diff --git a/client/client.go b/client/client.go index e3ac867..ad67a7c 100644 --- a/client/client.go +++ b/client/client.go @@ -86,15 +86,15 @@ func NewClient(authorizationStateHandler AuthorizationStateHandler, options ...O client.extraGenerator = UuidV4Generator() client.catchTimeout = 60 * time.Second - for _, option := range options { - option(client) - } - tdlibInstance.addClient(client) go client.processPendingResponse() go client.receiver() + for _, option := range options { + go option(client) + } + err := Authorize(client, authorizationStateHandler) if err != nil { return nil, err @@ -116,7 +116,7 @@ func (client *Client) processResponse(response *Response) { return } - if typ.GetType() == (&UpdateMessageSendSucceeded{}).GetType() { + if !client.DisablePatch && typ.GetType() == (&UpdateMessageSendSucceeded{}).GetType() { sendVal, sOk := client.successMsgStore.Load(typ.(*UpdateMessageSendSucceeded).OldMessageId) if sOk { sendVal.(chan *Response) <- response @@ -134,7 +134,18 @@ func (client *Client) processResponse(response *Response) { needGc := false for _, listener := range client.listenerStore.Listeners() { if listener.IsActive() && listener.Updates != nil && typ.GetType() == listener.Filter.GetType() { // All updates go to Updates channel if type == filter - listener.Updates <- typ + // Make some delay to UpdateMessageSendSucceeded listener + // This can make UpdateMessageSendSucceeded response later than sendMessage response. + // This may help a bot developer to map temporary message id to actual message id easily. + // Cause an event listener slower than sendMessage response, so you have enough time to do mapping stuff. + if typ.GetType() == (&UpdateMessageSendSucceeded{}).GetType() { + go func(listener *Listener, typ Type) { + time.Sleep(5 * time.Millisecond) + listener.Updates <- typ + }(listener, typ) + } else { + listener.Updates <- typ + } } else if listener.IsActive() && listener.RawUpdates != nil { // All updates go to RawUpdates channel if filter is empty listener.RawUpdates <- typ } else if !listener.IsActive() { // GC inactive listener @@ -144,6 +155,10 @@ func (client *Client) processResponse(response *Response) { if needGc { client.listenerStore.gc() } + + if typ.GetType() == TypeUpdateAuthorizationState && typ.(*UpdateAuthorizationState).AuthorizationState.AuthorizationStateType() == TypeAuthorizationStateClosed { + close(client.responses) + } } func (client *Client) receiver() { @@ -246,7 +261,3 @@ func (client *Client) AddEventReceiver(msgType Type, channelCapacity int) *Liste return listener } - -func (client *Client) Stop() { - client.Destroy() -} diff --git a/client/extra.go b/client/extra.go index 1a82ea9..9b32fc9 100644 --- a/client/extra.go +++ b/client/extra.go @@ -15,41 +15,29 @@ func UuidV4Generator() ExtraGenerator { } func IsCommand(text string) bool { - if text != "" { - if text[0] == '/' { - return true - } + if i := strings.Index(text, "/"); i == 0 { + return true } return false } func CheckCommand(text string, entities []*TextEntity) string { if IsCommand(text) { - // Check text entities and make bot happy! - if len(entities) >= 1 { - // Get first command - if entities[0].Type.TextEntityTypeType() == "textEntityTypeBotCommand" { - // e.g.: { "text": "/hello@world_bot", "textEntity": { offset: 0, length: 16 } } - // Result: "/hello" - if i := strings.Index(text[:entities[0].Length], "@"); i != -1 { - return text[:i] - } - return text[:entities[0].Length] - } - } else { - // Since userbot does not have bot command entities in Private Chat, so make userbot happy too! - // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] - // Result: "/hello" - if i := strings.Index(text, "@"); i != -1 { - return text[:i] - } - // e.g. ["/hello 123", "/hell o 123"] - // Result: "/hello", "/hell" - if i := strings.Index(text, " "); i != -1 { - return text[:i] - } - return text + cmd := text + + // e.g. ["/hello 123", "/hell o 123"] + // Result: "/hello", "/hell" + if i := strings.Index(cmd, " "); i != -1 { + cmd = cmd[:i] } + + // e.g.: ["/hello@world_bot", "/hello@", "/hello@123"] + // Result: "/hello" + if i := strings.Index(cmd, "@"); i != -1 { + cmd = cmd[:i] + } + + return cmd } return "" } diff --git a/client/function.go b/client/function.go index 52c8bcb..cbd2cde 100755 --- a/client/function.go +++ b/client/function.go @@ -6,7 +6,7 @@ import ( "errors" ) -// Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization +// Returns the current authorization state. This is an offline method. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state. Can be called before initialization func (client *Client) GetAuthorizationState() (AuthorizationState, error) { result, err := client.Send(Request{ meta: meta{ @@ -29,6 +29,9 @@ func (client *Client) GetAuthorizationState() (AuthorizationState, error) { case TypeAuthorizationStateWaitPhoneNumber: return UnmarshalAuthorizationStateWaitPhoneNumber(result.Data) + case TypeAuthorizationStateWaitPremiumPurchase: + return UnmarshalAuthorizationStateWaitPremiumPurchase(result.Data) + case TypeAuthorizationStateWaitEmailAddress: return UnmarshalAuthorizationStateWaitEmailAddress(result.Data) @@ -93,10 +96,6 @@ type SetTdlibParametersRequest struct { SystemVersion string `json:"system_version"` // Application version; must be non-empty ApplicationVersion string `json:"application_version"` - // Pass true to automatically delete old files in background - EnableStorageOptimizer bool `json:"enable_storage_optimizer"` - // Pass true to ignore original file names for downloaded files. Otherwise, downloaded files are saved under names as close as possible to the original name - IgnoreFileNames bool `json:"ignore_file_names"` } // Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters @@ -120,8 +119,6 @@ func (client *Client) SetTdlibParameters(req *SetTdlibParametersRequest) (*Ok, e "device_model": req.DeviceModel, "system_version": req.SystemVersion, "application_version": req.ApplicationVersion, - "enable_storage_optimizer": req.EnableStorageOptimizer, - "ignore_file_names": req.IgnoreFileNames, }, }) if err != nil { @@ -142,7 +139,7 @@ type SetAuthenticationPhoneNumberRequest struct { Settings *PhoneNumberAuthenticationSettings `json:"settings"` } -// Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +// Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNumberRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -164,6 +161,70 @@ func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNu return UnmarshalOk(result.Data) } +type CheckAuthenticationPremiumPurchaseRequest struct { + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` +} + +// Checks whether an in-store purchase of Telegram Premium is possible before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase +func (client *Client) CheckAuthenticationPremiumPurchase(req *CheckAuthenticationPremiumPurchaseRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkAuthenticationPremiumPurchase", + }, + Data: map[string]interface{}{ + "currency": req.Currency, + "amount": req.Amount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetAuthenticationPremiumPurchaseTransactionRequest struct { + // Information about the transaction + Transaction StoreTransaction `json:"transaction"` + // Pass true if this is a restore of a Telegram Premium purchase; only for App Store + IsRestore bool `json:"is_restore"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` +} + +// Informs server about an in-store purchase of Telegram Premium before authorization. Works only when the current authorization state is authorizationStateWaitPremiumPurchase +func (client *Client) SetAuthenticationPremiumPurchaseTransaction(req *SetAuthenticationPremiumPurchaseTransactionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAuthenticationPremiumPurchaseTransaction", + }, + Data: map[string]interface{}{ + "transaction": req.Transaction, + "is_restore": req.IsRestore, + "currency": req.Currency, + "amount": req.Amount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetAuthenticationEmailAddressRequest struct { // The email address of the user EmailAddress string `json:"email_address"` @@ -190,13 +251,20 @@ func (client *Client) SetAuthenticationEmailAddress(req *SetAuthenticationEmailA return UnmarshalOk(result.Data) } +type ResendAuthenticationCodeRequest struct { + // Reason of code resending; pass null if unknown + Reason ResendCodeReason `json:"reason"` +} + // Resends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode, the next_code_type of the result is not null and the server-specified timeout has passed, or when the current authorization state is authorizationStateWaitEmailCode -func (client *Client) ResendAuthenticationCode() (*Ok, error) { +func (client *Client) ResendAuthenticationCode(req *ResendAuthenticationCodeRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "resendAuthenticationCode", }, - Data: map[string]interface{}{}, + Data: map[string]interface{}{ + "reason": req.Reason, + }, }) if err != nil { return nil, err @@ -214,7 +282,7 @@ type CheckAuthenticationEmailCodeRequest struct { Code EmailAddressAuthentication `json:"code"` } -// Checks the authentication of a email address. Works only when the current authorization state is authorizationStateWaitEmailCode +// Checks the authentication of an email address. Works only when the current authorization state is authorizationStateWaitEmailCode func (client *Client) CheckAuthenticationEmailCode(req *CheckAuthenticationEmailCodeRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -266,7 +334,7 @@ type RequestQrCodeAuthenticationRequest struct { OtherUserIds []int64 `json:"other_user_ids"` } -// Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +// Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword func (client *Client) RequestQrCodeAuthentication(req *RequestQrCodeAuthenticationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -287,11 +355,70 @@ func (client *Client) RequestQrCodeAuthentication(req *RequestQrCodeAuthenticati return UnmarshalOk(result.Data) } +// Returns parameters for authentication using a passkey as JSON-serialized string +func (client *Client) GetAuthenticationPasskeyParameters() (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAuthenticationPasskeyParameters", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type CheckAuthenticationPasskeyRequest struct { + // Base64url-encoded identifier of the credential + CredentialId string `json:"credential_id"` + // JSON-encoded client data + ClientData string `json:"client_data"` + // Authenticator data of the application that created the credential + AuthenticatorData []byte `json:"authenticator_data"` + // Cryptographic signature of the credential + Signature []byte `json:"signature"` + // User handle of the passkey + UserHandle []byte `json:"user_handle"` +} + +// Checks a passkey to log in to the corresponding account. Call getAuthenticationPasskeyParameters to get parameters for the passkey. Works only when the current authorization state is authorizationStateWaitPhoneNumber or authorizationStateWaitOtherDeviceConfirmation, or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword +func (client *Client) CheckAuthenticationPasskey(req *CheckAuthenticationPasskeyRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkAuthenticationPasskey", + }, + Data: map[string]interface{}{ + "credential_id": req.CredentialId, + "client_data": req.ClientData, + "authenticator_data": req.AuthenticatorData, + "signature": req.Signature, + "user_handle": req.UserHandle, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type RegisterUserRequest struct { // The first name of the user; 1-64 characters FirstName string `json:"first_name"` // The last name of the user; 0-64 characters LastName string `json:"last_name"` + // Pass true to disable notification about the current user joining Telegram for other users that added them to contact list + DisableNotification bool `json:"disable_notification"` } // Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration @@ -303,6 +430,7 @@ func (client *Client) RegisterUser(req *RegisterUserRequest) (*Ok, error) { Data: map[string]interface{}{ "first_name": req.FirstName, "last_name": req.LastName, + "disable_notification": req.DisableNotification, }, }) if err != nil { @@ -439,7 +567,7 @@ func (client *Client) RecoverAuthenticationPassword(req *RecoverAuthenticationPa } type SendAuthenticationFirebaseSmsRequest struct { - // SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application + // Play Integrity API or SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application Token string `json:"token"` } @@ -464,6 +592,32 @@ func (client *Client) SendAuthenticationFirebaseSms(req *SendAuthenticationFireb return UnmarshalOk(result.Data) } +type ReportAuthenticationCodeMissingRequest struct { + // Current mobile network code + MobileNetworkCode string `json:"mobile_network_code"` +} + +// Reports that authentication code wasn't delivered via SMS; for official mobile applications only. Works only when the current authorization state is authorizationStateWaitCode +func (client *Client) ReportAuthenticationCodeMissing(req *ReportAuthenticationCodeMissingRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportAuthenticationCodeMissing", + }, + Data: map[string]interface{}{ + "mobile_network_code": req.MobileNetworkCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type CheckAuthenticationBotTokenRequest struct { // The bot token Token string `json:"token"` @@ -675,12 +829,31 @@ func (client *Client) SetPassword(req *SetPasswordRequest) (*PasswordState, erro return UnmarshalPasswordState(result.Data) } +// Checks whether the current user is required to set login email address +func (client *Client) IsLoginEmailAddressRequired() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "isLoginEmailAddressRequired", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetLoginEmailAddressRequest struct { // New login email address NewLoginEmailAddress string `json:"new_login_email_address"` } -// Changes the login email address of the user. The email address can be changed only if the current user already has login email and passwordState.login_email_address_pattern is non-empty. The change will not be applied until the new login email address is confirmed with checkLoginEmailAddressCode. To use Apple ID/Google ID instead of a email address, call checkLoginEmailAddressCode directly +// Changes the login email address of the user. The email address can be changed only if the current user already has login email and passwordState.login_email_address_pattern is non-empty, or the user received suggestedActionSetLoginEmailAddress and isLoginEmailAddressRequired succeeds. The change will not be applied until the new login email address is confirmed with checkLoginEmailAddressCode. To use Apple ID/Google ID instead of an email address, call checkLoginEmailAddressCode directly func (client *Client) SetLoginEmailAddress(req *SetLoginEmailAddressRequest) (*EmailAddressAuthenticationCodeInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -846,6 +1019,25 @@ func (client *Client) ResendRecoveryEmailAddressCode() (*PasswordState, error) { return UnmarshalPasswordState(result.Data) } +// Cancels verification of the 2-step verification recovery email address +func (client *Client) CancelRecoveryEmailAddressVerification() (*PasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "cancelRecoveryEmailAddressVerification", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasswordState(result.Data) +} + // Requests to send a 2-step verification password recovery code to an email address that was previously set up func (client *Client) RequestPasswordRecovery() (*EmailAddressAuthenticationCodeInfo, error) { result, err := client.Send(Request{ @@ -1045,7 +1237,7 @@ type GetUserRequest struct { UserId int64 `json:"user_id"` } -// Returns information about a user by their identifier. This is an offline request if the current user is not a bot +// Returns information about a user by their identifier. This is an offline method if the current user is not a bot func (client *Client) GetUser(req *GetUserRequest) (*User, error) { result, err := client.Send(Request{ meta: meta{ @@ -1097,7 +1289,7 @@ type GetBasicGroupRequest struct { BasicGroupId int64 `json:"basic_group_id"` } -// Returns information about a basic group by its identifier. This is an offline request if the current user is not a bot +// Returns information about a basic group by its identifier. This is an offline method if the current user is not a bot func (client *Client) GetBasicGroup(req *GetBasicGroupRequest) (*BasicGroup, error) { result, err := client.Send(Request{ meta: meta{ @@ -1149,7 +1341,7 @@ type GetSupergroupRequest struct { SupergroupId int64 `json:"supergroup_id"` } -// Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot +// Returns information about a supergroup or a channel by its identifier. This is an offline method if the current user is not a bot func (client *Client) GetSupergroup(req *GetSupergroupRequest) (*Supergroup, error) { result, err := client.Send(Request{ meta: meta{ @@ -1201,7 +1393,7 @@ type GetSecretChatRequest struct { SecretChatId int32 `json:"secret_chat_id"` } -// Returns information about a secret chat by its identifier. This is an offline request +// Returns information about a secret chat by its identifier. This is an offline method func (client *Client) GetSecretChat(req *GetSecretChatRequest) (*SecretChat, error) { result, err := client.Send(Request{ meta: meta{ @@ -1227,7 +1419,7 @@ type GetChatRequest struct { ChatId int64 `json:"chat_id"` } -// Returns information about a chat by its identifier; this is an offline request if the current user is not a bot +// Returns information about a chat by its identifier. This is an offline method if the current user is not a bot func (client *Client) GetChat(req *GetChatRequest) (*Chat, error) { result, err := client.Send(Request{ meta: meta{ @@ -1255,7 +1447,7 @@ type GetMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message +// Returns information about a message. Returns a 404 error if the message doesn't exist func (client *Client) GetMessage(req *GetMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1284,7 +1476,7 @@ type GetMessageLocallyRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message, if it is available without sending network request. This is an offline request +// Returns information about a message, if it is available without sending network request. Returns a 404 error if message isn't available locally. This is an offline method func (client *Client) GetMessageLocally(req *GetMessageLocallyRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1313,7 +1505,7 @@ type GetRepliedMessageRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message that is replied by a given message. Also, returns the pinned message, the game message, the invoice message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground and topic messages without replied message respectively +// Returns information about a non-bundled message that is replied by a given message. Also, returns the pinned message for messagePinMessage, the game message for messageGameScore, the invoice message for messagePaymentSuccessful, the message with a previously set same background for messageChatSetBackground, the giveaway message for messageGiveawayCompleted, the checklist message for messageChecklistTasksDone, messageChecklistTasksAdded, the message with suggested post information for messageSuggestedPostApprovalFailed, messageSuggestedPostApproved, messageSuggestedPostDeclined, messageSuggestedPostPaid, messageSuggestedPostRefunded, the message with the regular gift that was upgraded for messageUpgradedGift with origin of the type upgradedGiftOriginUpgrade, the message with gift purchase offer for messageUpgradedGiftPurchaseOfferRejected, and the topic creation message for topic messages without non-bundled replied message. Returns a 404 error if the message doesn't exist func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1340,7 +1532,7 @@ type GetChatPinnedMessageRequest struct { ChatId int64 `json:"chat_id"` } -// Returns information about a newest pinned message in the chat +// Returns information about a newest pinned message in the chat. Returns a 404 error if the message doesn't exist func (client *Client) GetChatPinnedMessage(req *GetChatPinnedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1422,6 +1614,35 @@ func (client *Client) GetMessages(req *GetMessagesRequest) (*Messages, error) { return UnmarshalMessages(result.Data) } +type GetMessagePropertiesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns properties of a message. This is an offline method +func (client *Client) GetMessageProperties(req *GetMessagePropertiesRequest) (*MessageProperties, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageProperties", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageProperties(result.Data) +} + type GetMessageThreadRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -1429,7 +1650,7 @@ type GetMessageThreadRequest struct { MessageId int64 `json:"message_id"` } -// Returns information about a message thread. Can be used only if message.can_get_message_thread == true +// Returns information about a message thread. Can be used only if messageProperties.can_get_message_thread == true func (client *Client) GetMessageThread(req *GetMessageThreadRequest) (*MessageThreadInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -1451,6 +1672,53 @@ func (client *Client) GetMessageThread(req *GetMessageThreadRequest) (*MessageTh return UnmarshalMessageThreadInfo(result.Data) } +type GetMessageReadDateRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns read date of a recent outgoing message in a private chat. The method can be called if messageProperties.can_get_read_date == true +func (client *Client) GetMessageReadDate(req *GetMessageReadDateRequest) (MessageReadDate, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageReadDate", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeMessageReadDateRead: + return UnmarshalMessageReadDateRead(result.Data) + + case TypeMessageReadDateUnread: + return UnmarshalMessageReadDateUnread(result.Data) + + case TypeMessageReadDateTooOld: + return UnmarshalMessageReadDateTooOld(result.Data) + + case TypeMessageReadDateUserPrivacyRestricted: + return UnmarshalMessageReadDateUserPrivacyRestricted(result.Data) + + case TypeMessageReadDateMyPrivacyRestricted: + return UnmarshalMessageReadDateMyPrivacyRestricted(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type GetMessageViewersRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -1458,7 +1726,7 @@ type GetMessageViewersRequest struct { MessageId int64 `json:"message_id"` } -// Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if message.can_get_viewers == true +// Returns viewers of a recent outgoing message in a basic group or a supergroup chat. For video notes and voice notes only users, opened content of the message, are returned. The method can be called if messageProperties.can_get_viewers == true func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*MessageViewers, error) { result, err := client.Send(Request{ meta: meta{ @@ -1480,12 +1748,41 @@ func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*Message return UnmarshalMessageViewers(result.Data) } +type GetMessageAuthorRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns information about actual author of a message sent on behalf of a channel. The method can be called if messageProperties.can_get_author == true +func (client *Client) GetMessageAuthor(req *GetMessageAuthorRequest) (*User, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageAuthor", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUser(result.Data) +} + type GetFileRequest struct { // Identifier of the file to get FileId int32 `json:"file_id"` } -// Returns information about a file; this is an offline request +// Returns information about a file. This is an offline method func (client *Client) GetFile(req *GetFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -1513,7 +1810,7 @@ type GetRemoteFileRequest struct { FileType FileType `json:"file_type"` } -// Returns information about a file by its remote identifier; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application +// Returns information about a file by its remote identifier. This is an offline method. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application func (client *Client) GetRemoteFile(req *GetRemoteFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -1652,7 +1949,7 @@ type SearchChatsRequest struct { Limit int32 `json:"limit"` } -// Searches for the specified query in the title and username of already known chats; this is an offline request. Returns chats in the order seen in the main chat list +// Searches for the specified query in the title and username of already known chats. This is an offline method. Returns chats in the order seen in the main chat list func (client *Client) SearchChats(req *SearchChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -1703,19 +2000,38 @@ func (client *Client) SearchChatsOnServer(req *SearchChatsOnServerRequest) (*Cha return UnmarshalChats(result.Data) } -type SearchChatsNearbyRequest struct { - // Current user location - Location *Location `json:"location"` -} - -// Returns a list of users and location-based supergroups nearby. The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. The request must be sent again every 25 seconds with adjusted location to not miss new chats -func (client *Client) SearchChatsNearby(req *SearchChatsNearbyRequest) (*ChatsNearby, error) { +// Returns a list of channel chats recommended to the current user +func (client *Client) GetRecommendedChats() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ - Type: "searchChatsNearby", + Type: "getRecommendedChats", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type GetChatSimilarChatsRequest struct { + // Identifier of the target chat; must be an identifier of a channel chat + ChatId int64 `json:"chat_id"` +} + +// Returns a list of chats similar to the given chat +func (client *Client) GetChatSimilarChats(req *GetChatSimilarChatsRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatSimilarChats", }, Data: map[string]interface{}{ - "location": req.Location, + "chat_id": req.ChatId, }, }) if err != nil { @@ -1726,7 +2042,149 @@ func (client *Client) SearchChatsNearby(req *SearchChatsNearbyRequest) (*ChatsNe return nil, buildResponseError(result.Data) } - return UnmarshalChatsNearby(result.Data) + return UnmarshalChats(result.Data) +} + +type GetChatSimilarChatCountRequest struct { + // Identifier of the target chat; must be an identifier of a channel chat + ChatId int64 `json:"chat_id"` + // Pass true to get the number of chats without sending network requests, or -1 if the number of chats is unknown locally + ReturnLocal bool `json:"return_local"` +} + +// Returns approximate number of chats similar to the given chat +func (client *Client) GetChatSimilarChatCount(req *GetChatSimilarChatCountRequest) (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatSimilarChatCount", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "return_local": req.ReturnLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + +type OpenChatSimilarChatRequest struct { + // Identifier of the original chat, which similar chats were requested + ChatId int64 `json:"chat_id"` + // Identifier of the opened chat + OpenedChatId int64 `json:"opened_chat_id"` +} + +// Informs TDLib that a chat was opened from the list of similar chats. The method is independent of openChat and closeChat methods +func (client *Client) OpenChatSimilarChat(req *OpenChatSimilarChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openChatSimilarChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "opened_chat_id": req.OpenedChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBotSimilarBotsRequest struct { + // User identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Returns a list of bots similar to the given bot +func (client *Client) GetBotSimilarBots(req *GetBotSimilarBotsRequest) (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotSimilarBots", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + +type GetBotSimilarBotCountRequest struct { + // User identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // Pass true to get the number of bots without sending network requests, or -1 if the number of bots is unknown locally + ReturnLocal bool `json:"return_local"` +} + +// Returns approximate number of bots similar to the given bot +func (client *Client) GetBotSimilarBotCount(req *GetBotSimilarBotCountRequest) (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotSimilarBotCount", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "return_local": req.ReturnLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + +type OpenBotSimilarBotRequest struct { + // Identifier of the original bot, which similar bots were requested + BotUserId int64 `json:"bot_user_id"` + // Identifier of the opened bot + OpenedBotUserId int64 `json:"opened_bot_user_id"` +} + +// Informs TDLib that a bot was opened from the list of similar bots +func (client *Client) OpenBotSimilarBot(req *OpenBotSimilarBotRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openBotSimilarBot", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "opened_bot_user_id": req.OpenedBotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) } type GetTopChatsRequest struct { @@ -1794,7 +2252,7 @@ type SearchRecentlyFoundChatsRequest struct { Limit int32 `json:"limit"` } -// Searches for the specified query in the title and username of up to 50 recently found chats; this is an offline request +// Searches for the specified query in the title and username of up to 50 recently found chats. This is an offline method func (client *Client) SearchRecentlyFoundChats(req *SearchRecentlyFoundChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -1892,7 +2350,7 @@ type GetRecentlyOpenedChatsRequest struct { Limit int32 `json:"limit"` } -// Returns recently opened chats; this is an offline request. Returns chats in the order of last opening +// Returns recently opened chats. This is an offline method. Returns chats in the order of last opening func (client *Client) GetRecentlyOpenedChats(req *GetRecentlyOpenedChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -2034,7 +2492,7 @@ func (client *Client) GetSuitableDiscussionChats() (*Chats, error) { return UnmarshalChats(result.Data) } -// Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error. Also, the limit can be increased with Telegram Premium +// Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives the error "CHANNELS_TOO_MUCH". Also, the limit can be increased with Telegram Premium func (client *Client) GetInactiveSupergroupChats() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -2053,6 +2511,574 @@ func (client *Client) GetInactiveSupergroupChats() (*Chats, error) { return UnmarshalChats(result.Data) } +// Returns a list of channel chats, which can be used as a personal chat +func (client *Client) GetSuitablePersonalChats() (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSuitablePersonalChats", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type LoadDirectMessagesChatTopicsRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached + Limit int32 `json:"limit"` +} + +// Loads more topics in a channel direct messages chat administered by the current user. The loaded topics will be sent through updateDirectMessagesChatTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded +func (client *Client) LoadDirectMessagesChatTopics(req *LoadDirectMessagesChatTopicsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "loadDirectMessagesChatTopics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetDirectMessagesChatTopicRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic to get + TopicId int64 `json:"topic_id"` +} + +// Returns information about the topic in a channel direct messages chat administered by the current user +func (client *Client) GetDirectMessagesChatTopic(req *GetDirectMessagesChatTopicRequest) (*DirectMessagesChatTopic, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopic", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalDirectMessagesChatTopic(result.Data) +} + +type GetDirectMessagesChatTopicHistoryRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be fetched + TopicId int64 `json:"topic_id"` + // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns messages in the topic in a channel direct messages chat administered by the current user. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) +func (client *Client) GetDirectMessagesChatTopicHistory(req *GetDirectMessagesChatTopicHistoryRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type GetDirectMessagesChatTopicMessageByDateRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be fetched + TopicId int64 `json:"topic_id"` + // Point in time (Unix timestamp) relative to which to search for messages + Date int32 `json:"date"` +} + +// Returns the last message sent in the topic in a channel direct messages chat administered by the current user no later than the specified date +func (client *Client) GetDirectMessagesChatTopicMessageByDate(req *GetDirectMessagesChatTopicMessageByDateRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicMessageByDate", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "date": req.Date, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type DeleteDirectMessagesChatTopicHistoryRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be deleted + TopicId int64 `json:"topic_id"` +} + +// Deletes all messages in the topic in a channel direct messages chat administered by the current user +func (client *Client) DeleteDirectMessagesChatTopicHistory(req *DeleteDirectMessagesChatTopicHistoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteDirectMessagesChatTopicHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteDirectMessagesChatTopicMessagesByDateRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the topic which messages will be deleted + TopicId int64 `json:"topic_id"` + // The minimum date of the messages to delete + MinDate int32 `json:"min_date"` + // The maximum date of the messages to delete + MaxDate int32 `json:"max_date"` +} + +// Deletes all messages between the specified dates in the topic in a channel direct messages chat administered by the current user. Messages sent in the last 30 seconds will not be deleted +func (client *Client) DeleteDirectMessagesChatTopicMessagesByDate(req *DeleteDirectMessagesChatTopicMessagesByDateRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteDirectMessagesChatTopicMessagesByDate", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "min_date": req.MinDate, + "max_date": req.MaxDate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetDirectMessagesChatTopicIsMarkedAsUnreadRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` + // New value of is_marked_as_unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` +} + +// Changes the marked as unread state of the topic in a channel direct messages chat administered by the current user +func (client *Client) SetDirectMessagesChatTopicIsMarkedAsUnread(req *SetDirectMessagesChatTopicIsMarkedAsUnreadRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setDirectMessagesChatTopicIsMarkedAsUnread", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "is_marked_as_unread": req.IsMarkedAsUnread, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type UnpinAllDirectMessagesChatTopicMessagesRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` +} + +// Removes all pinned messages from the topic in a channel direct messages chat administered by the current user +func (client *Client) UnpinAllDirectMessagesChatTopicMessages(req *UnpinAllDirectMessagesChatTopicMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "unpinAllDirectMessagesChatTopicMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReadAllDirectMessagesChatTopicReactionsRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Topic identifier + TopicId int64 `json:"topic_id"` +} + +// Removes all unread reactions in the topic in a channel direct messages chat administered by the current user +func (client *Client) ReadAllDirectMessagesChatTopicReactions(req *ReadAllDirectMessagesChatTopicReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readAllDirectMessagesChatTopicReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetDirectMessagesChatTopicRevenueRequest struct { + // Chat identifier of the channel direct messages chat administered by the current user + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId int64 `json:"topic_id"` +} + +// Returns the total number of Telegram Stars received by the channel chat for direct messages from the given topic +func (client *Client) GetDirectMessagesChatTopicRevenue(req *GetDirectMessagesChatTopicRevenueRequest) (*StarCount, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDirectMessagesChatTopicRevenue", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarCount(result.Data) +} + +type ToggleDirectMessagesChatTopicCanSendUnpaidMessagesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId int64 `json:"topic_id"` + // Pass true to allow unpaid messages; pass false to disallow unpaid messages + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` + // Pass true to refund the user previously paid messages + RefundPayments bool `json:"refund_payments"` +} + +// Allows to send unpaid messages to the given topic of the channel direct messages chat administered by the current user +func (client *Client) ToggleDirectMessagesChatTopicCanSendUnpaidMessages(req *ToggleDirectMessagesChatTopicCanSendUnpaidMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleDirectMessagesChatTopicCanSendUnpaidMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "topic_id": req.TopicId, + "can_send_unpaid_messages": req.CanSendUnpaidMessages, + "refund_payments": req.RefundPayments, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type LoadSavedMessagesTopicsRequest struct { + // The maximum number of topics to be loaded. For optimal performance, the number of loaded topics is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached + Limit int32 `json:"limit"` +} + +// Loads more Saved Messages topics. The loaded topics will be sent through updateSavedMessagesTopic. Topics are sorted by their topic.order in descending order. Returns a 404 error if all topics have been loaded +func (client *Client) LoadSavedMessagesTopics(req *LoadSavedMessagesTopicsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "loadSavedMessagesTopics", + }, + Data: map[string]interface{}{ + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetSavedMessagesTopicHistoryRequest struct { + // Identifier of Saved Messages topic which messages will be fetched + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns messages in a Saved Messages topic. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) +func (client *Client) GetSavedMessagesTopicHistory(req *GetSavedMessagesTopicHistoryRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSavedMessagesTopicHistory", + }, + Data: map[string]interface{}{ + "saved_messages_topic_id": req.SavedMessagesTopicId, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + +type GetSavedMessagesTopicMessageByDateRequest struct { + // Identifier of Saved Messages topic which message will be returned + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // Point in time (Unix timestamp) relative to which to search for messages + Date int32 `json:"date"` +} + +// Returns the last message sent in a Saved Messages topic no later than the specified date +func (client *Client) GetSavedMessagesTopicMessageByDate(req *GetSavedMessagesTopicMessageByDateRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSavedMessagesTopicMessageByDate", + }, + Data: map[string]interface{}{ + "saved_messages_topic_id": req.SavedMessagesTopicId, + "date": req.Date, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +type DeleteSavedMessagesTopicHistoryRequest struct { + // Identifier of Saved Messages topic which messages will be deleted + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` +} + +// Deletes all messages in a Saved Messages topic +func (client *Client) DeleteSavedMessagesTopicHistory(req *DeleteSavedMessagesTopicHistoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteSavedMessagesTopicHistory", + }, + Data: map[string]interface{}{ + "saved_messages_topic_id": req.SavedMessagesTopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteSavedMessagesTopicMessagesByDateRequest struct { + // Identifier of Saved Messages topic which messages will be deleted + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // The minimum date of the messages to delete + MinDate int32 `json:"min_date"` + // The maximum date of the messages to delete + MaxDate int32 `json:"max_date"` +} + +// Deletes all messages between the specified dates in a Saved Messages topic. Messages sent in the last 30 seconds will not be deleted +func (client *Client) DeleteSavedMessagesTopicMessagesByDate(req *DeleteSavedMessagesTopicMessagesByDateRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteSavedMessagesTopicMessagesByDate", + }, + Data: map[string]interface{}{ + "saved_messages_topic_id": req.SavedMessagesTopicId, + "min_date": req.MinDate, + "max_date": req.MaxDate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleSavedMessagesTopicIsPinnedRequest struct { + // Identifier of Saved Messages topic to pin or unpin + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // Pass true to pin the topic; pass false to unpin it + IsPinned bool `json:"is_pinned"` +} + +// Changes the pinned state of a Saved Messages topic. There can be up to getOption("pinned_saved_messages_topic_count_max") pinned topics. The limit can be increased with Telegram Premium +func (client *Client) ToggleSavedMessagesTopicIsPinned(req *ToggleSavedMessagesTopicIsPinnedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSavedMessagesTopicIsPinned", + }, + Data: map[string]interface{}{ + "saved_messages_topic_id": req.SavedMessagesTopicId, + "is_pinned": req.IsPinned, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetPinnedSavedMessagesTopicsRequest struct { + // Identifiers of the new pinned Saved Messages topics + SavedMessagesTopicIds []int64 `json:"saved_messages_topic_ids"` +} + +// Changes the order of pinned Saved Messages topics +func (client *Client) SetPinnedSavedMessagesTopics(req *SetPinnedSavedMessagesTopicsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPinnedSavedMessagesTopics", + }, + Data: map[string]interface{}{ + "saved_messages_topic_ids": req.SavedMessagesTopicIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetGroupsInCommonRequest struct { // User identifier UserId int64 `json:"user_id"` @@ -2090,15 +3116,15 @@ type GetChatHistoryRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` // Pass true to get only messages that are available without sending network requests OnlyLocal bool `json:"only_local"` } -// Returns messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib. This is an offline request if only_local is true +// Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib. This is an offline method if only_local is true func (client *Client) GetChatHistory(req *GetChatHistoryRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2130,13 +3156,13 @@ type GetMessageThreadHistoryRequest struct { MessageId int64 `json:"message_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } -// Returns messages in a message thread of a message. Can be used only if message.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib +// Returns messages in a message thread of a message. Can be used only if messageProperties.can_get_message_thread == true. Message thread of a channel message is in the channel's linked supergroup. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib func (client *Client) GetMessageThreadHistory(req *GetMessageThreadHistoryRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2222,23 +3248,23 @@ func (client *Client) DeleteChat(req *DeleteChatRequest) (*Ok, error) { type SearchChatMessagesRequest struct { // Identifier of the chat in which to search messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to search messages only in specific topic; pass null to search for messages in all topics + TopicId MessageTopic `json:"topic_id"` // Query to search for Query string `json:"query"` // Identifier of the sender of messages to search for; pass null to search for messages from any sender. Not supported in secret chats SenderId MessageSender `json:"sender_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages + // Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` // Additional filter for messages to search; pass null to search for all messages Filter SearchMessagesFilter `json:"filter"` - // If not 0, only messages in the specified thread will be returned; supergroups only - MessageThreadId int64 `json:"message_thread_id"` } -// Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. A combination of query, sender_id, filter and message_thread_id search criteria is expected to be supported, only if it is required for Telegram official application implementation +// Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query (searchSecretMessages must be used instead), or without an enabled message database. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit. A combination of query, sender_id, filter and topic_id search criteria is expected to be supported, only if it is required for Telegram official application implementation func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*FoundChatMessages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2246,13 +3272,13 @@ func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Found }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "query": req.Query, "sender_id": req.SenderId, "from_message_id": req.FromMessageId, "offset": req.Offset, "limit": req.Limit, "filter": req.Filter, - "message_thread_id": req.MessageThreadId, }, }) if err != nil { @@ -2277,6 +3303,8 @@ type SearchMessagesRequest struct { Limit int32 `json:"limit"` // Additional filter for messages to search; pass null to search for all messages. Filters searchMessagesFilterMention, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, searchMessagesFilterFailedToSend, and searchMessagesFilterPinned are unsupported in this function Filter SearchMessagesFilter `json:"filter"` + // Additional filter for type of the chat of the searched messages; pass null to search for messages in all chats + ChatTypeFilter SearchMessagesChatTypeFilter `json:"chat_type_filter"` // If not 0, the minimum date of the messages to return MinDate int32 `json:"min_date"` // If not 0, the maximum date of the messages to return @@ -2295,6 +3323,7 @@ func (client *Client) SearchMessages(req *SearchMessagesRequest) (*FoundMessages "offset": req.Offset, "limit": req.Limit, "filter": req.Filter, + "chat_type_filter": req.ChatTypeFilter, "min_date": req.MinDate, "max_date": req.MaxDate, }, @@ -2348,6 +3377,47 @@ func (client *Client) SearchSecretMessages(req *SearchSecretMessagesRequest) (*F return UnmarshalFoundMessages(result.Data) } +type SearchSavedMessagesRequest struct { + // If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // Tag to search for; pass null to return all suitable messages + Tag ReactionType `json:"tag"` + // Query to search for + Query string `json:"query"` + // Identifier of the message starting from which messages must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the message from_message_id or a negative number to get the specified message and some newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Searches for messages tagged by the given reaction and with the given words in the Saved Messages chat; for Telegram Premium users only. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchSavedMessages(req *SearchSavedMessagesRequest) (*FoundChatMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchSavedMessages", + }, + Data: map[string]interface{}{ + "saved_messages_topic_id": req.SavedMessagesTopicId, + "tag": req.Tag, + "query": req.Query, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundChatMessages(result.Data) +} + type SearchCallMessagesRequest struct { // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` @@ -2357,7 +3427,7 @@ type SearchCallMessagesRequest struct { OnlyMissed bool `json:"only_missed"` } -// Searches for call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib +// Searches for call and group call messages. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib func (client *Client) SearchCallMessages(req *SearchCallMessagesRequest) (*FoundMessages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2409,6 +3479,282 @@ func (client *Client) SearchOutgoingDocumentMessages(req *SearchOutgoingDocument return UnmarshalFoundMessages(result.Data) } +type GetPublicPostSearchLimitsRequest struct { + // Query that will be searched for + Query string `json:"query"` +} + +// Checks public post search limits without actually performing the search +func (client *Client) GetPublicPostSearchLimits(req *GetPublicPostSearchLimitsRequest) (*PublicPostSearchLimits, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPublicPostSearchLimits", + }, + Data: map[string]interface{}{ + "query": req.Query, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPublicPostSearchLimits(result.Data) +} + +type SearchPublicPostsRequest struct { + // Query to search for + Query string `json:"query"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` + // The Telegram Star amount the user agreed to pay for the search; pass 0 for free searches + StarCount int64 `json:"star_count"` +} + +// Searches for public channel posts using the given query. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicPosts(req *SearchPublicPostsRequest) (*FoundPublicPosts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicPosts", + }, + Data: map[string]interface{}{ + "query": req.Query, + "offset": req.Offset, + "limit": req.Limit, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundPublicPosts(result.Data) +} + +type SearchPublicMessagesByTagRequest struct { + // Hashtag or cashtag to search for + Tag string `json:"tag"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of messages to be returned; up to 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Searches for public channel posts containing the given hashtag or cashtag. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicMessagesByTag(req *SearchPublicMessagesByTagRequest) (*FoundMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicMessagesByTag", + }, + Data: map[string]interface{}{ + "tag": req.Tag, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundMessages(result.Data) +} + +type SearchPublicStoriesByTagRequest struct { + // Identifier of the chat that posted the stories to search for; pass 0 to search stories in all chats + StoryPosterChatId int64 `json:"story_poster_chat_id"` + // Hashtag or cashtag to search for + Tag string `json:"tag"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Searches for public stories containing the given hashtag or cashtag. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicStoriesByTag(req *SearchPublicStoriesByTagRequest) (*FoundStories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicStoriesByTag", + }, + Data: map[string]interface{}{ + "story_poster_chat_id": req.StoryPosterChatId, + "tag": req.Tag, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundStories(result.Data) +} + +type SearchPublicStoriesByLocationRequest struct { + // Address of the location + Address *LocationAddress `json:"address"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Searches for public stories by the given address location. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicStoriesByLocation(req *SearchPublicStoriesByLocationRequest) (*FoundStories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicStoriesByLocation", + }, + Data: map[string]interface{}{ + "address": req.Address, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundStories(result.Data) +} + +type SearchPublicStoriesByVenueRequest struct { + // Provider of the venue + VenueProvider string `json:"venue_provider"` + // Identifier of the venue in the provider database + VenueId string `json:"venue_id"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of stories to be returned; up to 100. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Searches for public stories from the given venue. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit +func (client *Client) SearchPublicStoriesByVenue(req *SearchPublicStoriesByVenueRequest) (*FoundStories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchPublicStoriesByVenue", + }, + Data: map[string]interface{}{ + "venue_provider": req.VenueProvider, + "venue_id": req.VenueId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundStories(result.Data) +} + +type GetSearchedForTagsRequest struct { + // Prefix of hashtags or cashtags to return + TagPrefix string `json:"tag_prefix"` + // The maximum number of items to be returned + Limit int32 `json:"limit"` +} + +// Returns recently searched for hashtags or cashtags by their prefix +func (client *Client) GetSearchedForTags(req *GetSearchedForTagsRequest) (*Hashtags, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSearchedForTags", + }, + Data: map[string]interface{}{ + "tag_prefix": req.TagPrefix, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHashtags(result.Data) +} + +type RemoveSearchedForTagRequest struct { + // Hashtag or cashtag to delete + Tag string `json:"tag"` +} + +// Removes a hashtag or a cashtag from the list of recently searched for hashtags or cashtags +func (client *Client) RemoveSearchedForTag(req *RemoveSearchedForTagRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeSearchedForTag", + }, + Data: map[string]interface{}{ + "tag": req.Tag, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ClearSearchedForTagsRequest struct { + // Pass true to clear the list of recently searched for cashtags; otherwise, the list of recently searched for hashtags will be cleared + ClearCashtags bool `json:"clear_cashtags"` +} + +// Clears the list of recently searched for hashtags or cashtags +func (client *Client) ClearSearchedForTags(req *ClearSearchedForTagsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clearSearchedForTags", + }, + Data: map[string]interface{}{ + "clear_cashtags": req.ClearCashtags, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type DeleteAllCallMessagesRequest struct { // Pass true to delete the messages for all users Revoke bool `json:"revoke"` @@ -2464,25 +3810,6 @@ func (client *Client) SearchChatRecentLocationMessages(req *SearchChatRecentLoca return UnmarshalMessages(result.Data) } -// Returns all active live locations that need to be updated by the application. The list is persistent across application restarts only if the message database is used -func (client *Client) GetActiveLiveLocationMessages() (*Messages, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getActiveLiveLocationMessages", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalMessages(result.Data) -} - type GetChatMessageByDateRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -2490,7 +3817,7 @@ type GetChatMessageByDateRequest struct { Date int32 `json:"date"` } -// Returns the last message sent in a chat no later than the specified date +// Returns the last message sent in a chat no later than the specified date. Returns a 404 error if such message doesn't exist func (client *Client) GetChatMessageByDate(req *GetChatMessageByDateRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -2521,6 +3848,8 @@ type GetChatSparseMessagePositionsRequest struct { FromMessageId int64 `json:"from_message_id"` // The expected number of message positions to be returned; 50-2000. A smaller number of positions can be returned, if there are not enough appropriate messages Limit int32 `json:"limit"` + // If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all messages, or for chats other than Saved Messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` } // Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. Returns the results in reverse chronological order (i.e., in order of decreasing message_id). Cannot be used in secret chats or with searchMessagesFilterFailedToSend filter without an enabled message database @@ -2534,6 +3863,7 @@ func (client *Client) GetChatSparseMessagePositions(req *GetChatSparseMessagePos "filter": req.Filter, "from_message_id": req.FromMessageId, "limit": req.Limit, + "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -2550,6 +3880,8 @@ func (client *Client) GetChatSparseMessagePositions(req *GetChatSparseMessagePos type GetChatMessageCalendarRequest struct { // Identifier of the chat in which to return information about messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to get the result only in specific topic; pass null to get the result in all topics; forum topics and message threads aren't supported + TopicId MessageTopic `json:"topic_id"` // Filter for message content. Filters searchMessagesFilterEmpty, searchMessagesFilterMention, searchMessagesFilterUnreadMention, and searchMessagesFilterUnreadReaction are unsupported in this function Filter SearchMessagesFilter `json:"filter"` // The message identifier from which to return information about messages; use 0 to get results from the last message @@ -2564,6 +3896,7 @@ func (client *Client) GetChatMessageCalendar(req *GetChatMessageCalendarRequest) }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "filter": req.Filter, "from_message_id": req.FromMessageId, }, @@ -2582,13 +3915,15 @@ func (client *Client) GetChatMessageCalendar(req *GetChatMessageCalendarRequest) type GetChatMessageCountRequest struct { // Identifier of the chat in which to count messages ChatId int64 `json:"chat_id"` + // Pass topic identifier to get number of messages only in specific topic; pass null to get number of messages in all topics; message threads aren't supported + TopicId MessageTopic `json:"topic_id"` // Filter for message content; searchMessagesFilterEmpty is unsupported in this function Filter SearchMessagesFilter `json:"filter"` // Pass true to get the number of messages without sending network requests, or -1 if the number of messages is unknown locally ReturnLocal bool `json:"return_local"` } -// Returns approximate number of messages of the specified type in the chat +// Returns approximate number of messages of the specified type in the chat or its topic func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Count, error) { result, err := client.Send(Request{ meta: meta{ @@ -2596,6 +3931,7 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "topic_id": req.TopicId, "filter": req.Filter, "return_local": req.ReturnLocal, }, @@ -2614,15 +3950,15 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou type GetChatMessagePositionRequest struct { // Identifier of the chat in which to find message position ChatId int64 `json:"chat_id"` - // Message identifier - MessageId int64 `json:"message_id"` + // Pass topic identifier to get position among messages only in specific topic; pass null to get position among all chat messages; message threads aren't supported + TopicId MessageTopic `json:"topic_id"` // Filter for message content; searchMessagesFilterEmpty, searchMessagesFilterUnreadMention, searchMessagesFilterUnreadReaction, and searchMessagesFilterFailedToSend are unsupported in this function Filter SearchMessagesFilter `json:"filter"` - // If not 0, only messages in the specified thread will be considered; supergroups only - MessageThreadId int64 `json:"message_thread_id"` + // Message identifier + MessageId int64 `json:"message_id"` } -// Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat. Cannot be used in secret chats +// Returns approximate 1-based position of a message among messages, which can be found by the specified filter in the chat and topic. Cannot be used in secret chats func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) (*Count, error) { result, err := client.Send(Request{ meta: meta{ @@ -2630,9 +3966,9 @@ func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_id": req.MessageId, + "topic_id": req.TopicId, "filter": req.Filter, - "message_thread_id": req.MessageThreadId, + "message_id": req.MessageId, }, }) if err != nil { @@ -2651,7 +3987,7 @@ type GetChatScheduledMessagesRequest struct { ChatId int64 `json:"chat_id"` } -// Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) +// Returns all scheduled messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) func (client *Client) GetChatScheduledMessages(req *GetChatScheduledMessagesRequest) (*Messages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2677,7 +4013,7 @@ type GetChatSponsoredMessagesRequest struct { ChatId int64 `json:"chat_id"` } -// Returns sponsored messages to be shown in a chat; for channel chats only +// Returns sponsored messages to be shown in a chat; for channel chats and chats with bots only func (client *Client) GetChatSponsoredMessages(req *GetChatSponsoredMessagesRequest) (*SponsoredMessages, error) { result, err := client.Send(Request{ meta: meta{ @@ -2703,14 +4039,224 @@ type ClickChatSponsoredMessageRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the sponsored message MessageId int64 `json:"message_id"` + // Pass true if the media was clicked in the sponsored message + IsMediaClick bool `json:"is_media_click"` + // Pass true if the user expanded the video from the sponsored message fullscreen before the click + FromFullscreen bool `json:"from_fullscreen"` } -// Informs TDLib that the user opened the sponsored chat via the button, the name, the photo, or a mention in the sponsored message +// Informs TDLib that the user opened the sponsored chat via the button, the name, the chat photo, a mention in the sponsored message text, or the media in the sponsored message func (client *Client) ClickChatSponsoredMessage(req *ClickChatSponsoredMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "clickChatSponsoredMessage", }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "is_media_click": req.IsMediaClick, + "from_fullscreen": req.FromFullscreen, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReportChatSponsoredMessageRequest struct { + // Chat identifier of the sponsored message + ChatId int64 `json:"chat_id"` + // Identifier of the sponsored message + MessageId int64 `json:"message_id"` + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` +} + +// Reports a sponsored message to Telegram moderators +func (client *Client) ReportChatSponsoredMessage(req *ReportChatSponsoredMessageRequest) (ReportSponsoredResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportChatSponsoredMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "option_id": req.OptionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(result.Data) + + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(result.Data) + + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(result.Data) + + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(result.Data) + + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetSearchSponsoredChatsRequest struct { + // Query the user searches for + Query string `json:"query"` +} + +// Returns sponsored chats to be shown in the search results +func (client *Client) GetSearchSponsoredChats(req *GetSearchSponsoredChatsRequest) (*SponsoredChats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSearchSponsoredChats", + }, + Data: map[string]interface{}{ + "query": req.Query, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSponsoredChats(result.Data) +} + +type ViewSponsoredChatRequest struct { + // Unique identifier of the sponsored chat + SponsoredChatUniqueId int64 `json:"sponsored_chat_unique_id"` +} + +// Informs TDLib that the user fully viewed a sponsored chat +func (client *Client) ViewSponsoredChat(req *ViewSponsoredChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "viewSponsoredChat", + }, + Data: map[string]interface{}{ + "sponsored_chat_unique_id": req.SponsoredChatUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type OpenSponsoredChatRequest struct { + // Unique identifier of the sponsored chat + SponsoredChatUniqueId int64 `json:"sponsored_chat_unique_id"` +} + +// Informs TDLib that the user opened a sponsored chat +func (client *Client) OpenSponsoredChat(req *OpenSponsoredChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openSponsoredChat", + }, + Data: map[string]interface{}{ + "sponsored_chat_unique_id": req.SponsoredChatUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReportSponsoredChatRequest struct { + // Unique identifier of the sponsored chat + SponsoredChatUniqueId int64 `json:"sponsored_chat_unique_id"` + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` +} + +// Reports a sponsored chat to Telegram moderators +func (client *Client) ReportSponsoredChat(req *ReportSponsoredChatRequest) (ReportSponsoredResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportSponsoredChat", + }, + Data: map[string]interface{}{ + "sponsored_chat_unique_id": req.SponsoredChatUniqueId, + "option_id": req.OptionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(result.Data) + + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(result.Data) + + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(result.Data) + + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(result.Data) + + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetVideoMessageAdvertisementsRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns advertisements to be shown while a video from a message is watched. Available only if messageProperties.can_get_video_advertisements +func (client *Client) GetVideoMessageAdvertisements(req *GetVideoMessageAdvertisementsRequest) (*VideoMessageAdvertisements, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getVideoMessageAdvertisements", + }, Data: map[string]interface{}{ "chat_id": req.ChatId, "message_id": req.MessageId, @@ -2724,9 +4270,108 @@ func (client *Client) ClickChatSponsoredMessage(req *ClickChatSponsoredMessageRe return nil, buildResponseError(result.Data) } + return UnmarshalVideoMessageAdvertisements(result.Data) +} + +type ViewVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` +} + +// Informs TDLib that the user viewed a video message advertisement +func (client *Client) ViewVideoMessageAdvertisement(req *ViewVideoMessageAdvertisementRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "viewVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + return UnmarshalOk(result.Data) } +type ClickVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` +} + +// Informs TDLib that the user clicked a video message advertisement +func (client *Client) ClickVideoMessageAdvertisement(req *ClickVideoMessageAdvertisementRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clickVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReportVideoMessageAdvertisementRequest struct { + // Unique identifier of the advertisement + AdvertisementUniqueId int64 `json:"advertisement_unique_id"` + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` +} + +// Reports a video message advertisement to Telegram moderators +func (client *Client) ReportVideoMessageAdvertisement(req *ReportVideoMessageAdvertisementRequest) (ReportSponsoredResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportVideoMessageAdvertisement", + }, + Data: map[string]interface{}{ + "advertisement_unique_id": req.AdvertisementUniqueId, + "option_id": req.OptionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(result.Data) + + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(result.Data) + + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(result.Data) + + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(result.Data) + + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type RemoveNotificationRequest struct { // Identifier of notification group to which the notification belongs NotificationGroupId int32 `json:"notification_group_id"` @@ -2790,7 +4435,7 @@ type GetMessageLinkRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its web page preview + // If not 0, timestamp from which the video/audio/video note/voice note/story playing must start, in seconds. The media can be in the message content or in its link preview MediaTimestamp int32 `json:"media_timestamp"` // Pass true to create a link for the whole media album ForAlbum bool `json:"for_album"` @@ -2798,7 +4443,7 @@ type GetMessageLinkRequest struct { InMessageThread bool `json:"in_message_thread"` } -// Returns an HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels, or if message.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline request +// Returns an HTTPS link to a message in a chat. Available only if messageProperties.can_get_link, or if messageProperties.can_get_media_timestamp_links and a media timestamp link is generated. This is an offline method func (client *Client) GetMessageLink(req *GetMessageLinkRequest) (*MessageLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -2832,7 +4477,7 @@ type GetMessageEmbeddingCodeRequest struct { ForAlbum bool `json:"for_album"` } -// Returns an HTML code for embedding the message. Available only for messages in supergroups and channels with a username +// Returns an HTML code for embedding the message. Available only if messageProperties.can_get_embedding_code func (client *Client) GetMessageEmbeddingCode(req *GetMessageEmbeddingCodeRequest) (*Text, error) { result, err := client.Send(Request{ meta: meta{ @@ -2915,7 +4560,7 @@ type TranslateMessageTextRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Language code of the language to which the message is translated. Must be one of "af", "sq", "am", "ar", "hy", "az", "eu", "be", "bn", "bs", "bg", "ca", "ceb", "zh-CN", "zh", "zh-Hans", "zh-TW", "zh-Hant", "co", "hr", "cs", "da", "nl", "en", "eo", "et", "fi", "fr", "fy", "gl", "ka", "de", "el", "gu", "ht", "ha", "haw", "he", "iw", "hi", "hmn", "hu", "is", "ig", "id", "in", "ga", "it", "ja", "jv", "kn", "kk", "km", "rw", "ko", "ku", "ky", "lo", "la", "lv", "lt", "lb", "mk", "mg", "ms", "ml", "mt", "mi", "mr", "mn", "my", "ne", "no", "ny", "or", "ps", "fa", "pl", "pt", "pa", "ro", "ru", "sm", "gd", "sr", "st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu" + // Language code of the language to which the message is translated. See translateText.to_language_code for the list of supported values ToLanguageCode string `json:"to_language_code"` } @@ -2942,14 +4587,46 @@ func (client *Client) TranslateMessageText(req *TranslateMessageTextRequest) (*F return UnmarshalFormattedText(result.Data) } -type RecognizeSpeechRequest struct { +type SummarizeMessageRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` + // Pass a language code to which the summary will be translated; may be empty if translation isn't needed. See translateText.to_language_code for the list of supported values + TranslateToLanguageCode string `json:"translate_to_language_code"` } -// Recognizes speech in a video note or a voice note message. The message must be successfully sent and must not be scheduled. May return an error with a message "MSG_VOICE_TOO_LONG" if media duration is too big to be recognized +// Summarizes content of the message with non-empty summary_language_code +func (client *Client) SummarizeMessage(req *SummarizeMessageRequest) (*FormattedText, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "summarizeMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "translate_to_language_code": req.TranslateToLanguageCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFormattedText(result.Data) +} + +type RecognizeSpeechRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message. Use messageProperties.can_recognize_speech to check whether the message is suitable + MessageId int64 `json:"message_id"` +} + +// Recognizes speech in a video note or a voice note message func (client *Client) RecognizeSpeech(req *RecognizeSpeechRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3008,7 +4685,7 @@ type GetChatAvailableMessageSendersRequest struct { ChatId int64 `json:"chat_id"` } -// Returns list of message sender identifiers, which can be used to send messages in a chat +// Returns the list of message sender identifiers, which can be used to send messages in a chat func (client *Client) GetChatAvailableMessageSenders(req *GetChatAvailableMessageSendersRequest) (*ChatMessageSenders, error) { result, err := client.Send(Request{ meta: meta{ @@ -3061,8 +4738,8 @@ func (client *Client) SetChatMessageSender(req *SetChatMessageSenderRequest) (*O type SendMessageRequest struct { // Target chat ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the message will be sent - MessageThreadId int64 `json:"message_thread_id"` + // Topic in which the message will be sent; pass null if none + TopicId MessageTopic `json:"topic_id"` // Information about the message or story to be replied; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` // Options to be used to send the message; pass null to use default options @@ -3081,7 +4758,7 @@ func (client *Client) SendMessage(req *SendMessageRequest) (*Message, error) { }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "topic_id": req.TopicId, "reply_to": req.ReplyTo, "options": req.Options, "reply_markup": req.ReplyMarkup, @@ -3102,13 +4779,13 @@ func (client *Client) SendMessage(req *SendMessageRequest) (*Message, error) { type SendMessageAlbumRequest struct { // Target chat ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the messages will be sent - MessageThreadId int64 `json:"message_thread_id"` + // Topic in which the messages will be sent; pass null if none + TopicId MessageTopic `json:"topic_id"` // Information about the message or story to be replied; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` - // Contents of messages to be sent. At most 10 messages can be added to an album + // Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media InputMessageContents []InputMessageContent `json:"input_message_contents"` } @@ -3120,7 +4797,7 @@ func (client *Client) SendMessageAlbum(req *SendMessageAlbumRequest) (*Messages, }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "topic_id": req.TopicId, "reply_to": req.ReplyTo, "options": req.Options, "input_message_contents": req.InputMessageContents, @@ -3146,7 +4823,7 @@ type SendBotStartMessageRequest struct { Parameter string `json:"parameter"` } -// Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message +// Invites a bot to a chat (if it is not yet a member) and sends it the /start command; requires can_invite_users member right. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message func (client *Client) SendBotStartMessage(req *SendBotStartMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -3172,8 +4849,8 @@ func (client *Client) SendBotStartMessage(req *SendBotStartMessageRequest) (*Mes type SendInlineQueryResultMessageRequest struct { // Target chat ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the message will be sent - MessageThreadId int64 `json:"message_thread_id"` + // Topic in which the message will be sent; pass null if none + TopicId MessageTopic `json:"topic_id"` // Information about the message or story to be replied; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` // Options to be used to send the message; pass null to use default options @@ -3194,7 +4871,7 @@ func (client *Client) SendInlineQueryResultMessage(req *SendInlineQueryResultMes }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "topic_id": req.TopicId, "reply_to": req.ReplyTo, "options": req.Options, "query_id": req.QueryId, @@ -3216,15 +4893,15 @@ func (client *Client) SendInlineQueryResultMessage(req *SendInlineQueryResultMes type ForwardMessagesRequest struct { // Identifier of the chat to which to forward messages ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the message will be sent; for forum threads only - MessageThreadId int64 `json:"message_thread_id"` + // Topic in which the messages will be forwarded; message threads aren't supported; pass null if none + TopicId MessageTopic `json:"topic_id"` // Identifier of the chat from which to forward messages FromChatId int64 `json:"from_chat_id"` - // Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if message.can_be_forwarded + // Identifiers of the messages to forward. Message identifiers must be in a strictly increasing order. At most 100 messages can be forwarded simultaneously. A message can be forwarded only if messageProperties.can_be_forwarded MessageIds []int64 `json:"message_ids"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` - // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local + // Pass true to copy content of the messages without reference to the original sender. Always true if the messages are forwarded to a secret chat or are local. Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // Pass true to remove media captions of message copies. Ignored if send_copy is false RemoveCaption bool `json:"remove_caption"` @@ -3238,7 +4915,7 @@ func (client *Client) ForwardMessages(req *ForwardMessagesRequest) (*Messages, e }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "topic_id": req.TopicId, "from_chat_id": req.FromChatId, "message_ids": req.MessageIds, "options": req.Options, @@ -3257,13 +4934,47 @@ func (client *Client) ForwardMessages(req *ForwardMessagesRequest) (*Messages, e return UnmarshalMessages(result.Data) } +type SendQuickReplyShortcutMessagesRequest struct { + // Identifier of the chat to which to send messages. The chat must be a private chat with a regular user + ChatId int64 `json:"chat_id"` + // Unique identifier of the quick reply shortcut + ShortcutId int32 `json:"shortcut_id"` + // Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates + SendingId int32 `json:"sending_id"` +} + +// Sends messages from a quick reply shortcut. Requires Telegram Business subscription. Can't be used to send paid messages +func (client *Client) SendQuickReplyShortcutMessages(req *SendQuickReplyShortcutMessagesRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendQuickReplyShortcutMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "shortcut_id": req.ShortcutId, + "sending_id": req.SendingId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + type ResendMessagesRequest struct { // Identifier of the chat to send messages ChatId int64 `json:"chat_id"` // Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order MessageIds []int64 `json:"message_ids"` // New manually chosen quote from the message to be replied; pass null if none. Ignored if more than one message is re-sent, or if messageSendingStateFailed.need_another_reply_quote == false - Quote *FormattedText `json:"quote"` + Quote *InputTextQuote `json:"quote"` + // The number of Telegram Stars the user agreed to pay to send the messages. Ignored if messageSendingStateFailed.required_paid_message_star_count == 0 + PaidMessageStarCount int64 `json:"paid_message_star_count"` } // Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message @@ -3276,6 +4987,7 @@ func (client *Client) ResendMessages(req *ResendMessagesRequest) (*Messages, err "chat_id": req.ChatId, "message_ids": req.MessageIds, "quote": req.Quote, + "paid_message_star_count": req.PaidMessageStarCount, }, }) if err != nil { @@ -3316,7 +5028,7 @@ func (client *Client) SendChatScreenshotTakenNotification(req *SendChatScreensho } type AddLocalMessageRequest struct { - // Target chat + // Target chat; channel direct messages chats aren't supported ChatId int64 `json:"chat_id"` // Identifier of the sender of the message SenderId MessageSender `json:"sender_id"` @@ -3356,7 +5068,7 @@ func (client *Client) AddLocalMessage(req *AddLocalMessageRequest) (*Message, er type DeleteMessagesRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifiers of the messages to be deleted + // Identifiers of the messages to be deleted. Use messageProperties.can_be_deleted_only_for_self and messageProperties.can_be_deleted_for_all_users to get suitable messages MessageIds []int64 `json:"message_ids"` // Pass true to delete messages for all chat members. Always true for supergroups, channels and secret chats Revoke bool `json:"revoke"` @@ -3392,7 +5104,7 @@ type DeleteChatMessagesBySenderRequest struct { SenderId MessageSender `json:"sender_id"` } -// Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator privileges +// Deletes all messages sent by the specified message sender in a chat. Supported only for supergroups; requires can_delete_messages administrator right func (client *Client) DeleteChatMessagesBySender(req *DeleteChatMessagesBySenderRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3452,7 +5164,7 @@ func (client *Client) DeleteChatMessagesByDate(req *DeleteChatMessagesByDateRequ type EditMessageTextRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` @@ -3487,12 +5199,14 @@ func (client *Client) EditMessageText(req *EditMessageTextRequest) (*Message, er type EditMessageLiveLocationRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` // New location content of the message; pass null to stop sharing the live location Location *Location `json:"location"` + // New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period + LivePeriod int32 `json:"live_period"` // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown Heading int32 `json:"heading"` // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled @@ -3510,6 +5224,7 @@ func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationReques "message_id": req.MessageId, "reply_markup": req.ReplyMarkup, "location": req.Location, + "live_period": req.LivePeriod, "heading": req.Heading, "proximity_alert_radius": req.ProximityAlertRadius, }, @@ -3525,10 +5240,45 @@ func (client *Client) EditMessageLiveLocation(req *EditMessageLiveLocationReques return UnmarshalMessage(result.Data) } +type EditMessageChecklistRequest struct { + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The new checklist. If some tasks were completed, this information will be kept + Checklist *InputChecklist `json:"checklist"` +} + +// Edits the message content of a checklist. Returns the edited message after the edit is completed on the server side +func (client *Client) EditMessageChecklist(req *EditMessageChecklistRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editMessageChecklist", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "checklist": req.Checklist, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + type EditMessageMediaRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_edit_media to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` @@ -3536,7 +5286,7 @@ type EditMessageMediaRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the content of a message with an animation, an audio, a document, a photo or a video, including message caption. If only the caption needs to be edited, use editMessageCaption instead. The media can't be edited if the message was set to self-destruct or to a self-destructing media. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side +// Edits the media content of a message, including message caption. If only the caption needs to be edited, use editMessageCaption instead. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa. Returns the edited message after the edit is completed on the server side func (client *Client) EditMessageMedia(req *EditMessageMediaRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -3563,12 +5313,14 @@ func (client *Client) EditMessageMedia(req *EditMessageMediaRequest) (*Message, type EditMessageCaptionRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; 0-getOption("message_caption_length_max") characters; pass null to remove caption Caption *FormattedText `json:"caption"` + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } // Edits the message content caption. Returns the edited message after the edit is completed on the server side @@ -3582,6 +5334,7 @@ func (client *Client) EditMessageCaption(req *EditMessageCaptionRequest) (*Messa "message_id": req.MessageId, "reply_markup": req.ReplyMarkup, "caption": req.Caption, + "show_caption_above_media": req.ShowCaptionAboveMedia, }, }) if err != nil { @@ -3598,7 +5351,7 @@ func (client *Client) EditMessageCaption(req *EditMessageCaptionRequest) (*Messa type EditMessageReplyMarkupRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_be_edited to check whether the message can be edited MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none ReplyMarkup ReplyMarkup `json:"reply_markup"` @@ -3666,6 +5419,8 @@ type EditInlineMessageLiveLocationRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New location content of the message; pass null to stop sharing the live location Location *Location `json:"location"` + // New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period + LivePeriod int32 `json:"live_period"` // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown Heading int32 `json:"heading"` // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled @@ -3682,6 +5437,7 @@ func (client *Client) EditInlineMessageLiveLocation(req *EditInlineMessageLiveLo "inline_message_id": req.InlineMessageId, "reply_markup": req.ReplyMarkup, "location": req.Location, + "live_period": req.LivePeriod, "heading": req.Heading, "proximity_alert_radius": req.ProximityAlertRadius, }, @@ -3706,7 +5462,7 @@ type EditInlineMessageMediaRequest struct { InputMessageContent InputMessageContent `json:"input_message_content"` } -// Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only +// Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only func (client *Client) EditInlineMessageMedia(req *EditInlineMessageMediaRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3736,6 +5492,8 @@ type EditInlineMessageCaptionRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` // New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` } // Edits the caption of an inline message sent via a bot; for bots only @@ -3748,6 +5506,7 @@ func (client *Client) EditInlineMessageCaption(req *EditInlineMessageCaptionRequ "inline_message_id": req.InlineMessageId, "reply_markup": req.ReplyMarkup, "caption": req.Caption, + "show_caption_above_media": req.ShowCaptionAboveMedia, }, }) if err != nil { @@ -3793,9 +5552,9 @@ func (client *Client) EditInlineMessageReplyMarkup(req *EditInlineMessageReplyMa type EditMessageSchedulingStateRequest struct { // The chat the message belongs to ChatId int64 `json:"chat_id"` - // Identifier of the message + // Identifier of the message. Use messageProperties.can_edit_scheduling_state to check whether the message is suitable MessageId int64 `json:"message_id"` - // The new message scheduling state; pass null to send the message immediately + // The new message scheduling state; pass null to send the message immediately. Must be null for messages in the state messageSchedulingStateSendWhenVideoProcessed SchedulingState MessageSchedulingState `json:"scheduling_state"` } @@ -3822,7 +5581,1123 @@ func (client *Client) EditMessageSchedulingState(req *EditMessageSchedulingState return UnmarshalOk(result.Data) } -// Returns list of custom emojis, which can be used as forum topic icon by all users +type SetMessageFactCheckRequest struct { + // The channel chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are supported + Text *FormattedText `json:"text"` +} + +// Changes the fact-check of a message. Can be only used if messageProperties.can_set_fact_check == true +func (client *Client) SetMessageFactCheck(req *SetMessageFactCheckRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMessageFactCheck", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendBusinessMessageRequest struct { + // Unique identifier of business connection on behalf of which to send the request + BusinessConnectionId string `json:"business_connection_id"` + // Target chat + ChatId int64 `json:"chat_id"` + // Information about the message to be replied; pass null if none + ReplyTo InputMessageReplyTo `json:"reply_to"` + // Pass true to disable notification for the message + DisableNotification bool `json:"disable_notification"` + // Pass true if the content of the message must be protected from forwarding and saving + ProtectContent bool `json:"protect_content"` + // Identifier of the effect to apply to the message + EffectId JsonInt64 `json:"effect_id"` + // Markup for replying to the message; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The content of the message to be sent + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Sends a message on behalf of a business account; for bots only. Returns the message after it was sent +func (client *Client) SendBusinessMessage(req *SendBusinessMessageRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendBusinessMessage", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "reply_to": req.ReplyTo, + "disable_notification": req.DisableNotification, + "protect_content": req.ProtectContent, + "effect_id": req.EffectId, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type SendBusinessMessageAlbumRequest struct { + // Unique identifier of business connection on behalf of which to send the request + BusinessConnectionId string `json:"business_connection_id"` + // Target chat + ChatId int64 `json:"chat_id"` + // Information about the message to be replied; pass null if none + ReplyTo InputMessageReplyTo `json:"reply_to"` + // Pass true to disable notification for the message + DisableNotification bool `json:"disable_notification"` + // Pass true if the content of the message must be protected from forwarding and saving + ProtectContent bool `json:"protect_content"` + // Identifier of the effect to apply to the message + EffectId JsonInt64 `json:"effect_id"` + // Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media + InputMessageContents []InputMessageContent `json:"input_message_contents"` +} + +// Sends 2-10 messages grouped together into an album on behalf of a business account; for bots only. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages +func (client *Client) SendBusinessMessageAlbum(req *SendBusinessMessageAlbumRequest) (*BusinessMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendBusinessMessageAlbum", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "reply_to": req.ReplyTo, + "disable_notification": req.DisableNotification, + "protect_content": req.ProtectContent, + "effect_id": req.EffectId, + "input_message_contents": req.InputMessageContents, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessages(result.Data) +} + +type EditBusinessMessageTextRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New text content of the message. Must be of type inputMessageText + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Edits the text of a text or game message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageText(req *EditBusinessMessageTextRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageText", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type EditBusinessMessageLiveLocationRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New location content of the message; pass null to stop sharing the live location + Location *Location `json:"location"` + // New time relative to the message send date, for which the location can be updated, in seconds. If 0x7FFFFFFF specified, then the location can be updated forever. Otherwise, must not exceed the current live_period by more than a day, and the live location expiration date must remain in the next 90 days. Pass 0 to keep the current live_period + LivePeriod int32 `json:"live_period"` + // The new direction in which the location moves, in degrees; 1-360. Pass 0 if unknown + Heading int32 `json:"heading"` + // The new maximum distance for proximity alerts, in meters (0-100000). Pass 0 if the notification is disabled + ProximityAlertRadius int32 `json:"proximity_alert_radius"` +} + +// Edits the content of a live location in a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageLiveLocation(req *EditBusinessMessageLiveLocationRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageLiveLocation", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "location": req.Location, + "live_period": req.LivePeriod, + "heading": req.Heading, + "proximity_alert_radius": req.ProximityAlertRadius, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type EditBusinessMessageChecklistRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // The new checklist. If some tasks were completed, this information will be kept + Checklist *InputChecklist `json:"checklist"` +} + +// Edits the content of a checklist in a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageChecklist(req *EditBusinessMessageChecklistRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageChecklist", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "checklist": req.Checklist, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type EditBusinessMessageMediaRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, inputMessagePhoto or inputMessageVideo + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Edits the media content of a message with a text, an animation, an audio, a document, a photo or a video in a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageMedia(req *EditBusinessMessageMediaRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageMedia", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type EditBusinessMessageCaptionRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` + // New message content caption; pass null to remove caption; 0-getOption("message_caption_length_max") characters + Caption *FormattedText `json:"caption"` + // Pass true to show the caption above the media; otherwise, the caption will be shown below the media. May be true only for animation, photo, and video messages + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` +} + +// Edits the caption of a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageCaption(req *EditBusinessMessageCaptionRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageCaption", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + "caption": req.Caption, + "show_caption_above_media": req.ShowCaptionAboveMedia, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type EditBusinessMessageReplyMarkupRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` +} + +// Edits the reply markup of a message sent on behalf of a business account; for bots only +func (client *Client) EditBusinessMessageReplyMarkup(req *EditBusinessMessageReplyMarkupRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessMessageReplyMarkup", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type StopBusinessPollRequest struct { + // Unique identifier of business connection on behalf of which the message with the poll was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the poll + MessageId int64 `json:"message_id"` + // The new message reply markup; pass null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` +} + +// Stops a poll sent on behalf of a business account; for bots only +func (client *Client) StopBusinessPoll(req *StopBusinessPollRequest) (*BusinessMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "stopBusinessPoll", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessMessage(result.Data) +} + +type SetBusinessMessageIsPinnedRequest struct { + // Unique identifier of business connection on behalf of which the message was sent + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // Pass true to pin the message, pass false to unpin it + IsPinned bool `json:"is_pinned"` +} + +// Pins or unpins a message sent on behalf of a business account; for bots only +func (client *Client) SetBusinessMessageIsPinned(req *SetBusinessMessageIsPinnedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessMessageIsPinned", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "is_pinned": req.IsPinned, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReadBusinessMessageRequest struct { + // Unique identifier of business connection through which the message was received + BusinessConnectionId string `json:"business_connection_id"` + // The chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Reads a message on behalf of a business account; for bots only +func (client *Client) ReadBusinessMessage(req *ReadBusinessMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readBusinessMessage", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteBusinessMessagesRequest struct { + // Unique identifier of business connection through which the messages were received + BusinessConnectionId string `json:"business_connection_id"` + // Identifier of the messages + MessageIds []int64 `json:"message_ids"` +} + +// Deletes messages on behalf of a business account; for bots only +func (client *Client) DeleteBusinessMessages(req *DeleteBusinessMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBusinessMessages", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "message_ids": req.MessageIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type EditBusinessStoryRequest struct { + // Identifier of the chat that posted the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` + // Identifier of the story to edit + StoryId int32 `json:"story_id"` + // New content of the story + Content InputStoryContent `json:"content"` + // New clickable rectangle areas to be shown on the story media + Areas *InputStoryAreas `json:"areas"` + // New story caption + Caption *FormattedText `json:"caption"` + // The new privacy settings for the story + PrivacySettings StoryPrivacySettings `json:"privacy_settings"` +} + +// Changes a story posted by the bot on behalf of a business account; for bots only +func (client *Client) EditBusinessStory(req *EditBusinessStoryRequest) (*Story, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessStory", + }, + Data: map[string]interface{}{ + "story_poster_chat_id": req.StoryPosterChatId, + "story_id": req.StoryId, + "content": req.Content, + "areas": req.Areas, + "caption": req.Caption, + "privacy_settings": req.PrivacySettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStory(result.Data) +} + +type DeleteBusinessStoryRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // Identifier of the story to delete + StoryId int32 `json:"story_id"` +} + +// Deletes a story posted by the bot on behalf of a business account; for bots only +func (client *Client) DeleteBusinessStory(req *DeleteBusinessStoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBusinessStory", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "story_id": req.StoryId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountNameRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new value of the first name for the business account; 1-64 characters + FirstName string `json:"first_name"` + // The new value of the optional last name for the business account; 0-64 characters + LastName string `json:"last_name"` +} + +// Changes the first and last name of a business account; for bots only +func (client *Client) SetBusinessAccountName(req *SetBusinessAccountNameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountName", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "first_name": req.FirstName, + "last_name": req.LastName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountBioRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new value of the bio; 0-getOption("bio_length_max") characters without line feeds + Bio string `json:"bio"` +} + +// Changes the bio of a business account; for bots only +func (client *Client) SetBusinessAccountBio(req *SetBusinessAccountBioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountBio", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "bio": req.Bio, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountProfilePhotoRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // Profile photo to set; pass null to remove the photo + Photo InputChatPhoto `json:"photo"` + // Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings + IsPublic bool `json:"is_public"` +} + +// Changes a profile photo of a business account; for bots only +func (client *Client) SetBusinessAccountProfilePhoto(req *SetBusinessAccountProfilePhotoRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountProfilePhoto", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "photo": req.Photo, + "is_public": req.IsPublic, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountUsernameRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new value of the username + Username string `json:"username"` +} + +// Changes the editable username of a business account; for bots only +func (client *Client) SetBusinessAccountUsername(req *SetBusinessAccountUsernameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountUsername", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "username": req.Username, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAccountGiftSettingsRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // The new settings + Settings *GiftSettings `json:"settings"` +} + +// Changes settings for gift receiving of a business account; for bots only +func (client *Client) SetBusinessAccountGiftSettings(req *SetBusinessAccountGiftSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAccountGiftSettings", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBusinessAccountStarAmountRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` +} + +// Returns the Telegram Star amount owned by a business account; for bots only +func (client *Client) GetBusinessAccountStarAmount(req *GetBusinessAccountStarAmountRequest) (*StarAmount, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessAccountStarAmount", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarAmount(result.Data) +} + +type TransferBusinessAccountStarsRequest struct { + // Unique identifier of business connection + BusinessConnectionId string `json:"business_connection_id"` + // Number of Telegram Stars to transfer + StarCount int64 `json:"star_count"` +} + +// Transfers Telegram Stars from the business account to the business bot; for bots only +func (client *Client) TransferBusinessAccountStars(req *TransferBusinessAccountStarsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "transferBusinessAccountStars", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CheckQuickReplyShortcutNameRequest struct { + // The name of the shortcut; 1-32 characters + Name string `json:"name"` +} + +// Checks validness of a name for a quick reply shortcut. Can be called synchronously +func CheckQuickReplyShortcutName(req *CheckQuickReplyShortcutNameRequest) (*Ok, error) { + result, err := Execute(Request{ + meta: meta{ + Type: "checkQuickReplyShortcutName", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// deprecated +// Checks validness of a name for a quick reply shortcut. Can be called synchronously +func (client *Client) CheckQuickReplyShortcutName(req *CheckQuickReplyShortcutNameRequest) (*Ok, error) { + return CheckQuickReplyShortcutName(req)} + +// Loads quick reply shortcuts created by the current user. The loaded data will be sent through updateQuickReplyShortcut and updateQuickReplyShortcuts +func (client *Client) LoadQuickReplyShortcuts() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "loadQuickReplyShortcuts", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetQuickReplyShortcutNameRequest struct { + // Unique identifier of the quick reply shortcut + ShortcutId int32 `json:"shortcut_id"` + // New name for the shortcut. Use checkQuickReplyShortcutName to check its validness + Name string `json:"name"` +} + +// Changes name of a quick reply shortcut +func (client *Client) SetQuickReplyShortcutName(req *SetQuickReplyShortcutNameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setQuickReplyShortcutName", + }, + Data: map[string]interface{}{ + "shortcut_id": req.ShortcutId, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteQuickReplyShortcutRequest struct { + // Unique identifier of the quick reply shortcut + ShortcutId int32 `json:"shortcut_id"` +} + +// Deletes a quick reply shortcut +func (client *Client) DeleteQuickReplyShortcut(req *DeleteQuickReplyShortcutRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteQuickReplyShortcut", + }, + Data: map[string]interface{}{ + "shortcut_id": req.ShortcutId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReorderQuickReplyShortcutsRequest struct { + // The new order of quick reply shortcuts + ShortcutIds []int32 `json:"shortcut_ids"` +} + +// Changes the order of quick reply shortcuts +func (client *Client) ReorderQuickReplyShortcuts(req *ReorderQuickReplyShortcutsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderQuickReplyShortcuts", + }, + Data: map[string]interface{}{ + "shortcut_ids": req.ShortcutIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type LoadQuickReplyShortcutMessagesRequest struct { + // Unique identifier of the quick reply shortcut + ShortcutId int32 `json:"shortcut_id"` +} + +// Loads quick reply messages that can be sent by a given quick reply shortcut. The loaded messages will be sent through updateQuickReplyShortcutMessages +func (client *Client) LoadQuickReplyShortcutMessages(req *LoadQuickReplyShortcutMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "loadQuickReplyShortcutMessages", + }, + Data: map[string]interface{}{ + "shortcut_id": req.ShortcutId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteQuickReplyShortcutMessagesRequest struct { + // Unique identifier of the quick reply shortcut to which the messages belong + ShortcutId int32 `json:"shortcut_id"` + // Unique identifiers of the messages + MessageIds []int64 `json:"message_ids"` +} + +// Deletes specified quick reply messages +func (client *Client) DeleteQuickReplyShortcutMessages(req *DeleteQuickReplyShortcutMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteQuickReplyShortcutMessages", + }, + Data: map[string]interface{}{ + "shortcut_id": req.ShortcutId, + "message_ids": req.MessageIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddQuickReplyShortcutMessageRequest struct { + // Name of the target shortcut + ShortcutName string `json:"shortcut_name"` + // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none + ReplyToMessageId int64 `json:"reply_to_message_id"` + // The content of the message to be added; inputMessagePaidMedia, inputMessageForwarded and inputMessageLocation with live_period aren't supported + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Adds a message to a quick reply shortcut. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. The shortcut must not contain more than getOption("quick_reply_shortcut_message_count_max") messages after adding the new message. Returns the added message +func (client *Client) AddQuickReplyShortcutMessage(req *AddQuickReplyShortcutMessageRequest) (*QuickReplyMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addQuickReplyShortcutMessage", + }, + Data: map[string]interface{}{ + "shortcut_name": req.ShortcutName, + "reply_to_message_id": req.ReplyToMessageId, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalQuickReplyMessage(result.Data) +} + +type AddQuickReplyShortcutInlineQueryResultMessageRequest struct { + // Name of the target shortcut + ShortcutName string `json:"shortcut_name"` + // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Identifier of the inline query + QueryId JsonInt64 `json:"query_id"` + // Identifier of the inline query result + ResultId string `json:"result_id"` + // Pass true to hide the bot, via which the message is sent. Can be used only for bots getOption("animation_search_bot_username"), getOption("photo_search_bot_username"), and getOption("venue_search_bot_username") + HideViaBot bool `json:"hide_via_bot"` +} + +// Adds a message to a quick reply shortcut via inline bot. If shortcut doesn't exist and there are less than getOption("quick_reply_shortcut_count_max") shortcuts, then a new shortcut is created. The shortcut must not contain more than getOption("quick_reply_shortcut_message_count_max") messages after adding the new message. Returns the added message +func (client *Client) AddQuickReplyShortcutInlineQueryResultMessage(req *AddQuickReplyShortcutInlineQueryResultMessageRequest) (*QuickReplyMessage, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addQuickReplyShortcutInlineQueryResultMessage", + }, + Data: map[string]interface{}{ + "shortcut_name": req.ShortcutName, + "reply_to_message_id": req.ReplyToMessageId, + "query_id": req.QueryId, + "result_id": req.ResultId, + "hide_via_bot": req.HideViaBot, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalQuickReplyMessage(result.Data) +} + +type AddQuickReplyShortcutMessageAlbumRequest struct { + // Name of the target shortcut + ShortcutName string `json:"shortcut_name"` + // Identifier of a quick reply message in the same shortcut to be replied; pass 0 if none + ReplyToMessageId int64 `json:"reply_to_message_id"` + // Contents of messages to be sent. At most 10 messages can be added to an album. All messages must have the same value of show_caption_above_media + InputMessageContents []InputMessageContent `json:"input_message_contents"` +} + +// Adds 2-10 messages grouped together into an album to a quick reply shortcut. Currently, only audio, document, photo and video messages can be grouped into an album. Documents and audio files can be only grouped in an album with messages of the same type. Returns sent messages +func (client *Client) AddQuickReplyShortcutMessageAlbum(req *AddQuickReplyShortcutMessageAlbumRequest) (*QuickReplyMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addQuickReplyShortcutMessageAlbum", + }, + Data: map[string]interface{}{ + "shortcut_name": req.ShortcutName, + "reply_to_message_id": req.ReplyToMessageId, + "input_message_contents": req.InputMessageContents, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalQuickReplyMessages(result.Data) +} + +type ReaddQuickReplyShortcutMessagesRequest struct { + // Name of the target shortcut + ShortcutName string `json:"shortcut_name"` + // Identifiers of the quick reply messages to readd. Message identifiers must be in a strictly increasing order + MessageIds []int64 `json:"message_ids"` +} + +// Readds quick reply messages which failed to add. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed. If a message is readded, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be readded, null will be returned instead of the message +func (client *Client) ReaddQuickReplyShortcutMessages(req *ReaddQuickReplyShortcutMessagesRequest) (*QuickReplyMessages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readdQuickReplyShortcutMessages", + }, + Data: map[string]interface{}{ + "shortcut_name": req.ShortcutName, + "message_ids": req.MessageIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalQuickReplyMessages(result.Data) +} + +type EditQuickReplyMessageRequest struct { + // Unique identifier of the quick reply shortcut with the message + ShortcutId int32 `json:"shortcut_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // New content of the message. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageChecklist, inputMessageDocument, inputMessagePhoto, inputMessageText, or inputMessageVideo + InputMessageContent InputMessageContent `json:"input_message_content"` +} + +// Asynchronously edits the text, media or caption of a quick reply message. Use quickReplyMessage.can_be_edited to check whether a message can be edited. Media message can be edited only to a media message. Checklist messages can be edited only to a checklist message. The type of message content in an album can't be changed with exception of replacing a photo with a video or vice versa +func (client *Client) EditQuickReplyMessage(req *EditQuickReplyMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editQuickReplyMessage", + }, + Data: map[string]interface{}{ + "shortcut_id": req.ShortcutId, + "message_id": req.MessageId, + "input_message_content": req.InputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns the list of custom emoji, which can be used as forum topic icon by all users func (client *Client) GetForumTopicDefaultIcons() (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ @@ -3846,11 +6721,13 @@ type CreateForumTopicRequest struct { ChatId int64 `json:"chat_id"` // Name of the topic; 1-128 characters Name string `json:"name"` + // Pass true if the name of the topic wasn't entered explicitly; for chats with bots only + IsNameImplicit bool `json:"is_name_implicit"` // Icon of the topic. Icon color must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. Telegram Premium users can use any custom emoji as topic icon, other users can use only a custom emoji returned by getForumTopicDefaultIcons Icon *ForumTopicIcon `json:"icon"` } -// Creates a topic in a forum supergroup chat; requires can_manage_topics rights in the supergroup +// Creates a topic in a forum supergroup chat or a chat with a bot with topics; requires can_manage_topics administrator or can_create_topics member right in the supergroup func (client *Client) CreateForumTopic(req *CreateForumTopicRequest) (*ForumTopicInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -3859,6 +6736,7 @@ func (client *Client) CreateForumTopic(req *CreateForumTopicRequest) (*ForumTopi Data: map[string]interface{}{ "chat_id": req.ChatId, "name": req.Name, + "is_name_implicit": req.IsNameImplicit, "icon": req.Icon, }, }) @@ -3876,8 +6754,8 @@ func (client *Client) CreateForumTopic(req *CreateForumTopicRequest) (*ForumTopi type EditForumTopicRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` - // Message thread identifier of the forum topic - MessageThreadId int64 `json:"message_thread_id"` + // Forum topic identifier + ForumTopicId int32 `json:"forum_topic_id"` // New name of the topic; 0-128 characters. If empty, the previous topic name is kept Name string `json:"name"` // Pass true to edit the icon of the topic. Icon of the General topic can't be edited @@ -3886,7 +6764,7 @@ type EditForumTopicRequest struct { IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` } -// Edits title and icon of a topic in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic +// Edits title and icon of a topic in a forum supergroup chat or a chat with a bot with topics; for supergroup chats requires can_manage_topics administrator right unless the user is creator of the topic func (client *Client) EditForumTopic(req *EditForumTopicRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3894,7 +6772,7 @@ func (client *Client) EditForumTopic(req *EditForumTopicRequest) (*Ok, error) { }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "forum_topic_id": req.ForumTopicId, "name": req.Name, "edit_icon_custom_emoji": req.EditIconCustomEmoji, "icon_custom_emoji_id": req.IconCustomEmojiId, @@ -3914,11 +6792,11 @@ func (client *Client) EditForumTopic(req *EditForumTopicRequest) (*Ok, error) { type GetForumTopicRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` - // Message thread identifier of the forum topic - MessageThreadId int64 `json:"message_thread_id"` + // Forum topic identifier + ForumTopicId int32 `json:"forum_topic_id"` } -// Returns information about a forum topic +// Returns information about a topic in a forum supergroup chat or a chat with a bot with topics func (client *Client) GetForumTopic(req *GetForumTopicRequest) (*ForumTopic, error) { result, err := client.Send(Request{ meta: meta{ @@ -3926,7 +6804,7 @@ func (client *Client) GetForumTopic(req *GetForumTopicRequest) (*ForumTopic, err }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "forum_topic_id": req.ForumTopicId, }, }) if err != nil { @@ -3940,14 +6818,52 @@ func (client *Client) GetForumTopic(req *GetForumTopicRequest) (*ForumTopic, err return UnmarshalForumTopic(result.Data) } +type GetForumTopicHistoryRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Forum topic identifier + ForumTopicId int32 `json:"forum_topic_id"` + // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message + FromMessageId int64 `json:"from_message_id"` + // Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages + Offset int32 `json:"offset"` + // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns messages in a topic in a forum supergroup chat or a chat with a bot with topics. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib +func (client *Client) GetForumTopicHistory(req *GetForumTopicHistoryRequest) (*Messages, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getForumTopicHistory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "forum_topic_id": req.ForumTopicId, + "from_message_id": req.FromMessageId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessages(result.Data) +} + type GetForumTopicLinkRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` - // Message thread identifier of the forum topic - MessageThreadId int64 `json:"message_thread_id"` + // Forum topic identifier + ForumTopicId int32 `json:"forum_topic_id"` } -// Returns an HTTPS link to a topic in a forum chat. This is an offline request +// Returns an HTTPS link to a topic in a forum supergroup chat. This is an offline method func (client *Client) GetForumTopicLink(req *GetForumTopicLinkRequest) (*MessageLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -3955,7 +6871,7 @@ func (client *Client) GetForumTopicLink(req *GetForumTopicLinkRequest) (*Message }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "forum_topic_id": req.ForumTopicId, }, }) if err != nil { @@ -3970,7 +6886,7 @@ func (client *Client) GetForumTopicLink(req *GetForumTopicLinkRequest) (*Message } type GetForumTopicsRequest struct { - // Identifier of the forum chat + // Identifier of the chat ChatId int64 `json:"chat_id"` // Query to search for in the forum topic's name Query string `json:"query"` @@ -3978,13 +6894,13 @@ type GetForumTopicsRequest struct { OffsetDate int32 `json:"offset_date"` // The message identifier of the last message in the last found topic, or 0 for the first request OffsetMessageId int64 `json:"offset_message_id"` - // The message thread identifier of the last found topic, or 0 for the first request - OffsetMessageThreadId int64 `json:"offset_message_thread_id"` + // The forum topic identifier of the last found topic, or 0 for the first request + OffsetForumTopicId int32 `json:"offset_forum_topic_id"` // The maximum number of forum topics to be returned; up to 100. For optimal performance, the number of returned forum topics is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } -// Returns found forum topics in a forum chat. This is a temporary method for getting information about topic list from the server +// Returns found forum topics in a forum supergroup chat or a chat with a bot with topics. This is a temporary method for getting information about topic list from the server func (client *Client) GetForumTopics(req *GetForumTopicsRequest) (*ForumTopics, error) { result, err := client.Send(Request{ meta: meta{ @@ -3995,7 +6911,7 @@ func (client *Client) GetForumTopics(req *GetForumTopicsRequest) (*ForumTopics, "query": req.Query, "offset_date": req.OffsetDate, "offset_message_id": req.OffsetMessageId, - "offset_message_thread_id": req.OffsetMessageThreadId, + "offset_forum_topic_id": req.OffsetForumTopicId, "limit": req.Limit, }, }) @@ -4013,13 +6929,13 @@ func (client *Client) GetForumTopics(req *GetForumTopicsRequest) (*ForumTopics, type SetForumTopicNotificationSettingsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Message thread identifier of the forum topic - MessageThreadId int64 `json:"message_thread_id"` + // Forum topic identifier + ForumTopicId int32 `json:"forum_topic_id"` // New notification settings for the forum topic. If the topic is muted for more than 366 days, it is considered to be muted forever NotificationSettings *ChatNotificationSettings `json:"notification_settings"` } -// Changes the notification settings of a forum topic +// Changes the notification settings of a forum topic in a forum supergroup chat or a chat with a bot with topics func (client *Client) SetForumTopicNotificationSettings(req *SetForumTopicNotificationSettingsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4027,7 +6943,7 @@ func (client *Client) SetForumTopicNotificationSettings(req *SetForumTopicNotifi }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "forum_topic_id": req.ForumTopicId, "notification_settings": req.NotificationSettings, }, }) @@ -4045,8 +6961,8 @@ func (client *Client) SetForumTopicNotificationSettings(req *SetForumTopicNotifi type ToggleForumTopicIsClosedRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` - // Message thread identifier of the forum topic - MessageThreadId int64 `json:"message_thread_id"` + // Forum topic identifier + ForumTopicId int32 `json:"forum_topic_id"` // Pass true to close the topic; pass false to reopen it IsClosed bool `json:"is_closed"` } @@ -4059,7 +6975,7 @@ func (client *Client) ToggleForumTopicIsClosed(req *ToggleForumTopicIsClosedRequ }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "forum_topic_id": req.ForumTopicId, "is_closed": req.IsClosed, }, }) @@ -4106,13 +7022,13 @@ func (client *Client) ToggleGeneralForumTopicIsHidden(req *ToggleGeneralForumTop type ToggleForumTopicIsPinnedRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Message thread identifier of the forum topic - MessageThreadId int64 `json:"message_thread_id"` + // Forum topic identifier + ForumTopicId int32 `json:"forum_topic_id"` // Pass true to pin the topic; pass false to unpin it IsPinned bool `json:"is_pinned"` } -// Changes the pinned state of a forum topic; requires can_manage_topics administrator right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics +// Changes the pinned state of a topic in a forum supergroup chat or a chat with a bot with topics; requires can_manage_topics administrator right in the supergroup. There can be up to getOption("pinned_forum_topic_count_max") pinned forum topics func (client *Client) ToggleForumTopicIsPinned(req *ToggleForumTopicIsPinnedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4120,7 +7036,7 @@ func (client *Client) ToggleForumTopicIsPinned(req *ToggleForumTopicIsPinnedRequ }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "forum_topic_id": req.ForumTopicId, "is_pinned": req.IsPinned, }, }) @@ -4138,11 +7054,11 @@ func (client *Client) ToggleForumTopicIsPinned(req *ToggleForumTopicIsPinnedRequ type SetPinnedForumTopicsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // The new list of pinned forum topics - MessageThreadIds []int64 `json:"message_thread_ids"` + // The new list of identifiers of the pinned forum topics + ForumTopicIds []int32 `json:"forum_topic_ids"` } -// Changes the order of pinned forum topics +// Changes the order of pinned topics in a forum supergroup chat or a chat with a bot with topics; requires can_manage_topics administrator right in the supergroup func (client *Client) SetPinnedForumTopics(req *SetPinnedForumTopicsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4150,7 +7066,7 @@ func (client *Client) SetPinnedForumTopics(req *SetPinnedForumTopicsRequest) (*O }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_ids": req.MessageThreadIds, + "forum_topic_ids": req.ForumTopicIds, }, }) if err != nil { @@ -4167,11 +7083,11 @@ func (client *Client) SetPinnedForumTopics(req *SetPinnedForumTopicsRequest) (*O type DeleteForumTopicRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` - // Message thread identifier of the forum topic - MessageThreadId int64 `json:"message_thread_id"` + // Forum topic identifier + ForumTopicId int32 `json:"forum_topic_id"` } -// Deletes all messages in a forum topic; requires can_delete_messages administrator right in the supergroup unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages +// Deletes all messages from a topic in a forum supergroup chat or a chat with a bot with topics; requires can_delete_messages administrator right in the supergroup unless the user is creator of the topic, the topic has no messages from other users and has at most 11 messages func (client *Client) DeleteForumTopic(req *DeleteForumTopicRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4179,7 +7095,187 @@ func (client *Client) DeleteForumTopic(req *DeleteForumTopicRequest) (*Ok, error }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "forum_topic_id": req.ForumTopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReadAllForumTopicMentionsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Forum topic identifier in which mentions are marked as read + ForumTopicId int32 `json:"forum_topic_id"` +} + +// Marks all mentions in a topic in a forum supergroup chat as read +func (client *Client) ReadAllForumTopicMentions(req *ReadAllForumTopicMentionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readAllForumTopicMentions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "forum_topic_id": req.ForumTopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReadAllForumTopicReactionsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Forum topic identifier in which reactions are marked as read + ForumTopicId int32 `json:"forum_topic_id"` +} + +// Marks all reactions in a topic in a forum supergroup chat or a chat with a bot with topics as read +func (client *Client) ReadAllForumTopicReactions(req *ReadAllForumTopicReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readAllForumTopicReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "forum_topic_id": req.ForumTopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type UnpinAllForumTopicMessagesRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Forum topic identifier in which messages will be unpinned + ForumTopicId int32 `json:"forum_topic_id"` +} + +// Removes all pinned messages from a topic in a forum supergroup chat or a chat with a bot with topics; requires can_pin_messages member right in the supergroup +func (client *Client) UnpinAllForumTopicMessages(req *UnpinAllForumTopicMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "unpinAllForumTopicMessages", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "forum_topic_id": req.ForumTopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns parameters for creating of a new passkey as JSON-serialized string +func (client *Client) GetPasskeyParameters() (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPasskeyParameters", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type AddLoginPasskeyRequest struct { + // JSON-encoded client data + ClientData string `json:"client_data"` + // Passkey attestation object + AttestationObject []byte `json:"attestation_object"` +} + +// Adds a passkey allowed to be used for the login by the current user and returns the added passkey. Call getPasskeyParameters to get parameters for creating of the passkey +func (client *Client) AddLoginPasskey(req *AddLoginPasskeyRequest) (*Passkey, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addLoginPasskey", + }, + Data: map[string]interface{}{ + "client_data": req.ClientData, + "attestation_object": req.AttestationObject, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasskey(result.Data) +} + +// Returns the list of passkeys allowed to be used for the login by the current user +func (client *Client) GetLoginPasskeys() (*Passkeys, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLoginPasskeys", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasskeys(result.Data) +} + +type RemoveLoginPasskeyRequest struct { + // Unique identifier of the passkey to remove + PasskeyId string `json:"passkey_id"` +} + +// Removes a passkey from the list of passkeys allowed to be used for the login by the current user +func (client *Client) RemoveLoginPasskey(req *RemoveLoginPasskeyRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeLoginPasskey", + }, + Data: map[string]interface{}{ + "passkey_id": req.PasskeyId, }, }) if err != nil { @@ -4198,7 +7294,7 @@ type GetEmojiReactionRequest struct { Emoji string `json:"emoji"` } -// Returns information about a emoji reaction. Returns a 404 error if the reaction is not found +// Returns information about an emoji reaction. Returns a 404 error if the reaction is not found func (client *Client) GetEmojiReaction(req *GetEmojiReactionRequest) (*EmojiReaction, error) { result, err := client.Send(Request{ meta: meta{ @@ -4294,15 +7390,15 @@ type AddMessageReactionRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Type of the reaction to add + // Type of the reaction to add. Use addPendingPaidMessageReaction instead to add the paid reaction ReactionType ReactionType `json:"reaction_type"` // Pass true if the reaction is added with a big animation IsBig bool `json:"is_big"` - // Pass true if the reaction needs to be added to recent reactions + // Pass true if the reaction needs to be added to recent reactions; tags are never added to the list of recent reactions UpdateRecentReactions bool `json:"update_recent_reactions"` } -// Adds a reaction to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message +// Adds a reaction or a tag to a message. Use getMessageAvailableReactions to receive the list of available reactions for the message func (client *Client) AddMessageReaction(req *AddMessageReactionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4332,7 +7428,7 @@ type RemoveMessageReactionRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Type of the reaction to remove + // Type of the reaction to remove. The paid reaction can't be removed ReactionType ReactionType `json:"reaction_type"` } @@ -4359,12 +7455,198 @@ func (client *Client) RemoveMessageReaction(req *RemoveMessageReactionRequest) ( return UnmarshalOk(result.Data) } -type GetMessageAddedReactionsRequest struct { +type GetChatAvailablePaidMessageReactionSendersRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns the list of message sender identifiers, which can be used to send a paid reaction in a chat +func (client *Client) GetChatAvailablePaidMessageReactionSenders(req *GetChatAvailablePaidMessageReactionSendersRequest) (*MessageSenders, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatAvailablePaidMessageReactionSenders", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageSenders(result.Data) +} + +type AddPendingPaidMessageReactionRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` - // Type of the reactions to return; pass null to return all added reactions + // Number of Telegram Stars to be used for the reaction. The total number of pending paid reactions must not exceed getOption("paid_reaction_star_count_max") + StarCount int64 `json:"star_count"` + // Type of the paid reaction; pass null if the user didn't choose reaction type explicitly, for example, the reaction is set from the message bubble + Type PaidReactionType `json:"type"` +} + +// Adds the paid message reaction to a message. Use getMessageAvailableReactions to check whether the reaction is available for the message +func (client *Client) AddPendingPaidMessageReaction(req *AddPendingPaidMessageReactionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addPendingPaidMessageReaction", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "star_count": req.StarCount, + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CommitPendingPaidMessageReactionsRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Applies all pending paid reactions on a message +func (client *Client) CommitPendingPaidMessageReactions(req *CommitPendingPaidMessageReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "commitPendingPaidMessageReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemovePendingPaidMessageReactionsRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Removes all pending paid reactions on a message +func (client *Client) RemovePendingPaidMessageReactions(req *RemovePendingPaidMessageReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removePendingPaidMessageReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetPaidMessageReactionTypeRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // New type of the paid reaction + Type PaidReactionType `json:"type"` +} + +// Changes type of paid message reaction of the current user on a message. The message must have paid reaction added by the current user +func (client *Client) SetPaidMessageReactionType(req *SetPaidMessageReactionTypeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPaidMessageReactionType", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetMessageReactionsRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` + // Types of the reaction to set; pass an empty list to remove the reactions + ReactionTypes []ReactionType `json:"reaction_types"` + // Pass true if the reactions are added with a big animation + IsBig bool `json:"is_big"` +} + +// Sets reactions on a message; for bots only +func (client *Client) SetMessageReactions(req *SetMessageReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMessageReactions", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reaction_types": req.ReactionTypes, + "is_big": req.IsBig, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetMessageAddedReactionsRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message. Use message.interaction_info.reactions.can_get_added_reactions to check whether added reactions can be received for the message + MessageId int64 `json:"message_id"` + // Type of the reactions to return; pass null to return all added reactions; reactionTypePaid isn't supported ReactionType ReactionType `json:"reaction_type"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` @@ -4398,7 +7680,7 @@ func (client *Client) GetMessageAddedReactions(req *GetMessageAddedReactionsRequ } type SetDefaultReactionTypeRequest struct { - // New type of the default reaction + // New type of the default reaction. The paid reaction can't be set as default ReactionType ReactionType `json:"reaction_type"` } @@ -4423,6 +7705,87 @@ func (client *Client) SetDefaultReactionType(req *SetDefaultReactionTypeRequest) return UnmarshalOk(result.Data) } +type GetSavedMessagesTagsRequest struct { + // Identifier of Saved Messages topic which tags will be returned; pass 0 to get all Saved Messages tags + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` +} + +// Returns tags used in Saved Messages or a Saved Messages topic +func (client *Client) GetSavedMessagesTags(req *GetSavedMessagesTagsRequest) (*SavedMessagesTags, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSavedMessagesTags", + }, + Data: map[string]interface{}{ + "saved_messages_topic_id": req.SavedMessagesTopicId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSavedMessagesTags(result.Data) +} + +type SetSavedMessagesTagLabelRequest struct { + // The tag which label will be changed + Tag ReactionType `json:"tag"` + // New label for the tag; 0-12 characters + Label string `json:"label"` +} + +// Changes label of a Saved Messages tag; for Telegram Premium users only +func (client *Client) SetSavedMessagesTagLabel(req *SetSavedMessagesTagLabelRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSavedMessagesTagLabel", + }, + Data: map[string]interface{}{ + "tag": req.Tag, + "label": req.Label, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetMessageEffectRequest struct { + // Unique identifier of the effect + EffectId JsonInt64 `json:"effect_id"` +} + +// Returns information about a message effect. Returns a 404 error if the effect is not found +func (client *Client) GetMessageEffect(req *GetMessageEffectRequest) (*MessageEffect, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageEffect", + }, + Data: map[string]interface{}{ + "effect_id": req.EffectId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessageEffect(result.Data) +} + type SearchQuoteRequest struct { // Text in which to search for the quote Text *FormattedText `json:"text"` @@ -4498,7 +7861,7 @@ type ParseTextEntitiesRequest struct { ParseMode TextParseMode `json:"parse_mode"` } -// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously +// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, ExpandableBlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously func ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { result, err := Execute(Request{ meta: meta{ @@ -4521,7 +7884,7 @@ func ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { } // deprecated -// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously +// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, ExpandableBlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously func (client *Client) ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { return ParseTextEntities(req)} @@ -4587,6 +7950,37 @@ func GetMarkdownText(req *GetMarkdownTextRequest) (*FormattedText, error) { func (client *Client) GetMarkdownText(req *GetMarkdownTextRequest) (*FormattedText, error) { return GetMarkdownText(req)} +type GetCountryFlagEmojiRequest struct { + // A two-letter ISO 3166-1 alpha-2 country code as received from getCountries + CountryCode string `json:"country_code"` +} + +// Returns an emoji for the given country. Returns an empty string on failure. Can be called synchronously +func GetCountryFlagEmoji(req *GetCountryFlagEmojiRequest) (*Text, error) { + result, err := Execute(Request{ + meta: meta{ + Type: "getCountryFlagEmoji", + }, + Data: map[string]interface{}{ + "country_code": req.CountryCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +// deprecated +// Returns an emoji for the given country. Returns an empty string on failure. Can be called synchronously +func (client *Client) GetCountryFlagEmoji(req *GetCountryFlagEmojiRequest) (*Text, error) { + return GetCountryFlagEmoji(req)} + type GetFileMimeTypeRequest struct { // The name of the file or path to the file FileName string `json:"file_name"` @@ -4654,7 +8048,7 @@ type CleanFileNameRequest struct { FileName string `json:"file_name"` } -// Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously +// Removes potentially dangerous characters from the name of a file. Returns an empty string on failure. Can be called synchronously func CleanFileName(req *CleanFileNameRequest) (*Text, error) { result, err := Execute(Request{ meta: meta{ @@ -4676,7 +8070,7 @@ func CleanFileName(req *CleanFileNameRequest) (*Text, error) { } // deprecated -// Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. Can be called synchronously +// Removes potentially dangerous characters from the name of a file. Returns an empty string on failure. Can be called synchronously func (client *Client) CleanFileName(req *CleanFileNameRequest) (*Text, error) { return CleanFileName(req)} @@ -4919,13 +8313,13 @@ func (client *Client) GetPollVoters(req *GetPollVotersRequest) (*MessageSenders, type StopPollRequest struct { // Identifier of the chat to which the poll belongs ChatId int64 `json:"chat_id"` - // Identifier of the message containing the poll + // Identifier of the message containing the poll. Use messageProperties.can_be_edited to check whether the poll can be stopped MessageId int64 `json:"message_id"` // The new message reply markup; pass null if none; for bots only ReplyMarkup ReplyMarkup `json:"reply_markup"` } -// Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag is set +// Stops a poll func (client *Client) StopPoll(req *StopPollRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4948,6 +8342,73 @@ func (client *Client) StopPoll(req *StopPollRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type AddChecklistTasksRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the checklist. Use messageProperties.can_add_tasks to check whether the tasks can be added + MessageId int64 `json:"message_id"` + // List of added tasks + Tasks []*InputChecklistTask `json:"tasks"` +} + +// Adds tasks to a checklist in a message +func (client *Client) AddChecklistTasks(req *AddChecklistTasksRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addChecklistTasks", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "tasks": req.Tasks, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type MarkChecklistTasksAsDoneRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the checklist. Use messageProperties.can_mark_tasks_as_done to check whether the tasks can be marked as done or not done + MessageId int64 `json:"message_id"` + // Identifiers of tasks that were marked as done + MarkedAsDoneTaskIds []int32 `json:"marked_as_done_task_ids"` + // Identifiers of tasks that were marked as not done + MarkedAsNotDoneTaskIds []int32 `json:"marked_as_not_done_task_ids"` +} + +// Adds tasks of a checklist in a message as done or not done +func (client *Client) MarkChecklistTasksAsDone(req *MarkChecklistTasksAsDoneRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "markChecklistTasksAsDone", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "marked_as_done_task_ids": req.MarkedAsDoneTaskIds, + "marked_as_not_done_task_ids": req.MarkedAsNotDoneTaskIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type HideSuggestedActionRequest struct { // Suggested action to hide Action SuggestedAction `json:"action"` @@ -4974,10 +8435,55 @@ func (client *Client) HideSuggestedAction(req *HideSuggestedActionRequest) (*Ok, return UnmarshalOk(result.Data) } +// Hides the list of contacts that have close birthdays for 24 hours +func (client *Client) HideContactCloseBirthdays() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "hideContactCloseBirthdays", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBusinessConnectionRequest struct { + // Identifier of the business connection to return + ConnectionId string `json:"connection_id"` +} + +// Returns information about a business connection by its identifier; for bots only +func (client *Client) GetBusinessConnection(req *GetBusinessConnectionRequest) (*BusinessConnection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessConnection", + }, + Data: map[string]interface{}{ + "connection_id": req.ConnectionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessConnection(result.Data) +} + type GetLoginUrlInfoRequest struct { // Chat identifier of the message with the button ChatId int64 `json:"chat_id"` - // Message identifier of the message with the button + // Message identifier of the message with the button. The message must not be scheduled MessageId int64 `json:"message_id"` // Button identifier ButtonId int64 `json:"button_id"` @@ -5022,7 +8528,7 @@ type GetLoginUrlRequest struct { MessageId int64 `json:"message_id"` // Button identifier ButtonId int64 `json:"button_id"` - // Pass true to allow the bot to send messages to the current user + // Pass true to allow the bot to send messages to the current user. Phone number access can't be requested using the button AllowWriteAccess bool `json:"allow_write_access"` } @@ -5050,30 +8556,30 @@ func (client *Client) GetLoginUrl(req *GetLoginUrlRequest) (*HttpUrl, error) { return UnmarshalHttpUrl(result.Data) } -type ShareUserWithBotRequest struct { +type ShareUsersWithBotRequest struct { // Identifier of the chat with the bot ChatId int64 `json:"chat_id"` // Identifier of the message with the button MessageId int64 `json:"message_id"` // Identifier of the button ButtonId int32 `json:"button_id"` - // Identifier of the shared user - SharedUserId int64 `json:"shared_user_id"` - // Pass true to check that the user can be shared by the button instead of actually sharing them + // Identifiers of the shared users + SharedUserIds []int64 `json:"shared_user_ids"` + // Pass true to check that the users can be shared by the button instead of actually sharing them OnlyCheck bool `json:"only_check"` } -// Shares a user after pressing a keyboardButtonTypeRequestUser button with the bot -func (client *Client) ShareUserWithBot(req *ShareUserWithBotRequest) (*Ok, error) { +// Shares users after pressing a keyboardButtonTypeRequestUsers button with the bot +func (client *Client) ShareUsersWithBot(req *ShareUsersWithBotRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "shareUserWithBot", + Type: "shareUsersWithBot", }, Data: map[string]interface{}{ "chat_id": req.ChatId, "message_id": req.MessageId, "button_id": req.ButtonId, - "shared_user_id": req.SharedUserId, + "shared_user_ids": req.SharedUserIds, "only_check": req.OnlyCheck, }, }) @@ -5167,7 +8673,7 @@ func (client *Client) GetInlineQueryResults(req *GetInlineQueryResultsRequest) ( type AnswerInlineQueryRequest struct { // Identifier of the inline query InlineQueryId JsonInt64 `json:"inline_query_id"` - // Pass true if results may be cached and returned only for the user that sent the query. By default, results may be returned to any user who sends the same query + // Pass true if results may be cached and returned only for the user who sent the query. By default, results may be returned to any user who sends the same query IsPersonal bool `json:"is_personal"` // Button to be shown above inline query results; pass null if none Button *InlineQueryResultsButton `json:"button"` @@ -5205,6 +8711,96 @@ func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, err return UnmarshalOk(result.Data) } +type SavePreparedInlineMessageRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // The description of the message + Result InputInlineQueryResult `json:"result"` + // Types of the chats to which the message can be sent + ChatTypes *TargetChatTypes `json:"chat_types"` +} + +// Saves an inline message to be sent by the given user; for bots only +func (client *Client) SavePreparedInlineMessage(req *SavePreparedInlineMessageRequest) (*PreparedInlineMessageId, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "savePreparedInlineMessage", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "result": req.Result, + "chat_types": req.ChatTypes, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPreparedInlineMessageId(result.Data) +} + +type GetPreparedInlineMessageRequest struct { + // Identifier of the bot that created the message + BotUserId int64 `json:"bot_user_id"` + // Identifier of the prepared message + PreparedMessageId string `json:"prepared_message_id"` +} + +// 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{ + Type: "getPreparedInlineMessage", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "prepared_message_id": req.PreparedMessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPreparedInlineMessage(result.Data) +} + +type GetGrossingWebAppBotsRequest struct { + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of bots to be returned; up to 100 + Limit int32 `json:"limit"` +} + +// Returns the most grossing Web App bots +func (client *Client) GetGrossingWebAppBots(req *GetGrossingWebAppBotsRequest) (*FoundUsers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGrossingWebAppBots", + }, + Data: map[string]interface{}{ + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundUsers(result.Data) +} + type SearchWebAppRequest struct { // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` @@ -5234,6 +8830,32 @@ func (client *Client) SearchWebApp(req *SearchWebAppRequest) (*FoundWebApp, erro return UnmarshalFoundWebApp(result.Data) } +type GetWebAppPlaceholderRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Returns a default placeholder for Web Apps of a bot. This is an offline method. Returns a 404 error if the placeholder isn't known +func (client *Client) GetWebAppPlaceholder(req *GetWebAppPlaceholderRequest) (*Outline, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getWebAppPlaceholder", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOutline(result.Data) +} + type GetWebAppLinkUrlRequest struct { // Identifier of the chat in which the link was clicked; pass 0 if none ChatId int64 `json:"chat_id"` @@ -5243,12 +8865,10 @@ type GetWebAppLinkUrlRequest struct { WebAppShortName string `json:"web_app_short_name"` // Start parameter from internalLinkTypeWebApp StartParameter string `json:"start_parameter"` - // Preferred Web App theme; pass null to use the default theme - Theme *ThemeParameters `json:"theme"` - // Short name of the application; 0-64 English letters, digits, and underscores - ApplicationName string `json:"application_name"` // Pass true if the current user allowed the bot to send them messages AllowWriteAccess bool `json:"allow_write_access"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` } // Returns an HTTPS URL of a Web App to open after a link of the type internalLinkTypeWebApp is clicked @@ -5262,9 +8882,8 @@ func (client *Client) GetWebAppLinkUrl(req *GetWebAppLinkUrlRequest) (*HttpUrl, "bot_user_id": req.BotUserId, "web_app_short_name": req.WebAppShortName, "start_parameter": req.StartParameter, - "theme": req.Theme, - "application_name": req.ApplicationName, "allow_write_access": req.AllowWriteAccess, + "parameters": req.Parameters, }, }) if err != nil { @@ -5278,18 +8897,51 @@ func (client *Client) GetWebAppLinkUrl(req *GetWebAppLinkUrlRequest) (*HttpUrl, return UnmarshalHttpUrl(result.Data) } -type GetWebAppUrlRequest struct { - // Identifier of the target bot +type GetMainWebAppRequest struct { + // Identifier of the chat in which the Web App is opened; pass 0 if none + ChatId int64 `json:"chat_id"` + // Identifier of the target bot. If the bot is restricted for the current user, then show an error instead of calling the method BotUserId int64 `json:"bot_user_id"` - // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, an internalLinkTypeSideMenuBot link, or an empty when the bot is opened from the side menu - Url string `json:"url"` - // Preferred Web App theme; pass null to use the default theme - Theme *ThemeParameters `json:"theme"` - // Short name of the application; 0-64 English letters, digits, and underscores - ApplicationName string `json:"application_name"` + // Start parameter from internalLinkTypeMainWebApp + StartParameter string `json:"start_parameter"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` } -// Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, an inlineQueryResultsButtonTypeWebApp button, or an internalLinkTypeSideMenuBot link +// Returns information needed to open the main Web App of a bot +func (client *Client) GetMainWebApp(req *GetMainWebAppRequest) (*MainWebApp, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMainWebApp", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "bot_user_id": req.BotUserId, + "start_parameter": req.StartParameter, + "parameters": req.Parameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMainWebApp(result.Data) +} + +type GetWebAppUrlRequest struct { + // Identifier of the target bot. If the bot is restricted for the current user, then show an error instead of calling the method + BotUserId int64 `json:"bot_user_id"` + // The URL from a keyboardButtonTypeWebApp button, inlineQueryResultsButtonTypeWebApp button, or an empty string when the bot is opened from the side menu + Url string `json:"url"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` +} + +// Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, or an inlineQueryResultsButtonTypeWebApp button func (client *Client) GetWebAppUrl(req *GetWebAppUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -5298,8 +8950,7 @@ func (client *Client) GetWebAppUrl(req *GetWebAppUrlRequest) (*HttpUrl, error) { Data: map[string]interface{}{ "bot_user_id": req.BotUserId, "url": req.Url, - "theme": req.Theme, - "application_name": req.ApplicationName, + "parameters": req.Parameters, }, }) if err != nil { @@ -5348,18 +8999,16 @@ func (client *Client) SendWebAppData(req *SendWebAppDataRequest) (*Ok, error) { type OpenWebAppRequest struct { // Identifier of the chat in which the Web App is opened. The Web App can't be opened in secret chats ChatId int64 `json:"chat_id"` - // Identifier of the bot, providing the Web App + // Identifier of the bot, providing the Web App. If the bot is restricted for the current user, then show an error instead of calling the method BotUserId int64 `json:"bot_user_id"` // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise Url string `json:"url"` - // Preferred Web App theme; pass null to use the default theme - Theme *ThemeParameters `json:"theme"` - // Short name of the application; 0-64 English letters, digits, and underscores - ApplicationName string `json:"application_name"` - // If not 0, a message thread identifier in which the message will be sent - MessageThreadId int64 `json:"message_thread_id"` + // Topic in which the message will be sent; pass null if none + TopicId MessageTopic `json:"topic_id"` // Information about the message or story to be replied in the message sent by the Web App; pass null if none ReplyTo InputMessageReplyTo `json:"reply_to"` + // Parameters to use to open the Web App + Parameters *WebAppOpenParameters `json:"parameters"` } // Informs TDLib that a Web App is being opened from the attachment menu, a botMenuButton button, an internalLinkTypeAttachmentMenuBot link, or an inlineKeyboardButtonTypeWebApp button. For each bot, a confirmation alert about data sent to the bot must be shown once @@ -5372,10 +9021,9 @@ func (client *Client) OpenWebApp(req *OpenWebAppRequest) (*WebAppInfo, error) { "chat_id": req.ChatId, "bot_user_id": req.BotUserId, "url": req.Url, - "theme": req.Theme, - "application_name": req.ApplicationName, - "message_thread_id": req.MessageThreadId, + "topic_id": req.TopicId, "reply_to": req.ReplyTo, + "parameters": req.Parameters, }, }) if err != nil { @@ -5444,10 +9092,42 @@ func (client *Client) AnswerWebAppQuery(req *AnswerWebAppQueryRequest) (*SentWeb return UnmarshalSentWebAppMessage(result.Data) } +type CheckWebAppFileDownloadRequest struct { + // Identifier of the bot, providing the Web App + BotUserId int64 `json:"bot_user_id"` + // Name of the file + FileName string `json:"file_name"` + // URL of the file + Url string `json:"url"` +} + +// Checks whether a file can be downloaded and saved locally by Web App request +func (client *Client) CheckWebAppFileDownload(req *CheckWebAppFileDownloadRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkWebAppFileDownload", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "file_name": req.FileName, + "url": req.Url, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetCallbackQueryAnswerRequest struct { // Identifier of the chat with the message ChatId int64 `json:"chat_id"` - // Identifier of the message from which the query originated + // Identifier of the message from which the query originated. The message must not be scheduled MessageId int64 `json:"message_id"` // Query payload Payload CallbackQueryPayload `json:"payload"` @@ -5722,7 +9402,7 @@ type DeleteChatReplyMarkupRequest struct { MessageId int64 `json:"message_id"` } -// Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a replyMarkupForceReply reply markup has been used. An updateChatReplyMarkup update will be sent if the reply markup is changed +// Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a replyMarkupForceReply reply markup has been used or dismissed func (client *Client) DeleteChatReplyMarkup(req *DeleteChatReplyMarkupRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -5747,8 +9427,10 @@ func (client *Client) DeleteChatReplyMarkup(req *DeleteChatReplyMarkupRequest) ( type SendChatActionRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the action was performed - MessageThreadId int64 `json:"message_thread_id"` + // Identifier of the topic in which the action is performed; pass null if none + TopicId MessageTopic `json:"topic_id"` + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` // The action description; pass null to cancel the currently active action Action ChatAction `json:"action"` } @@ -5761,7 +9443,8 @@ func (client *Client) SendChatAction(req *SendChatActionRequest) (*Ok, error) { }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "topic_id": req.TopicId, + "business_connection_id": req.BusinessConnectionId, "action": req.Action, }, }) @@ -5776,6 +9459,41 @@ func (client *Client) SendChatAction(req *SendChatActionRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SendTextMessageDraftRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // The forum topic identifier in which the message will be sent; pass 0 if none + ForumTopicId int32 `json:"forum_topic_id"` + // Unique identifier of the draft + DraftId JsonInt64 `json:"draft_id"` + // Draft text of the message + Text *FormattedText `json:"text"` +} + +// Sends a draft for a being generated text message; for bots only +func (client *Client) SendTextMessageDraft(req *SendTextMessageDraftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendTextMessageDraft", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "forum_topic_id": req.ForumTopicId, + "draft_id": req.DraftId, + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type OpenChatRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -5835,7 +9553,7 @@ type ViewMessagesRequest struct { MessageIds []int64 `json:"message_ids"` // Source of the message view; pass null to guess the source based on chat open state Source MessageSource `json:"source"` - // Pass true to mark as read the specified messages even the chat is closed + // Pass true to mark as read the specified messages even if the chat is closed ForceRead bool `json:"force_read"` } @@ -5955,7 +9673,7 @@ type GetInternalLinkTypeRequest struct { Link string `json:"link"` } -// Returns information about the type of an internal link. Returns a 404 error if the link is not internal. Can be called before authorization +// Returns information about the type of internal link. Returns a 404 error if the link is not internal. Can be called before authorization func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (InternalLinkType, error) { result, err := client.Send(Request{ meta: meta{ @@ -5974,9 +9692,6 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte } switch result.Type { - case TypeInternalLinkTypeActiveSessions: - return UnmarshalInternalLinkTypeActiveSessions(result.Data) - case TypeInternalLinkTypeAttachmentMenuBot: return UnmarshalInternalLinkTypeAttachmentMenuBot(result.Data) @@ -5995,8 +9710,14 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(result.Data) - case TypeInternalLinkTypeChangePhoneNumber: - return UnmarshalInternalLinkTypeChangePhoneNumber(result.Data) + case TypeInternalLinkTypeBusinessChat: + return UnmarshalInternalLinkTypeBusinessChat(result.Data) + + case TypeInternalLinkTypeCallsPage: + return UnmarshalInternalLinkTypeCallsPage(result.Data) + + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(result.Data) case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(result.Data) @@ -6004,21 +9725,30 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeChatFolderInvite: return UnmarshalInternalLinkTypeChatFolderInvite(result.Data) - case TypeInternalLinkTypeChatFolderSettings: - return UnmarshalInternalLinkTypeChatFolderSettings(result.Data) - case TypeInternalLinkTypeChatInvite: return UnmarshalInternalLinkTypeChatInvite(result.Data) - case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: - return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(result.Data) + case TypeInternalLinkTypeChatSelection: + return UnmarshalInternalLinkTypeChatSelection(result.Data) - case TypeInternalLinkTypeEditProfileSettings: - return UnmarshalInternalLinkTypeEditProfileSettings(result.Data) + case TypeInternalLinkTypeContactsPage: + return UnmarshalInternalLinkTypeContactsPage(result.Data) + + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(result.Data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(result.Data) + case TypeInternalLinkTypeGiftAuction: + return UnmarshalInternalLinkTypeGiftAuction(result.Data) + + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(result.Data) + + case TypeInternalLinkTypeGroupCall: + return UnmarshalInternalLinkTypeGroupCall(result.Data) + case TypeInternalLinkTypeInstantView: return UnmarshalInternalLinkTypeInstantView(result.Data) @@ -6028,8 +9758,11 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeLanguagePack: return UnmarshalInternalLinkTypeLanguagePack(result.Data) - case TypeInternalLinkTypeLanguageSettings: - return UnmarshalInternalLinkTypeLanguageSettings(result.Data) + case TypeInternalLinkTypeLiveStory: + return UnmarshalInternalLinkTypeLiveStory(result.Data) + + case TypeInternalLinkTypeMainWebApp: + return UnmarshalInternalLinkTypeMainWebApp(result.Data) case TypeInternalLinkTypeMessage: return UnmarshalInternalLinkTypeMessage(result.Data) @@ -6037,20 +9770,35 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(result.Data) + case TypeInternalLinkTypeMyProfilePage: + return UnmarshalInternalLinkTypeMyProfilePage(result.Data) + + case TypeInternalLinkTypeNewChannelChat: + return UnmarshalInternalLinkTypeNewChannelChat(result.Data) + + case TypeInternalLinkTypeNewGroupChat: + return UnmarshalInternalLinkTypeNewGroupChat(result.Data) + + case TypeInternalLinkTypeNewPrivateChat: + return UnmarshalInternalLinkTypeNewPrivateChat(result.Data) + + case TypeInternalLinkTypeNewStory: + return UnmarshalInternalLinkTypeNewStory(result.Data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(result.Data) case TypeInternalLinkTypePhoneNumberConfirmation: return UnmarshalInternalLinkTypePhoneNumberConfirmation(result.Data) - case TypeInternalLinkTypePremiumFeatures: - return UnmarshalInternalLinkTypePremiumFeatures(result.Data) + case TypeInternalLinkTypePremiumFeaturesPage: + return UnmarshalInternalLinkTypePremiumFeaturesPage(result.Data) case TypeInternalLinkTypePremiumGiftCode: return UnmarshalInternalLinkTypePremiumGiftCode(result.Data) - case TypeInternalLinkTypePrivacyAndSecuritySettings: - return UnmarshalInternalLinkTypePrivacyAndSecuritySettings(result.Data) + case TypeInternalLinkTypePremiumGiftPurchase: + return UnmarshalInternalLinkTypePremiumGiftPurchase(result.Data) case TypeInternalLinkTypeProxy: return UnmarshalInternalLinkTypeProxy(result.Data) @@ -6064,11 +9812,17 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeRestorePurchases: return UnmarshalInternalLinkTypeRestorePurchases(result.Data) + case TypeInternalLinkTypeSavedMessages: + return UnmarshalInternalLinkTypeSavedMessages(result.Data) + + case TypeInternalLinkTypeSearch: + return UnmarshalInternalLinkTypeSearch(result.Data) + case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(result.Data) - case TypeInternalLinkTypeSideMenuBot: - return UnmarshalInternalLinkTypeSideMenuBot(result.Data) + case TypeInternalLinkTypeStarPurchase: + return UnmarshalInternalLinkTypeStarPurchase(result.Data) case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(result.Data) @@ -6076,17 +9830,17 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(result.Data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(result.Data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(result.Data) - case TypeInternalLinkTypeThemeSettings: - return UnmarshalInternalLinkTypeThemeSettings(result.Data) - case TypeInternalLinkTypeUnknownDeepLink: return UnmarshalInternalLinkTypeUnknownDeepLink(result.Data) - case TypeInternalLinkTypeUnsupportedProxy: - return UnmarshalInternalLinkTypeUnsupportedProxy(result.Data) + case TypeInternalLinkTypeUpgradedGift: + return UnmarshalInternalLinkTypeUpgradedGift(result.Data) case TypeInternalLinkTypeUserPhoneNumber: return UnmarshalInternalLinkTypeUserPhoneNumber(result.Data) @@ -6110,7 +9864,7 @@ type GetExternalLinkInfoRequest struct { Link string `json:"link"` } -// Returns information about an action to be done when the current user clicks an external link. Don't use this method for links from secret chats if web page preview is disabled in secret chats +// Returns information about an action to be done when the current user clicks an external link. Don't use this method for links from secret chats if link preview is disabled in secret chats func (client *Client) GetExternalLinkInfo(req *GetExternalLinkInfoRequest) (LoginUrlInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -6143,11 +9897,13 @@ func (client *Client) GetExternalLinkInfo(req *GetExternalLinkInfoRequest) (Logi type GetExternalLinkRequest struct { // The HTTP link Link string `json:"link"` - // Pass true if the current user allowed the bot, returned in getExternalLinkInfo, to send them messages + // Pass true if the current user allowed the bot that was returned in getExternalLinkInfo, to send them messages AllowWriteAccess bool `json:"allow_write_access"` + // Pass true if the current user allowed the bot that was returned in getExternalLinkInfo, to access their phone number + AllowPhoneNumberAccess bool `json:"allow_phone_number_access"` } -// Returns an HTTP URL which can be used to automatically authorize the current user on a website after clicking an HTTP link. Use the method getExternalLinkInfo to find whether a prior user confirmation is needed +// Returns an HTTP URL which can be used to automatically authorize the current user on a website after clicking an HTTP link. Use the method getExternalLinkInfo to find whether a prior user confirmation is needed. May return an empty link if just a toast about successful login has to be shown func (client *Client) GetExternalLink(req *GetExternalLinkRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -6156,6 +9912,7 @@ func (client *Client) GetExternalLink(req *GetExternalLinkRequest) (*HttpUrl, er Data: map[string]interface{}{ "link": req.Link, "allow_write_access": req.AllowWriteAccess, + "allow_phone_number_access": req.AllowPhoneNumberAccess, }, }) if err != nil { @@ -6195,41 +9952,12 @@ func (client *Client) ReadAllChatMentions(req *ReadAllChatMentionsRequest) (*Ok, return UnmarshalOk(result.Data) } -type ReadAllMessageThreadMentionsRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // Message thread identifier in which mentions are marked as read - MessageThreadId int64 `json:"message_thread_id"` -} - -// Marks all mentions in a forum topic as read -func (client *Client) ReadAllMessageThreadMentions(req *ReadAllMessageThreadMentionsRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "readAllMessageThreadMentions", - }, - Data: map[string]interface{}{ - "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type ReadAllChatReactionsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` } -// Marks all reactions in a chat or a forum topic as read +// Marks all reactions in a chat as read func (client *Client) ReadAllChatReactions(req *ReadAllChatReactionsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6250,35 +9978,6 @@ func (client *Client) ReadAllChatReactions(req *ReadAllChatReactionsRequest) (*O return UnmarshalOk(result.Data) } -type ReadAllMessageThreadReactionsRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` - // Message thread identifier in which reactions are marked as read - MessageThreadId int64 `json:"message_thread_id"` -} - -// Marks all reactions in a forum topic as read -func (client *Client) ReadAllMessageThreadReactions(req *ReadAllMessageThreadReactionsRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "readAllMessageThreadReactions", - }, - Data: map[string]interface{}{ - "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type CreatePrivateChatRequest struct { // User identifier UserId int64 `json:"user_id"` @@ -6401,8 +10100,8 @@ type CreateNewBasicGroupChatRequest struct { MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` } -// Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat -func (client *Client) CreateNewBasicGroupChat(req *CreateNewBasicGroupChatRequest) (*Chat, error) { +// Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns information about the newly created chat +func (client *Client) CreateNewBasicGroupChat(req *CreateNewBasicGroupChatRequest) (*CreatedBasicGroupChat, error) { result, err := client.Send(Request{ meta: meta{ Type: "createNewBasicGroupChat", @@ -6421,7 +10120,7 @@ func (client *Client) CreateNewBasicGroupChat(req *CreateNewBasicGroupChatReques return nil, buildResponseError(result.Data) } - return UnmarshalChat(result.Data) + return UnmarshalCreatedBasicGroupChat(result.Data) } type CreateNewSupergroupChatRequest struct { @@ -6499,7 +10198,7 @@ type UpgradeBasicGroupChatToSupergroupChatRequest struct { ChatId int64 `json:"chat_id"` } -// Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group +// Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires owner privileges. Deactivates the original basic group func (client *Client) UpgradeBasicGroupChatToSupergroupChat(req *UpgradeBasicGroupChatToSupergroupChatRequest) (*Chat, error) { result, err := client.Send(Request{ meta: meta{ @@ -6525,7 +10224,7 @@ type GetChatListsToAddChatRequest struct { ChatId int64 `json:"chat_id"` } -// Returns chat lists to which the chat can be added. This is an offline request +// Returns chat lists to which the chat can be added. This is an offline method func (client *Client) GetChatListsToAddChat(req *GetChatListsToAddChatRequest) (*ChatLists, error) { result, err := client.Send(Request{ meta: meta{ @@ -6766,6 +10465,32 @@ func (client *Client) ReorderChatFolders(req *ReorderChatFoldersRequest) (*Ok, e return UnmarshalOk(result.Data) } +type ToggleChatFolderTagsRequest struct { + // Pass true to enable folder tags; pass false to disable them + AreTagsEnabled bool `json:"are_tags_enabled"` +} + +// Toggles whether chat folder tags are enabled +func (client *Client) ToggleChatFolderTags(req *ToggleChatFolderTagsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatFolderTags", + }, + Data: map[string]interface{}{ + "are_tags_enabled": req.AreTagsEnabled, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns recommended chat folders for the current user func (client *Client) GetRecommendedChatFolders() (*RecommendedChatFolders, error) { result, err := client.Send(Request{ @@ -7126,7 +10851,7 @@ type SetChatTitleRequest struct { Title string `json:"title"` } -// Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right +// Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info member right func (client *Client) SetChatTitle(req *SetChatTitleRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7155,7 +10880,7 @@ type SetChatPhotoRequest struct { Photo InputChatPhoto `json:"photo"` } -// Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info administrator right +// Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info member right func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7180,13 +10905,13 @@ func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) { type SetChatAccentColorRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifier of the accent color to use + // Identifier of the accent color to use. The chat must have at least accentColor.min_channel_chat_boost_level boost level to pass the corresponding color AccentColorId int32 `json:"accent_color_id"` - // Identifier of a custom emoji to be shown on the reply header background; 0 if none + // Identifier of a custom emoji to be shown on the reply header and link preview background; 0 if none. Use chatBoostLevelFeatures.can_set_background_custom_emoji to check whether a custom emoji can be set BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` } -// Changes accent color and background custom emoji of a chat. Supported only for channels with getOption("channel_custom_accent_color_boost_level_min") boost level. Requires can_change_info administrator right +// Changes accent color and background custom emoji of a channel chat. Requires can_change_info administrator right func (client *Client) SetChatAccentColor(req *SetChatAccentColorRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7209,6 +10934,38 @@ func (client *Client) SetChatAccentColor(req *SetChatAccentColorRequest) (*Ok, e return UnmarshalOk(result.Data) } +type SetChatProfileAccentColorRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Identifier of the accent color to use for profile; pass -1 if none. The chat must have at least profileAccentColor.min_supergroup_chat_boost_level for supergroups or profileAccentColor.min_channel_chat_boost_level for channels boost level to pass the corresponding color + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + // Identifier of a custom emoji to be shown on the chat's profile photo background; 0 if none. Use chatBoostLevelFeatures.can_set_profile_background_custom_emoji to check whether a custom emoji can be set + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` +} + +// Changes accent color and background custom emoji for profile of a supergroup or channel chat. Requires can_change_info administrator right +func (client *Client) SetChatProfileAccentColor(req *SetChatProfileAccentColorRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatProfileAccentColor", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "profile_accent_color_id": req.ProfileAccentColorId, + "profile_background_custom_emoji_id": req.ProfileBackgroundCustomEmojiId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetChatMessageAutoDeleteTimeRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -7216,7 +10973,7 @@ type SetChatMessageAutoDeleteTimeRequest struct { MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` } -// Changes the message auto-delete or self-destruct (for secret chats) time in a chat. Requires change_info administrator right in basic groups, supergroups and channels Message auto-delete time can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). +// Changes the message auto-delete or self-destruct (for secret chats) time in a chat. Requires change_info administrator right in basic groups, supergroups and channels. Message auto-delete time can't be changed in a chat with the current user (Saved Messages) and the chat 777000 (Telegram). func (client *Client) SetChatMessageAutoDeleteTime(req *SetChatMessageAutoDeleteTimeRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7238,6 +10995,35 @@ func (client *Client) SetChatMessageAutoDeleteTime(req *SetChatMessageAutoDelete return UnmarshalOk(result.Data) } +type SetChatEmojiStatusRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New emoji status; pass null to remove emoji status + EmojiStatus *EmojiStatus `json:"emoji_status"` +} + +// Changes the emoji status of a chat. Use chatBoostLevelFeatures.can_set_emoji_status to check whether an emoji status can be set. Requires can_change_info administrator right +func (client *Client) SetChatEmojiStatus(req *SetChatEmojiStatusRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatEmojiStatus", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "emoji_status": req.EmojiStatus, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetChatPermissionsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -7270,15 +11056,17 @@ func (client *Client) SetChatPermissions(req *SetChatPermissionsRequest) (*Ok, e type SetChatBackgroundRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // The input background to use; pass null to create a new filled background or to remove the current background + // The input background to use; pass null to create a new filled or chat theme background Background InputBackground `json:"background"` - // Background type; pass null to remove the current background + // Background type; pass null to use default background type for the chosen background; backgroundTypeChatTheme isn't supported for private and secret chats. Use chatBoostLevelFeatures.chat_theme_background_count and chatBoostLevelFeatures.can_set_custom_background to check whether the background type can be set in the boosted chat Type BackgroundType `json:"type"` - // Dimming of the background in dark themes, as a percentage; 0-100 + // Dimming of the background in dark themes, as a percentage; 0-100. Applied only to Wallpaper and Fill types of background DarkThemeDimming int32 `json:"dark_theme_dimming"` + // Pass true to set background only for self; pass false to set background for all chat users. Always false for backgrounds set in boosted chats. Background can be set for both users only by Telegram Premium users and if set background isn't of the type inputBackgroundPrevious + OnlyForSelf bool `json:"only_for_self"` } -// Changes the background in a specific chat. Supported only in private and secret chats with non-deleted users +// Sets the background in a specific chat. Supported only in private and secret chats with non-deleted users, and in chats with sufficient boost level and can_change_info administrator right func (client *Client) SetChatBackground(req *SetChatBackgroundRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7289,6 +11077,7 @@ func (client *Client) SetChatBackground(req *SetChatBackgroundRequest) (*Ok, err "background": req.Background, "type": req.Type, "dark_theme_dimming": req.DarkThemeDimming, + "only_for_self": req.OnlyForSelf, }, }) if err != nil { @@ -7302,11 +11091,69 @@ func (client *Client) SetChatBackground(req *SetChatBackgroundRequest) (*Ok, err return UnmarshalOk(result.Data) } +type DeleteChatBackgroundRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Pass true to restore previously set background. Can be used only in private and secret chats with non-deleted users if userFullInfo.set_chat_background == true. Supposed to be used from messageChatSetBackground messages with the currently set background that was set for both sides by the other user + RestorePrevious bool `json:"restore_previous"` +} + +// Deletes background in a specific chat +func (client *Client) DeleteChatBackground(req *DeleteChatBackgroundRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteChatBackground", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "restore_previous": req.RestorePrevious, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetGiftChatThemesRequest struct { + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of chat themes to return + Limit int32 `json:"limit"` +} + +// Returns available to the current user gift chat themes +func (client *Client) GetGiftChatThemes(req *GetGiftChatThemesRequest) (*GiftChatThemes, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftChatThemes", + }, + Data: map[string]interface{}{ + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftChatThemes(result.Data) +} + type SetChatThemeRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Name of the new chat theme; pass an empty string to return the default theme - ThemeName string `json:"theme_name"` + // New chat theme; pass null to return the default theme + Theme InputChatTheme `json:"theme"` } // Changes the chat theme. Supported only in private and secret chats @@ -7317,7 +11164,7 @@ func (client *Client) SetChatTheme(req *SetChatThemeRequest) (*Ok, error) { }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "theme_name": req.ThemeName, + "theme": req.Theme, }, }) if err != nil { @@ -7334,13 +11181,13 @@ func (client *Client) SetChatTheme(req *SetChatThemeRequest) (*Ok, error) { type SetChatDraftMessageRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the draft was changed - MessageThreadId int64 `json:"message_thread_id"` - // New draft message; pass null to remove the draft + // Topic in which the draft will be changed; pass null to change the draft for the chat itself + TopicId MessageTopic `json:"topic_id"` + // New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored DraftMessage *DraftMessage `json:"draft_message"` } -// Changes the draft message in a chat +// Changes the draft message in a chat or a topic func (client *Client) SetChatDraftMessage(req *SetChatDraftMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7348,7 +11195,7 @@ func (client *Client) SetChatDraftMessage(req *SetChatDraftMessageRequest) (*Ok, }, Data: map[string]interface{}{ "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, + "topic_id": req.TopicId, "draft_message": req.DraftMessage, }, }) @@ -7421,6 +11268,35 @@ func (client *Client) ToggleChatHasProtectedContent(req *ToggleChatHasProtectedC return UnmarshalOk(result.Data) } +type ToggleChatViewAsTopicsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of view_as_topics + ViewAsTopics bool `json:"view_as_topics"` +} + +// Changes the view_as_topics setting of a forum chat or Saved Messages +func (client *Client) ToggleChatViewAsTopics(req *ToggleChatViewAsTopicsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatViewAsTopics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "view_as_topics": req.ViewAsTopics, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleChatIsTranslatableRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -7428,7 +11304,7 @@ type ToggleChatIsTranslatableRequest struct { IsTranslatable bool `json:"is_translatable"` } -// Changes the translatable state of a chat; for Telegram Premium users only +// Changes the translatable state of a chat func (client *Client) ToggleChatIsTranslatable(req *ToggleChatIsTranslatableRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7511,11 +11387,11 @@ func (client *Client) ToggleChatDefaultDisableNotification(req *ToggleChatDefaul type SetChatAvailableReactionsRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` - // Reactions available in the chat. All emoji reactions must be active + // Reactions available in the chat. All explicitly specified emoji reactions must be active. In channel chats up to the chat's boost level custom emoji reactions can be explicitly specified AvailableReactions ChatAvailableReactions `json:"available_reactions"` } -// Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right +// Changes reactions, available in a chat. Available for basic groups, supergroups, and channels. Requires can_change_info member right func (client *Client) SetChatAvailableReactions(req *SetChatAvailableReactionsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7573,7 +11449,7 @@ type SetChatDescriptionRequest struct { Description string `json:"description"` } -// Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info administrator right +// Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info member right func (client *Client) SetChatDescription(req *SetChatDescriptionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7596,7 +11472,7 @@ func (client *Client) SetChatDescription(req *SetChatDescriptionRequest) (*Ok, e } type SetChatDiscussionGroupRequest struct { - // Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup) + // Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages member right in the supergroup) ChatId int64 `json:"chat_id"` // Identifier of a new channel's discussion group. Use 0 to remove the discussion group. Use the method getSuitableDiscussionChats to find all suitable groups. Basic group chats must be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable must be used first to change that DiscussionChatId int64 `json:"discussion_chat_id"` @@ -7624,6 +11500,38 @@ func (client *Client) SetChatDiscussionGroup(req *SetChatDiscussionGroupRequest) return UnmarshalOk(result.Data) } +type SetChatDirectMessagesGroupRequest struct { + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` + // Pass true if the direct messages group is enabled for the channel chat; pass false otherwise + IsEnabled bool `json:"is_enabled"` + // The new number of Telegram Stars that must be paid for each message that is sent to the direct messages chat unless the sender is an administrator of the channel chat; 0-getOption("paid_message_star_count_max"). The channel will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. Requires supergroupFullInfo.can_enable_paid_messages for positive amounts + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Changes direct messages group settings for a channel chat; requires owner privileges in the chat +func (client *Client) SetChatDirectMessagesGroup(req *SetChatDirectMessagesGroupRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatDirectMessagesGroup", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_enabled": req.IsEnabled, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetChatLocationRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -7656,11 +11564,11 @@ func (client *Client) SetChatLocation(req *SetChatLocationRequest) (*Ok, error) type SetChatSlowModeDelayRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // New slow mode delay for the chat, in seconds; must be one of 0, 10, 30, 60, 300, 900, 3600 + // New slow mode delay for the chat, in seconds; must be one of 0, 5, 10, 30, 60, 300, 900, 3600 SlowModeDelay int32 `json:"slow_mode_delay"` } -// Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members rights +// Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members administrator right func (client *Client) SetChatSlowModeDelay(req *SetChatSlowModeDelayRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7693,7 +11601,7 @@ type PinChatMessageRequest struct { OnlyForSelf bool `json:"only_for_self"` } -// Pins a message in a chat; requires can_pin_messages rights or can_edit_messages rights in the channel +// Pins a message in a chat. A message can be pinned only if messageProperties.can_be_pinned func (client *Client) PinChatMessage(req *PinChatMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7724,7 +11632,7 @@ type UnpinChatMessageRequest struct { MessageId int64 `json:"message_id"` } -// Removes a pinned message from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel +// Removes a pinned message from a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel func (client *Client) UnpinChatMessage(req *UnpinChatMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7751,7 +11659,7 @@ type UnpinAllChatMessagesRequest struct { ChatId int64 `json:"chat_id"` } -// Removes all pinned messages from a chat; requires can_pin_messages rights in the group or can_edit_messages rights in the channel +// Removes all pinned messages from a chat; requires can_pin_messages member right if the chat is a basic group or supergroup, or can_edit_messages administrator right if the chat is a channel func (client *Client) UnpinAllChatMessages(req *UnpinAllChatMessagesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7772,35 +11680,6 @@ func (client *Client) UnpinAllChatMessages(req *UnpinAllChatMessagesRequest) (*O return UnmarshalOk(result.Data) } -type UnpinAllMessageThreadMessagesRequest struct { - // Identifier of the chat - ChatId int64 `json:"chat_id"` - // Message thread identifier in which messages will be unpinned - MessageThreadId int64 `json:"message_thread_id"` -} - -// Removes all pinned messages from a forum topic; requires can_pin_messages rights in the supergroup -func (client *Client) UnpinAllMessageThreadMessages(req *UnpinAllMessageThreadMessagesRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "unpinAllMessageThreadMessages", - }, - Data: map[string]interface{}{ - "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type JoinChatRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -7862,8 +11741,8 @@ type AddChatMemberRequest struct { ForwardLimit int32 `json:"forward_limit"` } -// Adds a new member to a chat. Members can't be added to private or secret chats -func (client *Client) AddChatMember(req *AddChatMemberRequest) (*Ok, error) { +// Adds a new member to a chat; requires can_invite_users member right. Members can't be added to private or secret chats. Returns information about members that weren't added +func (client *Client) AddChatMember(req *AddChatMemberRequest) (*FailedToAddMembers, error) { result, err := client.Send(Request{ meta: meta{ Type: "addChatMember", @@ -7882,7 +11761,7 @@ func (client *Client) AddChatMember(req *AddChatMemberRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + return UnmarshalFailedToAddMembers(result.Data) } type AddChatMembersRequest struct { @@ -7892,8 +11771,8 @@ type AddChatMembersRequest struct { UserIds []int64 `json:"user_ids"` } -// Adds multiple new members to a chat. Currently, this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members -func (client *Client) AddChatMembers(req *AddChatMembersRequest) (*Ok, error) { +// Adds multiple new members to a chat; requires can_invite_users member right. Currently, this method is only available for supergroups and channels. This method can't be used to join a chat. Members can't be added to a channel if it has more than 200 members. Returns information about members that weren't added +func (client *Client) AddChatMembers(req *AddChatMembersRequest) (*FailedToAddMembers, error) { result, err := client.Send(Request{ meta: meta{ Type: "addChatMembers", @@ -7911,7 +11790,7 @@ func (client *Client) AddChatMembers(req *AddChatMembersRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + return UnmarshalFailedToAddMembers(result.Data) } type SetChatMemberStatusRequest struct { @@ -7923,7 +11802,7 @@ type SetChatMemberStatusRequest struct { Status ChatMemberStatus `json:"status"` } -// Changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for transferring chat ownership; use transferChatOwnership instead. Use addChatMember or banChatMember if some additional parameters needs to be passed +// Changes the status of a chat member; requires can_invite_users member right to add a chat member, can_promote_members administrator right to change administrator rights of the member, and can_restrict_members administrator right to change restrictions of a user. This function is currently not suitable for transferring chat ownership; use transferChatOwnership instead. Use addChatMember or banChatMember if some additional parameters needs to be passed func (client *Client) SetChatMemberStatus(req *SetChatMemberStatusRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7953,11 +11832,11 @@ type BanChatMemberRequest struct { MemberId MessageSender `json:"member_id"` // Point in time (Unix timestamp) when the user will be unbanned; 0 if never. If the user is banned for more than 366 days or for less than 30 seconds from the current time, the user is considered to be banned forever. Ignored in basic groups and if a chat is banned BannedUntilDate int32 `json:"banned_until_date"` - // Pass true to delete all messages in the chat for the user that is being removed. Always true for supergroups and channels + // Pass true to delete all messages in the chat for the user who is being removed. Always true for supergroups and channels RevokeMessages bool `json:"revoke_messages"` } -// Bans a member in a chat. Members can't be banned in private or secret chats. In supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first +// Bans a member in a chat; requires can_restrict_members administrator right. Members can't be banned in private or secret chats. In supergroups and channels, the user will not be able to return to the group on their own using invite links, etc., unless unbanned first func (client *Client) BanChatMember(req *BanChatMemberRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8024,7 +11903,7 @@ type TransferChatOwnershipRequest struct { Password string `json:"password"` } -// Changes the owner of a chat. The current user must be a current owner of the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats +// Changes the owner of a chat; requires owner privileges in the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats func (client *Client) TransferChatOwnership(req *TransferChatOwnershipRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8047,6 +11926,32 @@ func (client *Client) TransferChatOwnership(req *TransferChatOwnershipRequest) ( return UnmarshalOk(result.Data) } +type GetChatOwnerAfterLeavingRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns the user who will become the owner of the chat after 7 days if the current user does not return to the chat during that period; requires owner privileges in the chat. Available only for supergroups and channel chats +func (client *Client) GetChatOwnerAfterLeaving(req *GetChatOwnerAfterLeavingRequest) (*User, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatOwnerAfterLeaving", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUser(result.Data) +} + type GetChatMemberRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -8087,7 +11992,7 @@ type SearchChatMembersRequest struct { Filter ChatMembersFilter `json:"filter"` } -// Searches for a specified query in the first name, last name and usernames of the members of a specified chat. Requires administrator rights in channels +// Searches for a specified query in the first name, last name and usernames of the members of a specified chat. Requires administrator rights if the chat is a channel func (client *Client) SearchChatMembers(req *SearchChatMembersRequest) (*ChatMembers, error) { result, err := client.Send(Request{ meta: meta{ @@ -8163,6 +12068,25 @@ func (client *Client) ClearAllDraftMessages(req *ClearAllDraftMessagesRequest) ( return UnmarshalOk(result.Data) } +// Returns the current state of stake dice +func (client *Client) GetStakeDiceState() (*StakeDiceState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStakeDiceState", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStakeDiceState(result.Data) +} + type GetSavedNotificationSoundRequest struct { // Identifier of the notification sound NotificationSoundId JsonInt64 `json:"notification_sound_id"` @@ -8189,7 +12113,7 @@ func (client *Client) GetSavedNotificationSound(req *GetSavedNotificationSoundRe return UnmarshalNotificationSounds(result.Data) } -// Returns list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used +// Returns the list of saved notification sounds. If a sound isn't in the list, then default sound needs to be used func (client *Client) GetSavedNotificationSounds() (*NotificationSounds, error) { result, err := client.Send(Request{ meta: meta{ @@ -8267,7 +12191,7 @@ type GetChatNotificationSettingsExceptionsRequest struct { CompareSound bool `json:"compare_sound"` } -// Returns list of chats with non-default notification settings for new messages +// Returns the list of chats with non-default notification settings for new messages func (client *Client) GetChatNotificationSettingsExceptions(req *GetChatNotificationSettingsExceptionsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -8344,7 +12268,33 @@ func (client *Client) SetScopeNotificationSettings(req *SetScopeNotificationSett return UnmarshalOk(result.Data) } -// Resets all notification settings to their default values. By default, all chats are unmuted and message previews are shown +type SetReactionNotificationSettingsRequest struct { + // The new notification settings for reactions + NotificationSettings *ReactionNotificationSettings `json:"notification_settings"` +} + +// Changes notification settings for reactions +func (client *Client) SetReactionNotificationSettings(req *SetReactionNotificationSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setReactionNotificationSettings", + }, + Data: map[string]interface{}{ + "notification_settings": req.NotificationSettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Resets all chat and scope notification settings to their default values. By default, all chats are unmuted and message previews are shown func (client *Client) ResetAllNotificationSettings() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8429,7 +12379,7 @@ type ReadChatListRequest struct { ChatList ChatList `json:"chat_list"` } -// Traverse all chats in a chat list and marks all messages in the chats as read +// Traverses all chats in a chat list and marks all messages in the chats as read func (client *Client) ReadChatList(req *ReadChatListRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8450,9 +12400,35 @@ func (client *Client) ReadChatList(req *ReadChatListRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type GetCurrentWeatherRequest struct { + // The location + Location *Location `json:"location"` +} + +// Returns the current weather in the given location +func (client *Client) GetCurrentWeather(req *GetCurrentWeatherRequest) (*CurrentWeather, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCurrentWeather", + }, + Data: map[string]interface{}{ + "location": req.Location, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCurrentWeather(result.Data) +} + type GetStoryRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` // Pass true to get only locally available information without sending network requests @@ -8466,7 +12442,7 @@ func (client *Client) GetStory(req *GetStoryRequest) (*Story, error) { Type: "getStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "only_local": req.OnlyLocal, }, @@ -8482,11 +12458,11 @@ func (client *Client) GetStory(req *GetStoryRequest) (*Story, error) { return UnmarshalStory(result.Data) } -// Returns channel chats in which the current user has the right to post stories. The chats must be rechecked with canSendStory before actually trying to post a story there -func (client *Client) GetChatsToSendStories() (*Chats, error) { +// Returns supergroup and channel chats in which the current user has the right to post stories. The chats must be rechecked with canPostStory before actually trying to post a story there +func (client *Client) GetChatsToPostStories() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getChatsToSendStories", + Type: "getChatsToPostStories", }, Data: map[string]interface{}{}, }) @@ -8501,16 +12477,16 @@ func (client *Client) GetChatsToSendStories() (*Chats, error) { return UnmarshalChats(result.Data) } -type CanSendStoryRequest struct { - // Chat identifier +type CanPostStoryRequest struct { + // Chat identifier. Pass Saved Messages chat identifier when posting a story on behalf of the current user ChatId int64 `json:"chat_id"` } -// Checks whether the current user can send a story on behalf of a chat; requires can_post_stories rights for channel chats -func (client *Client) CanSendStory(req *CanSendStoryRequest) (CanSendStoryResult, error) { +// Checks whether the current user can post a story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats +func (client *Client) CanPostStory(req *CanPostStoryRequest) (CanPostStoryResult, error) { result, err := client.Send(Request{ meta: meta{ - Type: "canSendStory", + Type: "canPostStory", }, Data: map[string]interface{}{ "chat_id": req.ChatId, @@ -8525,53 +12501,60 @@ func (client *Client) CanSendStory(req *CanSendStoryRequest) (CanSendStoryResult } switch result.Type { - case TypeCanSendStoryResultOk: - return UnmarshalCanSendStoryResultOk(result.Data) + case TypeCanPostStoryResultOk: + return UnmarshalCanPostStoryResultOk(result.Data) - case TypeCanSendStoryResultPremiumNeeded: - return UnmarshalCanSendStoryResultPremiumNeeded(result.Data) + case TypeCanPostStoryResultPremiumNeeded: + return UnmarshalCanPostStoryResultPremiumNeeded(result.Data) - case TypeCanSendStoryResultBoostNeeded: - return UnmarshalCanSendStoryResultBoostNeeded(result.Data) + case TypeCanPostStoryResultBoostNeeded: + return UnmarshalCanPostStoryResultBoostNeeded(result.Data) - case TypeCanSendStoryResultActiveStoryLimitExceeded: - return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(result.Data) + case TypeCanPostStoryResultActiveStoryLimitExceeded: + return UnmarshalCanPostStoryResultActiveStoryLimitExceeded(result.Data) - case TypeCanSendStoryResultWeeklyLimitExceeded: - return UnmarshalCanSendStoryResultWeeklyLimitExceeded(result.Data) + case TypeCanPostStoryResultWeeklyLimitExceeded: + return UnmarshalCanPostStoryResultWeeklyLimitExceeded(result.Data) - case TypeCanSendStoryResultMonthlyLimitExceeded: - return UnmarshalCanSendStoryResultMonthlyLimitExceeded(result.Data) + case TypeCanPostStoryResultMonthlyLimitExceeded: + return UnmarshalCanPostStoryResultMonthlyLimitExceeded(result.Data) + + case TypeCanPostStoryResultLiveStoryIsActive: + return UnmarshalCanPostStoryResultLiveStoryIsActive(result.Data) default: return nil, errors.New("invalid type") } } -type SendStoryRequest struct { - // Identifier of the chat that will post the story +type PostStoryRequest struct { + // Identifier of the chat that will post the story. Pass Saved Messages chat identifier when posting a story on behalf of the current user ChatId int64 `json:"chat_id"` // Content of the story Content InputStoryContent `json:"content"` // Clickable rectangle areas to be shown on the story media; pass null if none Areas *InputStoryAreas `json:"areas"` - // Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters + // Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters; can have entities only if getOption("can_use_text_entities_in_story_caption") Caption *FormattedText `json:"caption"` - // The privacy settings for the story + // The privacy settings for the story; ignored for stories posted on behalf of supergroup and channel chats PrivacySettings StoryPrivacySettings `json:"privacy_settings"` + // Identifiers of story albums to which the story will be added upon posting. An album can have up to getOption("story_album_size_max") stories + AlbumIds []int32 `json:"album_ids"` // Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise ActivePeriod int32 `json:"active_period"` + // Full identifier of the original story, which content was used to create the story; pass null if the story isn't repost of another story + FromStoryFullId *StoryFullId `json:"from_story_full_id"` // Pass true to keep the story accessible after expiration - IsPinned bool `json:"is_pinned"` + IsPostedToChatPage bool `json:"is_posted_to_chat_page"` // Pass true if the content of the story must be protected from forwarding and screenshotting ProtectContent bool `json:"protect_content"` } -// Sends a new story to a chat; requires can_post_stories rights for channel chats. Returns a temporary story -func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { +// Posts a new story on behalf of a chat; requires can_post_stories administrator right for supergroup and channel chats. Returns a temporary story +func (client *Client) PostStory(req *PostStoryRequest) (*Story, error) { result, err := client.Send(Request{ meta: meta{ - Type: "sendStory", + Type: "postStory", }, Data: map[string]interface{}{ "chat_id": req.ChatId, @@ -8579,8 +12562,10 @@ func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { "areas": req.Areas, "caption": req.Caption, "privacy_settings": req.PrivacySettings, + "album_ids": req.AlbumIds, "active_period": req.ActivePeriod, - "is_pinned": req.IsPinned, + "from_story_full_id": req.FromStoryFullId, + "is_posted_to_chat_page": req.IsPostedToChatPage, "protect_content": req.ProtectContent, }, }) @@ -8595,9 +12580,59 @@ func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { return UnmarshalStory(result.Data) } +type StartLiveStoryRequest struct { + // Identifier of the chat that will start the live story. Pass Saved Messages chat identifier when starting a live story on behalf of the current user, or a channel chat identifier + ChatId int64 `json:"chat_id"` + // The privacy settings for the story; ignored for stories posted on behalf of channel chats + PrivacySettings StoryPrivacySettings `json:"privacy_settings"` + // Pass true if the content of the story must be protected from screenshotting + ProtectContent bool `json:"protect_content"` + // Pass true to create an RTMP stream instead of an ordinary group call + IsRtmpStream bool `json:"is_rtmp_stream"` + // Pass true to allow viewers of the story to send messages + EnableMessages bool `json:"enable_messages"` + // The minimum number of Telegram Stars that must be paid by viewers for each sent message to the call; 0-getOption("paid_group_call_message_star_count_max") + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Starts a new live story on behalf of a chat; requires can_post_stories administrator right for channel chats +func (client *Client) StartLiveStory(req *StartLiveStoryRequest) (StartLiveStoryResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "startLiveStory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "privacy_settings": req.PrivacySettings, + "protect_content": req.ProtectContent, + "is_rtmp_stream": req.IsRtmpStream, + "enable_messages": req.EnableMessages, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeStartLiveStoryResultOk: + return UnmarshalStartLiveStoryResultOk(result.Data) + + case TypeStartLiveStoryResultFail: + return UnmarshalStartLiveStoryResultFail(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type EditStoryRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story to edit StoryId int32 `json:"story_id"` // New content of the story; pass null to keep the current content @@ -8615,7 +12650,7 @@ func (client *Client) EditStory(req *EditStoryRequest) (*Ok, error) { Type: "editStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "content": req.Content, "areas": req.Areas, @@ -8633,23 +12668,52 @@ func (client *Client) EditStory(req *EditStoryRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -type SetStoryPrivacySettingsRequest struct { +type EditStoryCoverRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` + // Identifier of the story to edit + StoryId int32 `json:"story_id"` + // New timestamp of the frame, which will be used as video thumbnail + CoverFrameTimestamp float64 `json:"cover_frame_timestamp"` +} + +// Changes cover of a video story. Can be called only if story.can_be_edited == true and the story isn't being edited now +func (client *Client) EditStoryCover(req *EditStoryCoverRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editStoryCover", + }, + Data: map[string]interface{}{ + "story_poster_chat_id": req.StoryPosterChatId, + "story_id": req.StoryId, + "cover_frame_timestamp": req.CoverFrameTimestamp, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +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"` } -// Changes privacy settings of a story. Can be called only if story.can_be_edited == true +// 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_set_privacy_settings == true func (client *Client) SetStoryPrivacySettings(req *SetStoryPrivacySettingsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "setStoryPrivacySettings", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, "story_id": req.StoryId, "privacy_settings": req.PrivacySettings, }, @@ -8665,25 +12729,25 @@ func (client *Client) SetStoryPrivacySettings(req *SetStoryPrivacySettingsReques return UnmarshalOk(result.Data) } -type ToggleStoryIsPinnedRequest struct { +type ToggleStoryIsPostedToChatPageRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story StoryId int32 `json:"story_id"` // Pass true to make the story accessible after expiration; pass false to make it private - IsPinned bool `json:"is_pinned"` + IsPostedToChatPage bool `json:"is_posted_to_chat_page"` } -// Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_pinned == true -func (client *Client) ToggleStoryIsPinned(req *ToggleStoryIsPinnedRequest) (*Ok, error) { +// Toggles whether a story is accessible after expiration. Can be called only if story.can_toggle_is_posted_to_chat_page == true +func (client *Client) ToggleStoryIsPostedToChatPage(req *ToggleStoryIsPostedToChatPageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "toggleStoryIsPinned", + Type: "toggleStoryIsPostedToChatPage", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, - "is_pinned": req.IsPinned, + "is_posted_to_chat_page": req.IsPostedToChatPage, }, }) if err != nil { @@ -8699,19 +12763,19 @@ func (client *Client) ToggleStoryIsPinned(req *ToggleStoryIsPinnedRequest) (*Ok, type DeleteStoryRequest struct { // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Identifier of the story to delete StoryId int32 `json:"story_id"` } -// Deletes a previously sent story. Can be called only if story.can_be_deleted == true +// Deletes a previously posted story. Can be called only if story.can_be_deleted == true func (client *Client) DeleteStory(req *DeleteStoryRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "deleteStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, }, }) @@ -8726,7 +12790,7 @@ func (client *Client) DeleteStory(req *DeleteStoryRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -// Returns list of chats with non-default notification settings for stories +// Returns the list of chats with non-default notification settings for stories func (client *Client) GetStoryNotificationSettingsExceptions() (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -8750,7 +12814,7 @@ type LoadActiveStoriesRequest struct { StoryList StoryList `json:"story_list"` } -// Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by the pair (active_stories.order, active_stories.story_sender_chat_id) in descending order. Returns a 404 error if all active stories have been loaded +// Loads more active stories from a story list. The loaded stories will be sent through updates. Active stories are sorted by the pair (active_stories.order, active_stories.story_poster_chat_id) in descending order. Returns a 404 error if all active stories have been loaded func (client *Client) LoadActiveStories(req *LoadActiveStoriesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8826,20 +12890,20 @@ func (client *Client) GetChatActiveStories(req *GetChatActiveStoriesRequest) (*C return UnmarshalChatActiveStories(result.Data) } -type GetChatPinnedStoriesRequest struct { +type GetChatPostedToChatPageStoriesRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifier of the story starting from which stories must be returned; use 0 to get results from the last story + // Identifier of the story starting from which stories must be returned; use 0 to get results from pinned and the newest story FromStoryId int32 `json:"from_story_id"` - // The maximum number of stories to be returned For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + // The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } -// Returns the list of pinned stories posted by the given chat. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib -func (client *Client) GetChatPinnedStories(req *GetChatPinnedStoriesRequest) (*Stories, error) { +// Returns the list of stories that posted by the given chat to its chat page. If from_story_id == 0, then pinned stories are returned first. Then, stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +func (client *Client) GetChatPostedToChatPageStories(req *GetChatPostedToChatPageStoriesRequest) (*Stories, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getChatPinnedStories", + Type: "getChatPostedToChatPageStories", }, Data: map[string]interface{}{ "chat_id": req.ChatId, @@ -8863,11 +12927,11 @@ type GetChatArchivedStoriesRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the story starting from which stories must be returned; use 0 to get results from the last story FromStoryId int32 `json:"from_story_id"` - // The maximum number of stories to be returned For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + // The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } -// Returns the list of all stories posted by the given chat; requires can_edit_stories rights for channel chats. The stories are returned in a reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib +// Returns the list of all stories posted by the given chat; requires can_edit_stories administrator right in the chat. The stories are returned in reverse chronological order (i.e., in order of decreasing story_id). For optimal performance, the number of returned stories is chosen by TDLib func (client *Client) GetChatArchivedStories(req *GetChatArchivedStoriesRequest) (*Stories, error) { result, err := client.Send(Request{ meta: meta{ @@ -8890,9 +12954,38 @@ func (client *Client) GetChatArchivedStories(req *GetChatArchivedStoriesRequest) return UnmarshalStories(result.Data) } +type SetChatPinnedStoriesRequest struct { + // Identifier of the chat that posted the stories + ChatId int64 `json:"chat_id"` + // New list of pinned stories. All stories must be posted to the chat page first. There can be up to getOption("pinned_story_count_max") pinned stories on a chat page + StoryIds []int32 `json:"story_ids"` +} + +// Changes the list of pinned stories on a chat page; requires can_edit_stories administrator right in the chat +func (client *Client) SetChatPinnedStories(req *SetChatPinnedStoriesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatPinnedStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type OpenStoryRequest struct { - // The identifier of the sender of the opened story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the chat that posted the opened story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -8904,7 +12997,7 @@ func (client *Client) OpenStory(req *OpenStoryRequest) (*Ok, error) { Type: "openStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, }, }) @@ -8920,8 +13013,8 @@ func (client *Client) OpenStory(req *OpenStoryRequest) (*Ok, error) { } type CloseStoryRequest struct { - // The identifier of the sender of the story to close - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story to close + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -8933,7 +13026,7 @@ func (client *Client) CloseStory(req *CloseStoryRequest) (*Ok, error) { Type: "closeStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, }, }) @@ -8975,24 +13068,24 @@ func (client *Client) GetStoryAvailableReactions(req *GetStoryAvailableReactions } type SetStoryReactionRequest struct { - // The identifier of the sender of the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` - // Type of the reaction to set; pass null to remove the reaction. `reactionTypeCustomEmoji` reactions can be used only by Telegram Premium users + // Type of the reaction to set; pass null to remove the reaction. Custom emoji reactions can be used only by Telegram Premium users. Paid reactions can't be set ReactionType ReactionType `json:"reaction_type"` // Pass true if the reaction needs to be added to recent reactions UpdateRecentReactions bool `json:"update_recent_reactions"` } -// Changes chosen reaction on a story +// Changes chosen reaction on a story that has already been sent; not supported for live stories func (client *Client) SetStoryReaction(req *SetStoryReactionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "setStoryReaction", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, "reaction_type": req.ReactionType, "update_recent_reactions": req.UpdateRecentReactions, @@ -9009,31 +13102,34 @@ func (client *Client) SetStoryReaction(req *SetStoryReactionRequest) (*Ok, error return UnmarshalOk(result.Data) } -type GetStoryViewersRequest struct { +type GetStoryInteractionsRequest struct { // Story identifier StoryId int32 `json:"story_id"` - // Query to search for in names and usernames of the viewers; may be empty to get all relevant viewers + // Query to search for in names, usernames and titles; may be empty to get all relevant interactions Query string `json:"query"` - // Pass true to get only contacts; pass false to get all relevant viewers + // Pass true to get only interactions by contacts; pass false to get all relevant interactions OnlyContacts bool `json:"only_contacts"` - // Pass true to get viewers with reaction first; pass false to get viewers sorted just by view_date + // Pass true to get forwards and reposts first, then reactions, then other views; pass false to get interactions sorted just by interaction date + PreferForwards bool `json:"prefer_forwards"` + // Pass true to get interactions with reaction first; pass false to get interactions sorted just by interaction date. Ignored if prefer_forwards == true PreferWithReaction bool `json:"prefer_with_reaction"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` - // The maximum number of story viewers to return + // The maximum number of story interactions to return Limit int32 `json:"limit"` } -// Returns viewers of a story. The method can be called only for stories posted on behalf of the current user -func (client *Client) GetStoryViewers(req *GetStoryViewersRequest) (*StoryViewers, error) { +// Returns interactions with a story. The method can be called only for stories posted on behalf of the current user +func (client *Client) GetStoryInteractions(req *GetStoryInteractionsRequest) (*StoryInteractions, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getStoryViewers", + Type: "getStoryInteractions", }, Data: map[string]interface{}{ "story_id": req.StoryId, "query": req.Query, "only_contacts": req.OnlyContacts, + "prefer_forwards": req.PreferForwards, "prefer_with_reaction": req.PreferWithReaction, "offset": req.Offset, "limit": req.Limit, @@ -9047,30 +13143,71 @@ func (client *Client) GetStoryViewers(req *GetStoryViewersRequest) (*StoryViewer return nil, buildResponseError(result.Data) } - return UnmarshalStoryViewers(result.Data) + return UnmarshalStoryInteractions(result.Data) +} + +type GetChatStoryInteractionsRequest struct { + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` + // Story identifier + StoryId int32 `json:"story_id"` + // Pass the default heart reaction or a suggested reaction type to receive only interactions with the specified reaction type; pass null to receive all interactions; reactionTypePaid isn't supported + ReactionType ReactionType `json:"reaction_type"` + // Pass true to get forwards and reposts first, then reactions, then other views; pass false to get interactions sorted just by interaction date + PreferForwards bool `json:"prefer_forwards"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of story interactions to return + Limit int32 `json:"limit"` +} + +// Returns interactions with a story posted in a chat. Can be used only if story is posted on behalf of a chat and the user is an administrator in the chat +func (client *Client) GetChatStoryInteractions(req *GetChatStoryInteractionsRequest) (*StoryInteractions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatStoryInteractions", + }, + Data: map[string]interface{}{ + "story_poster_chat_id": req.StoryPosterChatId, + "story_id": req.StoryId, + "reaction_type": req.ReactionType, + "prefer_forwards": req.PreferForwards, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryInteractions(result.Data) } type ReportStoryRequest struct { - // The identifier of the sender of the story to report - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story to report + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story to report StoryId int32 `json:"story_id"` - // The reason for reporting the story - Reason ReportReason `json:"reason"` - // Additional report details; 0-1024 characters + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` + // Additional report details; 0-1024 characters; leave empty for the initial request Text string `json:"text"` } // Reports a story to the Telegram moderators -func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) { +func (client *Client) ReportStory(req *ReportStoryRequest) (ReportStoryResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "reportStory", }, Data: map[string]interface{}{ - "story_sender_chat_id": req.StorySenderChatId, + "story_poster_chat_id": req.StoryPosterChatId, "story_id": req.StoryId, - "reason": req.Reason, + "option_id": req.OptionId, "text": req.Text, }, }) @@ -9082,7 +13219,19 @@ func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeReportStoryResultOk: + return UnmarshalReportStoryResultOk(result.Data) + + case TypeReportStoryResultOptionRequired: + return UnmarshalReportStoryResultOptionRequired(result.Data) + + case TypeReportStoryResultTextRequired: + return UnmarshalReportStoryResultTextRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } } // Activates stealth mode for stories, which hides all views of stories from the current user in the last "story_stealth_mode_past_period" seconds and for the next "story_stealth_mode_future_period" seconds; for Telegram Premium users only @@ -9104,6 +13253,375 @@ func (client *Client) ActivateStoryStealthMode() (*Ok, error) { return UnmarshalOk(result.Data) } +type GetStoryPublicForwardsRequest struct { + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` + // The identifier of the story + StoryId int32 `json:"story_id"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns forwards of a story as a message to public chats and reposts by public channels. Can be used only if the story is posted on behalf of the current user or story.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib +func (client *Client) GetStoryPublicForwards(req *GetStoryPublicForwardsRequest) (*PublicForwards, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStoryPublicForwards", + }, + Data: map[string]interface{}{ + "story_poster_chat_id": req.StoryPosterChatId, + "story_id": req.StoryId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPublicForwards(result.Data) +} + +type GetChatStoryAlbumsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns the list of story albums owned by the given chat +func (client *Client) GetChatStoryAlbums(req *GetChatStoryAlbumsRequest) (*StoryAlbums, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatStoryAlbums", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbums(result.Data) +} + +type GetStoryAlbumStoriesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Story album identifier + StoryAlbumId int32 `json:"story_album_id"` + // Offset of the first entry to return; use 0 to get results from the first album story + Offset int32 `json:"offset"` + // The maximum number of stories to be returned. For optimal performance, the number of returned stories is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns the list of stories added to the given story album. For optimal performance, the number of returned stories is chosen by TDLib +func (client *Client) GetStoryAlbumStories(req *GetStoryAlbumStoriesRequest) (*Stories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStories(result.Data) +} + +type CreateStoryAlbumRequest struct { + // Identifier of the chat that posted the stories + StoryPosterChatId int64 `json:"story_poster_chat_id"` + // Name of the album; 1-12 characters + Name string `json:"name"` + // Identifiers of stories to add to the album; 0-getOption("story_album_size_max") identifiers + StoryIds []int32 `json:"story_ids"` +} + +// Creates an album of stories; requires can_edit_stories administrator right for supergroup and channel chats +func (client *Client) CreateStoryAlbum(req *CreateStoryAlbumRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createStoryAlbum", + }, + Data: map[string]interface{}{ + "story_poster_chat_id": req.StoryPosterChatId, + "name": req.Name, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type ReorderStoryAlbumsRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // New order of story albums + StoryAlbumIds []int32 `json:"story_album_ids"` +} + +// Changes order of story albums. If the albums are owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +func (client *Client) ReorderStoryAlbums(req *ReorderStoryAlbumsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderStoryAlbums", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_ids": req.StoryAlbumIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteStoryAlbumRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` +} + +// Deletes a story album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat +func (client *Client) DeleteStoryAlbum(req *DeleteStoryAlbumRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteStoryAlbum", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStoryAlbumNameRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // New name of the album; 1-12 characters + Name string `json:"name"` +} + +// Changes name of an album of stories. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) SetStoryAlbumName(req *SetStoryAlbumNameRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStoryAlbumName", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type AddStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to add to the album; 1-getOption("story_album_size_max") identifiers. If after addition the album has more than getOption("story_album_size_max") stories, then the last one are removed from the album + StoryIds []int32 `json:"story_ids"` +} + +// Adds stories to the beginning of a previously created story album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) AddStoryAlbumStories(req *AddStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type RemoveStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to remove from the album + StoryIds []int32 `json:"story_ids"` +} + +// Removes stories from an album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) RemoveStoryAlbumStories(req *RemoveStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type ReorderStoryAlbumStoriesRequest struct { + // Identifier of the chat that owns the stories + ChatId int64 `json:"chat_id"` + // Identifier of the story album + StoryAlbumId int32 `json:"story_album_id"` + // Identifier of the stories to move to the beginning of the album. All other stories are placed in the current order after the specified stories + StoryIds []int32 `json:"story_ids"` +} + +// Changes order of stories in an album. If the album is owned by a supergroup or a channel chat, then requires can_edit_stories administrator right in the chat. Returns the changed album +func (client *Client) ReorderStoryAlbumStories(req *ReorderStoryAlbumStoriesRequest) (*StoryAlbum, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderStoryAlbumStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_album_id": req.StoryAlbumId, + "story_ids": req.StoryIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryAlbum(result.Data) +} + +type GetChatBoostLevelFeaturesRequest struct { + // Pass true to get the list of features for channels; pass false to get the list of features for supergroups + IsChannel bool `json:"is_channel"` + // Chat boost level + Level int32 `json:"level"` +} + +// Returns the list of features available on the specific chat boost level. This is an offline method +func (client *Client) GetChatBoostLevelFeatures(req *GetChatBoostLevelFeaturesRequest) (*ChatBoostLevelFeatures, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatBoostLevelFeatures", + }, + Data: map[string]interface{}{ + "is_channel": req.IsChannel, + "level": req.Level, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostLevelFeatures(result.Data) +} + +type GetChatBoostFeaturesRequest struct { + // Pass true to get the list of features for channels; pass false to get the list of features for supergroups + IsChannel bool `json:"is_channel"` +} + +// Returns the list of features available for different chat boost levels. This is an offline method +func (client *Client) GetChatBoostFeatures(req *GetChatBoostFeaturesRequest) (*ChatBoostFeatures, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatBoostFeatures", + }, + Data: map[string]interface{}{ + "is_channel": req.IsChannel, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostFeatures(result.Data) +} + // Returns the list of available chat boost slots for the current user func (client *Client) GetAvailableChatBoostSlots() (*ChatBoostSlots, error) { result, err := client.Send(Request{ @@ -9124,11 +13642,11 @@ func (client *Client) GetAvailableChatBoostSlots() (*ChatBoostSlots, error) { } type GetChatBoostStatusRequest struct { - // Identifier of the channel chat + // Identifier of the chat ChatId int64 `json:"chat_id"` } -// Returns the current boost status for a channel chat +// Returns the current boost status for a supergroup or a channel chat func (client *Client) GetChatBoostStatus(req *GetChatBoostStatusRequest) (*ChatBoostStatus, error) { result, err := client.Send(Request{ meta: meta{ @@ -9183,7 +13701,7 @@ type GetChatBoostLinkRequest struct { ChatId int64 `json:"chat_id"` } -// Returns an HTTPS link to boost the specified channel chat +// Returns an HTTPS link to boost the specified supergroup or channel chat func (client *Client) GetChatBoostLink(req *GetChatBoostLinkRequest) (*ChatBoostLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -9241,7 +13759,7 @@ type GetChatBoostsRequest struct { Limit int32 `json:"limit"` } -// Returns list of boosts applied to a chat; requires administrator rights in the channel chat +// Returns the list of boosts applied to a chat; requires administrator rights in the chat func (client *Client) GetChatBoosts(req *GetChatBoostsRequest) (*FoundChatBoosts, error) { result, err := client.Send(Request{ meta: meta{ @@ -9272,7 +13790,7 @@ type GetUserChatBoostsRequest struct { UserId int64 `json:"user_id"` } -// Returns list of boosts applied to a chat by a given user; requires administrator rights in the channel chat; for bots only +// Returns the list of boosts applied to a chat by a given user; requires administrator rights in the chat; for bots only func (client *Client) GetUserChatBoosts(req *GetUserChatBoostsRequest) (*FoundChatBoosts, error) { result, err := client.Send(Request{ meta: meta{ @@ -9352,8 +13870,8 @@ func (client *Client) ToggleBotIsAddedToAttachmentMenu(req *ToggleBotIsAddedToAt return UnmarshalOk(result.Data) } -// Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list -func (client *Client) GetThemedEmojiStatuses() (*EmojiStatuses, error) { +// Returns up to 8 emoji statuses, which must be shown right after the default Premium Badge in the emoji status list for self status +func (client *Client) GetThemedEmojiStatuses() (*EmojiStatusCustomEmojis, error) { result, err := client.Send(Request{ meta: meta{ Type: "getThemedEmojiStatuses", @@ -9368,10 +13886,10 @@ func (client *Client) GetThemedEmojiStatuses() (*EmojiStatuses, error) { return nil, buildResponseError(result.Data) } - return UnmarshalEmojiStatuses(result.Data) + return UnmarshalEmojiStatusCustomEmojis(result.Data) } -// Returns recent emoji statuses +// Returns recent emoji statuses for self status func (client *Client) GetRecentEmojiStatuses() (*EmojiStatuses, error) { result, err := client.Send(Request{ meta: meta{ @@ -9390,11 +13908,11 @@ func (client *Client) GetRecentEmojiStatuses() (*EmojiStatuses, error) { return UnmarshalEmojiStatuses(result.Data) } -// Returns default emoji statuses -func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatuses, error) { +// Returns available upgraded gift emoji statuses for self status +func (client *Client) GetUpgradedGiftEmojiStatuses() (*EmojiStatuses, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getDefaultEmojiStatuses", + Type: "getUpgradedGiftEmojiStatuses", }, Data: map[string]interface{}{}, }) @@ -9409,7 +13927,26 @@ func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatuses, error) { return UnmarshalEmojiStatuses(result.Data) } -// Clears the list of recently used emoji statuses +// Returns default emoji statuses for self status +func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatusCustomEmojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDefaultEmojiStatuses", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiStatusCustomEmojis(result.Data) +} + +// Clears the list of recently used emoji statuses for self status func (client *Client) ClearRecentEmojiStatuses() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -9428,6 +13965,63 @@ func (client *Client) ClearRecentEmojiStatuses() (*Ok, error) { return UnmarshalOk(result.Data) } +// Returns up to 8 emoji statuses, which must be shown in the emoji status list for chats +func (client *Client) GetThemedChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getThemedChatEmojiStatuses", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiStatusCustomEmojis(result.Data) +} + +// Returns default emoji statuses for chats +func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDefaultChatEmojiStatuses", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiStatusCustomEmojis(result.Data) +} + +// Returns the list of emoji statuses, which can't be used as chat emoji status, even if they are from a sticker set with is_allowed_as_chat_emoji_status == true +func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatusCustomEmojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDisallowedChatEmojiStatuses", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiStatusCustomEmojis(result.Data) +} + type DownloadFileRequest struct { // Identifier of the file to download FileId int32 `json:"file_id"` @@ -9527,7 +14121,7 @@ func (client *Client) CancelDownloadFile(req *CancelDownloadFileRequest) (*Ok, e type GetSuggestedFileNameRequest struct { // Identifier of the file FileId int32 `json:"file_id"` - // Directory in which the file is supposed to be saved + // Directory in which the file is expected to be saved Directory string `json:"directory"` } @@ -9562,7 +14156,7 @@ type PreliminaryUploadFileRequest struct { Priority int32 `json:"priority"` } -// Preliminary uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. Updates updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message +// Preliminarily uploads a file to the cloud before sending it in a message, which can be useful for uploading of being recorded voice and video notes. In all other cases there is no need to preliminary upload a file. Updates updateFile will be used to notify about upload progress. The upload will not be completed until the file is sent in a message func (client *Client) PreliminaryUploadFile(req *PreliminaryUploadFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -9590,7 +14184,7 @@ type CancelPreliminaryUploadFileRequest struct { FileId int32 `json:"file_id"` } -// Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile. For other files the behavior is undefined +// Stops the preliminary uploading of a file. Supported only for files uploaded by using preliminaryUploadFile func (client *Client) CancelPreliminaryUploadFile(req *CancelPreliminaryUploadFileRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -9714,7 +14308,7 @@ type ReadFilePartRequest struct { } // Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the application has no direct access to TDLib's file system, because it is usually slower than a direct read from the file -func (client *Client) ReadFilePart(req *ReadFilePartRequest) (*FilePart, error) { +func (client *Client) ReadFilePart(req *ReadFilePartRequest) (*Data, error) { result, err := client.Send(Request{ meta: meta{ Type: "readFilePart", @@ -9733,7 +14327,7 @@ func (client *Client) ReadFilePart(req *ReadFilePartRequest) (*FilePart, error) return nil, buildResponseError(result.Data) } - return UnmarshalFilePart(result.Data) + return UnmarshalData(result.Data) } type DeleteFileRequest struct { @@ -9773,7 +14367,7 @@ type AddFileToDownloadsRequest struct { Priority int32 `json:"priority"` } -// Adds a file from a message to the list of file downloads. Download progress and completion of the download will be notified through updateFile updates. If message database is used, the list of file downloads is persistent across application restarts. The downloading is independent from download using downloadFile, i.e. it continues if downloadFile is canceled or is used to download a part of the file +// Adds a file from a message to the list of file downloads. Download progress and completion of the download will be notified through updateFile updates. If message database is used, the list of file downloads is persistent across application restarts. The downloading is independent of download using downloadFile, i.e. it continues if downloadFile is canceled or is used to download a part of the file func (client *Client) AddFileToDownloads(req *AddFileToDownloadsRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -9951,6 +14545,35 @@ func (client *Client) SearchFileDownloads(req *SearchFileDownloadsRequest) (*Fou return UnmarshalFoundFileDownloads(result.Data) } +type SetApplicationVerificationTokenRequest struct { + // Unique identifier for the verification process as received from updateApplicationVerificationRequired or updateApplicationRecaptchaVerificationRequired + VerificationId int64 `json:"verification_id"` + // Play Integrity API token for the Android application, or secret from push notification for the iOS application for application verification, or reCAPTCHA token for reCAPTCHA verifications; pass an empty string to abort verification and receive the error "VERIFICATION_FAILED" for the request + Token string `json:"token"` +} + +// Informs TDLib that application or reCAPTCHA verification has been completed. Can be called before authorization +func (client *Client) SetApplicationVerificationToken(req *SetApplicationVerificationTokenRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setApplicationVerificationToken", + }, + Data: map[string]interface{}{ + "verification_id": req.VerificationId, + "token": req.Token, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetMessageFileTypeRequest struct { // Beginning of the message file; up to 100 first lines MessageFileHead string `json:"message_file_head"` @@ -9990,7 +14613,7 @@ func (client *Client) GetMessageFileType(req *GetMessageFileTypeRequest) (Messag } type GetMessageImportConfirmationTextRequest struct { - // Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info administrator right + // Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info member right ChatId int64 `json:"chat_id"` } @@ -10016,7 +14639,7 @@ func (client *Client) GetMessageImportConfirmationText(req *GetMessageImportConf } type ImportMessagesRequest struct { - // Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info administrator right + // Identifier of a chat to which the messages will be imported. It must be an identifier of a private chat with a mutual contact or an identifier of a supergroup chat with can_change_info member right ChatId int64 `json:"chat_id"` // File with messages to import. Only inputFileLocal and inputFileGenerated are supported. The file must not be previously uploaded MessageFile InputFile `json:"message_file"` @@ -10111,6 +14734,38 @@ func (client *Client) CreateChatInviteLink(req *CreateChatInviteLinkRequest) (*C return UnmarshalChatInviteLink(result.Data) } +type CreateChatSubscriptionInviteLinkRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Invite link name; 0-32 characters + Name string `json:"name"` + // Information about subscription plan that will be applied to the users joining the chat via the link. Subscription period must be 2592000 in production environment, and 60 or 300 if Telegram test environment is used + SubscriptionPricing *StarSubscriptionPricing `json:"subscription_pricing"` +} + +// Creates a new subscription invite link for a channel chat. Requires can_invite_users right in the chat +func (client *Client) CreateChatSubscriptionInviteLink(req *CreateChatSubscriptionInviteLinkRequest) (*ChatInviteLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createChatSubscriptionInviteLink", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "name": req.Name, + "subscription_pricing": req.SubscriptionPricing, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatInviteLink(result.Data) +} + type EditChatInviteLinkRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -10126,7 +14781,7 @@ type EditChatInviteLinkRequest struct { CreatesJoinRequest bool `json:"creates_join_request"` } -// Edits a non-primary invite link for a chat. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links +// Edits a non-primary invite link for a chat. Available for basic groups, supergroups, and channels. If the link creates a subscription, then expiration_date, member_limit and creates_join_request must not be used. Requires administrator privileges and can_invite_users right in the chat for own links and owner privileges for other links func (client *Client) EditChatInviteLink(req *EditChatInviteLinkRequest) (*ChatInviteLink, error) { result, err := client.Send(Request{ meta: meta{ @@ -10152,6 +14807,38 @@ func (client *Client) EditChatInviteLink(req *EditChatInviteLinkRequest) (*ChatI return UnmarshalChatInviteLink(result.Data) } +type EditChatSubscriptionInviteLinkRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Invite link to be edited + InviteLink string `json:"invite_link"` + // Invite link name; 0-32 characters + Name string `json:"name"` +} + +// Edits a subscription invite link for a channel chat. Requires can_invite_users right in the chat for own links and owner privileges for other links +func (client *Client) EditChatSubscriptionInviteLink(req *EditChatSubscriptionInviteLinkRequest) (*ChatInviteLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editChatSubscriptionInviteLink", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "invite_link": req.InviteLink, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatInviteLink(result.Data) +} + type GetChatInviteLinkRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -10186,7 +14873,7 @@ type GetChatInviteLinkCountsRequest struct { ChatId int64 `json:"chat_id"` } -// Returns list of chat administrators with number of their invite links. Requires owner privileges in the chat +// Returns the list of chat administrators with number of their invite links. Requires owner privileges in the chat func (client *Client) GetChatInviteLinkCounts(req *GetChatInviteLinkCountsRequest) (*ChatInviteLinkCounts, error) { result, err := client.Send(Request{ meta: meta{ @@ -10253,6 +14940,8 @@ type GetChatInviteLinkMembersRequest struct { ChatId int64 `json:"chat_id"` // Invite link for which to return chat members InviteLink string `json:"invite_link"` + // Pass true if the link is a subscription link and only members with expired subscription must be returned + OnlyWithExpiredSubscription bool `json:"only_with_expired_subscription"` // A chat member from which to return next chat members; pass null to get results from the beginning OffsetMember *ChatInviteLinkMember `json:"offset_member"` // The maximum number of chat members to return; up to 100 @@ -10268,6 +14957,7 @@ func (client *Client) GetChatInviteLinkMembers(req *GetChatInviteLinkMembersRequ Data: map[string]interface{}{ "chat_id": req.ChatId, "invite_link": req.InviteLink, + "only_with_expired_subscription": req.OnlyWithExpiredSubscription, "offset_member": req.OffsetMember, "limit": req.Limit, }, @@ -10463,7 +15153,7 @@ func (client *Client) GetChatJoinRequests(req *GetChatJoinRequestsRequest) (*Cha type ProcessChatJoinRequestRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifier of the user that sent the request + // Identifier of the user who sent the request UserId int64 `json:"user_id"` // Pass true to approve the request; pass false to decline it Approve bool `json:"approve"` @@ -10524,6 +15214,102 @@ func (client *Client) ProcessChatJoinRequests(req *ProcessChatJoinRequestsReques return UnmarshalOk(result.Data) } +type ApproveSuggestedPostRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message with the suggested post. Use messageProperties.can_be_approved to check whether the suggested post can be approved + MessageId int64 `json:"message_id"` + // Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date has already been chosen. If specified, then the date must be in the future, but at most getOption("suggested_post_send_delay_max") seconds in the future + SendDate int32 `json:"send_date"` +} + +// Approves a suggested post in a channel direct messages chat +func (client *Client) ApproveSuggestedPost(req *ApproveSuggestedPostRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "approveSuggestedPost", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "send_date": req.SendDate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeclineSuggestedPostRequest struct { + // Chat identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message with the suggested post. Use messageProperties.can_be_declined to check whether the suggested post can be declined + MessageId int64 `json:"message_id"` + // Comment for the creator of the suggested post; 0-128 characters + Comment string `json:"comment"` +} + +// Declines a suggested post in a channel direct messages chat +func (client *Client) DeclineSuggestedPost(req *DeclineSuggestedPostRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "declineSuggestedPost", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "comment": req.Comment, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddOfferRequest struct { + // Identifier of the channel direct messages chat + ChatId int64 `json:"chat_id"` + // Identifier of the message in the chat which will be sent as suggested post. Use messageProperties.can_add_offer to check whether an offer can be added or messageProperties.can_edit_suggested_post_info to check whether price or time of sending of the post can be changed + MessageId int64 `json:"message_id"` + // Options to be used to send the message. New information about the suggested post must always be specified + Options *MessageSendOptions `json:"options"` +} + +// Sends a suggested post based on a previously sent message in a channel direct messages chat. Can be also used to suggest price or time change for an existing suggested post. Returns the sent message +func (client *Client) AddOffer(req *AddOfferRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addOffer", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "options": req.Options, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + type CreateCallRequest struct { // Identifier of the user to be called UserId int64 `json:"user_id"` @@ -10619,6 +15405,8 @@ type DiscardCallRequest struct { CallId int32 `json:"call_id"` // Pass true if the user was disconnected IsDisconnected bool `json:"is_disconnected"` + // If the call was upgraded to a group call, pass invite link to the group call + InviteLink string `json:"invite_link"` // The call duration, in seconds Duration int32 `json:"duration"` // Pass true if the call was a video call @@ -10636,6 +15424,7 @@ func (client *Client) DiscardCall(req *DiscardCallRequest) (*Ok, error) { Data: map[string]interface{}{ "call_id": req.CallId, "is_disconnected": req.IsDisconnected, + "invite_link": req.InviteLink, "duration": req.Duration, "is_video": req.IsVideo, "connection_id": req.ConnectionId, @@ -10750,7 +15539,7 @@ type GetVideoChatAvailableParticipantsRequest struct { ChatId int64 `json:"chat_id"` } -// Returns list of participant identifiers, on whose behalf a video chat in the chat can be joined +// Returns the list of participant identifiers, on whose behalf a video chat in the chat can be joined func (client *Client) GetVideoChatAvailableParticipants(req *GetVideoChatAvailableParticipantsRequest) (*MessageSenders, error) { result, err := client.Send(Request{ meta: meta{ @@ -10774,7 +15563,7 @@ func (client *Client) GetVideoChatAvailableParticipants(req *GetVideoChatAvailab type SetVideoChatDefaultParticipantRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Default group call participant identifier to join the video chats + // Default group call participant identifier to join the video chats in the chat DefaultParticipantId MessageSender `json:"default_participant_id"` } @@ -10805,13 +15594,13 @@ type CreateVideoChatRequest struct { ChatId int64 `json:"chat_id"` // Group call title; if empty, chat title will be used Title string `json:"title"` - // Point in time (Unix timestamp) when the group call is supposed 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 + // 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 creator privileges + // Pass true to create an RTMP stream instead of an ordinary video chat IsRtmpStream bool `json:"is_rtmp_stream"` } -// Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats rights +// Creates a video chat (a group call bound to a chat). Available only for basic groups, supergroups and channels; requires can_manage_video_chats administrator right func (client *Client) CreateVideoChat(req *CreateVideoChatRequest) (*GroupCallId, error) { result, err := client.Send(Request{ meta: meta{ @@ -10835,12 +15624,38 @@ func (client *Client) CreateVideoChat(req *CreateVideoChatRequest) (*GroupCallId return UnmarshalGroupCallId(result.Data) } +type CreateGroupCallRequest struct { + // Parameters to join the call; pass null to only create call link without joining the call + JoinParameters *GroupCallJoinParameters `json:"join_parameters"` +} + +// Creates a new group call that isn't bound to a chat +func (client *Client) CreateGroupCall(req *CreateGroupCallRequest) (*GroupCallInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createGroupCall", + }, + Data: map[string]interface{}{ + "join_parameters": req.JoinParameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGroupCallInfo(result.Data) +} + type GetVideoChatRtmpUrlRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` } -// Returns RTMP URL for streaming to the chat; requires creator privileges +// Returns RTMP URL for streaming to the video chat of a chat; requires can_manage_video_chats administrator right func (client *Client) GetVideoChatRtmpUrl(req *GetVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -10866,7 +15681,7 @@ type ReplaceVideoChatRtmpUrlRequest struct { ChatId int64 `json:"chat_id"` } -// Replaces the current RTMP URL for streaming to the chat; requires creator privileges +// Replaces the current RTMP URL for streaming to the video chat of a chat; requires owner privileges in the chat func (client *Client) ReplaceVideoChatRtmpUrl(req *ReplaceVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -10887,6 +15702,58 @@ func (client *Client) ReplaceVideoChatRtmpUrl(req *ReplaceVideoChatRtmpUrlReques return UnmarshalRtmpUrl(result.Data) } +type GetLiveStoryRtmpUrlRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns RTMP URL for streaming to a live story; requires can_post_stories administrator right for channel chats +func (client *Client) GetLiveStoryRtmpUrl(req *GetLiveStoryRtmpUrlRequest) (*RtmpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLiveStoryRtmpUrl", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalRtmpUrl(result.Data) +} + +type ReplaceLiveStoryRtmpUrlRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Replaces the current RTMP URL for streaming to a live story; requires owner privileges for channel chats +func (client *Client) ReplaceLiveStoryRtmpUrl(req *ReplaceLiveStoryRtmpUrlRequest) (*RtmpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "replaceLiveStoryRtmpUrl", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalRtmpUrl(result.Data) +} + type GetGroupCallRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` @@ -10913,16 +15780,16 @@ func (client *Client) GetGroupCall(req *GetGroupCallRequest) (*GroupCall, error) return UnmarshalGroupCall(result.Data) } -type StartScheduledGroupCallRequest struct { - // Group call identifier +type StartScheduledVideoChatRequest struct { + // Group call identifier of the video chat GroupCallId int32 `json:"group_call_id"` } -// Starts a scheduled group call -func (client *Client) StartScheduledGroupCall(req *StartScheduledGroupCallRequest) (*Ok, error) { +// Starts a scheduled video chat +func (client *Client) StartScheduledVideoChat(req *StartScheduledVideoChatRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "startScheduledGroupCall", + Type: "startScheduledVideoChat", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -10939,18 +15806,18 @@ func (client *Client) StartScheduledGroupCall(req *StartScheduledGroupCallReques return UnmarshalOk(result.Data) } -type ToggleGroupCallEnabledStartNotificationRequest struct { +type ToggleVideoChatEnabledStartNotificationRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` // New value of the enabled_start_notification setting EnabledStartNotification bool `json:"enabled_start_notification"` } -// Toggles whether the current user will receive a notification when the group call will start; scheduled group calls only -func (client *Client) ToggleGroupCallEnabledStartNotification(req *ToggleGroupCallEnabledStartNotificationRequest) (*Ok, error) { +// Toggles whether the current user will receive a notification when the video chat starts; for scheduled video chats only +func (client *Client) ToggleVideoChatEnabledStartNotification(req *ToggleVideoChatEnabledStartNotificationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "toggleGroupCallEnabledStartNotification", + Type: "toggleVideoChatEnabledStartNotification", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -10969,35 +15836,55 @@ func (client *Client) ToggleGroupCallEnabledStartNotification(req *ToggleGroupCa } type JoinGroupCallRequest struct { - // Group call identifier - GroupCallId int32 `json:"group_call_id"` - // Identifier of a group call participant, which will be used to join the call; pass null to join as self; video chats only - ParticipantId MessageSender `json:"participant_id"` - // Caller audio channel synchronization source identifier; received from tgcalls - AudioSourceId int32 `json:"audio_source_id"` - // Group call join payload; received from tgcalls - Payload string `json:"payload"` - // Pass true to join the call with muted microphone - IsMuted bool `json:"is_muted"` - // Pass true if the user's video is enabled - IsMyVideoEnabled bool `json:"is_my_video_enabled"` - // If non-empty, invite hash to be used to join the group call without being muted by administrators - InviteHash string `json:"invite_hash"` + // The group call to join + InputGroupCall InputGroupCall `json:"input_group_call"` + // Parameters to join the call + JoinParameters *GroupCallJoinParameters `json:"join_parameters"` } -// Joins an active group call. Returns join response payload for tgcalls -func (client *Client) JoinGroupCall(req *JoinGroupCallRequest) (*Text, error) { +// Joins a regular group call that is not bound to a chat +func (client *Client) JoinGroupCall(req *JoinGroupCallRequest) (*GroupCallInfo, error) { result, err := client.Send(Request{ meta: meta{ Type: "joinGroupCall", }, + Data: map[string]interface{}{ + "input_group_call": req.InputGroupCall, + "join_parameters": req.JoinParameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGroupCallInfo(result.Data) +} + +type JoinVideoChatRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Identifier of a group call participant, which will be used to join the call; pass null to join as self + ParticipantId MessageSender `json:"participant_id"` + // Parameters to join the call + JoinParameters *GroupCallJoinParameters `json:"join_parameters"` + // Invite hash as received from internalLinkTypeVideoChat + InviteHash string `json:"invite_hash"` +} + +// Joins an active video chat. Returns join response payload for tgcalls +func (client *Client) JoinVideoChat(req *JoinVideoChatRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "joinVideoChat", + }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, "participant_id": req.ParticipantId, - "audio_source_id": req.AudioSourceId, - "payload": req.Payload, - "is_muted": req.IsMuted, - "is_my_video_enabled": req.IsMyVideoEnabled, + "join_parameters": req.JoinParameters, "invite_hash": req.InviteHash, }, }) @@ -11012,6 +15899,35 @@ func (client *Client) JoinGroupCall(req *JoinGroupCallRequest) (*Text, error) { return UnmarshalText(result.Data) } +type JoinLiveStoryRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Parameters to join the call + JoinParameters *GroupCallJoinParameters `json:"join_parameters"` +} + +// Joins a group call of an active live story. Returns join response payload for tgcalls +func (client *Client) JoinLiveStory(req *JoinLiveStoryRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "joinLiveStory", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "join_parameters": req.JoinParameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + type StartGroupCallScreenSharingRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` @@ -11021,7 +15937,7 @@ type StartGroupCallScreenSharingRequest struct { Payload string `json:"payload"` } -// Starts screen sharing in a joined group call. Returns join response payload for tgcalls +// Starts screen sharing in a joined group call; not supported in live stories. Returns join response payload for tgcalls func (client *Client) StartGroupCallScreenSharing(req *StartGroupCallScreenSharingRequest) (*Text, error) { result, err := client.Send(Request{ meta: meta{ @@ -11051,7 +15967,7 @@ type ToggleGroupCallScreenSharingIsPausedRequest struct { IsPaused bool `json:"is_paused"` } -// Pauses or unpauses screen sharing in a joined group call +// Pauses or unpauses screen sharing in a joined group call; not supported in live stories func (client *Client) ToggleGroupCallScreenSharingIsPaused(req *ToggleGroupCallScreenSharingIsPausedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11078,7 +15994,7 @@ type EndGroupCallScreenSharingRequest struct { GroupCallId int32 `json:"group_call_id"` } -// Ends screen sharing in a joined group call +// Ends screen sharing in a joined group call; not supported in live stories func (client *Client) EndGroupCallScreenSharing(req *EndGroupCallScreenSharingRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11099,18 +16015,18 @@ func (client *Client) EndGroupCallScreenSharing(req *EndGroupCallScreenSharingRe return UnmarshalOk(result.Data) } -type SetGroupCallTitleRequest struct { +type SetVideoChatTitleRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` // New group call title; 1-64 characters Title string `json:"title"` } -// Sets group call title. Requires groupCall.can_be_managed group call flag -func (client *Client) SetGroupCallTitle(req *SetGroupCallTitleRequest) (*Ok, error) { +// Sets title of a video chat; requires groupCall.can_be_managed right +func (client *Client) SetVideoChatTitle(req *SetVideoChatTitleRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "setGroupCallTitle", + Type: "setVideoChatTitle", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -11128,18 +16044,18 @@ func (client *Client) SetGroupCallTitle(req *SetGroupCallTitleRequest) (*Ok, err return UnmarshalOk(result.Data) } -type ToggleGroupCallMuteNewParticipantsRequest struct { +type ToggleVideoChatMuteNewParticipantsRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` // New value of the mute_new_participants setting MuteNewParticipants bool `json:"mute_new_participants"` } -// Toggles whether new participants of a group call can be unmuted only by administrators of the group call. Requires groupCall.can_toggle_mute_new_participants group call flag -func (client *Client) ToggleGroupCallMuteNewParticipants(req *ToggleGroupCallMuteNewParticipantsRequest) (*Ok, error) { +// Toggles whether new participants of a video chat can be unmuted only by administrators of the video chat. Requires groupCall.can_toggle_mute_new_participants right +func (client *Client) ToggleVideoChatMuteNewParticipants(req *ToggleVideoChatMuteNewParticipantsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "toggleGroupCallMuteNewParticipants", + Type: "toggleVideoChatMuteNewParticipants", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -11157,18 +16073,407 @@ func (client *Client) ToggleGroupCallMuteNewParticipants(req *ToggleGroupCallMut return UnmarshalOk(result.Data) } -type InviteGroupCallParticipantsRequest struct { +type ToggleGroupCallAreMessagesAllowedRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` - // User identifiers. At most 10 users can be invited simultaneously - UserIds []int64 `json:"user_ids"` + // New value of the are_messages_allowed setting + AreMessagesAllowed bool `json:"are_messages_allowed"` } -// Invites users to an active group call. Sends a service message of type messageInviteVideoChatParticipants for video chats -func (client *Client) InviteGroupCallParticipants(req *InviteGroupCallParticipantsRequest) (*Ok, error) { +// Toggles whether participants of a group call can send messages there. Requires groupCall.can_toggle_are_messages_allowed right +func (client *Client) ToggleGroupCallAreMessagesAllowed(req *ToggleGroupCallAreMessagesAllowedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "inviteGroupCallParticipants", + Type: "toggleGroupCallAreMessagesAllowed", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "are_messages_allowed": req.AreMessagesAllowed, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetLiveStoryStreamerRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` +} + +// Returns information about the user or the chat that streams to a live story; for live stories that aren't an RTMP stream only +func (client *Client) GetLiveStoryStreamer(req *GetLiveStoryStreamerRequest) (*GroupCallParticipant, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLiveStoryStreamer", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGroupCallParticipant(result.Data) +} + +type GetLiveStoryAvailableMessageSendersRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` +} + +// Returns the list of message sender identifiers, on whose behalf messages can be sent to a live story +func (client *Client) GetLiveStoryAvailableMessageSenders(req *GetLiveStoryAvailableMessageSendersRequest) (*ChatMessageSenders, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLiveStoryAvailableMessageSenders", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatMessageSenders(result.Data) +} + +type SetLiveStoryMessageSenderRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // New message sender for the group call + MessageSenderId MessageSender `json:"message_sender_id"` +} + +// Selects a message sender to send messages in a live story call +func (client *Client) SetLiveStoryMessageSender(req *SetLiveStoryMessageSenderRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setLiveStoryMessageSender", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "message_sender_id": req.MessageSenderId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendGroupCallMessageRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Text of the message to send; 1-getOption("group_call_message_text_length_max") characters for non-live-stories; see updateGroupCallMessageLevels for live story restrictions, which depends on paid_message_star_count. Can't contain line feeds for live stories + Text *FormattedText `json:"text"` + // The number of Telegram Stars the user agreed to pay to send the message; for live stories only; 0-getOption("paid_group_call_message_star_count_max"). Must be 0 for messages sent to live stories posted by the current user + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Sends a message to other participants of a group call. Requires groupCall.can_send_messages right +func (client *Client) SendGroupCallMessage(req *SendGroupCallMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendGroupCallMessage", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "text": req.Text, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddPendingLiveStoryReactionRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Number of Telegram Stars to be used for the reaction. The total number of pending paid reactions must not exceed getOption("paid_group_call_message_star_count_max") + StarCount int64 `json:"star_count"` +} + +// Adds pending paid reaction in a live story group call. Can't be used in live stories posted by the current user. Call commitPendingLiveStoryReactions or removePendingLiveStoryReactions to actually send all pending reactions when the undo timer is over or abort the sending +func (client *Client) AddPendingLiveStoryReaction(req *AddPendingLiveStoryReactionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addPendingLiveStoryReaction", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CommitPendingLiveStoryReactionsRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` +} + +// Applies all pending paid reactions in a live story group call +func (client *Client) CommitPendingLiveStoryReactions(req *CommitPendingLiveStoryReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "commitPendingLiveStoryReactions", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemovePendingLiveStoryReactionsRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` +} + +// Removes all pending paid reactions in a live story group call +func (client *Client) RemovePendingLiveStoryReactions(req *RemovePendingLiveStoryReactionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removePendingLiveStoryReactions", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteGroupCallMessagesRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Identifiers of the messages to be deleted + MessageIds []int32 `json:"message_ids"` + // Pass true to report the messages as spam + ReportSpam bool `json:"report_spam"` +} + +// Deletes messages in a group call; for live story calls only. Requires groupCallMessage.can_be_deleted right +func (client *Client) DeleteGroupCallMessages(req *DeleteGroupCallMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteGroupCallMessages", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "message_ids": req.MessageIds, + "report_spam": req.ReportSpam, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteGroupCallMessagesBySenderRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Identifier of the sender of messages to delete + SenderId MessageSender `json:"sender_id"` + // Pass true to report the messages as spam + ReportSpam bool `json:"report_spam"` +} + +// Deletes all messages sent by the specified message sender in a group call; for live story calls only. Requires groupCall.can_delete_messages right +func (client *Client) DeleteGroupCallMessagesBySender(req *DeleteGroupCallMessagesBySenderRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteGroupCallMessagesBySender", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "sender_id": req.SenderId, + "report_spam": req.ReportSpam, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetLiveStoryTopDonorsRequest struct { + // Group call identifier of the live story + GroupCallId int32 `json:"group_call_id"` +} + +// Returns the list of top live story donors +func (client *Client) GetLiveStoryTopDonors(req *GetLiveStoryTopDonorsRequest) (*LiveStoryDonors, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLiveStoryTopDonors", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLiveStoryDonors(result.Data) +} + +type InviteGroupCallParticipantRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // User identifier + UserId int64 `json:"user_id"` + // Pass true if the group call is a video call + IsVideo bool `json:"is_video"` +} + +// Invites a user to an active group call; for group calls not bound to a chat only. Sends a service message of the type messageGroupCall. The group call can have at most getOption("group_call_participant_count_max") participants +func (client *Client) InviteGroupCallParticipant(req *InviteGroupCallParticipantRequest) (InviteGroupCallParticipantResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "inviteGroupCallParticipant", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "user_id": req.UserId, + "is_video": req.IsVideo, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeInviteGroupCallParticipantResultUserPrivacyRestricted: + return UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(result.Data) + + case TypeInviteGroupCallParticipantResultUserAlreadyParticipant: + return UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(result.Data) + + case TypeInviteGroupCallParticipantResultUserWasBanned: + return UnmarshalInviteGroupCallParticipantResultUserWasBanned(result.Data) + + case TypeInviteGroupCallParticipantResultSuccess: + return UnmarshalInviteGroupCallParticipantResultSuccess(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type DeclineGroupCallInvitationRequest struct { + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message of the type messageGroupCall + MessageId int64 `json:"message_id"` +} + +// Declines an invitation to an active group call via messageGroupCall. Can be called both by the sender and the receiver of the invitation +func (client *Client) DeclineGroupCallInvitation(req *DeclineGroupCallInvitationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "declineGroupCallInvitation", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type BanGroupCallParticipantsRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Identifiers of group call participants to ban; identifiers of unknown users from the update updateGroupCallParticipants can be also passed to the method + UserIds []JsonInt64 `json:"user_ids"` +} + +// Bans users from a group call not bound to a chat; requires groupCall.is_owned. Only the owner of the group call can invite the banned users back +func (client *Client) BanGroupCallParticipants(req *BanGroupCallParticipantsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "banGroupCallParticipants", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -11186,18 +16491,47 @@ func (client *Client) InviteGroupCallParticipants(req *InviteGroupCallParticipan return UnmarshalOk(result.Data) } -type GetGroupCallInviteLinkRequest struct { +type InviteVideoChatParticipantsRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` - // Pass true if the invite link needs to contain an invite hash, passing which to joinGroupCall would allow the invited user to unmute themselves. Requires groupCall.can_be_managed group call flag + // User identifiers. At most 10 users can be invited simultaneously + UserIds []int64 `json:"user_ids"` +} + +// Invites users to an active video chat. Sends a service message of the type messageInviteVideoChatParticipants to the chat bound to the group call +func (client *Client) InviteVideoChatParticipants(req *InviteVideoChatParticipantsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "inviteVideoChatParticipants", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "user_ids": req.UserIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetVideoChatInviteLinkRequest struct { + // Group call identifier + GroupCallId int32 `json:"group_call_id"` + // Pass true if the invite link needs to contain an invite hash, passing which to joinVideoChat would allow the invited user to unmute themselves. Requires groupCall.can_be_managed right CanSelfUnmute bool `json:"can_self_unmute"` } // Returns invite link to a video chat in a public chat -func (client *Client) GetGroupCallInviteLink(req *GetGroupCallInviteLinkRequest) (*HttpUrl, error) { +func (client *Client) GetVideoChatInviteLink(req *GetVideoChatInviteLinkRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getGroupCallInviteLink", + Type: "getVideoChatInviteLink", }, Data: map[string]interface{}{ "group_call_id": req.GroupCallId, @@ -11220,7 +16554,7 @@ type RevokeGroupCallInviteLinkRequest struct { GroupCallId int32 `json:"group_call_id"` } -// Revokes invite link for a group call. Requires groupCall.can_be_managed group call flag +// Revokes invite link for a group call. Requires groupCall.can_be_managed right for video chats or groupCall.is_owned otherwise func (client *Client) RevokeGroupCallInviteLink(req *RevokeGroupCallInviteLinkRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11252,7 +16586,7 @@ type StartGroupCallRecordingRequest struct { UsePortraitOrientation bool `json:"use_portrait_orientation"` } -// Starts recording of an active group call. Requires groupCall.can_be_managed group call flag +// Starts recording of an active group call; for video chats only. Requires groupCall.can_be_managed right func (client *Client) StartGroupCallRecording(req *StartGroupCallRecordingRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11281,7 +16615,7 @@ type EndGroupCallRecordingRequest struct { GroupCallId int32 `json:"group_call_id"` } -// Ends recording of an active group call. Requires groupCall.can_be_managed group call flag +// Ends recording of an active group call; for video chats only. Requires groupCall.can_be_managed right func (client *Client) EndGroupCallRecording(req *EndGroupCallRecordingRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11360,6 +16694,35 @@ func (client *Client) ToggleGroupCallIsMyVideoEnabled(req *ToggleGroupCallIsMyVi return UnmarshalOk(result.Data) } +type SetGroupCallPaidMessageStarCountRequest struct { + // Group call identifier; must be an identifier of a live story call + GroupCallId int32 `json:"group_call_id"` + // The new minimum number of Telegram Stars; 0-getOption("paid_group_call_message_star_count_max") + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Changes the minimum number of Telegram Stars that must be paid by general participant for each sent message to a live story call. Requires groupCall.can_be_managed right +func (client *Client) SetGroupCallPaidMessageStarCount(req *SetGroupCallPaidMessageStarCountRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGroupCallPaidMessageStarCount", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetGroupCallParticipantIsSpeakingRequest struct { // Group call identifier GroupCallId int32 `json:"group_call_id"` @@ -11369,8 +16732,8 @@ type SetGroupCallParticipantIsSpeakingRequest struct { IsSpeaking bool `json:"is_speaking"` } -// Informs TDLib that speaking state of a participant of an active group has changed -func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallParticipantIsSpeakingRequest) (*Ok, error) { +// Informs TDLib that speaking state of a participant of an active group call has changed. Returns identifier of the participant if it is found +func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallParticipantIsSpeakingRequest) (MessageSender, error) { result, err := client.Send(Request{ meta: meta{ Type: "setGroupCallParticipantIsSpeaking", @@ -11389,7 +16752,16 @@ func (client *Client) SetGroupCallParticipantIsSpeaking(req *SetGroupCallPartici return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeMessageSenderUser: + return UnmarshalMessageSenderUser(result.Data) + + case TypeMessageSenderChat: + return UnmarshalMessageSenderChat(result.Data) + + default: + return nil, errors.New("invalid type") + } } type ToggleGroupCallParticipantIsMutedRequest struct { @@ -11401,7 +16773,7 @@ type ToggleGroupCallParticipantIsMutedRequest struct { IsMuted bool `json:"is_muted"` } -// Toggles whether a participant of an active group call is muted, unmuted, or allowed to unmute themselves +// Toggles whether a participant of an active group call is muted, unmuted, or allowed to unmute themselves; not supported for live stories func (client *Client) ToggleGroupCallParticipantIsMuted(req *ToggleGroupCallParticipantIsMutedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11433,7 +16805,7 @@ type SetGroupCallParticipantVolumeLevelRequest struct { VolumeLevel int32 `json:"volume_level"` } -// Changes volume level of a participant of an active group call. If the current user can manage the group call, then the participant's volume level will be changed for all users with the default volume level +// Changes volume level of a participant of an active group call; not supported for live stories. If the current user can manage the group call or is the owner of the group call, then the participant's volume level will be changed for all users with the default volume level func (client *Client) SetGroupCallParticipantVolumeLevel(req *SetGroupCallParticipantVolumeLevelRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11461,11 +16833,11 @@ type ToggleGroupCallParticipantIsHandRaisedRequest struct { GroupCallId int32 `json:"group_call_id"` // Participant identifier ParticipantId MessageSender `json:"participant_id"` - // Pass true if the user's hand needs to be raised. Only self hand can be raised. Requires groupCall.can_be_managed group call flag to lower other's hand + // Pass true if the user's hand needs to be raised. Only self hand can be raised. Requires groupCall.can_be_managed right to lower other's hand IsHandRaised bool `json:"is_hand_raised"` } -// Toggles whether a group call participant hand is rased +// Toggles whether a group call participant hand is rased; for video chats only func (client *Client) ToggleGroupCallParticipantIsHandRaised(req *ToggleGroupCallParticipantIsHandRaisedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11488,6 +16860,35 @@ func (client *Client) ToggleGroupCallParticipantIsHandRaised(req *ToggleGroupCal return UnmarshalOk(result.Data) } +type GetGroupCallParticipantsRequest struct { + // The group call which participants will be returned + InputGroupCall InputGroupCall `json:"input_group_call"` + // The maximum number of participants to return; must be positive + Limit int32 `json:"limit"` +} + +// Returns information about participants of a non-joined group call that is not bound to a chat +func (client *Client) GetGroupCallParticipants(req *GetGroupCallParticipantsRequest) (*GroupCallParticipants, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGroupCallParticipants", + }, + Data: map[string]interface{}{ + "input_group_call": req.InputGroupCall, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGroupCallParticipants(result.Data) +} + type LoadGroupCallParticipantsRequest struct { // Group call identifier. The group call must be previously received through getGroupCall and must be joined or being joined GroupCallId int32 `json:"group_call_id"` @@ -11495,7 +16896,7 @@ type LoadGroupCallParticipantsRequest struct { Limit int32 `json:"limit"` } -// Loads more participants of a group call. The loaded participants will be received through updates. Use the field groupCall.loaded_all_participants to check whether all participants have already been loaded +// Loads more participants of a group call; not supported in live stories. The loaded participants will be received through updates. Use the field groupCall.loaded_all_participants to check whether all participants have already been loaded func (client *Client) LoadGroupCallParticipants(req *LoadGroupCallParticipantsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11548,7 +16949,7 @@ type EndGroupCallRequest struct { GroupCallId int32 `json:"group_call_id"` } -// Ends a group call. Requires groupCall.can_be_managed +// Ends a group call. Requires groupCall.can_be_managed right for video chats and live stories or groupCall.is_owned otherwise func (client *Client) EndGroupCall(req *EndGroupCallRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11574,7 +16975,7 @@ type GetGroupCallStreamsRequest struct { GroupCallId int32 `json:"group_call_id"` } -// Returns information about available group call streams +// Returns information about available streams in a video chat or a live story func (client *Client) GetGroupCallStreams(req *GetGroupCallStreamsRequest) (*GroupCallStreams, error) { result, err := client.Send(Request{ meta: meta{ @@ -11608,8 +17009,8 @@ type GetGroupCallStreamSegmentRequest struct { VideoQuality GroupCallVideoQuality `json:"video_quality"` } -// Returns a file with a segment of a group call stream in a modified OGG format for audio or MPEG-4 format for video -func (client *Client) GetGroupCallStreamSegment(req *GetGroupCallStreamSegmentRequest) (*FilePart, error) { +// Returns a file with a segment of a video chat or live story in a modified OGG format for audio or MPEG-4 format for video +func (client *Client) GetGroupCallStreamSegment(req *GetGroupCallStreamSegmentRequest) (*Data, error) { result, err := client.Send(Request{ meta: meta{ Type: "getGroupCallStreamSegment", @@ -11630,7 +17031,77 @@ func (client *Client) GetGroupCallStreamSegment(req *GetGroupCallStreamSegmentRe return nil, buildResponseError(result.Data) } - return UnmarshalFilePart(result.Data) + return UnmarshalData(result.Data) +} + +type EncryptGroupCallDataRequest struct { + // Group call identifier. The call must not be a video chat + GroupCallId int32 `json:"group_call_id"` + // Data channel for which data is encrypted + DataChannel GroupCallDataChannel `json:"data_channel"` + // Data to encrypt + Data []byte `json:"data"` + // Size of data prefix that must be kept unencrypted + UnencryptedPrefixSize int32 `json:"unencrypted_prefix_size"` +} + +// Encrypts group call data before sending them over network using tgcalls +func (client *Client) EncryptGroupCallData(req *EncryptGroupCallDataRequest) (*Data, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "encryptGroupCallData", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "data_channel": req.DataChannel, + "data": req.Data, + "unencrypted_prefix_size": req.UnencryptedPrefixSize, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalData(result.Data) +} + +type DecryptGroupCallDataRequest struct { + // Group call identifier. The call must not be a video chat + GroupCallId int32 `json:"group_call_id"` + // Identifier of the group call participant, which sent the data + ParticipantId MessageSender `json:"participant_id"` + // Data channel for which data was encrypted; pass null if unknown + DataChannel GroupCallDataChannel `json:"data_channel"` + // Data to decrypt + Data []byte `json:"data"` +} + +// Decrypts group call data received by tgcalls +func (client *Client) DecryptGroupCallData(req *DecryptGroupCallDataRequest) (*Data, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "decryptGroupCallData", + }, + Data: map[string]interface{}{ + "group_call_id": req.GroupCallId, + "participant_id": req.ParticipantId, + "data_channel": req.DataChannel, + "data": req.Data, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalData(result.Data) } type SetMessageSenderBlockListRequest struct { @@ -11730,8 +17201,10 @@ func (client *Client) GetBlockedMessageSenders(req *GetBlockedMessageSendersRequ } type AddContactRequest struct { - // The contact to add or edit; phone number may be empty and needs to be specified only if known, vCard is ignored - Contact *Contact `json:"contact"` + // Identifier of the user + UserId int64 `json:"user_id"` + // The contact to add or edit; phone number may be empty and needs to be specified only if known + Contact *ImportedContact `json:"contact"` // Pass true to share the current user's phone number with the new contact. A corresponding rule to userPrivacySettingShowPhoneNumber will be added if needed. Use the field userFullInfo.need_phone_number_privacy_exception to check whether the current user needs to be asked to share their phone number SharePhoneNumber bool `json:"share_phone_number"` } @@ -11743,6 +17216,7 @@ func (client *Client) AddContact(req *AddContactRequest) (*Ok, error) { Type: "addContact", }, Data: map[string]interface{}{ + "user_id": req.UserId, "contact": req.Contact, "share_phone_number": req.SharePhoneNumber, }, @@ -11759,8 +17233,8 @@ func (client *Client) AddContact(req *AddContactRequest) (*Ok, error) { } type ImportContactsRequest struct { - // The list of contacts to import or edit; contacts' vCard are ignored and are not imported - Contacts []*Contact `json:"contacts"` + // The list of contacts to import or edit + Contacts []*ImportedContact `json:"contacts"` } // Adds new contacts or edits existing contacts by their phone numbers; contacts' user identifiers are ignored @@ -11878,8 +17352,8 @@ func (client *Client) GetImportedContactCount() (*Count, error) { } type ChangeImportedContactsRequest struct { - // The new list of contacts, contact's vCard are ignored and are not imported - Contacts []*Contact `json:"contacts"` + // The new list of contacts to import + Contacts []*ImportedContact `json:"contacts"` } // Changes imported contacts using the list of contacts saved on the device. Imports newly added contacts and, if at least the file database is enabled, deletes recently deleted contacts. Query result depends on the result of the previous query, so only one query is possible at the same time @@ -11996,6 +17470,35 @@ func (client *Client) SetUserPersonalProfilePhoto(req *SetUserPersonalProfilePho return UnmarshalOk(result.Data) } +type SetUserNoteRequest struct { + // User identifier + UserId int64 `json:"user_id"` + // Note to set for the user; 0-getOption("user_note_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Note *FormattedText `json:"note"` +} + +// Changes a note of a contact user +func (client *Client) SetUserNote(req *SetUserNoteRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setUserNote", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "note": req.Note, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SuggestUserProfilePhotoRequest struct { // User identifier UserId int64 `json:"user_id"` @@ -12003,7 +17506,7 @@ type SuggestUserProfilePhotoRequest struct { Photo InputChatPhoto `json:"photo"` } -// Suggests a profile photo to another regular user with common messages +// Suggests a profile photo to another regular user with common messages and allowing non-paid messages func (client *Client) SuggestUserProfilePhoto(req *SuggestUserProfilePhotoRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -12025,9 +17528,98 @@ func (client *Client) SuggestUserProfilePhoto(req *SuggestUserProfilePhotoReques return UnmarshalOk(result.Data) } +type SuggestUserBirthdateRequest struct { + // User identifier + UserId int64 `json:"user_id"` + // Birthdate to suggest + Birthdate *Birthdate `json:"birthdate"` +} + +// Suggests a birthdate to another regular user with common messages and allowing non-paid messages +func (client *Client) SuggestUserBirthdate(req *SuggestUserBirthdateRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "suggestUserBirthdate", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "birthdate": req.Birthdate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleBotCanManageEmojiStatusRequest struct { + // User identifier of the bot + BotUserId int64 `json:"bot_user_id"` + // Pass true if the bot is allowed to change emoji status of the user; pass false otherwise + CanManageEmojiStatus bool `json:"can_manage_emoji_status"` +} + +// Toggles whether the bot can manage emoji status of the current user +func (client *Client) ToggleBotCanManageEmojiStatus(req *ToggleBotCanManageEmojiStatusRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleBotCanManageEmojiStatus", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "can_manage_emoji_status": req.CanManageEmojiStatus, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetUserEmojiStatusRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // New emoji status; pass null to switch to the default badge + EmojiStatus *EmojiStatus `json:"emoji_status"` +} + +// Changes the emoji status of a user; for bots only +func (client *Client) SetUserEmojiStatus(req *SetUserEmojiStatusRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setUserEmojiStatus", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "emoji_status": req.EmojiStatus, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SearchUserByPhoneNumberRequest struct { // Phone number to search for PhoneNumber string `json:"phone_number"` + // Pass true to get only locally available information without sending network requests + OnlyLocal bool `json:"only_local"` } // Searches a user by their phone number. Returns a 404 error if the user can't be found @@ -12038,6 +17630,7 @@ func (client *Client) SearchUserByPhoneNumber(req *SearchUserByPhoneNumberReques }, Data: map[string]interface{}{ "phone_number": req.PhoneNumber, + "only_local": req.OnlyLocal, }, }) if err != nil { @@ -12109,10 +17702,213 @@ func (client *Client) GetUserProfilePhotos(req *GetUserProfilePhotosRequest) (*C return UnmarshalChatPhotos(result.Data) } +type GetUserProfileAudiosRequest struct { + // User identifier + UserId int64 `json:"user_id"` + // The number of audio files to skip; must be non-negative + Offset int32 `json:"offset"` + // The maximum number of audio files to be returned; up to 100 + Limit int32 `json:"limit"` +} + +// Returns the list of profile audio files of a user +func (client *Client) GetUserProfileAudios(req *GetUserProfileAudiosRequest) (*Audios, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUserProfileAudios", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAudios(result.Data) +} + +type IsProfileAudioRequest struct { + // Identifier of the audio file to check + FileId int32 `json:"file_id"` +} + +// Checks whether a file is in the profile audio files of the current user. Returns a 404 error if it isn't +func (client *Client) IsProfileAudio(req *IsProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "isProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddProfileAudioRequest struct { + // Identifier of the audio file to be added. The file must have been uploaded to the server + FileId int32 `json:"file_id"` +} + +// Adds an audio file to the beginning of the profile audio files of the current user +func (client *Client) AddProfileAudio(req *AddProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetProfileAudioPositionRequest struct { + // Identifier of the file from profile audio files, which position will be changed + FileId int32 `json:"file_id"` + // Identifier of the file from profile audio files after which the file will be positioned; pass 0 to move the file to the beginning of the list + AfterFileId int32 `json:"after_file_id"` +} + +// Changes position of an audio file in the profile audio files of the current user +func (client *Client) SetProfileAudioPosition(req *SetProfileAudioPositionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setProfileAudioPosition", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + "after_file_id": req.AfterFileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveProfileAudioRequest struct { + // Identifier of the audio file to be removed + FileId int32 `json:"file_id"` +} + +// Removes an audio file from the profile audio files of the current user +func (client *Client) RemoveProfileAudio(req *RemoveProfileAudioRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeProfileAudio", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetStickerOutlineRequest struct { + // File identifier of the sticker + StickerFileId int32 `json:"sticker_file_id"` + // Pass true to get the outline scaled for animated emoji + ForAnimatedEmoji bool `json:"for_animated_emoji"` + // Pass true to get the outline scaled for clicked animated emoji message + ForClickedAnimatedEmojiMessage bool `json:"for_clicked_animated_emoji_message"` +} + +// Returns outline of a sticker. This is an offline method. Returns a 404 error if the outline isn't known +func (client *Client) GetStickerOutline(req *GetStickerOutlineRequest) (*Outline, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStickerOutline", + }, + Data: map[string]interface{}{ + "sticker_file_id": req.StickerFileId, + "for_animated_emoji": req.ForAnimatedEmoji, + "for_clicked_animated_emoji_message": req.ForClickedAnimatedEmojiMessage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOutline(result.Data) +} + +type GetStickerOutlineSvgPathRequest struct { + // File identifier of the sticker + StickerFileId int32 `json:"sticker_file_id"` + // Pass true to get the outline scaled for animated emoji + ForAnimatedEmoji bool `json:"for_animated_emoji"` + // Pass true to get the outline scaled for clicked animated emoji message + ForClickedAnimatedEmojiMessage bool `json:"for_clicked_animated_emoji_message"` +} + +// Returns outline of a sticker as an SVG path. This is an offline method. Returns an empty string if the outline isn't known +func (client *Client) GetStickerOutlineSvgPath(req *GetStickerOutlineSvgPathRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStickerOutlineSvgPath", + }, + Data: map[string]interface{}{ + "sticker_file_id": req.StickerFileId, + "for_animated_emoji": req.ForAnimatedEmoji, + "for_clicked_animated_emoji_message": req.ForClickedAnimatedEmojiMessage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + type GetStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` - // Search query; a space-separated list of emoji or a keyword prefix. If empty, returns all known installed stickers + // Search query; a space-separated list of emojis or a keyword prefix. If empty, returns all known installed stickers Query string `json:"query"` // The maximum number of stickers to be returned Limit int32 `json:"limit"` @@ -12182,8 +17978,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 emoji 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"` } @@ -12197,6 +17999,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, }, }) @@ -12211,6 +18016,25 @@ func (client *Client) SearchStickers(req *SearchStickersRequest) (*Stickers, err return UnmarshalStickers(result.Data) } +// Returns greeting stickers from regular sticker sets that can be used for the start page of other users +func (client *Client) GetGreetingStickers() (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGreetingStickers", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + type GetPremiumStickersRequest struct { // The maximum number of stickers to be returned; 0-100 Limit int32 `json:"limit"` @@ -12266,7 +18090,7 @@ func (client *Client) GetInstalledStickerSets(req *GetInstalledStickerSetsReques type GetArchivedStickerSetsRequest struct { // Type of the sticker sets to return StickerType StickerType `json:"sticker_type"` - // Identifier of the sticker set from which to return the result + // Identifier of the sticker set from which to return the result; use 0 to get results from the beginning OffsetStickerSetId JsonInt64 `json:"offset_sticker_set_id"` // The maximum number of sticker sets to return; up to 100 Limit int32 `json:"limit"` @@ -12379,9 +18203,37 @@ func (client *Client) GetStickerSet(req *GetStickerSetRequest) (*StickerSet, err return UnmarshalStickerSet(result.Data) } +type GetStickerSetNameRequest struct { + // Identifier of the sticker set + SetId JsonInt64 `json:"set_id"` +} + +// Returns name of a sticker set by its identifier +func (client *Client) GetStickerSetName(req *GetStickerSetNameRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStickerSetName", + }, + Data: map[string]interface{}{ + "set_id": req.SetId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + type SearchStickerSetRequest struct { // Name of the sticker set Name string `json:"name"` + // Pass true to ignore local cache of sticker sets and always send a network request + IgnoreCache bool `json:"ignore_cache"` } // Searches for a sticker set by its name @@ -12392,6 +18244,7 @@ func (client *Client) SearchStickerSet(req *SearchStickerSetRequest) (*StickerSe }, Data: map[string]interface{}{ "name": req.Name, + "ignore_cache": req.IgnoreCache, }, }) if err != nil { @@ -12438,17 +18291,20 @@ func (client *Client) SearchInstalledStickerSets(req *SearchInstalledStickerSets } type SearchStickerSetsRequest struct { + // Type of the sticker sets to return + StickerType StickerType `json:"sticker_type"` // Query to search for Query string `json:"query"` } -// Searches for ordinary sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results +// Searches for sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results func (client *Client) SearchStickerSets(req *SearchStickerSetsRequest) (*StickerSets, error) { result, err := client.Send(Request{ meta: meta{ Type: "searchStickerSets", }, Data: map[string]interface{}{ + "sticker_type": req.StickerType, "query": req.Query, }, }) @@ -12583,7 +18439,7 @@ type AddRecentStickerRequest struct { Sticker InputFile `json:"sticker"` } -// Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list. Emoji stickers can't be added to recent stickers +// Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set or in WEBP or WEBM format can be added to this list. Emoji stickers can't be added to recent stickers func (client *Client) AddRecentSticker(req *AddRecentStickerRequest) (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ @@ -12684,7 +18540,7 @@ type AddFavoriteStickerRequest struct { Sticker InputFile `json:"sticker"` } -// Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list. Emoji stickers can't be added to favorite stickers +// Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set or in WEBP or WEBM format can be added to this list. Emoji stickers can't be added to favorite stickers func (client *Client) AddFavoriteSticker(req *AddFavoriteStickerRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -12760,21 +18616,47 @@ func (client *Client) GetStickerEmojis(req *GetStickerEmojisRequest) (*Emojis, e type SearchEmojisRequest struct { // Text to search for Text string `json:"text"` - // Pass true if only emojis, which exactly match the text, needs to be returned - ExactMatch bool `json:"exact_match"` // List of possible IETF language tags of the user's input language; may be empty if unknown InputLanguageCodes []string `json:"input_language_codes"` } -// Searches for emojis by keywords. Supported only if the file database is enabled -func (client *Client) SearchEmojis(req *SearchEmojisRequest) (*Emojis, error) { +// Searches for emojis by keywords. Supported only if the file database is enabled. Order of results is unspecified +func (client *Client) SearchEmojis(req *SearchEmojisRequest) (*EmojiKeywords, error) { result, err := client.Send(Request{ meta: meta{ Type: "searchEmojis", }, Data: map[string]interface{}{ "text": req.Text, - "exact_match": req.ExactMatch, + "input_language_codes": req.InputLanguageCodes, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiKeywords(result.Data) +} + +type GetKeywordEmojisRequest struct { + // Text to search for + Text string `json:"text"` + // List of possible IETF language tags of the user's input language; may be empty if unknown + InputLanguageCodes []string `json:"input_language_codes"` +} + +// Returns emojis matching the keyword. Supported only if the file database is enabled. Order of results is unspecified +func (client *Client) GetKeywordEmojis(req *GetKeywordEmojisRequest) (*Emojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getKeywordEmojis", + }, + Data: map[string]interface{}{ + "text": req.Text, "input_language_codes": req.InputLanguageCodes, }, }) @@ -12794,7 +18676,7 @@ type GetEmojiCategoriesRequest struct { Type EmojiCategoryType `json:"type"` } -// Returns available emojis categories +// Returns available emoji categories func (client *Client) GetEmojiCategories(req *GetEmojiCategoriesRequest) (*EmojiCategories, error) { result, err := client.Send(Request{ meta: meta{ @@ -12872,7 +18754,7 @@ type GetCustomEmojiStickersRequest struct { CustomEmojiIds []JsonInt64 `json:"custom_emoji_ids"` } -// Returns list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned +// Returns the list of custom emoji stickers by their identifiers. Stickers are returned in arbitrary order. Only found stickers are returned func (client *Client) GetCustomEmojiStickers(req *GetCustomEmojiStickersRequest) (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ @@ -13040,6 +18922,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"` @@ -13095,7 +18996,7 @@ func (client *Client) RemoveRecentHashtag(req *RemoveRecentHashtagRequest) (*Ok, return UnmarshalOk(result.Data) } -type GetWebPagePreviewRequest struct { +type GetLinkPreviewRequest struct { // Message text with formatting Text *FormattedText `json:"text"` // Options to be used for generation of the link preview; pass null to use default link preview options @@ -13103,10 +19004,10 @@ type GetWebPagePreviewRequest struct { } // Returns a link preview by the text of a message. Do not call this function too often. Returns a 404 error if the text has no link preview -func (client *Client) GetWebPagePreview(req *GetWebPagePreviewRequest) (*WebPage, error) { +func (client *Client) GetLinkPreview(req *GetLinkPreviewRequest) (*LinkPreview, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getWebPagePreview", + Type: "getLinkPreview", }, Data: map[string]interface{}{ "text": req.Text, @@ -13121,17 +19022,17 @@ func (client *Client) GetWebPagePreview(req *GetWebPagePreviewRequest) (*WebPage return nil, buildResponseError(result.Data) } - return UnmarshalWebPage(result.Data) + return UnmarshalLinkPreview(result.Data) } type GetWebPageInstantViewRequest struct { // The web page URL Url string `json:"url"` - // Pass true to get full instant view for the web page - ForceFull bool `json:"force_full"` + // Pass true to get only locally available information without sending network requests + OnlyLocal bool `json:"only_local"` } -// Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page +// Returns an instant view version of a web page if available. This is an offline method if only_local is true. Returns a 404 error if the web page has no instant view page func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) (*WebPageInstantView, error) { result, err := client.Send(Request{ meta: meta{ @@ -13139,7 +19040,7 @@ func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) ( }, Data: map[string]interface{}{ "url": req.Url, - "force_full": req.ForceFull, + "only_local": req.OnlyLocal, }, }) if err != nil { @@ -13156,7 +19057,7 @@ func (client *Client) GetWebPageInstantView(req *GetWebPageInstantViewRequest) ( type SetProfilePhotoRequest struct { // Profile photo to set Photo InputChatPhoto `json:"photo"` - // Pass true to set a public photo, which will be visible even the main photo is hidden by privacy settings + // Pass true to set the public photo, which will be visible even if the main photo is hidden by privacy settings IsPublic bool `json:"is_public"` } @@ -13211,7 +19112,7 @@ func (client *Client) DeleteProfilePhoto(req *DeleteProfilePhotoRequest) (*Ok, e type SetAccentColorRequest struct { // Identifier of the accent color to use AccentColorId int32 `json:"accent_color_id"` - // Identifier of a custom emoji to be shown on the reply header background; 0 if none + // 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"` } @@ -13237,6 +19138,61 @@ func (client *Client) SetAccentColor(req *SetAccentColorRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SetUpgradedGiftColorsRequest struct { + // Identifier of the upgradedGiftColors scheme to use + UpgradedGiftColorsId JsonInt64 `json:"upgraded_gift_colors_id"` +} + +// Changes color scheme for the current user based on an owned or a hosted upgraded gift; for Telegram Premium users only +func (client *Client) SetUpgradedGiftColors(req *SetUpgradedGiftColorsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setUpgradedGiftColors", + }, + Data: map[string]interface{}{ + "upgraded_gift_colors_id": req.UpgradedGiftColorsId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetProfileAccentColorRequest struct { + // Identifier of the accent color to use for profile; pass -1 if none + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + // Identifier of a custom emoji to be shown on the user's profile photo background; 0 if none + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` +} + +// Changes accent color and background custom emoji for profile of the current user; for Telegram Premium users only +func (client *Client) SetProfileAccentColor(req *SetProfileAccentColorRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setProfileAccentColor", + }, + Data: map[string]interface{}{ + "profile_accent_color_id": req.ProfileAccentColorId, + "profile_background_custom_emoji_id": req.ProfileBackgroundCustomEmojiId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetNameRequest struct { // The new value of the first name for the current user; 1-64 characters FirstName string `json:"first_name"` @@ -13373,6 +19329,84 @@ func (client *Client) ReorderActiveUsernames(req *ReorderActiveUsernamesRequest) return UnmarshalOk(result.Data) } +type SetBirthdateRequest struct { + // The new value of the current user's birthdate; pass null to remove the birthdate + Birthdate *Birthdate `json:"birthdate"` +} + +// Changes the birthdate of the current user +func (client *Client) SetBirthdate(req *SetBirthdateRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBirthdate", + }, + Data: map[string]interface{}{ + "birthdate": req.Birthdate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetMainProfileTabRequest struct { + // The new value of the main profile tab + MainProfileTab ProfileTab `json:"main_profile_tab"` +} + +// Changes the main profile tab of the current user +func (client *Client) SetMainProfileTab(req *SetMainProfileTabRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMainProfileTab", + }, + Data: map[string]interface{}{ + "main_profile_tab": req.MainProfileTab, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetPersonalChatRequest struct { + // Identifier of the new personal chat; pass 0 to remove the chat. Use getSuitablePersonalChats to get suitable chats + ChatId int64 `json:"chat_id"` +} + +// Changes the personal chat of the current user +func (client *Client) SetPersonalChat(req *SetPersonalChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPersonalChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetEmojiStatusRequest struct { // New emoji status; pass null to switch to the default badge EmojiStatus *EmojiStatus `json:"emoji_status"` @@ -13399,16 +19433,42 @@ func (client *Client) SetEmojiStatus(req *SetEmojiStatusRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -type SetLocationRequest struct { - // The new location of the user - Location *Location `json:"location"` +type ToggleHasSponsoredMessagesEnabledRequest struct { + // Pass true to enable sponsored messages for the current user; false to disable them + HasSponsoredMessagesEnabled bool `json:"has_sponsored_messages_enabled"` } -// Changes the location of the current user. Needs to be called if getOption("is_location_visible") is true and location changes for more than 1 kilometer -func (client *Client) SetLocation(req *SetLocationRequest) (*Ok, error) { +// Toggles whether the current user has sponsored messages enabled. The setting has no effect for users without Telegram Premium for which sponsored messages are always enabled +func (client *Client) ToggleHasSponsoredMessagesEnabled(req *ToggleHasSponsoredMessagesEnabledRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "setLocation", + Type: "toggleHasSponsoredMessagesEnabled", + }, + Data: map[string]interface{}{ + "has_sponsored_messages_enabled": req.HasSponsoredMessagesEnabled, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessLocationRequest struct { + // The new location of the business; pass null to remove the location + Location *BusinessLocation `json:"location"` +} + +// Changes the business location of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessLocation(req *SetBusinessLocationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessLocation", }, Data: map[string]interface{}{ "location": req.Location, @@ -13425,22 +19485,129 @@ func (client *Client) SetLocation(req *SetLocationRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -type ChangePhoneNumberRequest struct { - // The new phone number of the user in international format +type SetBusinessOpeningHoursRequest struct { + // The new opening hours of the business; pass null to remove the opening hours; up to 28 time intervals can be specified + OpeningHours *BusinessOpeningHours `json:"opening_hours"` +} + +// Changes the business opening hours of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessOpeningHours(req *SetBusinessOpeningHoursRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessOpeningHours", + }, + Data: map[string]interface{}{ + "opening_hours": req.OpeningHours, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessGreetingMessageSettingsRequest struct { + // The new settings for the greeting message of the business; pass null to disable the greeting message + GreetingMessageSettings *BusinessGreetingMessageSettings `json:"greeting_message_settings"` +} + +// Changes the business greeting message settings of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessGreetingMessageSettings(req *SetBusinessGreetingMessageSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessGreetingMessageSettings", + }, + Data: map[string]interface{}{ + "greeting_message_settings": req.GreetingMessageSettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessAwayMessageSettingsRequest struct { + // The new settings for the away message of the business; pass null to disable the away message + AwayMessageSettings *BusinessAwayMessageSettings `json:"away_message_settings"` +} + +// Changes the business away message settings of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessAwayMessageSettings(req *SetBusinessAwayMessageSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessAwayMessageSettings", + }, + Data: map[string]interface{}{ + "away_message_settings": req.AwayMessageSettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBusinessStartPageRequest struct { + // The new start page of the business; pass null to remove custom start page + StartPage *InputBusinessStartPage `json:"start_page"` +} + +// Changes the business start page of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessStartPage(req *SetBusinessStartPageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessStartPage", + }, + Data: map[string]interface{}{ + "start_page": req.StartPage, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendPhoneNumberCodeRequest struct { + // The phone number, in international format PhoneNumber string `json:"phone_number"` // Settings for the authentication of the user's phone number; pass null to use default settings Settings *PhoneNumberAuthenticationSettings `json:"settings"` + // Type of the request for which the code is sent + Type PhoneNumberCodeType `json:"type"` } -// Changes the phone number of the user and sends an authentication code to the user's new phone number; for official Android and iOS applications only. On success, returns information about the sent code -func (client *Client) ChangePhoneNumber(req *ChangePhoneNumberRequest) (*AuthenticationCodeInfo, error) { +// Sends a code to the specified phone number. Aborts previous phone number verification if there was one. On success, returns information about the sent code +func (client *Client) SendPhoneNumberCode(req *SendPhoneNumberCodeRequest) (*AuthenticationCodeInfo, error) { result, err := client.Send(Request{ meta: meta{ - Type: "changePhoneNumber", + Type: "sendPhoneNumberCode", }, Data: map[string]interface{}{ "phone_number": req.PhoneNumber, "settings": req.Settings, + "type": req.Type, }, }) if err != nil { @@ -13454,13 +19621,72 @@ func (client *Client) ChangePhoneNumber(req *ChangePhoneNumberRequest) (*Authent return UnmarshalAuthenticationCodeInfo(result.Data) } -// Resends the authentication code sent to confirm a new phone number for the current user. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed -func (client *Client) ResendChangePhoneNumberCode() (*AuthenticationCodeInfo, error) { +type SendPhoneNumberFirebaseSmsRequest struct { + // Play Integrity API or SafetyNet Attestation API token for the Android application, or secret from push notification for the iOS application + Token string `json:"token"` +} + +// Sends Firebase Authentication SMS to the specified phone number. Works only when received a code of the type authenticationCodeTypeFirebaseAndroid or authenticationCodeTypeFirebaseIos +func (client *Client) SendPhoneNumberFirebaseSms(req *SendPhoneNumberFirebaseSmsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "resendChangePhoneNumberCode", + Type: "sendPhoneNumberFirebaseSms", + }, + Data: map[string]interface{}{ + "token": req.Token, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReportPhoneNumberCodeMissingRequest struct { + // Current mobile network code + MobileNetworkCode string `json:"mobile_network_code"` +} + +// Reports that authentication code wasn't delivered via SMS to the specified phone number; for official mobile applications only +func (client *Client) ReportPhoneNumberCodeMissing(req *ReportPhoneNumberCodeMissingRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportPhoneNumberCodeMissing", + }, + Data: map[string]interface{}{ + "mobile_network_code": req.MobileNetworkCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ResendPhoneNumberCodeRequest struct { + // Reason of code resending; pass null if unknown + Reason ResendCodeReason `json:"reason"` +} + +// Resends the authentication code sent to a phone number. Works only if the previously received authenticationCodeInfo next_code_type was not null and the server-specified timeout has passed +func (client *Client) ResendPhoneNumberCode(req *ResendPhoneNumberCodeRequest) (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendPhoneNumberCode", + }, + Data: map[string]interface{}{ + "reason": req.Reason, }, - Data: map[string]interface{}{}, }) if err != nil { return nil, err @@ -13473,16 +19699,16 @@ func (client *Client) ResendChangePhoneNumberCode() (*AuthenticationCodeInfo, er return UnmarshalAuthenticationCodeInfo(result.Data) } -type CheckChangePhoneNumberCodeRequest struct { +type CheckPhoneNumberCodeRequest struct { // Authentication code to check Code string `json:"code"` } -// Checks the authentication code sent to confirm a new phone number of the user -func (client *Client) CheckChangePhoneNumberCode(req *CheckChangePhoneNumberCodeRequest) (*Ok, error) { +// Checks the authentication code and completes the request for which the code was sent if appropriate +func (client *Client) CheckPhoneNumberCode(req *CheckPhoneNumberCodeRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "checkChangePhoneNumberCode", + Type: "checkPhoneNumberCode", }, Data: map[string]interface{}{ "code": req.Code, @@ -13499,6 +19725,258 @@ func (client *Client) CheckChangePhoneNumberCode(req *CheckChangePhoneNumberCode return UnmarshalOk(result.Data) } +// Returns the business bot that is connected to the current user account. Returns a 404 error if there is no connected bot +func (client *Client) GetBusinessConnectedBot() (*BusinessConnectedBot, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessConnectedBot", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessConnectedBot(result.Data) +} + +type SetBusinessConnectedBotRequest struct { + // Connection settings for the bot + Bot *BusinessConnectedBot `json:"bot"` +} + +// Adds or changes business bot that is connected to the current user account +func (client *Client) SetBusinessConnectedBot(req *SetBusinessConnectedBotRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessConnectedBot", + }, + Data: map[string]interface{}{ + "bot": req.Bot, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteBusinessConnectedBotRequest struct { + // Unique user identifier for the bot + BotUserId int64 `json:"bot_user_id"` +} + +// Deletes the business bot that is connected to the current user account +func (client *Client) DeleteBusinessConnectedBot(req *DeleteBusinessConnectedBotRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBusinessConnectedBot", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleBusinessConnectedBotChatIsPausedRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Pass true to pause the connected bot in the chat; pass false to resume the bot + IsPaused bool `json:"is_paused"` +} + +// Pauses or resumes the connected business bot in a specific chat +func (client *Client) ToggleBusinessConnectedBotChatIsPaused(req *ToggleBusinessConnectedBotChatIsPausedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleBusinessConnectedBotChatIsPaused", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_paused": req.IsPaused, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveBusinessConnectedBotFromChatRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Removes the connected business bot from a specific chat by adding the chat to businessRecipients.excluded_chat_ids +func (client *Client) RemoveBusinessConnectedBotFromChat(req *RemoveBusinessConnectedBotFromChatRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeBusinessConnectedBotFromChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns business chat links created for the current account +func (client *Client) GetBusinessChatLinks() (*BusinessChatLinks, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessChatLinks", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessChatLinks(result.Data) +} + +type CreateBusinessChatLinkRequest struct { + // Information about the link to create + LinkInfo *InputBusinessChatLink `json:"link_info"` +} + +// Creates a business chat link for the current account. Requires Telegram Business subscription. There can be up to getOption("business_chat_link_count_max") links created. Returns the created link +func (client *Client) CreateBusinessChatLink(req *CreateBusinessChatLinkRequest) (*BusinessChatLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createBusinessChatLink", + }, + Data: map[string]interface{}{ + "link_info": req.LinkInfo, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessChatLink(result.Data) +} + +type EditBusinessChatLinkRequest struct { + // The link to edit + Link string `json:"link"` + // New description of the link + LinkInfo *InputBusinessChatLink `json:"link_info"` +} + +// Edits a business chat link of the current account. Requires Telegram Business subscription. Returns the edited link +func (client *Client) EditBusinessChatLink(req *EditBusinessChatLinkRequest) (*BusinessChatLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBusinessChatLink", + }, + Data: map[string]interface{}{ + "link": req.Link, + "link_info": req.LinkInfo, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessChatLink(result.Data) +} + +type DeleteBusinessChatLinkRequest struct { + // The link to delete + Link string `json:"link"` +} + +// Deletes a business chat link of the current account +func (client *Client) DeleteBusinessChatLink(req *DeleteBusinessChatLinkRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBusinessChatLink", + }, + Data: map[string]interface{}{ + "link": req.Link, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBusinessChatLinkInfoRequest struct { + // Name of the link + LinkName string `json:"link_name"` +} + +// Returns information about a business chat link +func (client *Client) GetBusinessChatLinkInfo(req *GetBusinessChatLinkInfoRequest) (*BusinessChatLinkInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessChatLinkInfo", + }, + Data: map[string]interface{}{ + "link_name": req.LinkName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessChatLinkInfo(result.Data) +} + // Returns an HTTPS link, which can be used to get information about the current user func (client *Client) GetUserLink() (*UserLink, error) { result, err := client.Send(Request{ @@ -13612,7 +20090,7 @@ type GetCommandsRequest struct { LanguageCode string `json:"language_code"` } -// Returns list of commands supported by the bot for the given user scope and language; for bots only +// Returns the list of commands supported by the bot for the given user scope and language; for bots only func (client *Client) GetCommands(req *GetCommandsRequest) (*BotCommands, error) { result, err := client.Send(Request{ meta: meta{ @@ -13825,6 +20303,192 @@ func (client *Client) SendWebAppCustomRequest(req *SendWebAppCustomRequestReques return UnmarshalCustomRequestResult(result.Data) } +type GetBotMediaPreviewsRequest struct { + // Identifier of the target bot. The bot must have the main Web App + BotUserId int64 `json:"bot_user_id"` +} + +// Returns the list of media previews of a bot +func (client *Client) GetBotMediaPreviews(req *GetBotMediaPreviewsRequest) (*BotMediaPreviews, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotMediaPreviews", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBotMediaPreviews(result.Data) +} + +type GetBotMediaPreviewInfoRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserId int64 `json:"bot_user_id"` + // A two-letter ISO 639-1 language code for which to get previews. If empty, then default previews are returned + LanguageCode string `json:"language_code"` +} + +// Returns the list of media previews for the given language and the list of languages for which the bot has dedicated previews +func (client *Client) GetBotMediaPreviewInfo(req *GetBotMediaPreviewInfoRequest) (*BotMediaPreviewInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotMediaPreviewInfo", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBotMediaPreviewInfo(result.Data) +} + +type AddBotMediaPreviewRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserId int64 `json:"bot_user_id"` + // A two-letter ISO 639-1 language code for which preview is added. If empty, then the preview will be shown to all users for whose languages there are no dedicated previews. If non-empty, then there must be an official language pack of the same name, which is returned by getLocalizationTargetInfo + LanguageCode string `json:"language_code"` + // Content of the added preview + Content InputStoryContent `json:"content"` +} + +// Adds a new media preview to the beginning of the list of media previews of a bot. Returns the added preview after addition is completed server-side. The total number of previews must not exceed getOption("bot_media_preview_count_max") for the given language +func (client *Client) AddBotMediaPreview(req *AddBotMediaPreviewRequest) (*BotMediaPreview, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addBotMediaPreview", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + "content": req.Content, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBotMediaPreview(result.Data) +} + +type EditBotMediaPreviewRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserId int64 `json:"bot_user_id"` + // Language code of the media preview to edit + LanguageCode string `json:"language_code"` + // File identifier of the media to replace + FileId int32 `json:"file_id"` + // Content of the new preview + Content InputStoryContent `json:"content"` +} + +// Replaces media preview in the list of media previews of a bot. Returns the new preview after edit is completed server-side +func (client *Client) EditBotMediaPreview(req *EditBotMediaPreviewRequest) (*BotMediaPreview, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editBotMediaPreview", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + "file_id": req.FileId, + "content": req.Content, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBotMediaPreview(result.Data) +} + +type ReorderBotMediaPreviewsRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserId int64 `json:"bot_user_id"` + // Language code of the media previews to reorder + LanguageCode string `json:"language_code"` + // File identifiers of the media in the new order + FileIds []int32 `json:"file_ids"` +} + +// Changes order of media previews in the list of media previews of a bot +func (client *Client) ReorderBotMediaPreviews(req *ReorderBotMediaPreviewsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderBotMediaPreviews", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + "file_ids": req.FileIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteBotMediaPreviewsRequest struct { + // Identifier of the target bot. The bot must be owned and must have the main Web App + BotUserId int64 `json:"bot_user_id"` + // Language code of the media previews to delete + LanguageCode string `json:"language_code"` + // File identifiers of the media to delete + FileIds []int32 `json:"file_ids"` +} + +// Deletes media previews from the list of media previews of a bot +func (client *Client) DeleteBotMediaPreviews(req *DeleteBotMediaPreviewsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteBotMediaPreviews", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + "file_ids": req.FileIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetBotNameRequest struct { // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` @@ -13924,7 +20588,7 @@ type ToggleBotUsernameIsActiveRequest struct { IsActive bool `json:"is_active"` } -// Changes active state for a username of a bot. The editable username can't be disabled. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached. Can be called only if userTypeBot.can_be_edited == true +// Changes active state for a username of a bot. The editable username can be disabled only if there are other active usernames. May return an error with a message "USERNAMES_ACTIVE_TOO_MUCH" if the maximum number of active usernames has been reached. Can be called only if userTypeBot.can_be_edited == true func (client *Client) ToggleBotUsernameIsActive(req *ToggleBotUsernameIsActiveRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14098,6 +20762,67 @@ func (client *Client) GetBotInfoShortDescription(req *GetBotInfoShortDescription return UnmarshalText(result.Data) } +type SetMessageSenderBotVerificationRequest struct { + // Identifier of the owned bot, which will verify the user or the chat + BotUserId int64 `json:"bot_user_id"` + // Identifier of the user or the supergroup or channel chat, which will be verified by the bot + VerifiedId MessageSender `json:"verified_id"` + // Custom description of verification reason; 0-getOption("bot_verification_custom_description_length_max"). If empty, then "was verified by organization "organization_name"" will be used as description. Can be specified only if the bot is allowed to provide custom description + CustomDescription string `json:"custom_description"` +} + +// Changes the verification status of a user or a chat by an owned bot +func (client *Client) SetMessageSenderBotVerification(req *SetMessageSenderBotVerificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setMessageSenderBotVerification", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "verified_id": req.VerifiedId, + "custom_description": req.CustomDescription, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveMessageSenderBotVerificationRequest struct { + // Identifier of the owned bot, which verified the user or the chat + BotUserId int64 `json:"bot_user_id"` + // Identifier of the user or the supergroup or channel chat, which verification is removed + VerifiedId MessageSender `json:"verified_id"` +} + +// Removes the verification status of a user or a chat by an owned bot +func (client *Client) RemoveMessageSenderBotVerification(req *RemoveMessageSenderBotVerificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeMessageSenderBotVerification", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "verified_id": req.VerifiedId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Returns all active sessions of the current user func (client *Client) GetActiveSessions() (*Sessions, error) { result, err := client.Send(Request{ @@ -14481,14 +21206,103 @@ func (client *Client) SetSupergroupStickerSet(req *SetSupergroupStickerSetReques return UnmarshalOk(result.Data) } +type SetSupergroupCustomEmojiStickerSetRequest struct { + // Identifier of the supergroup + SupergroupId int64 `json:"supergroup_id"` + // New value of the custom emoji sticker set identifier for the supergroup. Use 0 to remove the custom emoji sticker set in the supergroup + CustomEmojiStickerSetId JsonInt64 `json:"custom_emoji_sticker_set_id"` +} + +// Changes the custom emoji sticker set of a supergroup; requires can_change_info administrator right. The chat must have at least chatBoostFeatures.min_custom_emoji_sticker_set_boost_level boost level to pass the corresponding color +func (client *Client) SetSupergroupCustomEmojiStickerSet(req *SetSupergroupCustomEmojiStickerSetRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSupergroupCustomEmojiStickerSet", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "custom_emoji_sticker_set_id": req.CustomEmojiStickerSetId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetSupergroupUnrestrictBoostCountRequest struct { + // Identifier of the supergroup + SupergroupId int64 `json:"supergroup_id"` + // New value of the unrestrict_boost_count supergroup setting; 0-8. Use 0 to remove the setting + UnrestrictBoostCount int32 `json:"unrestrict_boost_count"` +} + +// Changes the number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; requires can_restrict_members administrator right +func (client *Client) SetSupergroupUnrestrictBoostCount(req *SetSupergroupUnrestrictBoostCountRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSupergroupUnrestrictBoostCount", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "unrestrict_boost_count": req.UnrestrictBoostCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetSupergroupMainProfileTabRequest struct { + // Identifier of the channel + SupergroupId int64 `json:"supergroup_id"` + // The new value of the main profile tab + MainProfileTab ProfileTab `json:"main_profile_tab"` +} + +// Changes the main profile tab of the channel; requires can_change_info administrator right +func (client *Client) SetSupergroupMainProfileTab(req *SetSupergroupMainProfileTabRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setSupergroupMainProfileTab", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "main_profile_tab": req.MainProfileTab, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSupergroupSignMessagesRequest struct { // Identifier of the channel SupergroupId int64 `json:"supergroup_id"` // New value of sign_messages SignMessages bool `json:"sign_messages"` + // New value of show_message_sender + ShowMessageSender bool `json:"show_message_sender"` } -// Toggles whether sender signature is added to sent messages in a channel; requires can_change_info administrator right +// Toggles whether sender signature or link to the account is added to sent messages in a channel; requires can_change_info member right func (client *Client) ToggleSupergroupSignMessages(req *ToggleSupergroupSignMessagesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14497,6 +21311,7 @@ func (client *Client) ToggleSupergroupSignMessages(req *ToggleSupergroupSignMess Data: map[string]interface{}{ "supergroup_id": req.SupergroupId, "sign_messages": req.SignMessages, + "show_message_sender": req.ShowMessageSender, }, }) if err != nil { @@ -14511,7 +21326,7 @@ func (client *Client) ToggleSupergroupSignMessages(req *ToggleSupergroupSignMess } type ToggleSupergroupJoinToSendMessagesRequest struct { - // Identifier of the supergroup + // Identifier of the supergroup that isn't a broadcast group SupergroupId int64 `json:"supergroup_id"` // New value of join_to_send_messages JoinToSendMessages bool `json:"join_to_send_messages"` @@ -14540,7 +21355,7 @@ func (client *Client) ToggleSupergroupJoinToSendMessages(req *ToggleSupergroupJo } type ToggleSupergroupJoinByRequestRequest struct { - // Identifier of the channel + // Identifier of the supergroup that isn't a broadcast group and isn't a channel direct message group SupergroupId int64 `json:"supergroup_id"` // New value of join_by_request JoinByRequest bool `json:"join_by_request"` @@ -14575,7 +21390,7 @@ type ToggleSupergroupIsAllHistoryAvailableRequest struct { IsAllHistoryAvailable bool `json:"is_all_history_available"` } -// Toggles whether the message history of a supergroup is available to new members; requires can_change_info administrator right +// Toggles whether the message history of a supergroup is available to new members; requires can_change_info member right func (client *Client) ToggleSupergroupIsAllHistoryAvailable(req *ToggleSupergroupIsAllHistoryAvailableRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -14597,6 +21412,64 @@ func (client *Client) ToggleSupergroupIsAllHistoryAvailable(req *ToggleSupergrou return UnmarshalOk(result.Data) } +type ToggleSupergroupCanHaveSponsoredMessagesRequest struct { + // The identifier of the channel + SupergroupId int64 `json:"supergroup_id"` + // The new value of can_have_sponsored_messages + CanHaveSponsoredMessages bool `json:"can_have_sponsored_messages"` +} + +// Toggles whether sponsored messages are shown in the channel chat; requires owner privileges in the channel. The chat must have at least chatBoostFeatures.min_sponsored_message_disable_boost_level boost level to disable sponsored messages +func (client *Client) ToggleSupergroupCanHaveSponsoredMessages(req *ToggleSupergroupCanHaveSponsoredMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSupergroupCanHaveSponsoredMessages", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "can_have_sponsored_messages": req.CanHaveSponsoredMessages, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleSupergroupHasAutomaticTranslationRequest struct { + // The identifier of the channel + SupergroupId int64 `json:"supergroup_id"` + // The new value of has_automatic_translation + HasAutomaticTranslation bool `json:"has_automatic_translation"` +} + +// Toggles whether messages are automatically translated in the channel chat; requires can_change_info administrator right in the channel. The chat must have at least chatBoostFeatures.min_automatic_translation_boost_level boost level to enable automatic translation +func (client *Client) ToggleSupergroupHasAutomaticTranslation(req *ToggleSupergroupHasAutomaticTranslationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleSupergroupHasAutomaticTranslation", + }, + Data: map[string]interface{}{ + "supergroup_id": req.SupergroupId, + "has_automatic_translation": req.HasAutomaticTranslation, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSupergroupHasHiddenMembersRequest struct { // Identifier of the supergroup SupergroupId int64 `json:"supergroup_id"` @@ -14660,6 +21533,8 @@ type ToggleSupergroupIsForumRequest struct { SupergroupId int64 `json:"supergroup_id"` // New value of is_forum IsForum bool `json:"is_forum"` + // New value of has_forum_tabs; ignored if is_forum is false + HasForumTabs bool `json:"has_forum_tabs"` } // Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums @@ -14671,6 +21546,7 @@ func (client *Client) ToggleSupergroupIsForum(req *ToggleSupergroupIsForumReques Data: map[string]interface{}{ "supergroup_id": req.SupergroupId, "is_forum": req.IsForum, + "has_forum_tabs": req.HasForumTabs, }, }) if err != nil { @@ -14713,7 +21589,7 @@ func (client *Client) ToggleSupergroupIsBroadcastGroup(req *ToggleSupergroupIsBr type ReportSupergroupSpamRequest struct { // Supergroup identifier SupergroupId int64 `json:"supergroup_id"` - // Identifiers of messages to report + // Identifiers of messages to report. Use messageProperties.can_report_supergroup_spam to check whether the message can be reported MessageIds []int64 `json:"message_ids"` } @@ -14742,7 +21618,7 @@ func (client *Client) ReportSupergroupSpam(req *ReportSupergroupSpamRequest) (*O type ReportSupergroupAntiSpamFalsePositiveRequest struct { // Supergroup identifier SupergroupId int64 `json:"supergroup_id"` - // Identifier of the erroneously deleted message + // Identifier of the erroneously deleted message from chatEventMessageDeleted MessageId int64 `json:"message_id"` } @@ -14775,7 +21651,7 @@ type GetSupergroupMembersRequest struct { Filter SupergroupMembersFilter `json:"filter"` // Number of users to skip Offset int32 `json:"offset"` - // The maximum number of users be returned; up to 200 + // The maximum number of users to be returned; up to 200 Limit int32 `json:"limit"` } @@ -14870,6 +21746,25 @@ func (client *Client) GetChatEventLog(req *GetChatEventLogRequest) (*ChatEvents, return UnmarshalChatEvents(result.Data) } +// Returns the list of supported time zones +func (client *Client) GetTimeZones() (*TimeZones, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTimeZones", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTimeZones(result.Data) +} + type GetPaymentFormRequest struct { // The invoice InputInvoice InputInvoice `json:"input_invoice"` @@ -14877,7 +21772,7 @@ type GetPaymentFormRequest struct { Theme *ThemeParameters `json:"theme"` } -// Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy +// Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy, or wants to buy access to media in a messagePaidMedia message func (client *Client) GetPaymentForm(req *GetPaymentFormRequest) (*PaymentForm, error) { result, err := client.Send(Request{ meta: meta{ @@ -14940,7 +21835,7 @@ type SendPaymentFormRequest struct { OrderInfoId string `json:"order_info_id"` // Identifier of a chosen shipping option, if applicable ShippingOptionId string `json:"shipping_option_id"` - // The credentials chosen by user for payment + // The credentials chosen by user for payment; pass null for a payment in Telegram Stars Credentials InputCredentials `json:"credentials"` // Chosen by the user amount of tip in the smallest units of the currency TipAmount int64 `json:"tip_amount"` @@ -15058,7 +21953,1289 @@ func (client *Client) DeleteSavedCredentials() (*Ok, error) { return UnmarshalOk(result.Data) } +type SetGiftSettingsRequest struct { + // The new settings + Settings *GiftSettings `json:"settings"` +} + +// Changes settings for gift receiving for the current user +func (client *Client) SetGiftSettings(req *SetGiftSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGiftSettings", + }, + Data: map[string]interface{}{ + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns gifts that can be sent to other users and channel chats +func (client *Client) GetAvailableGifts() (*AvailableGifts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAvailableGifts", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAvailableGifts(result.Data) +} + +type CanSendGiftRequest struct { + // Identifier of the gift to send + GiftId JsonInt64 `json:"gift_id"` +} + +// Checks whether a gift with next_send_date in the future can be sent already +func (client *Client) CanSendGift(req *CanSendGiftRequest) (CanSendGiftResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "canSendGift", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(result.Data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type SendGiftRequest struct { + // Identifier of the gift to send + GiftId JsonInt64 `json:"gift_id"` + // Identifier of the user or the channel chat that will receive the gift; limited gifts can't be sent to channel chats + OwnerId MessageSender `json:"owner_id"` + // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed. Must be empty if the receiver enabled paid messages + Text *FormattedText `json:"text"` + // Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them + IsPrivate bool `json:"is_private"` + // Pass true to additionally pay for the gift upgrade and allow the receiver to upgrade it for free + PayForUpgrade bool `json:"pay_for_upgrade"` +} + +// Sends a gift to another user or channel chat. May return an error with a message "STARGIFT_USAGE_LIMITED" if the gift was sold out +func (client *Client) SendGift(req *SendGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendGift", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + "owner_id": req.OwnerId, + "text": req.Text, + "is_private": req.IsPrivate, + "pay_for_upgrade": req.PayForUpgrade, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetGiftAuctionStateRequest struct { + // Unique identifier of the auction + AuctionId string `json:"auction_id"` +} + +// Returns auction state for a gift +func (client *Client) GetGiftAuctionState(req *GetGiftAuctionStateRequest) (*GiftAuctionState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftAuctionState", + }, + Data: map[string]interface{}{ + "auction_id": req.AuctionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftAuctionState(result.Data) +} + +type GetGiftAuctionAcquiredGiftsRequest struct { + // Identifier of the auctioned gift + GiftId JsonInt64 `json:"gift_id"` +} + +// Returns the gifts that were acquired by the current user on a gift auction +func (client *Client) GetGiftAuctionAcquiredGifts(req *GetGiftAuctionAcquiredGiftsRequest) (*GiftAuctionAcquiredGifts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftAuctionAcquiredGifts", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftAuctionAcquiredGifts(result.Data) +} + +type OpenGiftAuctionRequest struct { + // Identifier of the gift, which auction was opened + GiftId JsonInt64 `json:"gift_id"` +} + +// Informs TDLib that a gift auction was opened by the user +func (client *Client) OpenGiftAuction(req *OpenGiftAuctionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openGiftAuction", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CloseGiftAuctionRequest struct { + // Identifier of the gift, which auction was closed + GiftId JsonInt64 `json:"gift_id"` +} + +// Informs TDLib that a gift auction was closed by the user +func (client *Client) CloseGiftAuction(req *CloseGiftAuctionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "closeGiftAuction", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type PlaceGiftAuctionBidRequest struct { + // Identifier of the gift to place the bid on + GiftId JsonInt64 `json:"gift_id"` + // The number of Telegram Stars to place in the bid + StarCount int64 `json:"star_count"` + // Identifier of the user who will receive the gift + UserId int64 `json:"user_id"` + // Text to show along with the gift; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed. Must be empty if the receiver enabled paid messages + Text *FormattedText `json:"text"` + // Pass true to show gift text and sender only to the gift receiver; otherwise, everyone will be able to see them + IsPrivate bool `json:"is_private"` +} + +// Places a bid on an auction gift +func (client *Client) PlaceGiftAuctionBid(req *PlaceGiftAuctionBidRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "placeGiftAuctionBid", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + "star_count": req.StarCount, + "user_id": req.UserId, + "text": req.Text, + "is_private": req.IsPrivate, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type IncreaseGiftAuctionBidRequest struct { + // Identifier of the gift to put the bid on + GiftId JsonInt64 `json:"gift_id"` + // The number of Telegram Stars to put in the bid + StarCount int64 `json:"star_count"` +} + +// Increases a bid for an auction gift without changing gift text and receiver +func (client *Client) IncreaseGiftAuctionBid(req *IncreaseGiftAuctionBidRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "increaseGiftAuctionBid", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SellGiftRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` +} + +// Sells a gift for Telegram Stars; requires owner privileges for gifts owned by a chat +func (client *Client) SellGift(req *SellGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sellGift", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "received_gift_id": req.ReceivedGiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleGiftIsSavedRequest struct { + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` + // Pass true to display the gift on the user's or the channel's profile page; pass false to remove it from the profile page + IsSaved bool `json:"is_saved"` +} + +// Toggles whether a gift is shown on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat +func (client *Client) ToggleGiftIsSaved(req *ToggleGiftIsSavedRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleGiftIsSaved", + }, + Data: map[string]interface{}{ + "received_gift_id": req.ReceivedGiftId, + "is_saved": req.IsSaved, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetPinnedGiftsRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` + // New list of pinned gifts. All gifts must be upgraded and saved on the profile page first. There can be up to getOption("pinned_gift_count_max") pinned gifts + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Changes the list of pinned gifts on the current user's or the channel's profile page; requires can_post_messages administrator right in the channel chat +func (client *Client) SetPinnedGifts(req *SetPinnedGiftsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPinnedGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleChatGiftNotificationsRequest struct { + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` + // Pass true to enable notifications about new gifts owned by the channel chat; pass false to disable the notifications + AreEnabled bool `json:"are_enabled"` +} + +// Toggles whether notifications for new gifts received by a channel chat are sent to the current user; requires can_post_messages administrator right in the chat +func (client *Client) ToggleChatGiftNotifications(req *ToggleChatGiftNotificationsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatGiftNotifications", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "are_enabled": req.AreEnabled, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetGiftUpgradePreviewRequest struct { + // Identifier of the regular gift + RegularGiftId JsonInt64 `json:"regular_gift_id"` +} + +// Returns examples of possible upgraded gifts for a regular gift +func (client *Client) GetGiftUpgradePreview(req *GetGiftUpgradePreviewRequest) (*GiftUpgradePreview, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftUpgradePreview", + }, + Data: map[string]interface{}{ + "regular_gift_id": req.RegularGiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftUpgradePreview(result.Data) +} + +type GetUpgradedGiftVariantsRequest struct { + // Identifier of the regular gift + RegularGiftId JsonInt64 `json:"regular_gift_id"` + // Pass true to get models that can be obtained by upgrading a regular gift + ReturnUpgradeModels bool `json:"return_upgrade_models"` + // Pass true to get models that can be obtained by crafting a gift from upgraded gifts + ReturnCraftModels bool `json:"return_craft_models"` +} + +// Returns all possible variants of upgraded gifts for a regular gift +func (client *Client) GetUpgradedGiftVariants(req *GetUpgradedGiftVariantsRequest) (*GiftUpgradeVariants, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGiftVariants", + }, + Data: map[string]interface{}{ + "regular_gift_id": req.RegularGiftId, + "return_upgrade_models": req.ReturnUpgradeModels, + "return_craft_models": req.ReturnCraftModels, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftUpgradeVariants(result.Data) +} + +type UpgradeGiftRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` + // Pass true to keep the original gift text, sender and receiver in the upgraded gift + KeepOriginalDetails bool `json:"keep_original_details"` + // The Telegram Star amount required to pay for the upgrade. It the gift has prepaid_upgrade_star_count > 0, then pass 0, otherwise, pass gift.upgrade_star_count + StarCount int64 `json:"star_count"` +} + +// Upgrades a regular gift +func (client *Client) UpgradeGift(req *UpgradeGiftRequest) (*UpgradeGiftResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "upgradeGift", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "received_gift_id": req.ReceivedGiftId, + "keep_original_details": req.KeepOriginalDetails, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpgradeGiftResult(result.Data) +} + +type BuyGiftUpgradeRequest struct { + // Identifier of the user or the channel chat that owns the gift + OwnerId MessageSender `json:"owner_id"` + // Prepaid upgrade hash as received along with the gift + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` + // The Telegram Star amount the user agreed to pay for the upgrade; must be equal to gift.upgrade_star_count + StarCount int64 `json:"star_count"` +} + +// Pays for upgrade of a regular gift that is owned by another user or channel chat +func (client *Client) BuyGiftUpgrade(req *BuyGiftUpgradeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "buyGiftUpgrade", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "prepaid_upgrade_hash": req.PrepaidUpgradeHash, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CraftGiftRequest struct { + // Identifier of the gifts to use for crafting + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Crafts a new gift from other gifts that will be permanently lost +func (client *Client) CraftGift(req *CraftGiftRequest) (CraftGiftResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "craftGift", + }, + Data: map[string]interface{}{ + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeCraftGiftResultSuccess: + return UnmarshalCraftGiftResultSuccess(result.Data) + + case TypeCraftGiftResultTooEarly: + return UnmarshalCraftGiftResultTooEarly(result.Data) + + case TypeCraftGiftResultInvalidGift: + return UnmarshalCraftGiftResultInvalidGift(result.Data) + + case TypeCraftGiftResultFail: + return UnmarshalCraftGiftResultFail(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type TransferGiftRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` + // Identifier of the user or the channel chat that will receive the gift + NewOwnerId MessageSender `json:"new_owner_id"` + // The Telegram Star amount required to pay for the transfer + StarCount int64 `json:"star_count"` +} + +// Sends an upgraded gift to another user or channel chat +func (client *Client) TransferGift(req *TransferGiftRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "transferGift", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "received_gift_id": req.ReceivedGiftId, + "new_owner_id": req.NewOwnerId, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DropGiftOriginalDetailsRequest struct { + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` + // The Telegram Star amount required to pay for the operation + StarCount int64 `json:"star_count"` +} + +// Drops original details for an upgraded gift +func (client *Client) DropGiftOriginalDetails(req *DropGiftOriginalDetailsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "dropGiftOriginalDetails", + }, + Data: map[string]interface{}{ + "received_gift_id": req.ReceivedGiftId, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SendResoldGiftRequest struct { + // Name of the upgraded gift to send + GiftName string `json:"gift_name"` + // Identifier of the user or the channel chat that will receive the gift + OwnerId MessageSender `json:"owner_id"` + // The price that the user agreed to pay for the gift + Price GiftResalePrice `json:"price"` +} + +// Sends an upgraded gift that is available for resale to another user or channel chat; gifts already owned by the current user must be transferred using transferGift and can't be passed to the method +func (client *Client) SendResoldGift(req *SendResoldGiftRequest) (GiftResaleResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendResoldGift", + }, + Data: map[string]interface{}{ + "gift_name": req.GiftName, + "owner_id": req.OwnerId, + "price": req.Price, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(result.Data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type SendGiftPurchaseOfferRequest struct { + // Identifier of the user or the channel chat that currently owns the gift and will receive the offer + OwnerId MessageSender `json:"owner_id"` + // Name of the upgraded gift + GiftName string `json:"gift_name"` + // The price that the user agreed to pay for the gift + Price GiftResalePrice `json:"price"` + // Duration of the offer, in seconds; must be one of 21600, 43200, 86400, 129600, 172800, or 259200. Can also be 120 if Telegram test environment is used + Duration int32 `json:"duration"` + // The number of Telegram Stars the user agreed to pay additionally for sending of the offer message to the current gift owner; pass userFullInfo.outgoing_paid_message_star_count for users and 0 otherwise + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Sends an offer to purchase an upgraded gift +func (client *Client) SendGiftPurchaseOffer(req *SendGiftPurchaseOfferRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendGiftPurchaseOffer", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "gift_name": req.GiftName, + "price": req.Price, + "duration": req.Duration, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ProcessGiftPurchaseOfferRequest struct { + // Identifier of the message with the gift purchase offer + MessageId int64 `json:"message_id"` + // Pass true to accept the request; pass false to reject it + Accept bool `json:"accept"` +} + +// Handles a pending gift purchase offer +func (client *Client) ProcessGiftPurchaseOffer(req *ProcessGiftPurchaseOfferRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "processGiftPurchaseOffer", + }, + Data: map[string]interface{}{ + "message_id": req.MessageId, + "accept": req.Accept, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetReceivedGiftsRequest struct { + // Unique identifier of business connection on behalf of which to send the request; for bots only + BusinessConnectionId string `json:"business_connection_id"` + // Identifier of the gift receiver + OwnerId MessageSender `json:"owner_id"` + // Pass collection identifier to get gifts only from the specified collection; pass 0 to get gifts regardless of collections + CollectionId int32 `json:"collection_id"` + // Pass true to exclude gifts that aren't saved to the chat's profile page. Always true for gifts received by other users and channel chats without can_post_messages administrator right + ExcludeUnsaved bool `json:"exclude_unsaved"` + // Pass true to exclude gifts that are saved to the chat's profile page. Always false for gifts received by other users and channel chats without can_post_messages administrator right + ExcludeSaved bool `json:"exclude_saved"` + // Pass true to exclude gifts that can be purchased unlimited number of times + ExcludeUnlimited bool `json:"exclude_unlimited"` + // Pass true to exclude gifts that can be purchased limited number of times and can be upgraded + ExcludeUpgradable bool `json:"exclude_upgradable"` + // Pass true to exclude gifts that can be purchased limited number of times and can't be upgraded + ExcludeNonUpgradable bool `json:"exclude_non_upgradable"` + // Pass true to exclude upgraded gifts + ExcludeUpgraded bool `json:"exclude_upgraded"` + // Pass true to exclude gifts that can't be used in setUpgradedGiftColors + ExcludeWithoutColors bool `json:"exclude_without_colors"` + // Pass true to exclude gifts that are just hosted and are not owned by the owner + ExcludeHosted bool `json:"exclude_hosted"` + // Pass true to sort results by gift price instead of send date + SortByPrice bool `json:"sort_by_price"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns gifts received by the given user or chat +func (client *Client) GetReceivedGifts(req *GetReceivedGiftsRequest) (*ReceivedGifts, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getReceivedGifts", + }, + Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "exclude_unsaved": req.ExcludeUnsaved, + "exclude_saved": req.ExcludeSaved, + "exclude_unlimited": req.ExcludeUnlimited, + "exclude_upgradable": req.ExcludeUpgradable, + "exclude_non_upgradable": req.ExcludeNonUpgradable, + "exclude_upgraded": req.ExcludeUpgraded, + "exclude_without_colors": req.ExcludeWithoutColors, + "exclude_hosted": req.ExcludeHosted, + "sort_by_price": req.SortByPrice, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalReceivedGifts(result.Data) +} + +type GetReceivedGiftRequest struct { + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` +} + +// Returns information about a received gift +func (client *Client) GetReceivedGift(req *GetReceivedGiftRequest) (*ReceivedGift, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getReceivedGift", + }, + Data: map[string]interface{}{ + "received_gift_id": req.ReceivedGiftId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalReceivedGift(result.Data) +} + +type GetGiftsForCraftingRequest struct { + // Identifier of the regular gift that will be used for crafting + RegularGiftId JsonInt64 `json:"regular_gift_id"` + // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of gifts to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns upgraded gifts of the current user who can be used to craft another gifts +func (client *Client) GetGiftsForCrafting(req *GetGiftsForCraftingRequest) (*GiftsForCrafting, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftsForCrafting", + }, + Data: map[string]interface{}{ + "regular_gift_id": req.RegularGiftId, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftsForCrafting(result.Data) +} + +type GetUpgradedGiftRequest struct { + // Unique name of the upgraded gift + Name string `json:"name"` +} + +// Returns information about an upgraded gift by its name +func (client *Client) GetUpgradedGift(req *GetUpgradedGiftRequest) (*UpgradedGift, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGift", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpgradedGift(result.Data) +} + +type GetUpgradedGiftValueInfoRequest struct { + // Unique name of the upgraded gift + Name string `json:"name"` +} + +// Returns information about value of an upgraded gift by its name +func (client *Client) GetUpgradedGiftValueInfo(req *GetUpgradedGiftValueInfoRequest) (*UpgradedGiftValueInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGiftValueInfo", + }, + Data: map[string]interface{}{ + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpgradedGiftValueInfo(result.Data) +} + +type GetUpgradedGiftWithdrawalUrlRequest struct { + // Identifier of the gift + ReceivedGiftId string `json:"received_gift_id"` + // The 2-step verification password of the current user + Password string `json:"password"` +} + +// Returns a URL for upgraded gift withdrawal in the TON blockchain as an NFT; requires owner privileges for gifts owned by a chat +func (client *Client) GetUpgradedGiftWithdrawalUrl(req *GetUpgradedGiftWithdrawalUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGiftWithdrawalUrl", + }, + Data: map[string]interface{}{ + "received_gift_id": req.ReceivedGiftId, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + +// Returns promotional anumation for upgraded gifts +func (client *Client) GetUpgradedGiftsPromotionalAnimation() (*Animation, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getUpgradedGiftsPromotionalAnimation", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAnimation(result.Data) +} + +type SetGiftResalePriceRequest struct { + // Identifier of the unique gift + ReceivedGiftId string `json:"received_gift_id"` + // The new price for the unique gift; pass null to disallow gift resale. The current user will receive getOption("gift_resale_star_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for the gift if the gift price is in Telegram Stars or getOption("gift_resale_ton_earnings_per_mille") Toncoins for each 1000 Toncoins paid for the gift if the gift price is in Toncoins + Price GiftResalePrice `json:"price"` +} + +// Changes resale price of a unique gift owned by the current user +func (client *Client) SetGiftResalePrice(req *SetGiftResalePriceRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGiftResalePrice", + }, + Data: map[string]interface{}{ + "received_gift_id": req.ReceivedGiftId, + "price": req.Price, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SearchGiftsForResaleRequest struct { + // Identifier of the regular gift that was upgraded to a unique gift + GiftId JsonInt64 `json:"gift_id"` + // Order in which the results will be sorted + Order GiftForResaleOrder `json:"order"` + // Pass true to get only gifts suitable for crafting + ForCrafting bool `json:"for_crafting"` + // Attributes used to filter received gifts. If multiple attributes of the same type are specified, then all of them are allowed. If none attributes of specific type are specified, then all values for this attribute type are allowed + Attributes []UpgradedGiftAttributeId `json:"attributes"` + // Offset of the first entry to return as received from the previous request with the same order and attributes; use empty string to get the first chunk of results + Offset string `json:"offset"` + // The maximum number of gifts to return + Limit int32 `json:"limit"` +} + +// Returns upgraded gifts that can be bought from other owners using sendResoldGift +func (client *Client) SearchGiftsForResale(req *SearchGiftsForResaleRequest) (*GiftsForResale, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchGiftsForResale", + }, + Data: map[string]interface{}{ + "gift_id": req.GiftId, + "order": req.Order, + "for_crafting": req.ForCrafting, + "attributes": req.Attributes, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftsForResale(result.Data) +} + +type GetGiftCollectionsRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` +} + +// Returns collections of gifts owned by the given user or chat +func (client *Client) GetGiftCollections(req *GetGiftCollectionsRequest) (*GiftCollections, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getGiftCollections", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollections(result.Data) +} + +type CreateGiftCollectionRequest struct { + // Identifier of the user or the channel chat that received the gifts + OwnerId MessageSender `json:"owner_id"` + // Name of the collection; 1-12 characters + Name string `json:"name"` + // Identifier of the gifts to add to the collection; 0-getOption("gift_collection_size_max") identifiers + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Creates a collection from gifts on the current user's or a channel's profile page; requires can_post_messages administrator right in the channel chat. An owner can have up to getOption("gift_collection_count_max") gift collections. The new collection will be added to the end of the gift collection list of the owner. Returns the created collection +func (client *Client) CreateGiftCollection(req *CreateGiftCollectionRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createGiftCollection", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "name": req.Name, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type ReorderGiftCollectionsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // New order of gift collections + CollectionIds []int32 `json:"collection_ids"` +} + +// Changes order of gift collections. If the collections are owned by a channel chat, then requires can_post_messages administrator right in the channel chat +func (client *Client) ReorderGiftCollections(req *ReorderGiftCollectionsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderGiftCollections", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_ids": req.CollectionIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteGiftCollectionRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` +} + +// Deletes a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat +func (client *Client) DeleteGiftCollection(req *DeleteGiftCollectionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteGiftCollection", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetGiftCollectionNameRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // New name of the collection; 1-12 characters + Name string `json:"name"` +} + +// Changes name of a gift collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) SetGiftCollectionName(req *SetGiftCollectionNameRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setGiftCollectionName", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type AddGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to add to the collection; 1-getOption("gift_collection_size_max") identifiers. If after addition the collection has more than getOption("gift_collection_size_max") gifts, then the last one are removed from the collection + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Adds gifts to the beginning of a previously created collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) AddGiftCollectionGifts(req *AddGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type RemoveGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to remove from the collection + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Removes gifts from a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) RemoveGiftCollectionGifts(req *RemoveGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + +type ReorderGiftCollectionGiftsRequest struct { + // Identifier of the user or the channel chat that owns the collection + OwnerId MessageSender `json:"owner_id"` + // Identifier of the gift collection + CollectionId int32 `json:"collection_id"` + // Identifier of the gifts to move to the beginning of the collection. All other gifts are placed in the current order after the specified gifts + ReceivedGiftIds []string `json:"received_gift_ids"` +} + +// Changes order of gifts in a collection. If the collection is owned by a channel chat, then requires can_post_messages administrator right in the channel chat. Returns the changed collection +func (client *Client) ReorderGiftCollectionGifts(req *ReorderGiftCollectionGiftsRequest) (*GiftCollection, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderGiftCollectionGifts", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "collection_id": req.CollectionId, + "received_gift_ids": req.ReceivedGiftIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalGiftCollection(result.Data) +} + type CreateInvoiceLinkRequest struct { + // Unique identifier of business connection on behalf of which to send the request + BusinessConnectionId string `json:"business_connection_id"` // Information about the invoice of the type inputMessageInvoice Invoice InputMessageContent `json:"invoice"` } @@ -15070,6 +23247,7 @@ func (client *Client) CreateInvoiceLink(req *CreateInvoiceLinkRequest) (*HttpUrl Type: "createInvoiceLink", }, Data: map[string]interface{}{ + "business_connection_id": req.BusinessConnectionId, "invoice": req.Invoice, }, }) @@ -15084,7 +23262,36 @@ func (client *Client) CreateInvoiceLink(req *CreateInvoiceLinkRequest) (*HttpUrl return UnmarshalHttpUrl(result.Data) } -// Returns a user that can be contacted to get support +type RefundStarPaymentRequest struct { + // Identifier of the user who did the payment + UserId int64 `json:"user_id"` + // Telegram payment identifier + TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` +} + +// Refunds a previously done payment in Telegram Stars; for bots only +func (client *Client) RefundStarPayment(req *RefundStarPaymentRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "refundStarPayment", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "telegram_payment_charge_id": req.TelegramPaymentChargeId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns a user who can be contacted to get support func (client *Client) GetSupportUser() (*User, error) { result, err := client.Send(Request{ meta: meta{ @@ -15103,36 +23310,10 @@ func (client *Client) GetSupportUser() (*User, error) { return UnmarshalUser(result.Data) } -type GetBackgroundsRequest struct { - // Pass true to order returned backgrounds for a dark theme - ForDarkTheme bool `json:"for_dark_theme"` -} - -// Returns backgrounds installed by the user -func (client *Client) GetBackgrounds(req *GetBackgroundsRequest) (*Backgrounds, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getBackgrounds", - }, - Data: map[string]interface{}{ - "for_dark_theme": req.ForDarkTheme, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalBackgrounds(result.Data) -} - type GetBackgroundUrlRequest struct { // Background name Name string `json:"name"` - // Background type + // Background type; backgroundTypeChatTheme isn't supported Type BackgroundType `json:"type"` } @@ -15184,20 +23365,20 @@ func (client *Client) SearchBackground(req *SearchBackgroundRequest) (*Backgroun return UnmarshalBackground(result.Data) } -type SetBackgroundRequest struct { - // The input background to use; pass null to create a new filled background or to remove the current background +type SetDefaultBackgroundRequest struct { + // The input background to use; pass null to create a new filled background Background InputBackground `json:"background"` - // Background type; pass null to use the default type of the remote background or to remove the current background + // Background type; pass null to use the default type of the remote background; backgroundTypeChatTheme isn't supported Type BackgroundType `json:"type"` - // Pass true if the background is changed for a dark theme + // Pass true if the background is set for a dark theme ForDarkTheme bool `json:"for_dark_theme"` } -// Changes the background selected by the user; adds background to the list of installed backgrounds -func (client *Client) SetBackground(req *SetBackgroundRequest) (*Background, error) { +// Sets default background for chats; adds the background to the list of installed backgrounds +func (client *Client) SetDefaultBackground(req *SetDefaultBackgroundRequest) (*Background, error) { result, err := client.Send(Request{ meta: meta{ - Type: "setBackground", + Type: "setDefaultBackground", }, Data: map[string]interface{}{ "background": req.Background, @@ -15216,16 +23397,68 @@ func (client *Client) SetBackground(req *SetBackgroundRequest) (*Background, err return UnmarshalBackground(result.Data) } -type RemoveBackgroundRequest struct { +type DeleteDefaultBackgroundRequest struct { + // Pass true if the background is deleted for a dark theme + ForDarkTheme bool `json:"for_dark_theme"` +} + +// Deletes default background for chats +func (client *Client) DeleteDefaultBackground(req *DeleteDefaultBackgroundRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteDefaultBackground", + }, + Data: map[string]interface{}{ + "for_dark_theme": req.ForDarkTheme, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetInstalledBackgroundsRequest struct { + // Pass true to order returned backgrounds for a dark theme + ForDarkTheme bool `json:"for_dark_theme"` +} + +// Returns backgrounds installed by the user +func (client *Client) GetInstalledBackgrounds(req *GetInstalledBackgroundsRequest) (*Backgrounds, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getInstalledBackgrounds", + }, + Data: map[string]interface{}{ + "for_dark_theme": req.ForDarkTheme, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBackgrounds(result.Data) +} + +type RemoveInstalledBackgroundRequest struct { // The background identifier BackgroundId JsonInt64 `json:"background_id"` } // Removes background from the list of installed backgrounds -func (client *Client) RemoveBackground(req *RemoveBackgroundRequest) (*Ok, error) { +func (client *Client) RemoveInstalledBackground(req *RemoveInstalledBackgroundRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "removeBackground", + Type: "removeInstalledBackground", }, Data: map[string]interface{}{ "background_id": req.BackgroundId, @@ -15243,10 +23476,10 @@ func (client *Client) RemoveBackground(req *RemoveBackgroundRequest) (*Ok, error } // Resets list of installed backgrounds to its default value -func (client *Client) ResetBackgrounds() (*Ok, error) { +func (client *Client) ResetInstalledBackgrounds() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "resetBackgrounds", + Type: "resetInstalledBackgrounds", }, Data: map[string]interface{}{}, }) @@ -15266,7 +23499,7 @@ type GetLocalizationTargetInfoRequest struct { OnlyLocal bool `json:"only_local"` } -// Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization +// Returns information about the current localization target. This is an offline method if only_local is true. Can be called before authorization func (client *Client) GetLocalizationTargetInfo(req *GetLocalizationTargetInfoRequest) (*LocalizationTargetInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -15671,6 +23904,224 @@ func (client *Client) GetUserPrivacySettingRules(req *GetUserPrivacySettingRules return UnmarshalUserPrivacySettingRules(result.Data) } +type SetReadDatePrivacySettingsRequest struct { + // New settings + Settings *ReadDatePrivacySettings `json:"settings"` +} + +// Changes privacy settings for message read date +func (client *Client) SetReadDatePrivacySettings(req *SetReadDatePrivacySettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setReadDatePrivacySettings", + }, + Data: map[string]interface{}{ + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns privacy settings for message read date +func (client *Client) GetReadDatePrivacySettings() (*ReadDatePrivacySettings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getReadDatePrivacySettings", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalReadDatePrivacySettings(result.Data) +} + +type SetNewChatPrivacySettingsRequest struct { + // New settings + Settings *NewChatPrivacySettings `json:"settings"` +} + +// Changes privacy settings for new chat creation; can be used only if getOption("can_set_new_chat_privacy_settings") +func (client *Client) SetNewChatPrivacySettings(req *SetNewChatPrivacySettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setNewChatPrivacySettings", + }, + Data: map[string]interface{}{ + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns privacy settings for new chat creation +func (client *Client) GetNewChatPrivacySettings() (*NewChatPrivacySettings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getNewChatPrivacySettings", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalNewChatPrivacySettings(result.Data) +} + +type GetPaidMessageRevenueRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` +} + +// Returns the total number of Telegram Stars received by the current user for paid messages from the given user +func (client *Client) GetPaidMessageRevenue(req *GetPaidMessageRevenueRequest) (*StarCount, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPaidMessageRevenue", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarCount(result.Data) +} + +type AllowUnpaidMessagesFromUserRequest struct { + // Identifier of the user + UserId int64 `json:"user_id"` + // Pass true to refund the user previously paid messages + RefundPayments bool `json:"refund_payments"` +} + +// Allows the specified user to send unpaid private messages to the current user by adding a rule to userPrivacySettingAllowUnpaidMessages +func (client *Client) AllowUnpaidMessagesFromUser(req *AllowUnpaidMessagesFromUserRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "allowUnpaidMessagesFromUser", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "refund_payments": req.RefundPayments, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatPaidMessageStarCountRequest struct { + // Identifier of the supergroup chat + ChatId int64 `json:"chat_id"` + // The new number of Telegram Stars that must be paid for each message that is sent to the supergroup chat unless the sender is an administrator of the chat; 0-getOption("paid_message_star_count_max"). The supergroup will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +// Changes the Telegram Star amount that must be paid to send a message to a supergroup chat; requires can_restrict_members administrator right and supergroupFullInfo.can_enable_paid_messages +func (client *Client) SetChatPaidMessageStarCount(req *SetChatPaidMessageStarCountRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatPaidMessageStarCount", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "paid_message_star_count": req.PaidMessageStarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CanSendMessageToUserRequest struct { + // Identifier of the other user + UserId int64 `json:"user_id"` + // Pass true to get only locally available information without sending network requests + OnlyLocal bool `json:"only_local"` +} + +// Checks whether the current user can message another user or try to create a chat with them +func (client *Client) CanSendMessageToUser(req *CanSendMessageToUserRequest) (CanSendMessageToUserResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "canSendMessageToUser", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "only_local": req.OnlyLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeCanSendMessageToUserResultOk: + return UnmarshalCanSendMessageToUserResultOk(result.Data) + + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(result.Data) + + case TypeCanSendMessageToUserResultUserIsDeleted: + return UnmarshalCanSendMessageToUserResultUserIsDeleted(result.Data) + + case TypeCanSendMessageToUserResultUserRestrictsNewChats: + return UnmarshalCanSendMessageToUserResultUserRestrictsNewChats(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type GetOptionRequest struct { // The name of the option Name string `json:"name"` @@ -15794,7 +24245,7 @@ func (client *Client) GetAccountTtl() (*AccountTtl, error) { type DeleteAccountRequest struct { // The reason why the account was deleted; optional Reason string `json:"reason"` - // The 2-step verification password of the current user. If not specified, account deletion can be canceled within one week + // The 2-step verification password of the current user. If the current user isn't authorized, then an empty string can be passed and account deletion can be canceled within one week Password string `json:"password"` } @@ -15894,24 +24345,24 @@ func (client *Client) RemoveChatActionBar(req *RemoveChatActionBarRequest) (*Ok, type ReportChatRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Identifiers of reported messages; may be empty to report the whole chat + // Option identifier chosen by the user; leave empty for the initial request + OptionId []byte `json:"option_id"` + // Identifiers of reported messages. Use messageProperties.can_report_chat to check whether the message can be reported MessageIds []int64 `json:"message_ids"` - // The reason for reporting the chat - Reason ReportReason `json:"reason"` - // Additional report details; 0-1024 characters + // Additional report details if asked by the server; 0-1024 characters; leave empty for the initial request Text string `json:"text"` } // Reports a chat to the Telegram moderators. A chat can be reported only from the chat action bar, or if chat.can_be_reported -func (client *Client) ReportChat(req *ReportChatRequest) (*Ok, error) { +func (client *Client) ReportChat(req *ReportChatRequest) (ReportChatResult, error) { result, err := client.Send(Request{ meta: meta{ Type: "reportChat", }, Data: map[string]interface{}{ "chat_id": req.ChatId, + "option_id": req.OptionId, "message_ids": req.MessageIds, - "reason": req.Reason, "text": req.Text, }, }) @@ -15923,7 +24374,22 @@ func (client *Client) ReportChat(req *ReportChatRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } - return UnmarshalOk(result.Data) + switch result.Type { + case TypeReportChatResultOk: + return UnmarshalReportChatResultOk(result.Data) + + case TypeReportChatResultOptionRequired: + return UnmarshalReportChatResultOptionRequired(result.Data) + + case TypeReportChatResultTextRequired: + return UnmarshalReportChatResultTextRequired(result.Data) + + case TypeReportChatResultMessagesRequired: + return UnmarshalReportChatResultMessagesRequired(result.Data) + + default: + return nil, errors.New("invalid type") + } } type ReportChatPhotoRequest struct { @@ -15970,7 +24436,7 @@ type ReportMessageReactionsRequest struct { SenderId MessageSender `json:"sender_id"` } -// Reports reactions set on a message to the Telegram moderators. Reactions on a message can be reported only if message.can_report_reactions +// Reports reactions set on a message to the Telegram moderators. Reactions on a message can be reported only if messageProperties.can_report_reactions func (client *Client) ReportMessageReactions(req *ReportMessageReactionsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -15993,6 +24459,267 @@ func (client *Client) ReportMessageReactions(req *ReportMessageReactionsRequest) return UnmarshalOk(result.Data) } +type GetChatRevenueStatisticsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed revenue statistics about a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true +func (client *Client) GetChatRevenueStatistics(req *GetChatRevenueStatisticsRequest) (*ChatRevenueStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatRevenueStatistics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatRevenueStatistics(result.Data) +} + +type GetChatRevenueWithdrawalUrlRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // The 2-step verification password of the current user + Password string `json:"password"` +} + +// Returns a URL for chat revenue withdrawal; requires owner privileges in the channel chat or the bot. Currently, this method can be used only if getOption("can_withdraw_chat_revenue") for channels with supergroupFullInfo.can_get_revenue_statistics == true or bots with userFullInfo.bot_info.can_get_revenue_statistics == true +func (client *Client) GetChatRevenueWithdrawalUrl(req *GetChatRevenueWithdrawalUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatRevenueWithdrawalUrl", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + +type GetChatRevenueTransactionsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Offset of the first transaction 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 transactions to be returned; up to 100 + Limit int32 `json:"limit"` +} + +// Returns the list of revenue transactions for a chat. Currently, this method can be used only for channels if supergroupFullInfo.can_get_revenue_statistics == true or bots if userFullInfo.bot_info.can_get_revenue_statistics == true +func (client *Client) GetChatRevenueTransactions(req *GetChatRevenueTransactionsRequest) (*ChatRevenueTransactions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatRevenueTransactions", + }, + 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 UnmarshalChatRevenueTransactions(result.Data) +} + +type GetTonTransactionsRequest struct { + // Direction of the transactions to receive; pass null to get all transactions + Direction TransactionDirection `json:"direction"` + // Offset of the first transaction 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 transactions to return + Limit int32 `json:"limit"` +} + +// Returns the list of Toncoin transactions of the current user +func (client *Client) GetTonTransactions(req *GetTonTransactionsRequest) (*TonTransactions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonTransactions", + }, + Data: map[string]interface{}{ + "direction": req.Direction, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTonTransactions(result.Data) +} + +type GetStarRevenueStatisticsRequest struct { + // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true + OwnerId MessageSender `json:"owner_id"` + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed Telegram Star revenue statistics +func (client *Client) GetStarRevenueStatistics(req *GetStarRevenueStatisticsRequest) (*StarRevenueStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarRevenueStatistics", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarRevenueStatistics(result.Data) +} + +type GetStarWithdrawalUrlRequest struct { + // Identifier of the owner of the Telegram Stars; can be identifier of the current user, an owned bot, or an owned supergroup or channel chat + OwnerId MessageSender `json:"owner_id"` + // The number of Telegram Stars to withdraw; must be between getOption("star_withdrawal_count_min") and getOption("star_withdrawal_count_max") + StarCount int64 `json:"star_count"` + // The 2-step verification password of the current user + Password string `json:"password"` +} + +// Returns a URL for Telegram Star withdrawal +func (client *Client) GetStarWithdrawalUrl(req *GetStarWithdrawalUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarWithdrawalUrl", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "star_count": req.StarCount, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + +type GetStarAdAccountUrlRequest struct { + // Identifier of the owner of the Telegram Stars; can be identifier of an owned bot, or identifier of an owned channel chat + OwnerId MessageSender `json:"owner_id"` +} + +// Returns a URL for a Telegram Ad platform account that can be used to set up advertisements for the chat paid in the owned Telegram Stars +func (client *Client) GetStarAdAccountUrl(req *GetStarAdAccountUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarAdAccountUrl", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + +type GetTonRevenueStatisticsRequest struct { + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed Toncoin revenue statistics of the current user +func (client *Client) GetTonRevenueStatistics(req *GetTonRevenueStatisticsRequest) (*TonRevenueStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonRevenueStatistics", + }, + Data: map[string]interface{}{ + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalTonRevenueStatistics(result.Data) +} + +type GetTonWithdrawalUrlRequest struct { + // The 2-step verification password of the current user + Password string `json:"password"` +} + +// Returns a URL for Toncoin withdrawal from the current user's account. The user must have at least 10 toncoins to withdraw and can withdraw up to 100000 Toncoins in one transaction +func (client *Client) GetTonWithdrawalUrl(req *GetTonWithdrawalUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getTonWithdrawalUrl", + }, + Data: map[string]interface{}{ + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type GetChatStatisticsRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -16040,7 +24767,7 @@ type GetMessageStatisticsRequest struct { IsDark bool `json:"is_dark"` } -// Returns detailed statistics about a message. Can be used only if message.can_get_statistics == true +// Returns detailed statistics about a message. Can be used only if messageProperties.can_get_statistics == true func (client *Client) GetMessageStatistics(req *GetMessageStatisticsRequest) (*MessageStatistics, error) { result, err := client.Send(Request{ meta: meta{ @@ -16070,12 +24797,12 @@ type GetMessagePublicForwardsRequest struct { MessageId int64 `json:"message_id"` // Offset of the first entry to return as received from the previous request; use empty string to get the first chunk of results Offset string `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit + // The maximum number of messages and stories to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit Limit int32 `json:"limit"` } -// Returns forwarded copies of a channel message to different public channels. Can be used only if message.can_get_statistics == true. For optimal performance, the number of returned messages is chosen by TDLib -func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequest) (*FoundMessages, error) { +// Returns forwarded copies of a channel message to different public channels and public reposts as a story. Can be used only if messageProperties.can_get_statistics == true. For optimal performance, the number of returned messages and stories is chosen by TDLib +func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequest) (*PublicForwards, error) { result, err := client.Send(Request{ meta: meta{ Type: "getMessagePublicForwards", @@ -16095,7 +24822,39 @@ func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequ return nil, buildResponseError(result.Data) } - return UnmarshalFoundMessages(result.Data) + return UnmarshalPublicForwards(result.Data) +} + +type GetStoryStatisticsRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Story identifier + StoryId int32 `json:"story_id"` + // Pass true if a dark theme is used by the application + IsDark bool `json:"is_dark"` +} + +// Returns detailed statistics about a story. Can be used only if story.can_get_statistics == true +func (client *Client) GetStoryStatistics(req *GetStoryStatisticsRequest) (*StoryStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStoryStatistics", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_id": req.StoryId, + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryStatistics(result.Data) } type GetStatisticalGraphRequest struct { @@ -16695,7 +25454,7 @@ type SetPassportElementErrorsRequest struct { Errors []*InputPassportElementError `json:"errors"` } -// Informs the user that some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed +// Informs the user who some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed func (client *Client) SetPassportElementErrors(req *SetPassportElementErrorsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -16743,80 +25502,6 @@ func (client *Client) GetPreferredCountryLanguage(req *GetPreferredCountryLangua return UnmarshalText(result.Data) } -type SendPhoneNumberVerificationCodeRequest struct { - // The phone number of the user, in international format - PhoneNumber string `json:"phone_number"` - // Settings for the authentication of the user's phone number; pass null to use default settings - Settings *PhoneNumberAuthenticationSettings `json:"settings"` -} - -// Sends a code to verify a phone number to be added to a user's Telegram Passport -func (client *Client) SendPhoneNumberVerificationCode(req *SendPhoneNumberVerificationCodeRequest) (*AuthenticationCodeInfo, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "sendPhoneNumberVerificationCode", - }, - Data: map[string]interface{}{ - "phone_number": req.PhoneNumber, - "settings": req.Settings, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalAuthenticationCodeInfo(result.Data) -} - -// Resends the code to verify a phone number to be added to a user's Telegram Passport -func (client *Client) ResendPhoneNumberVerificationCode() (*AuthenticationCodeInfo, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "resendPhoneNumberVerificationCode", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalAuthenticationCodeInfo(result.Data) -} - -type CheckPhoneNumberVerificationCodeRequest struct { - // Verification code to check - Code string `json:"code"` -} - -// Checks the phone number verification code for Telegram Passport -func (client *Client) CheckPhoneNumberVerificationCode(req *CheckPhoneNumberVerificationCodeRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "checkPhoneNumberVerificationCode", - }, - Data: map[string]interface{}{ - "code": req.Code, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type SendEmailAddressVerificationCodeRequest struct { // Email address EmailAddress string `json:"email_address"` @@ -16981,83 +25666,6 @@ func (client *Client) SendPassportAuthorizationForm(req *SendPassportAuthorizati return UnmarshalOk(result.Data) } -type SendPhoneNumberConfirmationCodeRequest struct { - // Hash value from the link - Hash string `json:"hash"` - // Phone number value from the link - PhoneNumber string `json:"phone_number"` - // Settings for the authentication of the user's phone number; pass null to use default settings - Settings *PhoneNumberAuthenticationSettings `json:"settings"` -} - -// Sends phone number confirmation code to handle links of the type internalLinkTypePhoneNumberConfirmation -func (client *Client) SendPhoneNumberConfirmationCode(req *SendPhoneNumberConfirmationCodeRequest) (*AuthenticationCodeInfo, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "sendPhoneNumberConfirmationCode", - }, - Data: map[string]interface{}{ - "hash": req.Hash, - "phone_number": req.PhoneNumber, - "settings": req.Settings, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalAuthenticationCodeInfo(result.Data) -} - -// Resends phone number confirmation code -func (client *Client) ResendPhoneNumberConfirmationCode() (*AuthenticationCodeInfo, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "resendPhoneNumberConfirmationCode", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalAuthenticationCodeInfo(result.Data) -} - -type CheckPhoneNumberConfirmationCodeRequest struct { - // Confirmation code to check - Code string `json:"code"` -} - -// Checks phone number confirmation code -func (client *Client) CheckPhoneNumberConfirmationCode(req *CheckPhoneNumberConfirmationCodeRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "checkPhoneNumberConfirmationCode", - }, - Data: map[string]interface{}{ - "code": req.Code, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type SetBotUpdatesStatusRequest struct { // The number of pending updates PendingUpdateCount int32 `json:"pending_update_count"` @@ -17188,15 +25796,13 @@ type CreateNewStickerSetRequest struct { UserId int64 `json:"user_id"` // Sticker set title; 1-64 characters Title string `json:"title"` - // Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive) for bots; 1-64 characters + // Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_"* (** is case insensitive) for bots; 0-64 characters. If empty, then the name returned by getSuggestedStickerSetName will be used automatically Name string `json:"name"` - // Format of the stickers in the set - StickerFormat StickerFormat `json:"sticker_format"` // Type of the stickers in the set StickerType StickerType `json:"sticker_type"` // Pass true if stickers in the sticker set must be repainted; for custom emoji sticker sets only NeedsRepainting bool `json:"needs_repainting"` - // List of stickers to be added to the set; must be non-empty. All stickers must have the same format. For TGS stickers, uploadStickerFile must be used before the sticker is shown + // List of stickers to be added to the set; 1-200 stickers for custom emoji sticker sets, and 1-120 stickers otherwise. For TGS stickers, uploadStickerFile must be used before the sticker is shown Stickers []*InputSticker `json:"stickers"` // Source of the sticker set; may be empty if unknown Source string `json:"source"` @@ -17212,7 +25818,6 @@ func (client *Client) CreateNewStickerSet(req *CreateNewStickerSetRequest) (*Sti "user_id": req.UserId, "title": req.Title, "name": req.Name, - "sticker_format": req.StickerFormat, "sticker_type": req.StickerType, "needs_repainting": req.NeedsRepainting, "stickers": req.Stickers, @@ -17231,15 +25836,15 @@ func (client *Client) CreateNewStickerSet(req *CreateNewStickerSetRequest) (*Sti } type AddStickerToSetRequest struct { - // Sticker set owner + // Sticker set owner; ignored for regular users UserId int64 `json:"user_id"` - // Sticker set name + // Sticker set name. The sticker set must be owned by the current user, and contain less than 200 stickers for custom emoji sticker sets and less than 120 otherwise Name string `json:"name"` // Sticker to add to the set Sticker *InputSticker `json:"sticker"` } -// Adds a new sticker to a set; for bots only +// Adds a new sticker to a set func (client *Client) AddStickerToSet(req *AddStickerToSetRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -17262,16 +25867,53 @@ func (client *Client) AddStickerToSet(req *AddStickerToSetRequest) (*Ok, error) return UnmarshalOk(result.Data) } -type SetStickerSetThumbnailRequest struct { - // Sticker set owner +type ReplaceStickerInSetRequest struct { + // Sticker set owner; ignored for regular users UserId int64 `json:"user_id"` - // Sticker set name + // Sticker set name. The sticker set must be owned by the current user Name string `json:"name"` - // Thumbnail to set in PNG, TGS, or WEBM format; pass null to remove the sticker set thumbnail. Thumbnail format must match the format of stickers in the set - Thumbnail InputFile `json:"thumbnail"` + // Sticker to remove from the set + OldSticker InputFile `json:"old_sticker"` + // Sticker to add to the set + NewSticker *InputSticker `json:"new_sticker"` } -// Sets a sticker set thumbnail; for bots only +// Replaces existing sticker in a set. The function is equivalent to removeStickerFromSet, then addStickerToSet, then setStickerPositionInSet +func (client *Client) ReplaceStickerInSet(req *ReplaceStickerInSetRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "replaceStickerInSet", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "name": req.Name, + "old_sticker": req.OldSticker, + "new_sticker": req.NewSticker, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStickerSetThumbnailRequest struct { + // Sticker set owner; ignored for regular users + UserId int64 `json:"user_id"` + // Sticker set name. The sticker set must be owned by the current user + Name string `json:"name"` + // Thumbnail to set; pass null to remove the sticker set thumbnail + Thumbnail InputFile `json:"thumbnail"` + // Format of the thumbnail; pass null if thumbnail is removed + Format StickerFormat `json:"format"` +} + +// Sets a sticker set thumbnail func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -17281,6 +25923,7 @@ func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) "user_id": req.UserId, "name": req.Name, "thumbnail": req.Thumbnail, + "format": req.Format, }, }) if err != nil { @@ -17295,13 +25938,13 @@ func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) } type SetCustomEmojiStickerSetThumbnailRequest struct { - // Sticker set name + // Sticker set name. The sticker set must be owned by the current user Name string `json:"name"` // Identifier of the custom emoji from the sticker set, which will be set as sticker set thumbnail; pass 0 to remove the sticker set thumbnail CustomEmojiId JsonInt64 `json:"custom_emoji_id"` } -// Sets a custom emoji sticker set thumbnail; for bots only +// Sets a custom emoji sticker set thumbnail func (client *Client) SetCustomEmojiStickerSetThumbnail(req *SetCustomEmojiStickerSetThumbnailRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -17324,13 +25967,13 @@ func (client *Client) SetCustomEmojiStickerSetThumbnail(req *SetCustomEmojiStick } type SetStickerSetTitleRequest struct { - // Sticker set name + // Sticker set name. The sticker set must be owned by the current user Name string `json:"name"` // New sticker set title Title string `json:"title"` } -// Sets a sticker set title; for bots only +// Sets a sticker set title func (client *Client) SetStickerSetTitle(req *SetStickerSetTitleRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -17353,11 +25996,11 @@ func (client *Client) SetStickerSetTitle(req *SetStickerSetTitleRequest) (*Ok, e } type DeleteStickerSetRequest struct { - // Sticker set name + // Sticker set name. The sticker set must be owned by the current user Name string `json:"name"` } -// Deleted a sticker set; for bots only +// Completely deletes a sticker set func (client *Client) DeleteStickerSet(req *DeleteStickerSetRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -17385,7 +26028,7 @@ type SetStickerPositionInSetRequest struct { Position int32 `json:"position"` } -// Changes the position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot +// Changes the position of a sticker in the set to which it belongs. The sticker set must be owned by the current user func (client *Client) SetStickerPositionInSet(req *SetStickerPositionInSetRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -17408,11 +26051,11 @@ func (client *Client) SetStickerPositionInSet(req *SetStickerPositionInSetReques } type RemoveStickerFromSetRequest struct { - // Sticker + // Sticker to remove from the set Sticker InputFile `json:"sticker"` } -// Removes a sticker from the set to which it belongs; for bots only. The sticker set must have been created by the bot +// Removes a sticker from the set to which it belongs. The sticker set must be owned by the current user func (client *Client) RemoveStickerFromSet(req *RemoveStickerFromSetRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -17440,7 +26083,7 @@ type SetStickerEmojisRequest struct { Emojis string `json:"emojis"` } -// Changes the list of emoji corresponding to a sticker; for bots only. The sticker must belong to a regular or custom emoji sticker set created by the bot +// Changes the list of emojis corresponding to a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user func (client *Client) SetStickerEmojis(req *SetStickerEmojisRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -17469,7 +26112,7 @@ type SetStickerKeywordsRequest struct { Keywords []string `json:"keywords"` } -// Changes the list of keywords of a sticker; for bots only. The sticker must belong to a regular or custom emoji sticker set created by the bot +// Changes the list of keywords of a sticker. The sticker must belong to a regular or custom emoji sticker set that is owned by the current user func (client *Client) SetStickerKeywords(req *SetStickerKeywordsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -17498,7 +26141,7 @@ type SetStickerMaskPositionRequest struct { MaskPosition *MaskPosition `json:"mask_position"` } -// Changes the mask position of a mask sticker; for bots only. The sticker must belong to a mask sticker set created by the bot +// Changes the mask position of a mask sticker. The sticker must belong to a mask sticker set that is owned by the current user func (client *Client) SetStickerMaskPosition(req *SetStickerMaskPositionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -17520,6 +26163,35 @@ func (client *Client) SetStickerMaskPosition(req *SetStickerMaskPositionRequest) return UnmarshalOk(result.Data) } +type GetOwnedStickerSetsRequest struct { + // Identifier of the sticker set from which to return owned sticker sets; use 0 to get results from the beginning + OffsetStickerSetId JsonInt64 `json:"offset_sticker_set_id"` + // The maximum number of sticker sets to be returned; must be positive and can't be greater than 100. For optimal performance, the number of returned objects is chosen by TDLib and can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns sticker sets owned by the current user +func (client *Client) GetOwnedStickerSets(req *GetOwnedStickerSetsRequest) (*StickerSets, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getOwnedStickerSets", + }, + Data: map[string]interface{}{ + "offset_sticker_set_id": req.OffsetStickerSetId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickerSets(result.Data) +} + type GetMapThumbnailFileRequest struct { // Location of the map center Location *Location `json:"location"` @@ -17632,6 +26304,32 @@ func (client *Client) GetPremiumStickerExamples() (*Stickers, error) { return UnmarshalStickers(result.Data) } +type GetPremiumInfoStickerRequest struct { + // Number of months the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` +} + +// Returns the sticker to be used as representation of the Telegram Premium subscription +func (client *Client) GetPremiumInfoSticker(req *GetPremiumInfoStickerRequest) (*Sticker, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPremiumInfoSticker", + }, + Data: map[string]interface{}{ + "month_count": req.MonthCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSticker(result.Data) +} + type ViewPremiumFeatureRequest struct { // The viewed premium feature Feature PremiumFeature `json:"feature"` @@ -17696,16 +26394,35 @@ func (client *Client) GetPremiumState() (*PremiumState, error) { return UnmarshalPremiumState(result.Data) } -type GetPremiumGiftCodePaymentOptionsRequest struct { - // Identifier of the channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user; 0 if none +// Returns available options for gifting Telegram Premium to a user +func (client *Client) GetPremiumGiftPaymentOptions() (*PremiumGiftPaymentOptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPremiumGiftPaymentOptions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPremiumGiftPaymentOptions(result.Data) +} + +type GetPremiumGiveawayPaymentOptionsRequest struct { + // Identifier of the supergroup or channel chat, which will be automatically boosted by receivers of the gift codes and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` } -// Returns available options for Telegram Premium gift code or giveaway creation -func (client *Client) GetPremiumGiftCodePaymentOptions(req *GetPremiumGiftCodePaymentOptionsRequest) (*PremiumGiftCodePaymentOptions, error) { +// Returns available options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members +func (client *Client) GetPremiumGiveawayPaymentOptions(req *GetPremiumGiveawayPaymentOptionsRequest) (*PremiumGiveawayPaymentOptions, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getPremiumGiftCodePaymentOptions", + Type: "getPremiumGiveawayPaymentOptions", }, Data: map[string]interface{}{ "boosted_chat_id": req.BoostedChatId, @@ -17719,7 +26436,7 @@ func (client *Client) GetPremiumGiftCodePaymentOptions(req *GetPremiumGiftCodePa return nil, buildResponseError(result.Data) } - return UnmarshalPremiumGiftCodePaymentOptions(result.Data) + return UnmarshalPremiumGiveawayPaymentOptions(result.Data) } type CheckPremiumGiftCodeRequest struct { @@ -17727,7 +26444,7 @@ type CheckPremiumGiftCodeRequest struct { Code string `json:"code"` } -// Return information about a Telegram Premium gift code +// Returns information about a Telegram Premium gift code func (client *Client) CheckPremiumGiftCode(req *CheckPremiumGiftCodeRequest) (*PremiumGiftCodeInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -17774,22 +26491,28 @@ func (client *Client) ApplyPremiumGiftCode(req *ApplyPremiumGiftCodeRequest) (*O return UnmarshalOk(result.Data) } -type LaunchPrepaidPremiumGiveawayRequest struct { - // Unique identifier of the prepaid giveaway - GiveawayId JsonInt64 `json:"giveaway_id"` - // Giveaway parameters - Parameters *PremiumGiveawayParameters `json:"parameters"` +type GiftPremiumWithStarsRequest struct { + // Identifier of the user which will receive Telegram Premium + UserId int64 `json:"user_id"` + // The number of Telegram Stars to pay for subscription + StarCount int64 `json:"star_count"` + // Number of months the Telegram Premium subscription will be active for the user + MonthCount int32 `json:"month_count"` + // Text to show to the user receiving Telegram Premium; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` } -// Launches a prepaid Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels -func (client *Client) LaunchPrepaidPremiumGiveaway(req *LaunchPrepaidPremiumGiveawayRequest) (*Ok, error) { +// Allows to buy a Telegram Premium subscription for another user with payment in Telegram Stars; for bots only +func (client *Client) GiftPremiumWithStars(req *GiftPremiumWithStarsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "launchPrepaidPremiumGiveaway", + Type: "giftPremiumWithStars", }, Data: map[string]interface{}{ - "giveaway_id": req.GiveawayId, - "parameters": req.Parameters, + "user_id": req.UserId, + "star_count": req.StarCount, + "month_count": req.MonthCount, + "text": req.Text, }, }) if err != nil { @@ -17803,18 +26526,53 @@ func (client *Client) LaunchPrepaidPremiumGiveaway(req *LaunchPrepaidPremiumGive return UnmarshalOk(result.Data) } -type GetPremiumGiveawayInfoRequest struct { +type LaunchPrepaidGiveawayRequest struct { + // Unique identifier of the prepaid giveaway + GiveawayId JsonInt64 `json:"giveaway_id"` + // Giveaway parameters + Parameters *GiveawayParameters `json:"parameters"` + // The number of users to receive giveaway prize + WinnerCount int32 `json:"winner_count"` + // The number of Telegram Stars to be distributed through the giveaway; pass 0 for Telegram Premium giveaways + StarCount int64 `json:"star_count"` +} + +// Launches a prepaid giveaway +func (client *Client) LaunchPrepaidGiveaway(req *LaunchPrepaidGiveawayRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "launchPrepaidGiveaway", + }, + Data: map[string]interface{}{ + "giveaway_id": req.GiveawayId, + "parameters": req.Parameters, + "winner_count": req.WinnerCount, + "star_count": req.StarCount, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetGiveawayInfoRequest struct { // Identifier of the channel chat which started the giveaway ChatId int64 `json:"chat_id"` - // Identifier of the giveaway message in the chat + // Identifier of the giveaway or a giveaway winners message in the chat MessageId int64 `json:"message_id"` } -// Returns information about a Telegram Premium giveaway -func (client *Client) GetPremiumGiveawayInfo(req *GetPremiumGiveawayInfoRequest) (PremiumGiveawayInfo, error) { +// Returns information about a giveaway +func (client *Client) GetGiveawayInfo(req *GetGiveawayInfoRequest) (GiveawayInfo, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getPremiumGiveawayInfo", + Type: "getGiveawayInfo", }, Data: map[string]interface{}{ "chat_id": req.ChatId, @@ -17830,27 +26588,158 @@ func (client *Client) GetPremiumGiveawayInfo(req *GetPremiumGiveawayInfoRequest) } switch result.Type { - case TypePremiumGiveawayInfoOngoing: - return UnmarshalPremiumGiveawayInfoOngoing(result.Data) + case TypeGiveawayInfoOngoing: + return UnmarshalGiveawayInfoOngoing(result.Data) - case TypePremiumGiveawayInfoCompleted: - return UnmarshalPremiumGiveawayInfoCompleted(result.Data) + case TypeGiveawayInfoCompleted: + return UnmarshalGiveawayInfoCompleted(result.Data) default: return nil, errors.New("invalid type") } } -type CanPurchasePremiumRequest struct { +// Returns available options for Telegram Stars purchase +func (client *Client) GetStarPaymentOptions() (*StarPaymentOptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarPaymentOptions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarPaymentOptions(result.Data) +} + +type GetStarGiftPaymentOptionsRequest struct { + // Identifier of the user who will receive Telegram Stars; pass 0 to get options for an unspecified user + UserId int64 `json:"user_id"` +} + +// Returns available options for Telegram Stars gifting +func (client *Client) GetStarGiftPaymentOptions(req *GetStarGiftPaymentOptionsRequest) (*StarPaymentOptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarGiftPaymentOptions", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarPaymentOptions(result.Data) +} + +// Returns available options for Telegram Star giveaway creation +func (client *Client) GetStarGiveawayPaymentOptions() (*StarGiveawayPaymentOptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarGiveawayPaymentOptions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarGiveawayPaymentOptions(result.Data) +} + +type GetStarTransactionsRequest struct { + // Identifier of the owner of the Telegram Stars; can be the identifier of the current user, identifier of an owned bot, or identifier of a supergroup or a channel chat with supergroupFullInfo.can_get_star_revenue_statistics == true + OwnerId MessageSender `json:"owner_id"` + // If non-empty, only transactions related to the Star Subscription will be returned + SubscriptionId string `json:"subscription_id"` + // Direction of the transactions to receive; pass null to get all transactions + Direction TransactionDirection `json:"direction"` + // Offset of the first transaction 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 transactions to return + Limit int32 `json:"limit"` +} + +// Returns the list of Telegram Star transactions for the specified owner +func (client *Client) GetStarTransactions(req *GetStarTransactionsRequest) (*StarTransactions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarTransactions", + }, + Data: map[string]interface{}{ + "owner_id": req.OwnerId, + "subscription_id": req.SubscriptionId, + "direction": req.Direction, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarTransactions(result.Data) +} + +type GetStarSubscriptionsRequest struct { + // Pass true to receive only expiring subscriptions for which there are no enough Telegram Stars to extend + OnlyExpiring bool `json:"only_expiring"` + // Offset of the first subscription to return as received from the previous request; use empty string to get the first chunk of results + Offset string `json:"offset"` +} + +// Returns the list of Telegram Star subscriptions for the current user +func (client *Client) GetStarSubscriptions(req *GetStarSubscriptionsRequest) (*StarSubscriptions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStarSubscriptions", + }, + Data: map[string]interface{}{ + "only_expiring": req.OnlyExpiring, + "offset": req.Offset, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStarSubscriptions(result.Data) +} + +type CanPurchaseFromStoreRequest struct { // Transaction purpose Purpose StorePaymentPurpose `json:"purpose"` } -// Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase -func (client *Client) CanPurchasePremium(req *CanPurchasePremiumRequest) (*Ok, error) { +// Checks whether an in-store purchase is possible. Must be called before any in-store purchase. For official applications only +func (client *Client) CanPurchaseFromStore(req *CanPurchaseFromStoreRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "canPurchasePremium", + Type: "canPurchaseFromStore", }, Data: map[string]interface{}{ "purpose": req.Purpose, @@ -17867,21 +26756,21 @@ func (client *Client) CanPurchasePremium(req *CanPurchasePremiumRequest) (*Ok, e return UnmarshalOk(result.Data) } -type AssignAppStoreTransactionRequest struct { - // App Store receipt - Receipt []byte `json:"receipt"` +type AssignStoreTransactionRequest struct { + // Information about the transaction + Transaction StoreTransaction `json:"transaction"` // Transaction purpose Purpose StorePaymentPurpose `json:"purpose"` } -// Informs server about a purchase through App Store. For official applications only -func (client *Client) AssignAppStoreTransaction(req *AssignAppStoreTransactionRequest) (*Ok, error) { +// Informs server about an in-store purchase. For official applications only +func (client *Client) AssignStoreTransaction(req *AssignStoreTransactionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "assignAppStoreTransaction", + Type: "assignStoreTransaction", }, Data: map[string]interface{}{ - "receipt": req.Receipt, + "transaction": req.Transaction, "purpose": req.Purpose, }, }) @@ -17896,28 +26785,22 @@ func (client *Client) AssignAppStoreTransaction(req *AssignAppStoreTransactionRe return UnmarshalOk(result.Data) } -type AssignGooglePlayTransactionRequest struct { - // Application package name - PackageName string `json:"package_name"` - // Identifier of the purchased store product - StoreProductId string `json:"store_product_id"` - // Google Play purchase token - PurchaseToken string `json:"purchase_token"` - // Transaction purpose - Purpose StorePaymentPurpose `json:"purpose"` +type EditStarSubscriptionRequest struct { + // Identifier of the subscription to change + SubscriptionId string `json:"subscription_id"` + // New value of is_canceled + IsCanceled bool `json:"is_canceled"` } -// Informs server about a purchase through Google Play. For official applications only -func (client *Client) AssignGooglePlayTransaction(req *AssignGooglePlayTransactionRequest) (*Ok, error) { +// Cancels or re-enables Telegram Star subscription +func (client *Client) EditStarSubscription(req *EditStarSubscriptionRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "assignGooglePlayTransaction", + Type: "editStarSubscription", }, Data: map[string]interface{}{ - "package_name": req.PackageName, - "store_product_id": req.StoreProductId, - "purchase_token": req.PurchaseToken, - "purpose": req.Purpose, + "subscription_id": req.SubscriptionId, + "is_canceled": req.IsCanceled, }, }) if err != nil { @@ -17931,6 +26814,302 @@ func (client *Client) AssignGooglePlayTransaction(req *AssignGooglePlayTransacti return UnmarshalOk(result.Data) } +type EditUserStarSubscriptionRequest struct { + // User identifier + UserId int64 `json:"user_id"` + // Telegram payment identifier of the subscription + TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` + // Pass true to cancel the subscription; pass false to allow the user to enable it + IsCanceled bool `json:"is_canceled"` +} + +// Cancels or re-enables Telegram Star subscription for a user; for bots only +func (client *Client) EditUserStarSubscription(req *EditUserStarSubscriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editUserStarSubscription", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "telegram_payment_charge_id": req.TelegramPaymentChargeId, + "is_canceled": req.IsCanceled, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReuseStarSubscriptionRequest struct { + // Identifier of the subscription + SubscriptionId string `json:"subscription_id"` +} + +// Reuses an active Telegram Star subscription to a channel chat and joins the chat again +func (client *Client) ReuseStarSubscription(req *ReuseStarSubscriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reuseStarSubscription", + }, + Data: map[string]interface{}{ + "subscription_id": req.SubscriptionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + 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 { + // The affiliate for which affiliate programs are searched for + Affiliate AffiliateType `json:"affiliate"` + // 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 connected to the given affiliate +func (client *Client) SearchAffiliatePrograms(req *SearchAffiliateProgramsRequest) (*FoundAffiliatePrograms, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchAffiliatePrograms", + }, + Data: map[string]interface{}{ + "affiliate": req.Affiliate, + "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 ConnectAffiliateProgramRequest struct { + // The affiliate to which the affiliate program will be connected + Affiliate AffiliateType `json:"affiliate"` + // Identifier of the bot, which affiliate program is connected + BotUserId int64 `json:"bot_user_id"` +} + +// Connects an affiliate program to the given affiliate. Returns information about the connected affiliate program +func (client *Client) ConnectAffiliateProgram(req *ConnectAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "connectAffiliateProgram", + }, + Data: map[string]interface{}{ + "affiliate": req.Affiliate, + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalConnectedAffiliateProgram(result.Data) +} + +type DisconnectAffiliateProgramRequest struct { + // The affiliate to which the affiliate program is connected + Affiliate AffiliateType `json:"affiliate"` + // The referral link of the affiliate program + Url string `json:"url"` +} + +// Disconnects an affiliate program from the given affiliate and immediately deactivates its referral link. Returns updated information about the disconnected affiliate program +func (client *Client) DisconnectAffiliateProgram(req *DisconnectAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "disconnectAffiliateProgram", + }, + Data: map[string]interface{}{ + "affiliate": req.Affiliate, + "url": req.Url, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalConnectedAffiliateProgram(result.Data) +} + +type GetConnectedAffiliateProgramRequest struct { + // The affiliate to which the affiliate program will be connected + Affiliate AffiliateType `json:"affiliate"` + // Identifier of the bot that created the program + BotUserId int64 `json:"bot_user_id"` +} + +// Returns an affiliate program that was connected to the given affiliate by identifier of the bot that created the program +func (client *Client) GetConnectedAffiliateProgram(req *GetConnectedAffiliateProgramRequest) (*ConnectedAffiliateProgram, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getConnectedAffiliateProgram", + }, + Data: map[string]interface{}{ + "affiliate": req.Affiliate, + "bot_user_id": req.BotUserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalConnectedAffiliateProgram(result.Data) +} + +type GetConnectedAffiliateProgramsRequest struct { + // The affiliate to which the affiliate program were connected + Affiliate AffiliateType `json:"affiliate"` + // 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 affiliate +func (client *Client) GetConnectedAffiliatePrograms(req *GetConnectedAffiliateProgramsRequest) (*ConnectedAffiliatePrograms, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getConnectedAffiliatePrograms", + }, + Data: map[string]interface{}{ + "affiliate": req.Affiliate, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalConnectedAffiliatePrograms(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"` +} + +// Returns information about features, available to Business users +func (client *Client) GetBusinessFeatures(req *GetBusinessFeaturesRequest) (*BusinessFeatures, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBusinessFeatures", + }, + Data: map[string]interface{}{ + "source": req.Source, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalBusinessFeatures(result.Data) +} + type AcceptTermsOfServiceRequest struct { // Terms of service identifier TermsOfServiceId string `json:"terms_of_service_id"` @@ -18179,6 +27358,32 @@ func GetPhoneNumberInfoSync(req *GetPhoneNumberInfoSyncRequest) (*PhoneNumberInf func (client *Client) GetPhoneNumberInfoSync(req *GetPhoneNumberInfoSyncRequest) (*PhoneNumberInfo, error) { return GetPhoneNumberInfoSync(req)} +type GetCollectibleItemInfoRequest struct { + // Type of the collectible item. The item must be used by a user and must be visible to the current user + Type CollectibleItemType `json:"type"` +} + +// Returns information about a given collectible item that was purchased at https://fragment.com +func (client *Client) GetCollectibleItemInfo(req *GetCollectibleItemInfoRequest) (*CollectibleItemInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCollectibleItemInfo", + }, + Data: map[string]interface{}{ + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCollectibleItemInfo(result.Data) +} + type GetDeepLinkInfoRequest struct { // The link Link string `json:"link"` @@ -18245,32 +27450,6 @@ func (client *Client) GetApplicationConfig() (JsonValue, error) { } } -type AddApplicationChangelogRequest struct { - // The previous application version - PreviousApplicationVersion string `json:"previous_application_version"` -} - -// Adds server-provided application changelog as messages to the chat 777000 (Telegram) or as a stories; for official applications only. Returns a 404 error if nothing changed -func (client *Client) AddApplicationChangelog(req *AddApplicationChangelogRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "addApplicationChangelog", - }, - Data: map[string]interface{}{ - "previous_application_version": req.PreviousApplicationVersion, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type SaveApplicationLogEventRequest struct { // Event type Type string `json:"type"` @@ -18323,27 +27502,21 @@ func (client *Client) GetApplicationDownloadLink() (*HttpUrl, error) { } type AddProxyRequest struct { - // Proxy server domain or IP address - Server string `json:"server"` - // Proxy server port - Port int32 `json:"port"` + // The proxy to add + Proxy *Proxy `json:"proxy"` // Pass true to immediately enable the proxy Enable bool `json:"enable"` - // Proxy type - Type ProxyType `json:"type"` } // Adds a proxy server for network requests. Can be called before authorization -func (client *Client) AddProxy(req *AddProxyRequest) (*Proxy, error) { +func (client *Client) AddProxy(req *AddProxyRequest) (*AddedProxy, error) { result, err := client.Send(Request{ meta: meta{ Type: "addProxy", }, Data: map[string]interface{}{ - "server": req.Server, - "port": req.Port, + "proxy": req.Proxy, "enable": req.Enable, - "type": req.Type, }, }) if err != nil { @@ -18354,34 +27527,28 @@ func (client *Client) AddProxy(req *AddProxyRequest) (*Proxy, error) { return nil, buildResponseError(result.Data) } - return UnmarshalProxy(result.Data) + return UnmarshalAddedProxy(result.Data) } type EditProxyRequest struct { // Proxy identifier ProxyId int32 `json:"proxy_id"` - // Proxy server domain or IP address - Server string `json:"server"` - // Proxy server port - Port int32 `json:"port"` + // The new information about the proxy + Proxy *Proxy `json:"proxy"` // Pass true to immediately enable the proxy Enable bool `json:"enable"` - // Proxy type - Type ProxyType `json:"type"` } // Edits an existing proxy server for network requests. Can be called before authorization -func (client *Client) EditProxy(req *EditProxyRequest) (*Proxy, error) { +func (client *Client) EditProxy(req *EditProxyRequest) (*AddedProxy, error) { result, err := client.Send(Request{ meta: meta{ Type: "editProxy", }, Data: map[string]interface{}{ "proxy_id": req.ProxyId, - "server": req.Server, - "port": req.Port, + "proxy": req.Proxy, "enable": req.Enable, - "type": req.Type, }, }) if err != nil { @@ -18392,7 +27559,7 @@ func (client *Client) EditProxy(req *EditProxyRequest) (*Proxy, error) { return nil, buildResponseError(result.Data) } - return UnmarshalProxy(result.Data) + return UnmarshalAddedProxy(result.Data) } type EnableProxyRequest struct { @@ -18466,8 +27633,8 @@ func (client *Client) RemoveProxy(req *RemoveProxyRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -// Returns list of proxies that are currently set up. Can be called before authorization -func (client *Client) GetProxies() (*Proxies, error) { +// Returns the list of proxies that are currently set up. Can be called before authorization +func (client *Client) GetProxies() (*AddedProxies, error) { result, err := client.Send(Request{ meta: meta{ Type: "getProxies", @@ -18482,38 +27649,12 @@ func (client *Client) GetProxies() (*Proxies, error) { return nil, buildResponseError(result.Data) } - return UnmarshalProxies(result.Data) -} - -type GetProxyLinkRequest struct { - // Proxy identifier - ProxyId int32 `json:"proxy_id"` -} - -// Returns an HTTPS link, which can be used to add a proxy. Available only for SOCKS5 and MTProto proxies. Can be called before authorization -func (client *Client) GetProxyLink(req *GetProxyLinkRequest) (*HttpUrl, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getProxyLink", - }, - Data: map[string]interface{}{ - "proxy_id": req.ProxyId, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalHttpUrl(result.Data) + return UnmarshalAddedProxies(result.Data) } type PingProxyRequest struct { - // Proxy identifier. Use 0 to ping a Telegram server without a proxy - ProxyId int32 `json:"proxy_id"` + // The proxy to test; pass null to ping a Telegram server without a proxy + Proxy *Proxy `json:"proxy"` } // Computes time needed to receive a response from a Telegram server through a proxy. Can be called before authorization @@ -18523,7 +27664,7 @@ func (client *Client) PingProxy(req *PingProxyRequest) (*Seconds, error) { Type: "pingProxy", }, Data: map[string]interface{}{ - "proxy_id": req.ProxyId, + "proxy": req.Proxy, }, }) if err != nil { @@ -18659,7 +27800,7 @@ func GetLogVerbosityLevel() (*LogVerbosityLevel, error) { func (client *Client) GetLogVerbosityLevel() (*LogVerbosityLevel, error) { return GetLogVerbosityLevel()} -// Returns list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously +// Returns the list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously func GetLogTags() (*LogTags, error) { result, err := Execute(Request{ meta: meta{ @@ -18679,7 +27820,7 @@ func GetLogTags() (*LogTags, error) { } // deprecated -// Returns list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously +// Returns the list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. Can be called synchronously func (client *Client) GetLogTags() (*LogTags, error) { return GetLogTags()} @@ -19077,12 +28218,8 @@ func (client *Client) TestNetwork() (*Ok, error) { } type TestProxyRequest struct { - // Proxy server domain or IP address - Server string `json:"server"` - // Proxy server port - Port int32 `json:"port"` - // Proxy type - Type ProxyType `json:"type"` + // The proxy to test + Proxy *Proxy `json:"proxy"` // Identifier of a datacenter with which to test connection DcId int32 `json:"dc_id"` // The maximum overall timeout for the request @@ -19096,9 +28233,7 @@ func (client *Client) TestProxy(req *TestProxyRequest) (*Ok, error) { Type: "testProxy", }, Data: map[string]interface{}{ - "server": req.Server, - "port": req.Port, - "type": req.Type, + "proxy": req.Proxy, "dc_id": req.DcId, "timeout": req.Timeout, }, @@ -19186,9 +28321,18 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateMessageUnreadReactions: return UnmarshalUpdateMessageUnreadReactions(result.Data) + case TypeUpdateMessageFactCheck: + return UnmarshalUpdateMessageFactCheck(result.Data) + + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(result.Data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(result.Data) + case TypeUpdateVideoPublished: + return UnmarshalUpdateVideoPublished(result.Data) + case TypeUpdateNewChat: return UnmarshalUpdateNewChat(result.Data) @@ -19198,11 +28342,8 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(result.Data) - case TypeUpdateChatAccentColor: - return UnmarshalUpdateChatAccentColor(result.Data) - - case TypeUpdateChatBackgroundCustomEmoji: - return UnmarshalUpdateChatBackgroundCustomEmoji(result.Data) + case TypeUpdateChatAccentColors: + return UnmarshalUpdateChatAccentColors(result.Data) case TypeUpdateChatPermissions: return UnmarshalUpdateChatPermissions(result.Data) @@ -19213,6 +28354,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatPosition: return UnmarshalUpdateChatPosition(result.Data) + case TypeUpdateChatAddedToList: + return UnmarshalUpdateChatAddedToList(result.Data) + + case TypeUpdateChatRemovedFromList: + return UnmarshalUpdateChatRemovedFromList(result.Data) + case TypeUpdateChatReadInbox: return UnmarshalUpdateChatReadInbox(result.Data) @@ -19222,12 +28369,18 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatActionBar: return UnmarshalUpdateChatActionBar(result.Data) + case TypeUpdateChatBusinessBotManageBar: + return UnmarshalUpdateChatBusinessBotManageBar(result.Data) + case TypeUpdateChatAvailableReactions: return UnmarshalUpdateChatAvailableReactions(result.Data) case TypeUpdateChatDraftMessage: return UnmarshalUpdateChatDraftMessage(result.Data) + case TypeUpdateChatEmojiStatus: + return UnmarshalUpdateChatEmojiStatus(result.Data) + case TypeUpdateChatMessageSender: return UnmarshalUpdateChatMessageSender(result.Data) @@ -19270,6 +28423,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatIsMarkedAsUnread: return UnmarshalUpdateChatIsMarkedAsUnread(result.Data) + case TypeUpdateChatViewAsTopics: + return UnmarshalUpdateChatViewAsTopics(result.Data) + case TypeUpdateChatBlockList: return UnmarshalUpdateChatBlockList(result.Data) @@ -19282,12 +28438,42 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(result.Data) + case TypeUpdateSavedMessagesTopic: + return UnmarshalUpdateSavedMessagesTopic(result.Data) + + case TypeUpdateSavedMessagesTopicCount: + return UnmarshalUpdateSavedMessagesTopicCount(result.Data) + + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(result.Data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(result.Data) + + case TypeUpdateQuickReplyShortcut: + return UnmarshalUpdateQuickReplyShortcut(result.Data) + + case TypeUpdateQuickReplyShortcutDeleted: + return UnmarshalUpdateQuickReplyShortcutDeleted(result.Data) + + case TypeUpdateQuickReplyShortcuts: + return UnmarshalUpdateQuickReplyShortcuts(result.Data) + + case TypeUpdateQuickReplyShortcutMessages: + return UnmarshalUpdateQuickReplyShortcutMessages(result.Data) + case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(result.Data) + case TypeUpdateForumTopic: + return UnmarshalUpdateForumTopic(result.Data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(result.Data) + case TypeUpdateReactionNotificationSettings: + return UnmarshalUpdateReactionNotificationSettings(result.Data) + case TypeUpdateNotification: return UnmarshalUpdateNotification(result.Data) @@ -19306,6 +28492,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatAction: return UnmarshalUpdateChatAction(result.Data) + case TypeUpdatePendingTextMessage: + return UnmarshalUpdatePendingTextMessage(result.Data) + case TypeUpdateUserStatus: return UnmarshalUpdateUserStatus(result.Data) @@ -19354,6 +28543,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateFileRemovedFromDownloads: return UnmarshalUpdateFileRemovedFromDownloads(result.Data) + case TypeUpdateApplicationVerificationRequired: + return UnmarshalUpdateApplicationVerificationRequired(result.Data) + + case TypeUpdateApplicationRecaptchaVerificationRequired: + return UnmarshalUpdateApplicationRecaptchaVerificationRequired(result.Data) + case TypeUpdateCall: return UnmarshalUpdateCall(result.Data) @@ -19363,9 +28558,36 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateGroupCallParticipant: return UnmarshalUpdateGroupCallParticipant(result.Data) + case TypeUpdateGroupCallParticipants: + return UnmarshalUpdateGroupCallParticipants(result.Data) + + case TypeUpdateGroupCallVerificationState: + return UnmarshalUpdateGroupCallVerificationState(result.Data) + + case TypeUpdateNewGroupCallMessage: + return UnmarshalUpdateNewGroupCallMessage(result.Data) + + case TypeUpdateNewGroupCallPaidReaction: + return UnmarshalUpdateNewGroupCallPaidReaction(result.Data) + + case TypeUpdateGroupCallMessageSendFailed: + return UnmarshalUpdateGroupCallMessageSendFailed(result.Data) + + case TypeUpdateGroupCallMessagesDeleted: + return UnmarshalUpdateGroupCallMessagesDeleted(result.Data) + + case TypeUpdateLiveStoryTopDonors: + return UnmarshalUpdateLiveStoryTopDonors(result.Data) + case TypeUpdateNewCallSignalingData: return UnmarshalUpdateNewCallSignalingData(result.Data) + case TypeUpdateGiftAuctionState: + return UnmarshalUpdateGiftAuctionState(result.Data) + + case TypeUpdateActiveGiftAuctions: + return UnmarshalUpdateActiveGiftAuctions(result.Data) + case TypeUpdateUserPrivacySettingRules: return UnmarshalUpdateUserPrivacySettingRules(result.Data) @@ -19381,11 +28603,11 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateStoryDeleted: return UnmarshalUpdateStoryDeleted(result.Data) - case TypeUpdateStorySendSucceeded: - return UnmarshalUpdateStorySendSucceeded(result.Data) + case TypeUpdateStoryPostSucceeded: + return UnmarshalUpdateStoryPostSucceeded(result.Data) - case TypeUpdateStorySendFailed: - return UnmarshalUpdateStorySendFailed(result.Data) + case TypeUpdateStoryPostFailed: + return UnmarshalUpdateStoryPostFailed(result.Data) case TypeUpdateChatActiveStories: return UnmarshalUpdateChatActiveStories(result.Data) @@ -19396,6 +28618,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateStoryStealthMode: return UnmarshalUpdateStoryStealthMode(result.Data) + case TypeUpdateTrustedMiniAppBots: + return UnmarshalUpdateTrustedMiniAppBots(result.Data) + case TypeUpdateOption: return UnmarshalUpdateOption(result.Data) @@ -19420,27 +28645,33 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSavedNotificationSounds: return UnmarshalUpdateSavedNotificationSounds(result.Data) - case TypeUpdateSelectedBackground: - return UnmarshalUpdateSelectedBackground(result.Data) + case TypeUpdateDefaultBackground: + return UnmarshalUpdateDefaultBackground(result.Data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(result.Data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(result.Data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(result.Data) + case TypeUpdateProfileAccentColors: + return UnmarshalUpdateProfileAccentColors(result.Data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(result.Data) case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(result.Data) + case TypeUpdateFreezeState: + return UnmarshalUpdateFreezeState(result.Data) + + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(result.Data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(result.Data) - case TypeUpdateUsersNearby: - return UnmarshalUpdateUsersNearby(result.Data) - case TypeUpdateUnconfirmedSession: return UnmarshalUpdateUnconfirmedSession(result.Data) @@ -19453,12 +28684,48 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateActiveEmojiReactions: return UnmarshalUpdateActiveEmojiReactions(result.Data) + case TypeUpdateAvailableMessageEffects: + return UnmarshalUpdateAvailableMessageEffects(result.Data) + case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(result.Data) + case TypeUpdateDefaultPaidReactionType: + return UnmarshalUpdateDefaultPaidReactionType(result.Data) + + case TypeUpdateSavedMessagesTags: + return UnmarshalUpdateSavedMessagesTags(result.Data) + + case TypeUpdateActiveLiveLocationMessages: + return UnmarshalUpdateActiveLiveLocationMessages(result.Data) + + case TypeUpdateOwnedStarCount: + return UnmarshalUpdateOwnedStarCount(result.Data) + + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(result.Data) + + case TypeUpdateChatRevenueAmount: + return UnmarshalUpdateChatRevenueAmount(result.Data) + + case TypeUpdateStarRevenueStatus: + return UnmarshalUpdateStarRevenueStatus(result.Data) + + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(result.Data) + + case TypeUpdateSpeechRecognitionTrial: + return UnmarshalUpdateSpeechRecognitionTrial(result.Data) + + case TypeUpdateGroupCallMessageLevels: + return UnmarshalUpdateGroupCallMessageLevels(result.Data) + case TypeUpdateDiceEmojis: return UnmarshalUpdateDiceEmojis(result.Data) + case TypeUpdateStakeDiceState: + return UnmarshalUpdateStakeDiceState(result.Data) + case TypeUpdateAnimatedEmojiMessageClicked: return UnmarshalUpdateAnimatedEmojiMessageClicked(result.Data) @@ -19468,12 +28735,27 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(result.Data) - case TypeUpdateAddChatMembersPrivacyForbidden: - return UnmarshalUpdateAddChatMembersPrivacyForbidden(result.Data) + case TypeUpdateSpeedLimitNotification: + return UnmarshalUpdateSpeedLimitNotification(result.Data) + + case TypeUpdateContactCloseBirthdays: + return UnmarshalUpdateContactCloseBirthdays(result.Data) case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(result.Data) + case TypeUpdateBusinessConnection: + return UnmarshalUpdateBusinessConnection(result.Data) + + case TypeUpdateNewBusinessMessage: + return UnmarshalUpdateNewBusinessMessage(result.Data) + + case TypeUpdateBusinessMessageEdited: + return UnmarshalUpdateBusinessMessageEdited(result.Data) + + case TypeUpdateBusinessMessagesDeleted: + return UnmarshalUpdateBusinessMessagesDeleted(result.Data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(result.Data) @@ -19486,6 +28768,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateNewInlineCallbackQuery: return UnmarshalUpdateNewInlineCallbackQuery(result.Data) + case TypeUpdateNewBusinessCallbackQuery: + return UnmarshalUpdateNewBusinessCallbackQuery(result.Data) + case TypeUpdateNewShippingQuery: return UnmarshalUpdateNewShippingQuery(result.Data) @@ -19513,6 +28798,15 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatBoost: return UnmarshalUpdateChatBoost(result.Data) + case TypeUpdateMessageReaction: + return UnmarshalUpdateMessageReaction(result.Data) + + case TypeUpdateMessageReactions: + return UnmarshalUpdateMessageReactions(result.Data) + + case TypeUpdatePaidMediaPurchased: + return UnmarshalUpdatePaidMediaPurchased(result.Data) + default: return nil, errors.New("invalid type") } diff --git a/client/tdlib.go b/client/tdlib.go index 9e4fd63..dc943a0 100644 --- a/client/tdlib.go +++ b/client/tdlib.go @@ -1,10 +1,12 @@ package client //#cgo linux CFLAGS: -I/usr/local/include +//#cgo freebsd CFLAGS: -I/usr/local/include //#cgo darwin CFLAGS: -I/usr/local/include //#cgo windows CFLAGS: -IE:/src/tdlib -IE:/src/tdlib/build -//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm -//#cgo darwin LDFLAGS: -L/usr/local/lib -L/usr/local/opt/openssl/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltde2e -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo freebsd LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltde2e -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm +//#cgo darwin LDFLAGS: -L/usr/local/lib -L/usr/local/opt/openssl/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltde2e -ltdsqlite -ltdmtproto -ltdnet -ltdutils -lstdc++ -lssl -lcrypto -ldl -lz -lm //#cgo windows LDFLAGS: -LE:/src/tdlib/build/Release -ltdjson //#include //#include diff --git a/client/type.go b/client/type.go index 1c74660..feb0c58 100755 --- a/client/type.go +++ b/client/type.go @@ -11,6 +11,7 @@ const ( ClassEmailAddressAuthentication = "EmailAddressAuthentication" ClassEmailAddressResetState = "EmailAddressResetState" ClassAuthorizationState = "AuthorizationState" + ClassFirebaseDeviceVerificationParameters = "FirebaseDeviceVerificationParameters" ClassInputFile = "InputFile" ClassThumbnailFormat = "ThumbnailFormat" ClassMaskPoint = "MaskPoint" @@ -18,43 +19,82 @@ const ( ClassStickerType = "StickerType" ClassStickerFullType = "StickerFullType" ClassPollType = "PollType" + ClassProfileTab = "ProfileTab" ClassUserType = "UserType" + ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" ClassChatPhotoStickerType = "ChatPhotoStickerType" ClassInputChatPhoto = "InputChatPhoto" - ClassPremiumGiveawayParticipantStatus = "PremiumGiveawayParticipantStatus" - ClassPremiumGiveawayInfo = "PremiumGiveawayInfo" + ClassGiftResalePrice = "GiftResalePrice" + ClassGiftPurchaseOfferState = "GiftPurchaseOfferState" + ClassSuggestedPostPrice = "SuggestedPostPrice" + ClassSuggestedPostState = "SuggestedPostState" + ClassSuggestedPostRefundReason = "SuggestedPostRefundReason" + ClassStarSubscriptionType = "StarSubscriptionType" + ClassAffiliateType = "AffiliateType" + ClassAffiliateProgramSortOrder = "AffiliateProgramSortOrder" + ClassCanSendGiftResult = "CanSendGiftResult" + ClassUpgradedGiftOrigin = "UpgradedGiftOrigin" + ClassUpgradedGiftAttributeRarity = "UpgradedGiftAttributeRarity" + ClassCraftGiftResult = "CraftGiftResult" + ClassUpgradedGiftAttributeId = "UpgradedGiftAttributeId" + ClassGiftForResaleOrder = "GiftForResaleOrder" + ClassGiftResaleResult = "GiftResaleResult" + ClassSentGift = "SentGift" + ClassAuctionState = "AuctionState" + ClassTransactionDirection = "TransactionDirection" + ClassStarTransactionType = "StarTransactionType" + ClassTonTransactionType = "TonTransactionType" + ClassActiveStoryState = "ActiveStoryState" + ClassGiveawayParticipantStatus = "GiveawayParticipantStatus" + ClassGiveawayInfo = "GiveawayInfo" + ClassGiveawayPrize = "GiveawayPrize" + ClassEmojiStatusType = "EmojiStatusType" ClassChatMemberStatus = "ChatMemberStatus" ClassChatMembersFilter = "ChatMembersFilter" ClassSupergroupMembersFilter = "SupergroupMembersFilter" ClassInviteLinkChatType = "InviteLinkChatType" ClassSecretChatState = "SecretChatState" ClassMessageSender = "MessageSender" + ClassMessageReadDate = "MessageReadDate" ClassMessageOrigin = "MessageOrigin" ClassReactionType = "ReactionType" + ClassPaidReactionType = "PaidReactionType" + ClassMessageTopic = "MessageTopic" + ClassMessageEffectType = "MessageEffectType" ClassMessageSendingState = "MessageSendingState" ClassMessageReplyTo = "MessageReplyTo" ClassInputMessageReplyTo = "InputMessageReplyTo" ClassMessageSource = "MessageSource" - ClassMessageSponsorType = "MessageSponsorType" + ClassReportSponsoredResult = "ReportSponsoredResult" ClassNotificationSettingsScope = "NotificationSettingsScope" + ClassReactionNotificationSource = "ReactionNotificationSource" ClassChatType = "ChatType" ClassChatList = "ChatList" ClassChatSource = "ChatSource" ClassChatAvailableReactions = "ChatAvailableReactions" ClassPublicChatType = "PublicChatType" ClassChatActionBar = "ChatActionBar" + ClassButtonStyle = "ButtonStyle" ClassKeyboardButtonType = "KeyboardButtonType" ClassInlineKeyboardButtonType = "InlineKeyboardButtonType" ClassReplyMarkup = "ReplyMarkup" ClassLoginUrlInfo = "LoginUrlInfo" + ClassWebAppOpenMode = "WebAppOpenMode" + ClassSavedMessagesTopicType = "SavedMessagesTopicType" + ClassBuiltInTheme = "BuiltInTheme" ClassRichText = "RichText" ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" ClassPageBlock = "PageBlock" + ClassLinkPreviewAlbumMedia = "LinkPreviewAlbumMedia" + ClassLinkPreviewType = "LinkPreviewType" + ClassCollectibleItemType = "CollectibleItemType" ClassInputCredentials = "InputCredentials" ClassPaymentProvider = "PaymentProvider" + ClassPaymentFormType = "PaymentFormType" + ClassPaymentReceiptType = "PaymentReceiptType" ClassInputInvoice = "InputInvoice" - ClassMessageExtendedMedia = "MessageExtendedMedia" + ClassPaidMedia = "PaidMedia" ClassPassportElementType = "PassportElementType" ClassPassportElement = "PassportElement" ClassInputPassportElement = "InputPassportElement" @@ -62,28 +102,41 @@ const ( ClassInputPassportElementErrorSource = "InputPassportElementErrorSource" ClassMessageContent = "MessageContent" ClassTextEntityType = "TextEntityType" + ClassInputPaidMediaType = "InputPaidMediaType" ClassMessageSchedulingState = "MessageSchedulingState" ClassMessageSelfDestructType = "MessageSelfDestructType" ClassInputMessageContent = "InputMessageContent" ClassSearchMessagesFilter = "SearchMessagesFilter" + ClassSearchMessagesChatTypeFilter = "SearchMessagesChatTypeFilter" ClassChatAction = "ChatAction" ClassUserStatus = "UserStatus" + ClassEmojiCategorySource = "EmojiCategorySource" ClassEmojiCategoryType = "EmojiCategoryType" ClassStoryAreaType = "StoryAreaType" ClassInputStoryAreaType = "InputStoryAreaType" + ClassStoryContentType = "StoryContentType" ClassStoryContent = "StoryContent" ClassInputStoryContent = "InputStoryContent" ClassStoryList = "StoryList" + ClassStoryOrigin = "StoryOrigin" + ClassStoryInteractionType = "StoryInteractionType" + ClassPublicForward = "PublicForward" ClassChatBoostSource = "ChatBoostSource" + ClassResendCodeReason = "ResendCodeReason" ClassCallDiscardReason = "CallDiscardReason" ClassCallServerType = "CallServerType" ClassCallState = "CallState" ClassGroupCallVideoQuality = "GroupCallVideoQuality" + ClassInviteGroupCallParticipantResult = "InviteGroupCallParticipantResult" + ClassGroupCallDataChannel = "GroupCallDataChannel" + ClassInputGroupCall = "InputGroupCall" ClassCallProblem = "CallProblem" ClassFirebaseAuthenticationSettings = "FirebaseAuthenticationSettings" + ClassReactionUnavailabilityReason = "ReactionUnavailabilityReason" ClassDiceStickers = "DiceStickers" ClassSpeechRecognitionResult = "SpeechRecognitionResult" ClassBotWriteAccessAllowReason = "BotWriteAccessAllowReason" + ClassTargetChat = "TargetChat" ClassInputInlineQueryResult = "InputInlineQueryResult" ClassInlineQueryResult = "InlineQueryResult" ClassInlineQueryResultsButtonType = "InlineQueryResultsButtonType" @@ -92,15 +145,20 @@ const ( ClassLanguagePackStringValue = "LanguagePackStringValue" ClassPremiumLimitType = "PremiumLimitType" ClassPremiumFeature = "PremiumFeature" + ClassBusinessFeature = "BusinessFeature" ClassPremiumStoryFeature = "PremiumStoryFeature" ClassPremiumSource = "PremiumSource" ClassStorePaymentPurpose = "StorePaymentPurpose" + ClassStoreTransaction = "StoreTransaction" ClassTelegramPaymentPurpose = "TelegramPaymentPurpose" ClassDeviceToken = "DeviceToken" ClassBackgroundFill = "BackgroundFill" ClassBackgroundType = "BackgroundType" ClassInputBackground = "InputBackground" - ClassCanSendStoryResult = "CanSendStoryResult" + ClassChatTheme = "ChatTheme" + ClassInputChatTheme = "InputChatTheme" + ClassCanPostStoryResult = "CanPostStoryResult" + ClassStartLiveStoryResult = "StartLiveStoryResult" ClassCanTransferOwnershipResult = "CanTransferOwnershipResult" ClassCheckChatUsernameResult = "CheckChatUsernameResult" ClassCheckStickerSetNameResult = "CheckStickerSetNameResult" @@ -114,9 +172,12 @@ const ( ClassStoryPrivacySettings = "StoryPrivacySettings" ClassUserPrivacySettingRule = "UserPrivacySettingRule" ClassUserPrivacySetting = "UserPrivacySetting" + ClassCanSendMessageToUserResult = "CanSendMessageToUserResult" ClassSessionType = "SessionType" ClassReportReason = "ReportReason" - ClassTargetChat = "TargetChat" + ClassReportChatResult = "ReportChatResult" + ClassReportStoryResult = "ReportStoryResult" + ClassSettingsSection = "SettingsSection" ClassInternalLinkType = "InternalLinkType" ClassBlockList = "BlockList" ClassFileType = "FileType" @@ -130,9 +191,13 @@ const ( ClassTextParseMode = "TextParseMode" ClassProxyType = "ProxyType" ClassStatisticalGraph = "StatisticalGraph" + ClassChatStatisticsObjectType = "ChatStatisticsObjectType" ClassChatStatistics = "ChatStatistics" + ClassRevenueWithdrawalState = "RevenueWithdrawalState" + ClassChatRevenueTransactionType = "ChatRevenueTransactionType" ClassVectorPathCommand = "VectorPathCommand" ClassBotCommandScope = "BotCommandScope" + ClassPhoneNumberCodeType = "PhoneNumberCodeType" ClassUpdate = "Update" ClassLogStream = "LogStream" ClassError = "Error" @@ -143,6 +208,8 @@ const ( ClassTextEntities = "TextEntities" ClassFormattedText = "FormattedText" ClassTermsOfService = "TermsOfService" + ClassPasskey = "Passkey" + ClassPasskeys = "Passkeys" ClassPasswordState = "PasswordState" ClassRecoveryEmailAddress = "RecoveryEmailAddress" ClassTemporaryPasswordState = "TemporaryPasswordState" @@ -154,9 +221,15 @@ const ( ClassThumbnail = "Thumbnail" ClassMaskPosition = "MaskPosition" ClassClosedVectorPath = "ClosedVectorPath" + ClassOutline = "Outline" ClassPollOption = "PollOption" + ClassChecklistTask = "ChecklistTask" + ClassInputChecklistTask = "InputChecklistTask" + ClassChecklist = "Checklist" + ClassInputChecklist = "InputChecklist" ClassAnimation = "Animation" ClassAudio = "Audio" + ClassAudios = "Audios" ClassDocument = "Document" ClassPhoto = "Photo" ClassSticker = "Sticker" @@ -168,8 +241,11 @@ const ( ClassLocation = "Location" ClassVenue = "Venue" ClassGame = "Game" + ClassStakeDiceState = "StakeDiceState" ClassWebApp = "WebApp" ClassPoll = "Poll" + ClassAlternativeVideo = "AlternativeVideo" + ClassVideoStoryboard = "VideoStoryboard" ClassBackground = "Background" ClassBackgrounds = "Backgrounds" ClassChatBackground = "ChatBackground" @@ -178,26 +254,115 @@ const ( ClassBotCommand = "BotCommand" ClassBotCommands = "BotCommands" ClassBotMenuButton = "BotMenuButton" + ClassBotVerificationParameters = "BotVerificationParameters" + ClassBotVerification = "BotVerification" + ClassVerificationStatus = "VerificationStatus" ClassChatLocation = "ChatLocation" + ClassBirthdate = "Birthdate" + ClassCloseBirthdayUser = "CloseBirthdayUser" + ClassBusinessLocation = "BusinessLocation" + ClassBusinessRecipients = "BusinessRecipients" + ClassBusinessAwayMessageSettings = "BusinessAwayMessageSettings" + ClassBusinessGreetingMessageSettings = "BusinessGreetingMessageSettings" + ClassBusinessBotRights = "BusinessBotRights" + ClassBusinessConnectedBot = "BusinessConnectedBot" + ClassBusinessStartPage = "BusinessStartPage" + ClassInputBusinessStartPage = "InputBusinessStartPage" + ClassBusinessOpeningHoursInterval = "BusinessOpeningHoursInterval" + ClassBusinessOpeningHours = "BusinessOpeningHours" + ClassBusinessInfo = "BusinessInfo" + ClassBusinessChatLink = "BusinessChatLink" + ClassBusinessChatLinks = "BusinessChatLinks" + ClassInputBusinessChatLink = "InputBusinessChatLink" + ClassBusinessChatLinkInfo = "BusinessChatLinkInfo" ClassChatPhotoSticker = "ChatPhotoSticker" ClassAnimatedChatPhoto = "AnimatedChatPhoto" ClassChatPhoto = "ChatPhoto" ClassChatPhotos = "ChatPhotos" ClassChatPermissions = "ChatPermissions" ClassChatAdministratorRights = "ChatAdministratorRights" + ClassSuggestedPostInfo = "SuggestedPostInfo" + ClassInputSuggestedPostInfo = "InputSuggestedPostInfo" + ClassStarAmount = "StarAmount" + ClassStarSubscriptionPricing = "StarSubscriptionPricing" + ClassStarSubscription = "StarSubscription" + ClassStarSubscriptions = "StarSubscriptions" + ClassAffiliateProgramParameters = "AffiliateProgramParameters" + ClassAffiliateProgramInfo = "AffiliateProgramInfo" + ClassAffiliateInfo = "AffiliateInfo" + ClassFoundAffiliateProgram = "FoundAffiliateProgram" + ClassFoundAffiliatePrograms = "FoundAffiliatePrograms" + ClassConnectedAffiliateProgram = "ConnectedAffiliateProgram" + ClassConnectedAffiliatePrograms = "ConnectedAffiliatePrograms" + ClassProductInfo = "ProductInfo" ClassPremiumPaymentOption = "PremiumPaymentOption" ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" - ClassPremiumGiftCodePaymentOption = "PremiumGiftCodePaymentOption" - ClassPremiumGiftCodePaymentOptions = "PremiumGiftCodePaymentOptions" + ClassPremiumGiftPaymentOption = "PremiumGiftPaymentOption" + ClassPremiumGiftPaymentOptions = "PremiumGiftPaymentOptions" + ClassPremiumGiveawayPaymentOption = "PremiumGiveawayPaymentOption" + ClassPremiumGiveawayPaymentOptions = "PremiumGiveawayPaymentOptions" ClassPremiumGiftCodeInfo = "PremiumGiftCodeInfo" + ClassStarPaymentOption = "StarPaymentOption" + ClassStarPaymentOptions = "StarPaymentOptions" + ClassStarGiveawayWinnerOption = "StarGiveawayWinnerOption" + ClassStarGiveawayPaymentOption = "StarGiveawayPaymentOption" + ClassStarGiveawayPaymentOptions = "StarGiveawayPaymentOptions" + ClassAcceptedGiftTypes = "AcceptedGiftTypes" + ClassGiftSettings = "GiftSettings" + ClassGiftAuction = "GiftAuction" + ClassGiftBackground = "GiftBackground" + ClassGiftPurchaseLimits = "GiftPurchaseLimits" + ClassGiftResaleParameters = "GiftResaleParameters" + ClassGiftCollection = "GiftCollection" + ClassGiftCollections = "GiftCollections" + ClassUpgradedGiftModel = "UpgradedGiftModel" + ClassUpgradedGiftSymbol = "UpgradedGiftSymbol" + ClassUpgradedGiftBackdropColors = "UpgradedGiftBackdropColors" + ClassUpgradedGiftBackdrop = "UpgradedGiftBackdrop" + ClassUpgradedGiftOriginalDetails = "UpgradedGiftOriginalDetails" + ClassUpgradedGiftColors = "UpgradedGiftColors" + ClassGift = "Gift" + ClassUpgradedGift = "UpgradedGift" + ClassUpgradedGiftValueInfo = "UpgradedGiftValueInfo" + ClassUpgradeGiftResult = "UpgradeGiftResult" + ClassAvailableGift = "AvailableGift" + ClassAvailableGifts = "AvailableGifts" + ClassGiftUpgradePrice = "GiftUpgradePrice" + ClassUpgradedGiftModelCount = "UpgradedGiftModelCount" + ClassUpgradedGiftSymbolCount = "UpgradedGiftSymbolCount" + ClassUpgradedGiftBackdropCount = "UpgradedGiftBackdropCount" + ClassGiftForResale = "GiftForResale" + ClassGiftsForResale = "GiftsForResale" + ClassReceivedGift = "ReceivedGift" + ClassReceivedGifts = "ReceivedGifts" + ClassAttributeCraftPersistenceProbability = "AttributeCraftPersistenceProbability" + ClassGiftsForCrafting = "GiftsForCrafting" + ClassGiftUpgradePreview = "GiftUpgradePreview" + ClassGiftUpgradeVariants = "GiftUpgradeVariants" + ClassAuctionBid = "AuctionBid" + ClassUserAuctionBid = "UserAuctionBid" + ClassAuctionRound = "AuctionRound" + ClassGiftAuctionState = "GiftAuctionState" + ClassGiftAuctionAcquiredGift = "GiftAuctionAcquiredGift" + ClassGiftAuctionAcquiredGifts = "GiftAuctionAcquiredGifts" + ClassStarTransaction = "StarTransaction" + ClassStarTransactions = "StarTransactions" + ClassTonTransaction = "TonTransaction" + ClassTonTransactions = "TonTransactions" ClassAccentColor = "AccentColor" + ClassProfileAccentColors = "ProfileAccentColors" + ClassProfileAccentColor = "ProfileAccentColor" + ClassUserRating = "UserRating" + ClassRestrictionInfo = "RestrictionInfo" ClassEmojiStatus = "EmojiStatus" ClassEmojiStatuses = "EmojiStatuses" + ClassEmojiStatusCustomEmojis = "EmojiStatusCustomEmojis" ClassUsernames = "Usernames" ClassUser = "User" ClassBotInfo = "BotInfo" ClassUserFullInfo = "UserFullInfo" ClassUsers = "Users" + ClassFoundUsers = "FoundUsers" ClassChatAdministrator = "ChatAdministrator" ClassChatAdministrators = "ChatAdministrators" ClassChatMember = "ChatMember" @@ -208,6 +373,7 @@ const ( ClassChatInviteLinkCounts = "ChatInviteLinkCounts" ClassChatInviteLinkMember = "ChatInviteLinkMember" ClassChatInviteLinkMembers = "ChatInviteLinkMembers" + ClassChatInviteLinkSubscriptionInfo = "ChatInviteLinkSubscriptionInfo" ClassChatInviteLinkInfo = "ChatInviteLinkInfo" ClassChatJoinRequest = "ChatJoinRequest" ClassChatJoinRequests = "ChatJoinRequests" @@ -217,35 +383,54 @@ const ( ClassSupergroup = "Supergroup" ClassSupergroupFullInfo = "SupergroupFullInfo" ClassSecretChat = "SecretChat" + ClassPublicPostSearchLimits = "PublicPostSearchLimits" ClassMessageSenders = "MessageSenders" ClassChatMessageSender = "ChatMessageSender" ClassChatMessageSenders = "ChatMessageSenders" ClassMessageViewer = "MessageViewer" ClassMessageViewers = "MessageViewers" + ClassForwardSource = "ForwardSource" + ClassPaidReactor = "PaidReactor" + ClassLiveStoryDonors = "LiveStoryDonors" ClassMessageForwardInfo = "MessageForwardInfo" ClassMessageImportInfo = "MessageImportInfo" ClassMessageReplyInfo = "MessageReplyInfo" ClassMessageReaction = "MessageReaction" + ClassMessageReactions = "MessageReactions" ClassMessageInteractionInfo = "MessageInteractionInfo" ClassUnreadReaction = "UnreadReaction" + ClassMessageEffect = "MessageEffect" + ClassTextQuote = "TextQuote" + ClassInputTextQuote = "InputTextQuote" + ClassFactCheck = "FactCheck" ClassMessage = "Message" ClassMessages = "Messages" ClassFoundMessages = "FoundMessages" ClassFoundChatMessages = "FoundChatMessages" + ClassFoundPublicPosts = "FoundPublicPosts" ClassMessagePosition = "MessagePosition" ClassMessagePositions = "MessagePositions" ClassMessageCalendarDay = "MessageCalendarDay" ClassMessageCalendar = "MessageCalendar" - ClassMessageSponsor = "MessageSponsor" + ClassBusinessMessage = "BusinessMessage" + ClassBusinessMessages = "BusinessMessages" + ClassAdvertisementSponsor = "AdvertisementSponsor" ClassSponsoredMessage = "SponsoredMessage" ClassSponsoredMessages = "SponsoredMessages" + ClassSponsoredChat = "SponsoredChat" + ClassSponsoredChats = "SponsoredChats" + ClassVideoMessageAdvertisement = "VideoMessageAdvertisement" + ClassVideoMessageAdvertisements = "VideoMessageAdvertisements" + ClassReportOption = "ReportOption" ClassFileDownload = "FileDownload" ClassDownloadedFileCounts = "DownloadedFileCounts" ClassFoundFileDownloads = "FoundFileDownloads" ClassChatNotificationSettings = "ChatNotificationSettings" ClassScopeNotificationSettings = "ScopeNotificationSettings" + ClassReactionNotificationSettings = "ReactionNotificationSettings" ClassDraftMessage = "DraftMessage" ClassChatFolderIcon = "ChatFolderIcon" + ClassChatFolderName = "ChatFolderName" ClassChatFolder = "ChatFolder" ClassChatFolderInfo = "ChatFolderInfo" ClassChatFolderInviteLink = "ChatFolderInviteLink" @@ -256,34 +441,48 @@ const ( ClassArchiveChatListSettings = "ArchiveChatListSettings" ClassChatLists = "ChatLists" ClassChatPosition = "ChatPosition" + ClassSavedMessagesTag = "SavedMessagesTag" + ClassSavedMessagesTags = "SavedMessagesTags" + ClassBusinessBotManageBar = "BusinessBotManageBar" ClassVideoChat = "VideoChat" ClassChat = "Chat" ClassChats = "Chats" - ClassChatNearby = "ChatNearby" - ClassChatsNearby = "ChatsNearby" + ClassFailedToAddMember = "FailedToAddMember" + ClassFailedToAddMembers = "FailedToAddMembers" + ClassCreatedBasicGroupChat = "CreatedBasicGroupChat" + ClassAccountInfo = "AccountInfo" ClassKeyboardButton = "KeyboardButton" ClassInlineKeyboardButton = "InlineKeyboardButton" + ClassThemeParameters = "ThemeParameters" ClassFoundWebApp = "FoundWebApp" ClassWebAppInfo = "WebAppInfo" + ClassMainWebApp = "MainWebApp" + ClassWebAppOpenParameters = "WebAppOpenParameters" ClassMessageThreadInfo = "MessageThreadInfo" + ClassSavedMessagesTopic = "SavedMessagesTopic" + ClassDirectMessagesChatTopic = "DirectMessagesChatTopic" ClassForumTopicIcon = "ForumTopicIcon" ClassForumTopicInfo = "ForumTopicInfo" ClassForumTopic = "ForumTopic" ClassForumTopics = "ForumTopics" ClassLinkPreviewOptions = "LinkPreviewOptions" + ClassSharedUser = "SharedUser" + ClassSharedChat = "SharedChat" + ClassThemeSettings = "ThemeSettings" ClassPageBlockCaption = "PageBlockCaption" ClassPageBlockListItem = "PageBlockListItem" ClassPageBlockTableCell = "PageBlockTableCell" ClassPageBlockRelatedArticle = "PageBlockRelatedArticle" ClassWebPageInstantView = "WebPageInstantView" - ClassWebPage = "WebPage" + ClassLinkPreview = "LinkPreview" ClassCountryInfo = "CountryInfo" ClassCountries = "Countries" ClassPhoneNumberInfo = "PhoneNumberInfo" + ClassCollectibleItemInfo = "CollectibleItemInfo" ClassBankCardActionOpenUrl = "BankCardActionOpenUrl" ClassBankCardInfo = "BankCardInfo" ClassAddress = "Address" - ClassThemeParameters = "ThemeParameters" + ClassLocationAddress = "LocationAddress" ClassLabeledPricePart = "LabeledPricePart" ClassInvoice = "Invoice" ClassOrderInfo = "OrderInfo" @@ -294,7 +493,7 @@ const ( ClassValidatedOrderInfo = "ValidatedOrderInfo" ClassPaymentResult = "PaymentResult" ClassPaymentReceipt = "PaymentReceipt" - ClassPremiumGiveawayParameters = "PremiumGiveawayParameters" + ClassGiveawayParameters = "GiveawayParameters" ClassDatedFile = "DatedFile" ClassDate = "Date" ClassPersonalDetails = "PersonalDetails" @@ -312,8 +511,12 @@ const ( ClassEncryptedPassportElement = "EncryptedPassportElement" ClassInputPassportElementError = "InputPassportElementError" ClassInputThumbnail = "InputThumbnail" + ClassInputPaidMedia = "InputPaidMedia" ClassMessageSendOptions = "MessageSendOptions" ClassMessageCopyOptions = "MessageCopyOptions" + ClassMessageProperties = "MessageProperties" + ClassEmojiKeyword = "EmojiKeyword" + ClassEmojiKeywords = "EmojiKeywords" ClassStickers = "Stickers" ClassEmojis = "Emojis" ClassStickerSet = "StickerSet" @@ -322,19 +525,34 @@ const ( ClassTrendingStickerSets = "TrendingStickerSets" ClassEmojiCategory = "EmojiCategory" ClassEmojiCategories = "EmojiCategories" - ClassStoryViewer = "StoryViewer" - ClassStoryViewers = "StoryViewers" + ClassCurrentWeather = "CurrentWeather" ClassStoryAreaPosition = "StoryAreaPosition" ClassStoryArea = "StoryArea" ClassInputStoryArea = "InputStoryArea" ClassInputStoryAreas = "InputStoryAreas" ClassStoryVideo = "StoryVideo" + ClassStoryRepostInfo = "StoryRepostInfo" ClassStoryInteractionInfo = "StoryInteractionInfo" ClassStory = "Story" ClassStories = "Stories" + ClassFoundStories = "FoundStories" + ClassStoryAlbum = "StoryAlbum" + ClassStoryAlbums = "StoryAlbums" + ClassStoryFullId = "StoryFullId" ClassStoryInfo = "StoryInfo" ClassChatActiveStories = "ChatActiveStories" - ClassPrepaidPremiumGiveaway = "PrepaidPremiumGiveaway" + ClassStoryInteraction = "StoryInteraction" + ClassStoryInteractions = "StoryInteractions" + ClassQuickReplyMessage = "QuickReplyMessage" + ClassQuickReplyMessages = "QuickReplyMessages" + ClassQuickReplyShortcut = "QuickReplyShortcut" + ClassPublicForwards = "PublicForwards" + ClassBotMediaPreview = "BotMediaPreview" + ClassBotMediaPreviews = "BotMediaPreviews" + ClassBotMediaPreviewInfo = "BotMediaPreviewInfo" + ClassChatBoostLevelFeatures = "ChatBoostLevelFeatures" + ClassChatBoostFeatures = "ChatBoostFeatures" + ClassPrepaidGiveaway = "PrepaidGiveaway" ClassChatBoostStatus = "ChatBoostStatus" ClassChatBoost = "ChatBoost" ClassFoundChatBoosts = "FoundChatBoosts" @@ -344,6 +562,7 @@ const ( ClassCallServer = "CallServer" ClassCallId = "CallId" ClassGroupCallId = "GroupCallId" + ClassGroupCallJoinParameters = "GroupCallJoinParameters" ClassGroupCallStream = "GroupCallStream" ClassGroupCallStreams = "GroupCallStreams" ClassRtmpUrl = "RtmpUrl" @@ -352,6 +571,10 @@ const ( ClassGroupCallVideoSourceGroup = "GroupCallVideoSourceGroup" ClassGroupCallParticipantVideoInfo = "GroupCallParticipantVideoInfo" ClassGroupCallParticipant = "GroupCallParticipant" + ClassGroupCallParticipants = "GroupCallParticipants" + ClassGroupCallInfo = "GroupCallInfo" + ClassGroupCallMessage = "GroupCallMessage" + ClassGroupCallMessageLevel = "GroupCallMessageLevel" ClassCall = "Call" ClassPhoneNumberAuthenticationSettings = "PhoneNumberAuthenticationSettings" ClassAddedReaction = "AddedReaction" @@ -360,14 +583,19 @@ const ( ClassAvailableReactions = "AvailableReactions" ClassEmojiReaction = "EmojiReaction" ClassAnimations = "Animations" + ClassImportedContact = "ImportedContact" ClassImportedContacts = "ImportedContacts" + ClassBusinessConnection = "BusinessConnection" ClassAttachmentMenuBotColor = "AttachmentMenuBotColor" ClassAttachmentMenuBot = "AttachmentMenuBot" ClassSentWebAppMessage = "SentWebAppMessage" ClassHttpUrl = "HttpUrl" ClassUserLink = "UserLink" + ClassTargetChatTypes = "TargetChatTypes" ClassInlineQueryResultsButton = "InlineQueryResultsButton" ClassInlineQueryResults = "InlineQueryResults" + ClassPreparedInlineMessageId = "PreparedInlineMessageId" + ClassPreparedInlineMessage = "PreparedInlineMessage" ClassCallbackQueryAnswer = "CallbackQueryAnswer" ClassCustomRequestResult = "CustomRequestResult" ClassGameHighScore = "GameHighScore" @@ -381,18 +609,26 @@ const ( ClassLocalizationTargetInfo = "LocalizationTargetInfo" ClassPremiumLimit = "PremiumLimit" ClassPremiumFeatures = "PremiumFeatures" + ClassBusinessFeatures = "BusinessFeatures" ClassPremiumFeaturePromotionAnimation = "PremiumFeaturePromotionAnimation" + ClassBusinessFeaturePromotionAnimation = "BusinessFeaturePromotionAnimation" ClassPremiumState = "PremiumState" ClassPushReceiverId = "PushReceiverId" - ClassThemeSettings = "ThemeSettings" - ClassChatTheme = "ChatTheme" + ClassEmojiChatTheme = "EmojiChatTheme" + ClassGiftChatTheme = "GiftChatTheme" + ClassGiftChatThemes = "GiftChatThemes" + ClassTimeZone = "TimeZone" + ClassTimeZones = "TimeZones" ClassHashtags = "Hashtags" ClassNotificationSound = "NotificationSound" ClassNotificationSounds = "NotificationSounds" ClassNotification = "Notification" ClassNotificationGroup = "NotificationGroup" + ClassProxy = "Proxy" ClassJsonObjectMember = "JsonObjectMember" ClassUserPrivacySettingRules = "UserPrivacySettingRules" + ClassReadDatePrivacySettings = "ReadDatePrivacySettings" + ClassNewChatPrivacySettings = "NewChatPrivacySettings" ClassAccountTtl = "AccountTtl" ClassMessageAutoDeleteTime = "MessageAutoDeleteTime" ClassSession = "Session" @@ -404,7 +640,6 @@ const ( ClassMessageLinkInfo = "MessageLinkInfo" ClassChatBoostLink = "ChatBoostLink" ClassChatBoostLinkInfo = "ChatBoostLinkInfo" - ClassFilePart = "FilePart" ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" ClassStorageStatisticsByChat = "StorageStatisticsByChat" ClassStorageStatistics = "StorageStatistics" @@ -416,25 +651,37 @@ const ( ClassScopeAutosaveSettings = "ScopeAutosaveSettings" ClassAutosaveSettingsException = "AutosaveSettingsException" ClassAutosaveSettings = "AutosaveSettings" + ClassAgeVerificationParameters = "AgeVerificationParameters" ClassFoundPosition = "FoundPosition" ClassFoundPositions = "FoundPositions" ClassTMeUrl = "TMeUrl" ClassTMeUrls = "TMeUrls" ClassCount = "Count" ClassText = "Text" + ClassData = "Data" ClassSeconds = "Seconds" ClassFileDownloadedPrefixSize = "FileDownloadedPrefixSize" + ClassStarCount = "StarCount" ClassDeepLinkInfo = "DeepLinkInfo" - ClassProxy = "Proxy" - ClassProxies = "Proxies" + ClassAddedProxy = "AddedProxy" + ClassAddedProxies = "AddedProxies" ClassInputSticker = "InputSticker" ClassDateRange = "DateRange" ClassStatisticalValue = "StatisticalValue" - ClassChatStatisticsMessageInteractionInfo = "ChatStatisticsMessageInteractionInfo" + ClassChatStatisticsInteractionInfo = "ChatStatisticsInteractionInfo" ClassChatStatisticsMessageSenderInfo = "ChatStatisticsMessageSenderInfo" ClassChatStatisticsAdministratorActionsInfo = "ChatStatisticsAdministratorActionsInfo" ClassChatStatisticsInviterInfo = "ChatStatisticsInviterInfo" + ClassChatRevenueAmount = "ChatRevenueAmount" + ClassChatRevenueStatistics = "ChatRevenueStatistics" ClassMessageStatistics = "MessageStatistics" + ClassStoryStatistics = "StoryStatistics" + ClassChatRevenueTransaction = "ChatRevenueTransaction" + ClassChatRevenueTransactions = "ChatRevenueTransactions" + ClassStarRevenueStatus = "StarRevenueStatus" + ClassStarRevenueStatistics = "StarRevenueStatistics" + ClassTonRevenueStatus = "TonRevenueStatus" + ClassTonRevenueStatistics = "TonRevenueStatistics" ClassPoint = "Point" ClassUpdates = "Updates" ClassLogVerbosityLevel = "LogVerbosityLevel" @@ -454,6 +701,8 @@ const ( TypeOk = "ok" TypeAuthenticationCodeTypeTelegramMessage = "authenticationCodeTypeTelegramMessage" TypeAuthenticationCodeTypeSms = "authenticationCodeTypeSms" + TypeAuthenticationCodeTypeSmsWord = "authenticationCodeTypeSmsWord" + TypeAuthenticationCodeTypeSmsPhrase = "authenticationCodeTypeSmsPhrase" TypeAuthenticationCodeTypeCall = "authenticationCodeTypeCall" TypeAuthenticationCodeTypeFlashCall = "authenticationCodeTypeFlashCall" TypeAuthenticationCodeTypeMissedCall = "authenticationCodeTypeMissedCall" @@ -471,8 +720,11 @@ const ( TypeTextEntities = "textEntities" TypeFormattedText = "formattedText" TypeTermsOfService = "termsOfService" + TypePasskey = "passkey" + TypePasskeys = "passkeys" TypeAuthorizationStateWaitTdlibParameters = "authorizationStateWaitTdlibParameters" TypeAuthorizationStateWaitPhoneNumber = "authorizationStateWaitPhoneNumber" + TypeAuthorizationStateWaitPremiumPurchase = "authorizationStateWaitPremiumPurchase" TypeAuthorizationStateWaitEmailAddress = "authorizationStateWaitEmailAddress" TypeAuthorizationStateWaitEmailCode = "authorizationStateWaitEmailCode" TypeAuthorizationStateWaitCode = "authorizationStateWaitCode" @@ -483,6 +735,8 @@ const ( TypeAuthorizationStateLoggingOut = "authorizationStateLoggingOut" TypeAuthorizationStateClosing = "authorizationStateClosing" TypeAuthorizationStateClosed = "authorizationStateClosed" + TypeFirebaseDeviceVerificationParametersSafetyNet = "firebaseDeviceVerificationParametersSafetyNet" + TypeFirebaseDeviceVerificationParametersPlayIntegrity = "firebaseDeviceVerificationParametersPlayIntegrity" TypePasswordState = "passwordState" TypeRecoveryEmailAddress = "recoveryEmailAddress" TypeTemporaryPasswordState = "temporaryPasswordState" @@ -518,11 +772,17 @@ const ( TypeStickerFullTypeMask = "stickerFullTypeMask" TypeStickerFullTypeCustomEmoji = "stickerFullTypeCustomEmoji" TypeClosedVectorPath = "closedVectorPath" + TypeOutline = "outline" TypePollOption = "pollOption" TypePollTypeRegular = "pollTypeRegular" TypePollTypeQuiz = "pollTypeQuiz" + TypeChecklistTask = "checklistTask" + TypeInputChecklistTask = "inputChecklistTask" + TypeChecklist = "checklist" + TypeInputChecklist = "inputChecklist" TypeAnimation = "animation" TypeAudio = "audio" + TypeAudios = "audios" TypeDocument = "document" TypePhoto = "photo" TypeSticker = "sticker" @@ -534,13 +794,24 @@ const ( TypeLocation = "location" TypeVenue = "venue" TypeGame = "game" + TypeStakeDiceState = "stakeDiceState" TypeWebApp = "webApp" TypePoll = "poll" + TypeAlternativeVideo = "alternativeVideo" + TypeVideoStoryboard = "videoStoryboard" TypeBackground = "background" TypeBackgrounds = "backgrounds" TypeChatBackground = "chatBackground" TypeProfilePhoto = "profilePhoto" TypeChatPhotoInfo = "chatPhotoInfo" + TypeProfileTabPosts = "profileTabPosts" + TypeProfileTabGifts = "profileTabGifts" + TypeProfileTabMedia = "profileTabMedia" + TypeProfileTabFiles = "profileTabFiles" + TypeProfileTabLinks = "profileTabLinks" + TypeProfileTabMusic = "profileTabMusic" + TypeProfileTabVoice = "profileTabVoice" + TypeProfileTabGifs = "profileTabGifs" TypeUserTypeRegular = "userTypeRegular" TypeUserTypeDeleted = "userTypeDeleted" TypeUserTypeBot = "userTypeBot" @@ -548,7 +819,30 @@ const ( TypeBotCommand = "botCommand" TypeBotCommands = "botCommands" TypeBotMenuButton = "botMenuButton" + TypeBotVerificationParameters = "botVerificationParameters" + TypeBotVerification = "botVerification" + TypeVerificationStatus = "verificationStatus" TypeChatLocation = "chatLocation" + TypeBirthdate = "birthdate" + TypeCloseBirthdayUser = "closeBirthdayUser" + TypeBusinessAwayMessageScheduleAlways = "businessAwayMessageScheduleAlways" + TypeBusinessAwayMessageScheduleOutsideOfOpeningHours = "businessAwayMessageScheduleOutsideOfOpeningHours" + TypeBusinessAwayMessageScheduleCustom = "businessAwayMessageScheduleCustom" + TypeBusinessLocation = "businessLocation" + TypeBusinessRecipients = "businessRecipients" + TypeBusinessAwayMessageSettings = "businessAwayMessageSettings" + TypeBusinessGreetingMessageSettings = "businessGreetingMessageSettings" + TypeBusinessBotRights = "businessBotRights" + TypeBusinessConnectedBot = "businessConnectedBot" + TypeBusinessStartPage = "businessStartPage" + TypeInputBusinessStartPage = "inputBusinessStartPage" + TypeBusinessOpeningHoursInterval = "businessOpeningHoursInterval" + TypeBusinessOpeningHours = "businessOpeningHours" + TypeBusinessInfo = "businessInfo" + TypeBusinessChatLink = "businessChatLink" + TypeBusinessChatLinks = "businessChatLinks" + TypeInputBusinessChatLink = "inputBusinessChatLink" + TypeBusinessChatLinkInfo = "businessChatLinkInfo" TypeChatPhotoStickerTypeRegularOrMask = "chatPhotoStickerTypeRegularOrMask" TypeChatPhotoStickerTypeCustomEmoji = "chatPhotoStickerTypeCustomEmoji" TypeChatPhotoSticker = "chatPhotoSticker" @@ -561,26 +855,208 @@ const ( TypeInputChatPhotoSticker = "inputChatPhotoSticker" TypeChatPermissions = "chatPermissions" TypeChatAdministratorRights = "chatAdministratorRights" + TypeGiftResalePriceStar = "giftResalePriceStar" + TypeGiftResalePriceTon = "giftResalePriceTon" + TypeGiftPurchaseOfferStatePending = "giftPurchaseOfferStatePending" + TypeGiftPurchaseOfferStateAccepted = "giftPurchaseOfferStateAccepted" + TypeGiftPurchaseOfferStateRejected = "giftPurchaseOfferStateRejected" + TypeSuggestedPostPriceStar = "suggestedPostPriceStar" + TypeSuggestedPostPriceTon = "suggestedPostPriceTon" + TypeSuggestedPostStatePending = "suggestedPostStatePending" + TypeSuggestedPostStateApproved = "suggestedPostStateApproved" + TypeSuggestedPostStateDeclined = "suggestedPostStateDeclined" + TypeSuggestedPostInfo = "suggestedPostInfo" + TypeInputSuggestedPostInfo = "inputSuggestedPostInfo" + TypeSuggestedPostRefundReasonPostDeleted = "suggestedPostRefundReasonPostDeleted" + TypeSuggestedPostRefundReasonPaymentRefunded = "suggestedPostRefundReasonPaymentRefunded" + TypeStarAmount = "starAmount" + TypeStarSubscriptionTypeChannel = "starSubscriptionTypeChannel" + TypeStarSubscriptionTypeBot = "starSubscriptionTypeBot" + TypeStarSubscriptionPricing = "starSubscriptionPricing" + TypeStarSubscription = "starSubscription" + TypeStarSubscriptions = "starSubscriptions" + TypeAffiliateTypeCurrentUser = "affiliateTypeCurrentUser" + TypeAffiliateTypeBot = "affiliateTypeBot" + TypeAffiliateTypeChannel = "affiliateTypeChannel" + TypeAffiliateProgramSortOrderProfitability = "affiliateProgramSortOrderProfitability" + TypeAffiliateProgramSortOrderCreationDate = "affiliateProgramSortOrderCreationDate" + TypeAffiliateProgramSortOrderRevenue = "affiliateProgramSortOrderRevenue" + TypeAffiliateProgramParameters = "affiliateProgramParameters" + TypeAffiliateProgramInfo = "affiliateProgramInfo" + TypeAffiliateInfo = "affiliateInfo" + TypeFoundAffiliateProgram = "foundAffiliateProgram" + TypeFoundAffiliatePrograms = "foundAffiliatePrograms" + TypeConnectedAffiliateProgram = "connectedAffiliateProgram" + TypeConnectedAffiliatePrograms = "connectedAffiliatePrograms" + TypeProductInfo = "productInfo" TypePremiumPaymentOption = "premiumPaymentOption" TypePremiumStatePaymentOption = "premiumStatePaymentOption" - TypePremiumGiftCodePaymentOption = "premiumGiftCodePaymentOption" - TypePremiumGiftCodePaymentOptions = "premiumGiftCodePaymentOptions" + TypePremiumGiftPaymentOption = "premiumGiftPaymentOption" + TypePremiumGiftPaymentOptions = "premiumGiftPaymentOptions" + TypePremiumGiveawayPaymentOption = "premiumGiveawayPaymentOption" + TypePremiumGiveawayPaymentOptions = "premiumGiveawayPaymentOptions" TypePremiumGiftCodeInfo = "premiumGiftCodeInfo" - TypePremiumGiveawayParticipantStatusEligible = "premiumGiveawayParticipantStatusEligible" - TypePremiumGiveawayParticipantStatusParticipating = "premiumGiveawayParticipantStatusParticipating" - TypePremiumGiveawayParticipantStatusAlreadyWasMember = "premiumGiveawayParticipantStatusAlreadyWasMember" - TypePremiumGiveawayParticipantStatusAdministrator = "premiumGiveawayParticipantStatusAdministrator" - TypePremiumGiveawayParticipantStatusDisallowedCountry = "premiumGiveawayParticipantStatusDisallowedCountry" - TypePremiumGiveawayInfoOngoing = "premiumGiveawayInfoOngoing" - TypePremiumGiveawayInfoCompleted = "premiumGiveawayInfoCompleted" + TypeStarPaymentOption = "starPaymentOption" + TypeStarPaymentOptions = "starPaymentOptions" + TypeStarGiveawayWinnerOption = "starGiveawayWinnerOption" + TypeStarGiveawayPaymentOption = "starGiveawayPaymentOption" + TypeStarGiveawayPaymentOptions = "starGiveawayPaymentOptions" + TypeAcceptedGiftTypes = "acceptedGiftTypes" + TypeGiftSettings = "giftSettings" + TypeGiftAuction = "giftAuction" + TypeGiftBackground = "giftBackground" + TypeGiftPurchaseLimits = "giftPurchaseLimits" + TypeGiftResaleParameters = "giftResaleParameters" + TypeGiftCollection = "giftCollection" + TypeGiftCollections = "giftCollections" + TypeCanSendGiftResultOk = "canSendGiftResultOk" + TypeCanSendGiftResultFail = "canSendGiftResultFail" + TypeUpgradedGiftOriginUpgrade = "upgradedGiftOriginUpgrade" + TypeUpgradedGiftOriginTransfer = "upgradedGiftOriginTransfer" + TypeUpgradedGiftOriginResale = "upgradedGiftOriginResale" + TypeUpgradedGiftOriginBlockchain = "upgradedGiftOriginBlockchain" + TypeUpgradedGiftOriginPrepaidUpgrade = "upgradedGiftOriginPrepaidUpgrade" + TypeUpgradedGiftOriginOffer = "upgradedGiftOriginOffer" + TypeUpgradedGiftOriginCraft = "upgradedGiftOriginCraft" + TypeUpgradedGiftAttributeRarityPerMille = "upgradedGiftAttributeRarityPerMille" + TypeUpgradedGiftAttributeRarityUncommon = "upgradedGiftAttributeRarityUncommon" + TypeUpgradedGiftAttributeRarityRare = "upgradedGiftAttributeRarityRare" + TypeUpgradedGiftAttributeRarityEpic = "upgradedGiftAttributeRarityEpic" + TypeUpgradedGiftAttributeRarityLegendary = "upgradedGiftAttributeRarityLegendary" + TypeUpgradedGiftModel = "upgradedGiftModel" + TypeUpgradedGiftSymbol = "upgradedGiftSymbol" + TypeUpgradedGiftBackdropColors = "upgradedGiftBackdropColors" + TypeUpgradedGiftBackdrop = "upgradedGiftBackdrop" + TypeUpgradedGiftOriginalDetails = "upgradedGiftOriginalDetails" + TypeUpgradedGiftColors = "upgradedGiftColors" + TypeGift = "gift" + TypeUpgradedGift = "upgradedGift" + TypeUpgradedGiftValueInfo = "upgradedGiftValueInfo" + TypeUpgradeGiftResult = "upgradeGiftResult" + TypeCraftGiftResultSuccess = "craftGiftResultSuccess" + TypeCraftGiftResultTooEarly = "craftGiftResultTooEarly" + TypeCraftGiftResultInvalidGift = "craftGiftResultInvalidGift" + TypeCraftGiftResultFail = "craftGiftResultFail" + TypeAvailableGift = "availableGift" + TypeAvailableGifts = "availableGifts" + TypeGiftUpgradePrice = "giftUpgradePrice" + TypeUpgradedGiftAttributeIdModel = "upgradedGiftAttributeIdModel" + TypeUpgradedGiftAttributeIdSymbol = "upgradedGiftAttributeIdSymbol" + TypeUpgradedGiftAttributeIdBackdrop = "upgradedGiftAttributeIdBackdrop" + TypeUpgradedGiftModelCount = "upgradedGiftModelCount" + TypeUpgradedGiftSymbolCount = "upgradedGiftSymbolCount" + TypeUpgradedGiftBackdropCount = "upgradedGiftBackdropCount" + TypeGiftForResaleOrderPrice = "giftForResaleOrderPrice" + TypeGiftForResaleOrderPriceChangeDate = "giftForResaleOrderPriceChangeDate" + TypeGiftForResaleOrderNumber = "giftForResaleOrderNumber" + TypeGiftForResale = "giftForResale" + TypeGiftsForResale = "giftsForResale" + TypeGiftResaleResultOk = "giftResaleResultOk" + TypeGiftResaleResultPriceIncreased = "giftResaleResultPriceIncreased" + TypeSentGiftRegular = "sentGiftRegular" + TypeSentGiftUpgraded = "sentGiftUpgraded" + TypeReceivedGift = "receivedGift" + TypeReceivedGifts = "receivedGifts" + TypeAttributeCraftPersistenceProbability = "attributeCraftPersistenceProbability" + TypeGiftsForCrafting = "giftsForCrafting" + TypeGiftUpgradePreview = "giftUpgradePreview" + TypeGiftUpgradeVariants = "giftUpgradeVariants" + TypeAuctionBid = "auctionBid" + TypeUserAuctionBid = "userAuctionBid" + TypeAuctionRound = "auctionRound" + TypeAuctionStateActive = "auctionStateActive" + TypeAuctionStateFinished = "auctionStateFinished" + TypeGiftAuctionState = "giftAuctionState" + TypeGiftAuctionAcquiredGift = "giftAuctionAcquiredGift" + TypeGiftAuctionAcquiredGifts = "giftAuctionAcquiredGifts" + TypeTransactionDirectionIncoming = "transactionDirectionIncoming" + TypeTransactionDirectionOutgoing = "transactionDirectionOutgoing" + 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" + TypeStarTransactionTypeGiftAuctionBid = "starTransactionTypeGiftAuctionBid" + TypeStarTransactionTypeGiftPurchase = "starTransactionTypeGiftPurchase" + TypeStarTransactionTypeGiftPurchaseOffer = "starTransactionTypeGiftPurchaseOffer" + TypeStarTransactionTypeGiftTransfer = "starTransactionTypeGiftTransfer" + TypeStarTransactionTypeGiftOriginalDetailsDrop = "starTransactionTypeGiftOriginalDetailsDrop" + TypeStarTransactionTypeGiftSale = "starTransactionTypeGiftSale" + TypeStarTransactionTypeGiftUpgrade = "starTransactionTypeGiftUpgrade" + TypeStarTransactionTypeGiftUpgradePurchase = "starTransactionTypeGiftUpgradePurchase" + TypeStarTransactionTypeUpgradedGiftPurchase = "starTransactionTypeUpgradedGiftPurchase" + TypeStarTransactionTypeUpgradedGiftSale = "starTransactionTypeUpgradedGiftSale" + TypeStarTransactionTypeChannelPaidReactionSend = "starTransactionTypeChannelPaidReactionSend" + TypeStarTransactionTypeChannelPaidReactionReceive = "starTransactionTypeChannelPaidReactionReceive" + TypeStarTransactionTypeAffiliateProgramCommission = "starTransactionTypeAffiliateProgramCommission" + TypeStarTransactionTypePaidMessageSend = "starTransactionTypePaidMessageSend" + TypeStarTransactionTypePaidMessageReceive = "starTransactionTypePaidMessageReceive" + TypeStarTransactionTypePaidGroupCallMessageSend = "starTransactionTypePaidGroupCallMessageSend" + TypeStarTransactionTypePaidGroupCallMessageReceive = "starTransactionTypePaidGroupCallMessageReceive" + TypeStarTransactionTypePaidGroupCallReactionSend = "starTransactionTypePaidGroupCallReactionSend" + TypeStarTransactionTypePaidGroupCallReactionReceive = "starTransactionTypePaidGroupCallReactionReceive" + TypeStarTransactionTypeSuggestedPostPaymentSend = "starTransactionTypeSuggestedPostPaymentSend" + TypeStarTransactionTypeSuggestedPostPaymentReceive = "starTransactionTypeSuggestedPostPaymentReceive" + TypeStarTransactionTypePremiumPurchase = "starTransactionTypePremiumPurchase" + TypeStarTransactionTypeBusinessBotTransferSend = "starTransactionTypeBusinessBotTransferSend" + TypeStarTransactionTypeBusinessBotTransferReceive = "starTransactionTypeBusinessBotTransferReceive" + TypeStarTransactionTypePublicPostSearch = "starTransactionTypePublicPostSearch" + TypeStarTransactionTypeUnsupported = "starTransactionTypeUnsupported" + TypeStarTransaction = "starTransaction" + TypeStarTransactions = "starTransactions" + TypeTonTransactionTypeFragmentDeposit = "tonTransactionTypeFragmentDeposit" + TypeTonTransactionTypeFragmentWithdrawal = "tonTransactionTypeFragmentWithdrawal" + TypeTonTransactionTypeSuggestedPostPayment = "tonTransactionTypeSuggestedPostPayment" + TypeTonTransactionTypeGiftPurchaseOffer = "tonTransactionTypeGiftPurchaseOffer" + TypeTonTransactionTypeUpgradedGiftPurchase = "tonTransactionTypeUpgradedGiftPurchase" + TypeTonTransactionTypeUpgradedGiftSale = "tonTransactionTypeUpgradedGiftSale" + TypeTonTransactionTypeStakeDiceStake = "tonTransactionTypeStakeDiceStake" + TypeTonTransactionTypeStakeDicePayout = "tonTransactionTypeStakeDicePayout" + TypeTonTransactionTypeUnsupported = "tonTransactionTypeUnsupported" + TypeTonTransaction = "tonTransaction" + TypeTonTransactions = "tonTransactions" + TypeActiveStoryStateLive = "activeStoryStateLive" + TypeActiveStoryStateUnread = "activeStoryStateUnread" + TypeActiveStoryStateRead = "activeStoryStateRead" + TypeGiveawayParticipantStatusEligible = "giveawayParticipantStatusEligible" + TypeGiveawayParticipantStatusParticipating = "giveawayParticipantStatusParticipating" + TypeGiveawayParticipantStatusAlreadyWasMember = "giveawayParticipantStatusAlreadyWasMember" + TypeGiveawayParticipantStatusAdministrator = "giveawayParticipantStatusAdministrator" + TypeGiveawayParticipantStatusDisallowedCountry = "giveawayParticipantStatusDisallowedCountry" + TypeGiveawayInfoOngoing = "giveawayInfoOngoing" + TypeGiveawayInfoCompleted = "giveawayInfoCompleted" + TypeGiveawayPrizePremium = "giveawayPrizePremium" + TypeGiveawayPrizeStars = "giveawayPrizeStars" TypeAccentColor = "accentColor" + TypeProfileAccentColors = "profileAccentColors" + TypeProfileAccentColor = "profileAccentColor" + TypeUserRating = "userRating" + TypeRestrictionInfo = "restrictionInfo" + TypeEmojiStatusTypeCustomEmoji = "emojiStatusTypeCustomEmoji" + TypeEmojiStatusTypeUpgradedGift = "emojiStatusTypeUpgradedGift" TypeEmojiStatus = "emojiStatus" TypeEmojiStatuses = "emojiStatuses" + TypeEmojiStatusCustomEmojis = "emojiStatusCustomEmojis" TypeUsernames = "usernames" TypeUser = "user" TypeBotInfo = "botInfo" TypeUserFullInfo = "userFullInfo" TypeUsers = "users" + TypeFoundUsers = "foundUsers" TypeChatAdministrator = "chatAdministrator" TypeChatAdministrators = "chatAdministrators" TypeChatMemberStatusCreator = "chatMemberStatusCreator" @@ -615,6 +1091,7 @@ const ( TypeInviteLinkChatTypeBasicGroup = "inviteLinkChatTypeBasicGroup" TypeInviteLinkChatTypeSupergroup = "inviteLinkChatTypeSupergroup" TypeInviteLinkChatTypeChannel = "inviteLinkChatTypeChannel" + TypeChatInviteLinkSubscriptionInfo = "chatInviteLinkSubscriptionInfo" TypeChatInviteLinkInfo = "chatInviteLinkInfo" TypeChatJoinRequest = "chatJoinRequest" TypeChatJoinRequests = "chatJoinRequests" @@ -627,42 +1104,71 @@ const ( TypeSecretChatStateReady = "secretChatStateReady" TypeSecretChatStateClosed = "secretChatStateClosed" TypeSecretChat = "secretChat" + TypePublicPostSearchLimits = "publicPostSearchLimits" TypeMessageSenderUser = "messageSenderUser" TypeMessageSenderChat = "messageSenderChat" TypeMessageSenders = "messageSenders" TypeChatMessageSender = "chatMessageSender" TypeChatMessageSenders = "chatMessageSenders" + TypeMessageReadDateRead = "messageReadDateRead" + TypeMessageReadDateUnread = "messageReadDateUnread" + TypeMessageReadDateTooOld = "messageReadDateTooOld" + TypeMessageReadDateUserPrivacyRestricted = "messageReadDateUserPrivacyRestricted" + TypeMessageReadDateMyPrivacyRestricted = "messageReadDateMyPrivacyRestricted" TypeMessageViewer = "messageViewer" TypeMessageViewers = "messageViewers" TypeMessageOriginUser = "messageOriginUser" TypeMessageOriginHiddenUser = "messageOriginHiddenUser" TypeMessageOriginChat = "messageOriginChat" TypeMessageOriginChannel = "messageOriginChannel" + TypeForwardSource = "forwardSource" TypeReactionTypeEmoji = "reactionTypeEmoji" TypeReactionTypeCustomEmoji = "reactionTypeCustomEmoji" + TypeReactionTypePaid = "reactionTypePaid" + TypePaidReactionTypeRegular = "paidReactionTypeRegular" + TypePaidReactionTypeAnonymous = "paidReactionTypeAnonymous" + TypePaidReactionTypeChat = "paidReactionTypeChat" + TypePaidReactor = "paidReactor" + TypeLiveStoryDonors = "liveStoryDonors" TypeMessageForwardInfo = "messageForwardInfo" TypeMessageImportInfo = "messageImportInfo" TypeMessageReplyInfo = "messageReplyInfo" TypeMessageReaction = "messageReaction" + TypeMessageReactions = "messageReactions" TypeMessageInteractionInfo = "messageInteractionInfo" TypeUnreadReaction = "unreadReaction" + TypeMessageTopicThread = "messageTopicThread" + TypeMessageTopicForum = "messageTopicForum" + TypeMessageTopicDirectMessages = "messageTopicDirectMessages" + TypeMessageTopicSavedMessages = "messageTopicSavedMessages" + TypeMessageEffectTypeEmojiReaction = "messageEffectTypeEmojiReaction" + TypeMessageEffectTypePremiumSticker = "messageEffectTypePremiumSticker" + TypeMessageEffect = "messageEffect" TypeMessageSendingStatePending = "messageSendingStatePending" TypeMessageSendingStateFailed = "messageSendingStateFailed" + TypeTextQuote = "textQuote" + TypeInputTextQuote = "inputTextQuote" TypeMessageReplyToMessage = "messageReplyToMessage" TypeMessageReplyToStory = "messageReplyToStory" TypeInputMessageReplyToMessage = "inputMessageReplyToMessage" + TypeInputMessageReplyToExternalMessage = "inputMessageReplyToExternalMessage" TypeInputMessageReplyToStory = "inputMessageReplyToStory" + TypeFactCheck = "factCheck" TypeMessage = "message" TypeMessages = "messages" TypeFoundMessages = "foundMessages" TypeFoundChatMessages = "foundChatMessages" + TypeFoundPublicPosts = "foundPublicPosts" TypeMessagePosition = "messagePosition" TypeMessagePositions = "messagePositions" TypeMessageCalendarDay = "messageCalendarDay" TypeMessageCalendar = "messageCalendar" + TypeBusinessMessage = "businessMessage" + TypeBusinessMessages = "businessMessages" TypeMessageSourceChatHistory = "messageSourceChatHistory" TypeMessageSourceMessageThreadHistory = "messageSourceMessageThreadHistory" TypeMessageSourceForumTopicHistory = "messageSourceForumTopicHistory" + TypeMessageSourceDirectMessagesChatTopicHistory = "messageSourceDirectMessagesChatTopicHistory" TypeMessageSourceHistoryPreview = "messageSourceHistoryPreview" TypeMessageSourceChatList = "messageSourceChatList" TypeMessageSourceSearch = "messageSourceSearch" @@ -670,13 +1176,19 @@ const ( TypeMessageSourceNotification = "messageSourceNotification" TypeMessageSourceScreenshot = "messageSourceScreenshot" TypeMessageSourceOther = "messageSourceOther" - TypeMessageSponsorTypeBot = "messageSponsorTypeBot" - TypeMessageSponsorTypePublicChannel = "messageSponsorTypePublicChannel" - TypeMessageSponsorTypePrivateChannel = "messageSponsorTypePrivateChannel" - TypeMessageSponsorTypeWebsite = "messageSponsorTypeWebsite" - TypeMessageSponsor = "messageSponsor" + TypeAdvertisementSponsor = "advertisementSponsor" TypeSponsoredMessage = "sponsoredMessage" TypeSponsoredMessages = "sponsoredMessages" + TypeSponsoredChat = "sponsoredChat" + TypeSponsoredChats = "sponsoredChats" + TypeVideoMessageAdvertisement = "videoMessageAdvertisement" + TypeVideoMessageAdvertisements = "videoMessageAdvertisements" + TypeReportOption = "reportOption" + TypeReportSponsoredResultOk = "reportSponsoredResultOk" + TypeReportSponsoredResultFailed = "reportSponsoredResultFailed" + TypeReportSponsoredResultOptionRequired = "reportSponsoredResultOptionRequired" + TypeReportSponsoredResultAdsHidden = "reportSponsoredResultAdsHidden" + TypeReportSponsoredResultPremiumRequired = "reportSponsoredResultPremiumRequired" TypeFileDownload = "fileDownload" TypeDownloadedFileCounts = "downloadedFileCounts" TypeFoundFileDownloads = "foundFileDownloads" @@ -685,12 +1197,17 @@ const ( TypeNotificationSettingsScopeChannelChats = "notificationSettingsScopeChannelChats" TypeChatNotificationSettings = "chatNotificationSettings" TypeScopeNotificationSettings = "scopeNotificationSettings" + TypeReactionNotificationSourceNone = "reactionNotificationSourceNone" + TypeReactionNotificationSourceContacts = "reactionNotificationSourceContacts" + TypeReactionNotificationSourceAll = "reactionNotificationSourceAll" + TypeReactionNotificationSettings = "reactionNotificationSettings" TypeDraftMessage = "draftMessage" TypeChatTypePrivate = "chatTypePrivate" TypeChatTypeBasicGroup = "chatTypeBasicGroup" TypeChatTypeSupergroup = "chatTypeSupergroup" TypeChatTypeSecret = "chatTypeSecret" TypeChatFolderIcon = "chatFolderIcon" + TypeChatFolderName = "chatFolderName" TypeChatFolder = "chatFolder" TypeChatFolderInfo = "chatFolderInfo" TypeChatFolderInviteLink = "chatFolderInviteLink" @@ -708,25 +1225,33 @@ const ( TypeChatPosition = "chatPosition" TypeChatAvailableReactionsAll = "chatAvailableReactionsAll" TypeChatAvailableReactionsSome = "chatAvailableReactionsSome" + TypeSavedMessagesTag = "savedMessagesTag" + TypeSavedMessagesTags = "savedMessagesTags" + TypeBusinessBotManageBar = "businessBotManageBar" TypeVideoChat = "videoChat" TypeChat = "chat" TypeChats = "chats" - TypeChatNearby = "chatNearby" - TypeChatsNearby = "chatsNearby" + TypeFailedToAddMember = "failedToAddMember" + TypeFailedToAddMembers = "failedToAddMembers" + TypeCreatedBasicGroupChat = "createdBasicGroupChat" TypePublicChatTypeHasUsername = "publicChatTypeHasUsername" TypePublicChatTypeIsLocationBased = "publicChatTypeIsLocationBased" + TypeAccountInfo = "accountInfo" TypeChatActionBarReportSpam = "chatActionBarReportSpam" - TypeChatActionBarReportUnrelatedLocation = "chatActionBarReportUnrelatedLocation" TypeChatActionBarInviteMembers = "chatActionBarInviteMembers" TypeChatActionBarReportAddBlock = "chatActionBarReportAddBlock" TypeChatActionBarAddContact = "chatActionBarAddContact" TypeChatActionBarSharePhoneNumber = "chatActionBarSharePhoneNumber" TypeChatActionBarJoinRequest = "chatActionBarJoinRequest" + TypeButtonStyleDefault = "buttonStyleDefault" + TypeButtonStylePrimary = "buttonStylePrimary" + TypeButtonStyleDanger = "buttonStyleDanger" + TypeButtonStyleSuccess = "buttonStyleSuccess" TypeKeyboardButtonTypeText = "keyboardButtonTypeText" TypeKeyboardButtonTypeRequestPhoneNumber = "keyboardButtonTypeRequestPhoneNumber" TypeKeyboardButtonTypeRequestLocation = "keyboardButtonTypeRequestLocation" TypeKeyboardButtonTypeRequestPoll = "keyboardButtonTypeRequestPoll" - TypeKeyboardButtonTypeRequestUser = "keyboardButtonTypeRequestUser" + TypeKeyboardButtonTypeRequestUsers = "keyboardButtonTypeRequestUsers" TypeKeyboardButtonTypeRequestChat = "keyboardButtonTypeRequestChat" TypeKeyboardButtonTypeWebApp = "keyboardButtonTypeWebApp" TypeKeyboardButton = "keyboardButton" @@ -739,6 +1264,7 @@ const ( TypeInlineKeyboardButtonTypeSwitchInline = "inlineKeyboardButtonTypeSwitchInline" TypeInlineKeyboardButtonTypeBuy = "inlineKeyboardButtonTypeBuy" TypeInlineKeyboardButtonTypeUser = "inlineKeyboardButtonTypeUser" + TypeInlineKeyboardButtonTypeCopyText = "inlineKeyboardButtonTypeCopyText" TypeInlineKeyboardButton = "inlineKeyboardButton" TypeReplyMarkupRemoveKeyboard = "replyMarkupRemoveKeyboard" TypeReplyMarkupForceReply = "replyMarkupForceReply" @@ -746,14 +1272,33 @@ const ( TypeReplyMarkupInlineKeyboard = "replyMarkupInlineKeyboard" TypeLoginUrlInfoOpen = "loginUrlInfoOpen" TypeLoginUrlInfoRequestConfirmation = "loginUrlInfoRequestConfirmation" + TypeThemeParameters = "themeParameters" + TypeWebAppOpenModeCompact = "webAppOpenModeCompact" + TypeWebAppOpenModeFullSize = "webAppOpenModeFullSize" + TypeWebAppOpenModeFullScreen = "webAppOpenModeFullScreen" TypeFoundWebApp = "foundWebApp" TypeWebAppInfo = "webAppInfo" + TypeMainWebApp = "mainWebApp" + TypeWebAppOpenParameters = "webAppOpenParameters" TypeMessageThreadInfo = "messageThreadInfo" + TypeSavedMessagesTopicTypeMyNotes = "savedMessagesTopicTypeMyNotes" + TypeSavedMessagesTopicTypeAuthorHidden = "savedMessagesTopicTypeAuthorHidden" + TypeSavedMessagesTopicTypeSavedFromChat = "savedMessagesTopicTypeSavedFromChat" + TypeSavedMessagesTopic = "savedMessagesTopic" + TypeDirectMessagesChatTopic = "directMessagesChatTopic" TypeForumTopicIcon = "forumTopicIcon" TypeForumTopicInfo = "forumTopicInfo" TypeForumTopic = "forumTopic" TypeForumTopics = "forumTopics" TypeLinkPreviewOptions = "linkPreviewOptions" + TypeSharedUser = "sharedUser" + TypeSharedChat = "sharedChat" + TypeBuiltInThemeClassic = "builtInThemeClassic" + TypeBuiltInThemeDay = "builtInThemeDay" + TypeBuiltInThemeNight = "builtInThemeNight" + TypeBuiltInThemeTinted = "builtInThemeTinted" + TypeBuiltInThemeArctic = "builtInThemeArctic" + TypeThemeSettings = "themeSettings" TypeRichTextPlain = "richTextPlain" TypeRichTextBold = "richTextBold" TypeRichTextItalic = "richTextItalic" @@ -811,14 +1356,57 @@ const ( TypePageBlockRelatedArticles = "pageBlockRelatedArticles" TypePageBlockMap = "pageBlockMap" TypeWebPageInstantView = "webPageInstantView" - TypeWebPage = "webPage" + TypeLinkPreviewAlbumMediaPhoto = "linkPreviewAlbumMediaPhoto" + TypeLinkPreviewAlbumMediaVideo = "linkPreviewAlbumMediaVideo" + TypeLinkPreviewTypeAlbum = "linkPreviewTypeAlbum" + TypeLinkPreviewTypeAnimation = "linkPreviewTypeAnimation" + TypeLinkPreviewTypeApp = "linkPreviewTypeApp" + TypeLinkPreviewTypeArticle = "linkPreviewTypeArticle" + TypeLinkPreviewTypeAudio = "linkPreviewTypeAudio" + TypeLinkPreviewTypeBackground = "linkPreviewTypeBackground" + TypeLinkPreviewTypeChannelBoost = "linkPreviewTypeChannelBoost" + TypeLinkPreviewTypeChat = "linkPreviewTypeChat" + TypeLinkPreviewTypeDirectMessagesChat = "linkPreviewTypeDirectMessagesChat" + TypeLinkPreviewTypeDocument = "linkPreviewTypeDocument" + TypeLinkPreviewTypeEmbeddedAnimationPlayer = "linkPreviewTypeEmbeddedAnimationPlayer" + TypeLinkPreviewTypeEmbeddedAudioPlayer = "linkPreviewTypeEmbeddedAudioPlayer" + TypeLinkPreviewTypeEmbeddedVideoPlayer = "linkPreviewTypeEmbeddedVideoPlayer" + TypeLinkPreviewTypeExternalAudio = "linkPreviewTypeExternalAudio" + TypeLinkPreviewTypeExternalVideo = "linkPreviewTypeExternalVideo" + TypeLinkPreviewTypeGiftAuction = "linkPreviewTypeGiftAuction" + TypeLinkPreviewTypeGiftCollection = "linkPreviewTypeGiftCollection" + TypeLinkPreviewTypeGroupCall = "linkPreviewTypeGroupCall" + TypeLinkPreviewTypeInvoice = "linkPreviewTypeInvoice" + TypeLinkPreviewTypeLiveStory = "linkPreviewTypeLiveStory" + TypeLinkPreviewTypeMessage = "linkPreviewTypeMessage" + TypeLinkPreviewTypePhoto = "linkPreviewTypePhoto" + TypeLinkPreviewTypePremiumGiftCode = "linkPreviewTypePremiumGiftCode" + TypeLinkPreviewTypeShareableChatFolder = "linkPreviewTypeShareableChatFolder" + TypeLinkPreviewTypeSticker = "linkPreviewTypeSticker" + TypeLinkPreviewTypeStickerSet = "linkPreviewTypeStickerSet" + TypeLinkPreviewTypeStory = "linkPreviewTypeStory" + TypeLinkPreviewTypeStoryAlbum = "linkPreviewTypeStoryAlbum" + TypeLinkPreviewTypeSupergroupBoost = "linkPreviewTypeSupergroupBoost" + TypeLinkPreviewTypeTheme = "linkPreviewTypeTheme" + TypeLinkPreviewTypeUnsupported = "linkPreviewTypeUnsupported" + TypeLinkPreviewTypeUpgradedGift = "linkPreviewTypeUpgradedGift" + TypeLinkPreviewTypeUser = "linkPreviewTypeUser" + TypeLinkPreviewTypeVideo = "linkPreviewTypeVideo" + TypeLinkPreviewTypeVideoChat = "linkPreviewTypeVideoChat" + TypeLinkPreviewTypeVideoNote = "linkPreviewTypeVideoNote" + TypeLinkPreviewTypeVoiceNote = "linkPreviewTypeVoiceNote" + TypeLinkPreviewTypeWebApp = "linkPreviewTypeWebApp" + TypeLinkPreview = "linkPreview" TypeCountryInfo = "countryInfo" TypeCountries = "countries" TypePhoneNumberInfo = "phoneNumberInfo" + TypeCollectibleItemTypeUsername = "collectibleItemTypeUsername" + TypeCollectibleItemTypePhoneNumber = "collectibleItemTypePhoneNumber" + TypeCollectibleItemInfo = "collectibleItemInfo" TypeBankCardActionOpenUrl = "bankCardActionOpenUrl" TypeBankCardInfo = "bankCardInfo" TypeAddress = "address" - TypeThemeParameters = "themeParameters" + TypeLocationAddress = "locationAddress" TypeLabeledPricePart = "labeledPricePart" TypeInvoice = "invoice" TypeOrderInfo = "orderInfo" @@ -832,18 +1420,23 @@ const ( TypePaymentProviderStripe = "paymentProviderStripe" TypePaymentProviderOther = "paymentProviderOther" TypePaymentOption = "paymentOption" + TypePaymentFormTypeRegular = "paymentFormTypeRegular" + TypePaymentFormTypeStars = "paymentFormTypeStars" + TypePaymentFormTypeStarSubscription = "paymentFormTypeStarSubscription" TypePaymentForm = "paymentForm" TypeValidatedOrderInfo = "validatedOrderInfo" TypePaymentResult = "paymentResult" + TypePaymentReceiptTypeRegular = "paymentReceiptTypeRegular" + TypePaymentReceiptTypeStars = "paymentReceiptTypeStars" TypePaymentReceipt = "paymentReceipt" TypeInputInvoiceMessage = "inputInvoiceMessage" TypeInputInvoiceName = "inputInvoiceName" TypeInputInvoiceTelegram = "inputInvoiceTelegram" - TypeMessageExtendedMediaPreview = "messageExtendedMediaPreview" - TypeMessageExtendedMediaPhoto = "messageExtendedMediaPhoto" - TypeMessageExtendedMediaVideo = "messageExtendedMediaVideo" - TypeMessageExtendedMediaUnsupported = "messageExtendedMediaUnsupported" - TypePremiumGiveawayParameters = "premiumGiveawayParameters" + TypePaidMediaPreview = "paidMediaPreview" + TypePaidMediaPhoto = "paidMediaPhoto" + TypePaidMediaVideo = "paidMediaVideo" + TypePaidMediaUnsupported = "paidMediaUnsupported" + TypeGiveawayParameters = "giveawayParameters" TypeDatedFile = "datedFile" TypePassportElementTypePersonalDetails = "passportElementTypePersonalDetails" TypePassportElementTypePassport = "passportElementTypePassport" @@ -921,13 +1514,16 @@ const ( TypeMessageAnimation = "messageAnimation" TypeMessageAudio = "messageAudio" TypeMessageDocument = "messageDocument" + TypeMessagePaidMedia = "messagePaidMedia" TypeMessagePhoto = "messagePhoto" - TypeMessageExpiredPhoto = "messageExpiredPhoto" TypeMessageSticker = "messageSticker" TypeMessageVideo = "messageVideo" - TypeMessageExpiredVideo = "messageExpiredVideo" TypeMessageVideoNote = "messageVideoNote" TypeMessageVoiceNote = "messageVoiceNote" + TypeMessageExpiredPhoto = "messageExpiredPhoto" + TypeMessageExpiredVideo = "messageExpiredVideo" + TypeMessageExpiredVideoNote = "messageExpiredVideoNote" + TypeMessageExpiredVoiceNote = "messageExpiredVoiceNote" TypeMessageLocation = "messageLocation" TypeMessageVenue = "messageVenue" TypeMessageContact = "messageContact" @@ -935,9 +1531,12 @@ const ( TypeMessageDice = "messageDice" TypeMessageGame = "messageGame" TypeMessagePoll = "messagePoll" + TypeMessageStakeDice = "messageStakeDice" TypeMessageStory = "messageStory" + TypeMessageChecklist = "messageChecklist" TypeMessageInvoice = "messageInvoice" TypeMessageCall = "messageCall" + TypeMessageGroupCall = "messageGroupCall" TypeMessageVideoChatScheduled = "messageVideoChatScheduled" TypeMessageVideoChatStarted = "messageVideoChatStarted" TypeMessageVideoChatEnded = "messageVideoChatEnded" @@ -947,6 +1546,8 @@ const ( TypeMessageChatChangeTitle = "messageChatChangeTitle" TypeMessageChatChangePhoto = "messageChatChangePhoto" TypeMessageChatDeletePhoto = "messageChatDeletePhoto" + TypeMessageChatOwnerLeft = "messageChatOwnerLeft" + TypeMessageChatOwnerChanged = "messageChatOwnerChanged" TypeMessageChatAddMembers = "messageChatAddMembers" TypeMessageChatJoinByLink = "messageChatJoinByLink" TypeMessageChatJoinByRequest = "messageChatJoinByRequest" @@ -958,21 +1559,44 @@ const ( TypeMessageChatSetBackground = "messageChatSetBackground" TypeMessageChatSetTheme = "messageChatSetTheme" TypeMessageChatSetMessageAutoDeleteTime = "messageChatSetMessageAutoDeleteTime" + TypeMessageChatBoost = "messageChatBoost" TypeMessageForumTopicCreated = "messageForumTopicCreated" TypeMessageForumTopicEdited = "messageForumTopicEdited" TypeMessageForumTopicIsClosedToggled = "messageForumTopicIsClosedToggled" TypeMessageForumTopicIsHiddenToggled = "messageForumTopicIsHiddenToggled" TypeMessageSuggestProfilePhoto = "messageSuggestProfilePhoto" + TypeMessageSuggestBirthdate = "messageSuggestBirthdate" TypeMessageCustomServiceAction = "messageCustomServiceAction" TypeMessageGameScore = "messageGameScore" TypeMessagePaymentSuccessful = "messagePaymentSuccessful" TypeMessagePaymentSuccessfulBot = "messagePaymentSuccessfulBot" + TypeMessagePaymentRefunded = "messagePaymentRefunded" TypeMessageGiftedPremium = "messageGiftedPremium" TypeMessagePremiumGiftCode = "messagePremiumGiftCode" - TypeMessagePremiumGiveawayCreated = "messagePremiumGiveawayCreated" - TypeMessagePremiumGiveaway = "messagePremiumGiveaway" + TypeMessageGiveawayCreated = "messageGiveawayCreated" + TypeMessageGiveaway = "messageGiveaway" + TypeMessageGiveawayCompleted = "messageGiveawayCompleted" + TypeMessageGiveawayWinners = "messageGiveawayWinners" + TypeMessageGiftedStars = "messageGiftedStars" + TypeMessageGiftedTon = "messageGiftedTon" + TypeMessageGiveawayPrizeStars = "messageGiveawayPrizeStars" + TypeMessageGift = "messageGift" + TypeMessageUpgradedGift = "messageUpgradedGift" + TypeMessageRefundedUpgradedGift = "messageRefundedUpgradedGift" + TypeMessageUpgradedGiftPurchaseOffer = "messageUpgradedGiftPurchaseOffer" + TypeMessageUpgradedGiftPurchaseOfferRejected = "messageUpgradedGiftPurchaseOfferRejected" + TypeMessagePaidMessagesRefunded = "messagePaidMessagesRefunded" + TypeMessagePaidMessagePriceChanged = "messagePaidMessagePriceChanged" + TypeMessageDirectMessagePriceChanged = "messageDirectMessagePriceChanged" + TypeMessageChecklistTasksDone = "messageChecklistTasksDone" + TypeMessageChecklistTasksAdded = "messageChecklistTasksAdded" + TypeMessageSuggestedPostApprovalFailed = "messageSuggestedPostApprovalFailed" + TypeMessageSuggestedPostApproved = "messageSuggestedPostApproved" + TypeMessageSuggestedPostDeclined = "messageSuggestedPostDeclined" + TypeMessageSuggestedPostPaid = "messageSuggestedPostPaid" + TypeMessageSuggestedPostRefunded = "messageSuggestedPostRefunded" TypeMessageContactRegistered = "messageContactRegistered" - TypeMessageUserShared = "messageUserShared" + TypeMessageUsersShared = "messageUsersShared" TypeMessageChatShared = "messageChatShared" TypeMessageBotWriteAccessAllowed = "messageBotWriteAccessAllowed" TypeMessageWebAppDataSent = "messageWebAppDataSent" @@ -998,13 +1622,18 @@ const ( TypeTextEntityTypePre = "textEntityTypePre" TypeTextEntityTypePreCode = "textEntityTypePreCode" TypeTextEntityTypeBlockQuote = "textEntityTypeBlockQuote" + TypeTextEntityTypeExpandableBlockQuote = "textEntityTypeExpandableBlockQuote" TypeTextEntityTypeTextUrl = "textEntityTypeTextUrl" TypeTextEntityTypeMentionName = "textEntityTypeMentionName" TypeTextEntityTypeCustomEmoji = "textEntityTypeCustomEmoji" TypeTextEntityTypeMediaTimestamp = "textEntityTypeMediaTimestamp" TypeInputThumbnail = "inputThumbnail" + TypeInputPaidMediaTypePhoto = "inputPaidMediaTypePhoto" + TypeInputPaidMediaTypeVideo = "inputPaidMediaTypeVideo" + TypeInputPaidMedia = "inputPaidMedia" TypeMessageSchedulingStateSendAtDate = "messageSchedulingStateSendAtDate" TypeMessageSchedulingStateSendWhenOnline = "messageSchedulingStateSendWhenOnline" + TypeMessageSchedulingStateSendWhenVideoProcessed = "messageSchedulingStateSendWhenVideoProcessed" TypeMessageSelfDestructTypeTimer = "messageSelfDestructTypeTimer" TypeMessageSelfDestructTypeImmediately = "messageSelfDestructTypeImmediately" TypeMessageSendOptions = "messageSendOptions" @@ -1013,6 +1642,7 @@ const ( TypeInputMessageAnimation = "inputMessageAnimation" TypeInputMessageAudio = "inputMessageAudio" TypeInputMessageDocument = "inputMessageDocument" + TypeInputMessagePaidMedia = "inputMessagePaidMedia" TypeInputMessagePhoto = "inputMessagePhoto" TypeInputMessageSticker = "inputMessageSticker" TypeInputMessageVideo = "inputMessageVideo" @@ -1025,8 +1655,11 @@ const ( TypeInputMessageGame = "inputMessageGame" TypeInputMessageInvoice = "inputMessageInvoice" TypeInputMessagePoll = "inputMessagePoll" + TypeInputMessageStakeDice = "inputMessageStakeDice" TypeInputMessageStory = "inputMessageStory" + TypeInputMessageChecklist = "inputMessageChecklist" TypeInputMessageForwarded = "inputMessageForwarded" + TypeMessageProperties = "messageProperties" TypeSearchMessagesFilterEmpty = "searchMessagesFilterEmpty" TypeSearchMessagesFilterAnimation = "searchMessagesFilterAnimation" TypeSearchMessagesFilterAudio = "searchMessagesFilterAudio" @@ -1044,6 +1677,9 @@ const ( TypeSearchMessagesFilterUnreadReaction = "searchMessagesFilterUnreadReaction" TypeSearchMessagesFilterFailedToSend = "searchMessagesFilterFailedToSend" TypeSearchMessagesFilterPinned = "searchMessagesFilterPinned" + TypeSearchMessagesChatTypeFilterPrivate = "searchMessagesChatTypeFilterPrivate" + TypeSearchMessagesChatTypeFilterGroup = "searchMessagesChatTypeFilterGroup" + TypeSearchMessagesChatTypeFilterChannel = "searchMessagesChatTypeFilterChannel" TypeChatActionTyping = "chatActionTyping" TypeChatActionRecordingVideo = "chatActionRecordingVideo" TypeChatActionUploadingVideo = "chatActionUploadingVideo" @@ -1065,57 +1701,100 @@ const ( TypeUserStatusRecently = "userStatusRecently" TypeUserStatusLastWeek = "userStatusLastWeek" TypeUserStatusLastMonth = "userStatusLastMonth" + TypeEmojiKeyword = "emojiKeyword" + TypeEmojiKeywords = "emojiKeywords" TypeStickers = "stickers" TypeEmojis = "emojis" TypeStickerSet = "stickerSet" TypeStickerSetInfo = "stickerSetInfo" TypeStickerSets = "stickerSets" TypeTrendingStickerSets = "trendingStickerSets" + TypeEmojiCategorySourceSearch = "emojiCategorySourceSearch" + TypeEmojiCategorySourcePremium = "emojiCategorySourcePremium" TypeEmojiCategory = "emojiCategory" TypeEmojiCategories = "emojiCategories" TypeEmojiCategoryTypeDefault = "emojiCategoryTypeDefault" + TypeEmojiCategoryTypeRegularStickers = "emojiCategoryTypeRegularStickers" TypeEmojiCategoryTypeEmojiStatus = "emojiCategoryTypeEmojiStatus" TypeEmojiCategoryTypeChatPhoto = "emojiCategoryTypeChatPhoto" - TypeStoryViewer = "storyViewer" - TypeStoryViewers = "storyViewers" + TypeCurrentWeather = "currentWeather" TypeStoryAreaPosition = "storyAreaPosition" TypeStoryAreaTypeLocation = "storyAreaTypeLocation" TypeStoryAreaTypeVenue = "storyAreaTypeVenue" TypeStoryAreaTypeSuggestedReaction = "storyAreaTypeSuggestedReaction" + TypeStoryAreaTypeMessage = "storyAreaTypeMessage" + TypeStoryAreaTypeLink = "storyAreaTypeLink" + TypeStoryAreaTypeWeather = "storyAreaTypeWeather" + TypeStoryAreaTypeUpgradedGift = "storyAreaTypeUpgradedGift" TypeStoryArea = "storyArea" TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" TypeInputStoryAreaTypePreviousVenue = "inputStoryAreaTypePreviousVenue" TypeInputStoryAreaTypeSuggestedReaction = "inputStoryAreaTypeSuggestedReaction" + TypeInputStoryAreaTypeMessage = "inputStoryAreaTypeMessage" + TypeInputStoryAreaTypeLink = "inputStoryAreaTypeLink" + TypeInputStoryAreaTypeWeather = "inputStoryAreaTypeWeather" + TypeInputStoryAreaTypeUpgradedGift = "inputStoryAreaTypeUpgradedGift" TypeInputStoryArea = "inputStoryArea" TypeInputStoryAreas = "inputStoryAreas" TypeStoryVideo = "storyVideo" + TypeStoryContentTypePhoto = "storyContentTypePhoto" + TypeStoryContentTypeVideo = "storyContentTypeVideo" + TypeStoryContentTypeLive = "storyContentTypeLive" + TypeStoryContentTypeUnsupported = "storyContentTypeUnsupported" TypeStoryContentPhoto = "storyContentPhoto" TypeStoryContentVideo = "storyContentVideo" + TypeStoryContentLive = "storyContentLive" TypeStoryContentUnsupported = "storyContentUnsupported" TypeInputStoryContentPhoto = "inputStoryContentPhoto" TypeInputStoryContentVideo = "inputStoryContentVideo" TypeStoryListMain = "storyListMain" TypeStoryListArchive = "storyListArchive" + TypeStoryOriginPublicStory = "storyOriginPublicStory" + TypeStoryOriginHiddenUser = "storyOriginHiddenUser" + TypeStoryRepostInfo = "storyRepostInfo" TypeStoryInteractionInfo = "storyInteractionInfo" TypeStory = "story" TypeStories = "stories" + TypeFoundStories = "foundStories" + TypeStoryAlbum = "storyAlbum" + TypeStoryAlbums = "storyAlbums" + TypeStoryFullId = "storyFullId" TypeStoryInfo = "storyInfo" TypeChatActiveStories = "chatActiveStories" + TypeStoryInteractionTypeView = "storyInteractionTypeView" + TypeStoryInteractionTypeForward = "storyInteractionTypeForward" + TypeStoryInteractionTypeRepost = "storyInteractionTypeRepost" + TypeStoryInteraction = "storyInteraction" + TypeStoryInteractions = "storyInteractions" + TypeQuickReplyMessage = "quickReplyMessage" + TypeQuickReplyMessages = "quickReplyMessages" + TypeQuickReplyShortcut = "quickReplyShortcut" + TypePublicForwardMessage = "publicForwardMessage" + TypePublicForwardStory = "publicForwardStory" + TypePublicForwards = "publicForwards" + TypeBotMediaPreview = "botMediaPreview" + TypeBotMediaPreviews = "botMediaPreviews" + TypeBotMediaPreviewInfo = "botMediaPreviewInfo" + TypeChatBoostLevelFeatures = "chatBoostLevelFeatures" + TypeChatBoostFeatures = "chatBoostFeatures" TypeChatBoostSourceGiftCode = "chatBoostSourceGiftCode" TypeChatBoostSourceGiveaway = "chatBoostSourceGiveaway" TypeChatBoostSourcePremium = "chatBoostSourcePremium" - TypePrepaidPremiumGiveaway = "prepaidPremiumGiveaway" + TypePrepaidGiveaway = "prepaidGiveaway" TypeChatBoostStatus = "chatBoostStatus" TypeChatBoost = "chatBoost" TypeFoundChatBoosts = "foundChatBoosts" TypeChatBoostSlot = "chatBoostSlot" TypeChatBoostSlots = "chatBoostSlots" + TypeResendCodeReasonUserRequest = "resendCodeReasonUserRequest" + TypeResendCodeReasonVerificationFailed = "resendCodeReasonVerificationFailed" TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty" TypeCallDiscardReasonMissed = "callDiscardReasonMissed" TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" TypeCallDiscardReasonDisconnected = "callDiscardReasonDisconnected" TypeCallDiscardReasonHungUp = "callDiscardReasonHungUp" + TypeCallDiscardReasonUpgradeToGroupCall = "callDiscardReasonUpgradeToGroupCall" TypeCallProtocol = "callProtocol" TypeCallServerTypeTelegramReflector = "callServerTypeTelegramReflector" TypeCallServerTypeWebrtc = "callServerTypeWebrtc" @@ -1128,6 +1807,7 @@ const ( TypeCallStateHangingUp = "callStateHangingUp" TypeCallStateDiscarded = "callStateDiscarded" TypeCallStateError = "callStateError" + TypeGroupCallJoinParameters = "groupCallJoinParameters" TypeGroupCallVideoQualityThumbnail = "groupCallVideoQualityThumbnail" TypeGroupCallVideoQualityMedium = "groupCallVideoQualityMedium" TypeGroupCallVideoQualityFull = "groupCallVideoQualityFull" @@ -1139,6 +1819,18 @@ const ( TypeGroupCallVideoSourceGroup = "groupCallVideoSourceGroup" TypeGroupCallParticipantVideoInfo = "groupCallParticipantVideoInfo" TypeGroupCallParticipant = "groupCallParticipant" + TypeGroupCallParticipants = "groupCallParticipants" + TypeGroupCallInfo = "groupCallInfo" + TypeGroupCallMessage = "groupCallMessage" + TypeGroupCallMessageLevel = "groupCallMessageLevel" + TypeInviteGroupCallParticipantResultUserPrivacyRestricted = "inviteGroupCallParticipantResultUserPrivacyRestricted" + TypeInviteGroupCallParticipantResultUserAlreadyParticipant = "inviteGroupCallParticipantResultUserAlreadyParticipant" + TypeInviteGroupCallParticipantResultUserWasBanned = "inviteGroupCallParticipantResultUserWasBanned" + TypeInviteGroupCallParticipantResultSuccess = "inviteGroupCallParticipantResultSuccess" + TypeGroupCallDataChannelMain = "groupCallDataChannelMain" + TypeGroupCallDataChannelScreenSharing = "groupCallDataChannelScreenSharing" + TypeInputGroupCallLink = "inputGroupCallLink" + TypeInputGroupCallMessage = "inputGroupCallMessage" TypeCallProblemEcho = "callProblemEcho" TypeCallProblemNoise = "callProblemNoise" TypeCallProblemInterruptions = "callProblemInterruptions" @@ -1157,13 +1849,17 @@ const ( TypeAvailableReaction = "availableReaction" TypeAvailableReactions = "availableReactions" TypeEmojiReaction = "emojiReaction" + TypeReactionUnavailabilityReasonAnonymousAdministrator = "reactionUnavailabilityReasonAnonymousAdministrator" + TypeReactionUnavailabilityReasonGuest = "reactionUnavailabilityReasonGuest" TypeAnimations = "animations" TypeDiceStickersRegular = "diceStickersRegular" TypeDiceStickersSlotMachine = "diceStickersSlotMachine" + TypeImportedContact = "importedContact" TypeImportedContacts = "importedContacts" TypeSpeechRecognitionResultPending = "speechRecognitionResultPending" TypeSpeechRecognitionResultText = "speechRecognitionResultText" TypeSpeechRecognitionResultError = "speechRecognitionResultError" + TypeBusinessConnection = "businessConnection" TypeAttachmentMenuBotColor = "attachmentMenuBotColor" TypeAttachmentMenuBot = "attachmentMenuBot" TypeSentWebAppMessage = "sentWebAppMessage" @@ -1173,6 +1869,10 @@ const ( TypeBotWriteAccessAllowReasonAcceptedRequest = "botWriteAccessAllowReasonAcceptedRequest" TypeHttpUrl = "httpUrl" TypeUserLink = "userLink" + TypeTargetChatTypes = "targetChatTypes" + TypeTargetChatCurrent = "targetChatCurrent" + TypeTargetChatChosen = "targetChatChosen" + TypeTargetChatInternalLink = "targetChatInternalLink" TypeInputInlineQueryResultAnimation = "inputInlineQueryResultAnimation" TypeInputInlineQueryResultArticle = "inputInlineQueryResultArticle" TypeInputInlineQueryResultAudio = "inputInlineQueryResultAudio" @@ -1201,6 +1901,8 @@ const ( TypeInlineQueryResultsButtonTypeWebApp = "inlineQueryResultsButtonTypeWebApp" TypeInlineQueryResultsButton = "inlineQueryResultsButton" TypeInlineQueryResults = "inlineQueryResults" + TypePreparedInlineMessageId = "preparedInlineMessageId" + TypePreparedInlineMessage = "preparedInlineMessage" TypeCallbackQueryPayloadData = "callbackQueryPayloadData" TypeCallbackQueryPayloadDataWithPassword = "callbackQueryPayloadDataWithPassword" TypeCallbackQueryPayloadGame = "callbackQueryPayloadGame" @@ -1220,8 +1922,11 @@ const ( TypeChatEventMemberLeft = "chatEventMemberLeft" TypeChatEventMemberPromoted = "chatEventMemberPromoted" TypeChatEventMemberRestricted = "chatEventMemberRestricted" + TypeChatEventMemberSubscriptionExtended = "chatEventMemberSubscriptionExtended" TypeChatEventAvailableReactionsChanged = "chatEventAvailableReactionsChanged" + TypeChatEventBackgroundChanged = "chatEventBackgroundChanged" TypeChatEventDescriptionChanged = "chatEventDescriptionChanged" + TypeChatEventEmojiStatusChanged = "chatEventEmojiStatusChanged" TypeChatEventLinkedChatChanged = "chatEventLinkedChatChanged" TypeChatEventLocationChanged = "chatEventLocationChanged" TypeChatEventMessageAutoDeleteTimeChanged = "chatEventMessageAutoDeleteTimeChanged" @@ -1229,16 +1934,19 @@ const ( TypeChatEventPhotoChanged = "chatEventPhotoChanged" TypeChatEventSlowModeDelayChanged = "chatEventSlowModeDelayChanged" TypeChatEventStickerSetChanged = "chatEventStickerSetChanged" + TypeChatEventCustomEmojiStickerSetChanged = "chatEventCustomEmojiStickerSetChanged" TypeChatEventTitleChanged = "chatEventTitleChanged" TypeChatEventUsernameChanged = "chatEventUsernameChanged" TypeChatEventActiveUsernamesChanged = "chatEventActiveUsernamesChanged" TypeChatEventAccentColorChanged = "chatEventAccentColorChanged" - TypeChatEventBackgroundCustomEmojiChanged = "chatEventBackgroundCustomEmojiChanged" + TypeChatEventProfileAccentColorChanged = "chatEventProfileAccentColorChanged" TypeChatEventHasProtectedContentToggled = "chatEventHasProtectedContentToggled" TypeChatEventInvitesToggled = "chatEventInvitesToggled" TypeChatEventIsAllHistoryAvailableToggled = "chatEventIsAllHistoryAvailableToggled" TypeChatEventHasAggressiveAntiSpamEnabledToggled = "chatEventHasAggressiveAntiSpamEnabledToggled" TypeChatEventSignMessagesToggled = "chatEventSignMessagesToggled" + TypeChatEventShowMessageSenderToggled = "chatEventShowMessageSenderToggled" + TypeChatEventAutomaticTranslationToggled = "chatEventAutomaticTranslationToggled" TypeChatEventInviteLinkEdited = "chatEventInviteLinkEdited" TypeChatEventInviteLinkRevoked = "chatEventInviteLinkRevoked" TypeChatEventInviteLinkDeleted = "chatEventInviteLinkDeleted" @@ -1272,15 +1980,17 @@ const ( TypePremiumLimitTypeChatFolderCount = "premiumLimitTypeChatFolderCount" TypePremiumLimitTypeChatFolderChosenChatCount = "premiumLimitTypeChatFolderChosenChatCount" TypePremiumLimitTypePinnedArchivedChatCount = "premiumLimitTypePinnedArchivedChatCount" + TypePremiumLimitTypePinnedSavedMessagesTopicCount = "premiumLimitTypePinnedSavedMessagesTopicCount" TypePremiumLimitTypeCaptionLength = "premiumLimitTypeCaptionLength" TypePremiumLimitTypeBioLength = "premiumLimitTypeBioLength" TypePremiumLimitTypeChatFolderInviteLinkCount = "premiumLimitTypeChatFolderInviteLinkCount" TypePremiumLimitTypeShareableChatFolderCount = "premiumLimitTypeShareableChatFolderCount" TypePremiumLimitTypeActiveStoryCount = "premiumLimitTypeActiveStoryCount" - TypePremiumLimitTypeWeeklySentStoryCount = "premiumLimitTypeWeeklySentStoryCount" - TypePremiumLimitTypeMonthlySentStoryCount = "premiumLimitTypeMonthlySentStoryCount" + TypePremiumLimitTypeWeeklyPostedStoryCount = "premiumLimitTypeWeeklyPostedStoryCount" + TypePremiumLimitTypeMonthlyPostedStoryCount = "premiumLimitTypeMonthlyPostedStoryCount" TypePremiumLimitTypeStoryCaptionLength = "premiumLimitTypeStoryCaptionLength" TypePremiumLimitTypeStorySuggestedReactionAreaCount = "premiumLimitTypeStorySuggestedReactionAreaCount" + TypePremiumLimitTypeSimilarChatCount = "premiumLimitTypeSimilarChatCount" TypePremiumFeatureIncreasedLimits = "premiumFeatureIncreasedLimits" TypePremiumFeatureIncreasedUploadFileSize = "premiumFeatureIncreasedUploadFileSize" TypePremiumFeatureImprovedDownloadSpeed = "premiumFeatureImprovedDownloadSpeed" @@ -1299,27 +2009,60 @@ const ( TypePremiumFeatureUpgradedStories = "premiumFeatureUpgradedStories" TypePremiumFeatureChatBoost = "premiumFeatureChatBoost" TypePremiumFeatureAccentColor = "premiumFeatureAccentColor" + TypePremiumFeatureBackgroundForBoth = "premiumFeatureBackgroundForBoth" + TypePremiumFeatureSavedMessagesTags = "premiumFeatureSavedMessagesTags" + TypePremiumFeatureMessagePrivacy = "premiumFeatureMessagePrivacy" + TypePremiumFeatureLastSeenTimes = "premiumFeatureLastSeenTimes" + TypePremiumFeatureBusiness = "premiumFeatureBusiness" + TypePremiumFeatureMessageEffects = "premiumFeatureMessageEffects" + TypePremiumFeatureChecklists = "premiumFeatureChecklists" + TypePremiumFeaturePaidMessages = "premiumFeaturePaidMessages" + TypeBusinessFeatureLocation = "businessFeatureLocation" + TypeBusinessFeatureOpeningHours = "businessFeatureOpeningHours" + TypeBusinessFeatureQuickReplies = "businessFeatureQuickReplies" + TypeBusinessFeatureGreetingMessage = "businessFeatureGreetingMessage" + TypeBusinessFeatureAwayMessage = "businessFeatureAwayMessage" + TypeBusinessFeatureAccountLinks = "businessFeatureAccountLinks" + TypeBusinessFeatureStartPage = "businessFeatureStartPage" + TypeBusinessFeatureBots = "businessFeatureBots" + TypeBusinessFeatureEmojiStatus = "businessFeatureEmojiStatus" + TypeBusinessFeatureChatFolderTags = "businessFeatureChatFolderTags" + TypeBusinessFeatureUpgradedStories = "businessFeatureUpgradedStories" TypePremiumStoryFeaturePriorityOrder = "premiumStoryFeaturePriorityOrder" TypePremiumStoryFeatureStealthMode = "premiumStoryFeatureStealthMode" TypePremiumStoryFeaturePermanentViewsHistory = "premiumStoryFeaturePermanentViewsHistory" TypePremiumStoryFeatureCustomExpirationDuration = "premiumStoryFeatureCustomExpirationDuration" TypePremiumStoryFeatureSaveStories = "premiumStoryFeatureSaveStories" TypePremiumStoryFeatureLinksAndFormatting = "premiumStoryFeatureLinksAndFormatting" + TypePremiumStoryFeatureVideoQuality = "premiumStoryFeatureVideoQuality" TypePremiumLimit = "premiumLimit" TypePremiumFeatures = "premiumFeatures" + TypeBusinessFeatures = "businessFeatures" TypePremiumSourceLimitExceeded = "premiumSourceLimitExceeded" TypePremiumSourceFeature = "premiumSourceFeature" + TypePremiumSourceBusinessFeature = "premiumSourceBusinessFeature" TypePremiumSourceStoryFeature = "premiumSourceStoryFeature" TypePremiumSourceLink = "premiumSourceLink" TypePremiumSourceSettings = "premiumSourceSettings" TypePremiumFeaturePromotionAnimation = "premiumFeaturePromotionAnimation" + TypeBusinessFeaturePromotionAnimation = "businessFeaturePromotionAnimation" TypePremiumState = "premiumState" TypeStorePaymentPurposePremiumSubscription = "storePaymentPurposePremiumSubscription" - TypeStorePaymentPurposeGiftedPremium = "storePaymentPurposeGiftedPremium" + TypeStorePaymentPurposePremiumGift = "storePaymentPurposePremiumGift" TypeStorePaymentPurposePremiumGiftCodes = "storePaymentPurposePremiumGiftCodes" TypeStorePaymentPurposePremiumGiveaway = "storePaymentPurposePremiumGiveaway" + TypeStorePaymentPurposeStarGiveaway = "storePaymentPurposeStarGiveaway" + TypeStorePaymentPurposeStars = "storePaymentPurposeStars" + TypeStorePaymentPurposeGiftedStars = "storePaymentPurposeGiftedStars" + TypeStoreTransactionAppStore = "storeTransactionAppStore" + TypeStoreTransactionGooglePlay = "storeTransactionGooglePlay" + TypeTelegramPaymentPurposePremiumGift = "telegramPaymentPurposePremiumGift" TypeTelegramPaymentPurposePremiumGiftCodes = "telegramPaymentPurposePremiumGiftCodes" TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" + TypeTelegramPaymentPurposeStars = "telegramPaymentPurposeStars" + TypeTelegramPaymentPurposeGiftedStars = "telegramPaymentPurposeGiftedStars" + TypeTelegramPaymentPurposeStarGiveaway = "telegramPaymentPurposeStarGiveaway" + TypeTelegramPaymentPurposeJoinChat = "telegramPaymentPurposeJoinChat" TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging" TypeDeviceTokenApplePush = "deviceTokenApplePush" TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" @@ -1339,18 +2082,29 @@ const ( TypeBackgroundTypeWallpaper = "backgroundTypeWallpaper" TypeBackgroundTypePattern = "backgroundTypePattern" TypeBackgroundTypeFill = "backgroundTypeFill" + TypeBackgroundTypeChatTheme = "backgroundTypeChatTheme" TypeInputBackgroundLocal = "inputBackgroundLocal" TypeInputBackgroundRemote = "inputBackgroundRemote" TypeInputBackgroundPrevious = "inputBackgroundPrevious" - TypeThemeSettings = "themeSettings" - TypeChatTheme = "chatTheme" + TypeEmojiChatTheme = "emojiChatTheme" + TypeGiftChatTheme = "giftChatTheme" + TypeGiftChatThemes = "giftChatThemes" + TypeChatThemeEmoji = "chatThemeEmoji" + TypeChatThemeGift = "chatThemeGift" + TypeInputChatThemeEmoji = "inputChatThemeEmoji" + TypeInputChatThemeGift = "inputChatThemeGift" + TypeTimeZone = "timeZone" + TypeTimeZones = "timeZones" TypeHashtags = "hashtags" - TypeCanSendStoryResultOk = "canSendStoryResultOk" - TypeCanSendStoryResultPremiumNeeded = "canSendStoryResultPremiumNeeded" - TypeCanSendStoryResultBoostNeeded = "canSendStoryResultBoostNeeded" - TypeCanSendStoryResultActiveStoryLimitExceeded = "canSendStoryResultActiveStoryLimitExceeded" - TypeCanSendStoryResultWeeklyLimitExceeded = "canSendStoryResultWeeklyLimitExceeded" - TypeCanSendStoryResultMonthlyLimitExceeded = "canSendStoryResultMonthlyLimitExceeded" + TypeCanPostStoryResultOk = "canPostStoryResultOk" + TypeCanPostStoryResultPremiumNeeded = "canPostStoryResultPremiumNeeded" + TypeCanPostStoryResultBoostNeeded = "canPostStoryResultBoostNeeded" + TypeCanPostStoryResultActiveStoryLimitExceeded = "canPostStoryResultActiveStoryLimitExceeded" + TypeCanPostStoryResultWeeklyLimitExceeded = "canPostStoryResultWeeklyLimitExceeded" + TypeCanPostStoryResultMonthlyLimitExceeded = "canPostStoryResultMonthlyLimitExceeded" + TypeCanPostStoryResultLiveStoryIsActive = "canPostStoryResultLiveStoryIsActive" + TypeStartLiveStoryResultOk = "startLiveStoryResultOk" + TypeStartLiveStoryResultFail = "startLiveStoryResultFail" TypeCanTransferOwnershipResultOk = "canTransferOwnershipResultOk" TypeCanTransferOwnershipResultPasswordNeeded = "canTransferOwnershipResultPasswordNeeded" TypeCanTransferOwnershipResultPasswordTooFresh = "canTransferOwnershipResultPasswordTooFresh" @@ -1380,18 +2134,25 @@ const ( TypePushMessageContentGameScore = "pushMessageContentGameScore" TypePushMessageContentInvoice = "pushMessageContentInvoice" TypePushMessageContentLocation = "pushMessageContentLocation" + TypePushMessageContentPaidMedia = "pushMessageContentPaidMedia" TypePushMessageContentPhoto = "pushMessageContentPhoto" TypePushMessageContentPoll = "pushMessageContentPoll" TypePushMessageContentPremiumGiftCode = "pushMessageContentPremiumGiftCode" - TypePushMessageContentPremiumGiveaway = "pushMessageContentPremiumGiveaway" + TypePushMessageContentGiveaway = "pushMessageContentGiveaway" + TypePushMessageContentGift = "pushMessageContentGift" + TypePushMessageContentUpgradedGift = "pushMessageContentUpgradedGift" TypePushMessageContentScreenshotTaken = "pushMessageContentScreenshotTaken" TypePushMessageContentSticker = "pushMessageContentSticker" TypePushMessageContentStory = "pushMessageContentStory" TypePushMessageContentText = "pushMessageContentText" + TypePushMessageContentChecklist = "pushMessageContentChecklist" TypePushMessageContentVideo = "pushMessageContentVideo" TypePushMessageContentVideoNote = "pushMessageContentVideoNote" TypePushMessageContentVoiceNote = "pushMessageContentVoiceNote" TypePushMessageContentBasicGroupChatCreate = "pushMessageContentBasicGroupChatCreate" + TypePushMessageContentVideoChatStarted = "pushMessageContentVideoChatStarted" + TypePushMessageContentVideoChatEnded = "pushMessageContentVideoChatEnded" + TypePushMessageContentInviteVideoChatParticipants = "pushMessageContentInviteVideoChatParticipants" TypePushMessageContentChatAddMembers = "pushMessageContentChatAddMembers" TypePushMessageContentChatChangePhoto = "pushMessageContentChatChangePhoto" TypePushMessageContentChatChangeTitle = "pushMessageContentChatChangeTitle" @@ -1402,6 +2163,10 @@ const ( TypePushMessageContentChatJoinByRequest = "pushMessageContentChatJoinByRequest" TypePushMessageContentRecurringPayment = "pushMessageContentRecurringPayment" TypePushMessageContentSuggestProfilePhoto = "pushMessageContentSuggestProfilePhoto" + TypePushMessageContentSuggestBirthdate = "pushMessageContentSuggestBirthdate" + TypePushMessageContentProximityAlertTriggered = "pushMessageContentProximityAlertTriggered" + TypePushMessageContentChecklistTasksAdded = "pushMessageContentChecklistTasksAdded" + TypePushMessageContentChecklistTasksDone = "pushMessageContentChecklistTasksDone" TypePushMessageContentMessageForwards = "pushMessageContentMessageForwards" TypePushMessageContentMediaAlbum = "pushMessageContentMediaAlbum" TypeNotificationTypeNewMessage = "notificationTypeNewMessage" @@ -1416,6 +2181,7 @@ const ( TypeNotificationSounds = "notificationSounds" TypeNotification = "notification" TypeNotificationGroup = "notificationGroup" + TypeProxy = "proxy" TypeOptionValueBoolean = "optionValueBoolean" TypeOptionValueEmpty = "optionValueEmpty" TypeOptionValueInteger = "optionValueInteger" @@ -1433,10 +2199,13 @@ const ( TypeStoryPrivacySettingsSelectedUsers = "storyPrivacySettingsSelectedUsers" TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" + TypeUserPrivacySettingRuleAllowBots = "userPrivacySettingRuleAllowBots" + TypeUserPrivacySettingRuleAllowPremiumUsers = "userPrivacySettingRuleAllowPremiumUsers" TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" TypeUserPrivacySettingRuleAllowChatMembers = "userPrivacySettingRuleAllowChatMembers" TypeUserPrivacySettingRuleRestrictAll = "userPrivacySettingRuleRestrictAll" TypeUserPrivacySettingRuleRestrictContacts = "userPrivacySettingRuleRestrictContacts" + TypeUserPrivacySettingRuleRestrictBots = "userPrivacySettingRuleRestrictBots" TypeUserPrivacySettingRuleRestrictUsers = "userPrivacySettingRuleRestrictUsers" TypeUserPrivacySettingRuleRestrictChatMembers = "userPrivacySettingRuleRestrictChatMembers" TypeUserPrivacySettingRules = "userPrivacySettingRules" @@ -1445,11 +2214,21 @@ const ( TypeUserPrivacySettingShowLinkInForwardedMessages = "userPrivacySettingShowLinkInForwardedMessages" TypeUserPrivacySettingShowPhoneNumber = "userPrivacySettingShowPhoneNumber" TypeUserPrivacySettingShowBio = "userPrivacySettingShowBio" + TypeUserPrivacySettingShowBirthdate = "userPrivacySettingShowBirthdate" + TypeUserPrivacySettingShowProfileAudio = "userPrivacySettingShowProfileAudio" TypeUserPrivacySettingAllowChatInvites = "userPrivacySettingAllowChatInvites" TypeUserPrivacySettingAllowCalls = "userPrivacySettingAllowCalls" TypeUserPrivacySettingAllowPeerToPeerCalls = "userPrivacySettingAllowPeerToPeerCalls" TypeUserPrivacySettingAllowFindingByPhoneNumber = "userPrivacySettingAllowFindingByPhoneNumber" TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" + TypeUserPrivacySettingAutosaveGifts = "userPrivacySettingAutosaveGifts" + TypeUserPrivacySettingAllowUnpaidMessages = "userPrivacySettingAllowUnpaidMessages" + TypeReadDatePrivacySettings = "readDatePrivacySettings" + TypeNewChatPrivacySettings = "newChatPrivacySettings" + TypeCanSendMessageToUserResultOk = "canSendMessageToUserResultOk" + TypeCanSendMessageToUserResultUserHasPaidMessages = "canSendMessageToUserResultUserHasPaidMessages" + TypeCanSendMessageToUserResultUserIsDeleted = "canSendMessageToUserResultUserIsDeleted" + TypeCanSendMessageToUserResultUserRestrictsNewChats = "canSendMessageToUserResultUserRestrictsNewChats" TypeAccountTtl = "accountTtl" TypeMessageAutoDeleteTime = "messageAutoDeleteTime" TypeSessionTypeAndroid = "sessionTypeAndroid" @@ -1484,47 +2263,84 @@ const ( TypeReportReasonIllegalDrugs = "reportReasonIllegalDrugs" TypeReportReasonPersonalDetails = "reportReasonPersonalDetails" TypeReportReasonCustom = "reportReasonCustom" - TypeTargetChatCurrent = "targetChatCurrent" - TypeTargetChatChosen = "targetChatChosen" - TypeTargetChatInternalLink = "targetChatInternalLink" - TypeInternalLinkTypeActiveSessions = "internalLinkTypeActiveSessions" + TypeReportChatResultOk = "reportChatResultOk" + TypeReportChatResultOptionRequired = "reportChatResultOptionRequired" + TypeReportChatResultTextRequired = "reportChatResultTextRequired" + TypeReportChatResultMessagesRequired = "reportChatResultMessagesRequired" + TypeReportStoryResultOk = "reportStoryResultOk" + TypeReportStoryResultOptionRequired = "reportStoryResultOptionRequired" + TypeReportStoryResultTextRequired = "reportStoryResultTextRequired" + TypeSettingsSectionAppearance = "settingsSectionAppearance" + TypeSettingsSectionAskQuestion = "settingsSectionAskQuestion" + TypeSettingsSectionBusiness = "settingsSectionBusiness" + TypeSettingsSectionChatFolders = "settingsSectionChatFolders" + TypeSettingsSectionDataAndStorage = "settingsSectionDataAndStorage" + TypeSettingsSectionDevices = "settingsSectionDevices" + TypeSettingsSectionEditProfile = "settingsSectionEditProfile" + TypeSettingsSectionFaq = "settingsSectionFaq" + TypeSettingsSectionFeatures = "settingsSectionFeatures" + TypeSettingsSectionInAppBrowser = "settingsSectionInAppBrowser" + TypeSettingsSectionLanguage = "settingsSectionLanguage" + TypeSettingsSectionMyStars = "settingsSectionMyStars" + TypeSettingsSectionMyToncoins = "settingsSectionMyToncoins" + TypeSettingsSectionNotifications = "settingsSectionNotifications" + TypeSettingsSectionPowerSaving = "settingsSectionPowerSaving" + TypeSettingsSectionPremium = "settingsSectionPremium" + TypeSettingsSectionPrivacyAndSecurity = "settingsSectionPrivacyAndSecurity" + TypeSettingsSectionPrivacyPolicy = "settingsSectionPrivacyPolicy" + TypeSettingsSectionQrCode = "settingsSectionQrCode" + TypeSettingsSectionSearch = "settingsSectionSearch" + TypeSettingsSectionSendGift = "settingsSectionSendGift" TypeInternalLinkTypeAttachmentMenuBot = "internalLinkTypeAttachmentMenuBot" TypeInternalLinkTypeAuthenticationCode = "internalLinkTypeAuthenticationCode" TypeInternalLinkTypeBackground = "internalLinkTypeBackground" TypeInternalLinkTypeBotAddToChannel = "internalLinkTypeBotAddToChannel" TypeInternalLinkTypeBotStart = "internalLinkTypeBotStart" TypeInternalLinkTypeBotStartInGroup = "internalLinkTypeBotStartInGroup" - TypeInternalLinkTypeChangePhoneNumber = "internalLinkTypeChangePhoneNumber" + TypeInternalLinkTypeBusinessChat = "internalLinkTypeBusinessChat" + TypeInternalLinkTypeCallsPage = "internalLinkTypeCallsPage" + TypeInternalLinkTypeChatAffiliateProgram = "internalLinkTypeChatAffiliateProgram" TypeInternalLinkTypeChatBoost = "internalLinkTypeChatBoost" TypeInternalLinkTypeChatFolderInvite = "internalLinkTypeChatFolderInvite" - TypeInternalLinkTypeChatFolderSettings = "internalLinkTypeChatFolderSettings" TypeInternalLinkTypeChatInvite = "internalLinkTypeChatInvite" - TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings = "internalLinkTypeDefaultMessageAutoDeleteTimerSettings" - TypeInternalLinkTypeEditProfileSettings = "internalLinkTypeEditProfileSettings" + TypeInternalLinkTypeChatSelection = "internalLinkTypeChatSelection" + TypeInternalLinkTypeContactsPage = "internalLinkTypeContactsPage" + TypeInternalLinkTypeDirectMessagesChat = "internalLinkTypeDirectMessagesChat" TypeInternalLinkTypeGame = "internalLinkTypeGame" + TypeInternalLinkTypeGiftAuction = "internalLinkTypeGiftAuction" + TypeInternalLinkTypeGiftCollection = "internalLinkTypeGiftCollection" + TypeInternalLinkTypeGroupCall = "internalLinkTypeGroupCall" TypeInternalLinkTypeInstantView = "internalLinkTypeInstantView" TypeInternalLinkTypeInvoice = "internalLinkTypeInvoice" TypeInternalLinkTypeLanguagePack = "internalLinkTypeLanguagePack" - TypeInternalLinkTypeLanguageSettings = "internalLinkTypeLanguageSettings" + TypeInternalLinkTypeLiveStory = "internalLinkTypeLiveStory" + TypeInternalLinkTypeMainWebApp = "internalLinkTypeMainWebApp" TypeInternalLinkTypeMessage = "internalLinkTypeMessage" TypeInternalLinkTypeMessageDraft = "internalLinkTypeMessageDraft" + TypeInternalLinkTypeMyProfilePage = "internalLinkTypeMyProfilePage" + TypeInternalLinkTypeNewChannelChat = "internalLinkTypeNewChannelChat" + TypeInternalLinkTypeNewGroupChat = "internalLinkTypeNewGroupChat" + TypeInternalLinkTypeNewPrivateChat = "internalLinkTypeNewPrivateChat" + TypeInternalLinkTypeNewStory = "internalLinkTypeNewStory" TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" TypeInternalLinkTypePhoneNumberConfirmation = "internalLinkTypePhoneNumberConfirmation" - TypeInternalLinkTypePremiumFeatures = "internalLinkTypePremiumFeatures" + TypeInternalLinkTypePremiumFeaturesPage = "internalLinkTypePremiumFeaturesPage" TypeInternalLinkTypePremiumGiftCode = "internalLinkTypePremiumGiftCode" - TypeInternalLinkTypePrivacyAndSecuritySettings = "internalLinkTypePrivacyAndSecuritySettings" + TypeInternalLinkTypePremiumGiftPurchase = "internalLinkTypePremiumGiftPurchase" TypeInternalLinkTypeProxy = "internalLinkTypeProxy" TypeInternalLinkTypePublicChat = "internalLinkTypePublicChat" TypeInternalLinkTypeQrCodeAuthentication = "internalLinkTypeQrCodeAuthentication" TypeInternalLinkTypeRestorePurchases = "internalLinkTypeRestorePurchases" + TypeInternalLinkTypeSavedMessages = "internalLinkTypeSavedMessages" + TypeInternalLinkTypeSearch = "internalLinkTypeSearch" TypeInternalLinkTypeSettings = "internalLinkTypeSettings" - TypeInternalLinkTypeSideMenuBot = "internalLinkTypeSideMenuBot" + TypeInternalLinkTypeStarPurchase = "internalLinkTypeStarPurchase" TypeInternalLinkTypeStickerSet = "internalLinkTypeStickerSet" TypeInternalLinkTypeStory = "internalLinkTypeStory" + TypeInternalLinkTypeStoryAlbum = "internalLinkTypeStoryAlbum" TypeInternalLinkTypeTheme = "internalLinkTypeTheme" - TypeInternalLinkTypeThemeSettings = "internalLinkTypeThemeSettings" TypeInternalLinkTypeUnknownDeepLink = "internalLinkTypeUnknownDeepLink" - TypeInternalLinkTypeUnsupportedProxy = "internalLinkTypeUnsupportedProxy" + TypeInternalLinkTypeUpgradedGift = "internalLinkTypeUpgradedGift" TypeInternalLinkTypeUserPhoneNumber = "internalLinkTypeUserPhoneNumber" TypeInternalLinkTypeUserToken = "internalLinkTypeUserToken" TypeInternalLinkTypeVideoChat = "internalLinkTypeVideoChat" @@ -1535,7 +2351,6 @@ const ( TypeChatBoostLinkInfo = "chatBoostLinkInfo" TypeBlockListMain = "blockListMain" TypeBlockListStories = "blockListStories" - TypeFilePart = "filePart" TypeFileTypeNone = "fileTypeNone" TypeFileTypeAnimation = "fileTypeAnimation" TypeFileTypeAudio = "fileTypeAudio" @@ -1547,6 +2362,10 @@ const ( TypeFileTypeSecret = "fileTypeSecret" TypeFileTypeSecretThumbnail = "fileTypeSecretThumbnail" TypeFileTypeSecure = "fileTypeSecure" + TypeFileTypeSelfDestructingPhoto = "fileTypeSelfDestructingPhoto" + TypeFileTypeSelfDestructingVideo = "fileTypeSelfDestructingVideo" + TypeFileTypeSelfDestructingVideoNote = "fileTypeSelfDestructingVideoNote" + TypeFileTypeSelfDestructingVoiceNote = "fileTypeSelfDestructingVoiceNote" TypeFileTypeSticker = "fileTypeSticker" TypeFileTypeThumbnail = "fileTypeThumbnail" TypeFileTypeUnknown = "fileTypeUnknown" @@ -1582,11 +2401,13 @@ const ( TypeConnectionStateConnecting = "connectionStateConnecting" TypeConnectionStateUpdating = "connectionStateUpdating" TypeConnectionStateReady = "connectionStateReady" + TypeAgeVerificationParameters = "ageVerificationParameters" TypeTopChatCategoryUsers = "topChatCategoryUsers" TypeTopChatCategoryBots = "topChatCategoryBots" TypeTopChatCategoryGroups = "topChatCategoryGroups" TypeTopChatCategoryChannels = "topChatCategoryChannels" TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots" + TypeTopChatCategoryWebAppBots = "topChatCategoryWebAppBots" TypeTopChatCategoryCalls = "topChatCategoryCalls" TypeTopChatCategoryForwardChats = "topChatCategoryForwardChats" TypeFoundPosition = "foundPosition" @@ -1606,31 +2427,60 @@ const ( TypeSuggestedActionUpgradePremium = "suggestedActionUpgradePremium" TypeSuggestedActionRestorePremium = "suggestedActionRestorePremium" TypeSuggestedActionSubscribeToAnnualPremium = "suggestedActionSubscribeToAnnualPremium" + TypeSuggestedActionGiftPremiumForChristmas = "suggestedActionGiftPremiumForChristmas" + TypeSuggestedActionSetBirthdate = "suggestedActionSetBirthdate" + TypeSuggestedActionSetProfilePhoto = "suggestedActionSetProfilePhoto" + TypeSuggestedActionExtendPremium = "suggestedActionExtendPremium" + TypeSuggestedActionExtendStarSubscriptions = "suggestedActionExtendStarSubscriptions" + TypeSuggestedActionCustom = "suggestedActionCustom" + TypeSuggestedActionSetLoginEmailAddress = "suggestedActionSetLoginEmailAddress" + TypeSuggestedActionAddLoginPasskey = "suggestedActionAddLoginPasskey" TypeCount = "count" TypeText = "text" + TypeData = "data" TypeSeconds = "seconds" TypeFileDownloadedPrefixSize = "fileDownloadedPrefixSize" + TypeStarCount = "starCount" TypeDeepLinkInfo = "deepLinkInfo" TypeTextParseModeMarkdown = "textParseModeMarkdown" TypeTextParseModeHTML = "textParseModeHTML" TypeProxyTypeSocks5 = "proxyTypeSocks5" TypeProxyTypeHttp = "proxyTypeHttp" TypeProxyTypeMtproto = "proxyTypeMtproto" - TypeProxy = "proxy" - TypeProxies = "proxies" + TypeAddedProxy = "addedProxy" + TypeAddedProxies = "addedProxies" TypeInputSticker = "inputSticker" TypeDateRange = "dateRange" TypeStatisticalValue = "statisticalValue" TypeStatisticalGraphData = "statisticalGraphData" TypeStatisticalGraphAsync = "statisticalGraphAsync" TypeStatisticalGraphError = "statisticalGraphError" - TypeChatStatisticsMessageInteractionInfo = "chatStatisticsMessageInteractionInfo" + TypeChatStatisticsObjectTypeMessage = "chatStatisticsObjectTypeMessage" + TypeChatStatisticsObjectTypeStory = "chatStatisticsObjectTypeStory" + TypeChatStatisticsInteractionInfo = "chatStatisticsInteractionInfo" TypeChatStatisticsMessageSenderInfo = "chatStatisticsMessageSenderInfo" TypeChatStatisticsAdministratorActionsInfo = "chatStatisticsAdministratorActionsInfo" TypeChatStatisticsInviterInfo = "chatStatisticsInviterInfo" TypeChatStatisticsSupergroup = "chatStatisticsSupergroup" TypeChatStatisticsChannel = "chatStatisticsChannel" + TypeChatRevenueAmount = "chatRevenueAmount" + TypeChatRevenueStatistics = "chatRevenueStatistics" TypeMessageStatistics = "messageStatistics" + TypeStoryStatistics = "storyStatistics" + TypeRevenueWithdrawalStatePending = "revenueWithdrawalStatePending" + TypeRevenueWithdrawalStateSucceeded = "revenueWithdrawalStateSucceeded" + TypeRevenueWithdrawalStateFailed = "revenueWithdrawalStateFailed" + TypeChatRevenueTransactionTypeUnsupported = "chatRevenueTransactionTypeUnsupported" + TypeChatRevenueTransactionTypeSponsoredMessageEarnings = "chatRevenueTransactionTypeSponsoredMessageEarnings" + TypeChatRevenueTransactionTypeSuggestedPostEarnings = "chatRevenueTransactionTypeSuggestedPostEarnings" + TypeChatRevenueTransactionTypeFragmentWithdrawal = "chatRevenueTransactionTypeFragmentWithdrawal" + TypeChatRevenueTransactionTypeFragmentRefund = "chatRevenueTransactionTypeFragmentRefund" + TypeChatRevenueTransaction = "chatRevenueTransaction" + TypeChatRevenueTransactions = "chatRevenueTransactions" + TypeStarRevenueStatus = "starRevenueStatus" + TypeStarRevenueStatistics = "starRevenueStatistics" + TypeTonRevenueStatus = "tonRevenueStatus" + TypeTonRevenueStatistics = "tonRevenueStatistics" TypePoint = "point" TypeVectorPathCommandLine = "vectorPathCommandLine" TypeVectorPathCommandCubicBezierCurve = "vectorPathCommandCubicBezierCurve" @@ -1641,6 +2491,9 @@ const ( TypeBotCommandScopeChat = "botCommandScopeChat" TypeBotCommandScopeChatAdministrators = "botCommandScopeChatAdministrators" TypeBotCommandScopeChatMember = "botCommandScopeChatMember" + TypePhoneNumberCodeTypeChange = "phoneNumberCodeTypeChange" + TypePhoneNumberCodeTypeVerify = "phoneNumberCodeTypeVerify" + TypePhoneNumberCodeTypeConfirmOwnership = "phoneNumberCodeTypeConfirmOwnership" TypeUpdateAuthorizationState = "updateAuthorizationState" TypeUpdateNewMessage = "updateNewMessage" TypeUpdateMessageSendAcknowledged = "updateMessageSendAcknowledged" @@ -1653,20 +2506,26 @@ const ( TypeUpdateMessageContentOpened = "updateMessageContentOpened" TypeUpdateMessageMentionRead = "updateMessageMentionRead" TypeUpdateMessageUnreadReactions = "updateMessageUnreadReactions" + TypeUpdateMessageFactCheck = "updateMessageFactCheck" + TypeUpdateMessageSuggestedPostInfo = "updateMessageSuggestedPostInfo" TypeUpdateMessageLiveLocationViewed = "updateMessageLiveLocationViewed" + TypeUpdateVideoPublished = "updateVideoPublished" TypeUpdateNewChat = "updateNewChat" TypeUpdateChatTitle = "updateChatTitle" TypeUpdateChatPhoto = "updateChatPhoto" - TypeUpdateChatAccentColor = "updateChatAccentColor" - TypeUpdateChatBackgroundCustomEmoji = "updateChatBackgroundCustomEmoji" + TypeUpdateChatAccentColors = "updateChatAccentColors" TypeUpdateChatPermissions = "updateChatPermissions" TypeUpdateChatLastMessage = "updateChatLastMessage" TypeUpdateChatPosition = "updateChatPosition" + TypeUpdateChatAddedToList = "updateChatAddedToList" + TypeUpdateChatRemovedFromList = "updateChatRemovedFromList" TypeUpdateChatReadInbox = "updateChatReadInbox" TypeUpdateChatReadOutbox = "updateChatReadOutbox" TypeUpdateChatActionBar = "updateChatActionBar" + TypeUpdateChatBusinessBotManageBar = "updateChatBusinessBotManageBar" TypeUpdateChatAvailableReactions = "updateChatAvailableReactions" TypeUpdateChatDraftMessage = "updateChatDraftMessage" + TypeUpdateChatEmojiStatus = "updateChatEmojiStatus" TypeUpdateChatMessageSender = "updateChatMessageSender" TypeUpdateChatMessageAutoDeleteTime = "updateChatMessageAutoDeleteTime" TypeUpdateChatNotificationSettings = "updateChatNotificationSettings" @@ -1681,18 +2540,30 @@ const ( TypeUpdateChatHasProtectedContent = "updateChatHasProtectedContent" TypeUpdateChatIsTranslatable = "updateChatIsTranslatable" TypeUpdateChatIsMarkedAsUnread = "updateChatIsMarkedAsUnread" + TypeUpdateChatViewAsTopics = "updateChatViewAsTopics" TypeUpdateChatBlockList = "updateChatBlockList" TypeUpdateChatHasScheduledMessages = "updateChatHasScheduledMessages" TypeUpdateChatFolders = "updateChatFolders" TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" + TypeUpdateSavedMessagesTopic = "updateSavedMessagesTopic" + TypeUpdateSavedMessagesTopicCount = "updateSavedMessagesTopicCount" + TypeUpdateDirectMessagesChatTopic = "updateDirectMessagesChatTopic" + TypeUpdateTopicMessageCount = "updateTopicMessageCount" + TypeUpdateQuickReplyShortcut = "updateQuickReplyShortcut" + TypeUpdateQuickReplyShortcutDeleted = "updateQuickReplyShortcutDeleted" + TypeUpdateQuickReplyShortcuts = "updateQuickReplyShortcuts" + TypeUpdateQuickReplyShortcutMessages = "updateQuickReplyShortcutMessages" TypeUpdateForumTopicInfo = "updateForumTopicInfo" + TypeUpdateForumTopic = "updateForumTopic" TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" + TypeUpdateReactionNotificationSettings = "updateReactionNotificationSettings" TypeUpdateNotification = "updateNotification" TypeUpdateNotificationGroup = "updateNotificationGroup" TypeUpdateActiveNotifications = "updateActiveNotifications" TypeUpdateHavePendingNotifications = "updateHavePendingNotifications" TypeUpdateDeleteMessages = "updateDeleteMessages" TypeUpdateChatAction = "updateChatAction" + TypeUpdatePendingTextMessage = "updatePendingTextMessage" TypeUpdateUserStatus = "updateUserStatus" TypeUpdateUser = "updateUser" TypeUpdateBasicGroup = "updateBasicGroup" @@ -1709,20 +2580,32 @@ const ( TypeUpdateFileAddedToDownloads = "updateFileAddedToDownloads" TypeUpdateFileDownload = "updateFileDownload" TypeUpdateFileRemovedFromDownloads = "updateFileRemovedFromDownloads" + TypeUpdateApplicationVerificationRequired = "updateApplicationVerificationRequired" + TypeUpdateApplicationRecaptchaVerificationRequired = "updateApplicationRecaptchaVerificationRequired" TypeUpdateCall = "updateCall" TypeUpdateGroupCall = "updateGroupCall" TypeUpdateGroupCallParticipant = "updateGroupCallParticipant" + TypeUpdateGroupCallParticipants = "updateGroupCallParticipants" + TypeUpdateGroupCallVerificationState = "updateGroupCallVerificationState" + TypeUpdateNewGroupCallMessage = "updateNewGroupCallMessage" + TypeUpdateNewGroupCallPaidReaction = "updateNewGroupCallPaidReaction" + TypeUpdateGroupCallMessageSendFailed = "updateGroupCallMessageSendFailed" + TypeUpdateGroupCallMessagesDeleted = "updateGroupCallMessagesDeleted" + TypeUpdateLiveStoryTopDonors = "updateLiveStoryTopDonors" TypeUpdateNewCallSignalingData = "updateNewCallSignalingData" + TypeUpdateGiftAuctionState = "updateGiftAuctionState" + TypeUpdateActiveGiftAuctions = "updateActiveGiftAuctions" TypeUpdateUserPrivacySettingRules = "updateUserPrivacySettingRules" TypeUpdateUnreadMessageCount = "updateUnreadMessageCount" TypeUpdateUnreadChatCount = "updateUnreadChatCount" TypeUpdateStory = "updateStory" TypeUpdateStoryDeleted = "updateStoryDeleted" - TypeUpdateStorySendSucceeded = "updateStorySendSucceeded" - TypeUpdateStorySendFailed = "updateStorySendFailed" + TypeUpdateStoryPostSucceeded = "updateStoryPostSucceeded" + TypeUpdateStoryPostFailed = "updateStoryPostFailed" TypeUpdateChatActiveStories = "updateChatActiveStories" TypeUpdateStoryListChatCount = "updateStoryListChatCount" TypeUpdateStoryStealthMode = "updateStoryStealthMode" + TypeUpdateTrustedMiniAppBots = "updateTrustedMiniAppBots" TypeUpdateOption = "updateOption" TypeUpdateStickerSet = "updateStickerSet" TypeUpdateInstalledStickerSets = "updateInstalledStickerSets" @@ -1731,28 +2614,48 @@ const ( TypeUpdateFavoriteStickers = "updateFavoriteStickers" TypeUpdateSavedAnimations = "updateSavedAnimations" TypeUpdateSavedNotificationSounds = "updateSavedNotificationSounds" - TypeUpdateSelectedBackground = "updateSelectedBackground" - TypeUpdateChatThemes = "updateChatThemes" + TypeUpdateDefaultBackground = "updateDefaultBackground" + TypeUpdateEmojiChatThemes = "updateEmojiChatThemes" TypeUpdateAccentColors = "updateAccentColors" + TypeUpdateProfileAccentColors = "updateProfileAccentColors" TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" + TypeUpdateFreezeState = "updateFreezeState" + TypeUpdateAgeVerificationParameters = "updateAgeVerificationParameters" TypeUpdateTermsOfService = "updateTermsOfService" - TypeUpdateUsersNearby = "updateUsersNearby" TypeUpdateUnconfirmedSession = "updateUnconfirmedSession" TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" TypeUpdateWebAppMessageSent = "updateWebAppMessageSent" TypeUpdateActiveEmojiReactions = "updateActiveEmojiReactions" + TypeUpdateAvailableMessageEffects = "updateAvailableMessageEffects" TypeUpdateDefaultReactionType = "updateDefaultReactionType" + TypeUpdateDefaultPaidReactionType = "updateDefaultPaidReactionType" + TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" + TypeUpdateActiveLiveLocationMessages = "updateActiveLiveLocationMessages" + TypeUpdateOwnedStarCount = "updateOwnedStarCount" + TypeUpdateOwnedTonCount = "updateOwnedTonCount" + TypeUpdateChatRevenueAmount = "updateChatRevenueAmount" + TypeUpdateStarRevenueStatus = "updateStarRevenueStatus" + TypeUpdateTonRevenueStatus = "updateTonRevenueStatus" + TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" + TypeUpdateGroupCallMessageLevels = "updateGroupCallMessageLevels" TypeUpdateDiceEmojis = "updateDiceEmojis" + TypeUpdateStakeDiceState = "updateStakeDiceState" TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" TypeUpdateAnimationSearchParameters = "updateAnimationSearchParameters" TypeUpdateSuggestedActions = "updateSuggestedActions" - TypeUpdateAddChatMembersPrivacyForbidden = "updateAddChatMembersPrivacyForbidden" + TypeUpdateSpeedLimitNotification = "updateSpeedLimitNotification" + TypeUpdateContactCloseBirthdays = "updateContactCloseBirthdays" TypeUpdateAutosaveSettings = "updateAutosaveSettings" + TypeUpdateBusinessConnection = "updateBusinessConnection" + TypeUpdateNewBusinessMessage = "updateNewBusinessMessage" + TypeUpdateBusinessMessageEdited = "updateBusinessMessageEdited" + TypeUpdateBusinessMessagesDeleted = "updateBusinessMessagesDeleted" TypeUpdateNewInlineQuery = "updateNewInlineQuery" TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" TypeUpdateNewCallbackQuery = "updateNewCallbackQuery" TypeUpdateNewInlineCallbackQuery = "updateNewInlineCallbackQuery" + TypeUpdateNewBusinessCallbackQuery = "updateNewBusinessCallbackQuery" TypeUpdateNewShippingQuery = "updateNewShippingQuery" TypeUpdateNewPreCheckoutQuery = "updateNewPreCheckoutQuery" TypeUpdateNewCustomEvent = "updateNewCustomEvent" @@ -1762,6 +2665,9 @@ const ( TypeUpdateChatMember = "updateChatMember" TypeUpdateNewChatJoinRequest = "updateNewChatJoinRequest" TypeUpdateChatBoost = "updateChatBoost" + TypeUpdateMessageReaction = "updateMessageReaction" + TypeUpdateMessageReactions = "updateMessageReactions" + TypeUpdatePaidMediaPurchased = "updatePaidMediaPurchased" TypeUpdates = "updates" TypeLogStreamDefault = "logStreamDefault" TypeLogStreamFile = "logStreamFile" @@ -1783,12 +2689,12 @@ type AuthenticationCodeType interface { AuthenticationCodeTypeType() string } -// Contains authentication data for a email address +// Contains authentication data for an email address type EmailAddressAuthentication interface { EmailAddressAuthenticationType() string } -// Describes reset state of a email address +// Describes reset state of an email address type EmailAddressResetState interface { EmailAddressResetStateType() string } @@ -1798,6 +2704,11 @@ type AuthorizationState interface { AuthorizationStateType() string } +// Describes parameters to be used for device verification +type FirebaseDeviceVerificationParameters interface { + FirebaseDeviceVerificationParametersType() string +} + // Points to a file type InputFile interface { InputFileType() string @@ -1818,7 +2729,7 @@ type StickerFormat interface { StickerFormatType() string } -// Describes type of a sticker +// Describes type of sticker type StickerType interface { StickerTypeType() string } @@ -1828,17 +2739,27 @@ type StickerFullType interface { StickerFullTypeType() string } -// Describes the type of a poll +// Describes the type of poll type PollType interface { PollTypeType() string } -// Represents the type of a user. The following types are possible: regular users, deleted users and bots +// Describes a tab shown in a user or a chat profile +type ProfileTab interface { + ProfileTabType() string +} + +// Represents the type of user. The following types are possible: regular users, deleted users and bots type UserType interface { UserTypeType() string } -// Describes type of a sticker, which was used to create a chat photo +// Describes conditions for sending of away messages by a Telegram Business account +type BusinessAwayMessageSchedule interface { + BusinessAwayMessageScheduleType() string +} + +// Describes type of sticker, which was used to create a chat photo type ChatPhotoStickerType interface { ChatPhotoStickerTypeType() string } @@ -1848,14 +2769,129 @@ type InputChatPhoto interface { InputChatPhotoType() string } -// Contains information about status of a user in a Telegram Premium giveaway -type PremiumGiveawayParticipantStatus interface { - PremiumGiveawayParticipantStatusType() string +// Describes price of a resold gift +type GiftResalePrice interface { + GiftResalePriceType() string } -// Contains information about Telegram Premium giveaway -type PremiumGiveawayInfo interface { - PremiumGiveawayInfoType() string +// Describes state of a gift purchase offer +type GiftPurchaseOfferState interface { + GiftPurchaseOfferStateType() string +} + +// Describes price of a suggested post +type SuggestedPostPrice interface { + SuggestedPostPriceType() string +} + +// Describes state of a suggested post +type SuggestedPostState interface { + SuggestedPostStateType() string +} + +// Describes reason for refund of the payment for a suggested post +type SuggestedPostRefundReason interface { + SuggestedPostRefundReasonType() string +} + +// Describes type of subscription paid in Telegram Stars +type StarSubscriptionType interface { + StarSubscriptionTypeType() string +} + +// Describes type of affiliate for an affiliate program +type AffiliateType interface { + AffiliateTypeType() string +} + +// Describes the order of the found affiliate programs +type AffiliateProgramSortOrder interface { + AffiliateProgramSortOrderType() string +} + +// Describes whether a gift can be sent now by the current user +type CanSendGiftResult interface { + CanSendGiftResultType() string +} + +// Describes origin from which the upgraded gift was obtained +type UpgradedGiftOrigin interface { + UpgradedGiftOriginType() string +} + +// Describes rarity of an upgraded gift attribute +type UpgradedGiftAttributeRarity interface { + UpgradedGiftAttributeRarityType() string +} + +// Contains result of gift crafting +type CraftGiftResult interface { + CraftGiftResultType() string +} + +// Contains identifier of an upgraded gift attribute to search for +type UpgradedGiftAttributeId interface { + UpgradedGiftAttributeIdType() string +} + +// Describes order in which upgraded gifts for resale will be sorted +type GiftForResaleOrder interface { + GiftForResaleOrderType() string +} + +// Describes result of sending a resold gift +type GiftResaleResult interface { + GiftResaleResultType() string +} + +// Represents content of a gift received by a user or a channel chat +type SentGift interface { + SentGiftType() string +} + +// Describes state of an auction +type AuctionState interface { + AuctionStateType() string +} + +// Describes direction of transactions in a transaction list +type TransactionDirection interface { + TransactionDirectionType() string +} + +// Describes type of transaction with Telegram Stars +type StarTransactionType interface { + StarTransactionTypeType() string +} + +// Describes type of transaction with Toncoins +type TonTransactionType interface { + TonTransactionTypeType() string +} + +// Describes state of active stories posted by a chat +type ActiveStoryState interface { + ActiveStoryStateType() string +} + +// Contains information about status of a user in a giveaway +type GiveawayParticipantStatus interface { + GiveawayParticipantStatusType() string +} + +// Contains information about a giveaway +type GiveawayInfo interface { + GiveawayInfoType() string +} + +// Contains information about a giveaway prize +type GiveawayPrize interface { + GiveawayPrizeType() string +} + +// Describes type of emoji status +type EmojiStatusType interface { + EmojiStatusTypeType() string } // Provides information about the status of a member in a chat @@ -1873,7 +2909,7 @@ type SupergroupMembersFilter interface { SupergroupMembersFilterType() string } -// Describes the type of a chat to which points an invite link +// Describes the type of chat to which points an invite link type InviteLinkChatType interface { InviteLinkChatTypeType() string } @@ -1888,6 +2924,11 @@ type MessageSender interface { MessageSenderType() string } +// Describes read date of a recent outgoing message in a private chat +type MessageReadDate interface { + MessageReadDateType() string +} + // Contains information about the origin of a message type MessageOrigin interface { MessageOriginType() string @@ -1898,6 +2939,21 @@ type ReactionType interface { ReactionTypeType() string } +// Describes type of paid message reaction +type PaidReactionType interface { + PaidReactionTypeType() string +} + +// Describes a topic of messages in a chat +type MessageTopic interface { + MessageTopicType() string +} + +// Describes type of emoji effect +type MessageEffectType interface { + MessageEffectTypeType() string +} + // Contains information about the sending state of the message type MessageSendingState interface { MessageSendingStateType() string @@ -1918,9 +2974,9 @@ type MessageSource interface { MessageSourceType() string } -// Describes type of a message sponsor -type MessageSponsorType interface { - MessageSponsorTypeType() string +// Describes result of sponsored message or chat report +type ReportSponsoredResult interface { + ReportSponsoredResultType() string } // Describes the types of chats to which notification settings are relevant @@ -1928,7 +2984,12 @@ type NotificationSettingsScope interface { NotificationSettingsScopeType() string } -// Describes the type of a chat +// Describes sources of reactions for which notifications will be shown +type ReactionNotificationSource interface { + ReactionNotificationSourceType() string +} + +// Describes the type of chat type ChatType interface { ChatTypeType() string } @@ -1948,7 +3009,7 @@ type ChatAvailableReactions interface { ChatAvailableReactionsType() string } -// Describes a type of public chats +// Describes type of public chat type PublicChatType interface { PublicChatTypeType() string } @@ -1958,12 +3019,17 @@ type ChatActionBar interface { ChatActionBarType() string } +// Describes style of a button +type ButtonStyle interface { + ButtonStyleType() string +} + // Describes a keyboard button type type KeyboardButtonType interface { KeyboardButtonTypeType() string } -// Describes the type of an inline keyboard button +// Describes the type of inline keyboard button type InlineKeyboardButtonType interface { InlineKeyboardButtonTypeType() string } @@ -1978,7 +3044,22 @@ type LoginUrlInfo interface { LoginUrlInfoType() string } -// Describes a text object inside an instant-view web page +// Describes mode in which a Web App is opened +type WebAppOpenMode interface { + WebAppOpenModeType() string +} + +// Describes type of Saved Messages topic +type SavedMessagesTopicType interface { + SavedMessagesTopicTypeType() string +} + +// Describes a built-in theme of an official app +type BuiltInTheme interface { + BuiltInThemeType() string +} + +// Describes a formatted text object type RichText interface { RichTextType() string } @@ -1993,11 +3074,26 @@ type PageBlockVerticalAlignment interface { PageBlockVerticalAlignmentType() string } -// Describes a block of an instant view web page +// Describes a block of an instant view for a web page type PageBlock interface { PageBlockType() string } +// Describes a media from a link preview album +type LinkPreviewAlbumMedia interface { + LinkPreviewAlbumMediaType() string +} + +// Describes type of link preview +type LinkPreviewType interface { + LinkPreviewTypeType() string +} + +// Describes a collectible item that can be purchased at https://fragment.com +type CollectibleItemType interface { + CollectibleItemTypeType() string +} + // Contains information about the payment method chosen by the user type InputCredentials interface { InputCredentialsType() string @@ -2008,17 +3104,27 @@ type PaymentProvider interface { PaymentProviderType() string } +// Describes type of payment form +type PaymentFormType interface { + PaymentFormTypeType() string +} + +// Describes type of successful payment +type PaymentReceiptType interface { + PaymentReceiptTypeType() string +} + // Describes an invoice to process type InputInvoice interface { InputInvoiceType() string } -// Describes a media, which is attached to an invoice -type MessageExtendedMedia interface { - MessageExtendedMediaType() string +// Describes a paid media +type PaidMedia interface { + PaidMediaType() string } -// Contains the type of a Telegram Passport element +// Contains the type of Telegram Passport element type PassportElementType interface { PassportElementTypeType() string } @@ -2053,6 +3159,11 @@ type TextEntityType interface { TextEntityTypeType() string } +// Describes type of paid media to sent +type InputPaidMediaType interface { + InputPaidMediaTypeType() string +} + // Contains information about the time when a scheduled message will be sent type MessageSchedulingState interface { MessageSchedulingStateType() string @@ -2073,6 +3184,11 @@ type SearchMessagesFilter interface { SearchMessagesFilterType() string } +// Represents a filter for type of the chats in which to search messages +type SearchMessagesChatTypeFilter interface { + SearchMessagesChatTypeFilterType() string +} + // Describes the different types of activity in a chat type ChatAction interface { ChatActionType() string @@ -2083,27 +3199,37 @@ type UserStatus interface { UserStatusType() string } -// Describes type of an emoji category +// Describes source of stickers for an emoji category +type EmojiCategorySource interface { + EmojiCategorySourceType() string +} + +// Describes type of emoji category type EmojiCategoryType interface { EmojiCategoryTypeType() string } -// Describes type of a clickable rectangle area on a story media +// Describes type of clickable area on a story media type StoryAreaType interface { StoryAreaTypeType() string } -// Describes type of a clickable rectangle area on a story media to be added +// Describes type of clickable area on a story media to be added type InputStoryAreaType interface { InputStoryAreaTypeType() string } +// Contains the type of the content of a story +type StoryContentType interface { + StoryContentTypeType() string +} + // Contains the content of a story type StoryContent interface { StoryContentType() string } -// The content of a story to send +// The content of a story to post type InputStoryContent interface { InputStoryContentType() string } @@ -2113,17 +3239,37 @@ type StoryList interface { StoryListType() string } +// Contains information about the origin of a story that was reposted +type StoryOrigin interface { + StoryOriginType() string +} + +// Describes type of interaction with a story +type StoryInteractionType interface { + StoryInteractionTypeType() string +} + +// Describes a public forward or repost of a story +type PublicForward interface { + PublicForwardType() string +} + // Describes source of a chat boost type ChatBoostSource interface { ChatBoostSourceType() string } +// Describes the reason why a code needs to be re-sent +type ResendCodeReason interface { + ResendCodeReasonType() string +} + // Describes the reason why a call was discarded type CallDiscardReason interface { CallDiscardReasonType() string } -// Describes the type of a call server +// Describes the type of call server type CallServerType interface { CallServerTypeType() string } @@ -2138,7 +3284,22 @@ type GroupCallVideoQuality interface { GroupCallVideoQualityType() string } -// Describes the exact type of a problem with a call +// Describes result of group call participant invitation +type InviteGroupCallParticipantResult interface { + InviteGroupCallParticipantResultType() string +} + +// Describes data channel for a group call +type GroupCallDataChannel interface { + GroupCallDataChannelType() string +} + +// Describes a non-joined group call that isn't bound to a chat +type InputGroupCall interface { + InputGroupCallType() string +} + +// Describes the exact type of problem with a call type CallProblem interface { CallProblemType() string } @@ -2148,6 +3309,11 @@ type FirebaseAuthenticationSettings interface { FirebaseAuthenticationSettingsType() string } +// Describes why the current user can't add reactions to the message, despite some other users can +type ReactionUnavailabilityReason interface { + ReactionUnavailabilityReasonType() string +} + // Contains animated stickers which must be used for dice animation rendering type DiceStickers interface { DiceStickersType() string @@ -2163,6 +3329,11 @@ type BotWriteAccessAllowReason interface { BotWriteAccessAllowReasonType() string } +// Describes the target chat to be opened +type TargetChat interface { + TargetChatType() string +} + // Represents a single result of an inline query; for bots only type InputInlineQueryResult interface { InputInlineQueryResultType() string @@ -2173,7 +3344,7 @@ type InlineQueryResult interface { InlineQueryResultType() string } -// Represents a type of a button in results of inline query +// Represents type of button in results of inline query type InlineQueryResultsButtonType interface { InlineQueryResultsButtonTypeType() string } @@ -2193,7 +3364,7 @@ type LanguagePackStringValue interface { LanguagePackStringValueType() string } -// Describes type of a limit, increased for Premium users +// Describes type of limit, increased for Premium users type PremiumLimitType interface { PremiumLimitTypeType() string } @@ -2203,6 +3374,11 @@ type PremiumFeature interface { PremiumFeatureType() string } +// Describes a feature available to Business user accounts +type BusinessFeature interface { + BusinessFeatureType() string +} + // Describes a story feature available to Premium users type PremiumStoryFeature interface { PremiumStoryFeatureType() string @@ -2218,6 +3394,11 @@ type StorePaymentPurpose interface { StorePaymentPurposeType() string } +// Describes an in-store transaction +type StoreTransaction interface { + StoreTransactionType() string +} + // Describes a purpose of a payment toward Telegram type TelegramPaymentPurpose interface { TelegramPaymentPurposeType() string @@ -2233,7 +3414,7 @@ type BackgroundFill interface { BackgroundFillType() string } -// Describes the type of a background +// Describes the type of background type BackgroundType interface { BackgroundTypeType() string } @@ -2243,9 +3424,24 @@ type InputBackground interface { InputBackgroundType() string } -// Represents result of checking whether the current user can send a story in the specific chat -type CanSendStoryResult interface { - CanSendStoryResultType() string +// Describes a chat theme +type ChatTheme interface { + ChatThemeType() string +} + +// Describes a chat theme to set +type InputChatTheme interface { + InputChatThemeType() string +} + +// Represents result of checking whether the current user can post a story on behalf of the specific chat +type CanPostStoryResult interface { + CanPostStoryResultType() string +} + +// Represents result of starting a live story +type StartLiveStoryResult interface { + StartLiveStoryResultType() string } // Represents result of checking whether the current session can be used to transfer a chat ownership to another user @@ -2313,7 +3509,12 @@ type UserPrivacySetting interface { UserPrivacySettingType() string } -// Represents the type of a session +// Describes result of canSendMessageToUser +type CanSendMessageToUserResult interface { + CanSendMessageToUserResultType() string +} + +// Represents the type of session type SessionType interface { SessionTypeType() string } @@ -2323,9 +3524,19 @@ type ReportReason interface { ReportReasonType() string } -// Describes the target chat to be opened -type TargetChat interface { - TargetChatType() string +// Describes result of chat report +type ReportChatResult interface { + ReportChatResultType() string +} + +// Describes result of story report +type ReportStoryResult interface { + ReportStoryResultType() string +} + +// Describes a section of the application settings +type SettingsSection interface { + SettingsSectionType() string } // Describes an internal https://t.me or tg: link, which must be processed by the application in a special way @@ -2333,17 +3544,17 @@ type InternalLinkType interface { InternalLinkTypeType() string } -// Describes a type of a block list +// Describes type of block list type BlockList interface { BlockListType() string } -// Represents the type of a file +// Represents the type of file type FileType interface { FileTypeType() string } -// Represents the type of a network +// Represents the type of network type NetworkType interface { NetworkTypeType() string } @@ -2368,7 +3579,7 @@ type TopChatCategory interface { TopChatCategoryType() string } -// Describes the type of a URL linking to an internal Telegram entity +// Describes the type of URL linking to an internal Telegram entity type TMeUrlType interface { TMeUrlTypeType() string } @@ -2383,7 +3594,7 @@ type TextParseMode interface { TextParseModeType() string } -// Describes the type of a proxy server +// Describes the type of proxy server type ProxyType interface { ProxyTypeType() string } @@ -2393,11 +3604,26 @@ type StatisticalGraph interface { StatisticalGraphType() string } +// Describes type of object, for which statistics are provided +type ChatStatisticsObjectType interface { + ChatStatisticsObjectTypeType() string +} + // Contains a detailed statistics about a chat type ChatStatistics interface { ChatStatisticsType() string } +// Describes state of a revenue withdrawal +type RevenueWithdrawalState interface { + RevenueWithdrawalStateType() string +} + +// Describes type of transaction for revenue earned from sponsored messages in a chat +type ChatRevenueTransactionType interface { + ChatRevenueTransactionTypeType() string +} + // Represents a vector path command type VectorPathCommand interface { VectorPathCommandType() string @@ -2408,6 +3634,11 @@ type BotCommandScope interface { BotCommandScopeType() string } +// Describes type of the request for which a code is sent to a phone number +type PhoneNumberCodeType interface { + PhoneNumberCodeTypeType() string +} + // Contains notifications about data changes type Update interface { UpdateType() string @@ -2464,7 +3695,7 @@ func (*Ok) GetType() string { return TypeOk } -// An authentication code is delivered via a private Telegram message, which can be viewed from another active session +// A digit-only authentication code is delivered via a private Telegram message, which can be viewed from another active session type AuthenticationCodeTypeTelegramMessage struct { meta // Length of the code @@ -2491,7 +3722,7 @@ func (*AuthenticationCodeTypeTelegramMessage) AuthenticationCodeTypeType() strin return TypeAuthenticationCodeTypeTelegramMessage } -// An authentication code is delivered via an SMS message to the specified phone number; applications may not receive this type of code +// A digit-only authentication code is delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code type AuthenticationCodeTypeSms struct { meta // Length of the code @@ -2518,7 +3749,61 @@ func (*AuthenticationCodeTypeSms) AuthenticationCodeTypeType() string { return TypeAuthenticationCodeTypeSms } -// An authentication code is delivered via a phone call to the specified phone number +// An authentication code is a word delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code +type AuthenticationCodeTypeSmsWord struct { + meta + // The first letters of the word if known + FirstLetter string `json:"first_letter"` +} + +func (entity *AuthenticationCodeTypeSmsWord) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeSmsWord + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeSmsWord) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeSmsWord) GetType() string { + return TypeAuthenticationCodeTypeSmsWord +} + +func (*AuthenticationCodeTypeSmsWord) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeSmsWord +} + +// An authentication code is a phrase from multiple words delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code +type AuthenticationCodeTypeSmsPhrase struct { + meta + // The first word of the phrase if known + FirstWord string `json:"first_word"` +} + +func (entity *AuthenticationCodeTypeSmsPhrase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeSmsPhrase + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeSmsPhrase) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeSmsPhrase) GetType() string { + return TypeAuthenticationCodeTypeSmsPhrase +} + +func (*AuthenticationCodeTypeSmsPhrase) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeSmsPhrase +} + +// A digit-only authentication code is delivered via a phone call to the specified phone number type AuthenticationCodeTypeCall struct { meta // Length of the code @@ -2601,7 +3886,7 @@ func (*AuthenticationCodeTypeMissedCall) AuthenticationCodeTypeType() string { return TypeAuthenticationCodeTypeMissedCall } -// An authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT +// A digit-only authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT type AuthenticationCodeTypeFragment struct { meta // URL to open to receive the code @@ -2630,11 +3915,11 @@ func (*AuthenticationCodeTypeFragment) AuthenticationCodeTypeType() string { return TypeAuthenticationCodeTypeFragment } -// An authentication code is delivered via Firebase Authentication to the official Android application +// A digit-only authentication code is delivered via Firebase Authentication to the official Android application type AuthenticationCodeTypeFirebaseAndroid struct { meta - // Nonce to pass to the SafetyNet Attestation API - Nonce []byte `json:"nonce"` + // Parameters to be used for device verification + DeviceVerificationParameters FirebaseDeviceVerificationParameters `json:"device_verification_parameters"` // Length of the code Length int32 `json:"length"` } @@ -2659,12 +3944,31 @@ func (*AuthenticationCodeTypeFirebaseAndroid) AuthenticationCodeTypeType() strin return TypeAuthenticationCodeTypeFirebaseAndroid } -// An authentication code is delivered via Firebase Authentication to the official iOS application +func (authenticationCodeTypeFirebaseAndroid *AuthenticationCodeTypeFirebaseAndroid) UnmarshalJSON(data []byte) error { + var tmp struct { + DeviceVerificationParameters json.RawMessage `json:"device_verification_parameters"` + Length int32 `json:"length"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + authenticationCodeTypeFirebaseAndroid.Length = tmp.Length + + fieldDeviceVerificationParameters, _ := UnmarshalFirebaseDeviceVerificationParameters(tmp.DeviceVerificationParameters) + authenticationCodeTypeFirebaseAndroid.DeviceVerificationParameters = fieldDeviceVerificationParameters + + return nil +} + +// A digit-only authentication code is delivered via Firebase Authentication to the official iOS application type AuthenticationCodeTypeFirebaseIos struct { meta // Receipt of successful application token validation to compare with receipt from push notification Receipt string `json:"receipt"` - // Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds + // Time after the next authentication method is expected to be used if verification push notification isn't received, in seconds PushTimeout int32 `json:"push_timeout"` // Length of the code Length int32 `json:"length"` @@ -3027,6 +4331,60 @@ func (*TermsOfService) GetType() string { return TypeTermsOfService } +// Describes a passkey +type Passkey struct { + meta + // Unique identifier of the passkey + Id string `json:"id"` + // Name of the passkey + Name string `json:"name"` + // Point in time (Unix timestamp) when the passkey was added + AdditionDate int32 `json:"addition_date"` + // Point in time (Unix timestamp) when the passkey was used last time; 0 if never + LastUsageDate int32 `json:"last_usage_date"` + // Identifier of the custom emoji that is used as the icon of the software, which created the passkey; 0 if unknown + SoftwareIconCustomEmojiId JsonInt64 `json:"software_icon_custom_emoji_id"` +} + +func (entity *Passkey) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Passkey + + return json.Marshal((*stub)(entity)) +} + +func (*Passkey) GetClass() string { + return ClassPasskey +} + +func (*Passkey) GetType() string { + return TypePasskey +} + +// Contains a list of passkeys +type Passkeys struct { + meta + // List of passkeys + Passkeys []*Passkey `json:"passkeys"` +} + +func (entity *Passkeys) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Passkeys + + return json.Marshal((*stub)(entity)) +} + +func (*Passkeys) GetClass() string { + return ClassPasskeys +} + +func (*Passkeys) GetType() string { + return TypePasskeys +} + // Initialization parameters are needed. Call setTdlibParameters to provide them type AuthorizationStateWaitTdlibParameters struct{ meta @@ -3052,7 +4410,7 @@ func (*AuthorizationStateWaitTdlibParameters) AuthorizationStateType() string { return TypeAuthorizationStateWaitTdlibParameters } -// TDLib needs the user's phone number to authorize. Call setAuthenticationPhoneNumber to provide the phone number, or use requestQrCodeAuthentication or checkAuthenticationBotToken for other authentication options +// TDLib needs the user's phone number to authorize. Call setAuthenticationPhoneNumber to provide the phone number, or use requestQrCodeAuthentication, getAuthenticationPasskeyParameters, or checkAuthenticationBotToken for other authentication options type AuthorizationStateWaitPhoneNumber struct{ meta } @@ -3077,6 +4435,37 @@ func (*AuthorizationStateWaitPhoneNumber) AuthorizationStateType() string { return TypeAuthorizationStateWaitPhoneNumber } +// The user must buy Telegram Premium as an in-store purchase to log in. Call checkAuthenticationPremiumPurchase and then setAuthenticationPremiumPurchaseTransaction +type AuthorizationStateWaitPremiumPurchase struct { + meta + // Identifier of the store product that must be bought + StoreProductId string `json:"store_product_id"` + // Email address to use for support if the user has issues with Telegram Premium purchase + SupportEmailAddress string `json:"support_email_address"` + // Subject for the email sent to the support email address + SupportEmailSubject string `json:"support_email_subject"` +} + +func (entity *AuthorizationStateWaitPremiumPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthorizationStateWaitPremiumPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*AuthorizationStateWaitPremiumPurchase) GetClass() string { + return ClassAuthorizationState +} + +func (*AuthorizationStateWaitPremiumPurchase) GetType() string { + return TypeAuthorizationStateWaitPremiumPurchase +} + +func (*AuthorizationStateWaitPremiumPurchase) AuthorizationStateType() string { + return TypeAuthorizationStateWaitPremiumPurchase +} + // TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed type AuthorizationStateWaitEmailAddress struct { meta @@ -3376,6 +4765,62 @@ func (*AuthorizationStateClosed) AuthorizationStateType() string { return TypeAuthorizationStateClosed } +// Device verification must be performed with the SafetyNet Attestation API +type FirebaseDeviceVerificationParametersSafetyNet struct { + meta + // Nonce to pass to the SafetyNet Attestation API + Nonce []byte `json:"nonce"` +} + +func (entity *FirebaseDeviceVerificationParametersSafetyNet) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FirebaseDeviceVerificationParametersSafetyNet + + return json.Marshal((*stub)(entity)) +} + +func (*FirebaseDeviceVerificationParametersSafetyNet) GetClass() string { + return ClassFirebaseDeviceVerificationParameters +} + +func (*FirebaseDeviceVerificationParametersSafetyNet) GetType() string { + return TypeFirebaseDeviceVerificationParametersSafetyNet +} + +func (*FirebaseDeviceVerificationParametersSafetyNet) FirebaseDeviceVerificationParametersType() string { + return TypeFirebaseDeviceVerificationParametersSafetyNet +} + +// Device verification must be performed with the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) +type FirebaseDeviceVerificationParametersPlayIntegrity struct { + meta + // Base64url-encoded nonce to pass to the Play Integrity API + Nonce string `json:"nonce"` + // Cloud project number to pass to the Play Integrity API + CloudProjectNumber JsonInt64 `json:"cloud_project_number"` +} + +func (entity *FirebaseDeviceVerificationParametersPlayIntegrity) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FirebaseDeviceVerificationParametersPlayIntegrity + + return json.Marshal((*stub)(entity)) +} + +func (*FirebaseDeviceVerificationParametersPlayIntegrity) GetClass() string { + return ClassFirebaseDeviceVerificationParameters +} + +func (*FirebaseDeviceVerificationParametersPlayIntegrity) GetType() string { + return TypeFirebaseDeviceVerificationParametersPlayIntegrity +} + +func (*FirebaseDeviceVerificationParametersPlayIntegrity) FirebaseDeviceVerificationParametersType() string { + return TypeFirebaseDeviceVerificationParametersPlayIntegrity +} + // Represents the current state of 2-step verification type PasswordState struct { meta @@ -3641,14 +5086,14 @@ func (*InputFileLocal) InputFileType() string { return TypeInputFileLocal } -// A file generated by the application +// A file generated by the application. The application must handle updates updateFileGenerationStart and updateFileGenerationStop to generate the file when asked by TDLib type InputFileGenerated struct { meta - // Local path to a file from which the file is generated; may be empty if there is no such file + // Local path to a file from which the file is generated. The path doesn't have to be a valid path and is used by TDLib only to detect name and MIME type of the generated file OriginalPath string `json:"original_path"` // String specifying the conversion applied to the original file; must be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage Conversion string `json:"conversion"` - // Expected size of the generated file, in bytes; 0 if unknown + // Expected size of the generated file, in bytes; pass 0 if unknown ExpectedSize int64 `json:"expected_size"` } @@ -3830,7 +5275,7 @@ func (*ThumbnailFormatPng) ThumbnailFormatType() string { return TypeThumbnailFormatPng } -// The thumbnail is in TGS format. It will be used only for TGS sticker sets +// The thumbnail is in TGS format. It will be used only for sticker sets type ThumbnailFormatTgs struct{ meta } @@ -3855,7 +5300,7 @@ func (*ThumbnailFormatTgs) ThumbnailFormatType() string { return TypeThumbnailFormatTgs } -// The thumbnail is in WEBM format. It will be used only for WEBM sticker sets +// The thumbnail is in WEBM format. It will be used only for sticker sets type ThumbnailFormatWebm struct{ meta } @@ -3880,7 +5325,7 @@ func (*ThumbnailFormatWebm) ThumbnailFormatType() string { return TypeThumbnailFormatWebm } -// The thumbnail is in WEBP format. It will be used only for some stickers +// The thumbnail is in WEBP format. It will be used only for some stickers and sticker sets type ThumbnailFormatWebp struct{ meta } @@ -4342,7 +5787,7 @@ func (*StickerFullTypeCustomEmoji) StickerFullTypeType() string { return TypeStickerFullTypeCustomEmoji } -// Represents a closed vector path. The path begins at the end point of the last command +// Represents a closed vector path. The path begins at the end point of the last command. The coordinate system origin is in the upper-left corner type ClosedVectorPath struct { meta // List of vector path commands @@ -4381,11 +5826,34 @@ func (closedVectorPath *ClosedVectorPath) UnmarshalJSON(data []byte) error { return nil } +// Represents outline of an image +type Outline struct { + meta + // The list of closed vector paths + Paths []*ClosedVectorPath `json:"paths"` +} + +func (entity *Outline) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Outline + + return json.Marshal((*stub)(entity)) +} + +func (*Outline) GetClass() string { + return ClassOutline +} + +func (*Outline) GetType() string { + return TypeOutline +} + // Describes one answer option of a poll type PollOption struct { meta - // Option text; 1-100 characters - Text string `json:"text"` + // Option text; 1-100 characters. Only custom emoji entities are allowed + Text *FormattedText `json:"text"` // Number of voters for this option, available only for closed or voted polls VoterCount int32 `json:"voter_count"` // The percentage of votes for this option; 0-100 @@ -4468,6 +5936,145 @@ func (*PollTypeQuiz) PollTypeType() string { return TypePollTypeQuiz } +// Describes a task in a checklist +type ChecklistTask struct { + meta + // Unique identifier of the task + Id int32 `json:"id"` + // Text of the task; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Url, EmailAddress, Mention, Hashtag, Cashtag and PhoneNumber entities + Text *FormattedText `json:"text"` + // Identifier of the user or chat that completed the task; may be null if the task isn't completed yet + CompletedBy MessageSender `json:"completed_by"` + // Point in time (Unix timestamp) when the task was completed; 0 if the task isn't completed + CompletionDate int32 `json:"completion_date"` +} + +func (entity *ChecklistTask) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChecklistTask + + return json.Marshal((*stub)(entity)) +} + +func (*ChecklistTask) GetClass() string { + return ClassChecklistTask +} + +func (*ChecklistTask) GetType() string { + return TypeChecklistTask +} + +func (checklistTask *ChecklistTask) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int32 `json:"id"` + Text *FormattedText `json:"text"` + CompletedBy json.RawMessage `json:"completed_by"` + CompletionDate int32 `json:"completion_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + checklistTask.Id = tmp.Id + checklistTask.Text = tmp.Text + checklistTask.CompletionDate = tmp.CompletionDate + + fieldCompletedBy, _ := UnmarshalMessageSender(tmp.CompletedBy) + checklistTask.CompletedBy = fieldCompletedBy + + return nil +} + +// Describes a task in a checklist to be sent +type InputChecklistTask struct { + meta + // Unique identifier of the task; must be positive + Id int32 `json:"id"` + // Text of the task; 1-getOption("checklist_task_text_length_max") characters without line feeds. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Text *FormattedText `json:"text"` +} + +func (entity *InputChecklistTask) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChecklistTask + + return json.Marshal((*stub)(entity)) +} + +func (*InputChecklistTask) GetClass() string { + return ClassInputChecklistTask +} + +func (*InputChecklistTask) GetType() string { + return TypeInputChecklistTask +} + +// Describes a checklist +type Checklist struct { + meta + // Title of the checklist; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Title *FormattedText `json:"title"` + // List of tasks in the checklist + Tasks []*ChecklistTask `json:"tasks"` + // True, if users other than creator of the list can add tasks to the list + OthersCanAddTasks bool `json:"others_can_add_tasks"` + // True, if the current user can add tasks to the list if they have Telegram Premium subscription + CanAddTasks bool `json:"can_add_tasks"` + // True, if users other than creator of the list can mark tasks as done or not done. If true, then the checklist is called "group checklist" + OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done"` + // True, if the current user can mark tasks as done or not done if they have Telegram Premium subscription + CanMarkTasksAsDone bool `json:"can_mark_tasks_as_done"` +} + +func (entity *Checklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Checklist + + return json.Marshal((*stub)(entity)) +} + +func (*Checklist) GetClass() string { + return ClassChecklist +} + +func (*Checklist) GetType() string { + return TypeChecklist +} + +// Describes a checklist to be sent +type InputChecklist struct { + meta + // Title of the checklist; 1-getOption("checklist_title_length_max") characters. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities + Title *FormattedText `json:"title"` + // List of tasks in the checklist; 1-getOption("checklist_task_count_max") tasks + Tasks []*InputChecklistTask `json:"tasks"` + // True, if other users can add tasks to the list + OthersCanAddTasks bool `json:"others_can_add_tasks"` + // True, if other users can mark tasks as done or not done + OthersCanMarkTasksAsDone bool `json:"others_can_mark_tasks_as_done"` +} + +func (entity *InputChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*InputChecklist) GetClass() string { + return ClassInputChecklist +} + +func (*InputChecklist) GetType() string { + return TypeInputChecklist +} + // Describes an animation file. The animation must be encoded in GIF or MPEG4 format type Animation struct { meta @@ -4522,7 +6129,7 @@ type Audio struct { MimeType string `json:"mime_type"` // The minithumbnail of the album cover; may be null AlbumCoverMinithumbnail *Minithumbnail `json:"album_cover_minithumbnail"` - // The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is supposed to be extracted from the downloaded audio file; may be null + // The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is expected to be extracted from the downloaded audio file; may be null AlbumCoverThumbnail *Thumbnail `json:"album_cover_thumbnail"` // Album cover variants to use if the downloaded audio file contains no album cover. Provided thumbnail dimensions are approximate ExternalAlbumCovers []*Thumbnail `json:"external_album_covers"` @@ -4546,6 +6153,31 @@ func (*Audio) GetType() string { return TypeAudio } +// Contains a list of audio files +type Audios struct { + meta + // Approximate total number of audio files found + TotalCount int32 `json:"total_count"` + // List of audio files + Audios []*Audio `json:"audios"` +} + +func (entity *Audios) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Audios + + return json.Marshal((*stub)(entity)) +} + +func (*Audios) GetClass() string { + return ClassAudios +} + +func (*Audios) GetType() string { + return TypeAudios +} + // Describes a document of any type type Document struct { meta @@ -4615,14 +6247,12 @@ type Sticker struct { Width int32 `json:"width"` // Sticker height; as defined by the sender Height int32 `json:"height"` - // Emoji corresponding to the sticker + // Emoji corresponding to the sticker; may be empty if unknown Emoji string `json:"emoji"` // Sticker format Format StickerFormat `json:"format"` // Sticker's full type FullType StickerFullType `json:"full_type"` - // Sticker's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner - Outline []*ClosedVectorPath `json:"outline"` // Sticker thumbnail in WEBP or JPEG format; may be null Thumbnail *Thumbnail `json:"thumbnail"` // File containing the sticker @@ -4654,7 +6284,6 @@ func (sticker *Sticker) UnmarshalJSON(data []byte) error { Emoji string `json:"emoji"` Format json.RawMessage `json:"format"` FullType json.RawMessage `json:"full_type"` - Outline []*ClosedVectorPath `json:"outline"` Thumbnail *Thumbnail `json:"thumbnail"` Sticker *File `json:"sticker"` } @@ -4669,7 +6298,6 @@ func (sticker *Sticker) UnmarshalJSON(data []byte) error { sticker.Width = tmp.Width sticker.Height = tmp.Height sticker.Emoji = tmp.Emoji - sticker.Outline = tmp.Outline sticker.Thumbnail = tmp.Thumbnail sticker.Sticker = tmp.Sticker @@ -4697,7 +6325,7 @@ type Video struct { MimeType string `json:"mime_type"` // True, if stickers were added to the video. The list of corresponding sticker sets can be received using getAttachedStickerSets HasStickers bool `json:"has_stickers"` - // True, if the video is supposed to be streamed + // True, if the video is expected to be streamed SupportsStreaming bool `json:"supports_streaming"` // Video minithumbnail; may be null Minithumbnail *Minithumbnail `json:"minithumbnail"` @@ -4787,14 +6415,14 @@ func (videoNote *VideoNote) UnmarshalJSON(data []byte) error { return nil } -// Describes a voice note. The voice note must be encoded with the Opus codec, and stored inside an OGG container. Voice notes can have only a single audio channel +// Describes a voice note type VoiceNote struct { meta // Duration of the voice note, in seconds; as defined by the sender Duration int32 `json:"duration"` // A waveform representation of the voice note in 5-bit format Waveform []byte `json:"waveform"` - // MIME type of the file; as defined by the sender + // MIME type of the file; as defined by the sender. Usually, one of "audio/ogg" for Opus in an OGG container, "audio/mpeg" for an MP3 audio, or "audio/mp4" for an M4A audio MimeType string `json:"mime_type"` // Result of speech recognition in the voice note; may be null SpeechRecognitionResult SpeechRecognitionResult `json:"speech_recognition_result"` @@ -4846,7 +6474,7 @@ func (voiceNote *VoiceNote) UnmarshalJSON(data []byte) error { // Describes an animated or custom representation of an emoji type AnimatedEmoji struct { meta - // Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker is a custom emoji, it can have arbitrary format different from stickerFormatTgs + // Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker is a custom emoji, then it can have arbitrary format Sticker *Sticker `json:"sticker"` // Expected width of the sticker, which can be used if the sticker is null StickerWidth int32 `json:"sticker_width"` @@ -4874,14 +6502,14 @@ func (*AnimatedEmoji) GetType() string { return TypeAnimatedEmoji } -// Describes a user contact +// Describes a contact of a user type Contact struct { meta // Phone number of the user PhoneNumber string `json:"phone_number"` - // First name of the user; 1-255 characters in length + // First name of the user; 1-64 characters FirstName string `json:"first_name"` - // Last name of the user + // Last name of the user; 0-64 characters LastName string `json:"last_name"` // Additional data about the user in a form of vCard; 0-2048 bytes in length Vcard string `json:"vcard"` @@ -5000,6 +6628,39 @@ func (*Game) GetType() string { return TypeGame } +// Describes state of the stake dice +type StakeDiceState struct { + meta + // Hash of the state to use for sending the next dice; may be empty if the stake dice can't be sent by the current user + StateHash string `json:"state_hash"` + // The Toncoin amount that was staked in the previous roll; in the smallest units of the currency + StakeToncoinAmount int64 `json:"stake_toncoin_amount"` + // The amounts of Toncoins that are suggested to be staked; in the smallest units of the currency + SuggestedStakeToncoinAmounts []int64 `json:"suggested_stake_toncoin_amounts"` + // The number of rolled sixes towards the streak; 0-2 + CurrentStreak int32 `json:"current_streak"` + // The number of Toncoins received by the user for each 1000 Toncoins staked if the dice outcome is 1-6 correspondingly; may be empty if the stake dice can't be sent by the current user + PrizePerMille []int32 `json:"prize_per_mille"` + // The number of Toncoins received by the user for each 1000 Toncoins staked if the dice outcome is 6 three times in a row with the same stake + StreakPrizePerMille int32 `json:"streak_prize_per_mille"` +} + +func (entity *StakeDiceState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StakeDiceState + + return json.Marshal((*stub)(entity)) +} + +func (*StakeDiceState) GetClass() string { + return ClassStakeDiceState +} + +func (*StakeDiceState) GetType() string { + return TypeStakeDiceState +} + // Describes a Web App. Use getInternalLink with internalLinkTypeWebApp to share the Web App type WebApp struct { meta @@ -5036,8 +6697,8 @@ type Poll struct { meta // Unique poll identifier Id JsonInt64 `json:"id"` - // Poll question; 1-300 characters - Question string `json:"question"` + // Poll question; 1-300 characters. Only custom emoji entities are allowed + Question *FormattedText `json:"question"` // List of poll answer options Options []*PollOption `json:"options"` // Total number of voters, participating in the poll @@ -5075,7 +6736,7 @@ func (*Poll) GetType() string { func (poll *Poll) UnmarshalJSON(data []byte) error { var tmp struct { Id JsonInt64 `json:"id"` - Question string `json:"question"` + Question *FormattedText `json:"question"` Options []*PollOption `json:"options"` TotalVoterCount int32 `json:"total_voter_count"` RecentVoterIds []json.RawMessage `json:"recent_voter_ids"` @@ -5109,6 +6770,68 @@ func (poll *Poll) UnmarshalJSON(data []byte) error { return nil } +// Describes an alternative re-encoded quality of a video file +type AlternativeVideo struct { + meta + // Unique identifier of the alternative video, which is used in the HLS file + Id JsonInt64 `json:"id"` + // Video width + Width int32 `json:"width"` + // Video height + Height int32 `json:"height"` + // Codec used for video file encoding, for example, "h264", "h265", "av1", or "av01" + Codec string `json:"codec"` + // HLS file describing the video + HlsFile *File `json:"hls_file"` + // File containing the video + Video *File `json:"video"` +} + +func (entity *AlternativeVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AlternativeVideo + + return json.Marshal((*stub)(entity)) +} + +func (*AlternativeVideo) GetClass() string { + return ClassAlternativeVideo +} + +func (*AlternativeVideo) GetType() string { + return TypeAlternativeVideo +} + +// Describes a storyboard for a video +type VideoStoryboard struct { + meta + // A JPEG file that contains tiled previews of video + StoryboardFile *File `json:"storyboard_file"` + // Width of a tile + Width int32 `json:"width"` + // Height of a tile + Height int32 `json:"height"` + // File that describes mapping of position in the video to a tile in the JPEG file + MapFile *File `json:"map_file"` +} + +func (entity *VideoStoryboard) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoStoryboard + + return json.Marshal((*stub)(entity)) +} + +func (*VideoStoryboard) GetClass() string { + return ClassVideoStoryboard +} + +func (*VideoStoryboard) GetType() string { + return TypeVideoStoryboard +} + // Describes a chat background type Background struct { meta @@ -5120,7 +6843,7 @@ type Background struct { IsDark bool `json:"is_dark"` // Unique background name Name string `json:"name"` - // Document with the background; may be null. Null only for filled backgrounds + // Document with the background; may be null. Null only for filled and chat theme backgrounds Document *Document `json:"document"` // Type of the background Type BackgroundType `json:"type"` @@ -5197,7 +6920,7 @@ type ChatBackground struct { meta // The background Background *Background `json:"background"` - // Dimming of the background in dark themes, as a percentage; 0-100 + // Dimming of the background in dark themes, as a percentage; 0-100. Applied only to Wallpaper and Fill types of background DarkThemeDimming int32 `json:"dark_theme_dimming"` } @@ -5281,6 +7004,206 @@ func (*ChatPhotoInfo) GetType() string { return TypeChatPhotoInfo } +// A tab with stories posted by the user or the channel chat and saved to profile +type ProfileTabPosts struct{ + meta +} + +func (entity *ProfileTabPosts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabPosts + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabPosts) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabPosts) GetType() string { + return TypeProfileTabPosts +} + +func (*ProfileTabPosts) ProfileTabType() string { + return TypeProfileTabPosts +} + +// A tab with gifts received by the user or the channel chat +type ProfileTabGifts struct{ + meta +} + +func (entity *ProfileTabGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabGifts + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabGifts) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabGifts) GetType() string { + return TypeProfileTabGifts +} + +func (*ProfileTabGifts) ProfileTabType() string { + return TypeProfileTabGifts +} + +// A tab with photos and videos posted by the channel +type ProfileTabMedia struct{ + meta +} + +func (entity *ProfileTabMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabMedia + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabMedia) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabMedia) GetType() string { + return TypeProfileTabMedia +} + +func (*ProfileTabMedia) ProfileTabType() string { + return TypeProfileTabMedia +} + +// A tab with documents posted by the channel +type ProfileTabFiles struct{ + meta +} + +func (entity *ProfileTabFiles) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabFiles + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabFiles) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabFiles) GetType() string { + return TypeProfileTabFiles +} + +func (*ProfileTabFiles) ProfileTabType() string { + return TypeProfileTabFiles +} + +// A tab with messages posted by the channel and containing links +type ProfileTabLinks struct{ + meta +} + +func (entity *ProfileTabLinks) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabLinks + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabLinks) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabLinks) GetType() string { + return TypeProfileTabLinks +} + +func (*ProfileTabLinks) ProfileTabType() string { + return TypeProfileTabLinks +} + +// A tab with audio messages posted by the channel +type ProfileTabMusic struct{ + meta +} + +func (entity *ProfileTabMusic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabMusic + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabMusic) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabMusic) GetType() string { + return TypeProfileTabMusic +} + +func (*ProfileTabMusic) ProfileTabType() string { + return TypeProfileTabMusic +} + +// A tab with voice notes posted by the channel +type ProfileTabVoice struct{ + meta +} + +func (entity *ProfileTabVoice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabVoice + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabVoice) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabVoice) GetType() string { + return TypeProfileTabVoice +} + +func (*ProfileTabVoice) ProfileTabType() string { + return TypeProfileTabVoice +} + +// A tab with animations posted by the channel +type ProfileTabGifs struct{ + meta +} + +func (entity *ProfileTabGifs) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileTabGifs + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileTabGifs) GetClass() string { + return ClassProfileTab +} + +func (*ProfileTabGifs) GetType() string { + return TypeProfileTabGifs +} + +func (*ProfileTabGifs) ProfileTabType() string { + return TypeProfileTabGifs +} + // A regular user type UserTypeRegular struct{ meta @@ -5340,14 +7263,24 @@ type UserTypeBot struct { CanJoinGroups bool `json:"can_join_groups"` // True, if the bot can read all messages in basic group or supergroup chats and not just those addressed to the bot. In private and channel chats a bot can always read all messages CanReadAllGroupMessages bool `json:"can_read_all_group_messages"` + // True, if the bot has the main Web App + HasMainWebApp bool `json:"has_main_web_app"` + // True, if the bot has topics + HasTopics bool `json:"has_topics"` + // True, if users can create and delete topics in the chat with the bot + AllowsUsersToCreateTopics bool `json:"allows_users_to_create_topics"` // True, if the bot supports inline queries IsInline bool `json:"is_inline"` // Placeholder for inline queries (displayed on the application input field) InlineQueryPlaceholder string `json:"inline_query_placeholder"` // True, if the location of the user is expected to be sent with every inline query to this bot NeedLocation bool `json:"need_location"` + // True, if the bot supports connection to Telegram Business accounts + CanConnectToBusiness bool `json:"can_connect_to_business"` // True, if the bot can be added to attachment or side menu CanBeAddedToAttachmentMenu bool `json:"can_be_added_to_attachment_menu"` + // The number of recently active users of the bot + ActiveUserCount int32 `json:"active_user_count"` } func (entity *UserTypeBot) MarshalJSON() ([]byte, error) { @@ -5450,7 +7383,7 @@ type BotMenuButton struct { meta // Text of the button Text string `json:"text"` - // URL to be passed to openWebApp + // URL of a Web App to open when the button is pressed. If the link is of the type internalLinkTypeWebApp, then it must be processed accordingly. Otherwise, the link must be passed to openWebApp Url string `json:"url"` } @@ -5470,6 +7403,91 @@ func (*BotMenuButton) GetType() string { return TypeBotMenuButton } +// Describes parameters of verification that is provided by a bot +type BotVerificationParameters struct { + meta + // Identifier of the custom emoji that is used as the verification sign + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` + // Name of the organization that provides verification + OrganizationName string `json:"organization_name"` + // Default custom description of verification reason to be used as placeholder in setMessageSenderBotVerification; may be null if none + DefaultCustomDescription *FormattedText `json:"default_custom_description"` + // True, if the bot is allowed to provide custom description for verified entities + CanSetCustomDescription bool `json:"can_set_custom_description"` +} + +func (entity *BotVerificationParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotVerificationParameters + + return json.Marshal((*stub)(entity)) +} + +func (*BotVerificationParameters) GetClass() string { + return ClassBotVerificationParameters +} + +func (*BotVerificationParameters) GetType() string { + return TypeBotVerificationParameters +} + +// Describes verification status provided by a bot +type BotVerification struct { + meta + // Identifier of the bot that provided the verification + BotUserId int64 `json:"bot_user_id"` + // Identifier of the custom emoji that is used as the verification sign + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` + // Custom description of verification reason set by the bot. Can contain only Mention, Hashtag, Cashtag, PhoneNumber, BankCardNumber, Url, and EmailAddress entities + CustomDescription *FormattedText `json:"custom_description"` +} + +func (entity *BotVerification) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotVerification + + return json.Marshal((*stub)(entity)) +} + +func (*BotVerification) GetClass() string { + return ClassBotVerification +} + +func (*BotVerification) GetType() string { + return TypeBotVerification +} + +// Contains information about verification status of a chat or a user +type VerificationStatus struct { + meta + // True, if the chat or the user is verified by Telegram + IsVerified bool `json:"is_verified"` + // True, if the chat or the user is marked as scam by Telegram + IsScam bool `json:"is_scam"` + // True, if the chat or the user is marked as fake by Telegram + IsFake bool `json:"is_fake"` + // Identifier of the custom emoji to be shown as verification sign provided by a bot for the user; 0 if none + BotVerificationIconCustomEmojiId JsonInt64 `json:"bot_verification_icon_custom_emoji_id"` +} + +func (entity *VerificationStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VerificationStatus + + return json.Marshal((*stub)(entity)) +} + +func (*VerificationStatus) GetClass() string { + return ClassVerificationStatus +} + +func (*VerificationStatus) GetType() string { + return TypeVerificationStatus +} + // Represents a location to which a chat is connected type ChatLocation struct { meta @@ -5495,6 +7513,616 @@ func (*ChatLocation) GetType() string { return TypeChatLocation } +// Represents a birthdate of a user +type Birthdate struct { + meta + // Day of the month; 1-31 + Day int32 `json:"day"` + // Month of the year; 1-12 + Month int32 `json:"month"` + // Birth year; 0 if unknown + Year int32 `json:"year"` +} + +func (entity *Birthdate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Birthdate + + return json.Marshal((*stub)(entity)) +} + +func (*Birthdate) GetClass() string { + return ClassBirthdate +} + +func (*Birthdate) GetType() string { + return TypeBirthdate +} + +// Describes a user who had or will have a birthday soon +type CloseBirthdayUser struct { + meta + // User identifier + UserId int64 `json:"user_id"` + // Birthdate of the user + Birthdate *Birthdate `json:"birthdate"` +} + +func (entity *CloseBirthdayUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CloseBirthdayUser + + return json.Marshal((*stub)(entity)) +} + +func (*CloseBirthdayUser) GetClass() string { + return ClassCloseBirthdayUser +} + +func (*CloseBirthdayUser) GetType() string { + return TypeCloseBirthdayUser +} + +// Send away messages always +type BusinessAwayMessageScheduleAlways struct{ + meta +} + +func (entity *BusinessAwayMessageScheduleAlways) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessAwayMessageScheduleAlways + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessAwayMessageScheduleAlways) GetClass() string { + return ClassBusinessAwayMessageSchedule +} + +func (*BusinessAwayMessageScheduleAlways) GetType() string { + return TypeBusinessAwayMessageScheduleAlways +} + +func (*BusinessAwayMessageScheduleAlways) BusinessAwayMessageScheduleType() string { + return TypeBusinessAwayMessageScheduleAlways +} + +// Send away messages outside of the business opening hours +type BusinessAwayMessageScheduleOutsideOfOpeningHours struct{ + meta +} + +func (entity *BusinessAwayMessageScheduleOutsideOfOpeningHours) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessAwayMessageScheduleOutsideOfOpeningHours + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessAwayMessageScheduleOutsideOfOpeningHours) GetClass() string { + return ClassBusinessAwayMessageSchedule +} + +func (*BusinessAwayMessageScheduleOutsideOfOpeningHours) GetType() string { + return TypeBusinessAwayMessageScheduleOutsideOfOpeningHours +} + +func (*BusinessAwayMessageScheduleOutsideOfOpeningHours) BusinessAwayMessageScheduleType() string { + return TypeBusinessAwayMessageScheduleOutsideOfOpeningHours +} + +// Send away messages only in the specified time span +type BusinessAwayMessageScheduleCustom struct { + meta + // Point in time (Unix timestamp) when the away messages will start to be sent + StartDate int32 `json:"start_date"` + // Point in time (Unix timestamp) when the away messages will stop to be sent + EndDate int32 `json:"end_date"` +} + +func (entity *BusinessAwayMessageScheduleCustom) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessAwayMessageScheduleCustom + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessAwayMessageScheduleCustom) GetClass() string { + return ClassBusinessAwayMessageSchedule +} + +func (*BusinessAwayMessageScheduleCustom) GetType() string { + return TypeBusinessAwayMessageScheduleCustom +} + +func (*BusinessAwayMessageScheduleCustom) BusinessAwayMessageScheduleType() string { + return TypeBusinessAwayMessageScheduleCustom +} + +// Represents a location of a business +type BusinessLocation struct { + meta + // The location; may be null if not specified + Location *Location `json:"location"` + // Location address; 1-96 characters + Address string `json:"address"` +} + +func (entity *BusinessLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessLocation + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessLocation) GetClass() string { + return ClassBusinessLocation +} + +func (*BusinessLocation) GetType() string { + return TypeBusinessLocation +} + +// Describes private chats chosen for automatic interaction with a business +type BusinessRecipients struct { + meta + // Identifiers of selected private chats + ChatIds []int64 `json:"chat_ids"` + // Identifiers of private chats that are always excluded; for businessConnectedBot only + ExcludedChatIds []int64 `json:"excluded_chat_ids"` + // True, if all existing private chats are selected + SelectExistingChats bool `json:"select_existing_chats"` + // True, if all new private chats are selected + SelectNewChats bool `json:"select_new_chats"` + // True, if all private chats with contacts are selected + SelectContacts bool `json:"select_contacts"` + // True, if all private chats with non-contacts are selected + SelectNonContacts bool `json:"select_non_contacts"` + // If true, then all private chats except the selected are chosen. Otherwise, only the selected chats are chosen + ExcludeSelected bool `json:"exclude_selected"` +} + +func (entity *BusinessRecipients) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessRecipients + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessRecipients) GetClass() string { + return ClassBusinessRecipients +} + +func (*BusinessRecipients) GetType() string { + return TypeBusinessRecipients +} + +// Describes settings for messages that are automatically sent by a Telegram Business account when it is away +type BusinessAwayMessageSettings struct { + meta + // Unique quick reply shortcut identifier for the away messages + ShortcutId int32 `json:"shortcut_id"` + // Chosen recipients of the away messages + Recipients *BusinessRecipients `json:"recipients"` + // Settings used to check whether the current user is away + Schedule BusinessAwayMessageSchedule `json:"schedule"` + // True, if the messages must not be sent if the account was online in the last 10 minutes + OfflineOnly bool `json:"offline_only"` +} + +func (entity *BusinessAwayMessageSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessAwayMessageSettings + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessAwayMessageSettings) GetClass() string { + return ClassBusinessAwayMessageSettings +} + +func (*BusinessAwayMessageSettings) GetType() string { + return TypeBusinessAwayMessageSettings +} + +func (businessAwayMessageSettings *BusinessAwayMessageSettings) UnmarshalJSON(data []byte) error { + var tmp struct { + ShortcutId int32 `json:"shortcut_id"` + Recipients *BusinessRecipients `json:"recipients"` + Schedule json.RawMessage `json:"schedule"` + OfflineOnly bool `json:"offline_only"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + businessAwayMessageSettings.ShortcutId = tmp.ShortcutId + businessAwayMessageSettings.Recipients = tmp.Recipients + businessAwayMessageSettings.OfflineOnly = tmp.OfflineOnly + + fieldSchedule, _ := UnmarshalBusinessAwayMessageSchedule(tmp.Schedule) + businessAwayMessageSettings.Schedule = fieldSchedule + + return nil +} + +// Describes settings for greeting messages that are automatically sent by a Telegram Business account as response to incoming messages in an inactive private chat +type BusinessGreetingMessageSettings struct { + meta + // Unique quick reply shortcut identifier for the greeting messages + ShortcutId int32 `json:"shortcut_id"` + // Chosen recipients of the greeting messages + Recipients *BusinessRecipients `json:"recipients"` + // The number of days after which a chat will be considered as inactive; currently, must be on of 7, 14, 21, or 28 + InactivityDays int32 `json:"inactivity_days"` +} + +func (entity *BusinessGreetingMessageSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessGreetingMessageSettings + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessGreetingMessageSettings) GetClass() string { + return ClassBusinessGreetingMessageSettings +} + +func (*BusinessGreetingMessageSettings) GetType() string { + return TypeBusinessGreetingMessageSettings +} + +// Describes rights of a business bot +type BusinessBotRights struct { + meta + // True, if the bot can send and edit messages in the private chats that had incoming messages in the last 24 hours + CanReply bool `json:"can_reply"` + // True, if the bot can mark incoming private messages as read + CanReadMessages bool `json:"can_read_messages"` + // True, if the bot can delete sent messages + CanDeleteSentMessages bool `json:"can_delete_sent_messages"` + // True, if the bot can delete any message + CanDeleteAllMessages bool `json:"can_delete_all_messages"` + // True, if the bot can edit name of the business account + CanEditName bool `json:"can_edit_name"` + // True, if the bot can edit bio of the business account + CanEditBio bool `json:"can_edit_bio"` + // True, if the bot can edit profile photo of the business account + CanEditProfilePhoto bool `json:"can_edit_profile_photo"` + // True, if the bot can edit username of the business account + CanEditUsername bool `json:"can_edit_username"` + // True, if the bot can view gifts and Telegram Star amount owned by the business account + CanViewGiftsAndStars bool `json:"can_view_gifts_and_stars"` + // True, if the bot can sell regular gifts received by the business account + CanSellGifts bool `json:"can_sell_gifts"` + // True, if the bot can change gift receiving settings of the business account + CanChangeGiftSettings bool `json:"can_change_gift_settings"` + // True, if the bot can transfer and upgrade gifts received by the business account + CanTransferAndUpgradeGifts bool `json:"can_transfer_and_upgrade_gifts"` + // True, if the bot can transfer Telegram Stars received by the business account to account of the bot, or use them to upgrade and transfer gifts + CanTransferStars bool `json:"can_transfer_stars"` + // True, if the bot can post, edit and delete stories + CanManageStories bool `json:"can_manage_stories"` +} + +func (entity *BusinessBotRights) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessBotRights + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessBotRights) GetClass() string { + return ClassBusinessBotRights +} + +func (*BusinessBotRights) GetType() string { + return TypeBusinessBotRights +} + +// Describes a bot connected to a business account +type BusinessConnectedBot struct { + meta + // User identifier of the bot + BotUserId int64 `json:"bot_user_id"` + // Private chats that will be accessible to the bot + Recipients *BusinessRecipients `json:"recipients"` + // Rights of the bot + Rights *BusinessBotRights `json:"rights"` +} + +func (entity *BusinessConnectedBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessConnectedBot + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessConnectedBot) GetClass() string { + return ClassBusinessConnectedBot +} + +func (*BusinessConnectedBot) GetType() string { + return TypeBusinessConnectedBot +} + +// Describes settings for a business account start page +type BusinessStartPage struct { + meta + // Title text of the start page + Title string `json:"title"` + // Message text of the start page + Message string `json:"message"` + // Greeting sticker of the start page; may be null if none + Sticker *Sticker `json:"sticker"` +} + +func (entity *BusinessStartPage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessStartPage + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessStartPage) GetClass() string { + return ClassBusinessStartPage +} + +func (*BusinessStartPage) GetType() string { + return TypeBusinessStartPage +} + +// Describes settings for a business account start page to set +type InputBusinessStartPage struct { + meta + // Title text of the start page; 0-getOption("business_start_page_title_length_max") characters + Title string `json:"title"` + // Message text of the start page; 0-getOption("business_start_page_message_length_max") characters + Message string `json:"message"` + // Greeting sticker of the start page; pass null if none. The sticker must belong to a sticker set and must not be a custom emoji + Sticker InputFile `json:"sticker"` +} + +func (entity *InputBusinessStartPage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputBusinessStartPage + + return json.Marshal((*stub)(entity)) +} + +func (*InputBusinessStartPage) GetClass() string { + return ClassInputBusinessStartPage +} + +func (*InputBusinessStartPage) GetType() string { + return TypeInputBusinessStartPage +} + +func (inputBusinessStartPage *InputBusinessStartPage) UnmarshalJSON(data []byte) error { + var tmp struct { + Title string `json:"title"` + Message string `json:"message"` + Sticker json.RawMessage `json:"sticker"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputBusinessStartPage.Title = tmp.Title + inputBusinessStartPage.Message = tmp.Message + + fieldSticker, _ := UnmarshalInputFile(tmp.Sticker) + inputBusinessStartPage.Sticker = fieldSticker + + return nil +} + +// Describes an interval of time when the business is open +type BusinessOpeningHoursInterval struct { + meta + // The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0-7*24*60 + StartMinute int32 `json:"start_minute"` + // The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 1-8*24*60 + EndMinute int32 `json:"end_minute"` +} + +func (entity *BusinessOpeningHoursInterval) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessOpeningHoursInterval + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessOpeningHoursInterval) GetClass() string { + return ClassBusinessOpeningHoursInterval +} + +func (*BusinessOpeningHoursInterval) GetType() string { + return TypeBusinessOpeningHoursInterval +} + +// Describes opening hours of a business +type BusinessOpeningHours struct { + meta + // Unique time zone identifier + TimeZoneId string `json:"time_zone_id"` + // Intervals of the time when the business is open + OpeningHours []*BusinessOpeningHoursInterval `json:"opening_hours"` +} + +func (entity *BusinessOpeningHours) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessOpeningHours + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessOpeningHours) GetClass() string { + return ClassBusinessOpeningHours +} + +func (*BusinessOpeningHours) GetType() string { + return TypeBusinessOpeningHours +} + +// Contains information about a Telegram Business account +type BusinessInfo struct { + meta + // Location of the business; may be null if none + Location *BusinessLocation `json:"location"` + // Opening hours of the business; may be null if none. The hours are guaranteed to be valid and has already been split by week days + OpeningHours *BusinessOpeningHours `json:"opening_hours"` + // Opening hours of the business in the local time; may be null if none. The hours are guaranteed to be valid and has already been split by week days. Local time zone identifier will be empty. An updateUserFullInfo update is not triggered when value of this field changes + LocalOpeningHours *BusinessOpeningHours `json:"local_opening_hours"` + // Time left before the business will open the next time, in seconds; 0 if unknown. An updateUserFullInfo update is not triggered when value of this field changes + NextOpenIn int32 `json:"next_open_in"` + // Time left before the business will close the next time, in seconds; 0 if unknown. An updateUserFullInfo update is not triggered when value of this field changes + NextCloseIn int32 `json:"next_close_in"` + // The greeting message; may be null if none or the Business account is not of the current user + GreetingMessageSettings *BusinessGreetingMessageSettings `json:"greeting_message_settings"` + // The away message; may be null if none or the Business account is not of the current user + AwayMessageSettings *BusinessAwayMessageSettings `json:"away_message_settings"` + // Information about start page of the account; may be null if none + StartPage *BusinessStartPage `json:"start_page"` +} + +func (entity *BusinessInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessInfo + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessInfo) GetClass() string { + return ClassBusinessInfo +} + +func (*BusinessInfo) GetType() string { + return TypeBusinessInfo +} + +// Contains information about a business chat link +type BusinessChatLink struct { + meta + // The HTTPS link + Link string `json:"link"` + // Message draft text that will be added to the input field + Text *FormattedText `json:"text"` + // Link title + Title string `json:"title"` + // Number of times the link was used + ViewCount int32 `json:"view_count"` +} + +func (entity *BusinessChatLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessChatLink + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessChatLink) GetClass() string { + return ClassBusinessChatLink +} + +func (*BusinessChatLink) GetType() string { + return TypeBusinessChatLink +} + +// Contains a list of business chat links created by the user +type BusinessChatLinks struct { + meta + // List of links + Links []*BusinessChatLink `json:"links"` +} + +func (entity *BusinessChatLinks) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessChatLinks + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessChatLinks) GetClass() string { + return ClassBusinessChatLinks +} + +func (*BusinessChatLinks) GetType() string { + return TypeBusinessChatLinks +} + +// Describes a business chat link to create or edit +type InputBusinessChatLink struct { + meta + // Message draft text that will be added to the input field + Text *FormattedText `json:"text"` + // Link title + Title string `json:"title"` +} + +func (entity *InputBusinessChatLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputBusinessChatLink + + return json.Marshal((*stub)(entity)) +} + +func (*InputBusinessChatLink) GetClass() string { + return ClassInputBusinessChatLink +} + +func (*InputBusinessChatLink) GetType() string { + return TypeInputBusinessChatLink +} + +// Contains information about a business chat link +type BusinessChatLinkInfo struct { + meta + // Identifier of the private chat that created the link + ChatId int64 `json:"chat_id"` + // Message draft text that must be added to the input field + Text *FormattedText `json:"text"` +} + +func (entity *BusinessChatLinkInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessChatLinkInfo + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessChatLinkInfo) GetClass() string { + return ClassBusinessChatLinkInfo +} + +func (*BusinessChatLinkInfo) GetType() string { + return TypeBusinessChatLinkInfo +} + // Information about the sticker, which was used to create the chat photo type ChatPhotoStickerTypeRegularOrMask struct { meta @@ -5636,7 +8264,7 @@ type ChatPhoto struct { Sizes []*PhotoSize `json:"sizes"` // A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null Animation *AnimatedChatPhoto `json:"animation"` - // A small (160x160) animated variant of the photo in MPEG4 format; may be null even the big animation is available + // A small (160x160) animated variant of the photo in MPEG4 format; may be null even if the big animation is available SmallAnimation *AnimatedChatPhoto `json:"small_animation"` // Sticker-based version of the chat photo; may be null Sticker *ChatPhotoSticker `json:"sticker"` @@ -5831,7 +8459,7 @@ func (*InputChatPhotoSticker) InputChatPhotoType() string { // Describes actions that a user is allowed to take in a chat type ChatPermissions struct { meta - // True, if the user can send text messages, contacts, giveaways, invoices, locations, and venues + // True, if the user can send text messages, contacts, giveaways, giveaway winners, invoices, locations, and venues CanSendBasicMessages bool `json:"can_send_basic_messages"` // True, if the user can send music files CanSendAudios bool `json:"can_send_audios"` @@ -5845,7 +8473,7 @@ type ChatPermissions struct { CanSendVideoNotes bool `json:"can_send_video_notes"` // True, if the user can send voice notes CanSendVoiceNotes bool `json:"can_send_voice_notes"` - // True, if the user can send polls + // True, if the user can send polls and checklists CanSendPolls bool `json:"can_send_polls"` // True, if the user can send stickers. Implies can_send_messages permissions CanSendStickers bool `json:"can_send_stickers"` @@ -5855,16 +8483,16 @@ type ChatPermissions struct { CanSendGames bool `json:"can_send_games"` // True, if the user can use inline bots. Implies can_send_messages permissions CanUseInlineBots bool `json:"can_use_inline_bots"` - // True, if the user may add a web page preview to their messages - CanAddWebPagePreviews bool `json:"can_add_web_page_previews"` + // True, if the user may add a link preview to their messages + CanAddLinkPreviews bool `json:"can_add_link_previews"` // True, if the user can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` // True, if the user can invite new users to the chat CanInviteUsers bool `json:"can_invite_users"` // True, if the user can pin messages CanPinMessages bool `json:"can_pin_messages"` - // True, if the user can manage topics - CanManageTopics bool `json:"can_manage_topics"` + // True, if the user can create topics + CanCreateTopics bool `json:"can_create_topics"` } func (entity *ChatPermissions) MarshalJSON() ([]byte, error) { @@ -5886,11 +8514,11 @@ func (*ChatPermissions) GetType() string { // Describes rights of the administrator type ChatAdministratorRights struct { meta - // True, if the administrator can get chat event log, get chat boosts in channels, get channel members, report supergroup spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only + // True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other privilege; applicable to supergroups and channels only CanManageChat bool `json:"can_manage_chat"` // True, if the administrator can change the chat title, photo, and other settings CanChangeInfo bool `json:"can_change_info"` - // True, if the administrator can create channel posts or view channel statistics; applicable to channels only + // True, if the administrator can create channel posts, approve suggested channel posts, or view channel statistics; applicable to channels only CanPostMessages bool `json:"can_post_messages"` // True, if the administrator can edit messages of other users and pin messages; applicable to channels only CanEditMessages bool `json:"can_edit_messages"` @@ -5898,22 +8526,24 @@ type ChatAdministratorRights struct { CanDeleteMessages bool `json:"can_delete_messages"` // True, if the administrator can invite new users to the chat CanInviteUsers bool `json:"can_invite_users"` - // True, if the administrator can restrict, ban, or unban chat members or view supergroup statistics; always true for channels + // True, if the administrator can restrict, ban, or unban chat members or view supergroup statistics CanRestrictMembers bool `json:"can_restrict_members"` // True, if the administrator can pin messages; applicable to basic groups and supergroups only CanPinMessages bool `json:"can_pin_messages"` - // True, if the administrator can manage topics; applicable to forum supergroups only + // True, if the administrator can create, rename, close, reopen, hide, and unhide forum topics; applicable to forum supergroups only CanManageTopics bool `json:"can_manage_topics"` // True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them CanPromoteMembers bool `json:"can_promote_members"` // True, if the administrator can manage video chats CanManageVideoChats bool `json:"can_manage_video_chats"` - // True, if the administrator can create new channel stories, or edit and delete posted stories; applicable to channels only + // True, if the administrator can create new chat stories, or edit and delete posted stories; applicable to supergroups and channels only CanPostStories bool `json:"can_post_stories"` - // True, if the administrator can edit stories posted by other users, pin stories and access story archive; applicable to channels only + // True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access story archive; applicable to supergroups and channels only CanEditStories bool `json:"can_edit_stories"` - // True, if the administrator can delete stories posted by other users; applicable to channels only + // True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only CanDeleteStories bool `json:"can_delete_stories"` + // True, if the administrator can answer to channel direct messages; applicable to channels only + CanManageDirectMessages bool `json:"can_manage_direct_messages"` // True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only IsAnonymous bool `json:"is_anonymous"` } @@ -5934,6 +8564,995 @@ func (*ChatAdministratorRights) GetType() string { return TypeChatAdministratorRights } +// Describes price of a resold gift in Telegram Stars +type GiftResalePriceStar struct { + meta + // The Telegram Star amount expected to be paid for the gift. Must be in the range getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max") for gifts put for resale + StarCount int64 `json:"star_count"` +} + +func (entity *GiftResalePriceStar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResalePriceStar + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResalePriceStar) GetClass() string { + return ClassGiftResalePrice +} + +func (*GiftResalePriceStar) GetType() string { + return TypeGiftResalePriceStar +} + +func (*GiftResalePriceStar) GiftResalePriceType() string { + return TypeGiftResalePriceStar +} + +// Describes price of a resold gift in Toncoins +type GiftResalePriceTon struct { + meta + // The amount of 1/100 of Toncoin expected to be paid for the gift. Must be in the range getOption("gift_resale_toncoin_cent_count_min")-getOption("gift_resale_toncoin_cent_count_max") + ToncoinCentCount int64 `json:"toncoin_cent_count"` +} + +func (entity *GiftResalePriceTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResalePriceTon + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResalePriceTon) GetClass() string { + return ClassGiftResalePrice +} + +func (*GiftResalePriceTon) GetType() string { + return TypeGiftResalePriceTon +} + +func (*GiftResalePriceTon) GiftResalePriceType() string { + return TypeGiftResalePriceTon +} + +// The offer must be accepted or rejected +type GiftPurchaseOfferStatePending struct{ + meta +} + +func (entity *GiftPurchaseOfferStatePending) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftPurchaseOfferStatePending + + return json.Marshal((*stub)(entity)) +} + +func (*GiftPurchaseOfferStatePending) GetClass() string { + return ClassGiftPurchaseOfferState +} + +func (*GiftPurchaseOfferStatePending) GetType() string { + return TypeGiftPurchaseOfferStatePending +} + +func (*GiftPurchaseOfferStatePending) GiftPurchaseOfferStateType() string { + return TypeGiftPurchaseOfferStatePending +} + +// The offer was accepted +type GiftPurchaseOfferStateAccepted struct{ + meta +} + +func (entity *GiftPurchaseOfferStateAccepted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftPurchaseOfferStateAccepted + + return json.Marshal((*stub)(entity)) +} + +func (*GiftPurchaseOfferStateAccepted) GetClass() string { + return ClassGiftPurchaseOfferState +} + +func (*GiftPurchaseOfferStateAccepted) GetType() string { + return TypeGiftPurchaseOfferStateAccepted +} + +func (*GiftPurchaseOfferStateAccepted) GiftPurchaseOfferStateType() string { + return TypeGiftPurchaseOfferStateAccepted +} + +// The offer was rejected +type GiftPurchaseOfferStateRejected struct{ + meta +} + +func (entity *GiftPurchaseOfferStateRejected) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftPurchaseOfferStateRejected + + return json.Marshal((*stub)(entity)) +} + +func (*GiftPurchaseOfferStateRejected) GetClass() string { + return ClassGiftPurchaseOfferState +} + +func (*GiftPurchaseOfferStateRejected) GetType() string { + return TypeGiftPurchaseOfferStateRejected +} + +func (*GiftPurchaseOfferStateRejected) GiftPurchaseOfferStateType() string { + return TypeGiftPurchaseOfferStateRejected +} + +// Describes price of a suggested post in Telegram Stars +type SuggestedPostPriceStar struct { + meta + // The Telegram Star amount expected to be paid for the post; getOption("suggested_post_star_count_min")-getOption("suggested_post_star_count_max") + StarCount int64 `json:"star_count"` +} + +func (entity *SuggestedPostPriceStar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostPriceStar + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostPriceStar) GetClass() string { + return ClassSuggestedPostPrice +} + +func (*SuggestedPostPriceStar) GetType() string { + return TypeSuggestedPostPriceStar +} + +func (*SuggestedPostPriceStar) SuggestedPostPriceType() string { + return TypeSuggestedPostPriceStar +} + +// Describes price of a suggested post in Toncoins +type SuggestedPostPriceTon struct { + meta + // The amount of 1/100 of Toncoin expected to be paid for the post; getOption("suggested_post_toncoin_cent_count_min")-getOption("suggested_post_toncoin_cent_count_max") + ToncoinCentCount int64 `json:"toncoin_cent_count"` +} + +func (entity *SuggestedPostPriceTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostPriceTon + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostPriceTon) GetClass() string { + return ClassSuggestedPostPrice +} + +func (*SuggestedPostPriceTon) GetType() string { + return TypeSuggestedPostPriceTon +} + +func (*SuggestedPostPriceTon) SuggestedPostPriceType() string { + return TypeSuggestedPostPriceTon +} + +// The post must be approved or declined +type SuggestedPostStatePending struct{ + meta +} + +func (entity *SuggestedPostStatePending) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStatePending + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStatePending) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStatePending) GetType() string { + return TypeSuggestedPostStatePending +} + +func (*SuggestedPostStatePending) SuggestedPostStateType() string { + return TypeSuggestedPostStatePending +} + +// The post was approved +type SuggestedPostStateApproved struct{ + meta +} + +func (entity *SuggestedPostStateApproved) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStateApproved + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStateApproved) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStateApproved) GetType() string { + return TypeSuggestedPostStateApproved +} + +func (*SuggestedPostStateApproved) SuggestedPostStateType() string { + return TypeSuggestedPostStateApproved +} + +// The post was declined +type SuggestedPostStateDeclined struct{ + meta +} + +func (entity *SuggestedPostStateDeclined) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostStateDeclined + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostStateDeclined) GetClass() string { + return ClassSuggestedPostState +} + +func (*SuggestedPostStateDeclined) GetType() string { + return TypeSuggestedPostStateDeclined +} + +func (*SuggestedPostStateDeclined) SuggestedPostStateType() string { + return TypeSuggestedPostStateDeclined +} + +// Contains information about a suggested post. If the post can be approved or declined, then changes to the post can be also suggested. Use sendMessage with reply to the message and suggested post information to suggest message changes. Use addOffer to suggest price or time changes +type SuggestedPostInfo struct { + meta + // Price of the suggested post; may be null if the post is non-paid + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published; 0 if the specific date isn't set yet + SendDate int32 `json:"send_date"` + // State of the post + State SuggestedPostState `json:"state"` + // True, if the suggested post can be approved by the current user using approveSuggestedPost; updates aren't sent when value of this field changes + CanBeApproved bool `json:"can_be_approved"` + // True, if the suggested post can be declined by the current user using declineSuggestedPost; updates aren't sent when value of this field changes + CanBeDeclined bool `json:"can_be_declined"` +} + +func (entity *SuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostInfo) GetClass() string { + return ClassSuggestedPostInfo +} + +func (*SuggestedPostInfo) GetType() string { + return TypeSuggestedPostInfo +} + +func (suggestedPostInfo *SuggestedPostInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + State json.RawMessage `json:"state"` + CanBeApproved bool `json:"can_be_approved"` + CanBeDeclined bool `json:"can_be_declined"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + suggestedPostInfo.SendDate = tmp.SendDate + suggestedPostInfo.CanBeApproved = tmp.CanBeApproved + suggestedPostInfo.CanBeDeclined = tmp.CanBeDeclined + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + suggestedPostInfo.Price = fieldPrice + + fieldState, _ := UnmarshalSuggestedPostState(tmp.State) + suggestedPostInfo.State = fieldState + + return nil +} + +// Contains information about a post to suggest +type InputSuggestedPostInfo struct { + meta + // Price of the suggested post; pass null to suggest a post without payment. If the current user isn't an administrator of the channel direct messages chat and has no enough funds to pay for the post, then the error "BALANCE_TOO_LOW" will be returned immediately + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published; pass 0 if the date isn't restricted. If specified, then the date must be getOption("suggested_post_send_delay_min")-getOption("suggested_post_send_delay_max") seconds in the future + SendDate int32 `json:"send_date"` +} + +func (entity *InputSuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputSuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*InputSuggestedPostInfo) GetClass() string { + return ClassInputSuggestedPostInfo +} + +func (*InputSuggestedPostInfo) GetType() string { + return TypeInputSuggestedPostInfo +} + +func (inputSuggestedPostInfo *InputSuggestedPostInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputSuggestedPostInfo.SendDate = tmp.SendDate + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + inputSuggestedPostInfo.Price = fieldPrice + + return nil +} + +// The post was refunded, because it was deleted by channel administrators in less than getOption("suggested_post_lifetime_min") seconds +type SuggestedPostRefundReasonPostDeleted struct{ + meta +} + +func (entity *SuggestedPostRefundReasonPostDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostRefundReasonPostDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostRefundReasonPostDeleted) GetClass() string { + return ClassSuggestedPostRefundReason +} + +func (*SuggestedPostRefundReasonPostDeleted) GetType() string { + return TypeSuggestedPostRefundReasonPostDeleted +} + +func (*SuggestedPostRefundReasonPostDeleted) SuggestedPostRefundReasonType() string { + return TypeSuggestedPostRefundReasonPostDeleted +} + +// The post was refunded, because the payment for the post was refunded +type SuggestedPostRefundReasonPaymentRefunded struct{ + meta +} + +func (entity *SuggestedPostRefundReasonPaymentRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedPostRefundReasonPaymentRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedPostRefundReasonPaymentRefunded) GetClass() string { + return ClassSuggestedPostRefundReason +} + +func (*SuggestedPostRefundReasonPaymentRefunded) GetType() string { + return TypeSuggestedPostRefundReasonPaymentRefunded +} + +func (*SuggestedPostRefundReasonPaymentRefunded) SuggestedPostRefundReasonType() string { + return TypeSuggestedPostRefundReasonPaymentRefunded +} + +// Describes a possibly non-integer Telegram Star amount +type StarAmount struct { + meta + // The integer Telegram Star amount 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 + // True, if the subscription is active and the user can use the method reuseStarSubscription to join the subscribed chat again + CanReuse bool `json:"can_reuse"` + // The invite link that can be used to renew the subscription if it has been expired; may be empty, if the link isn't available anymore + InviteLink string `json:"invite_link"` +} + +func (entity *StarSubscriptionTypeChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscriptionTypeChannel + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscriptionTypeChannel) GetClass() string { + return ClassStarSubscriptionType +} + +func (*StarSubscriptionTypeChannel) GetType() string { + return TypeStarSubscriptionTypeChannel +} + +func (*StarSubscriptionTypeChannel) StarSubscriptionTypeType() string { + return TypeStarSubscriptionTypeChannel +} + +// Describes a subscription in a bot or a business account +type StarSubscriptionTypeBot struct { + meta + // True, if the subscription was canceled by the bot and can't be extended + IsCanceledByBot bool `json:"is_canceled_by_bot"` + // Subscription invoice title + Title string `json:"title"` + // Subscription invoice photo + Photo *Photo `json:"photo"` + // The link to the subscription invoice + InvoiceLink string `json:"invoice_link"` +} + +func (entity *StarSubscriptionTypeBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscriptionTypeBot + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscriptionTypeBot) GetClass() string { + return ClassStarSubscriptionType +} + +func (*StarSubscriptionTypeBot) GetType() string { + return TypeStarSubscriptionTypeBot +} + +func (*StarSubscriptionTypeBot) StarSubscriptionTypeType() string { + return TypeStarSubscriptionTypeBot +} + +// Describes subscription plan paid in Telegram Stars +type StarSubscriptionPricing struct { + meta + // The number of seconds between consecutive Telegram Star debiting + Period int32 `json:"period"` + // The Telegram Star amount that must be paid for each period + StarCount int64 `json:"star_count"` +} + +func (entity *StarSubscriptionPricing) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscriptionPricing + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscriptionPricing) GetClass() string { + return ClassStarSubscriptionPricing +} + +func (*StarSubscriptionPricing) GetType() string { + return TypeStarSubscriptionPricing +} + +// Contains information about subscription to a channel chat, a bot, or a business account that was paid in Telegram Stars +type StarSubscription struct { + meta + // Unique identifier of the subscription + Id string `json:"id"` + // Identifier of the chat that is subscribed + ChatId int64 `json:"chat_id"` + // Point in time (Unix timestamp) when the subscription will expire or expired + ExpirationDate int32 `json:"expiration_date"` + // True, if the subscription was canceled + IsCanceled bool `json:"is_canceled"` + // True, if the subscription expires soon and there are no enough Telegram Stars on the user's balance to extend it + IsExpiring bool `json:"is_expiring"` + // The subscription plan + Pricing *StarSubscriptionPricing `json:"pricing"` + // Type of the subscription + Type StarSubscriptionType `json:"type"` +} + +func (entity *StarSubscription) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscription + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscription) GetClass() string { + return ClassStarSubscription +} + +func (*StarSubscription) GetType() string { + return TypeStarSubscription +} + +func (starSubscription *StarSubscription) UnmarshalJSON(data []byte) error { + var tmp struct { + Id string `json:"id"` + ChatId int64 `json:"chat_id"` + ExpirationDate int32 `json:"expiration_date"` + IsCanceled bool `json:"is_canceled"` + IsExpiring bool `json:"is_expiring"` + Pricing *StarSubscriptionPricing `json:"pricing"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starSubscription.Id = tmp.Id + starSubscription.ChatId = tmp.ChatId + starSubscription.ExpirationDate = tmp.ExpirationDate + starSubscription.IsCanceled = tmp.IsCanceled + starSubscription.IsExpiring = tmp.IsExpiring + starSubscription.Pricing = tmp.Pricing + + fieldType, _ := UnmarshalStarSubscriptionType(tmp.Type) + starSubscription.Type = fieldType + + return nil +} + +// Represents a list of Telegram Star subscriptions +type StarSubscriptions struct { + meta + // The amount of owned Telegram Stars + 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 + RequiredStarCount int64 `json:"required_star_count"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *StarSubscriptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarSubscriptions + + return json.Marshal((*stub)(entity)) +} + +func (*StarSubscriptions) GetClass() string { + return ClassStarSubscriptions +} + +func (*StarSubscriptions) GetType() string { + return TypeStarSubscriptions +} + +// The affiliate is the current user +type AffiliateTypeCurrentUser struct{ + meta +} + +func (entity *AffiliateTypeCurrentUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateTypeCurrentUser + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateTypeCurrentUser) GetClass() string { + return ClassAffiliateType +} + +func (*AffiliateTypeCurrentUser) GetType() string { + return TypeAffiliateTypeCurrentUser +} + +func (*AffiliateTypeCurrentUser) AffiliateTypeType() string { + return TypeAffiliateTypeCurrentUser +} + +// The affiliate is a bot owned by the current user +type AffiliateTypeBot struct { + meta + // User identifier of the bot + UserId int64 `json:"user_id"` +} + +func (entity *AffiliateTypeBot) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateTypeBot + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateTypeBot) GetClass() string { + return ClassAffiliateType +} + +func (*AffiliateTypeBot) GetType() string { + return TypeAffiliateTypeBot +} + +func (*AffiliateTypeBot) AffiliateTypeType() string { + return TypeAffiliateTypeBot +} + +// The affiliate is a channel chat where the current user has can_post_messages administrator right +type AffiliateTypeChannel struct { + meta + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` +} + +func (entity *AffiliateTypeChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AffiliateTypeChannel + + return json.Marshal((*stub)(entity)) +} + +func (*AffiliateTypeChannel) GetClass() string { + return ClassAffiliateType +} + +func (*AffiliateTypeChannel) GetType() string { + return TypeAffiliateTypeChannel +} + +func (*AffiliateTypeChannel) AffiliateTypeType() string { + return TypeAffiliateTypeChannel +} + +// 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 connectAffiliateProgram, 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 Telegram Star amount that was 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 + Info *AffiliateProgramInfo `json:"info"` +} + +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 an affiliate +type ConnectedAffiliateProgram 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 int64 `json:"revenue_star_count"` +} + +func (entity *ConnectedAffiliateProgram) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ConnectedAffiliateProgram + + return json.Marshal((*stub)(entity)) +} + +func (*ConnectedAffiliateProgram) GetClass() string { + return ClassConnectedAffiliateProgram +} + +func (*ConnectedAffiliateProgram) GetType() string { + return TypeConnectedAffiliateProgram +} + +// Represents a list of affiliate programs that were connected to an affiliate +type ConnectedAffiliatePrograms struct { + meta + // The total number of affiliate programs that were connected to the affiliate + TotalCount int32 `json:"total_count"` + // The list of connected affiliate programs + Programs []*ConnectedAffiliateProgram `json:"programs"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *ConnectedAffiliatePrograms) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ConnectedAffiliatePrograms + + return json.Marshal((*stub)(entity)) +} + +func (*ConnectedAffiliatePrograms) GetClass() string { + return ClassConnectedAffiliatePrograms +} + +func (*ConnectedAffiliatePrograms) GetType() string { + return TypeConnectedAffiliatePrograms +} + +// Contains information about a product that can be paid with invoice +type ProductInfo struct { + meta + // Product title + Title string `json:"title"` + // Product description + Description *FormattedText `json:"description"` + // Product photo; may be null + Photo *Photo `json:"photo"` +} + +func (entity *ProductInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProductInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ProductInfo) GetClass() string { + return ClassProductInfo +} + +func (*ProductInfo) GetType() string { + return TypeProductInfo +} + // Describes an option for buying Telegram Premium to a user type PremiumPaymentOption struct { meta @@ -5943,7 +9562,7 @@ type PremiumPaymentOption struct { Amount int64 `json:"amount"` // The discount associated with this option, as a percentage DiscountPercentage int32 `json:"discount_percentage"` - // Number of month the Telegram Premium subscription will be active + // Number of months the Telegram Premium subscription will be active. Use getPremiumInfoSticker to get the sticker to be used as representation of the Telegram Premium subscription MonthCount int32 `json:"month_count"` // Identifier of the store product associated with the option StoreProductId string `json:"store_product_id"` @@ -6023,16 +9642,74 @@ func (*PremiumStatePaymentOption) GetType() string { return TypePremiumStatePaymentOption } -// Describes an option for creating Telegram Premium gift codes -type PremiumGiftCodePaymentOption struct { +// Describes an option for gifting Telegram Premium to a user. Use telegramPaymentPurposePremiumGift for out-of-store payments or payments in Telegram Stars +type PremiumGiftPaymentOption struct { + meta + // ISO 4217 currency code for the payment + Currency string `json:"currency"` + // The amount to pay, in the smallest units of the currency + Amount int64 `json:"amount"` + // The alternative Telegram Star amount to pay; 0 if payment in Telegram Stars is not possible + StarCount int64 `json:"star_count"` + // The discount associated with this option, as a percentage + DiscountPercentage int32 `json:"discount_percentage"` + // Number of months the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` + // Identifier of the store product associated with the option + StoreProductId string `json:"store_product_id"` + // A sticker to be shown along with the option; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *PremiumGiftPaymentOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiftPaymentOption + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiftPaymentOption) GetClass() string { + return ClassPremiumGiftPaymentOption +} + +func (*PremiumGiftPaymentOption) GetType() string { + return TypePremiumGiftPaymentOption +} + +// Contains a list of options for gifting Telegram Premium to a user +type PremiumGiftPaymentOptions struct { + meta + // The list of options sorted by Telegram Premium subscription duration + Options []*PremiumGiftPaymentOption `json:"options"` +} + +func (entity *PremiumGiftPaymentOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumGiftPaymentOptions + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumGiftPaymentOptions) GetClass() string { + return ClassPremiumGiftPaymentOptions +} + +func (*PremiumGiftPaymentOptions) GetType() string { + return TypePremiumGiftPaymentOptions +} + +// Describes an option for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members. Use telegramPaymentPurposePremiumGiftCodes or telegramPaymentPurposePremiumGiveaway for out-of-store payments +type PremiumGiveawayPaymentOption struct { meta // ISO 4217 currency code for Telegram Premium gift code payment Currency string `json:"currency"` // The amount to pay, in the smallest units of the currency Amount int64 `json:"amount"` // Number of users which will be able to activate the gift codes - UserCount int32 `json:"user_count"` - // Number of month the Telegram Premium subscription will be active + WinnerCount int32 `json:"winner_count"` + // Number of months the Telegram Premium subscription will be active MonthCount int32 `json:"month_count"` // Identifier of the store product associated with the option; may be empty if none StoreProductId string `json:"store_product_id"` @@ -6040,58 +9717,60 @@ type PremiumGiftCodePaymentOption struct { StoreProductQuantity int32 `json:"store_product_quantity"` } -func (entity *PremiumGiftCodePaymentOption) MarshalJSON() ([]byte, error) { +func (entity *PremiumGiveawayPaymentOption) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiftCodePaymentOption + type stub PremiumGiveawayPaymentOption return json.Marshal((*stub)(entity)) } -func (*PremiumGiftCodePaymentOption) GetClass() string { - return ClassPremiumGiftCodePaymentOption +func (*PremiumGiveawayPaymentOption) GetClass() string { + return ClassPremiumGiveawayPaymentOption } -func (*PremiumGiftCodePaymentOption) GetType() string { - return TypePremiumGiftCodePaymentOption +func (*PremiumGiveawayPaymentOption) GetType() string { + return TypePremiumGiveawayPaymentOption } -// Contains a list of options for creating Telegram Premium gift codes -type PremiumGiftCodePaymentOptions struct { +// Contains a list of options for creating of Telegram Premium giveaway or manual distribution of Telegram Premium among chat members +type PremiumGiveawayPaymentOptions struct { meta // The list of options - Options []*PremiumGiftCodePaymentOption `json:"options"` + Options []*PremiumGiveawayPaymentOption `json:"options"` } -func (entity *PremiumGiftCodePaymentOptions) MarshalJSON() ([]byte, error) { +func (entity *PremiumGiveawayPaymentOptions) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiftCodePaymentOptions + type stub PremiumGiveawayPaymentOptions return json.Marshal((*stub)(entity)) } -func (*PremiumGiftCodePaymentOptions) GetClass() string { - return ClassPremiumGiftCodePaymentOptions +func (*PremiumGiveawayPaymentOptions) GetClass() string { + return ClassPremiumGiveawayPaymentOptions } -func (*PremiumGiftCodePaymentOptions) GetType() string { - return TypePremiumGiftCodePaymentOptions +func (*PremiumGiveawayPaymentOptions) GetType() string { + return TypePremiumGiveawayPaymentOptions } // Contains information about a Telegram Premium gift code type PremiumGiftCodeInfo struct { meta - // Identifier of a chat or a user that created the gift code + // Identifier of a chat or a user who created the gift code; may be null if unknown. If null and the code is from messagePremiumGiftCode message, then creator_id from the message can be used CreatorId MessageSender `json:"creator_id"` // Point in time (Unix timestamp) when the code was created CreationDate int32 `json:"creation_date"` // True, if the gift code was created for a giveaway IsFromGiveaway bool `json:"is_from_giveaway"` - // Identifier of the corresponding giveaway message; can be 0 or an identifier of a deleted message + // Identifier of the corresponding giveaway message in the creator_id chat; may be 0 or an identifier of a deleted message GiveawayMessageId int64 `json:"giveaway_message_id"` - // Number of month the Telegram Premium subscription will be active after code activation + // Number of months the Telegram Premium subscription will be active after code activation; 0 if the number of months isn't integer MonthCount int32 `json:"month_count"` + // Number of days the Telegram Premium subscription will be active after code activation + DayCount int32 `json:"day_count"` // Identifier of a user for which the code was created; 0 if none UserId int64 `json:"user_id"` // Point in time (Unix timestamp) when the code was activated; 0 if none @@ -6121,6 +9800,7 @@ func (premiumGiftCodeInfo *PremiumGiftCodeInfo) UnmarshalJSON(data []byte) error IsFromGiveaway bool `json:"is_from_giveaway"` GiveawayMessageId int64 `json:"giveaway_message_id"` MonthCount int32 `json:"month_count"` + DayCount int32 `json:"day_count"` UserId int64 `json:"user_id"` UseDate int32 `json:"use_date"` } @@ -6134,6 +9814,7 @@ func (premiumGiftCodeInfo *PremiumGiftCodeInfo) UnmarshalJSON(data []byte) error premiumGiftCodeInfo.IsFromGiveaway = tmp.IsFromGiveaway premiumGiftCodeInfo.GiveawayMessageId = tmp.GiveawayMessageId premiumGiftCodeInfo.MonthCount = tmp.MonthCount + premiumGiftCodeInfo.DayCount = tmp.DayCount premiumGiftCodeInfo.UserId = tmp.UserId premiumGiftCodeInfo.UseDate = tmp.UseDate @@ -6143,169 +9824,4798 @@ func (premiumGiftCodeInfo *PremiumGiftCodeInfo) UnmarshalJSON(data []byte) error return nil } -// The user is eligible for the giveaway -type PremiumGiveawayParticipantStatusEligible struct{ +// Describes an option for buying Telegram Stars. Use telegramPaymentPurposeStars for out-of-store payments +type StarPaymentOption struct { meta + // ISO 4217 currency code for the payment + Currency string `json:"currency"` + // The amount to pay, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of Telegram Stars that will be purchased + StarCount int64 `json:"star_count"` + // Identifier of the store product associated with the option; may be empty if none + StoreProductId string `json:"store_product_id"` + // True, if the option must be shown only in the full list of payment options + IsAdditional bool `json:"is_additional"` } -func (entity *PremiumGiveawayParticipantStatusEligible) MarshalJSON() ([]byte, error) { +func (entity *StarPaymentOption) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParticipantStatusEligible + type stub StarPaymentOption return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParticipantStatusEligible) GetClass() string { - return ClassPremiumGiveawayParticipantStatus +func (*StarPaymentOption) GetClass() string { + return ClassStarPaymentOption } -func (*PremiumGiveawayParticipantStatusEligible) GetType() string { - return TypePremiumGiveawayParticipantStatusEligible +func (*StarPaymentOption) GetType() string { + return TypeStarPaymentOption } -func (*PremiumGiveawayParticipantStatusEligible) PremiumGiveawayParticipantStatusType() string { - return TypePremiumGiveawayParticipantStatusEligible +// Contains a list of options for buying Telegram Stars +type StarPaymentOptions struct { + meta + // The list of options + Options []*StarPaymentOption `json:"options"` +} + +func (entity *StarPaymentOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarPaymentOptions + + return json.Marshal((*stub)(entity)) +} + +func (*StarPaymentOptions) GetClass() string { + return ClassStarPaymentOptions +} + +func (*StarPaymentOptions) GetType() string { + return TypeStarPaymentOptions +} + +// Describes an option for the number of winners of a Telegram Star giveaway +type StarGiveawayWinnerOption struct { + meta + // The number of users that will be chosen as winners + WinnerCount int32 `json:"winner_count"` + // The number of Telegram Stars that will be won by the winners of the giveaway + WonStarCount int64 `json:"won_star_count"` + // True, if the option must be chosen by default + IsDefault bool `json:"is_default"` +} + +func (entity *StarGiveawayWinnerOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarGiveawayWinnerOption + + return json.Marshal((*stub)(entity)) +} + +func (*StarGiveawayWinnerOption) GetClass() string { + return ClassStarGiveawayWinnerOption +} + +func (*StarGiveawayWinnerOption) GetType() string { + return TypeStarGiveawayWinnerOption +} + +// Describes an option for creating of Telegram Star giveaway. Use telegramPaymentPurposeStarGiveaway for out-of-store payments +type StarGiveawayPaymentOption struct { + meta + // ISO 4217 currency code for the payment + Currency string `json:"currency"` + // The amount to pay, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of Telegram Stars that will be distributed among winners + StarCount int64 `json:"star_count"` + // Identifier of the store product associated with the option; may be empty if none + StoreProductId string `json:"store_product_id"` + // Number of times the chat will be boosted for one year if the option is chosen + YearlyBoostCount int32 `json:"yearly_boost_count"` + // Allowed options for the number of giveaway winners + WinnerOptions []*StarGiveawayWinnerOption `json:"winner_options"` + // True, if the option must be chosen by default + IsDefault bool `json:"is_default"` + // True, if the option must be shown only in the full list of payment options + IsAdditional bool `json:"is_additional"` +} + +func (entity *StarGiveawayPaymentOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarGiveawayPaymentOption + + return json.Marshal((*stub)(entity)) +} + +func (*StarGiveawayPaymentOption) GetClass() string { + return ClassStarGiveawayPaymentOption +} + +func (*StarGiveawayPaymentOption) GetType() string { + return TypeStarGiveawayPaymentOption +} + +// Contains a list of options for creating of Telegram Star giveaway +type StarGiveawayPaymentOptions struct { + meta + // The list of options + Options []*StarGiveawayPaymentOption `json:"options"` +} + +func (entity *StarGiveawayPaymentOptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarGiveawayPaymentOptions + + return json.Marshal((*stub)(entity)) +} + +func (*StarGiveawayPaymentOptions) GetClass() string { + return ClassStarGiveawayPaymentOptions +} + +func (*StarGiveawayPaymentOptions) GetType() string { + return TypeStarGiveawayPaymentOptions +} + +// Describes gift types that are accepted by a user +type AcceptedGiftTypes struct { + meta + // True, if unlimited regular gifts are accepted + UnlimitedGifts bool `json:"unlimited_gifts"` + // True, if limited regular gifts are accepted + LimitedGifts bool `json:"limited_gifts"` + // True, if upgraded gifts and regular gifts that can be upgraded for free are accepted + UpgradedGifts bool `json:"upgraded_gifts"` + // True, if gifts from channels are accepted subject to other restrictions + GiftsFromChannels bool `json:"gifts_from_channels"` + // True, if Telegram Premium subscription is accepted + PremiumSubscription bool `json:"premium_subscription"` +} + +func (entity *AcceptedGiftTypes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AcceptedGiftTypes + + return json.Marshal((*stub)(entity)) +} + +func (*AcceptedGiftTypes) GetClass() string { + return ClassAcceptedGiftTypes +} + +func (*AcceptedGiftTypes) GetType() string { + return TypeAcceptedGiftTypes +} + +// Contains settings for gift receiving for a user +type GiftSettings struct { + meta + // True, if a button for sending a gift to the user or by the user must always be shown in the input field + ShowGiftButton bool `json:"show_gift_button"` + // Types of gifts accepted by the user; for Telegram Premium users only + AcceptedGiftTypes *AcceptedGiftTypes `json:"accepted_gift_types"` +} + +func (entity *GiftSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftSettings + + return json.Marshal((*stub)(entity)) +} + +func (*GiftSettings) GetClass() string { + return ClassGiftSettings +} + +func (*GiftSettings) GetType() string { + return TypeGiftSettings +} + +// Describes an auction on which a gift can be purchased +type GiftAuction struct { + meta + // Identifier of the auction + Id string `json:"id"` + // Number of gifts distributed in each round + GiftsPerRound int32 `json:"gifts_per_round"` + // Point in time (Unix timestamp) when the auction will start + StartDate int32 `json:"start_date"` +} + +func (entity *GiftAuction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftAuction + + return json.Marshal((*stub)(entity)) +} + +func (*GiftAuction) GetClass() string { + return ClassGiftAuction +} + +func (*GiftAuction) GetType() string { + return TypeGiftAuction +} + +// Describes background of a gift +type GiftBackground struct { + meta + // Center color in RGB format + CenterColor int32 `json:"center_color"` + // Edge color in RGB format + EdgeColor int32 `json:"edge_color"` + // Text color in RGB format + TextColor int32 `json:"text_color"` +} + +func (entity *GiftBackground) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftBackground + + return json.Marshal((*stub)(entity)) +} + +func (*GiftBackground) GetClass() string { + return ClassGiftBackground +} + +func (*GiftBackground) GetType() string { + return TypeGiftBackground +} + +// Describes the maximum number of times that a specific gift can be purchased +type GiftPurchaseLimits struct { + meta + // The maximum number of times the gifts can be purchased + TotalCount int32 `json:"total_count"` + // Number of remaining times the gift can be purchased + RemainingCount int32 `json:"remaining_count"` +} + +func (entity *GiftPurchaseLimits) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftPurchaseLimits + + return json.Marshal((*stub)(entity)) +} + +func (*GiftPurchaseLimits) GetClass() string { + return ClassGiftPurchaseLimits +} + +func (*GiftPurchaseLimits) GetType() string { + return TypeGiftPurchaseLimits +} + +// Describes parameters of a unique gift available for resale +type GiftResaleParameters struct { + meta + // Resale price of the gift in Telegram Stars + StarCount int64 `json:"star_count"` + // Resale price of the gift in 1/100 of Toncoin + ToncoinCentCount int64 `json:"toncoin_cent_count"` + // True, if the gift can be bought only using Toncoins + ToncoinOnly bool `json:"toncoin_only"` +} + +func (entity *GiftResaleParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleParameters + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleParameters) GetClass() string { + return ClassGiftResaleParameters +} + +func (*GiftResaleParameters) GetType() string { + return TypeGiftResaleParameters +} + +// Describes collection of gifts +type GiftCollection struct { + meta + // Unique identifier of the collection + Id int32 `json:"id"` + // Name of the collection + Name string `json:"name"` + // Icon of the collection; may be null if none + Icon *Sticker `json:"icon"` + // Total number of gifts in the collection + GiftCount int32 `json:"gift_count"` +} + +func (entity *GiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*GiftCollection) GetClass() string { + return ClassGiftCollection +} + +func (*GiftCollection) GetType() string { + return TypeGiftCollection +} + +// Contains a list of gift collections +type GiftCollections struct { + meta + // List of gift collections + Collections []*GiftCollection `json:"collections"` +} + +func (entity *GiftCollections) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftCollections + + return json.Marshal((*stub)(entity)) +} + +func (*GiftCollections) GetClass() string { + return ClassGiftCollections +} + +func (*GiftCollections) GetType() string { + return TypeGiftCollections +} + +// The gift can be sent now by the current user +type CanSendGiftResultOk struct{ + meta +} + +func (entity *CanSendGiftResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendGiftResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendGiftResultOk) GetClass() string { + return ClassCanSendGiftResult +} + +func (*CanSendGiftResultOk) GetType() string { + return TypeCanSendGiftResultOk +} + +func (*CanSendGiftResultOk) CanSendGiftResultType() string { + return TypeCanSendGiftResultOk +} + +// The gift can't be sent now by the current user +type CanSendGiftResultFail struct { + meta + // Reason to be shown to the user + Reason *FormattedText `json:"reason"` +} + +func (entity *CanSendGiftResultFail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendGiftResultFail + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendGiftResultFail) GetClass() string { + return ClassCanSendGiftResult +} + +func (*CanSendGiftResultFail) GetType() string { + return TypeCanSendGiftResultFail +} + +func (*CanSendGiftResultFail) CanSendGiftResultType() string { + return TypeCanSendGiftResultFail +} + +// The gift was obtained by upgrading of a previously received gift +type UpgradedGiftOriginUpgrade struct { + meta + // Identifier of the message with the regular gift that was upgraded; may be 0 or an identifier of a deleted message + GiftMessageId int64 `json:"gift_message_id"` +} + +func (entity *UpgradedGiftOriginUpgrade) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginUpgrade + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginUpgrade) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginUpgrade) GetType() string { + return TypeUpgradedGiftOriginUpgrade +} + +func (*UpgradedGiftOriginUpgrade) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginUpgrade +} + +// The gift was transferred from another owner +type UpgradedGiftOriginTransfer struct{ + meta +} + +func (entity *UpgradedGiftOriginTransfer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginTransfer + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginTransfer) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginTransfer) GetType() string { + return TypeUpgradedGiftOriginTransfer +} + +func (*UpgradedGiftOriginTransfer) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginTransfer +} + +// The gift was bought from another user +type UpgradedGiftOriginResale struct { + meta + // Price paid for the gift + Price GiftResalePrice `json:"price"` +} + +func (entity *UpgradedGiftOriginResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginResale + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginResale) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginResale) GetType() string { + return TypeUpgradedGiftOriginResale +} + +func (*UpgradedGiftOriginResale) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginResale +} + +func (upgradedGiftOriginResale *UpgradedGiftOriginResale) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldPrice, _ := UnmarshalGiftResalePrice(tmp.Price) + upgradedGiftOriginResale.Price = fieldPrice + + return nil +} + +// The gift was assigned from blockchain and isn't owned by the current user. The gift can't be transferred, resold or withdrawn to blockchain +type UpgradedGiftOriginBlockchain struct{ + meta +} + +func (entity *UpgradedGiftOriginBlockchain) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginBlockchain + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginBlockchain) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginBlockchain) GetType() string { + return TypeUpgradedGiftOriginBlockchain +} + +func (*UpgradedGiftOriginBlockchain) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginBlockchain +} + +// The sender or receiver of the message has paid for upgraid of the gift, which has been completed +type UpgradedGiftOriginPrepaidUpgrade struct{ + meta +} + +func (entity *UpgradedGiftOriginPrepaidUpgrade) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginPrepaidUpgrade + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginPrepaidUpgrade) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginPrepaidUpgrade) GetType() string { + return TypeUpgradedGiftOriginPrepaidUpgrade +} + +func (*UpgradedGiftOriginPrepaidUpgrade) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginPrepaidUpgrade +} + +// The gift was bought through an offer +type UpgradedGiftOriginOffer struct { + meta + // Price paid for the gift + Price GiftResalePrice `json:"price"` +} + +func (entity *UpgradedGiftOriginOffer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginOffer + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginOffer) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginOffer) GetType() string { + return TypeUpgradedGiftOriginOffer +} + +func (*UpgradedGiftOriginOffer) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginOffer +} + +func (upgradedGiftOriginOffer *UpgradedGiftOriginOffer) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldPrice, _ := UnmarshalGiftResalePrice(tmp.Price) + upgradedGiftOriginOffer.Price = fieldPrice + + return nil +} + +// The gift was crafted from other gifts +type UpgradedGiftOriginCraft struct{ + meta +} + +func (entity *UpgradedGiftOriginCraft) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginCraft + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginCraft) GetClass() string { + return ClassUpgradedGiftOrigin +} + +func (*UpgradedGiftOriginCraft) GetType() string { + return TypeUpgradedGiftOriginCraft +} + +func (*UpgradedGiftOriginCraft) UpgradedGiftOriginType() string { + return TypeUpgradedGiftOriginCraft +} + +// The rarity is represented as the numeric frequence of the model +type UpgradedGiftAttributeRarityPerMille struct { + meta + // The number of upgraded gifts that receive this attribute for each 1000 gifts upgraded; if 0, then it can be shown as "<0.1%" + PerMille int32 `json:"per_mille"` +} + +func (entity *UpgradedGiftAttributeRarityPerMille) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeRarityPerMille + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeRarityPerMille) GetClass() string { + return ClassUpgradedGiftAttributeRarity +} + +func (*UpgradedGiftAttributeRarityPerMille) GetType() string { + return TypeUpgradedGiftAttributeRarityPerMille +} + +func (*UpgradedGiftAttributeRarityPerMille) UpgradedGiftAttributeRarityType() string { + return TypeUpgradedGiftAttributeRarityPerMille +} + +// The attribute is uncommon +type UpgradedGiftAttributeRarityUncommon struct{ + meta +} + +func (entity *UpgradedGiftAttributeRarityUncommon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeRarityUncommon + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeRarityUncommon) GetClass() string { + return ClassUpgradedGiftAttributeRarity +} + +func (*UpgradedGiftAttributeRarityUncommon) GetType() string { + return TypeUpgradedGiftAttributeRarityUncommon +} + +func (*UpgradedGiftAttributeRarityUncommon) UpgradedGiftAttributeRarityType() string { + return TypeUpgradedGiftAttributeRarityUncommon +} + +// The attribute is rare +type UpgradedGiftAttributeRarityRare struct{ + meta +} + +func (entity *UpgradedGiftAttributeRarityRare) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeRarityRare + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeRarityRare) GetClass() string { + return ClassUpgradedGiftAttributeRarity +} + +func (*UpgradedGiftAttributeRarityRare) GetType() string { + return TypeUpgradedGiftAttributeRarityRare +} + +func (*UpgradedGiftAttributeRarityRare) UpgradedGiftAttributeRarityType() string { + return TypeUpgradedGiftAttributeRarityRare +} + +// The attribute is epic +type UpgradedGiftAttributeRarityEpic struct{ + meta +} + +func (entity *UpgradedGiftAttributeRarityEpic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeRarityEpic + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeRarityEpic) GetClass() string { + return ClassUpgradedGiftAttributeRarity +} + +func (*UpgradedGiftAttributeRarityEpic) GetType() string { + return TypeUpgradedGiftAttributeRarityEpic +} + +func (*UpgradedGiftAttributeRarityEpic) UpgradedGiftAttributeRarityType() string { + return TypeUpgradedGiftAttributeRarityEpic +} + +// The attribute is legendary +type UpgradedGiftAttributeRarityLegendary struct{ + meta +} + +func (entity *UpgradedGiftAttributeRarityLegendary) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeRarityLegendary + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeRarityLegendary) GetClass() string { + return ClassUpgradedGiftAttributeRarity +} + +func (*UpgradedGiftAttributeRarityLegendary) GetType() string { + return TypeUpgradedGiftAttributeRarityLegendary +} + +func (*UpgradedGiftAttributeRarityLegendary) UpgradedGiftAttributeRarityType() string { + return TypeUpgradedGiftAttributeRarityLegendary +} + +// Describes a model of an upgraded gift +type UpgradedGiftModel struct { + meta + // Name of the model + Name string `json:"name"` + // The sticker representing the upgraded gift + Sticker *Sticker `json:"sticker"` + // The rarity of the model + Rarity UpgradedGiftAttributeRarity `json:"rarity"` + // True, if the model can be obtained only through gift crafting + IsCrafted bool `json:"is_crafted"` +} + +func (entity *UpgradedGiftModel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftModel + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftModel) GetClass() string { + return ClassUpgradedGiftModel +} + +func (*UpgradedGiftModel) GetType() string { + return TypeUpgradedGiftModel +} + +func (upgradedGiftModel *UpgradedGiftModel) UnmarshalJSON(data []byte) error { + var tmp struct { + Name string `json:"name"` + Sticker *Sticker `json:"sticker"` + Rarity json.RawMessage `json:"rarity"` + IsCrafted bool `json:"is_crafted"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + upgradedGiftModel.Name = tmp.Name + upgradedGiftModel.Sticker = tmp.Sticker + upgradedGiftModel.IsCrafted = tmp.IsCrafted + + fieldRarity, _ := UnmarshalUpgradedGiftAttributeRarity(tmp.Rarity) + upgradedGiftModel.Rarity = fieldRarity + + return nil +} + +// Describes a symbol shown on the pattern of an upgraded gift +type UpgradedGiftSymbol struct { + meta + // Name of the symbol + Name string `json:"name"` + // The sticker representing the symbol + Sticker *Sticker `json:"sticker"` + // The rarity of the symbol + Rarity UpgradedGiftAttributeRarity `json:"rarity"` +} + +func (entity *UpgradedGiftSymbol) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftSymbol + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftSymbol) GetClass() string { + return ClassUpgradedGiftSymbol +} + +func (*UpgradedGiftSymbol) GetType() string { + return TypeUpgradedGiftSymbol +} + +func (upgradedGiftSymbol *UpgradedGiftSymbol) UnmarshalJSON(data []byte) error { + var tmp struct { + Name string `json:"name"` + Sticker *Sticker `json:"sticker"` + Rarity json.RawMessage `json:"rarity"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + upgradedGiftSymbol.Name = tmp.Name + upgradedGiftSymbol.Sticker = tmp.Sticker + + fieldRarity, _ := UnmarshalUpgradedGiftAttributeRarity(tmp.Rarity) + upgradedGiftSymbol.Rarity = fieldRarity + + return nil +} + +// Describes colors of a backdrop of an upgraded gift +type UpgradedGiftBackdropColors struct { + meta + // A color in the center of the backdrop in the RGB format + CenterColor int32 `json:"center_color"` + // A color on the edges of the backdrop in the RGB format + EdgeColor int32 `json:"edge_color"` + // A color to be applied for the symbol in the RGB format + SymbolColor int32 `json:"symbol_color"` + // A color for the text on the backdrop in the RGB format + TextColor int32 `json:"text_color"` +} + +func (entity *UpgradedGiftBackdropColors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftBackdropColors + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftBackdropColors) GetClass() string { + return ClassUpgradedGiftBackdropColors +} + +func (*UpgradedGiftBackdropColors) GetType() string { + return TypeUpgradedGiftBackdropColors +} + +// Describes a backdrop of an upgraded gift +type UpgradedGiftBackdrop struct { + meta + // Unique identifier of the backdrop + Id int32 `json:"id"` + // Name of the backdrop + Name string `json:"name"` + // Colors of the backdrop + Colors *UpgradedGiftBackdropColors `json:"colors"` + // The rarity of the backdrop + Rarity UpgradedGiftAttributeRarity `json:"rarity"` +} + +func (entity *UpgradedGiftBackdrop) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftBackdrop + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftBackdrop) GetClass() string { + return ClassUpgradedGiftBackdrop +} + +func (*UpgradedGiftBackdrop) GetType() string { + return TypeUpgradedGiftBackdrop +} + +func (upgradedGiftBackdrop *UpgradedGiftBackdrop) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int32 `json:"id"` + Name string `json:"name"` + Colors *UpgradedGiftBackdropColors `json:"colors"` + Rarity json.RawMessage `json:"rarity"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + upgradedGiftBackdrop.Id = tmp.Id + upgradedGiftBackdrop.Name = tmp.Name + upgradedGiftBackdrop.Colors = tmp.Colors + + fieldRarity, _ := UnmarshalUpgradedGiftAttributeRarity(tmp.Rarity) + upgradedGiftBackdrop.Rarity = fieldRarity + + return nil +} + +// Describes the original details about the gift +type UpgradedGiftOriginalDetails struct { + meta + // Identifier of the user or the chat that sent the gift; may be null if the gift was private + SenderId MessageSender `json:"sender_id"` + // Identifier of the user or the chat that received the gift + ReceiverId MessageSender `json:"receiver_id"` + // Message added to the gift + Text *FormattedText `json:"text"` + // Point in time (Unix timestamp) when the gift was sent + Date int32 `json:"date"` +} + +func (entity *UpgradedGiftOriginalDetails) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftOriginalDetails + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftOriginalDetails) GetClass() string { + return ClassUpgradedGiftOriginalDetails +} + +func (*UpgradedGiftOriginalDetails) GetType() string { + return TypeUpgradedGiftOriginalDetails +} + +func (upgradedGiftOriginalDetails *UpgradedGiftOriginalDetails) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` + Text *FormattedText `json:"text"` + Date int32 `json:"date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + upgradedGiftOriginalDetails.Text = tmp.Text + upgradedGiftOriginalDetails.Date = tmp.Date + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + upgradedGiftOriginalDetails.SenderId = fieldSenderId + + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + upgradedGiftOriginalDetails.ReceiverId = fieldReceiverId + + return nil +} + +// Contains information about color scheme for user's name, background of empty chat photo, replies to messages and link previews +type UpgradedGiftColors struct { + meta + // Unique identifier of the upgraded gift colors + Id JsonInt64 `json:"id"` + // Custom emoji identifier of the model of the upgraded gift + ModelCustomEmojiId JsonInt64 `json:"model_custom_emoji_id"` + // Custom emoji identifier of the symbol of the upgraded gift + SymbolCustomEmojiId JsonInt64 `json:"symbol_custom_emoji_id"` + // Accent color to use in light themes in RGB format + LightThemeAccentColor int32 `json:"light_theme_accent_color"` + // The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in light themes + LightThemeColors []int32 `json:"light_theme_colors"` + // Accent color to use in dark themes in RGB format + DarkThemeAccentColor int32 `json:"dark_theme_accent_color"` + // The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes + DarkThemeColors []int32 `json:"dark_theme_colors"` +} + +func (entity *UpgradedGiftColors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftColors + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftColors) GetClass() string { + return ClassUpgradedGiftColors +} + +func (*UpgradedGiftColors) GetType() string { + return TypeUpgradedGiftColors +} + +// Describes a gift that can be sent to another user or channel chat +type Gift struct { + meta + // Unique identifier of the gift + Id JsonInt64 `json:"id"` + // Identifier of the chat that published the gift; 0 if none + PublisherChatId int64 `json:"publisher_chat_id"` + // The sticker representing the gift + Sticker *Sticker `json:"sticker"` + // Number of Telegram Stars that must be paid for the gift + StarCount int64 `json:"star_count"` + // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed + DefaultSellStarCount int64 `json:"default_sell_star_count"` + // Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible + UpgradeStarCount int64 `json:"upgrade_star_count"` + // Number of unique gift variants that are available for the upgraded gift; 0 if unknown + UpgradeVariantCount int32 `json:"upgrade_variant_count"` + // True, if the gift can be used to customize the user's name, and backgrounds of profile photo, reply header, and link preview + HasColors bool `json:"has_colors"` + // True, if the gift is a birthday gift + IsForBirthday bool `json:"is_for_birthday"` + // True, if the gift can be bought only by Telegram Premium subscribers + IsPremium bool `json:"is_premium"` + // Information about the auction on which the gift can be purchased; may be null if the gift can be purchased directly + AuctionInfo *GiftAuction `json:"auction_info"` + // Point in time (Unix timestamp) when the gift can be sent next time by the current user; may be 0 or a date in the past. If the date is in the future, then call canSendGift to get the reason, why the gift can't be sent now + NextSendDate int32 `json:"next_send_date"` + // Number of times the gift can be purchased by the current user; may be null if not limited + UserLimits *GiftPurchaseLimits `json:"user_limits"` + // Number of times the gift can be purchased all users; may be null if not limited + OverallLimits *GiftPurchaseLimits `json:"overall_limits"` + // Background of the gift + Background *GiftBackground `json:"background"` + // Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only + FirstSendDate int32 `json:"first_send_date"` + // Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only + LastSendDate int32 `json:"last_send_date"` +} + +func (entity *Gift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Gift + + return json.Marshal((*stub)(entity)) +} + +func (*Gift) GetClass() string { + return ClassGift +} + +func (*Gift) GetType() string { + return TypeGift +} + +// Describes an upgraded gift that can be transferred to another owner or transferred to the TON blockchain as an NFT +type UpgradedGift struct { + meta + // Unique identifier of the gift + Id JsonInt64 `json:"id"` + // Unique identifier of the regular gift from which the gift was upgraded; may be 0 for short period of time for old gifts from database + RegularGiftId JsonInt64 `json:"regular_gift_id"` + // Identifier of the chat that published the gift; 0 if none + PublisherChatId int64 `json:"publisher_chat_id"` + // The title of the upgraded gift + Title string `json:"title"` + // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift or sendResoldGift + Name string `json:"name"` + // Unique number of the upgraded gift among gifts upgraded from the same gift + Number int32 `json:"number"` + // Total number of gifts that were upgraded from the same gift + TotalUpgradedCount int32 `json:"total_upgraded_count"` + // The maximum number of gifts that can be upgraded from the same gift + MaxUpgradedCount int32 `json:"max_upgraded_count"` + // True, if the gift was used to craft another gift + IsBurned bool `json:"is_burned"` + // True, if the gift was craft from another gifts + IsCrafted bool `json:"is_crafted"` + // True, if the original gift could have been bought only by Telegram Premium subscribers + IsPremium bool `json:"is_premium"` + // True, if the gift can be used to set a theme in a chat + IsThemeAvailable bool `json:"is_theme_available"` + // Identifier of the chat for which the gift is used to set a theme; 0 if none or the gift isn't owned by the current user + UsedThemeChatId int64 `json:"used_theme_chat_id"` + // Identifier of the user or the chat to which the upgraded gift was assigned from blockchain; may be null if none or unknown + HostId MessageSender `json:"host_id"` + // Identifier of the user or the chat that owns the upgraded gift; may be null if none or unknown + OwnerId MessageSender `json:"owner_id"` + // Address of the gift NFT owner in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address + OwnerAddress string `json:"owner_address"` + // Name of the owner for the case when owner identifier and address aren't known + OwnerName string `json:"owner_name"` + // Address of the gift NFT in TON blockchain; may be empty if none. Append the address to getOption("ton_blockchain_explorer_url") to get a link with information about the address + GiftAddress string `json:"gift_address"` + // Model of the upgraded gift + Model *UpgradedGiftModel `json:"model"` + // Symbol of the upgraded gift + Symbol *UpgradedGiftSymbol `json:"symbol"` + // Backdrop of the upgraded gift + Backdrop *UpgradedGiftBackdrop `json:"backdrop"` + // Information about the originally sent gift; may be null if unknown + OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` + // Colors that can be set for user's name, background of empty chat photo, replies to messages and link previews; may be null if none or unknown + Colors *UpgradedGiftColors `json:"colors"` + // Resale parameters of the gift; may be null if resale isn't possible + ResaleParameters *GiftResaleParameters `json:"resale_parameters"` + // True, if an offer to purchase the gift can be sent using sendGiftPurchaseOffer + CanSendPurchaseOffer bool `json:"can_send_purchase_offer"` + // Probability that the gift adds to the chance of successful crafting of a new gift; 0 if the gift can't be used for crafting + CraftProbabilityPerMille int32 `json:"craft_probability_per_mille"` + // ISO 4217 currency code of the currency in which value of the gift is represented; may be empty if unavailable + ValueCurrency string `json:"value_currency"` + // Estimated value of the gift; in the smallest units of the currency; 0 if unavailable + ValueAmount int64 `json:"value_amount"` + // Estimated value of the gift in USD; in USD cents; 0 if unavailable + ValueUsdAmount int64 `json:"value_usd_amount"` +} + +func (entity *UpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGift) GetClass() string { + return ClassUpgradedGift +} + +func (*UpgradedGift) GetType() string { + return TypeUpgradedGift +} + +func (upgradedGift *UpgradedGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + RegularGiftId JsonInt64 `json:"regular_gift_id"` + PublisherChatId int64 `json:"publisher_chat_id"` + Title string `json:"title"` + Name string `json:"name"` + Number int32 `json:"number"` + TotalUpgradedCount int32 `json:"total_upgraded_count"` + MaxUpgradedCount int32 `json:"max_upgraded_count"` + IsBurned bool `json:"is_burned"` + IsCrafted bool `json:"is_crafted"` + IsPremium bool `json:"is_premium"` + IsThemeAvailable bool `json:"is_theme_available"` + UsedThemeChatId int64 `json:"used_theme_chat_id"` + HostId json.RawMessage `json:"host_id"` + OwnerId json.RawMessage `json:"owner_id"` + OwnerAddress string `json:"owner_address"` + OwnerName string `json:"owner_name"` + GiftAddress string `json:"gift_address"` + Model *UpgradedGiftModel `json:"model"` + Symbol *UpgradedGiftSymbol `json:"symbol"` + Backdrop *UpgradedGiftBackdrop `json:"backdrop"` + OriginalDetails *UpgradedGiftOriginalDetails `json:"original_details"` + Colors *UpgradedGiftColors `json:"colors"` + ResaleParameters *GiftResaleParameters `json:"resale_parameters"` + CanSendPurchaseOffer bool `json:"can_send_purchase_offer"` + CraftProbabilityPerMille int32 `json:"craft_probability_per_mille"` + ValueCurrency string `json:"value_currency"` + ValueAmount int64 `json:"value_amount"` + ValueUsdAmount int64 `json:"value_usd_amount"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + upgradedGift.Id = tmp.Id + upgradedGift.RegularGiftId = tmp.RegularGiftId + upgradedGift.PublisherChatId = tmp.PublisherChatId + upgradedGift.Title = tmp.Title + upgradedGift.Name = tmp.Name + upgradedGift.Number = tmp.Number + upgradedGift.TotalUpgradedCount = tmp.TotalUpgradedCount + upgradedGift.MaxUpgradedCount = tmp.MaxUpgradedCount + upgradedGift.IsBurned = tmp.IsBurned + upgradedGift.IsCrafted = tmp.IsCrafted + upgradedGift.IsPremium = tmp.IsPremium + upgradedGift.IsThemeAvailable = tmp.IsThemeAvailable + upgradedGift.UsedThemeChatId = tmp.UsedThemeChatId + upgradedGift.OwnerAddress = tmp.OwnerAddress + upgradedGift.OwnerName = tmp.OwnerName + upgradedGift.GiftAddress = tmp.GiftAddress + upgradedGift.Model = tmp.Model + upgradedGift.Symbol = tmp.Symbol + upgradedGift.Backdrop = tmp.Backdrop + upgradedGift.OriginalDetails = tmp.OriginalDetails + upgradedGift.Colors = tmp.Colors + upgradedGift.ResaleParameters = tmp.ResaleParameters + upgradedGift.CanSendPurchaseOffer = tmp.CanSendPurchaseOffer + upgradedGift.CraftProbabilityPerMille = tmp.CraftProbabilityPerMille + upgradedGift.ValueCurrency = tmp.ValueCurrency + upgradedGift.ValueAmount = tmp.ValueAmount + upgradedGift.ValueUsdAmount = tmp.ValueUsdAmount + + fieldHostId, _ := UnmarshalMessageSender(tmp.HostId) + upgradedGift.HostId = fieldHostId + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + upgradedGift.OwnerId = fieldOwnerId + + return nil +} + +// Contains information about value of an upgraded gift +type UpgradedGiftValueInfo struct { + meta + // ISO 4217 currency code of the currency in which the prices are represented + Currency string `json:"currency"` + // Estimated value of the gift; in the smallest units of the currency + Value int64 `json:"value"` + // True, if the value is calculated as average value of similar sold gifts. Otherwise, it is based on the sale price of the gift + IsValueAverage bool `json:"is_value_average"` + // Point in time (Unix timestamp) when the corresponding regular gift was originally purchased + InitialSaleDate int32 `json:"initial_sale_date"` + // The Telegram Star amount that was paid for the gift + InitialSaleStarCount int64 `json:"initial_sale_star_count"` + // Initial price of the gift; in the smallest units of the currency + InitialSalePrice int64 `json:"initial_sale_price"` + // Point in time (Unix timestamp) when the upgraded gift was purchased last time; 0 if never + LastSaleDate int32 `json:"last_sale_date"` + // Last purchase price of the gift; in the smallest units of the currency; 0 if the gift has never been resold + LastSalePrice int64 `json:"last_sale_price"` + // True, if the last sale was completed on Fragment + IsLastSaleOnFragment bool `json:"is_last_sale_on_fragment"` + // The current minimum price of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there are no such gifts + MinimumPrice int64 `json:"minimum_price"` + // The average sale price in the last month of gifts upgraded from the same gift; in the smallest units of the currency; 0 if there were no such sales + AverageSalePrice int64 `json:"average_sale_price"` + // Number of gifts upgraded from the same gift being resold on Telegram + TelegramListedGiftCount int32 `json:"telegram_listed_gift_count"` + // Number of gifts upgraded from the same gift being resold on Fragment + FragmentListedGiftCount int32 `json:"fragment_listed_gift_count"` + // The HTTPS link to the Fragment for the gift; may be empty if there are no such gifts being sold on Fragment + FragmentUrl string `json:"fragment_url"` +} + +func (entity *UpgradedGiftValueInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftValueInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftValueInfo) GetClass() string { + return ClassUpgradedGiftValueInfo +} + +func (*UpgradedGiftValueInfo) GetType() string { + return TypeUpgradedGiftValueInfo +} + +// Contains result of gift upgrading +type UpgradeGiftResult struct { + meta + // The upgraded gift + Gift *UpgradedGift `json:"gift"` + // Unique identifier of the received gift for the current user + ReceivedGiftId string `json:"received_gift_id"` + // True, if the gift is displayed on the user's or the channel's profile page + IsSaved bool `json:"is_saved"` + // True, if the gift can be transferred to another owner + CanBeTransferred bool `json:"can_be_transferred"` + // Number of Telegram Stars that must be paid to transfer the upgraded gift + TransferStarCount int64 `json:"transfer_star_count"` + // Number of Telegram Stars that must be paid to drop original details of the upgraded gift; 0 if not available + DropOriginalDetailsStarCount int64 `json:"drop_original_details_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past + ExportDate int32 `json:"export_date"` +} + +func (entity *UpgradeGiftResult) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradeGiftResult + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradeGiftResult) GetClass() string { + return ClassUpgradeGiftResult +} + +func (*UpgradeGiftResult) GetType() string { + return TypeUpgradeGiftResult +} + +// Crafting was successful +type CraftGiftResultSuccess struct { + meta + // The created gift + Gift *UpgradedGift `json:"gift"` + // Unique identifier of the received gift for the current user + ReceivedGiftId string `json:"received_gift_id"` +} + +func (entity *CraftGiftResultSuccess) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CraftGiftResultSuccess + + return json.Marshal((*stub)(entity)) +} + +func (*CraftGiftResultSuccess) GetClass() string { + return ClassCraftGiftResult +} + +func (*CraftGiftResultSuccess) GetType() string { + return TypeCraftGiftResultSuccess +} + +func (*CraftGiftResultSuccess) CraftGiftResultType() string { + return TypeCraftGiftResultSuccess +} + +// Crafting isn't possible because one of the gifts can't be used for crafting yet +type CraftGiftResultTooEarly struct { + meta + // Time left before the gift can be used for crafting + RetryAfter int32 `json:"retry_after"` +} + +func (entity *CraftGiftResultTooEarly) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CraftGiftResultTooEarly + + return json.Marshal((*stub)(entity)) +} + +func (*CraftGiftResultTooEarly) GetClass() string { + return ClassCraftGiftResult +} + +func (*CraftGiftResultTooEarly) GetType() string { + return TypeCraftGiftResultTooEarly +} + +func (*CraftGiftResultTooEarly) CraftGiftResultType() string { + return TypeCraftGiftResultTooEarly +} + +// Crafting isn't possible because one of the gifts isn't suitable for crafting +type CraftGiftResultInvalidGift struct{ + meta +} + +func (entity *CraftGiftResultInvalidGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CraftGiftResultInvalidGift + + return json.Marshal((*stub)(entity)) +} + +func (*CraftGiftResultInvalidGift) GetClass() string { + return ClassCraftGiftResult +} + +func (*CraftGiftResultInvalidGift) GetType() string { + return TypeCraftGiftResultInvalidGift +} + +func (*CraftGiftResultInvalidGift) CraftGiftResultType() string { + return TypeCraftGiftResultInvalidGift +} + +// Crafting has failed +type CraftGiftResultFail struct{ + meta +} + +func (entity *CraftGiftResultFail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CraftGiftResultFail + + return json.Marshal((*stub)(entity)) +} + +func (*CraftGiftResultFail) GetClass() string { + return ClassCraftGiftResult +} + +func (*CraftGiftResultFail) GetType() string { + return TypeCraftGiftResultFail +} + +func (*CraftGiftResultFail) CraftGiftResultType() string { + return TypeCraftGiftResultFail +} + +// Describes a gift that is available for purchase +type AvailableGift struct { + meta + // The gift + Gift *Gift `json:"gift"` + // Number of gifts that are available for resale + ResaleCount int32 `json:"resale_count"` + // The minimum price for the gifts available for resale in Telegram Star equivalent; 0 if there are no such gifts + MinResaleStarCount int64 `json:"min_resale_star_count"` + // The title of the upgraded gift; empty if the gift isn't available for resale + Title string `json:"title"` +} + +func (entity *AvailableGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AvailableGift + + return json.Marshal((*stub)(entity)) +} + +func (*AvailableGift) GetClass() string { + return ClassAvailableGift +} + +func (*AvailableGift) GetType() string { + return TypeAvailableGift +} + +// Contains a list of gifts that can be sent to another user or channel chat +type AvailableGifts struct { + meta + // The list of gifts + Gifts []*AvailableGift `json:"gifts"` +} + +func (entity *AvailableGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AvailableGifts + + return json.Marshal((*stub)(entity)) +} + +func (*AvailableGifts) GetClass() string { + return ClassAvailableGifts +} + +func (*AvailableGifts) GetType() string { + return TypeAvailableGifts +} + +// Describes a price required to pay to upgrade a gift +type GiftUpgradePrice struct { + meta + // Point in time (Unix timestamp) when the price will be in effect + Date int32 `json:"date"` + // The Telegram Star amount required to pay to upgrade the gift + StarCount int64 `json:"star_count"` +} + +func (entity *GiftUpgradePrice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftUpgradePrice + + return json.Marshal((*stub)(entity)) +} + +func (*GiftUpgradePrice) GetClass() string { + return ClassGiftUpgradePrice +} + +func (*GiftUpgradePrice) GetType() string { + return TypeGiftUpgradePrice +} + +// Identifier of a gift model +type UpgradedGiftAttributeIdModel struct { + meta + // Identifier of the sticker representing the model + StickerId JsonInt64 `json:"sticker_id"` +} + +func (entity *UpgradedGiftAttributeIdModel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdModel + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdModel) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdModel) GetType() string { + return TypeUpgradedGiftAttributeIdModel +} + +func (*UpgradedGiftAttributeIdModel) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdModel +} + +// Identifier of a gift symbol +type UpgradedGiftAttributeIdSymbol struct { + meta + // Identifier of the sticker representing the symbol + StickerId JsonInt64 `json:"sticker_id"` +} + +func (entity *UpgradedGiftAttributeIdSymbol) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdSymbol + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdSymbol) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdSymbol) GetType() string { + return TypeUpgradedGiftAttributeIdSymbol +} + +func (*UpgradedGiftAttributeIdSymbol) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdSymbol +} + +// Identifier of a gift backdrop +type UpgradedGiftAttributeIdBackdrop struct { + meta + // Identifier of the backdrop + BackdropId int32 `json:"backdrop_id"` +} + +func (entity *UpgradedGiftAttributeIdBackdrop) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftAttributeIdBackdrop + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftAttributeIdBackdrop) GetClass() string { + return ClassUpgradedGiftAttributeId +} + +func (*UpgradedGiftAttributeIdBackdrop) GetType() string { + return TypeUpgradedGiftAttributeIdBackdrop +} + +func (*UpgradedGiftAttributeIdBackdrop) UpgradedGiftAttributeIdType() string { + return TypeUpgradedGiftAttributeIdBackdrop +} + +// Describes a model of an upgraded gift with the number of gifts found +type UpgradedGiftModelCount struct { + meta + // The model + Model *UpgradedGiftModel `json:"model"` + // Total number of gifts with the model + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftModelCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftModelCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftModelCount) GetClass() string { + return ClassUpgradedGiftModelCount +} + +func (*UpgradedGiftModelCount) GetType() string { + return TypeUpgradedGiftModelCount +} + +// Describes a symbol shown on the pattern of an upgraded gift +type UpgradedGiftSymbolCount struct { + meta + // The symbol + Symbol *UpgradedGiftSymbol `json:"symbol"` + // Total number of gifts with the symbol + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftSymbolCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftSymbolCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftSymbolCount) GetClass() string { + return ClassUpgradedGiftSymbolCount +} + +func (*UpgradedGiftSymbolCount) GetType() string { + return TypeUpgradedGiftSymbolCount +} + +// Describes a backdrop of an upgraded gift +type UpgradedGiftBackdropCount struct { + meta + // The backdrop + Backdrop *UpgradedGiftBackdrop `json:"backdrop"` + // Total number of gifts with the symbol + TotalCount int32 `json:"total_count"` +} + +func (entity *UpgradedGiftBackdropCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpgradedGiftBackdropCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpgradedGiftBackdropCount) GetClass() string { + return ClassUpgradedGiftBackdropCount +} + +func (*UpgradedGiftBackdropCount) GetType() string { + return TypeUpgradedGiftBackdropCount +} + +// The gifts will be sorted by their price from the lowest to the highest +type GiftForResaleOrderPrice struct{ + meta +} + +func (entity *GiftForResaleOrderPrice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderPrice + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderPrice) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderPrice) GetType() string { + return TypeGiftForResaleOrderPrice +} + +func (*GiftForResaleOrderPrice) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderPrice +} + +// The gifts will be sorted by the last date when their price was changed from the newest to the oldest +type GiftForResaleOrderPriceChangeDate struct{ + meta +} + +func (entity *GiftForResaleOrderPriceChangeDate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderPriceChangeDate + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderPriceChangeDate) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderPriceChangeDate) GetType() string { + return TypeGiftForResaleOrderPriceChangeDate +} + +func (*GiftForResaleOrderPriceChangeDate) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderPriceChangeDate +} + +// The gifts will be sorted by their number from the smallest to the largest +type GiftForResaleOrderNumber struct{ + meta +} + +func (entity *GiftForResaleOrderNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResaleOrderNumber + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResaleOrderNumber) GetClass() string { + return ClassGiftForResaleOrder +} + +func (*GiftForResaleOrderNumber) GetType() string { + return TypeGiftForResaleOrderNumber +} + +func (*GiftForResaleOrderNumber) GiftForResaleOrderType() string { + return TypeGiftForResaleOrderNumber +} + +// Describes a gift available for resale +type GiftForResale struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // Unique identifier of the received gift for the current user; only for the gifts owned by the current user + ReceivedGiftId string `json:"received_gift_id"` +} + +func (entity *GiftForResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftForResale + + return json.Marshal((*stub)(entity)) +} + +func (*GiftForResale) GetClass() string { + return ClassGiftForResale +} + +func (*GiftForResale) GetType() string { + return TypeGiftForResale +} + +// Describes gifts available for resale +type GiftsForResale struct { + meta + // Total number of gifts found + TotalCount int32 `json:"total_count"` + // The gifts + Gifts []*GiftForResale `json:"gifts"` + // Available models; for searchGiftsForResale requests without offset and attributes only + Models []*UpgradedGiftModelCount `json:"models"` + // Available symbols; for searchGiftsForResale requests without offset and attributes only + Symbols []*UpgradedGiftSymbolCount `json:"symbols"` + // Available backdrops; for searchGiftsForResale requests without offset and attributes only + Backdrops []*UpgradedGiftBackdropCount `json:"backdrops"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *GiftsForResale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftsForResale + + return json.Marshal((*stub)(entity)) +} + +func (*GiftsForResale) GetClass() string { + return ClassGiftsForResale +} + +func (*GiftsForResale) GetType() string { + return TypeGiftsForResale +} + +// Operation was successfully completed +type GiftResaleResultOk struct { + meta + // Unique identifier of the received gift; only for the gifts sent to the current user + ReceivedGiftId string `json:"received_gift_id"` +} + +func (entity *GiftResaleResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleResultOk) GetClass() string { + return ClassGiftResaleResult +} + +func (*GiftResaleResultOk) GetType() string { + return TypeGiftResaleResultOk +} + +func (*GiftResaleResultOk) GiftResaleResultType() string { + return TypeGiftResaleResultOk +} + +// Operation has failed, because price has increased. If the price has decreased, then the buying will succeed anyway +type GiftResaleResultPriceIncreased struct { + meta + // New price for the gift + Price GiftResalePrice `json:"price"` +} + +func (entity *GiftResaleResultPriceIncreased) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftResaleResultPriceIncreased + + return json.Marshal((*stub)(entity)) +} + +func (*GiftResaleResultPriceIncreased) GetClass() string { + return ClassGiftResaleResult +} + +func (*GiftResaleResultPriceIncreased) GetType() string { + return TypeGiftResaleResultPriceIncreased +} + +func (*GiftResaleResultPriceIncreased) GiftResaleResultType() string { + return TypeGiftResaleResultPriceIncreased +} + +func (giftResaleResultPriceIncreased *GiftResaleResultPriceIncreased) UnmarshalJSON(data []byte) error { + var tmp struct { + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldPrice, _ := UnmarshalGiftResalePrice(tmp.Price) + giftResaleResultPriceIncreased.Price = fieldPrice + + return nil +} + +// Regular gift +type SentGiftRegular struct { + meta + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *SentGiftRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SentGiftRegular + + return json.Marshal((*stub)(entity)) +} + +func (*SentGiftRegular) GetClass() string { + return ClassSentGift +} + +func (*SentGiftRegular) GetType() string { + return TypeSentGiftRegular +} + +func (*SentGiftRegular) SentGiftType() string { + return TypeSentGiftRegular +} + +// Upgraded gift +type SentGiftUpgraded struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *SentGiftUpgraded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SentGiftUpgraded + + return json.Marshal((*stub)(entity)) +} + +func (*SentGiftUpgraded) GetClass() string { + return ClassSentGift +} + +func (*SentGiftUpgraded) GetType() string { + return TypeSentGiftUpgraded +} + +func (*SentGiftUpgraded) SentGiftType() string { + return TypeSentGiftUpgraded +} + +// Represents a gift received by a user or a chat +type ReceivedGift struct { + meta + // Unique identifier of the received gift for the current user; only for the receiver of the gift + ReceivedGiftId string `json:"received_gift_id"` + // Identifier of a user or a chat that sent the gift; may be null if unknown + SenderId MessageSender `json:"sender_id"` + // Message added to the gift + Text *FormattedText `json:"text"` + // Unique number of the gift among gifts upgraded from the same gift after upgrade; 0 if yet unassigned + UniqueGiftNumber int32 `json:"unique_gift_number"` + // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone are able to see them + IsPrivate bool `json:"is_private"` + // True, if the gift is displayed on the chat's profile page; only for the receiver of the gift + IsSaved bool `json:"is_saved"` + // True, if the gift is pinned to the top of the chat's profile page + IsPinned bool `json:"is_pinned"` + // True, if the gift is a regular gift that can be upgraded to a unique gift; only for the receiver of the gift + CanBeUpgraded bool `json:"can_be_upgraded"` + // True, if the gift is an upgraded gift that can be transferred to another owner; only for the receiver of the gift + CanBeTransferred bool `json:"can_be_transferred"` + // True, if the gift was refunded and isn't available anymore + WasRefunded bool `json:"was_refunded"` + // Point in time (Unix timestamp) when the gift was sent + Date int32 `json:"date"` + // The gift + Gift SentGift `json:"gift"` + // Identifiers of collections to which the gift is added; only for the receiver of the gift + CollectionIds []int32 `json:"collection_ids"` + // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the current user + SellStarCount int64 `json:"sell_star_count"` + // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + // True, if the upgrade was bought after the gift was sent. In this case, prepaid upgrade cost must not be added to the gift cost + IsUpgradeSeparate bool `json:"is_upgrade_separate"` + // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift + TransferStarCount int64 `json:"transfer_star_count"` + // Number of Telegram Stars that must be paid to drop original details of the upgraded gift; 0 if not available; only for the receiver of the gift + DropOriginalDetailsStarCount int64 `json:"drop_original_details_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` + // Point in time (Unix timestamp) when the upgraded gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift + ExportDate int32 `json:"export_date"` + // If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` + // Point in time (Unix timestamp) when the gift can be used to craft another gift can be in the past; only for the receiver of the gift + CraftDate int32 `json:"craft_date"` +} + +func (entity *ReceivedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReceivedGift + + return json.Marshal((*stub)(entity)) +} + +func (*ReceivedGift) GetClass() string { + return ClassReceivedGift +} + +func (*ReceivedGift) GetType() string { + return TypeReceivedGift +} + +func (receivedGift *ReceivedGift) UnmarshalJSON(data []byte) error { + var tmp struct { + ReceivedGiftId string `json:"received_gift_id"` + SenderId json.RawMessage `json:"sender_id"` + Text *FormattedText `json:"text"` + UniqueGiftNumber int32 `json:"unique_gift_number"` + IsPrivate bool `json:"is_private"` + IsSaved bool `json:"is_saved"` + IsPinned bool `json:"is_pinned"` + CanBeUpgraded bool `json:"can_be_upgraded"` + CanBeTransferred bool `json:"can_be_transferred"` + WasRefunded bool `json:"was_refunded"` + Date int32 `json:"date"` + Gift json.RawMessage `json:"gift"` + CollectionIds []int32 `json:"collection_ids"` + SellStarCount int64 `json:"sell_star_count"` + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + IsUpgradeSeparate bool `json:"is_upgrade_separate"` + TransferStarCount int64 `json:"transfer_star_count"` + DropOriginalDetailsStarCount int64 `json:"drop_original_details_star_count"` + NextTransferDate int32 `json:"next_transfer_date"` + NextResaleDate int32 `json:"next_resale_date"` + ExportDate int32 `json:"export_date"` + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` + CraftDate int32 `json:"craft_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + receivedGift.ReceivedGiftId = tmp.ReceivedGiftId + receivedGift.Text = tmp.Text + receivedGift.UniqueGiftNumber = tmp.UniqueGiftNumber + receivedGift.IsPrivate = tmp.IsPrivate + receivedGift.IsSaved = tmp.IsSaved + receivedGift.IsPinned = tmp.IsPinned + receivedGift.CanBeUpgraded = tmp.CanBeUpgraded + receivedGift.CanBeTransferred = tmp.CanBeTransferred + receivedGift.WasRefunded = tmp.WasRefunded + receivedGift.Date = tmp.Date + receivedGift.CollectionIds = tmp.CollectionIds + receivedGift.SellStarCount = tmp.SellStarCount + receivedGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + receivedGift.IsUpgradeSeparate = tmp.IsUpgradeSeparate + receivedGift.TransferStarCount = tmp.TransferStarCount + receivedGift.DropOriginalDetailsStarCount = tmp.DropOriginalDetailsStarCount + receivedGift.NextTransferDate = tmp.NextTransferDate + receivedGift.NextResaleDate = tmp.NextResaleDate + receivedGift.ExportDate = tmp.ExportDate + receivedGift.PrepaidUpgradeHash = tmp.PrepaidUpgradeHash + receivedGift.CraftDate = tmp.CraftDate + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + receivedGift.SenderId = fieldSenderId + + fieldGift, _ := UnmarshalSentGift(tmp.Gift) + receivedGift.Gift = fieldGift + + return nil +} + +// Represents a list of gifts received by a user or a chat +type ReceivedGifts struct { + meta + // The total number of received gifts + TotalCount int32 `json:"total_count"` + // The list of gifts + Gifts []*ReceivedGift `json:"gifts"` + // True, if notifications about new gifts of the owner are enabled + AreNotificationsEnabled bool `json:"are_notifications_enabled"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *ReceivedGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReceivedGifts + + return json.Marshal((*stub)(entity)) +} + +func (*ReceivedGifts) GetClass() string { + return ClassReceivedGifts +} + +func (*ReceivedGifts) GetType() string { + return TypeReceivedGifts +} + +// Describes chance of the crafted gift to have the backdrop or symbol of one of the original gifts +type AttributeCraftPersistenceProbability struct { + meta + // The 4 numbers that describe probability of the craft result to have the same attribute as one of the original gifts if 1, 2, 3, or 4 gifts with the attribute are used in the craft. Each number represents the number of crafted gifts with the original attribute per 1000 successful craftings + PersistenceChancePerMille []int32 `json:"persistence_chance_per_mille"` +} + +func (entity *AttributeCraftPersistenceProbability) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AttributeCraftPersistenceProbability + + return json.Marshal((*stub)(entity)) +} + +func (*AttributeCraftPersistenceProbability) GetClass() string { + return ClassAttributeCraftPersistenceProbability +} + +func (*AttributeCraftPersistenceProbability) GetType() string { + return TypeAttributeCraftPersistenceProbability +} + +// Represents a list of gifts received by a user or a chat +type GiftsForCrafting struct { + meta + // The total number of received gifts + TotalCount int32 `json:"total_count"` + // The list of gifts + Gifts []*ReceivedGift `json:"gifts"` + // The 4 objects that describe probabilities of the crafted gift to have the backdrop or symbol of one of the original gifts for the cases when 1, 2, 3 or 4 gifts are used in the craft correspondingly + AttributePersistenceProbabilities []*AttributeCraftPersistenceProbability `json:"attribute_persistence_probabilities"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *GiftsForCrafting) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftsForCrafting + + return json.Marshal((*stub)(entity)) +} + +func (*GiftsForCrafting) GetClass() string { + return ClassGiftsForCrafting +} + +func (*GiftsForCrafting) GetType() string { + return TypeGiftsForCrafting +} + +// Contains examples of possible upgraded gifts for the given regular gift +type GiftUpgradePreview struct { + meta + // Examples of possible models that can be chosen for the gift after upgrade + Models []*UpgradedGiftModel `json:"models"` + // Examples of possible symbols that can be chosen for the gift after upgrade + Symbols []*UpgradedGiftSymbol `json:"symbols"` + // Examples of possible backdrops that can be chosen for the gift after upgrade + Backdrops []*UpgradedGiftBackdrop `json:"backdrops"` + // Examples of price for gift upgrade from the maximum price to the minimum price + Prices []*GiftUpgradePrice `json:"prices"` + // Next changes for the price for gift upgrade with more granularity than in prices + NextPrices []*GiftUpgradePrice `json:"next_prices"` +} + +func (entity *GiftUpgradePreview) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftUpgradePreview + + return json.Marshal((*stub)(entity)) +} + +func (*GiftUpgradePreview) GetClass() string { + return ClassGiftUpgradePreview +} + +func (*GiftUpgradePreview) GetType() string { + return TypeGiftUpgradePreview +} + +// Contains all possible variants of upgraded gifts for the given regular gift +type GiftUpgradeVariants struct { + meta + // Models that can be chosen for the gift after upgrade + Models []*UpgradedGiftModel `json:"models"` + // Symbols that can be chosen for the gift after upgrade + Symbols []*UpgradedGiftSymbol `json:"symbols"` + // Backdrops that can be chosen for the gift after upgrade + Backdrops []*UpgradedGiftBackdrop `json:"backdrops"` +} + +func (entity *GiftUpgradeVariants) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftUpgradeVariants + + return json.Marshal((*stub)(entity)) +} + +func (*GiftUpgradeVariants) GetClass() string { + return ClassGiftUpgradeVariants +} + +func (*GiftUpgradeVariants) GetType() string { + return TypeGiftUpgradeVariants +} + +// Describes a bid in an auction +type AuctionBid struct { + meta + // The number of Telegram Stars that were put in the bid + StarCount int64 `json:"star_count"` + // Point in time (Unix timestamp) when the bid was made + BidDate int32 `json:"bid_date"` + // Position of the bid in the list of all bids + Position int32 `json:"position"` +} + +func (entity *AuctionBid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuctionBid + + return json.Marshal((*stub)(entity)) +} + +func (*AuctionBid) GetClass() string { + return ClassAuctionBid +} + +func (*AuctionBid) GetType() string { + return TypeAuctionBid +} + +// Describes a bid of the current user in an auction +type UserAuctionBid struct { + meta + // The number of Telegram Stars that were put in the bid + StarCount int64 `json:"star_count"` + // Point in time (Unix timestamp) when the bid was made + BidDate int32 `json:"bid_date"` + // The minimum number of Telegram Stars that can be put for the next bid + NextBidStarCount int64 `json:"next_bid_star_count"` + // Identifier of the user or the chat that will receive the auctioned item. If the auction is opened in context of another user or chat, then a warning is supposed to be shown to the current user + OwnerId MessageSender `json:"owner_id"` + // True, if the bid was returned to the user, because it was outbid and can't win anymore + WasReturned bool `json:"was_returned"` +} + +func (entity *UserAuctionBid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserAuctionBid + + return json.Marshal((*stub)(entity)) +} + +func (*UserAuctionBid) GetClass() string { + return ClassUserAuctionBid +} + +func (*UserAuctionBid) GetType() string { + return TypeUserAuctionBid +} + +func (userAuctionBid *UserAuctionBid) UnmarshalJSON(data []byte) error { + var tmp struct { + StarCount int64 `json:"star_count"` + BidDate int32 `json:"bid_date"` + NextBidStarCount int64 `json:"next_bid_star_count"` + OwnerId json.RawMessage `json:"owner_id"` + WasReturned bool `json:"was_returned"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + userAuctionBid.StarCount = tmp.StarCount + userAuctionBid.BidDate = tmp.BidDate + userAuctionBid.NextBidStarCount = tmp.NextBidStarCount + userAuctionBid.WasReturned = tmp.WasReturned + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + userAuctionBid.OwnerId = fieldOwnerId + + return nil +} + +// Describes a round of an auction +type AuctionRound struct { + meta + // 1-based number of the round + Number int32 `json:"number"` + // Duration of the round, in seconds + Duration int32 `json:"duration"` + // The number of seconds for which the round will be extended if there are changes in the top winners + ExtendTime int32 `json:"extend_time"` + // The number of top winners who trigger round extension if changed + TopWinnerCount int32 `json:"top_winner_count"` +} + +func (entity *AuctionRound) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuctionRound + + return json.Marshal((*stub)(entity)) +} + +func (*AuctionRound) GetClass() string { + return ClassAuctionRound +} + +func (*AuctionRound) GetType() string { + return TypeAuctionRound +} + +// Contains information about an ongoing or scheduled auction +type AuctionStateActive struct { + meta + // Point in time (Unix timestamp) when the auction started or will start + StartDate int32 `json:"start_date"` + // Point in time (Unix timestamp) when the auction will be ended + EndDate int32 `json:"end_date"` + // The minimum possible bid in the auction in Telegram Stars + MinBid int64 `json:"min_bid"` + // A sparse list of bids that were made in the auction + BidLevels []*AuctionBid `json:"bid_levels"` + // User identifiers of at most 3 users with the biggest bids + TopBidderUserIds []int64 `json:"top_bidder_user_ids"` + // Rounds of the auction in which their duration or extension rules are changed + Rounds []*AuctionRound `json:"rounds"` + // Point in time (Unix timestamp) when the current round will end + CurrentRoundEndDate int32 `json:"current_round_end_date"` + // 1-based number of the current round + CurrentRoundNumber int32 `json:"current_round_number"` + // The total number of rounds + TotalRoundCount int32 `json:"total_round_count"` + // The number of items that were purchased on the auction by all users + DistributedItemCount int32 `json:"distributed_item_count"` + // The number of items that have to be distributed on the auction + LeftItemCount int32 `json:"left_item_count"` + // The number of items that were purchased by the current user on the auction + AcquiredItemCount int32 `json:"acquired_item_count"` + // Bid of the current user in the auction; may be null if none + UserBid *UserAuctionBid `json:"user_bid"` +} + +func (entity *AuctionStateActive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuctionStateActive + + return json.Marshal((*stub)(entity)) +} + +func (*AuctionStateActive) GetClass() string { + return ClassAuctionState +} + +func (*AuctionStateActive) GetType() string { + return TypeAuctionStateActive +} + +func (*AuctionStateActive) AuctionStateType() string { + return TypeAuctionStateActive +} + +// Contains information about a finished auction +type AuctionStateFinished struct { + meta + // Point in time (Unix timestamp) when the auction started + StartDate int32 `json:"start_date"` + // Point in time (Unix timestamp) when the auction will be ended + EndDate int32 `json:"end_date"` + // Average price of bought items in Telegram Stars + AveragePrice int64 `json:"average_price"` + // The number of items that were purchased by the current user on the auction + AcquiredItemCount int32 `json:"acquired_item_count"` + // Number of items from the auction being resold on Telegram + TelegramListedItemCount int32 `json:"telegram_listed_item_count"` + // Number of items from the auction being resold on Fragment + FragmentListedItemCount int32 `json:"fragment_listed_item_count"` + // The HTTPS link to the Fragment for the resold items; may be empty if there are no such items being sold on Fragment + FragmentUrl string `json:"fragment_url"` +} + +func (entity *AuctionStateFinished) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuctionStateFinished + + return json.Marshal((*stub)(entity)) +} + +func (*AuctionStateFinished) GetClass() string { + return ClassAuctionState +} + +func (*AuctionStateFinished) GetType() string { + return TypeAuctionStateFinished +} + +func (*AuctionStateFinished) AuctionStateType() string { + return TypeAuctionStateFinished +} + +// Represent auction state of a gift +type GiftAuctionState struct { + meta + // The gift + Gift *Gift `json:"gift"` + // Auction state of the gift + State AuctionState `json:"state"` +} + +func (entity *GiftAuctionState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftAuctionState + + return json.Marshal((*stub)(entity)) +} + +func (*GiftAuctionState) GetClass() string { + return ClassGiftAuctionState +} + +func (*GiftAuctionState) GetType() string { + return TypeGiftAuctionState +} + +func (giftAuctionState *GiftAuctionState) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *Gift `json:"gift"` + State json.RawMessage `json:"state"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + giftAuctionState.Gift = tmp.Gift + + fieldState, _ := UnmarshalAuctionState(tmp.State) + giftAuctionState.State = fieldState + + return nil +} + +// Represents a gift that was acquired by the current user on an auction +type GiftAuctionAcquiredGift struct { + meta + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` + // Point in time (Unix timestamp) when the gift was acquired + Date int32 `json:"date"` + // The number of Telegram Stars that were paid for the gift + StarCount int64 `json:"star_count"` + // Identifier of the auction round in which the gift was acquired + AuctionRoundNumber int32 `json:"auction_round_number"` + // Position of the user in the round among all auction participants + AuctionRoundPosition int32 `json:"auction_round_position"` + // Unique number of the gift among gifts upgraded from the same gift after upgrade; 0 if yet unassigned + UniqueGiftNumber int32 `json:"unique_gift_number"` + // Message added to the gift + Text *FormattedText `json:"text"` + // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them + IsPrivate bool `json:"is_private"` +} + +func (entity *GiftAuctionAcquiredGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftAuctionAcquiredGift + + return json.Marshal((*stub)(entity)) +} + +func (*GiftAuctionAcquiredGift) GetClass() string { + return ClassGiftAuctionAcquiredGift +} + +func (*GiftAuctionAcquiredGift) GetType() string { + return TypeGiftAuctionAcquiredGift +} + +func (giftAuctionAcquiredGift *GiftAuctionAcquiredGift) UnmarshalJSON(data []byte) error { + var tmp struct { + ReceiverId json.RawMessage `json:"receiver_id"` + Date int32 `json:"date"` + StarCount int64 `json:"star_count"` + AuctionRoundNumber int32 `json:"auction_round_number"` + AuctionRoundPosition int32 `json:"auction_round_position"` + UniqueGiftNumber int32 `json:"unique_gift_number"` + Text *FormattedText `json:"text"` + IsPrivate bool `json:"is_private"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + giftAuctionAcquiredGift.Date = tmp.Date + giftAuctionAcquiredGift.StarCount = tmp.StarCount + giftAuctionAcquiredGift.AuctionRoundNumber = tmp.AuctionRoundNumber + giftAuctionAcquiredGift.AuctionRoundPosition = tmp.AuctionRoundPosition + giftAuctionAcquiredGift.UniqueGiftNumber = tmp.UniqueGiftNumber + giftAuctionAcquiredGift.Text = tmp.Text + giftAuctionAcquiredGift.IsPrivate = tmp.IsPrivate + + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + giftAuctionAcquiredGift.ReceiverId = fieldReceiverId + + return nil +} + +// Represents a list of gifts that were acquired by the current user on an auction +type GiftAuctionAcquiredGifts struct { + meta + // The list of acquired gifts + Gifts []*GiftAuctionAcquiredGift `json:"gifts"` +} + +func (entity *GiftAuctionAcquiredGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftAuctionAcquiredGifts + + return json.Marshal((*stub)(entity)) +} + +func (*GiftAuctionAcquiredGifts) GetClass() string { + return ClassGiftAuctionAcquiredGifts +} + +func (*GiftAuctionAcquiredGifts) GetType() string { + return TypeGiftAuctionAcquiredGifts +} + +// The transaction is incoming and increases the amount of owned currency +type TransactionDirectionIncoming struct{ + meta +} + +func (entity *TransactionDirectionIncoming) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TransactionDirectionIncoming + + return json.Marshal((*stub)(entity)) +} + +func (*TransactionDirectionIncoming) GetClass() string { + return ClassTransactionDirection +} + +func (*TransactionDirectionIncoming) GetType() string { + return TypeTransactionDirectionIncoming +} + +func (*TransactionDirectionIncoming) TransactionDirectionType() string { + return TypeTransactionDirectionIncoming +} + +// The transaction is outgoing and decreases the amount of owned currency +type TransactionDirectionOutgoing struct{ + meta +} + +func (entity *TransactionDirectionOutgoing) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TransactionDirectionOutgoing + + return json.Marshal((*stub)(entity)) +} + +func (*TransactionDirectionOutgoing) GetClass() string { + return ClassTransactionDirection +} + +func (*TransactionDirectionOutgoing) GetType() string { + return TypeTransactionDirectionOutgoing +} + +func (*TransactionDirectionOutgoing) TransactionDirectionType() string { + return TypeTransactionDirectionOutgoing +} + +// The transaction is a deposit of Telegram Stars from the Premium bot; relevant for regular users only +type StarTransactionTypePremiumBotDeposit struct{ + meta +} + +func (entity *StarTransactionTypePremiumBotDeposit) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePremiumBotDeposit + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePremiumBotDeposit) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePremiumBotDeposit) GetType() string { + return TypeStarTransactionTypePremiumBotDeposit +} + +func (*StarTransactionTypePremiumBotDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypePremiumBotDeposit +} + +// The transaction is a deposit of Telegram Stars from App Store; relevant for regular users only +type StarTransactionTypeAppStoreDeposit struct{ + meta +} + +func (entity *StarTransactionTypeAppStoreDeposit) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeAppStoreDeposit + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeAppStoreDeposit) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeAppStoreDeposit) GetType() string { + return TypeStarTransactionTypeAppStoreDeposit +} + +func (*StarTransactionTypeAppStoreDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeAppStoreDeposit +} + +// The transaction is a deposit of Telegram Stars from Google Play; relevant for regular users only +type StarTransactionTypeGooglePlayDeposit struct{ + meta +} + +func (entity *StarTransactionTypeGooglePlayDeposit) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGooglePlayDeposit + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGooglePlayDeposit) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGooglePlayDeposit) GetType() string { + return TypeStarTransactionTypeGooglePlayDeposit +} + +func (*StarTransactionTypeGooglePlayDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeGooglePlayDeposit +} + +// The transaction is a deposit of Telegram Stars from Fragment; relevant for regular users and bots only +type StarTransactionTypeFragmentDeposit struct{ + meta +} + +func (entity *StarTransactionTypeFragmentDeposit) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeFragmentDeposit + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeFragmentDeposit) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeFragmentDeposit) GetType() string { + return TypeStarTransactionTypeFragmentDeposit +} + +func (*StarTransactionTypeFragmentDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeFragmentDeposit +} + +// The transaction is a deposit of Telegram Stars by another user; relevant for regular users only +type StarTransactionTypeUserDeposit struct { + meta + // Identifier of the user who 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 *StarTransactionTypeUserDeposit) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUserDeposit + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUserDeposit) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUserDeposit) GetType() string { + return TypeStarTransactionTypeUserDeposit +} + +func (*StarTransactionTypeUserDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeUserDeposit +} + +// The transaction is a deposit of Telegram Stars from a giveaway; relevant for regular users only +type StarTransactionTypeGiveawayDeposit struct { + meta + // Identifier of a supergroup or a channel chat that created the giveaway + ChatId int64 `json:"chat_id"` + // Identifier of the message with the giveaway; may be 0 or an identifier of a deleted message + GiveawayMessageId int64 `json:"giveaway_message_id"` +} + +func (entity *StarTransactionTypeGiveawayDeposit) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiveawayDeposit + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiveawayDeposit) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiveawayDeposit) GetType() string { + return TypeStarTransactionTypeGiveawayDeposit +} + +func (*StarTransactionTypeGiveawayDeposit) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiveawayDeposit +} + +// The transaction is a withdrawal of earned Telegram Stars to Fragment; relevant for regular users, bots, supergroup and channel chats only +type StarTransactionTypeFragmentWithdrawal struct { + meta + // State of the withdrawal; may be null for refunds from Fragment + WithdrawalState RevenueWithdrawalState `json:"withdrawal_state"` +} + +func (entity *StarTransactionTypeFragmentWithdrawal) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeFragmentWithdrawal + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeFragmentWithdrawal) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeFragmentWithdrawal) GetType() string { + return TypeStarTransactionTypeFragmentWithdrawal +} + +func (*StarTransactionTypeFragmentWithdrawal) StarTransactionTypeType() string { + return TypeStarTransactionTypeFragmentWithdrawal +} + +func (starTransactionTypeFragmentWithdrawal *StarTransactionTypeFragmentWithdrawal) UnmarshalJSON(data []byte) error { + var tmp struct { + WithdrawalState json.RawMessage `json:"withdrawal_state"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldWithdrawalState, _ := UnmarshalRevenueWithdrawalState(tmp.WithdrawalState) + starTransactionTypeFragmentWithdrawal.WithdrawalState = fieldWithdrawalState + + return nil +} + +// The transaction is a withdrawal of earned Telegram Stars to Telegram Ad platform; relevant for bots and channel chats only +type StarTransactionTypeTelegramAdsWithdrawal struct{ + meta +} + +func (entity *StarTransactionTypeTelegramAdsWithdrawal) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeTelegramAdsWithdrawal + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeTelegramAdsWithdrawal) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeTelegramAdsWithdrawal) GetType() string { + return TypeStarTransactionTypeTelegramAdsWithdrawal +} + +func (*StarTransactionTypeTelegramAdsWithdrawal) StarTransactionTypeType() string { + return TypeStarTransactionTypeTelegramAdsWithdrawal +} + +// The transaction is a payment for Telegram API usage; relevant for bots only +type StarTransactionTypeTelegramApiUsage struct { + meta + // The number of billed requests + RequestCount int32 `json:"request_count"` +} + +func (entity *StarTransactionTypeTelegramApiUsage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeTelegramApiUsage + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeTelegramApiUsage) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeTelegramApiUsage) GetType() string { + return TypeStarTransactionTypeTelegramApiUsage +} + +func (*StarTransactionTypeTelegramApiUsage) StarTransactionTypeType() string { + return TypeStarTransactionTypeTelegramApiUsage +} + +// The transaction is a purchase of paid media from a bot or a business account by the current user; relevant for regular users only +type StarTransactionTypeBotPaidMediaPurchase struct { + meta + // Identifier of the bot or the business account user who sent the paid media + UserId int64 `json:"user_id"` + // The bought media if the transaction wasn't refunded + Media []PaidMedia `json:"media"` +} + +func (entity *StarTransactionTypeBotPaidMediaPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotPaidMediaPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotPaidMediaPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotPaidMediaPurchase) GetType() string { + return TypeStarTransactionTypeBotPaidMediaPurchase +} + +func (*StarTransactionTypeBotPaidMediaPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotPaidMediaPurchase +} + +func (starTransactionTypeBotPaidMediaPurchase *StarTransactionTypeBotPaidMediaPurchase) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + Media []json.RawMessage `json:"media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeBotPaidMediaPurchase.UserId = tmp.UserId + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionTypeBotPaidMediaPurchase.Media = fieldMedia + + return nil +} + +// The transaction is a sale of paid media by the bot or a business account managed by the bot; relevant for bots only +type StarTransactionTypeBotPaidMediaSale struct { + meta + // Identifier of the user who bought the media + UserId int64 `json:"user_id"` + // 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 *StarTransactionTypeBotPaidMediaSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBotPaidMediaSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBotPaidMediaSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBotPaidMediaSale) GetType() string { + return TypeStarTransactionTypeBotPaidMediaSale +} + +func (*StarTransactionTypeBotPaidMediaSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeBotPaidMediaSale +} + +func (starTransactionTypeBotPaidMediaSale *StarTransactionTypeBotPaidMediaSale) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + Media []json.RawMessage `json:"media"` + Payload string `json:"payload"` + Affiliate *AffiliateInfo `json:"affiliate"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeBotPaidMediaSale.UserId = tmp.UserId + starTransactionTypeBotPaidMediaSale.Payload = tmp.Payload + starTransactionTypeBotPaidMediaSale.Affiliate = tmp.Affiliate + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + starTransactionTypeBotPaidMediaSale.Media = fieldMedia + + return nil +} + +// The transaction is a purchase of paid media from a channel by the current user; relevant 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; may 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 *StarTransactionTypeChannelPaidMediaPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeChannelPaidMediaPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeChannelPaidMediaPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeChannelPaidMediaPurchase) GetType() string { + return TypeStarTransactionTypeChannelPaidMediaPurchase +} + +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; relevant for channel chats only +type StarTransactionTypeChannelPaidMediaSale struct { + meta + // Identifier of the user who bought the media + UserId int64 `json:"user_id"` + // Identifier of the corresponding message with paid media; may 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; relevant for regular users only +type StarTransactionTypeBotInvoicePurchase struct { + meta + // Identifier of the bot or the business account user who 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; relevant for bots only +type StarTransactionTypeBotInvoiceSale struct { + meta + // Identifier of the user who 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; relevant for regular users only +type StarTransactionTypeBotSubscriptionPurchase struct { + meta + // Identifier of the bot or the business account user who 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; relevant for bots only +type StarTransactionTypeBotSubscriptionSale struct { + meta + // Identifier of the user who 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; relevant 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; relevant for channel chats only +type StarTransactionTypeChannelSubscriptionSale struct { + meta + // Identifier of the user who 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 bid on a gift auction; relevant for regular users only +type StarTransactionTypeGiftAuctionBid struct { + meta + // Identifier of the user who will receive the gift + OwnerId MessageSender `json:"owner_id"` + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftAuctionBid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftAuctionBid + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftAuctionBid) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftAuctionBid) GetType() string { + return TypeStarTransactionTypeGiftAuctionBid +} + +func (*StarTransactionTypeGiftAuctionBid) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftAuctionBid +} + +func (starTransactionTypeGiftAuctionBid *StarTransactionTypeGiftAuctionBid) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *Gift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftAuctionBid.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftAuctionBid.OwnerId = fieldOwnerId + + return nil +} + +// The transaction is a purchase of a regular gift; relevant for regular users and bots only +type StarTransactionTypeGiftPurchase struct { + meta + // Identifier of the user or the channel that received the gift + OwnerId MessageSender `json:"owner_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 +} + +func (starTransactionTypeGiftPurchase *StarTransactionTypeGiftPurchase) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *Gift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftPurchase.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftPurchase.OwnerId = fieldOwnerId + + return nil +} + +// The transaction is an offer of gift purchase; relevant for regular users only +type StarTransactionTypeGiftPurchaseOffer struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftPurchaseOffer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftPurchaseOffer + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftPurchaseOffer) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftPurchaseOffer) GetType() string { + return TypeStarTransactionTypeGiftPurchaseOffer +} + +func (*StarTransactionTypeGiftPurchaseOffer) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftPurchaseOffer +} + +// The transaction is a transfer of an upgraded gift; relevant for regular users only +type StarTransactionTypeGiftTransfer struct { + meta + // Identifier of the user or the channel that received the gift + OwnerId MessageSender `json:"owner_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftTransfer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftTransfer + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftTransfer) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftTransfer) GetType() string { + return TypeStarTransactionTypeGiftTransfer +} + +func (*StarTransactionTypeGiftTransfer) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftTransfer +} + +func (starTransactionTypeGiftTransfer *StarTransactionTypeGiftTransfer) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *UpgradedGift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftTransfer.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftTransfer.OwnerId = fieldOwnerId + + return nil +} + +// The transaction is a drop of original details of an upgraded gift; relevant for regular users only +type StarTransactionTypeGiftOriginalDetailsDrop struct { + meta + // Identifier of the user or the channel that owns the gift + OwnerId MessageSender `json:"owner_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftOriginalDetailsDrop) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftOriginalDetailsDrop + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftOriginalDetailsDrop) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftOriginalDetailsDrop) GetType() string { + return TypeStarTransactionTypeGiftOriginalDetailsDrop +} + +func (*StarTransactionTypeGiftOriginalDetailsDrop) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftOriginalDetailsDrop +} + +func (starTransactionTypeGiftOriginalDetailsDrop *StarTransactionTypeGiftOriginalDetailsDrop) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *UpgradedGift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftOriginalDetailsDrop.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftOriginalDetailsDrop.OwnerId = fieldOwnerId + + return nil +} + +// The transaction is a sale of a received gift; relevant for regular users and channel chats only +type StarTransactionTypeGiftSale struct { + meta + // Identifier of the user who 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 an upgrade of a gift; relevant for regular users only +type StarTransactionTypeGiftUpgrade struct { + meta + // Identifier of the user who initially sent the gift + UserId int64 `json:"user_id"` + // The upgraded gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftUpgrade) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftUpgrade + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftUpgrade) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftUpgrade) GetType() string { + return TypeStarTransactionTypeGiftUpgrade +} + +func (*StarTransactionTypeGiftUpgrade) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftUpgrade +} + +// The transaction is a purchase of an upgrade of a gift owned by another user or channel; relevant for regular users only +type StarTransactionTypeGiftUpgradePurchase struct { + meta + // Owner of the upgraded gift + OwnerId MessageSender `json:"owner_id"` + // The gift + Gift *Gift `json:"gift"` +} + +func (entity *StarTransactionTypeGiftUpgradePurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeGiftUpgradePurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeGiftUpgradePurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeGiftUpgradePurchase) GetType() string { + return TypeStarTransactionTypeGiftUpgradePurchase +} + +func (*StarTransactionTypeGiftUpgradePurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeGiftUpgradePurchase +} + +func (starTransactionTypeGiftUpgradePurchase *StarTransactionTypeGiftUpgradePurchase) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Gift *Gift `json:"gift"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypeGiftUpgradePurchase.Gift = tmp.Gift + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + starTransactionTypeGiftUpgradePurchase.OwnerId = fieldOwnerId + + return nil +} + +// The transaction is a purchase of an upgraded gift for some user or channel; relevant for regular users only +type StarTransactionTypeUpgradedGiftPurchase struct { + meta + // Identifier of the user who sold the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *StarTransactionTypeUpgradedGiftPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUpgradedGiftPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUpgradedGiftPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUpgradedGiftPurchase) GetType() string { + return TypeStarTransactionTypeUpgradedGiftPurchase +} + +func (*StarTransactionTypeUpgradedGiftPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypeUpgradedGiftPurchase +} + +// The transaction is a sale of an upgraded gift; relevant for regular users only +type StarTransactionTypeUpgradedGiftSale struct { + meta + // Identifier of the user who bought the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` + // The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars received by the seller of the gift + CommissionPerMille int32 `json:"commission_per_mille"` + // The Telegram Star amount that was received by Telegram; can be negative for refunds + CommissionStarAmount *StarAmount `json:"commission_star_amount"` + // True, if the gift was sold through a purchase offer + ViaOffer bool `json:"via_offer"` +} + +func (entity *StarTransactionTypeUpgradedGiftSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeUpgradedGiftSale + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeUpgradedGiftSale) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeUpgradedGiftSale) GetType() string { + return TypeStarTransactionTypeUpgradedGiftSale +} + +func (*StarTransactionTypeUpgradedGiftSale) StarTransactionTypeType() string { + return TypeStarTransactionTypeUpgradedGiftSale +} + +// The transaction is a sending of a paid reaction to a message in a channel chat by the current user; relevant for regular users only +type StarTransactionTypeChannelPaidReactionSend struct { + meta + // Identifier of the channel chat + ChatId int64 `json:"chat_id"` + // Identifier of the reacted message; may 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; relevant for channel chats only +type StarTransactionTypeChannelPaidReactionReceive struct { + meta + // Identifier of the user who added the paid reaction + UserId int64 `json:"user_id"` + // Identifier of the reacted message; may 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; relevant 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 sending of a paid message; relevant for regular users only +type StarTransactionTypePaidMessageSend struct { + meta + // Identifier of the chat that received the payment + ChatId int64 `json:"chat_id"` + // Number of sent paid messages + MessageCount int32 `json:"message_count"` +} + +func (entity *StarTransactionTypePaidMessageSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidMessageSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidMessageSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidMessageSend) GetType() string { + return TypeStarTransactionTypePaidMessageSend +} + +func (*StarTransactionTypePaidMessageSend) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidMessageSend +} + +// The transaction is a receiving of a paid message; relevant for regular users, supergroup and channel chats only +type StarTransactionTypePaidMessageReceive struct { + meta + // Identifier of the sender of the message + SenderId MessageSender `json:"sender_id"` + // Number of received paid messages + MessageCount int32 `json:"message_count"` + // The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for message sending + CommissionPerMille int32 `json:"commission_per_mille"` + // The Telegram Star amount that was received by Telegram; can be negative for refunds + CommissionStarAmount *StarAmount `json:"commission_star_amount"` +} + +func (entity *StarTransactionTypePaidMessageReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidMessageReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidMessageReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidMessageReceive) GetType() string { + return TypeStarTransactionTypePaidMessageReceive +} + +func (*StarTransactionTypePaidMessageReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidMessageReceive +} + +func (starTransactionTypePaidMessageReceive *StarTransactionTypePaidMessageReceive) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderId json.RawMessage `json:"sender_id"` + MessageCount int32 `json:"message_count"` + CommissionPerMille int32 `json:"commission_per_mille"` + CommissionStarAmount *StarAmount `json:"commission_star_amount"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypePaidMessageReceive.MessageCount = tmp.MessageCount + starTransactionTypePaidMessageReceive.CommissionPerMille = tmp.CommissionPerMille + starTransactionTypePaidMessageReceive.CommissionStarAmount = tmp.CommissionStarAmount + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + starTransactionTypePaidMessageReceive.SenderId = fieldSenderId + + return nil +} + +// The transaction is a sending of a paid group call message; relevant for regular users only +type StarTransactionTypePaidGroupCallMessageSend struct { + meta + // Identifier of the chat that received the payment + ChatId int64 `json:"chat_id"` +} + +func (entity *StarTransactionTypePaidGroupCallMessageSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidGroupCallMessageSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidGroupCallMessageSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidGroupCallMessageSend) GetType() string { + return TypeStarTransactionTypePaidGroupCallMessageSend +} + +func (*StarTransactionTypePaidGroupCallMessageSend) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidGroupCallMessageSend +} + +// The transaction is a receiving of a paid group call message; relevant for regular users and channel chats only +type StarTransactionTypePaidGroupCallMessageReceive struct { + meta + // Identifier of the sender of the message + SenderId MessageSender `json:"sender_id"` + // The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for message sending + CommissionPerMille int32 `json:"commission_per_mille"` + // The Telegram Star amount that was received by Telegram; can be negative for refunds + CommissionStarAmount *StarAmount `json:"commission_star_amount"` +} + +func (entity *StarTransactionTypePaidGroupCallMessageReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidGroupCallMessageReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidGroupCallMessageReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidGroupCallMessageReceive) GetType() string { + return TypeStarTransactionTypePaidGroupCallMessageReceive +} + +func (*StarTransactionTypePaidGroupCallMessageReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidGroupCallMessageReceive +} + +func (starTransactionTypePaidGroupCallMessageReceive *StarTransactionTypePaidGroupCallMessageReceive) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderId json.RawMessage `json:"sender_id"` + CommissionPerMille int32 `json:"commission_per_mille"` + CommissionStarAmount *StarAmount `json:"commission_star_amount"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypePaidGroupCallMessageReceive.CommissionPerMille = tmp.CommissionPerMille + starTransactionTypePaidGroupCallMessageReceive.CommissionStarAmount = tmp.CommissionStarAmount + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + starTransactionTypePaidGroupCallMessageReceive.SenderId = fieldSenderId + + return nil +} + +// The transaction is a sending of a paid group reaction; relevant for regular users only +type StarTransactionTypePaidGroupCallReactionSend struct { + meta + // Identifier of the chat that received the payment + ChatId int64 `json:"chat_id"` +} + +func (entity *StarTransactionTypePaidGroupCallReactionSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidGroupCallReactionSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidGroupCallReactionSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidGroupCallReactionSend) GetType() string { + return TypeStarTransactionTypePaidGroupCallReactionSend +} + +func (*StarTransactionTypePaidGroupCallReactionSend) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidGroupCallReactionSend +} + +// The transaction is a receiving of a paid group call reaction; relevant for regular users and channel chats only +type StarTransactionTypePaidGroupCallReactionReceive struct { + meta + // Identifier of the sender of the reaction + SenderId MessageSender `json:"sender_id"` + // The number of Telegram Stars received by the Telegram for each 1000 Telegram Stars paid for reaction sending + CommissionPerMille int32 `json:"commission_per_mille"` + // The Telegram Star amount that was received by Telegram; can be negative for refunds + CommissionStarAmount *StarAmount `json:"commission_star_amount"` +} + +func (entity *StarTransactionTypePaidGroupCallReactionReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePaidGroupCallReactionReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePaidGroupCallReactionReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePaidGroupCallReactionReceive) GetType() string { + return TypeStarTransactionTypePaidGroupCallReactionReceive +} + +func (*StarTransactionTypePaidGroupCallReactionReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypePaidGroupCallReactionReceive +} + +func (starTransactionTypePaidGroupCallReactionReceive *StarTransactionTypePaidGroupCallReactionReceive) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderId json.RawMessage `json:"sender_id"` + CommissionPerMille int32 `json:"commission_per_mille"` + CommissionStarAmount *StarAmount `json:"commission_star_amount"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransactionTypePaidGroupCallReactionReceive.CommissionPerMille = tmp.CommissionPerMille + starTransactionTypePaidGroupCallReactionReceive.CommissionStarAmount = tmp.CommissionStarAmount + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + starTransactionTypePaidGroupCallReactionReceive.SenderId = fieldSenderId + + return nil +} + +// The transaction is a payment for a suggested post; relevant for regular users only +type StarTransactionTypeSuggestedPostPaymentSend struct { + meta + // Identifier of the channel chat that posted the post + ChatId int64 `json:"chat_id"` +} + +func (entity *StarTransactionTypeSuggestedPostPaymentSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeSuggestedPostPaymentSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) GetType() string { + return TypeStarTransactionTypeSuggestedPostPaymentSend +} + +func (*StarTransactionTypeSuggestedPostPaymentSend) StarTransactionTypeType() string { + return TypeStarTransactionTypeSuggestedPostPaymentSend +} + +// The transaction is a receiving of a payment for a suggested post by the channel chat; relevant for channel chats only +type StarTransactionTypeSuggestedPostPaymentReceive struct { + meta + // Identifier of the user who paid for the suggested post + UserId int64 `json:"user_id"` +} + +func (entity *StarTransactionTypeSuggestedPostPaymentReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeSuggestedPostPaymentReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) GetType() string { + return TypeStarTransactionTypeSuggestedPostPaymentReceive +} + +func (*StarTransactionTypeSuggestedPostPaymentReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypeSuggestedPostPaymentReceive +} + +// The transaction is a purchase of Telegram Premium subscription; relevant for regular users and bots only +type StarTransactionTypePremiumPurchase struct { + meta + // Identifier of the user who received the Telegram Premium subscription + UserId int64 `json:"user_id"` + // Number of months the Telegram Premium subscription will be active + MonthCount int32 `json:"month_count"` + // A sticker to be shown in the transaction information; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *StarTransactionTypePremiumPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePremiumPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePremiumPurchase) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePremiumPurchase) GetType() string { + return TypeStarTransactionTypePremiumPurchase +} + +func (*StarTransactionTypePremiumPurchase) StarTransactionTypeType() string { + return TypeStarTransactionTypePremiumPurchase +} + +// The transaction is a transfer of Telegram Stars to a business bot; relevant for regular users only +type StarTransactionTypeBusinessBotTransferSend struct { + meta + // Identifier of the bot that received Telegram Stars + UserId int64 `json:"user_id"` +} + +func (entity *StarTransactionTypeBusinessBotTransferSend) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBusinessBotTransferSend + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBusinessBotTransferSend) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBusinessBotTransferSend) GetType() string { + return TypeStarTransactionTypeBusinessBotTransferSend +} + +func (*StarTransactionTypeBusinessBotTransferSend) StarTransactionTypeType() string { + return TypeStarTransactionTypeBusinessBotTransferSend +} + +// The transaction is a transfer of Telegram Stars from a business account; relevant for bots only +type StarTransactionTypeBusinessBotTransferReceive struct { + meta + // Identifier of the user who sent Telegram Stars + UserId int64 `json:"user_id"` +} + +func (entity *StarTransactionTypeBusinessBotTransferReceive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypeBusinessBotTransferReceive + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypeBusinessBotTransferReceive) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypeBusinessBotTransferReceive) GetType() string { + return TypeStarTransactionTypeBusinessBotTransferReceive +} + +func (*StarTransactionTypeBusinessBotTransferReceive) StarTransactionTypeType() string { + return TypeStarTransactionTypeBusinessBotTransferReceive +} + +// The transaction is a payment for search of posts in public Telegram channels; relevant for regular users only +type StarTransactionTypePublicPostSearch struct{ + meta +} + +func (entity *StarTransactionTypePublicPostSearch) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactionTypePublicPostSearch + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactionTypePublicPostSearch) GetClass() string { + return ClassStarTransactionType +} + +func (*StarTransactionTypePublicPostSearch) GetType() string { + return TypeStarTransactionTypePublicPostSearch +} + +func (*StarTransactionTypePublicPostSearch) StarTransactionTypeType() string { + return TypeStarTransactionTypePublicPostSearch +} + +// 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 +type StarTransaction struct { + meta + // Unique identifier of the transaction + Id string `json:"id"` + // The amount of added owned Telegram Stars; negative for outgoing transactions + 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"` + // Type of the transaction + Type StarTransactionType `json:"type"` +} + +func (entity *StarTransaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransaction + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransaction) GetClass() string { + return ClassStarTransaction +} + +func (*StarTransaction) GetType() string { + return TypeStarTransaction +} + +func (starTransaction *StarTransaction) UnmarshalJSON(data []byte) error { + var tmp struct { + Id string `json:"id"` + StarAmount *StarAmount `json:"star_amount"` + IsRefund bool `json:"is_refund"` + Date int32 `json:"date"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starTransaction.Id = tmp.Id + starTransaction.StarAmount = tmp.StarAmount + starTransaction.IsRefund = tmp.IsRefund + starTransaction.Date = tmp.Date + + fieldType, _ := UnmarshalStarTransactionType(tmp.Type) + starTransaction.Type = fieldType + + return nil +} + +// Represents a list of Telegram Star transactions +type StarTransactions struct { + meta + // The amount of owned Telegram Stars + 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 + NextOffset string `json:"next_offset"` +} + +func (entity *StarTransactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarTransactions + + return json.Marshal((*stub)(entity)) +} + +func (*StarTransactions) GetClass() string { + return ClassStarTransactions +} + +func (*StarTransactions) GetType() string { + return TypeStarTransactions +} + +// The transaction is a deposit of Toncoins from Fragment +type TonTransactionTypeFragmentDeposit struct { + meta + // True, if the transaction is a gift from another user + IsGift bool `json:"is_gift"` + // The sticker to be shown in the transaction information; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *TonTransactionTypeFragmentDeposit) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeFragmentDeposit + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeFragmentDeposit) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeFragmentDeposit) GetType() string { + return TypeTonTransactionTypeFragmentDeposit +} + +func (*TonTransactionTypeFragmentDeposit) TonTransactionTypeType() string { + return TypeTonTransactionTypeFragmentDeposit +} + +// The transaction is a withdrawal of earned Toncoins to Fragment +type TonTransactionTypeFragmentWithdrawal struct { + meta + // State of the withdrawal; may be null for refunds from Fragment + WithdrawalState RevenueWithdrawalState `json:"withdrawal_state"` +} + +func (entity *TonTransactionTypeFragmentWithdrawal) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeFragmentWithdrawal + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeFragmentWithdrawal) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeFragmentWithdrawal) GetType() string { + return TypeTonTransactionTypeFragmentWithdrawal +} + +func (*TonTransactionTypeFragmentWithdrawal) TonTransactionTypeType() string { + return TypeTonTransactionTypeFragmentWithdrawal +} + +func (tonTransactionTypeFragmentWithdrawal *TonTransactionTypeFragmentWithdrawal) UnmarshalJSON(data []byte) error { + var tmp struct { + WithdrawalState json.RawMessage `json:"withdrawal_state"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldWithdrawalState, _ := UnmarshalRevenueWithdrawalState(tmp.WithdrawalState) + tonTransactionTypeFragmentWithdrawal.WithdrawalState = fieldWithdrawalState + + return nil +} + +// The transaction is a payment for a suggested post +type TonTransactionTypeSuggestedPostPayment struct { + meta + // Identifier of the channel chat that posted the post + ChatId int64 `json:"chat_id"` +} + +func (entity *TonTransactionTypeSuggestedPostPayment) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeSuggestedPostPayment + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeSuggestedPostPayment) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeSuggestedPostPayment) GetType() string { + return TypeTonTransactionTypeSuggestedPostPayment +} + +func (*TonTransactionTypeSuggestedPostPayment) TonTransactionTypeType() string { + return TypeTonTransactionTypeSuggestedPostPayment +} + +// The transaction is an offer of gift purchase +type TonTransactionTypeGiftPurchaseOffer struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *TonTransactionTypeGiftPurchaseOffer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeGiftPurchaseOffer + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeGiftPurchaseOffer) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeGiftPurchaseOffer) GetType() string { + return TypeTonTransactionTypeGiftPurchaseOffer +} + +func (*TonTransactionTypeGiftPurchaseOffer) TonTransactionTypeType() string { + return TypeTonTransactionTypeGiftPurchaseOffer +} + +// The transaction is a purchase of an upgraded gift for some user or channel +type TonTransactionTypeUpgradedGiftPurchase struct { + meta + // Identifier of the user who sold the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *TonTransactionTypeUpgradedGiftPurchase) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUpgradedGiftPurchase + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUpgradedGiftPurchase) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUpgradedGiftPurchase) GetType() string { + return TypeTonTransactionTypeUpgradedGiftPurchase +} + +func (*TonTransactionTypeUpgradedGiftPurchase) TonTransactionTypeType() string { + return TypeTonTransactionTypeUpgradedGiftPurchase +} + +// The transaction is a sale of an upgraded gift +type TonTransactionTypeUpgradedGiftSale struct { + meta + // Identifier of the user who bought the gift + UserId int64 `json:"user_id"` + // The gift + Gift *UpgradedGift `json:"gift"` + // The number of Toncoins received by the Telegram for each 1000 Toncoins received by the seller of the gift + CommissionPerMille int32 `json:"commission_per_mille"` + // The Toncoin amount that was received by the Telegram; in the smallest units of the currency + CommissionToncoinAmount int64 `json:"commission_toncoin_amount"` + // True, if the gift was sold through a purchase offer + ViaOffer bool `json:"via_offer"` +} + +func (entity *TonTransactionTypeUpgradedGiftSale) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUpgradedGiftSale + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUpgradedGiftSale) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUpgradedGiftSale) GetType() string { + return TypeTonTransactionTypeUpgradedGiftSale +} + +func (*TonTransactionTypeUpgradedGiftSale) TonTransactionTypeType() string { + return TypeTonTransactionTypeUpgradedGiftSale +} + +// The transaction is a payment for stake dice throw +type TonTransactionTypeStakeDiceStake struct{ + meta +} + +func (entity *TonTransactionTypeStakeDiceStake) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeStakeDiceStake + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeStakeDiceStake) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeStakeDiceStake) GetType() string { + return TypeTonTransactionTypeStakeDiceStake +} + +func (*TonTransactionTypeStakeDiceStake) TonTransactionTypeType() string { + return TypeTonTransactionTypeStakeDiceStake +} + +// The transaction is a payment for successful stake dice throw +type TonTransactionTypeStakeDicePayout struct{ + meta +} + +func (entity *TonTransactionTypeStakeDicePayout) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeStakeDicePayout + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeStakeDicePayout) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeStakeDicePayout) GetType() string { + return TypeTonTransactionTypeStakeDicePayout +} + +func (*TonTransactionTypeStakeDicePayout) TonTransactionTypeType() string { + return TypeTonTransactionTypeStakeDicePayout +} + +// The transaction is a transaction of an unsupported type +type TonTransactionTypeUnsupported struct{ + meta +} + +func (entity *TonTransactionTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactionTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactionTypeUnsupported) GetClass() string { + return ClassTonTransactionType +} + +func (*TonTransactionTypeUnsupported) GetType() string { + return TypeTonTransactionTypeUnsupported +} + +func (*TonTransactionTypeUnsupported) TonTransactionTypeType() string { + return TypeTonTransactionTypeUnsupported +} + +// Represents a transaction changing the amount of owned Toncoins +type TonTransaction struct { + meta + // Unique identifier of the transaction + Id string `json:"id"` + // The amount of added owned Toncoins; negative for outgoing transactions + TonAmount int64 `json:"ton_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"` + // Type of the transaction + Type TonTransactionType `json:"type"` +} + +func (entity *TonTransaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransaction + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransaction) GetClass() string { + return ClassTonTransaction +} + +func (*TonTransaction) GetType() string { + return TypeTonTransaction +} + +func (tonTransaction *TonTransaction) UnmarshalJSON(data []byte) error { + var tmp struct { + Id string `json:"id"` + TonAmount int64 `json:"ton_amount"` + IsRefund bool `json:"is_refund"` + Date int32 `json:"date"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + tonTransaction.Id = tmp.Id + tonTransaction.TonAmount = tmp.TonAmount + tonTransaction.IsRefund = tmp.IsRefund + tonTransaction.Date = tmp.Date + + fieldType, _ := UnmarshalTonTransactionType(tmp.Type) + tonTransaction.Type = fieldType + + return nil +} + +// Represents a list of Toncoin transactions +type TonTransactions struct { + meta + // The total amount of owned Toncoins + TonAmount int64 `json:"ton_amount"` + // List of Toncoin transactions + Transactions []*TonTransaction `json:"transactions"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *TonTransactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonTransactions + + return json.Marshal((*stub)(entity)) +} + +func (*TonTransactions) GetClass() string { + return ClassTonTransactions +} + +func (*TonTransactions) GetType() string { + return TypeTonTransactions +} + +// The chat has an active live story +type ActiveStoryStateLive struct { + meta + // Identifier of the active live story + StoryId int32 `json:"story_id"` +} + +func (entity *ActiveStoryStateLive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ActiveStoryStateLive + + return json.Marshal((*stub)(entity)) +} + +func (*ActiveStoryStateLive) GetClass() string { + return ClassActiveStoryState +} + +func (*ActiveStoryStateLive) GetType() string { + return TypeActiveStoryStateLive +} + +func (*ActiveStoryStateLive) ActiveStoryStateType() string { + return TypeActiveStoryStateLive +} + +// The chat has some unread active stories +type ActiveStoryStateUnread struct{ + meta +} + +func (entity *ActiveStoryStateUnread) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ActiveStoryStateUnread + + return json.Marshal((*stub)(entity)) +} + +func (*ActiveStoryStateUnread) GetClass() string { + return ClassActiveStoryState +} + +func (*ActiveStoryStateUnread) GetType() string { + return TypeActiveStoryStateUnread +} + +func (*ActiveStoryStateUnread) ActiveStoryStateType() string { + return TypeActiveStoryStateUnread +} + +// The chat has active stories, all of which were read +type ActiveStoryStateRead struct{ + meta +} + +func (entity *ActiveStoryStateRead) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ActiveStoryStateRead + + return json.Marshal((*stub)(entity)) +} + +func (*ActiveStoryStateRead) GetClass() string { + return ClassActiveStoryState +} + +func (*ActiveStoryStateRead) GetType() string { + return TypeActiveStoryStateRead +} + +func (*ActiveStoryStateRead) ActiveStoryStateType() string { + return TypeActiveStoryStateRead +} + +// The user is eligible for the giveaway +type GiveawayParticipantStatusEligible struct{ + meta +} + +func (entity *GiveawayParticipantStatusEligible) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiveawayParticipantStatusEligible + + return json.Marshal((*stub)(entity)) +} + +func (*GiveawayParticipantStatusEligible) GetClass() string { + return ClassGiveawayParticipantStatus +} + +func (*GiveawayParticipantStatusEligible) GetType() string { + return TypeGiveawayParticipantStatusEligible +} + +func (*GiveawayParticipantStatusEligible) GiveawayParticipantStatusType() string { + return TypeGiveawayParticipantStatusEligible } // The user participates in the giveaway -type PremiumGiveawayParticipantStatusParticipating struct{ +type GiveawayParticipantStatusParticipating struct{ meta } -func (entity *PremiumGiveawayParticipantStatusParticipating) MarshalJSON() ([]byte, error) { +func (entity *GiveawayParticipantStatusParticipating) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParticipantStatusParticipating + type stub GiveawayParticipantStatusParticipating return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParticipantStatusParticipating) GetClass() string { - return ClassPremiumGiveawayParticipantStatus +func (*GiveawayParticipantStatusParticipating) GetClass() string { + return ClassGiveawayParticipantStatus } -func (*PremiumGiveawayParticipantStatusParticipating) GetType() string { - return TypePremiumGiveawayParticipantStatusParticipating +func (*GiveawayParticipantStatusParticipating) GetType() string { + return TypeGiveawayParticipantStatusParticipating } -func (*PremiumGiveawayParticipantStatusParticipating) PremiumGiveawayParticipantStatusType() string { - return TypePremiumGiveawayParticipantStatusParticipating +func (*GiveawayParticipantStatusParticipating) GiveawayParticipantStatusType() string { + return TypeGiveawayParticipantStatusParticipating } // The user can't participate in the giveaway, because they have already been member of the chat -type PremiumGiveawayParticipantStatusAlreadyWasMember struct { +type GiveawayParticipantStatusAlreadyWasMember struct { meta // Point in time (Unix timestamp) when the user joined the chat JoinedChatDate int32 `json:"joined_chat_date"` } -func (entity *PremiumGiveawayParticipantStatusAlreadyWasMember) MarshalJSON() ([]byte, error) { +func (entity *GiveawayParticipantStatusAlreadyWasMember) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParticipantStatusAlreadyWasMember + type stub GiveawayParticipantStatusAlreadyWasMember return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParticipantStatusAlreadyWasMember) GetClass() string { - return ClassPremiumGiveawayParticipantStatus +func (*GiveawayParticipantStatusAlreadyWasMember) GetClass() string { + return ClassGiveawayParticipantStatus } -func (*PremiumGiveawayParticipantStatusAlreadyWasMember) GetType() string { - return TypePremiumGiveawayParticipantStatusAlreadyWasMember +func (*GiveawayParticipantStatusAlreadyWasMember) GetType() string { + return TypeGiveawayParticipantStatusAlreadyWasMember } -func (*PremiumGiveawayParticipantStatusAlreadyWasMember) PremiumGiveawayParticipantStatusType() string { - return TypePremiumGiveawayParticipantStatusAlreadyWasMember +func (*GiveawayParticipantStatusAlreadyWasMember) GiveawayParticipantStatusType() string { + return TypeGiveawayParticipantStatusAlreadyWasMember } // The user can't participate in the giveaway, because they are an administrator in one of the chats that created the giveaway -type PremiumGiveawayParticipantStatusAdministrator struct { +type GiveawayParticipantStatusAdministrator struct { meta // Identifier of the chat administered by the user ChatId int64 `json:"chat_id"` } -func (entity *PremiumGiveawayParticipantStatusAdministrator) MarshalJSON() ([]byte, error) { +func (entity *GiveawayParticipantStatusAdministrator) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParticipantStatusAdministrator + type stub GiveawayParticipantStatusAdministrator return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParticipantStatusAdministrator) GetClass() string { - return ClassPremiumGiveawayParticipantStatus +func (*GiveawayParticipantStatusAdministrator) GetClass() string { + return ClassGiveawayParticipantStatus } -func (*PremiumGiveawayParticipantStatusAdministrator) GetType() string { - return TypePremiumGiveawayParticipantStatusAdministrator +func (*GiveawayParticipantStatusAdministrator) GetType() string { + return TypeGiveawayParticipantStatusAdministrator } -func (*PremiumGiveawayParticipantStatusAdministrator) PremiumGiveawayParticipantStatusType() string { - return TypePremiumGiveawayParticipantStatusAdministrator +func (*GiveawayParticipantStatusAdministrator) GiveawayParticipantStatusType() string { + return TypeGiveawayParticipantStatusAdministrator } // The user can't participate in the giveaway, because they phone number is from a disallowed country -type PremiumGiveawayParticipantStatusDisallowedCountry struct { +type GiveawayParticipantStatusDisallowedCountry struct { meta // A two-letter ISO 3166-1 alpha-2 country code of the user's country UserCountryCode string `json:"user_country_code"` } -func (entity *PremiumGiveawayParticipantStatusDisallowedCountry) MarshalJSON() ([]byte, error) { +func (entity *GiveawayParticipantStatusDisallowedCountry) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParticipantStatusDisallowedCountry + type stub GiveawayParticipantStatusDisallowedCountry return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParticipantStatusDisallowedCountry) GetClass() string { - return ClassPremiumGiveawayParticipantStatus +func (*GiveawayParticipantStatusDisallowedCountry) GetClass() string { + return ClassGiveawayParticipantStatus } -func (*PremiumGiveawayParticipantStatusDisallowedCountry) GetType() string { - return TypePremiumGiveawayParticipantStatusDisallowedCountry +func (*GiveawayParticipantStatusDisallowedCountry) GetType() string { + return TypeGiveawayParticipantStatusDisallowedCountry } -func (*PremiumGiveawayParticipantStatusDisallowedCountry) PremiumGiveawayParticipantStatusType() string { - return TypePremiumGiveawayParticipantStatusDisallowedCountry +func (*GiveawayParticipantStatusDisallowedCountry) GiveawayParticipantStatusType() string { + return TypeGiveawayParticipantStatusDisallowedCountry } // Describes an ongoing giveaway -type PremiumGiveawayInfoOngoing struct { +type GiveawayInfoOngoing struct { meta // Point in time (Unix timestamp) when the giveaway was created CreationDate int32 `json:"creation_date"` // Status of the current user in the giveaway - Status PremiumGiveawayParticipantStatus `json:"status"` + Status GiveawayParticipantStatus `json:"status"` // True, if the giveaway has ended and results are being prepared IsEnded bool `json:"is_ended"` } -func (entity *PremiumGiveawayInfoOngoing) MarshalJSON() ([]byte, error) { +func (entity *GiveawayInfoOngoing) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayInfoOngoing + type stub GiveawayInfoOngoing return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayInfoOngoing) GetClass() string { - return ClassPremiumGiveawayInfo +func (*GiveawayInfoOngoing) GetClass() string { + return ClassGiveawayInfo } -func (*PremiumGiveawayInfoOngoing) GetType() string { - return TypePremiumGiveawayInfoOngoing +func (*GiveawayInfoOngoing) GetType() string { + return TypeGiveawayInfoOngoing } -func (*PremiumGiveawayInfoOngoing) PremiumGiveawayInfoType() string { - return TypePremiumGiveawayInfoOngoing +func (*GiveawayInfoOngoing) GiveawayInfoType() string { + return TypeGiveawayInfoOngoing } -func (premiumGiveawayInfoOngoing *PremiumGiveawayInfoOngoing) UnmarshalJSON(data []byte) error { +func (giveawayInfoOngoing *GiveawayInfoOngoing) UnmarshalJSON(data []byte) error { var tmp struct { CreationDate int32 `json:"creation_date"` Status json.RawMessage `json:"status"` @@ -6317,17 +14627,17 @@ func (premiumGiveawayInfoOngoing *PremiumGiveawayInfoOngoing) UnmarshalJSON(data return err } - premiumGiveawayInfoOngoing.CreationDate = tmp.CreationDate - premiumGiveawayInfoOngoing.IsEnded = tmp.IsEnded + giveawayInfoOngoing.CreationDate = tmp.CreationDate + giveawayInfoOngoing.IsEnded = tmp.IsEnded - fieldStatus, _ := UnmarshalPremiumGiveawayParticipantStatus(tmp.Status) - premiumGiveawayInfoOngoing.Status = fieldStatus + fieldStatus, _ := UnmarshalGiveawayParticipantStatus(tmp.Status) + giveawayInfoOngoing.Status = fieldStatus return nil } // Describes a completed giveaway -type PremiumGiveawayInfoCompleted struct { +type GiveawayInfoCompleted struct { meta // Point in time (Unix timestamp) when the giveaway was created CreationDate int32 `json:"creation_date"` @@ -6335,32 +14645,90 @@ type PremiumGiveawayInfoCompleted struct { ActualWinnersSelectionDate int32 `json:"actual_winners_selection_date"` // True, if the giveaway was canceled and was fully refunded WasRefunded bool `json:"was_refunded"` + // True, if the current user is a winner of the giveaway + IsWinner bool `json:"is_winner"` // Number of winners in the giveaway WinnerCount int32 `json:"winner_count"` - // Number of winners, which activated their gift codes + // Number of winners, which activated their gift codes; for Telegram Premium giveaways only ActivationCount int32 `json:"activation_count"` - // Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway + // Telegram Premium gift code that was received by the current user; empty if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Premium giveaway GiftCode string `json:"gift_code"` + // The Telegram Star amount won by the current user; 0 if the user isn't a winner in the giveaway or the giveaway isn't a Telegram Star giveaway + WonStarCount int64 `json:"won_star_count"` } -func (entity *PremiumGiveawayInfoCompleted) MarshalJSON() ([]byte, error) { +func (entity *GiveawayInfoCompleted) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayInfoCompleted + type stub GiveawayInfoCompleted return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayInfoCompleted) GetClass() string { - return ClassPremiumGiveawayInfo +func (*GiveawayInfoCompleted) GetClass() string { + return ClassGiveawayInfo } -func (*PremiumGiveawayInfoCompleted) GetType() string { - return TypePremiumGiveawayInfoCompleted +func (*GiveawayInfoCompleted) GetType() string { + return TypeGiveawayInfoCompleted } -func (*PremiumGiveawayInfoCompleted) PremiumGiveawayInfoType() string { - return TypePremiumGiveawayInfoCompleted +func (*GiveawayInfoCompleted) GiveawayInfoType() string { + return TypeGiveawayInfoCompleted +} + +// The giveaway sends Telegram Premium subscriptions to the winners +type GiveawayPrizePremium struct { + meta + // Number of months the Telegram Premium subscription will be active after code activation + MonthCount int32 `json:"month_count"` +} + +func (entity *GiveawayPrizePremium) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiveawayPrizePremium + + return json.Marshal((*stub)(entity)) +} + +func (*GiveawayPrizePremium) GetClass() string { + return ClassGiveawayPrize +} + +func (*GiveawayPrizePremium) GetType() string { + return TypeGiveawayPrizePremium +} + +func (*GiveawayPrizePremium) GiveawayPrizeType() string { + return TypeGiveawayPrizePremium +} + +// The giveaway sends Telegram Stars to the winners +type GiveawayPrizeStars struct { + meta + // Number of Telegram Stars that will be shared by all winners + StarCount int64 `json:"star_count"` +} + +func (entity *GiveawayPrizeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiveawayPrizeStars + + return json.Marshal((*stub)(entity)) +} + +func (*GiveawayPrizeStars) GetClass() string { + return ClassGiveawayPrize +} + +func (*GiveawayPrizeStars) GetType() string { + return TypeGiveawayPrizeStars +} + +func (*GiveawayPrizeStars) GiveawayPrizeType() string { + return TypeGiveawayPrizeStars } // Contains information about supported accent color for user/chat name, background of empty chat photo, replies to messages and link previews @@ -6374,6 +14742,8 @@ type AccentColor struct { LightThemeColors []int32 `json:"light_theme_colors"` // The list of 1-3 colors in RGB format, describing the accent color, as expected to be shown in dark themes DarkThemeColors []int32 `json:"dark_theme_colors"` + // The minimum chat boost level required to use the color in a channel chat + MinChannelChatBoostLevel int32 `json:"min_channel_chat_boost_level"` } func (entity *AccentColor) MarshalJSON() ([]byte, error) { @@ -6392,11 +14762,189 @@ func (*AccentColor) GetType() string { return TypeAccentColor } -// Describes a custom emoji to be shown instead of the Telegram Premium badge -type EmojiStatus struct { +// Contains information about supported accent colors for user profile photo background in RGB format +type ProfileAccentColors struct { + meta + // The list of 1-2 colors in RGB format, describing the colors, as expected to be shown in the color palette settings + PaletteColors []int32 `json:"palette_colors"` + // The list of 1-2 colors in RGB format, describing the colors, as expected to be used for the profile photo background + BackgroundColors []int32 `json:"background_colors"` + // The list of 2 colors in RGB format, describing the colors of the gradient to be used for the unread active story indicator around profile photo + StoryColors []int32 `json:"story_colors"` +} + +func (entity *ProfileAccentColors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileAccentColors + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileAccentColors) GetClass() string { + return ClassProfileAccentColors +} + +func (*ProfileAccentColors) GetType() string { + return TypeProfileAccentColors +} + +// Contains information about supported accent color for user profile photo background +type ProfileAccentColor struct { + meta + // Profile accent color identifier + Id int32 `json:"id"` + // Accent colors expected to be used in light themes + LightThemeColors *ProfileAccentColors `json:"light_theme_colors"` + // Accent colors expected to be used in dark themes + DarkThemeColors *ProfileAccentColors `json:"dark_theme_colors"` + // The minimum chat boost level required to use the color in a supergroup chat + MinSupergroupChatBoostLevel int32 `json:"min_supergroup_chat_boost_level"` + // The minimum chat boost level required to use the color in a channel chat + MinChannelChatBoostLevel int32 `json:"min_channel_chat_boost_level"` +} + +func (entity *ProfileAccentColor) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProfileAccentColor + + return json.Marshal((*stub)(entity)) +} + +func (*ProfileAccentColor) GetClass() string { + return ClassProfileAccentColor +} + +func (*ProfileAccentColor) GetType() string { + return TypeProfileAccentColor +} + +// Contains description of user rating +type UserRating struct { + meta + // The level of the user; may be negative + Level int32 `json:"level"` + // True, if the maximum level is reached + IsMaximumLevelReached bool `json:"is_maximum_level_reached"` + // Numerical value of the rating + Rating int64 `json:"rating"` + // The rating required for the current level + CurrentLevelRating int64 `json:"current_level_rating"` + // The rating required for the next level; 0 if the maximum level is reached + NextLevelRating int64 `json:"next_level_rating"` +} + +func (entity *UserRating) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserRating + + return json.Marshal((*stub)(entity)) +} + +func (*UserRating) GetClass() string { + return ClassUserRating +} + +func (*UserRating) GetType() string { + return TypeUserRating +} + +// Contains information about restrictions that must be applied to a chat or a message +type RestrictionInfo struct { + meta + // A human-readable description of the reason why access to the content must be restricted. If empty, then the content can be accessed, but may be covered by hidden with 18+ spoiler anyway + RestrictionReason string `json:"restriction_reason"` + // True, if media content of the messages must be hidden with 18+ spoiler. Use value of the option "can_ignore_sensitive_content_restrictions" to check whether the current user can ignore the restriction. If age verification parameters were received in updateAgeVerificationParameters, then the user must complete age verification to ignore the restriction. Set the option "ignore_sensitive_content_restrictions" to true if the user passes age verification + HasSensitiveContent bool `json:"has_sensitive_content"` +} + +func (entity *RestrictionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RestrictionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*RestrictionInfo) GetClass() string { + return ClassRestrictionInfo +} + +func (*RestrictionInfo) GetType() string { + return TypeRestrictionInfo +} + +// A custom emoji set as emoji status +type EmojiStatusTypeCustomEmoji struct { meta // Identifier of the custom emoji in stickerFormatTgs format CustomEmojiId JsonInt64 `json:"custom_emoji_id"` +} + +func (entity *EmojiStatusTypeCustomEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiStatusTypeCustomEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiStatusTypeCustomEmoji) GetClass() string { + return ClassEmojiStatusType +} + +func (*EmojiStatusTypeCustomEmoji) GetType() string { + return TypeEmojiStatusTypeCustomEmoji +} + +func (*EmojiStatusTypeCustomEmoji) EmojiStatusTypeType() string { + return TypeEmojiStatusTypeCustomEmoji +} + +// An upgraded gift set as emoji status +type EmojiStatusTypeUpgradedGift struct { + meta + // Identifier of the upgraded gift + UpgradedGiftId JsonInt64 `json:"upgraded_gift_id"` + // The title of the upgraded gift + GiftTitle string `json:"gift_title"` + // Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift + GiftName string `json:"gift_name"` + // Custom emoji identifier of the model of the upgraded gift + ModelCustomEmojiId JsonInt64 `json:"model_custom_emoji_id"` + // Custom emoji identifier of the symbol of the upgraded gift + SymbolCustomEmojiId JsonInt64 `json:"symbol_custom_emoji_id"` + // Colors of the backdrop of the upgraded gift + BackdropColors *UpgradedGiftBackdropColors `json:"backdrop_colors"` +} + +func (entity *EmojiStatusTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiStatusTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiStatusTypeUpgradedGift) GetClass() string { + return ClassEmojiStatusType +} + +func (*EmojiStatusTypeUpgradedGift) GetType() string { + return TypeEmojiStatusTypeUpgradedGift +} + +func (*EmojiStatusTypeUpgradedGift) EmojiStatusTypeType() string { + return TypeEmojiStatusTypeUpgradedGift +} + +// Describes an emoji to be shown instead of the Telegram Premium badge +type EmojiStatus struct { + meta + // Type of the emoji status + Type EmojiStatusType `json:"type"` // Point in time (Unix timestamp) when the status will expire; 0 if never ExpirationDate int32 `json:"expiration_date"` } @@ -6417,11 +14965,30 @@ func (*EmojiStatus) GetType() string { return TypeEmojiStatus } -// Contains a list of custom emoji identifiers, which can be set as emoji statuses +func (emojiStatus *EmojiStatus) UnmarshalJSON(data []byte) error { + var tmp struct { + Type json.RawMessage `json:"type"` + ExpirationDate int32 `json:"expiration_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + emojiStatus.ExpirationDate = tmp.ExpirationDate + + fieldType, _ := UnmarshalEmojiStatusType(tmp.Type) + emojiStatus.Type = fieldType + + return nil +} + +// Contains a list of emoji statuses type EmojiStatuses struct { meta - // The list of custom emoji identifiers - CustomEmojiIds []JsonInt64 `json:"custom_emoji_ids"` + // The list of emoji statuses identifiers + EmojiStatuses []*EmojiStatus `json:"emoji_statuses"` } func (entity *EmojiStatuses) MarshalJSON() ([]byte, error) { @@ -6440,6 +15007,29 @@ func (*EmojiStatuses) GetType() string { return TypeEmojiStatuses } +// Contains a list of custom emoji identifiers for emoji statuses +type EmojiStatusCustomEmojis struct { + meta + // The list of custom emoji identifiers + CustomEmojiIds []JsonInt64 `json:"custom_emoji_ids"` +} + +func (entity *EmojiStatusCustomEmojis) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiStatusCustomEmojis + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiStatusCustomEmojis) GetClass() string { + return ClassEmojiStatusCustomEmojis +} + +func (*EmojiStatusCustomEmojis) GetType() string { + return TypeEmojiStatusCustomEmojis +} + // Describes usernames assigned to a user, a supergroup, or a channel type Usernames struct { meta @@ -6447,8 +15037,10 @@ type Usernames struct { ActiveUsernames []string `json:"active_usernames"` // List of currently disabled usernames; the username can be activated with toggleUsernameIsActive, toggleBotUsernameIsActive, or toggleSupergroupUsernameIsActive DisabledUsernames []string `json:"disabled_usernames"` - // The active username, which can be changed with setUsername or setSupergroupUsername + // Active or disabled username, which may be changed with setUsername or setSupergroupUsername EditableUsername string `json:"editable_username"` + // Collectible usernames that were purchased at https://fragment.com and can be passed to getCollectibleItemInfo for more details + CollectibleUsernames []string `json:"collectible_usernames"` } func (entity *Usernames) MarshalJSON() ([]byte, error) { @@ -6488,9 +15080,15 @@ type User struct { ProfilePhoto *ProfilePhoto `json:"profile_photo"` // 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 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"` - // Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only + // Color scheme based on an upgraded gift to be used for the user instead of accent_color_id and background_custom_emoji_id; may be null if none + UpgradedGiftColors *UpgradedGiftColors `json:"upgraded_gift_colors"` + // 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 + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` + // 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"` @@ -6498,22 +15096,20 @@ type User struct { IsMutualContact bool `json:"is_mutual_contact"` // The user is a close friend of the current user; implies that the user is a contact IsCloseFriend bool `json:"is_close_friend"` - // True, if the user is verified - IsVerified bool `json:"is_verified"` + // Information about verification status of the user; may be null if none + VerificationStatus *VerificationStatus `json:"verification_status"` // True, if the user is a Telegram Premium user IsPremium bool `json:"is_premium"` // True, if the user is Telegram support account IsSupport bool `json:"is_support"` - // If non-empty, it contains a human-readable description of the reason why access to this user must be restricted - RestrictionReason string `json:"restriction_reason"` - // True, if many users reported this user as a scam - IsScam bool `json:"is_scam"` - // True, if many users reported this user as a fake account - IsFake bool `json:"is_fake"` - // True, if the user has non-expired stories available to the current user - HasActiveStories bool `json:"has_active_stories"` - // True, if the user has unread non-expired stories available to the current user - HasUnreadActiveStories bool `json:"has_unread_active_stories"` + // Information about restrictions that must be applied to the corresponding private chat; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` + // State of active stories of the user; may be null if the user has no active stories + ActiveStoryState ActiveStoryState `json:"active_story_state"` + // True, if the user may restrict new chats with non-contacts. Use canSendMessageToUser to check whether the current user can message the user or try to create a chat with them + RestrictsNewChats bool `json:"restricts_new_chats"` + // Number of Telegram Stars that must be paid by general user for each sent message to the user. If positive and userFullInfo is unknown, use canSendMessageToUser to check whether the current user must pay + PaidMessageStarCount int64 `json:"paid_message_star_count"` // If false, the user is inaccessible, and the only information known about the user is inside this class. Identifier of the user can't be passed to any method HaveAccess bool `json:"have_access"` // Type of the user @@ -6552,18 +15148,20 @@ func (user *User) UnmarshalJSON(data []byte) error { ProfilePhoto *ProfilePhoto `json:"profile_photo"` AccentColorId int32 `json:"accent_color_id"` BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` + UpgradedGiftColors *UpgradedGiftColors `json:"upgraded_gift_colors"` + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` EmojiStatus *EmojiStatus `json:"emoji_status"` IsContact bool `json:"is_contact"` IsMutualContact bool `json:"is_mutual_contact"` IsCloseFriend bool `json:"is_close_friend"` - IsVerified bool `json:"is_verified"` + VerificationStatus *VerificationStatus `json:"verification_status"` IsPremium bool `json:"is_premium"` IsSupport bool `json:"is_support"` - RestrictionReason string `json:"restriction_reason"` - IsScam bool `json:"is_scam"` - IsFake bool `json:"is_fake"` - HasActiveStories bool `json:"has_active_stories"` - HasUnreadActiveStories bool `json:"has_unread_active_stories"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` + ActiveStoryState json.RawMessage `json:"active_story_state"` + RestrictsNewChats bool `json:"restricts_new_chats"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` HaveAccess bool `json:"have_access"` Type json.RawMessage `json:"type"` LanguageCode string `json:"language_code"` @@ -6584,18 +15182,19 @@ func (user *User) UnmarshalJSON(data []byte) error { user.ProfilePhoto = tmp.ProfilePhoto user.AccentColorId = tmp.AccentColorId user.BackgroundCustomEmojiId = tmp.BackgroundCustomEmojiId + user.UpgradedGiftColors = tmp.UpgradedGiftColors + user.ProfileAccentColorId = tmp.ProfileAccentColorId + user.ProfileBackgroundCustomEmojiId = tmp.ProfileBackgroundCustomEmojiId user.EmojiStatus = tmp.EmojiStatus user.IsContact = tmp.IsContact user.IsMutualContact = tmp.IsMutualContact user.IsCloseFriend = tmp.IsCloseFriend - user.IsVerified = tmp.IsVerified + user.VerificationStatus = tmp.VerificationStatus user.IsPremium = tmp.IsPremium user.IsSupport = tmp.IsSupport - user.RestrictionReason = tmp.RestrictionReason - user.IsScam = tmp.IsScam - user.IsFake = tmp.IsFake - user.HasActiveStories = tmp.HasActiveStories - user.HasUnreadActiveStories = tmp.HasUnreadActiveStories + user.RestrictionInfo = tmp.RestrictionInfo + user.RestrictsNewChats = tmp.RestrictsNewChats + user.PaidMessageStarCount = tmp.PaidMessageStarCount user.HaveAccess = tmp.HaveAccess user.LanguageCode = tmp.LanguageCode user.AddedToAttachmentMenu = tmp.AddedToAttachmentMenu @@ -6603,6 +15202,9 @@ func (user *User) UnmarshalJSON(data []byte) error { fieldStatus, _ := UnmarshalUserStatus(tmp.Status) user.Status = fieldStatus + fieldActiveStoryState, _ := UnmarshalActiveStoryState(tmp.ActiveStoryState) + user.ActiveStoryState = fieldActiveStoryState + fieldType, _ := UnmarshalUserType(tmp.Type) user.Type = fieldType @@ -6624,10 +15226,30 @@ type BotInfo struct { MenuButton *BotMenuButton `json:"menu_button"` // List of the bot commands Commands []*BotCommand `json:"commands"` + // 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 + PrivacyPolicyUrl string `json:"privacy_policy_url"` // Default administrator rights for adding the bot to basic group and supergroup chats; may be null 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 + WebAppBackgroundDarkColor int32 `json:"web_app_background_dark_color"` + // Default light header color for bot Web Apps; -1 if not specified + WebAppHeaderLightColor int32 `json:"web_app_header_light_color"` + // Default dark header color for bot Web Apps; -1 if not specified + WebAppHeaderDarkColor int32 `json:"web_app_header_dark_color"` + // Parameters of the verification that can be provided by the bot; may be null if none or the current user isn't the owner of the bot + VerificationParameters *BotVerificationParameters `json:"verification_parameters"` + // True, if the bot's revenue statistics are available to the current user + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + // True, if the bot can manage emoji status of the current user + CanManageEmojiStatus bool `json:"can_manage_emoji_status"` + // True, if the bot has media previews + HasMediaPreviews bool `json:"has_media_previews"` // The internal link, which can be used to edit bot commands; may be null EditCommandsLink InternalLinkType `json:"edit_commands_link"` // The internal link, which can be used to edit bot description; may be null @@ -6662,8 +15284,18 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { Animation *Animation `json:"animation"` MenuButton *BotMenuButton `json:"menu_button"` Commands []*BotCommand `json:"commands"` + 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"` + WebAppHeaderDarkColor int32 `json:"web_app_header_dark_color"` + VerificationParameters *BotVerificationParameters `json:"verification_parameters"` + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + CanManageEmojiStatus bool `json:"can_manage_emoji_status"` + HasMediaPreviews bool `json:"has_media_previews"` EditCommandsLink json.RawMessage `json:"edit_commands_link"` EditDescriptionLink json.RawMessage `json:"edit_description_link"` EditDescriptionMediaLink json.RawMessage `json:"edit_description_media_link"` @@ -6681,8 +15313,18 @@ func (botInfo *BotInfo) UnmarshalJSON(data []byte) error { botInfo.Animation = tmp.Animation botInfo.MenuButton = tmp.MenuButton botInfo.Commands = tmp.Commands + 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 + botInfo.WebAppHeaderDarkColor = tmp.WebAppHeaderDarkColor + botInfo.VerificationParameters = tmp.VerificationParameters + botInfo.CanGetRevenueStatistics = tmp.CanGetRevenueStatistics + botInfo.CanManageEmojiStatus = tmp.CanManageEmojiStatus + botInfo.HasMediaPreviews = tmp.HasMediaPreviews fieldEditCommandsLink, _ := UnmarshalInternalLinkType(tmp.EditCommandsLink) botInfo.EditCommandsLink = fieldEditCommandsLink @@ -6720,16 +15362,46 @@ type UserFullInfo struct { HasPrivateForwards bool `json:"has_private_forwards"` // True, if voice and video notes can't be sent or forwarded to the user HasRestrictedVoiceAndVideoNoteMessages bool `json:"has_restricted_voice_and_video_note_messages"` - // True, if the user has pinned stories - HasPinnedStories bool `json:"has_pinned_stories"` + // True, if the user has posted to profile stories + HasPostedToProfileStories bool `json:"has_posted_to_profile_stories"` + // True, if the user always enabled sponsored messages; known only for the current user + HasSponsoredMessagesEnabled bool `json:"has_sponsored_messages_enabled"` // True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used NeedPhoneNumberPrivacyException bool `json:"need_phone_number_privacy_exception"` + // True, if the user set chat background for both chat users and it wasn't reverted yet + SetChatBackground bool `json:"set_chat_background"` // A short user bio; may be null for bots Bio *FormattedText `json:"bio"` - // The list of available options for gifting Telegram Premium to the user - PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` + // Birthdate of the user; may be null if unknown + Birthdate *Birthdate `json:"birthdate"` + // Identifier of the personal chat of the user; 0 if none + PersonalChatId int64 `json:"personal_chat_id"` + // Number of saved to profile gifts for other users or the total number of received gifts for the current user + GiftCount int32 `json:"gift_count"` // Number of group chats where both the other user and the current user are a member; 0 for the current user GroupInCommonCount int32 `json:"group_in_common_count"` + // Number of Telegram Stars that must be paid by the user for each sent message to the current user + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` + // Number of Telegram Stars that must be paid by the current user for each sent message to the user + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` + // Settings for gift receiving for the user + GiftSettings *GiftSettings `json:"gift_settings"` + // Information about verification status of the user provided by a bot; may be null if none or unknown + BotVerification *BotVerification `json:"bot_verification"` + // The main tab chosen by the user; may be null if not chosen manually + MainProfileTab ProfileTab `json:"main_profile_tab"` + // The first audio file added to the user's profile; may be null if none + FirstProfileAudio *Audio `json:"first_profile_audio"` + // The current rating of the user; may be null if none + Rating *UserRating `json:"rating"` + // The rating of the user after the next change; may be null if the user isn't the current user or there are no pending rating changes + PendingRating *UserRating `json:"pending_rating"` + // Unix timestamp when rating of the user will change to pending_rating; 0 if the user isn't the current user or there are no pending rating changes + PendingRatingDate int32 `json:"pending_rating_date"` + // Note added to the user's contact; may be null if none + Note *FormattedText `json:"note"` + // Information about business settings for Telegram Business accounts; may be null if none + BusinessInfo *BusinessInfo `json:"business_info"` // For bots, information about the bot; may be null if the user isn't a bot BotInfo *BotInfo `json:"bot_info"` } @@ -6761,11 +15433,26 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { HasPrivateCalls bool `json:"has_private_calls"` HasPrivateForwards bool `json:"has_private_forwards"` HasRestrictedVoiceAndVideoNoteMessages bool `json:"has_restricted_voice_and_video_note_messages"` - HasPinnedStories bool `json:"has_pinned_stories"` + HasPostedToProfileStories bool `json:"has_posted_to_profile_stories"` + HasSponsoredMessagesEnabled bool `json:"has_sponsored_messages_enabled"` NeedPhoneNumberPrivacyException bool `json:"need_phone_number_privacy_exception"` + SetChatBackground bool `json:"set_chat_background"` Bio *FormattedText `json:"bio"` - PremiumGiftOptions []*PremiumPaymentOption `json:"premium_gift_options"` + Birthdate *Birthdate `json:"birthdate"` + PersonalChatId int64 `json:"personal_chat_id"` + GiftCount int32 `json:"gift_count"` GroupInCommonCount int32 `json:"group_in_common_count"` + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` + GiftSettings *GiftSettings `json:"gift_settings"` + BotVerification *BotVerification `json:"bot_verification"` + MainProfileTab json.RawMessage `json:"main_profile_tab"` + FirstProfileAudio *Audio `json:"first_profile_audio"` + Rating *UserRating `json:"rating"` + PendingRating *UserRating `json:"pending_rating"` + PendingRatingDate int32 `json:"pending_rating_date"` + Note *FormattedText `json:"note"` + BusinessInfo *BusinessInfo `json:"business_info"` BotInfo *BotInfo `json:"bot_info"` } @@ -6782,16 +15469,33 @@ func (userFullInfo *UserFullInfo) UnmarshalJSON(data []byte) error { userFullInfo.HasPrivateCalls = tmp.HasPrivateCalls userFullInfo.HasPrivateForwards = tmp.HasPrivateForwards userFullInfo.HasRestrictedVoiceAndVideoNoteMessages = tmp.HasRestrictedVoiceAndVideoNoteMessages - userFullInfo.HasPinnedStories = tmp.HasPinnedStories + userFullInfo.HasPostedToProfileStories = tmp.HasPostedToProfileStories + userFullInfo.HasSponsoredMessagesEnabled = tmp.HasSponsoredMessagesEnabled userFullInfo.NeedPhoneNumberPrivacyException = tmp.NeedPhoneNumberPrivacyException + userFullInfo.SetChatBackground = tmp.SetChatBackground userFullInfo.Bio = tmp.Bio - userFullInfo.PremiumGiftOptions = tmp.PremiumGiftOptions + userFullInfo.Birthdate = tmp.Birthdate + userFullInfo.PersonalChatId = tmp.PersonalChatId + userFullInfo.GiftCount = tmp.GiftCount userFullInfo.GroupInCommonCount = tmp.GroupInCommonCount + userFullInfo.IncomingPaidMessageStarCount = tmp.IncomingPaidMessageStarCount + userFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount + userFullInfo.GiftSettings = tmp.GiftSettings + userFullInfo.BotVerification = tmp.BotVerification + userFullInfo.FirstProfileAudio = tmp.FirstProfileAudio + userFullInfo.Rating = tmp.Rating + userFullInfo.PendingRating = tmp.PendingRating + userFullInfo.PendingRatingDate = tmp.PendingRatingDate + userFullInfo.Note = tmp.Note + userFullInfo.BusinessInfo = tmp.BusinessInfo userFullInfo.BotInfo = tmp.BotInfo fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) userFullInfo.BlockList = fieldBlockList + fieldMainProfileTab, _ := UnmarshalProfileTab(tmp.MainProfileTab) + userFullInfo.MainProfileTab = fieldMainProfileTab + return nil } @@ -6820,6 +15524,31 @@ func (*Users) GetType() string { return TypeUsers } +// Represents a list of found users +type FoundUsers struct { + meta + // Identifiers of the found users + UserIds []int64 `json:"user_ids"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *FoundUsers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundUsers + + return json.Marshal((*stub)(entity)) +} + +func (*FoundUsers) GetClass() string { + return ClassFoundUsers +} + +func (*FoundUsers) GetType() string { + return TypeFoundUsers +} + // Contains information about a chat administrator type ChatAdministrator struct { meta @@ -6873,7 +15602,7 @@ func (*ChatAdministrators) GetType() string { // The user is the owner of the chat and has all the administrator privileges type ChatMemberStatusCreator struct { meta - // A custom title of the owner; 0-16 characters without emojis; applicable to supergroups only + // A custom title of the owner; 0-16 characters without emoji; applicable to supergroups only CustomTitle string `json:"custom_title"` // True, if the creator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only IsAnonymous bool `json:"is_anonymous"` @@ -6904,7 +15633,7 @@ func (*ChatMemberStatusCreator) ChatMemberStatusType() string { // The user is a member of the chat and has some additional privileges. In basic groups, administrators can edit and delete messages sent by others, add new members, ban unprivileged members, and manage video chats. In supergroups and channels, there are more detailed options for administrator privileges type ChatMemberStatusAdministrator struct { meta - // A custom title of the administrator; 0-16 characters without emojis; applicable to supergroups only + // A custom title of the administrator; 0-16 characters without emoji; applicable to supergroups only CustomTitle string `json:"custom_title"` // True, if the current user can edit the administrator privileges for the called user CanBeEdited bool `json:"can_be_edited"` @@ -6933,8 +15662,10 @@ func (*ChatMemberStatusAdministrator) ChatMemberStatusType() string { } // The user is a member of the chat, without any additional privileges or restrictions -type ChatMemberStatusMember struct{ +type ChatMemberStatusMember struct { meta + // Point in time (Unix timestamp) when the user will be removed from the chat because of the expired subscription; 0 if never. Ignored in setChatMemberStatus + MemberUntilDate int32 `json:"member_until_date"` } func (entity *ChatMemberStatusMember) MarshalJSON() ([]byte, error) { @@ -7045,7 +15776,7 @@ type ChatMember struct { meta // Identifier of the chat member. Currently, other chats can be only Left or Banned. Only supergroups and channels can have other chats as Left or Banned members and these chats must be supergroups or channels MemberId MessageSender `json:"member_id"` - // Identifier of a user that invited/promoted/banned this member in the chat; 0 if unknown + // Identifier of a user who invited/promoted/banned this member in the chat; 0 if unknown InviterUserId int64 `json:"inviter_user_id"` // Point in time (Unix timestamp) when the user joined/was promoted/was banned in the chat JoinedChatDate int32 `json:"joined_chat_date"` @@ -7197,8 +15928,8 @@ func (*ChatMembersFilterMembers) ChatMembersFilterType() string { // Returns users which can be mentioned in the chat type ChatMembersFilterMention struct { meta - // If non-zero, the identifier of the current message thread - MessageThreadId int64 `json:"message_thread_id"` + // Identifier of the topic in which the users will be mentioned; pass null if none + TopicId MessageTopic `json:"topic_id"` } func (entity *ChatMembersFilterMention) MarshalJSON() ([]byte, error) { @@ -7221,6 +15952,22 @@ func (*ChatMembersFilterMention) ChatMembersFilterType() string { return TypeChatMembersFilterMention } +func (chatMembersFilterMention *ChatMembersFilterMention) UnmarshalJSON(data []byte) error { + var tmp struct { + TopicId json.RawMessage `json:"topic_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + chatMembersFilterMention.TopicId = fieldTopicId + + return nil +} + // Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup type ChatMembersFilterRestricted struct{ meta @@ -7459,8 +16206,8 @@ type SupergroupMembersFilterMention struct { meta // Query to search for Query string `json:"query"` - // If non-zero, the identifier of the current message thread - MessageThreadId int64 `json:"message_thread_id"` + // Identifier of the topic in which the users will be mentioned; pass null if none + TopicId MessageTopic `json:"topic_id"` } func (entity *SupergroupMembersFilterMention) MarshalJSON() ([]byte, error) { @@ -7483,6 +16230,25 @@ func (*SupergroupMembersFilterMention) SupergroupMembersFilterType() string { return TypeSupergroupMembersFilterMention } +func (supergroupMembersFilterMention *SupergroupMembersFilterMention) UnmarshalJSON(data []byte) error { + var tmp struct { + Query string `json:"query"` + TopicId json.RawMessage `json:"topic_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + supergroupMembersFilterMention.Query = tmp.Query + + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + supergroupMembersFilterMention.TopicId = fieldTopicId + + return nil +} + // Returns bot members of the supergroup or channel type SupergroupMembersFilterBots struct{ meta @@ -7523,10 +16289,14 @@ type ChatInviteLink struct { EditDate int32 `json:"edit_date"` // Point in time (Unix timestamp) when the link will expire; 0 if never ExpirationDate int32 `json:"expiration_date"` + // Information about subscription plan that is applied to the users joining the chat by the link; may be null if the link doesn't require subscription + SubscriptionPricing *StarSubscriptionPricing `json:"subscription_pricing"` // The maximum number of members, which can join the chat using the link simultaneously; 0 if not limited. Always 0 if the link requires approval MemberLimit int32 `json:"member_limit"` // Number of chat members, which joined the chat using the link MemberCount int32 `json:"member_count"` + // Number of chat members, which joined the chat using the link, but have already left because of expired subscription; for subscription links only + ExpiredMemberCount int32 `json:"expired_member_count"` // Number of pending join requests created using this link PendingJoinRequestCount int32 `json:"pending_join_request_count"` // True, if the link only creates join request. If true, total number of joining members will be unlimited @@ -7757,6 +16527,33 @@ func (*InviteLinkChatTypeChannel) InviteLinkChatTypeType() string { return TypeInviteLinkChatTypeChannel } +// Contains information about subscription plan that must be paid by the user to use a chat invite link +type ChatInviteLinkSubscriptionInfo struct { + meta + // Information about subscription plan that must be paid by the user to use the link + Pricing *StarSubscriptionPricing `json:"pricing"` + // True, if the user has already paid for the subscription and can use joinChatByInviteLink to join the subscribed chat again + CanReuse bool `json:"can_reuse"` + // Identifier of the payment form to use for subscription payment; 0 if the subscription can't be paid + FormId JsonInt64 `json:"form_id"` +} + +func (entity *ChatInviteLinkSubscriptionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatInviteLinkSubscriptionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatInviteLinkSubscriptionInfo) GetClass() string { + return ClassChatInviteLinkSubscriptionInfo +} + +func (*ChatInviteLinkSubscriptionInfo) GetType() string { + return TypeChatInviteLinkSubscriptionInfo +} + // Contains information about a chat invite link type ChatInviteLinkInfo struct { meta @@ -7778,16 +16575,14 @@ type ChatInviteLinkInfo struct { MemberCount int32 `json:"member_count"` // User identifiers of some chat members that may be known to the current user MemberUserIds []int64 `json:"member_user_ids"` + // Information about subscription plan that must be paid by the user to use the link; may be null if the link doesn't require subscription + SubscriptionInfo *ChatInviteLinkSubscriptionInfo `json:"subscription_info"` // True, if the link only creates join request CreatesJoinRequest bool `json:"creates_join_request"` // True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup IsPublic bool `json:"is_public"` - // True, if the chat is verified - IsVerified bool `json:"is_verified"` - // True, if many users reported this chat as a scam - IsScam bool `json:"is_scam"` - // True, if many users reported this chat as a fake account - IsFake bool `json:"is_fake"` + // Information about verification status of the chat; may be null if none + VerificationStatus *VerificationStatus `json:"verification_status"` } func (entity *ChatInviteLinkInfo) MarshalJSON() ([]byte, error) { @@ -7817,11 +16612,10 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { Description string `json:"description"` MemberCount int32 `json:"member_count"` MemberUserIds []int64 `json:"member_user_ids"` + SubscriptionInfo *ChatInviteLinkSubscriptionInfo `json:"subscription_info"` CreatesJoinRequest bool `json:"creates_join_request"` IsPublic bool `json:"is_public"` - IsVerified bool `json:"is_verified"` - IsScam bool `json:"is_scam"` - IsFake bool `json:"is_fake"` + VerificationStatus *VerificationStatus `json:"verification_status"` } err := json.Unmarshal(data, &tmp) @@ -7837,11 +16631,10 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { chatInviteLinkInfo.Description = tmp.Description chatInviteLinkInfo.MemberCount = tmp.MemberCount chatInviteLinkInfo.MemberUserIds = tmp.MemberUserIds + chatInviteLinkInfo.SubscriptionInfo = tmp.SubscriptionInfo chatInviteLinkInfo.CreatesJoinRequest = tmp.CreatesJoinRequest chatInviteLinkInfo.IsPublic = tmp.IsPublic - chatInviteLinkInfo.IsVerified = tmp.IsVerified - chatInviteLinkInfo.IsScam = tmp.IsScam - chatInviteLinkInfo.IsFake = tmp.IsFake + chatInviteLinkInfo.VerificationStatus = tmp.VerificationStatus fieldType, _ := UnmarshalInviteLinkChatType(tmp.Type) chatInviteLinkInfo.Type = fieldType @@ -7849,7 +16642,7 @@ func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { return nil } -// Describes a user that sent a join request and waits for administrator approval +// Describes a user who sent a join request and waits for administrator approval type ChatJoinRequest struct { meta // User identifier @@ -7931,8 +16724,6 @@ type BasicGroup struct { meta // Group identifier Id int64 `json:"id"` - // Group access hash - AccessHash JsonInt64 `json:"access_hash"` // Number of members in the group MemberCount int32 `json:"member_count"` // Status of the current user in the group @@ -7962,7 +16753,6 @@ func (*BasicGroup) GetType() string { func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { var tmp struct { Id int64 `json:"id"` - AccessHash JsonInt64 `json:"access_hash"` MemberCount int32 `json:"member_count"` Status json.RawMessage `json:"status"` IsActive bool `json:"is_active"` @@ -7975,7 +16765,6 @@ func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { } basicGroup.Id = tmp.Id - basicGroup.AccessHash = tmp.AccessHash basicGroup.MemberCount = tmp.MemberCount basicGroup.IsActive = tmp.IsActive basicGroup.UpgradedToSupergroupId = tmp.UpgradedToSupergroupId @@ -8036,17 +16825,23 @@ type Supergroup struct { Date int32 `json:"date"` // Status of the current user in the supergroup or channel; custom title will always be empty Status ChatMemberStatus `json:"status"` - // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through searchPublicChats, searchChatsNearby, getInactiveSupergroupChats, getSuitableDiscussionChats, getGroupsInCommon, getUserPrivacySettingRules, or in chatFolderInviteLinkInfo.missing_chat_ids + // Number of members in the supergroup or channel; 0 if unknown. Currently, it is guaranteed to be known only if the supergroup or channel was received through getChatSimilarChats, getChatsToPostStories, getCreatedPublicChats, getGroupsInCommon, getInactiveSupergroupChats, getRecommendedChats, getSuitableDiscussionChats, getUserPrivacySettingRules, getVideoChatAvailableParticipants, searchPublicChats, or in chatFolderInviteLinkInfo.missing_chat_ids, or in userFullInfo.personal_chat_id, or for chats with messages or stories from publicForwards and foundStories MemberCount int32 `json:"member_count"` + // Approximate boost level for the chat + BoostLevel int32 `json:"boost_level"` + // True, if automatic translation of messages is enabled in the channel + HasAutomaticTranslation bool `json:"has_automatic_translation"` // True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel HasLinkedChat bool `json:"has_linked_chat"` // True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup HasLocation bool `json:"has_location"` - // True, if messages sent to the channel need to contain information about the sender. This field is only applicable to channels + // True, if messages sent to the channel contains name of the sender. This field is only applicable to channels SignMessages bool `json:"sign_messages"` - // True, if users need to join the supergroup before they can send messages. Always true for channels and non-discussion supergroups + // True, if messages sent to the channel have information about the sender user. This field is only applicable to channels + ShowMessageSender bool `json:"show_message_sender"` + // True, if users need to join the supergroup before they can send messages. May be false only for discussion supergroups and channel direct messages groups JoinToSendMessages bool `json:"join_to_send_messages"` - // True, if all users directly joining the supergroup need to be approved by supergroup administrators. Always false for channels and supergroups without username, location, or a linked chat + // True, if all users directly joining the supergroup need to be approved by supergroup administrators. May be true only for non-broadcast supergroups with username, location, or a linked chat JoinByRequest bool `json:"join_by_request"` // True, if the slow mode is enabled in the supergroup IsSlowModeEnabled bool `json:"is_slow_mode_enabled"` @@ -8054,20 +16849,24 @@ type Supergroup struct { IsChannel bool `json:"is_channel"` // True, if the supergroup is a broadcast group, i.e. only administrators can send messages and there is no limit on the number of members IsBroadcastGroup bool `json:"is_broadcast_group"` - // True, if the supergroup must be shown as a forum by default + // True, if the supergroup is a forum with topics IsForum bool `json:"is_forum"` - // True, if the supergroup or channel is verified - IsVerified bool `json:"is_verified"` - // If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted - RestrictionReason string `json:"restriction_reason"` - // True, if many users reported this supergroup or channel as a scam - IsScam bool `json:"is_scam"` - // True, if many users reported this supergroup or channel as a fake account - IsFake bool `json:"is_fake"` - // True, if the channel has non-expired stories available to the current user - HasActiveStories bool `json:"has_active_stories"` - // True, if the channel has unread non-expired stories available to the current user - HasUnreadActiveStories bool `json:"has_unread_active_stories"` + // True, if the supergroup is a direct message group for a channel chat + IsDirectMessagesGroup bool `json:"is_direct_messages_group"` + // True, if the supergroup is a direct messages group for a channel chat that is administered by the current user + IsAdministeredDirectMessagesGroup bool `json:"is_administered_direct_messages_group"` + // Information about verification status of the supergroup or channel; may be null if none + VerificationStatus *VerificationStatus `json:"verification_status"` + // True, if the channel has direct messages group + HasDirectMessagesGroup bool `json:"has_direct_messages_group"` + // True, if the supergroup is a forum, which topics are shown in the same way as in channel direct messages groups + HasForumTabs bool `json:"has_forum_tabs"` + // Information about the restrictions that must be applied to the corresponding supergroup or channel chat; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` + // Number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message + PaidMessageStarCount int64 `json:"paid_message_star_count"` + // State of active stories of the supergroup or channel; may be null if there are no active stories + ActiveStoryState ActiveStoryState `json:"active_story_state"` } func (entity *Supergroup) MarshalJSON() ([]byte, error) { @@ -8094,21 +16893,26 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { Date int32 `json:"date"` Status json.RawMessage `json:"status"` MemberCount int32 `json:"member_count"` + BoostLevel int32 `json:"boost_level"` + HasAutomaticTranslation bool `json:"has_automatic_translation"` HasLinkedChat bool `json:"has_linked_chat"` HasLocation bool `json:"has_location"` SignMessages bool `json:"sign_messages"` + ShowMessageSender bool `json:"show_message_sender"` JoinToSendMessages bool `json:"join_to_send_messages"` JoinByRequest bool `json:"join_by_request"` IsSlowModeEnabled bool `json:"is_slow_mode_enabled"` IsChannel bool `json:"is_channel"` IsBroadcastGroup bool `json:"is_broadcast_group"` IsForum bool `json:"is_forum"` - IsVerified bool `json:"is_verified"` - RestrictionReason string `json:"restriction_reason"` - IsScam bool `json:"is_scam"` - IsFake bool `json:"is_fake"` - HasActiveStories bool `json:"has_active_stories"` - HasUnreadActiveStories bool `json:"has_unread_active_stories"` + IsDirectMessagesGroup bool `json:"is_direct_messages_group"` + IsAdministeredDirectMessagesGroup bool `json:"is_administered_direct_messages_group"` + VerificationStatus *VerificationStatus `json:"verification_status"` + HasDirectMessagesGroup bool `json:"has_direct_messages_group"` + HasForumTabs bool `json:"has_forum_tabs"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` + ActiveStoryState json.RawMessage `json:"active_story_state"` } err := json.Unmarshal(data, &tmp) @@ -8121,25 +16925,32 @@ func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { supergroup.Usernames = tmp.Usernames supergroup.Date = tmp.Date supergroup.MemberCount = tmp.MemberCount + supergroup.BoostLevel = tmp.BoostLevel + supergroup.HasAutomaticTranslation = tmp.HasAutomaticTranslation supergroup.HasLinkedChat = tmp.HasLinkedChat supergroup.HasLocation = tmp.HasLocation supergroup.SignMessages = tmp.SignMessages + supergroup.ShowMessageSender = tmp.ShowMessageSender supergroup.JoinToSendMessages = tmp.JoinToSendMessages supergroup.JoinByRequest = tmp.JoinByRequest supergroup.IsSlowModeEnabled = tmp.IsSlowModeEnabled supergroup.IsChannel = tmp.IsChannel supergroup.IsBroadcastGroup = tmp.IsBroadcastGroup supergroup.IsForum = tmp.IsForum - supergroup.IsVerified = tmp.IsVerified - supergroup.RestrictionReason = tmp.RestrictionReason - supergroup.IsScam = tmp.IsScam - supergroup.IsFake = tmp.IsFake - supergroup.HasActiveStories = tmp.HasActiveStories - supergroup.HasUnreadActiveStories = tmp.HasUnreadActiveStories + supergroup.IsDirectMessagesGroup = tmp.IsDirectMessagesGroup + supergroup.IsAdministeredDirectMessagesGroup = tmp.IsAdministeredDirectMessagesGroup + supergroup.VerificationStatus = tmp.VerificationStatus + supergroup.HasDirectMessagesGroup = tmp.HasDirectMessagesGroup + supergroup.HasForumTabs = tmp.HasForumTabs + supergroup.RestrictionInfo = tmp.RestrictionInfo + supergroup.PaidMessageStarCount = tmp.PaidMessageStarCount fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) supergroup.Status = fieldStatus + fieldActiveStoryState, _ := UnmarshalActiveStoryState(tmp.ActiveStoryState) + supergroup.ActiveStoryState = fieldActiveStoryState + return nil } @@ -8160,10 +16971,16 @@ type SupergroupFullInfo struct { BannedCount int32 `json:"banned_count"` // Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown LinkedChatId int64 `json:"linked_chat_id"` + // Chat identifier of a direct messages group for the channel, or a channel, for which the supergroup is the designated direct messages group; 0 if none + DirectMessagesChatId int64 `json:"direct_messages_chat_id"` // Delay between consecutive sent messages for non-administrator supergroup members, in seconds SlowModeDelay int32 `json:"slow_mode_delay"` // Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero SlowModeDelayExpiresIn float64 `json:"slow_mode_delay_expires_in"` + // True, if paid messages can be enabled in the supergroup chat; for supergroup only + CanEnablePaidMessages bool `json:"can_enable_paid_messages"` + // True, if paid reaction can be enabled in the channel chat; for channels only + CanEnablePaidReaction bool `json:"can_enable_paid_reaction"` // True, if members of the chat can be retrieved via getSupergroupMembers or searchChatMembers CanGetMembers bool `json:"can_get_members"` // True, if non-administrators can receive only administrators and bots using getSupergroupMembers or searchChatMembers @@ -8176,22 +16993,46 @@ type SupergroupFullInfo struct { CanSetLocation bool `json:"can_set_location"` // True, if the supergroup or channel statistics are available CanGetStatistics bool `json:"can_get_statistics"` + // True, if the supergroup or channel revenue statistics are available + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + // True, if the supergroup or channel Telegram Star revenue statistics are available + CanGetStarRevenueStatistics bool `json:"can_get_star_revenue_statistics"` + // True, if the user can send a gift to the supergroup or channel using sendGift or transferGift + CanSendGift bool `json:"can_send_gift"` // True, if aggressive anti-spam checks can be enabled or disabled in the supergroup CanToggleAggressiveAntiSpam bool `json:"can_toggle_aggressive_anti_spam"` // True, if new chat members will have access to old messages. In public, discussion, of forum groups and all channels, old messages are always available, so this option affects only private non-forum supergroups without a linked chat. The value of this field is only available to chat administrators IsAllHistoryAvailable bool `json:"is_all_history_available"` + // True, if the chat can have sponsored messages. The value of this field is only available to the owner of the chat + CanHaveSponsoredMessages bool `json:"can_have_sponsored_messages"` // True, if aggressive anti-spam checks are enabled in the supergroup. The value of this field is only available to chat administrators HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled"` - // True, if the channel has pinned stories + // True, if paid media can be sent and forwarded to the channel chat; for channels only + HasPaidMediaAllowed bool `json:"has_paid_media_allowed"` + // True, if the supergroup or channel has pinned stories HasPinnedStories bool `json:"has_pinned_stories"` - // Identifier of the supergroup sticker set; 0 if none + // Number of saved to profile gifts for channels without can_post_messages administrator right, otherwise, the total number of received gifts + GiftCount int32 `json:"gift_count"` + // Number of times the current user boosted the supergroup or channel + MyBoostCount int32 `json:"my_boost_count"` + // Number of times the supergroup must be boosted by a user to ignore slow mode and chat permission restrictions; 0 if unspecified + UnrestrictBoostCount int32 `json:"unrestrict_boost_count"` + // Number of Telegram Stars that must be paid by the current user for each sent message to the supergroup + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` + // Identifier of the supergroup sticker set that must be shown before user sticker sets; 0 if none StickerSetId JsonInt64 `json:"sticker_set_id"` + // Identifier of the custom emoji sticker set that can be used in the supergroup without Telegram Premium subscription; 0 if none + CustomEmojiStickerSetId JsonInt64 `json:"custom_emoji_sticker_set_id"` // Location to which the supergroup is connected; may be null if none Location *ChatLocation `json:"location"` // Primary invite link for the chat; may be null. For chat administrators with can_invite_users right only InviteLink *ChatInviteLink `json:"invite_link"` // List of commands of bots in the group BotCommands []*BotCommands `json:"bot_commands"` + // Information about verification status of the supergroup or the channel provided by a bot; may be null if none or unknown + BotVerification *BotVerification `json:"bot_verification"` + // The main tab chosen by the administrators of the channel; may be null if not chosen manually + MainProfileTab ProfileTab `json:"main_profile_tab"` // Identifier of the basic group from which supergroup was upgraded; 0 if none UpgradedFromBasicGroupId int64 `json:"upgraded_from_basic_group_id"` // Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none @@ -8214,6 +17055,101 @@ func (*SupergroupFullInfo) GetType() string { return TypeSupergroupFullInfo } +func (supergroupFullInfo *SupergroupFullInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Photo *ChatPhoto `json:"photo"` + Description string `json:"description"` + MemberCount int32 `json:"member_count"` + AdministratorCount int32 `json:"administrator_count"` + RestrictedCount int32 `json:"restricted_count"` + BannedCount int32 `json:"banned_count"` + LinkedChatId int64 `json:"linked_chat_id"` + DirectMessagesChatId int64 `json:"direct_messages_chat_id"` + SlowModeDelay int32 `json:"slow_mode_delay"` + SlowModeDelayExpiresIn float64 `json:"slow_mode_delay_expires_in"` + CanEnablePaidMessages bool `json:"can_enable_paid_messages"` + CanEnablePaidReaction bool `json:"can_enable_paid_reaction"` + CanGetMembers bool `json:"can_get_members"` + HasHiddenMembers bool `json:"has_hidden_members"` + CanHideMembers bool `json:"can_hide_members"` + CanSetStickerSet bool `json:"can_set_sticker_set"` + CanSetLocation bool `json:"can_set_location"` + CanGetStatistics bool `json:"can_get_statistics"` + CanGetRevenueStatistics bool `json:"can_get_revenue_statistics"` + CanGetStarRevenueStatistics bool `json:"can_get_star_revenue_statistics"` + CanSendGift bool `json:"can_send_gift"` + CanToggleAggressiveAntiSpam bool `json:"can_toggle_aggressive_anti_spam"` + IsAllHistoryAvailable bool `json:"is_all_history_available"` + CanHaveSponsoredMessages bool `json:"can_have_sponsored_messages"` + HasAggressiveAntiSpamEnabled bool `json:"has_aggressive_anti_spam_enabled"` + HasPaidMediaAllowed bool `json:"has_paid_media_allowed"` + HasPinnedStories bool `json:"has_pinned_stories"` + GiftCount int32 `json:"gift_count"` + MyBoostCount int32 `json:"my_boost_count"` + UnrestrictBoostCount int32 `json:"unrestrict_boost_count"` + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` + StickerSetId JsonInt64 `json:"sticker_set_id"` + CustomEmojiStickerSetId JsonInt64 `json:"custom_emoji_sticker_set_id"` + Location *ChatLocation `json:"location"` + InviteLink *ChatInviteLink `json:"invite_link"` + BotCommands []*BotCommands `json:"bot_commands"` + BotVerification *BotVerification `json:"bot_verification"` + MainProfileTab json.RawMessage `json:"main_profile_tab"` + UpgradedFromBasicGroupId int64 `json:"upgraded_from_basic_group_id"` + UpgradedFromMaxMessageId int64 `json:"upgraded_from_max_message_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + supergroupFullInfo.Photo = tmp.Photo + supergroupFullInfo.Description = tmp.Description + supergroupFullInfo.MemberCount = tmp.MemberCount + supergroupFullInfo.AdministratorCount = tmp.AdministratorCount + supergroupFullInfo.RestrictedCount = tmp.RestrictedCount + supergroupFullInfo.BannedCount = tmp.BannedCount + supergroupFullInfo.LinkedChatId = tmp.LinkedChatId + supergroupFullInfo.DirectMessagesChatId = tmp.DirectMessagesChatId + supergroupFullInfo.SlowModeDelay = tmp.SlowModeDelay + supergroupFullInfo.SlowModeDelayExpiresIn = tmp.SlowModeDelayExpiresIn + supergroupFullInfo.CanEnablePaidMessages = tmp.CanEnablePaidMessages + supergroupFullInfo.CanEnablePaidReaction = tmp.CanEnablePaidReaction + supergroupFullInfo.CanGetMembers = tmp.CanGetMembers + supergroupFullInfo.HasHiddenMembers = tmp.HasHiddenMembers + supergroupFullInfo.CanHideMembers = tmp.CanHideMembers + supergroupFullInfo.CanSetStickerSet = tmp.CanSetStickerSet + supergroupFullInfo.CanSetLocation = tmp.CanSetLocation + supergroupFullInfo.CanGetStatistics = tmp.CanGetStatistics + supergroupFullInfo.CanGetRevenueStatistics = tmp.CanGetRevenueStatistics + supergroupFullInfo.CanGetStarRevenueStatistics = tmp.CanGetStarRevenueStatistics + supergroupFullInfo.CanSendGift = tmp.CanSendGift + supergroupFullInfo.CanToggleAggressiveAntiSpam = tmp.CanToggleAggressiveAntiSpam + supergroupFullInfo.IsAllHistoryAvailable = tmp.IsAllHistoryAvailable + supergroupFullInfo.CanHaveSponsoredMessages = tmp.CanHaveSponsoredMessages + supergroupFullInfo.HasAggressiveAntiSpamEnabled = tmp.HasAggressiveAntiSpamEnabled + supergroupFullInfo.HasPaidMediaAllowed = tmp.HasPaidMediaAllowed + supergroupFullInfo.HasPinnedStories = tmp.HasPinnedStories + supergroupFullInfo.GiftCount = tmp.GiftCount + supergroupFullInfo.MyBoostCount = tmp.MyBoostCount + supergroupFullInfo.UnrestrictBoostCount = tmp.UnrestrictBoostCount + supergroupFullInfo.OutgoingPaidMessageStarCount = tmp.OutgoingPaidMessageStarCount + supergroupFullInfo.StickerSetId = tmp.StickerSetId + supergroupFullInfo.CustomEmojiStickerSetId = tmp.CustomEmojiStickerSetId + supergroupFullInfo.Location = tmp.Location + supergroupFullInfo.InviteLink = tmp.InviteLink + supergroupFullInfo.BotCommands = tmp.BotCommands + supergroupFullInfo.BotVerification = tmp.BotVerification + supergroupFullInfo.UpgradedFromBasicGroupId = tmp.UpgradedFromBasicGroupId + supergroupFullInfo.UpgradedFromMaxMessageId = tmp.UpgradedFromMaxMessageId + + fieldMainProfileTab, _ := UnmarshalProfileTab(tmp.MainProfileTab) + supergroupFullInfo.MainProfileTab = fieldMainProfileTab + + return nil +} + // The secret chat is not yet created; waiting for the other user to get online type SecretChatStatePending struct{ meta @@ -8349,10 +17285,41 @@ func (secretChat *SecretChat) UnmarshalJSON(data []byte) error { return nil } +// Contains information about public post search limits +type PublicPostSearchLimits struct { + meta + // Number of queries that can be sent daily for free + DailyFreeQueryCount int32 `json:"daily_free_query_count"` + // Number of remaining free queries today + RemainingFreeQueryCount int32 `json:"remaining_free_query_count"` + // Amount of time till the next free query can be sent; 0 if it can be sent now + NextFreeQueryIn int32 `json:"next_free_query_in"` + // Number of Telegram Stars that must be paid for each non-free query + StarCount int64 `json:"star_count"` + // True, if the search for the specified query isn't charged + IsCurrentQueryFree bool `json:"is_current_query_free"` +} + +func (entity *PublicPostSearchLimits) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicPostSearchLimits + + return json.Marshal((*stub)(entity)) +} + +func (*PublicPostSearchLimits) GetClass() string { + return ClassPublicPostSearchLimits +} + +func (*PublicPostSearchLimits) GetType() string { + return TypePublicPostSearchLimits +} + // The message was sent by a known user type MessageSenderUser struct { meta - // Identifier of the user that sent the message + // Identifier of the user who sent the message UserId int64 `json:"user_id"` } @@ -8450,7 +17417,7 @@ func (messageSenders *MessageSenders) UnmarshalJSON(data []byte) error { // Represents a message sender, which can be used to send messages in a chat type ChatMessageSender struct { meta - // Available message senders + // The message sender Sender MessageSender `json:"sender"` // True, if Telegram Premium is needed to use the message sender NeedsPremium bool `json:"needs_premium"` @@ -8514,6 +17481,133 @@ func (*ChatMessageSenders) GetType() string { return TypeChatMessageSenders } +// Contains read date of the message +type MessageReadDateRead struct { + meta + // Point in time (Unix timestamp) when the message was read by the other user + ReadDate int32 `json:"read_date"` +} + +func (entity *MessageReadDateRead) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReadDateRead + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReadDateRead) GetClass() string { + return ClassMessageReadDate +} + +func (*MessageReadDateRead) GetType() string { + return TypeMessageReadDateRead +} + +func (*MessageReadDateRead) MessageReadDateType() string { + return TypeMessageReadDateRead +} + +// The message is unread yet +type MessageReadDateUnread struct{ + meta +} + +func (entity *MessageReadDateUnread) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReadDateUnread + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReadDateUnread) GetClass() string { + return ClassMessageReadDate +} + +func (*MessageReadDateUnread) GetType() string { + return TypeMessageReadDateUnread +} + +func (*MessageReadDateUnread) MessageReadDateType() string { + return TypeMessageReadDateUnread +} + +// The message is too old to get read date +type MessageReadDateTooOld struct{ + meta +} + +func (entity *MessageReadDateTooOld) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReadDateTooOld + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReadDateTooOld) GetClass() string { + return ClassMessageReadDate +} + +func (*MessageReadDateTooOld) GetType() string { + return TypeMessageReadDateTooOld +} + +func (*MessageReadDateTooOld) MessageReadDateType() string { + return TypeMessageReadDateTooOld +} + +// The read date is unknown due to privacy settings of the other user +type MessageReadDateUserPrivacyRestricted struct{ + meta +} + +func (entity *MessageReadDateUserPrivacyRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReadDateUserPrivacyRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReadDateUserPrivacyRestricted) GetClass() string { + return ClassMessageReadDate +} + +func (*MessageReadDateUserPrivacyRestricted) GetType() string { + return TypeMessageReadDateUserPrivacyRestricted +} + +func (*MessageReadDateUserPrivacyRestricted) MessageReadDateType() string { + return TypeMessageReadDateUserPrivacyRestricted +} + +// The read date is unknown due to privacy settings of the current user, but will be known if the user subscribes to Telegram Premium +type MessageReadDateMyPrivacyRestricted struct{ + meta +} + +func (entity *MessageReadDateMyPrivacyRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReadDateMyPrivacyRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReadDateMyPrivacyRestricted) GetClass() string { + return ClassMessageReadDate +} + +func (*MessageReadDateMyPrivacyRestricted) GetType() string { + return TypeMessageReadDateMyPrivacyRestricted +} + +func (*MessageReadDateMyPrivacyRestricted) MessageReadDateType() string { + return TypeMessageReadDateMyPrivacyRestricted +} + // Represents a viewer of a message type MessageViewer struct { meta @@ -8565,7 +17659,7 @@ func (*MessageViewers) GetType() string { // The message was originally sent by a known user type MessageOriginUser struct { meta - // Identifier of the user that originally sent the message + // Identifier of the user who originally sent the message SenderUserId int64 `json:"sender_user_id"` } @@ -8676,6 +17770,66 @@ func (*MessageOriginChannel) MessageOriginType() string { return TypeMessageOriginChannel } +// Contains information about the last message from which a new message was forwarded last time +type ForwardSource struct { + meta + // Identifier of the chat to which the message that was forwarded belonged; may be 0 if unknown + ChatId int64 `json:"chat_id"` + // Identifier of the message; may be 0 if unknown + MessageId int64 `json:"message_id"` + // Identifier of the sender of the message; may be null if unknown or the new message was forwarded not to Saved Messages + SenderId MessageSender `json:"sender_id"` + // Name of the sender of the message if the sender is hidden by their privacy settings + SenderName string `json:"sender_name"` + // Point in time (Unix timestamp) when the message is sent; 0 if unknown + Date int32 `json:"date"` + // True, if the message that was forwarded is outgoing; always false if sender is unknown + IsOutgoing bool `json:"is_outgoing"` +} + +func (entity *ForwardSource) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ForwardSource + + return json.Marshal((*stub)(entity)) +} + +func (*ForwardSource) GetClass() string { + return ClassForwardSource +} + +func (*ForwardSource) GetType() string { + return TypeForwardSource +} + +func (forwardSource *ForwardSource) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + MessageId int64 `json:"message_id"` + SenderId json.RawMessage `json:"sender_id"` + SenderName string `json:"sender_name"` + Date int32 `json:"date"` + IsOutgoing bool `json:"is_outgoing"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + forwardSource.ChatId = tmp.ChatId + forwardSource.MessageId = tmp.MessageId + forwardSource.SenderName = tmp.SenderName + forwardSource.Date = tmp.Date + forwardSource.IsOutgoing = tmp.IsOutgoing + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + forwardSource.SenderId = fieldSenderId + + return nil +} + // A reaction with an emoji type ReactionTypeEmoji struct { meta @@ -8730,6 +17884,189 @@ func (*ReactionTypeCustomEmoji) ReactionTypeType() string { return TypeReactionTypeCustomEmoji } +// The paid reaction in a channel chat +type ReactionTypePaid struct{ + meta +} + +func (entity *ReactionTypePaid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionTypePaid + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionTypePaid) GetClass() string { + return ClassReactionType +} + +func (*ReactionTypePaid) GetType() string { + return TypeReactionTypePaid +} + +func (*ReactionTypePaid) ReactionTypeType() string { + return TypeReactionTypePaid +} + +// A paid reaction on behalf of the current user +type PaidReactionTypeRegular struct{ + meta +} + +func (entity *PaidReactionTypeRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaidReactionTypeRegular + + return json.Marshal((*stub)(entity)) +} + +func (*PaidReactionTypeRegular) GetClass() string { + return ClassPaidReactionType +} + +func (*PaidReactionTypeRegular) GetType() string { + return TypePaidReactionTypeRegular +} + +func (*PaidReactionTypeRegular) PaidReactionTypeType() string { + return TypePaidReactionTypeRegular +} + +// An anonymous paid reaction +type PaidReactionTypeAnonymous struct{ + meta +} + +func (entity *PaidReactionTypeAnonymous) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaidReactionTypeAnonymous + + return json.Marshal((*stub)(entity)) +} + +func (*PaidReactionTypeAnonymous) GetClass() string { + return ClassPaidReactionType +} + +func (*PaidReactionTypeAnonymous) GetType() string { + return TypePaidReactionTypeAnonymous +} + +func (*PaidReactionTypeAnonymous) PaidReactionTypeType() string { + return TypePaidReactionTypeAnonymous +} + +// A paid reaction on behalf of an owned chat +type PaidReactionTypeChat struct { + meta + // Identifier of the chat + ChatId int64 `json:"chat_id"` +} + +func (entity *PaidReactionTypeChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaidReactionTypeChat + + return json.Marshal((*stub)(entity)) +} + +func (*PaidReactionTypeChat) GetClass() string { + return ClassPaidReactionType +} + +func (*PaidReactionTypeChat) GetType() string { + return TypePaidReactionTypeChat +} + +func (*PaidReactionTypeChat) PaidReactionTypeType() string { + return TypePaidReactionTypeChat +} + +// Contains information about a user who added paid reactions +type PaidReactor struct { + meta + // Identifier of the user or chat that added the reactions; may be null for anonymous reactors that aren't the current user + SenderId MessageSender `json:"sender_id"` + // Number of Telegram Stars added + StarCount int64 `json:"star_count"` + // True, if the reactor is one of the most active reactors; may be false if the reactor is the current user + IsTop bool `json:"is_top"` + // True, if the paid reaction was added by the current user + IsMe bool `json:"is_me"` + // True, if the reactor is anonymous + IsAnonymous bool `json:"is_anonymous"` +} + +func (entity *PaidReactor) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaidReactor + + return json.Marshal((*stub)(entity)) +} + +func (*PaidReactor) GetClass() string { + return ClassPaidReactor +} + +func (*PaidReactor) GetType() string { + return TypePaidReactor +} + +func (paidReactor *PaidReactor) UnmarshalJSON(data []byte) error { + var tmp struct { + SenderId json.RawMessage `json:"sender_id"` + StarCount int64 `json:"star_count"` + IsTop bool `json:"is_top"` + IsMe bool `json:"is_me"` + IsAnonymous bool `json:"is_anonymous"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + paidReactor.StarCount = tmp.StarCount + paidReactor.IsTop = tmp.IsTop + paidReactor.IsMe = tmp.IsMe + paidReactor.IsAnonymous = tmp.IsAnonymous + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + paidReactor.SenderId = fieldSenderId + + return nil +} + +// Contains a list of users and chats that spend most money on paid messages and reactions in a live story +type LiveStoryDonors struct { + meta + // Total amount of spend Telegram Stars + TotalStarCount int64 `json:"total_star_count"` + // List of top donors in the live story + TopDonors []*PaidReactor `json:"top_donors"` +} + +func (entity *LiveStoryDonors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LiveStoryDonors + + return json.Marshal((*stub)(entity)) +} + +func (*LiveStoryDonors) GetClass() string { + return ClassLiveStoryDonors +} + +func (*LiveStoryDonors) GetType() string { + return TypeLiveStoryDonors +} + // Contains information about a forwarded message type MessageForwardInfo struct { meta @@ -8737,12 +18074,10 @@ type MessageForwardInfo struct { Origin MessageOrigin `json:"origin"` // Point in time (Unix timestamp) when the message was originally sent Date int32 `json:"date"` - // The type of a public service announcement for the forwarded message + // For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, information about the source message from which the message was forwarded last time; may be null for other forwards or if unknown + Source *ForwardSource `json:"source"` + // The type of public service announcement for the forwarded message PublicServiceAnnouncementType string `json:"public_service_announcement_type"` - // For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown - FromChatId int64 `json:"from_chat_id"` - // For messages forwarded to the chat with the current user (Saved Messages), to the Replies bot chat, or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown - FromMessageId int64 `json:"from_message_id"` } func (entity *MessageForwardInfo) MarshalJSON() ([]byte, error) { @@ -8765,9 +18100,8 @@ func (messageForwardInfo *MessageForwardInfo) UnmarshalJSON(data []byte) error { var tmp struct { Origin json.RawMessage `json:"origin"` Date int32 `json:"date"` + Source *ForwardSource `json:"source"` PublicServiceAnnouncementType string `json:"public_service_announcement_type"` - FromChatId int64 `json:"from_chat_id"` - FromMessageId int64 `json:"from_message_id"` } err := json.Unmarshal(data, &tmp) @@ -8776,9 +18110,8 @@ func (messageForwardInfo *MessageForwardInfo) UnmarshalJSON(data []byte) error { } messageForwardInfo.Date = tmp.Date + messageForwardInfo.Source = tmp.Source messageForwardInfo.PublicServiceAnnouncementType = tmp.PublicServiceAnnouncementType - messageForwardInfo.FromChatId = tmp.FromChatId - messageForwardInfo.FromMessageId = tmp.FromMessageId fieldOrigin, _ := UnmarshalMessageOrigin(tmp.Origin) messageForwardInfo.Origin = fieldOrigin @@ -8876,7 +18209,7 @@ type MessageReaction struct { TotalCount int32 `json:"total_count"` // True, if the reaction is chosen by the current user IsChosen bool `json:"is_chosen"` - // Identifier of the message sender used by the current user to add the reaction; null if unknown or the reaction isn't chosen + // Identifier of the message sender used by the current user to add the reaction; may be null if unknown or the reaction isn't chosen UsedSenderId MessageSender `json:"used_sender_id"` // Identifiers of at most 3 recent message senders, added the reaction; available in private, basic group and supergroup chats RecentSenderIds []MessageSender `json:"recent_sender_ids"` @@ -8927,6 +18260,35 @@ func (messageReaction *MessageReaction) UnmarshalJSON(data []byte) error { return nil } +// Contains a list of reactions added to a message +type MessageReactions struct { + meta + // List of added reactions + Reactions []*MessageReaction `json:"reactions"` + // True, if the reactions are tags and Telegram Premium users can filter messages by them + AreTags bool `json:"are_tags"` + // Information about top users that added the paid reaction + PaidReactors []*PaidReactor `json:"paid_reactors"` + // True, if the list of added reactions is available using getMessageAddedReactions + CanGetAddedReactions bool `json:"can_get_added_reactions"` +} + +func (entity *MessageReactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageReactions + + return json.Marshal((*stub)(entity)) +} + +func (*MessageReactions) GetClass() string { + return ClassMessageReactions +} + +func (*MessageReactions) GetType() string { + return TypeMessageReactions +} + // Contains information about interactions with a message type MessageInteractionInfo struct { meta @@ -8936,8 +18298,8 @@ type MessageInteractionInfo struct { ForwardCount int32 `json:"forward_count"` // Information about direct or indirect replies to the message; may be null. Currently, available only in channels with a discussion supergroup and discussion supergroups for messages, which are not replies itself ReplyInfo *MessageReplyInfo `json:"reply_info"` - // The list of reactions added to the message - Reactions []*MessageReaction `json:"reactions"` + // The list of reactions or tags added to the message; may be null + Reactions *MessageReactions `json:"reactions"` } func (entity *MessageInteractionInfo) MarshalJSON() ([]byte, error) { @@ -9006,6 +18368,226 @@ func (unreadReaction *UnreadReaction) UnmarshalJSON(data []byte) error { return nil } +// A topic in a non-forum supergroup chat +type MessageTopicThread struct { + meta + // Unique identifier of the message thread + MessageThreadId int64 `json:"message_thread_id"` +} + +func (entity *MessageTopicThread) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicThread + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicThread) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicThread) GetType() string { + return TypeMessageTopicThread +} + +func (*MessageTopicThread) MessageTopicType() string { + return TypeMessageTopicThread +} + +// A topic in a forum supergroup chat or a chat with a bot +type MessageTopicForum struct { + meta + // Unique identifier of the forum topic + ForumTopicId int32 `json:"forum_topic_id"` +} + +func (entity *MessageTopicForum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicForum + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicForum) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicForum) GetType() string { + return TypeMessageTopicForum +} + +func (*MessageTopicForum) MessageTopicType() string { + return TypeMessageTopicForum +} + +// A topic in a channel direct messages chat administered by the current user +type MessageTopicDirectMessages struct { + meta + // Unique identifier of the topic + DirectMessagesChatTopicId int64 `json:"direct_messages_chat_topic_id"` +} + +func (entity *MessageTopicDirectMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicDirectMessages + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicDirectMessages) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicDirectMessages) GetType() string { + return TypeMessageTopicDirectMessages +} + +func (*MessageTopicDirectMessages) MessageTopicType() string { + return TypeMessageTopicDirectMessages +} + +// A topic in Saved Messages chat +type MessageTopicSavedMessages struct { + meta + // Unique identifier of the Saved Messages topic + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` +} + +func (entity *MessageTopicSavedMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageTopicSavedMessages + + return json.Marshal((*stub)(entity)) +} + +func (*MessageTopicSavedMessages) GetClass() string { + return ClassMessageTopic +} + +func (*MessageTopicSavedMessages) GetType() string { + return TypeMessageTopicSavedMessages +} + +func (*MessageTopicSavedMessages) MessageTopicType() string { + return TypeMessageTopicSavedMessages +} + +// An effect from an emoji reaction +type MessageEffectTypeEmojiReaction struct { + meta + // Select animation for the effect in TGS format + SelectAnimation *Sticker `json:"select_animation"` + // Effect animation for the effect in TGS format + EffectAnimation *Sticker `json:"effect_animation"` +} + +func (entity *MessageEffectTypeEmojiReaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageEffectTypeEmojiReaction + + return json.Marshal((*stub)(entity)) +} + +func (*MessageEffectTypeEmojiReaction) GetClass() string { + return ClassMessageEffectType +} + +func (*MessageEffectTypeEmojiReaction) GetType() string { + return TypeMessageEffectTypeEmojiReaction +} + +func (*MessageEffectTypeEmojiReaction) MessageEffectTypeType() string { + return TypeMessageEffectTypeEmojiReaction +} + +// An effect from a premium sticker +type MessageEffectTypePremiumSticker struct { + meta + // The premium sticker. The effect can be found at sticker.full_type.premium_animation + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessageEffectTypePremiumSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageEffectTypePremiumSticker + + return json.Marshal((*stub)(entity)) +} + +func (*MessageEffectTypePremiumSticker) GetClass() string { + return ClassMessageEffectType +} + +func (*MessageEffectTypePremiumSticker) GetType() string { + return TypeMessageEffectTypePremiumSticker +} + +func (*MessageEffectTypePremiumSticker) MessageEffectTypeType() string { + return TypeMessageEffectTypePremiumSticker +} + +// Contains information about an effect added to a message +type MessageEffect struct { + meta + // Unique identifier of the effect + Id JsonInt64 `json:"id"` + // Static icon for the effect in WEBP format; may be null if none + StaticIcon *Sticker `json:"static_icon"` + // Emoji corresponding to the effect that can be used if static icon isn't available + Emoji string `json:"emoji"` + // True, if Telegram Premium subscription is required to use the effect + IsPremium bool `json:"is_premium"` + // Type of the effect + Type MessageEffectType `json:"type"` +} + +func (entity *MessageEffect) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageEffect + + return json.Marshal((*stub)(entity)) +} + +func (*MessageEffect) GetClass() string { + return ClassMessageEffect +} + +func (*MessageEffect) GetType() string { + return TypeMessageEffect +} + +func (messageEffect *MessageEffect) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + StaticIcon *Sticker `json:"static_icon"` + Emoji string `json:"emoji"` + IsPremium bool `json:"is_premium"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageEffect.Id = tmp.Id + messageEffect.StaticIcon = tmp.StaticIcon + messageEffect.Emoji = tmp.Emoji + messageEffect.IsPremium = tmp.IsPremium + + fieldType, _ := UnmarshalMessageEffectType(tmp.Type) + messageEffect.Type = fieldType + + return nil +} + // The message is being sent now, but has not yet been delivered to the server type MessageSendingStatePending struct { meta @@ -9038,7 +18620,7 @@ type MessageSendingStateFailed struct { meta // The cause of the message sending failure Error *Error `json:"error"` - // True, if the message can be re-sent + // True, if the message can be re-sent using resendMessages or readdQuickReplyShortcutMessages CanRetry bool `json:"can_retry"` // True, if the message can be re-sent only on behalf of a different sender NeedAnotherSender bool `json:"need_another_sender"` @@ -9046,6 +18628,8 @@ type MessageSendingStateFailed struct { NeedAnotherReplyQuote bool `json:"need_another_reply_quote"` // True, if the message can be re-sent only if the message to be replied is removed. This will be done automatically by resendMessages NeedDropReply bool `json:"need_drop_reply"` + // The number of Telegram Stars that must be paid to send the message; 0 if the current amount is correct + RequiredPaidMessageStarCount int64 `json:"required_paid_message_star_count"` // Time left before the message can be re-sent, in seconds. No update is sent when this field changes RetryAfter float64 `json:"retry_after"` } @@ -9070,6 +18654,58 @@ func (*MessageSendingStateFailed) MessageSendingStateType() string { return TypeMessageSendingStateFailed } +// Describes manually or automatically chosen quote from another message +type TextQuote struct { + meta + // Text of the quote. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the text + Text *FormattedText `json:"text"` + // Approximate quote position in the original message in UTF-16 code units as specified by the message sender + Position int32 `json:"position"` + // True, if the quote was manually chosen by the message sender + IsManual bool `json:"is_manual"` +} + +func (entity *TextQuote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextQuote + + return json.Marshal((*stub)(entity)) +} + +func (*TextQuote) GetClass() string { + return ClassTextQuote +} + +func (*TextQuote) GetType() string { + return TypeTextQuote +} + +// Describes manually chosen quote from another message +type InputTextQuote struct { + meta + // Text of the quote; 0-getOption("message_reply_quote_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be kept and must be kept in the quote + Text *FormattedText `json:"text"` + // Quote position in the original message in UTF-16 code units + Position int32 `json:"position"` +} + +func (entity *InputTextQuote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputTextQuote + + return json.Marshal((*stub)(entity)) +} + +func (*InputTextQuote) GetClass() string { + return ClassInputTextQuote +} + +func (*InputTextQuote) GetType() string { + return TypeInputTextQuote +} + // Describes a message replied by a given message type MessageReplyToMessage struct { meta @@ -9077,15 +18713,15 @@ type MessageReplyToMessage struct { ChatId int64 `json:"chat_id"` // The identifier of the message; may be 0 if the replied message is in unknown chat MessageId int64 `json:"message_id"` - // Manually or automatically chosen quote from the replied message; may be null if none. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities can be present in the quote - Quote *FormattedText `json:"quote"` - // True, if the quote was manually chosen by the message sender - IsQuoteManual bool `json:"is_quote_manual"` - // Information about origin of the message if the message was replied from another chat; may be null for messages from the same chat + // Chosen quote from the replied message; may be null if none + Quote *TextQuote `json:"quote"` + // Identifier of the checklist task in the original message that was replied; 0 if none + ChecklistTaskId int32 `json:"checklist_task_id"` + // Information about origin of the message if the message was from another chat or topic; may be null for messages from the same chat Origin MessageOrigin `json:"origin"` - // Point in time (Unix timestamp) when the message was sent if the message was replied from another chat; 0 for messages from the same chat + // Point in time (Unix timestamp) when the message was sent if the message was from another chat or topic; 0 for messages from the same chat OriginSendDate int32 `json:"origin_send_date"` - // Media content of the message if the message was replied from another chat; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageContact, messageDice, messageDocument, messageGame, messageInvoice, messageLocation, messagePhoto, messagePoll, messagePremiumGiveaway, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote + // Media content of the message if the message was from another chat or topic; may be null for messages from the same chat and messages without media. Can be only one of the following types: messageAnimation, messageAudio, messageChecklist, messageContact, messageDice, messageDocument, messageGame, messageGiveaway, messageGiveawayWinners, messageInvoice, messageLocation, messagePaidMedia, messagePhoto, messagePoll, messageStakeDice, messageSticker, messageStory, messageText (for link preview), messageVenue, messageVideo, messageVideoNote, or messageVoiceNote Content MessageContent `json:"content"` } @@ -9113,8 +18749,8 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e var tmp struct { ChatId int64 `json:"chat_id"` MessageId int64 `json:"message_id"` - Quote *FormattedText `json:"quote"` - IsQuoteManual bool `json:"is_quote_manual"` + Quote *TextQuote `json:"quote"` + ChecklistTaskId int32 `json:"checklist_task_id"` Origin json.RawMessage `json:"origin"` OriginSendDate int32 `json:"origin_send_date"` Content json.RawMessage `json:"content"` @@ -9128,7 +18764,7 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e messageReplyToMessage.ChatId = tmp.ChatId messageReplyToMessage.MessageId = tmp.MessageId messageReplyToMessage.Quote = tmp.Quote - messageReplyToMessage.IsQuoteManual = tmp.IsQuoteManual + messageReplyToMessage.ChecklistTaskId = tmp.ChecklistTaskId messageReplyToMessage.OriginSendDate = tmp.OriginSendDate fieldOrigin, _ := UnmarshalMessageOrigin(tmp.Origin) @@ -9143,8 +18779,8 @@ func (messageReplyToMessage *MessageReplyToMessage) UnmarshalJSON(data []byte) e // Describes a story replied by a given message type MessageReplyToStory struct { meta - // The identifier of the sender of the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -9169,15 +18805,15 @@ func (*MessageReplyToStory) MessageReplyToType() string { return TypeMessageReplyToStory } -// Describes a message to be replied +// Describes a message to be replied in the same chat and forum topic type InputMessageReplyToMessage struct { meta - // The identifier of the chat to which the message to be replied belongs; pass 0 if the message to be replied is in the same chat. Must always be 0 for replies in secret chats. A message can be replied in another chat only if message.can_be_replied_in_another_chat - ChatId int64 `json:"chat_id"` - // The identifier of the message to be replied in the same or the specified chat + // The identifier of the message to be replied in the same chat and forum topic. A message can be replied in the same chat and forum topic only if messageProperties.can_be_replied MessageId int64 `json:"message_id"` - // Manually chosen quote from the message to be replied; pass null if none; 0-getOption("message_reply_quote_length_max") characters. Must always be null for replies in secret chats. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed to be kept and must be kept in the quote - Quote *FormattedText `json:"quote"` + // Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats + Quote *InputTextQuote `json:"quote"` + // Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message + ChecklistTaskId int32 `json:"checklist_task_id"` } func (entity *InputMessageReplyToMessage) MarshalJSON() ([]byte, error) { @@ -9200,11 +18836,44 @@ func (*InputMessageReplyToMessage) InputMessageReplyToType() string { return TypeInputMessageReplyToMessage } +// Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats +type InputMessageReplyToExternalMessage struct { + meta + // The identifier of the chat to which the message to be replied belongs + ChatId int64 `json:"chat_id"` + // The identifier of the message to be replied in the specified chat. A message can be replied in another chat or forum topic only if messageProperties.can_be_replied_in_another_chat + MessageId int64 `json:"message_id"` + // Quote from the message to be replied; pass null if none + Quote *InputTextQuote `json:"quote"` + // Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message + ChecklistTaskId int32 `json:"checklist_task_id"` +} + +func (entity *InputMessageReplyToExternalMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageReplyToExternalMessage + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageReplyToExternalMessage) GetClass() string { + return ClassInputMessageReplyTo +} + +func (*InputMessageReplyToExternalMessage) GetType() string { + return TypeInputMessageReplyToExternalMessage +} + +func (*InputMessageReplyToExternalMessage) InputMessageReplyToType() string { + return TypeInputMessageReplyToExternalMessage +} + // Describes a story to be replied type InputMessageReplyToStory struct { meta - // The identifier of the sender of the story. Currently, stories can be replied only in the sender's chat - StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the poster of the story. Currently, stories can be replied only in the chat that posted the story; channel stories can't be replied + StoryPosterChatId int64 `json:"story_poster_chat_id"` // The identifier of the story StoryId int32 `json:"story_id"` } @@ -9229,6 +18898,31 @@ func (*InputMessageReplyToStory) InputMessageReplyToType() string { return TypeInputMessageReplyToStory } +// Describes a fact-check added to the message by an independent checker +type FactCheck struct { + meta + // Text of the fact-check + Text *FormattedText `json:"text"` + // A two-letter ISO 3166-1 alpha-2 country code of the country for which the fact-check is shown + CountryCode string `json:"country_code"` +} + +func (entity *FactCheck) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FactCheck + + return json.Marshal((*stub)(entity)) +} + +func (*FactCheck) GetClass() string { + return ClassFactCheck +} + +func (*FactCheck) GetType() string { + return TypeFactCheck +} + // Describes a message type Message struct { meta @@ -9246,41 +18940,23 @@ type Message struct { IsOutgoing bool `json:"is_outgoing"` // True, if the message is pinned IsPinned bool `json:"is_pinned"` - // True, if the message can be edited. For live location and poll messages this fields shows whether editMessageLiveLocation or stopPoll can be used with this message by the application - CanBeEdited bool `json:"can_be_edited"` - // True, if the message can be forwarded - CanBeForwarded bool `json:"can_be_forwarded"` - // True, if the message can be replied in another chat - CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` - // True, if content of the message can be saved locally or copied + // True, if the message was sent because of a scheduled action by the message sender, for example, as away, or greeting service message + IsFromOffline bool `json:"is_from_offline"` + // True, if content of the message can be saved locally CanBeSaved bool `json:"can_be_saved"` - // True, if the message can be deleted only for the current user while other users will continue to see it - CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` - // True, if the message can be deleted for all users - CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - // True, if the list of added reactions is available through getMessageAddedReactions - CanGetAddedReactions bool `json:"can_get_added_reactions"` - // True, if the message statistics are available through getMessageStatistics - CanGetStatistics bool `json:"can_get_statistics"` - // True, if information about the message thread is available through getMessageThread and getMessageThreadHistory - CanGetMessageThread bool `json:"can_get_message_thread"` - // True, if chat members already viewed the message can be received through getMessageViewers - CanGetViewers bool `json:"can_get_viewers"` - // True, if media timestamp links can be generated for media timestamp entities in the message text, caption or web page description through getMessageLink - CanGetMediaTimestampLinks bool `json:"can_get_media_timestamp_links"` - // True, if reactions on the message can be reported through reportMessageReactions - CanReportReactions bool `json:"can_report_reactions"` // True, if media timestamp entities refers to a media in this message as opposed to a media in the replied message HasTimestampedMedia bool `json:"has_timestamped_media"` // True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts IsChannelPost bool `json:"is_channel_post"` - // True, if the message is a forum topic message - IsTopicMessage bool `json:"is_topic_message"` + // True, if the message is a suggested channel post which was paid in Telegram Stars; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending + IsPaidStarSuggestedPost bool `json:"is_paid_star_suggested_post"` + // True, if the message is a suggested channel post which was paid in Toncoins; a warning must be shown if the message is deleted in less than getOption("suggested_post_lifetime_min") seconds after sending + IsPaidTonSuggestedPost bool `json:"is_paid_ton_suggested_post"` // True, if the message contains an unread mention for the current user ContainsUnreadMention bool `json:"contains_unread_mention"` - // Point in time (Unix timestamp) when the message was sent + // Point in time (Unix timestamp) when the message was sent; 0 for scheduled messages Date int32 `json:"date"` - // Point in time (Unix timestamp) when the message was last edited + // Point in time (Unix timestamp) when the message was last edited; 0 for scheduled messages EditDate int32 `json:"edit_date"` // Information about the initial message sender; may be null if none or unknown ForwardInfo *MessageForwardInfo `json:"forward_info"` @@ -9290,24 +18966,38 @@ type Message struct { InteractionInfo *MessageInteractionInfo `json:"interaction_info"` // Information about unread reactions added to the message UnreadReactions []*UnreadReaction `json:"unread_reactions"` + // Information about fact-check added to the message; may be null if none + FactCheck *FactCheck `json:"fact_check"` + // Information about the suggested post; may be null if the message isn't a suggested post + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` // Information about the message or the story this message is replying to; may be null if none ReplyTo MessageReplyTo `json:"reply_to"` - // If non-zero, the identifier of the message thread the message belongs to; unique within the chat to which the message belongs - MessageThreadId int64 `json:"message_thread_id"` + // Identifier of the topic within the chat to which the message belongs; may be null if none; may change when the chat is converted to a forum or back + TopicId MessageTopic `json:"topic_id"` // The message's self-destruct type; may be null if none SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // Time left before the message self-destruct timer expires, in seconds; 0 if self-destruction isn't scheduled yet SelfDestructIn float64 `json:"self_destruct_in"` // Time left before the message will be automatically deleted by message_auto_delete_time setting of the chat, in seconds; 0 if never AutoDeleteIn float64 `json:"auto_delete_in"` - // If non-zero, the user identifier of the bot through which this message was sent + // If non-zero, the user identifier of the inline bot through which this message was sent ViaBotUserId int64 `json:"via_bot_user_id"` + // If non-zero, the user identifier of the business bot that sent this message + SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` + // Number of times the sender of the message boosted the supergroup at the time the message was sent; 0 if none or unknown. For messages sent by the current user, supergroupFullInfo.my_boost_count must be used instead + SenderBoostCount int32 `json:"sender_boost_count"` + // The number of Telegram Stars the sender paid to send the message + PaidMessageStarCount int64 `json:"paid_message_star_count"` // For channel posts and anonymous group messages, optional author signature AuthorSignature string `json:"author_signature"` - // Unique identifier of an album this message belongs to. Only audios, documents, photos and videos can be grouped together in albums + // Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums MediaAlbumId JsonInt64 `json:"media_album_id"` - // If non-empty, contains a human-readable description of the reason why access to this message must be restricted - RestrictionReason string `json:"restriction_reason"` + // Unique identifier of the effect added to the message; 0 if none + EffectId JsonInt64 `json:"effect_id"` + // Information about the restrictions that must be applied to the message content; may be null if none + RestrictionInfo *RestrictionInfo `json:"restriction_info"` + // IETF language tag of the message language on which it can be summarized; empty if summary isn't available for the message + SummaryLanguageCode string `json:"summary_language_code"` // Content of the message Content MessageContent `json:"content"` // Reply markup for the message; may be null if none @@ -9339,21 +19029,12 @@ func (message *Message) UnmarshalJSON(data []byte) error { SchedulingState json.RawMessage `json:"scheduling_state"` IsOutgoing bool `json:"is_outgoing"` IsPinned bool `json:"is_pinned"` - CanBeEdited bool `json:"can_be_edited"` - CanBeForwarded bool `json:"can_be_forwarded"` - CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` + IsFromOffline bool `json:"is_from_offline"` CanBeSaved bool `json:"can_be_saved"` - CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` - CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - CanGetAddedReactions bool `json:"can_get_added_reactions"` - CanGetStatistics bool `json:"can_get_statistics"` - CanGetMessageThread bool `json:"can_get_message_thread"` - CanGetViewers bool `json:"can_get_viewers"` - CanGetMediaTimestampLinks bool `json:"can_get_media_timestamp_links"` - CanReportReactions bool `json:"can_report_reactions"` HasTimestampedMedia bool `json:"has_timestamped_media"` IsChannelPost bool `json:"is_channel_post"` - IsTopicMessage bool `json:"is_topic_message"` + IsPaidStarSuggestedPost bool `json:"is_paid_star_suggested_post"` + IsPaidTonSuggestedPost bool `json:"is_paid_ton_suggested_post"` ContainsUnreadMention bool `json:"contains_unread_mention"` Date int32 `json:"date"` EditDate int32 `json:"edit_date"` @@ -9361,15 +19042,22 @@ func (message *Message) UnmarshalJSON(data []byte) error { ImportInfo *MessageImportInfo `json:"import_info"` InteractionInfo *MessageInteractionInfo `json:"interaction_info"` UnreadReactions []*UnreadReaction `json:"unread_reactions"` + FactCheck *FactCheck `json:"fact_check"` + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` ReplyTo json.RawMessage `json:"reply_to"` - MessageThreadId int64 `json:"message_thread_id"` + TopicId json.RawMessage `json:"topic_id"` SelfDestructType json.RawMessage `json:"self_destruct_type"` SelfDestructIn float64 `json:"self_destruct_in"` AutoDeleteIn float64 `json:"auto_delete_in"` ViaBotUserId int64 `json:"via_bot_user_id"` + SenderBusinessBotUserId int64 `json:"sender_business_bot_user_id"` + SenderBoostCount int32 `json:"sender_boost_count"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` AuthorSignature string `json:"author_signature"` MediaAlbumId JsonInt64 `json:"media_album_id"` - RestrictionReason string `json:"restriction_reason"` + EffectId JsonInt64 `json:"effect_id"` + RestrictionInfo *RestrictionInfo `json:"restriction_info"` + SummaryLanguageCode string `json:"summary_language_code"` Content json.RawMessage `json:"content"` ReplyMarkup json.RawMessage `json:"reply_markup"` } @@ -9383,21 +19071,12 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.ChatId = tmp.ChatId message.IsOutgoing = tmp.IsOutgoing message.IsPinned = tmp.IsPinned - message.CanBeEdited = tmp.CanBeEdited - message.CanBeForwarded = tmp.CanBeForwarded - message.CanBeRepliedInAnotherChat = tmp.CanBeRepliedInAnotherChat + message.IsFromOffline = tmp.IsFromOffline message.CanBeSaved = tmp.CanBeSaved - message.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf - message.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers - message.CanGetAddedReactions = tmp.CanGetAddedReactions - message.CanGetStatistics = tmp.CanGetStatistics - message.CanGetMessageThread = tmp.CanGetMessageThread - message.CanGetViewers = tmp.CanGetViewers - message.CanGetMediaTimestampLinks = tmp.CanGetMediaTimestampLinks - message.CanReportReactions = tmp.CanReportReactions message.HasTimestampedMedia = tmp.HasTimestampedMedia message.IsChannelPost = tmp.IsChannelPost - message.IsTopicMessage = tmp.IsTopicMessage + message.IsPaidStarSuggestedPost = tmp.IsPaidStarSuggestedPost + message.IsPaidTonSuggestedPost = tmp.IsPaidTonSuggestedPost message.ContainsUnreadMention = tmp.ContainsUnreadMention message.Date = tmp.Date message.EditDate = tmp.EditDate @@ -9405,13 +19084,19 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.ImportInfo = tmp.ImportInfo message.InteractionInfo = tmp.InteractionInfo message.UnreadReactions = tmp.UnreadReactions - message.MessageThreadId = tmp.MessageThreadId + message.FactCheck = tmp.FactCheck + message.SuggestedPostInfo = tmp.SuggestedPostInfo message.SelfDestructIn = tmp.SelfDestructIn message.AutoDeleteIn = tmp.AutoDeleteIn message.ViaBotUserId = tmp.ViaBotUserId + message.SenderBusinessBotUserId = tmp.SenderBusinessBotUserId + message.SenderBoostCount = tmp.SenderBoostCount + message.PaidMessageStarCount = tmp.PaidMessageStarCount message.AuthorSignature = tmp.AuthorSignature message.MediaAlbumId = tmp.MediaAlbumId - message.RestrictionReason = tmp.RestrictionReason + message.EffectId = tmp.EffectId + message.RestrictionInfo = tmp.RestrictionInfo + message.SummaryLanguageCode = tmp.SummaryLanguageCode fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) message.SenderId = fieldSenderId @@ -9425,6 +19110,9 @@ func (message *Message) UnmarshalJSON(data []byte) error { fieldReplyTo, _ := UnmarshalMessageReplyTo(tmp.ReplyTo) message.ReplyTo = fieldReplyTo + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + message.TopicId = fieldTopicId + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) message.SelfDestructType = fieldSelfDestructType @@ -9469,7 +19157,7 @@ type FoundMessages struct { TotalCount int32 `json:"total_count"` // List of messages Messages []*Message `json:"messages"` - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } @@ -9516,6 +19204,35 @@ func (*FoundChatMessages) GetType() string { return TypeFoundChatMessages } +// Contains a list of messages found by a public post search +type FoundPublicPosts struct { + meta + // List of found public posts + Messages []*Message `json:"messages"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` + // Updated public post search limits after the query; repeated requests with the same query will be free; may be null if they didn't change + SearchLimits *PublicPostSearchLimits `json:"search_limits"` + // True, if the query has failed because search limits are exceeded. In this case search_limits.daily_free_query_count will be equal to 0 + AreLimitsExceeded bool `json:"are_limits_exceeded"` +} + +func (entity *FoundPublicPosts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundPublicPosts + + return json.Marshal((*stub)(entity)) +} + +func (*FoundPublicPosts) GetClass() string { + return ClassFoundPublicPosts +} + +func (*FoundPublicPosts) GetType() string { + return TypeFoundPublicPosts +} + // Contains information about a message in a specific position type MessagePosition struct { meta @@ -9618,6 +19335,54 @@ func (*MessageCalendar) GetType() string { return TypeMessageCalendar } +// Describes a message from a business account as received by a bot +type BusinessMessage struct { + meta + // The message + Message *Message `json:"message"` + // Message that is replied by the message in the same chat; may be null if none + ReplyToMessage *Message `json:"reply_to_message"` +} + +func (entity *BusinessMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessMessage + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessMessage) GetClass() string { + return ClassBusinessMessage +} + +func (*BusinessMessage) GetType() string { + return TypeBusinessMessage +} + +// Contains a list of messages from a business account as received by a bot +type BusinessMessages struct { + meta + // List of business messages + Messages []*BusinessMessage `json:"messages"` +} + +func (entity *BusinessMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessMessages + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessMessages) GetClass() string { + return ClassBusinessMessages +} + +func (*BusinessMessages) GetType() string { + return TypeBusinessMessages +} + // The message is from a chat history type MessageSourceChatHistory struct{ meta @@ -9643,7 +19408,7 @@ func (*MessageSourceChatHistory) MessageSourceType() string { return TypeMessageSourceChatHistory } -// The message is from a message thread history +// The message is from history of a message thread type MessageSourceMessageThreadHistory struct{ meta } @@ -9668,7 +19433,7 @@ func (*MessageSourceMessageThreadHistory) MessageSourceType() string { return TypeMessageSourceMessageThreadHistory } -// The message is from a forum topic history +// The message is from history of a forum topic type MessageSourceForumTopicHistory struct{ meta } @@ -9693,6 +19458,31 @@ func (*MessageSourceForumTopicHistory) MessageSourceType() string { return TypeMessageSourceForumTopicHistory } +// The message is from history of a topic in a channel direct messages chat administered by the current user +type MessageSourceDirectMessagesChatTopicHistory struct{ + meta +} + +func (entity *MessageSourceDirectMessagesChatTopicHistory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSourceDirectMessagesChatTopicHistory + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSourceDirectMessagesChatTopicHistory) GetClass() string { + return ClassMessageSource +} + +func (*MessageSourceDirectMessagesChatTopicHistory) GetType() string { + return TypeMessageSourceDirectMessagesChatTopicHistory +} + +func (*MessageSourceDirectMessagesChatTopicHistory) MessageSourceType() string { + return TypeMessageSourceDirectMessagesChatTopicHistory +} + // The message is from chat, message thread or forum topic history preview type MessageSourceHistoryPreview struct{ meta @@ -9868,206 +19658,31 @@ func (*MessageSourceOther) MessageSourceType() string { return TypeMessageSourceOther } -// The sponsor is a bot -type MessageSponsorTypeBot struct { +// Information about the sponsor of an advertisement +type AdvertisementSponsor struct { meta - // User identifier of the bot - BotUserId int64 `json:"bot_user_id"` - // An internal link to be opened when the sponsored message is clicked - Link InternalLinkType `json:"link"` -} - -func (entity *MessageSponsorTypeBot) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSponsorTypeBot - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSponsorTypeBot) GetClass() string { - return ClassMessageSponsorType -} - -func (*MessageSponsorTypeBot) GetType() string { - return TypeMessageSponsorTypeBot -} - -func (*MessageSponsorTypeBot) MessageSponsorTypeType() string { - return TypeMessageSponsorTypeBot -} - -func (messageSponsorTypeBot *MessageSponsorTypeBot) UnmarshalJSON(data []byte) error { - var tmp struct { - BotUserId int64 `json:"bot_user_id"` - Link json.RawMessage `json:"link"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageSponsorTypeBot.BotUserId = tmp.BotUserId - - fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) - messageSponsorTypeBot.Link = fieldLink - - return nil -} - -// The sponsor is a public channel chat -type MessageSponsorTypePublicChannel struct { - meta - // Sponsor chat identifier - ChatId int64 `json:"chat_id"` - // An internal link to be opened when the sponsored message is clicked; may be null if the sponsor chat needs to be opened instead - Link InternalLinkType `json:"link"` -} - -func (entity *MessageSponsorTypePublicChannel) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSponsorTypePublicChannel - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSponsorTypePublicChannel) GetClass() string { - return ClassMessageSponsorType -} - -func (*MessageSponsorTypePublicChannel) GetType() string { - return TypeMessageSponsorTypePublicChannel -} - -func (*MessageSponsorTypePublicChannel) MessageSponsorTypeType() string { - return TypeMessageSponsorTypePublicChannel -} - -func (messageSponsorTypePublicChannel *MessageSponsorTypePublicChannel) UnmarshalJSON(data []byte) error { - var tmp struct { - ChatId int64 `json:"chat_id"` - Link json.RawMessage `json:"link"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageSponsorTypePublicChannel.ChatId = tmp.ChatId - - fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) - messageSponsorTypePublicChannel.Link = fieldLink - - return nil -} - -// The sponsor is a private channel chat -type MessageSponsorTypePrivateChannel struct { - meta - // Title of the chat - Title string `json:"title"` - // Invite link for the channel - InviteLink string `json:"invite_link"` -} - -func (entity *MessageSponsorTypePrivateChannel) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSponsorTypePrivateChannel - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSponsorTypePrivateChannel) GetClass() string { - return ClassMessageSponsorType -} - -func (*MessageSponsorTypePrivateChannel) GetType() string { - return TypeMessageSponsorTypePrivateChannel -} - -func (*MessageSponsorTypePrivateChannel) MessageSponsorTypeType() string { - return TypeMessageSponsorTypePrivateChannel -} - -// The sponsor is a website -type MessageSponsorTypeWebsite struct { - meta - // URL of the website + // URL of the sponsor to be opened when the advertisement is clicked Url string `json:"url"` - // Name of the website - Name string `json:"name"` -} - -func (entity *MessageSponsorTypeWebsite) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSponsorTypeWebsite - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSponsorTypeWebsite) GetClass() string { - return ClassMessageSponsorType -} - -func (*MessageSponsorTypeWebsite) GetType() string { - return TypeMessageSponsorTypeWebsite -} - -func (*MessageSponsorTypeWebsite) MessageSponsorTypeType() string { - return TypeMessageSponsorTypeWebsite -} - -// Information about the sponsor of a message -type MessageSponsor struct { - meta - // Type of the sponsor - Type MessageSponsorType `json:"type"` // Photo of the sponsor; may be null if must not be shown - Photo *ChatPhotoInfo `json:"photo"` - // Additional optional information about the sponsor to be shown along with the message + Photo *Photo `json:"photo"` + // Additional optional information about the sponsor to be shown along with the advertisement Info string `json:"info"` } -func (entity *MessageSponsor) MarshalJSON() ([]byte, error) { +func (entity *AdvertisementSponsor) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageSponsor + type stub AdvertisementSponsor return json.Marshal((*stub)(entity)) } -func (*MessageSponsor) GetClass() string { - return ClassMessageSponsor +func (*AdvertisementSponsor) GetClass() string { + return ClassAdvertisementSponsor } -func (*MessageSponsor) GetType() string { - return TypeMessageSponsor -} - -func (messageSponsor *MessageSponsor) UnmarshalJSON(data []byte) error { - var tmp struct { - Type json.RawMessage `json:"type"` - Photo *ChatPhotoInfo `json:"photo"` - Info string `json:"info"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageSponsor.Photo = tmp.Photo - messageSponsor.Info = tmp.Info - - fieldType, _ := UnmarshalMessageSponsorType(tmp.Type) - messageSponsor.Type = fieldType - - return nil +func (*AdvertisementSponsor) GetType() string { + return TypeAdvertisementSponsor } // Describes a sponsored message @@ -10077,10 +19692,20 @@ type SponsoredMessage struct { MessageId int64 `json:"message_id"` // True, if the message needs to be labeled as "recommended" instead of "sponsored" IsRecommended bool `json:"is_recommended"` - // Content of the message. Currently, can be only of the type messageText + // True, if the message can be reported to Telegram moderators through reportChatSponsoredMessage + CanBeReported bool `json:"can_be_reported"` + // Content of the message. Currently, can be only of the types messageText, messageAnimation, messagePhoto, or messageVideo. Video messages can be viewed fullscreen Content MessageContent `json:"content"` // Information about the sponsor of the message - Sponsor *MessageSponsor `json:"sponsor"` + Sponsor *AdvertisementSponsor `json:"sponsor"` + // Title of the sponsored message + Title string `json:"title"` + // Text for the message action button + ButtonText string `json:"button_text"` + // Identifier of the accent color for title, button text and message background + AccentColorId int32 `json:"accent_color_id"` + // Identifier of a custom emoji to be shown on the message background; 0 if none + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` // If non-empty, additional information about the sponsored message to be shown along with the message AdditionalInfo string `json:"additional_info"` } @@ -10105,8 +19730,13 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { var tmp struct { MessageId int64 `json:"message_id"` IsRecommended bool `json:"is_recommended"` + CanBeReported bool `json:"can_be_reported"` Content json.RawMessage `json:"content"` - Sponsor *MessageSponsor `json:"sponsor"` + Sponsor *AdvertisementSponsor `json:"sponsor"` + Title string `json:"title"` + ButtonText string `json:"button_text"` + AccentColorId int32 `json:"accent_color_id"` + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` AdditionalInfo string `json:"additional_info"` } @@ -10117,7 +19747,12 @@ func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { sponsoredMessage.MessageId = tmp.MessageId sponsoredMessage.IsRecommended = tmp.IsRecommended + sponsoredMessage.CanBeReported = tmp.CanBeReported sponsoredMessage.Sponsor = tmp.Sponsor + sponsoredMessage.Title = tmp.Title + sponsoredMessage.ButtonText = tmp.ButtonText + sponsoredMessage.AccentColorId = tmp.AccentColorId + sponsoredMessage.BackgroundCustomEmojiId = tmp.BackgroundCustomEmojiId sponsoredMessage.AdditionalInfo = tmp.AdditionalInfo fieldContent, _ := UnmarshalMessageContent(tmp.Content) @@ -10151,6 +19786,276 @@ func (*SponsoredMessages) GetType() string { return TypeSponsoredMessages } +// Describes a sponsored chat +type SponsoredChat struct { + meta + // Unique identifier of this result + UniqueId int64 `json:"unique_id"` + // Chat identifier + ChatId int64 `json:"chat_id"` + // Additional optional information about the sponsor to be shown along with the chat + SponsorInfo string `json:"sponsor_info"` + // If non-empty, additional information about the sponsored chat to be shown along with the chat + AdditionalInfo string `json:"additional_info"` +} + +func (entity *SponsoredChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SponsoredChat + + return json.Marshal((*stub)(entity)) +} + +func (*SponsoredChat) GetClass() string { + return ClassSponsoredChat +} + +func (*SponsoredChat) GetType() string { + return TypeSponsoredChat +} + +// Contains a list of sponsored chats +type SponsoredChats struct { + meta + // List of sponsored chats + Chats []*SponsoredChat `json:"chats"` +} + +func (entity *SponsoredChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SponsoredChats + + return json.Marshal((*stub)(entity)) +} + +func (*SponsoredChats) GetClass() string { + return ClassSponsoredChats +} + +func (*SponsoredChats) GetType() string { + return TypeSponsoredChats +} + +// Describes an advertisent to be shown while a video from a message is watched +type VideoMessageAdvertisement struct { + meta + // Unique identifier of this result + UniqueId int64 `json:"unique_id"` + // Text of the advertisement + Text string `json:"text"` + // The minimum amount of time the advertisement must be displayed before it can be hidden by the user, in seconds + MinDisplayDuration int32 `json:"min_display_duration"` + // The maximum amount of time the advertisement must be displayed before it must be automatically hidden, in seconds + MaxDisplayDuration int32 `json:"max_display_duration"` + // True, if the advertisement can be reported to Telegram moderators through reportVideoMessageAdvertisement + CanBeReported bool `json:"can_be_reported"` + // Information about the sponsor of the advertisement + Sponsor *AdvertisementSponsor `json:"sponsor"` + // Title of the sponsored message + Title string `json:"title"` + // If non-empty, additional information about the sponsored message to be shown along with the message + AdditionalInfo string `json:"additional_info"` +} + +func (entity *VideoMessageAdvertisement) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoMessageAdvertisement + + return json.Marshal((*stub)(entity)) +} + +func (*VideoMessageAdvertisement) GetClass() string { + return ClassVideoMessageAdvertisement +} + +func (*VideoMessageAdvertisement) GetType() string { + return TypeVideoMessageAdvertisement +} + +// Contains a list of advertisements to be shown while a video from a message is watched +type VideoMessageAdvertisements struct { + meta + // List of advertisements + Advertisements []*VideoMessageAdvertisement `json:"advertisements"` + // Delay before the first advertisement is shown, in seconds + StartDelay int32 `json:"start_delay"` + // Delay between consecutive advertisements, in seconds + BetweenDelay int32 `json:"between_delay"` +} + +func (entity *VideoMessageAdvertisements) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub VideoMessageAdvertisements + + return json.Marshal((*stub)(entity)) +} + +func (*VideoMessageAdvertisements) GetClass() string { + return ClassVideoMessageAdvertisements +} + +func (*VideoMessageAdvertisements) GetType() string { + return TypeVideoMessageAdvertisements +} + +// Describes an option to report an entity to Telegram +type ReportOption struct { + meta + // Unique identifier of the option + Id []byte `json:"id"` + // Text of the option + Text string `json:"text"` +} + +func (entity *ReportOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportOption + + return json.Marshal((*stub)(entity)) +} + +func (*ReportOption) GetClass() string { + return ClassReportOption +} + +func (*ReportOption) GetType() string { + return TypeReportOption +} + +// The message was reported successfully +type ReportSponsoredResultOk struct{ + meta +} + +func (entity *ReportSponsoredResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportSponsoredResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*ReportSponsoredResultOk) GetClass() string { + return ClassReportSponsoredResult +} + +func (*ReportSponsoredResultOk) GetType() string { + return TypeReportSponsoredResultOk +} + +func (*ReportSponsoredResultOk) ReportSponsoredResultType() string { + return TypeReportSponsoredResultOk +} + +// The sponsored message is too old or not found +type ReportSponsoredResultFailed struct{ + meta +} + +func (entity *ReportSponsoredResultFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportSponsoredResultFailed + + return json.Marshal((*stub)(entity)) +} + +func (*ReportSponsoredResultFailed) GetClass() string { + return ClassReportSponsoredResult +} + +func (*ReportSponsoredResultFailed) GetType() string { + return TypeReportSponsoredResultFailed +} + +func (*ReportSponsoredResultFailed) ReportSponsoredResultType() string { + return TypeReportSponsoredResultFailed +} + +// The user must choose an option to report the message and repeat request with the chosen option +type ReportSponsoredResultOptionRequired struct { + meta + // Title for the option choice + Title string `json:"title"` + // List of available options + Options []*ReportOption `json:"options"` +} + +func (entity *ReportSponsoredResultOptionRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportSponsoredResultOptionRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportSponsoredResultOptionRequired) GetClass() string { + return ClassReportSponsoredResult +} + +func (*ReportSponsoredResultOptionRequired) GetType() string { + return TypeReportSponsoredResultOptionRequired +} + +func (*ReportSponsoredResultOptionRequired) ReportSponsoredResultType() string { + return TypeReportSponsoredResultOptionRequired +} + +// Sponsored messages were hidden for the user in all chats +type ReportSponsoredResultAdsHidden struct{ + meta +} + +func (entity *ReportSponsoredResultAdsHidden) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportSponsoredResultAdsHidden + + return json.Marshal((*stub)(entity)) +} + +func (*ReportSponsoredResultAdsHidden) GetClass() string { + return ClassReportSponsoredResult +} + +func (*ReportSponsoredResultAdsHidden) GetType() string { + return TypeReportSponsoredResultAdsHidden +} + +func (*ReportSponsoredResultAdsHidden) ReportSponsoredResultType() string { + return TypeReportSponsoredResultAdsHidden +} + +// The user asked to hide sponsored messages, but Telegram Premium is required for this +type ReportSponsoredResultPremiumRequired struct{ + meta +} + +func (entity *ReportSponsoredResultPremiumRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportSponsoredResultPremiumRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportSponsoredResultPremiumRequired) GetClass() string { + return ClassReportSponsoredResult +} + +func (*ReportSponsoredResultPremiumRequired) GetType() string { + return TypeReportSponsoredResultPremiumRequired +} + +func (*ReportSponsoredResultPremiumRequired) ReportSponsoredResultType() string { + return TypeReportSponsoredResultPremiumRequired +} + // Describes a file added to file download list type FileDownload struct { meta @@ -10216,7 +20121,7 @@ type FoundFileDownloads struct { TotalCounts *DownloadedFileCounts `json:"total_counts"` // The list of files Files []*FileDownload `json:"files"` - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } @@ -10314,7 +20219,7 @@ func (*NotificationSettingsScopeChannelChats) NotificationSettingsScopeType() st // Contains information about notification settings for a chat or a forum topic type ChatNotificationSettings struct { meta - // If true, mute_for is ignored and the value for the relevant type of chat or the forum chat is used instead + // If true, the value for the relevant type of chat or the forum chat is used instead of mute_for UseDefaultMuteFor bool `json:"use_default_mute_for"` // Time left before notifications will be unmuted, in seconds MuteFor int32 `json:"mute_for"` @@ -10322,11 +20227,11 @@ type ChatNotificationSettings struct { UseDefaultSound bool `json:"use_default_sound"` // Identifier of the notification sound to be played for messages; 0 if sound is disabled SoundId JsonInt64 `json:"sound_id"` - // If true, show_preview is ignored and the value for the relevant type of chat or the forum chat is used instead + // If true, the value for the relevant type of chat or the forum chat is used instead of show_preview UseDefaultShowPreview bool `json:"use_default_show_preview"` // True, if message content must be displayed in notifications ShowPreview bool `json:"show_preview"` - // If true, mute_stories is ignored and the value for the relevant type of chat is used instead + // If true, the value for the relevant type of chat is used instead of mute_stories UseDefaultMuteStories bool `json:"use_default_mute_stories"` // True, if story notifications are disabled for the chat MuteStories bool `json:"mute_stories"` @@ -10334,15 +20239,15 @@ type ChatNotificationSettings struct { UseDefaultStorySound bool `json:"use_default_story_sound"` // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundId JsonInt64 `json:"story_sound_id"` - // If true, show_story_sender is ignored and the value for the relevant type of chat is used instead - UseDefaultShowStorySender bool `json:"use_default_show_story_sender"` - // True, if the sender of stories must be displayed in notifications - ShowStorySender bool `json:"show_story_sender"` - // If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat or the forum chat is used instead + // If true, the value for the relevant type of chat is used instead of show_story_poster + UseDefaultShowStoryPoster bool `json:"use_default_show_story_poster"` + // True, if the chat that posted a story must be displayed in notifications + ShowStoryPoster bool `json:"show_story_poster"` + // If true, the value for the relevant type of chat or the forum chat is used instead of disable_pinned_message_notifications UseDefaultDisablePinnedMessageNotifications bool `json:"use_default_disable_pinned_message_notifications"` // If true, notifications for incoming pinned messages will be created as for an ordinary unread message DisablePinnedMessageNotifications bool `json:"disable_pinned_message_notifications"` - // If true, disable_mention_notifications is ignored and the value for the relevant type of chat or the forum chat is used instead + // If true, the value for the relevant type of chat or the forum chat is used instead of disable_mention_notifications UseDefaultDisableMentionNotifications bool `json:"use_default_disable_mention_notifications"` // If true, notifications for messages with mentions will be created as for an ordinary unread message DisableMentionNotifications bool `json:"disable_mention_notifications"` @@ -10373,14 +20278,14 @@ type ScopeNotificationSettings struct { SoundId JsonInt64 `json:"sound_id"` // True, if message content must be displayed in notifications ShowPreview bool `json:"show_preview"` - // If true, mute_stories is ignored and story notifications are received only for the first 5 chats from topChatCategoryUsers + // If true, story notifications are received only for the first 5 chats from topChatCategoryUsers regardless of the value of mute_stories UseDefaultMuteStories bool `json:"use_default_mute_stories"` - // True, if story notifications are disabled for the chat + // True, if story notifications are disabled MuteStories bool `json:"mute_stories"` // Identifier of the notification sound to be played for stories; 0 if sound is disabled StorySoundId JsonInt64 `json:"story_sound_id"` - // True, if the sender of stories must be displayed in notifications - ShowStorySender bool `json:"show_story_sender"` + // True, if the chat that posted a story must be displayed in notifications + ShowStoryPoster bool `json:"show_story_poster"` // True, if notifications for incoming pinned messages will be created as for an ordinary unread message DisablePinnedMessageNotifications bool `json:"disable_pinned_message_notifications"` // True, if notifications for messages with mentions will be created as for an ordinary unread message @@ -10403,15 +20308,148 @@ func (*ScopeNotificationSettings) GetType() string { return TypeScopeNotificationSettings } +// Notifications for reactions are disabled +type ReactionNotificationSourceNone struct{ + meta +} + +func (entity *ReactionNotificationSourceNone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionNotificationSourceNone + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionNotificationSourceNone) GetClass() string { + return ClassReactionNotificationSource +} + +func (*ReactionNotificationSourceNone) GetType() string { + return TypeReactionNotificationSourceNone +} + +func (*ReactionNotificationSourceNone) ReactionNotificationSourceType() string { + return TypeReactionNotificationSourceNone +} + +// Notifications for reactions are shown only for reactions from contacts +type ReactionNotificationSourceContacts struct{ + meta +} + +func (entity *ReactionNotificationSourceContacts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionNotificationSourceContacts + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionNotificationSourceContacts) GetClass() string { + return ClassReactionNotificationSource +} + +func (*ReactionNotificationSourceContacts) GetType() string { + return TypeReactionNotificationSourceContacts +} + +func (*ReactionNotificationSourceContacts) ReactionNotificationSourceType() string { + return TypeReactionNotificationSourceContacts +} + +// Notifications for reactions are shown for all reactions +type ReactionNotificationSourceAll struct{ + meta +} + +func (entity *ReactionNotificationSourceAll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionNotificationSourceAll + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionNotificationSourceAll) GetClass() string { + return ClassReactionNotificationSource +} + +func (*ReactionNotificationSourceAll) GetType() string { + return TypeReactionNotificationSourceAll +} + +func (*ReactionNotificationSourceAll) ReactionNotificationSourceType() string { + return TypeReactionNotificationSourceAll +} + +// Contains information about notification settings for reactions +type ReactionNotificationSettings struct { + meta + // Source of message reactions for which notifications are shown + MessageReactionSource ReactionNotificationSource `json:"message_reaction_source"` + // Source of story reactions for which notifications are shown + StoryReactionSource ReactionNotificationSource `json:"story_reaction_source"` + // Identifier of the notification sound to be played; 0 if sound is disabled + SoundId JsonInt64 `json:"sound_id"` + // True, if reaction sender and emoji must be displayed in notifications + ShowPreview bool `json:"show_preview"` +} + +func (entity *ReactionNotificationSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionNotificationSettings + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionNotificationSettings) GetClass() string { + return ClassReactionNotificationSettings +} + +func (*ReactionNotificationSettings) GetType() string { + return TypeReactionNotificationSettings +} + +func (reactionNotificationSettings *ReactionNotificationSettings) UnmarshalJSON(data []byte) error { + var tmp struct { + MessageReactionSource json.RawMessage `json:"message_reaction_source"` + StoryReactionSource json.RawMessage `json:"story_reaction_source"` + SoundId JsonInt64 `json:"sound_id"` + ShowPreview bool `json:"show_preview"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + reactionNotificationSettings.SoundId = tmp.SoundId + reactionNotificationSettings.ShowPreview = tmp.ShowPreview + + fieldMessageReactionSource, _ := UnmarshalReactionNotificationSource(tmp.MessageReactionSource) + reactionNotificationSettings.MessageReactionSource = fieldMessageReactionSource + + fieldStoryReactionSource, _ := UnmarshalReactionNotificationSource(tmp.StoryReactionSource) + reactionNotificationSettings.StoryReactionSource = fieldStoryReactionSource + + return nil +} + // Contains information about a message draft type DraftMessage struct { meta - // Information about the message to be replied; must be of the type inputMessageReplyToMessage; may be null if none + // Information about the message to be replied; inputMessageReplyToStory is unsupported; may be null if none ReplyTo InputMessageReplyTo `json:"reply_to"` // Point in time (Unix timestamp) when the draft was created Date int32 `json:"date"` - // Content of the message draft; must be of the type inputMessageText + // Content of the message draft; must be of the type inputMessageText, inputMessageVideoNote, or inputMessageVoiceNote InputMessageText InputMessageContent `json:"input_message_text"` + // Identifier of the effect to apply to the message when it is sent; 0 if none + EffectId JsonInt64 `json:"effect_id"` + // Information about the suggested post; may be null if none + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` } func (entity *DraftMessage) MarshalJSON() ([]byte, error) { @@ -10435,6 +20473,8 @@ func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { ReplyTo json.RawMessage `json:"reply_to"` Date int32 `json:"date"` InputMessageText json.RawMessage `json:"input_message_text"` + EffectId JsonInt64 `json:"effect_id"` + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` } err := json.Unmarshal(data, &tmp) @@ -10443,6 +20483,8 @@ func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { } draftMessage.Date = tmp.Date + draftMessage.EffectId = tmp.EffectId + draftMessage.SuggestedPostInfo = tmp.SuggestedPostInfo fieldReplyTo, _ := UnmarshalInputMessageReplyTo(tmp.ReplyTo) draftMessage.ReplyTo = fieldReplyTo @@ -10541,7 +20583,7 @@ type ChatTypeSecret struct { meta // Secret chat identifier SecretChatId int32 `json:"secret_chat_id"` - // User identifier of the secret chat peer + // User identifier of the other user in the secret chat UserId int64 `json:"user_id"` } @@ -10588,13 +20630,40 @@ func (*ChatFolderIcon) GetType() string { return TypeChatFolderIcon } +// Describes name of a chat folder +type ChatFolderName struct { + meta + // The text of the chat folder name; 1-12 characters without line feeds. May contain only CustomEmoji entities + Text *FormattedText `json:"text"` + // True, if custom emoji in the name must be animated + AnimateCustomEmoji bool `json:"animate_custom_emoji"` +} + +func (entity *ChatFolderName) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatFolderName + + return json.Marshal((*stub)(entity)) +} + +func (*ChatFolderName) GetClass() string { + return ClassChatFolderName +} + +func (*ChatFolderName) GetType() string { + return TypeChatFolderName +} + // Represents a folder for user chats type ChatFolder struct { meta - // The title of the folder; 1-12 characters without line feeds - Title string `json:"title"` + // The name of the folder + Name *ChatFolderName `json:"name"` // The chosen icon for the chat folder; may be null. If null, use getChatFolderDefaultIconName to get default icon name for the folder Icon *ChatFolderIcon `json:"icon"` + // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled. Can't be changed if folder tags are disabled or the current user doesn't have Telegram Premium subscription + ColorId int32 `json:"color_id"` // True, if at least one link has been created for the folder IsShareable bool `json:"is_shareable"` // The chat identifiers of pinned chats in the folder. There can be up to getOption("chat_folder_chosen_chat_count_max") pinned and always included non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium @@ -10642,10 +20711,12 @@ type ChatFolderInfo struct { meta // Unique chat folder identifier Id int32 `json:"id"` - // The title of the folder; 1-12 characters without line feeds - Title string `json:"title"` + // The name of the folder + Name *ChatFolderName `json:"name"` // The chosen or default icon for the chat folder Icon *ChatFolderIcon `json:"icon"` + // The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled + ColorId int32 `json:"color_id"` // True, if at least one link has been created for the folder IsShareable bool `json:"is_shareable"` // True, if the chat folder has invite links created by the current user @@ -11044,9 +21115,11 @@ func (chatPosition *ChatPosition) UnmarshalJSON(data []byte) error { return nil } -// All reactions are available in the chat -type ChatAvailableReactionsAll struct{ +// All reactions are available in the chat, excluding the paid reaction and custom reactions in channel chats +type ChatAvailableReactionsAll struct { meta + // The maximum allowed number of reactions per message; 1-11 + MaxReactionCount int32 `json:"max_reaction_count"` } func (entity *ChatAvailableReactionsAll) MarshalJSON() ([]byte, error) { @@ -11074,6 +21147,8 @@ type ChatAvailableReactionsSome struct { meta // The list of reactions Reactions []ReactionType `json:"reactions"` + // The maximum allowed number of reactions per message; 1-11 + MaxReactionCount int32 `json:"max_reaction_count"` } func (entity *ChatAvailableReactionsSome) MarshalJSON() ([]byte, error) { @@ -11099,6 +21174,7 @@ func (*ChatAvailableReactionsSome) ChatAvailableReactionsType() string { func (chatAvailableReactionsSome *ChatAvailableReactionsSome) UnmarshalJSON(data []byte) error { var tmp struct { Reactions []json.RawMessage `json:"reactions"` + MaxReactionCount int32 `json:"max_reaction_count"` } err := json.Unmarshal(data, &tmp) @@ -11106,13 +21182,115 @@ func (chatAvailableReactionsSome *ChatAvailableReactionsSome) UnmarshalJSON(data return err } + chatAvailableReactionsSome.MaxReactionCount = tmp.MaxReactionCount + fieldReactions, _ := UnmarshalListOfReactionType(tmp.Reactions) chatAvailableReactionsSome.Reactions = fieldReactions return nil } -// Describes a video chat +// Represents a tag used in Saved Messages or a Saved Messages topic +type SavedMessagesTag struct { + meta + // The tag + Tag ReactionType `json:"tag"` + // Label of the tag; 0-12 characters. Always empty if the tag is returned for a Saved Messages topic + Label string `json:"label"` + // Number of times the tag was used; may be 0 if the tag has non-empty label + Count int32 `json:"count"` +} + +func (entity *SavedMessagesTag) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTag + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTag) GetClass() string { + return ClassSavedMessagesTag +} + +func (*SavedMessagesTag) GetType() string { + return TypeSavedMessagesTag +} + +func (savedMessagesTag *SavedMessagesTag) UnmarshalJSON(data []byte) error { + var tmp struct { + Tag json.RawMessage `json:"tag"` + Label string `json:"label"` + Count int32 `json:"count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + savedMessagesTag.Label = tmp.Label + savedMessagesTag.Count = tmp.Count + + fieldTag, _ := UnmarshalReactionType(tmp.Tag) + savedMessagesTag.Tag = fieldTag + + return nil +} + +// Contains a list of tags used in Saved Messages +type SavedMessagesTags struct { + meta + // List of tags + Tags []*SavedMessagesTag `json:"tags"` +} + +func (entity *SavedMessagesTags) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTags + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTags) GetClass() string { + return ClassSavedMessagesTags +} + +func (*SavedMessagesTags) GetType() string { + return TypeSavedMessagesTags +} + +// Contains information about a business bot that manages the chat +type BusinessBotManageBar struct { + meta + // User identifier of the bot + BotUserId int64 `json:"bot_user_id"` + // URL to be opened to manage the bot + ManageUrl string `json:"manage_url"` + // True, if the bot is paused. Use toggleBusinessConnectedBotChatIsPaused to change the value of the field + IsBotPaused bool `json:"is_bot_paused"` + // True, if the bot can reply + CanBotReply bool `json:"can_bot_reply"` +} + +func (entity *BusinessBotManageBar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessBotManageBar + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessBotManageBar) GetClass() string { + return ClassBusinessBotManageBar +} + +func (*BusinessBotManageBar) GetType() string { + return TypeBusinessBotManageBar +} + +// Describes a video chat, i.e. a group call bound to a chat type VideoChat struct { meta // Group call identifier of an active video chat; 0 if none. Full information about the video chat can be received through the method getGroupCall @@ -11173,14 +21351,22 @@ type Chat struct { Photo *ChatPhotoInfo `json:"photo"` // Identifier of the accent color for message sender name, and backgrounds of chat photo, reply header, and link preview AccentColorId int32 `json:"accent_color_id"` - // Identifier of a custom emoji to be shown on the reply header background in replies to messages sent by the chat; 0 if none + // Identifier of a custom emoji to be shown on the reply header and link preview background for messages sent by the chat; 0 if none BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` + // Color scheme based on an upgraded gift to be used for the chat instead of accent_color_id and background_custom_emoji_id; may be null if none + UpgradedGiftColors *UpgradedGiftColors `json:"upgraded_gift_colors"` + // Identifier of the profile accent color for the chat'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 chat's profile; 0 if none + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` // Actions that non-administrator chat members are allowed to take in the chat Permissions *ChatPermissions `json:"permissions"` // Last message in the chat; may be null if none or unknown LastMessage *Message `json:"last_message"` // Positions of the chat in chat lists Positions []*ChatPosition `json:"positions"` + // Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even if it doesn't belong to the chat list and have no position in a chat list even if it belongs to the chat list + ChatLists []ChatList `json:"chat_lists"` // Identifier of a user or chat that is selected to send messages in the chat; may be null if the user can't change message sender MessageSenderId MessageSender `json:"message_sender_id"` // Block list to which the chat is added; may be null if none @@ -11191,6 +21377,8 @@ type Chat struct { IsTranslatable bool `json:"is_translatable"` // True, if the chat is marked as unread IsMarkedAsUnread bool `json:"is_marked_as_unread"` + // True, if the chat is a forum supergroup that must be shown in the "View as topics" mode, or Saved Messages chat that must be shown in the "View as chats" + ViewAsTopics bool `json:"view_as_topics"` // True, if the chat has scheduled messages HasScheduledMessages bool `json:"has_scheduled_messages"` // True, if the chat messages can be deleted only for the current user while other users will continue to see the messages @@ -11217,12 +21405,16 @@ type Chat struct { AvailableReactions ChatAvailableReactions `json:"available_reactions"` // Current message auto-delete or self-destruct timer setting for the chat, in seconds; 0 if disabled. Self-destruct timer in secret chats starts after the message or its content is viewed. Auto-delete timer in other chats starts from the send date MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` + // Emoji status to be shown along with chat title; may be null + EmojiStatus *EmojiStatus `json:"emoji_status"` // Background set for the chat; may be null if none Background *ChatBackground `json:"background"` - // If non-empty, name of a theme, set for the chat - ThemeName string `json:"theme_name"` + // Theme set for the chat; may be null if none + Theme ChatTheme `json:"theme"` // Information about actions which must be possible to do through the chat action bar; may be null if none ActionBar ChatActionBar `json:"action_bar"` + // Information about bar for managing a business bot in the chat; may be null if none + BusinessBotManageBar *BusinessBotManageBar `json:"business_bot_manage_bar"` // Information about video chat of the chat VideoChat *VideoChat `json:"video_chat"` // Information about pending join requests; may be null if none @@ -11259,14 +21451,19 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { Photo *ChatPhotoInfo `json:"photo"` AccentColorId int32 `json:"accent_color_id"` BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` + UpgradedGiftColors *UpgradedGiftColors `json:"upgraded_gift_colors"` + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` Permissions *ChatPermissions `json:"permissions"` LastMessage *Message `json:"last_message"` Positions []*ChatPosition `json:"positions"` + ChatLists []json.RawMessage `json:"chat_lists"` MessageSenderId json.RawMessage `json:"message_sender_id"` BlockList json.RawMessage `json:"block_list"` HasProtectedContent bool `json:"has_protected_content"` IsTranslatable bool `json:"is_translatable"` IsMarkedAsUnread bool `json:"is_marked_as_unread"` + ViewAsTopics bool `json:"view_as_topics"` HasScheduledMessages bool `json:"has_scheduled_messages"` CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` @@ -11280,9 +21477,11 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { NotificationSettings *ChatNotificationSettings `json:"notification_settings"` AvailableReactions json.RawMessage `json:"available_reactions"` MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` + EmojiStatus *EmojiStatus `json:"emoji_status"` Background *ChatBackground `json:"background"` - ThemeName string `json:"theme_name"` + Theme json.RawMessage `json:"theme"` ActionBar json.RawMessage `json:"action_bar"` + BusinessBotManageBar *BusinessBotManageBar `json:"business_bot_manage_bar"` VideoChat *VideoChat `json:"video_chat"` PendingJoinRequests *ChatJoinRequestsInfo `json:"pending_join_requests"` ReplyMarkupMessageId int64 `json:"reply_markup_message_id"` @@ -11300,12 +21499,16 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.Photo = tmp.Photo chat.AccentColorId = tmp.AccentColorId chat.BackgroundCustomEmojiId = tmp.BackgroundCustomEmojiId + chat.UpgradedGiftColors = tmp.UpgradedGiftColors + chat.ProfileAccentColorId = tmp.ProfileAccentColorId + chat.ProfileBackgroundCustomEmojiId = tmp.ProfileBackgroundCustomEmojiId chat.Permissions = tmp.Permissions chat.LastMessage = tmp.LastMessage chat.Positions = tmp.Positions chat.HasProtectedContent = tmp.HasProtectedContent chat.IsTranslatable = tmp.IsTranslatable chat.IsMarkedAsUnread = tmp.IsMarkedAsUnread + chat.ViewAsTopics = tmp.ViewAsTopics chat.HasScheduledMessages = tmp.HasScheduledMessages chat.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf chat.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers @@ -11318,8 +21521,9 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.UnreadReactionCount = tmp.UnreadReactionCount chat.NotificationSettings = tmp.NotificationSettings chat.MessageAutoDeleteTime = tmp.MessageAutoDeleteTime + chat.EmojiStatus = tmp.EmojiStatus chat.Background = tmp.Background - chat.ThemeName = tmp.ThemeName + chat.BusinessBotManageBar = tmp.BusinessBotManageBar chat.VideoChat = tmp.VideoChat chat.PendingJoinRequests = tmp.PendingJoinRequests chat.ReplyMarkupMessageId = tmp.ReplyMarkupMessageId @@ -11329,6 +21533,9 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { fieldType, _ := UnmarshalChatType(tmp.Type) chat.Type = fieldType + fieldChatLists, _ := UnmarshalListOfChatList(tmp.ChatLists) + chat.ChatLists = fieldChatLists + fieldMessageSenderId, _ := UnmarshalMessageSender(tmp.MessageSenderId) chat.MessageSenderId = fieldMessageSenderId @@ -11338,6 +21545,9 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { fieldAvailableReactions, _ := UnmarshalChatAvailableReactions(tmp.AvailableReactions) chat.AvailableReactions = fieldAvailableReactions + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + chat.Theme = fieldTheme + fieldActionBar, _ := UnmarshalChatActionBar(tmp.ActionBar) chat.ActionBar = fieldActionBar @@ -11369,54 +21579,79 @@ func (*Chats) GetType() string { return TypeChats } -// Describes a chat located nearby -type ChatNearby struct { +// Contains information about a user who has failed to be added to a chat +type FailedToAddMember struct { + meta + // User identifier + UserId int64 `json:"user_id"` + // True, if subscription to Telegram Premium would have allowed to add the user to the chat + PremiumWouldAllowInvite bool `json:"premium_would_allow_invite"` + // True, if subscription to Telegram Premium is required to send the user chat invite link + PremiumRequiredToSendMessages bool `json:"premium_required_to_send_messages"` +} + +func (entity *FailedToAddMember) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FailedToAddMember + + return json.Marshal((*stub)(entity)) +} + +func (*FailedToAddMember) GetClass() string { + return ClassFailedToAddMember +} + +func (*FailedToAddMember) GetType() string { + return TypeFailedToAddMember +} + +// Represents a list of users that has failed to be added to a chat +type FailedToAddMembers struct { + meta + // Information about users that weren't added to the chat + FailedToAddMembers []*FailedToAddMember `json:"failed_to_add_members"` +} + +func (entity *FailedToAddMembers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FailedToAddMembers + + return json.Marshal((*stub)(entity)) +} + +func (*FailedToAddMembers) GetClass() string { + return ClassFailedToAddMembers +} + +func (*FailedToAddMembers) GetType() string { + return TypeFailedToAddMembers +} + +// Contains information about a newly created basic group chat +type CreatedBasicGroupChat struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // Distance to the chat location, in meters - Distance int32 `json:"distance"` + // Information about failed to add members + FailedToAddMembers *FailedToAddMembers `json:"failed_to_add_members"` } -func (entity *ChatNearby) MarshalJSON() ([]byte, error) { +func (entity *CreatedBasicGroupChat) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatNearby + type stub CreatedBasicGroupChat return json.Marshal((*stub)(entity)) } -func (*ChatNearby) GetClass() string { - return ClassChatNearby +func (*CreatedBasicGroupChat) GetClass() string { + return ClassCreatedBasicGroupChat } -func (*ChatNearby) GetType() string { - return TypeChatNearby -} - -// Represents a list of chats located nearby -type ChatsNearby struct { - meta - // List of users nearby - UsersNearby []*ChatNearby `json:"users_nearby"` - // List of location-based supergroups nearby - SupergroupsNearby []*ChatNearby `json:"supergroups_nearby"` -} - -func (entity *ChatsNearby) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatsNearby - - return json.Marshal((*stub)(entity)) -} - -func (*ChatsNearby) GetClass() string { - return ClassChatsNearby -} - -func (*ChatsNearby) GetType() string { - return TypeChatsNearby +func (*CreatedBasicGroupChat) GetType() string { + return TypeCreatedBasicGroupChat } // The chat is public, because it has an active username @@ -11469,7 +21704,38 @@ func (*PublicChatTypeIsLocationBased) PublicChatTypeType() string { return TypePublicChatTypeIsLocationBased } -// The chat can be reported as spam using the method reportChat with the reason reportReasonSpam. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown +// Contains basic information about another user who started a chat with the current user +type AccountInfo struct { + meta + // Month when the user was registered in Telegram; 0-12; may be 0 if unknown + RegistrationMonth int32 `json:"registration_month"` + // Year when the user was registered in Telegram; 0-9999; may be 0 if unknown + RegistrationYear int32 `json:"registration_year"` + // A two-letter ISO 3166-1 alpha-2 country code based on the phone number of the user; may be empty if unknown + PhoneNumberCountryCode string `json:"phone_number_country_code"` + // Point in time (Unix timestamp) when the user changed name last time; 0 if unknown + LastNameChangeDate int32 `json:"last_name_change_date"` + // Point in time (Unix timestamp) when the user changed photo last time; 0 if unknown + LastPhotoChangeDate int32 `json:"last_photo_change_date"` +} + +func (entity *AccountInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AccountInfo + + return json.Marshal((*stub)(entity)) +} + +func (*AccountInfo) GetClass() string { + return ClassAccountInfo +} + +func (*AccountInfo) GetType() string { + return TypeAccountInfo +} + +// The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown type ChatActionBarReportSpam struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings @@ -11496,31 +21762,6 @@ func (*ChatActionBarReportSpam) ChatActionBarType() string { return TypeChatActionBarReportSpam } -// The chat is a location-based supergroup, which can be reported as having unrelated location using the method reportChat with the reason reportReasonUnrelatedLocation -type ChatActionBarReportUnrelatedLocation struct{ - meta -} - -func (entity *ChatActionBarReportUnrelatedLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatActionBarReportUnrelatedLocation - - return json.Marshal((*stub)(entity)) -} - -func (*ChatActionBarReportUnrelatedLocation) GetClass() string { - return ClassChatActionBar -} - -func (*ChatActionBarReportUnrelatedLocation) GetType() string { - return TypeChatActionBarReportUnrelatedLocation -} - -func (*ChatActionBarReportUnrelatedLocation) ChatActionBarType() string { - return TypeChatActionBarReportUnrelatedLocation -} - // The chat is a recently created group chat to which new members can be invited type ChatActionBarInviteMembers struct{ meta @@ -11551,8 +21792,8 @@ type ChatActionBarReportAddBlock struct { meta // If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings CanUnarchive bool `json:"can_unarchive"` - // If non-negative, the current user was found by the peer through searchChatsNearby and this is the distance between the users - Distance int32 `json:"distance"` + // Basic information about the other user in the chat; may be null if unknown + AccountInfo *AccountInfo `json:"account_info"` } func (entity *ChatActionBarReportAddBlock) MarshalJSON() ([]byte, error) { @@ -11656,6 +21897,106 @@ func (*ChatActionBarJoinRequest) ChatActionBarType() string { return TypeChatActionBarJoinRequest } +// The button has default style +type ButtonStyleDefault struct{ + meta +} + +func (entity *ButtonStyleDefault) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ButtonStyleDefault + + return json.Marshal((*stub)(entity)) +} + +func (*ButtonStyleDefault) GetClass() string { + return ClassButtonStyle +} + +func (*ButtonStyleDefault) GetType() string { + return TypeButtonStyleDefault +} + +func (*ButtonStyleDefault) ButtonStyleType() string { + return TypeButtonStyleDefault +} + +// The button has dark blue color +type ButtonStylePrimary struct{ + meta +} + +func (entity *ButtonStylePrimary) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ButtonStylePrimary + + return json.Marshal((*stub)(entity)) +} + +func (*ButtonStylePrimary) GetClass() string { + return ClassButtonStyle +} + +func (*ButtonStylePrimary) GetType() string { + return TypeButtonStylePrimary +} + +func (*ButtonStylePrimary) ButtonStyleType() string { + return TypeButtonStylePrimary +} + +// The button has red color +type ButtonStyleDanger struct{ + meta +} + +func (entity *ButtonStyleDanger) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ButtonStyleDanger + + return json.Marshal((*stub)(entity)) +} + +func (*ButtonStyleDanger) GetClass() string { + return ClassButtonStyle +} + +func (*ButtonStyleDanger) GetType() string { + return TypeButtonStyleDanger +} + +func (*ButtonStyleDanger) ButtonStyleType() string { + return TypeButtonStyleDanger +} + +// The button has green color +type ButtonStyleSuccess struct{ + meta +} + +func (entity *ButtonStyleSuccess) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ButtonStyleSuccess + + return json.Marshal((*stub)(entity)) +} + +func (*ButtonStyleSuccess) GetClass() string { + return ClassButtonStyle +} + +func (*ButtonStyleSuccess) GetType() string { + return TypeButtonStyleSuccess +} + +func (*ButtonStyleSuccess) ButtonStyleType() string { + return TypeButtonStyleSuccess +} + // A simple button, with text that must be sent when the button is pressed type KeyboardButtonTypeText struct{ meta @@ -11760,39 +22101,47 @@ func (*KeyboardButtonTypeRequestPoll) KeyboardButtonTypeType() string { return TypeKeyboardButtonTypeRequestPoll } -// A button that requests a user to be shared by the current user; available only in private chats. Use the method shareUserWithBot to complete the request -type KeyboardButtonTypeRequestUser struct { +// A button that requests users to be shared by the current user; available only in private chats. Use the method shareUsersWithBot to complete the request +type KeyboardButtonTypeRequestUsers struct { meta // Unique button identifier Id int32 `json:"id"` - // True, if the shared user must or must not be a bot + // True, if the shared users must or must not be bots RestrictUserIsBot bool `json:"restrict_user_is_bot"` - // True, if the shared user must be a bot; otherwise, the shared user must no be a bot. Ignored if restrict_user_is_bot is false + // True, if the shared users must be bots; otherwise, the shared users must not be bots. Ignored if restrict_user_is_bot is false UserIsBot bool `json:"user_is_bot"` - // True, if the shared user must or must not be a Telegram Premium user + // True, if the shared users must or must not be Telegram Premium users RestrictUserIsPremium bool `json:"restrict_user_is_premium"` - // True, if the shared user must be a Telegram Premium user; otherwise, the shared user must no be a Telegram Premium user. Ignored if restrict_user_is_premium is false + // True, if the shared users must be Telegram Premium users; otherwise, the shared users must not be Telegram Premium users. Ignored if restrict_user_is_premium is false UserIsPremium bool `json:"user_is_premium"` + // The maximum number of users to share + MaxQuantity int32 `json:"max_quantity"` + // Pass true to request name of the users; bots only + RequestName bool `json:"request_name"` + // Pass true to request username of the users; bots only + RequestUsername bool `json:"request_username"` + // Pass true to request photo of the users; bots only + RequestPhoto bool `json:"request_photo"` } -func (entity *KeyboardButtonTypeRequestUser) MarshalJSON() ([]byte, error) { +func (entity *KeyboardButtonTypeRequestUsers) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub KeyboardButtonTypeRequestUser + type stub KeyboardButtonTypeRequestUsers return json.Marshal((*stub)(entity)) } -func (*KeyboardButtonTypeRequestUser) GetClass() string { +func (*KeyboardButtonTypeRequestUsers) GetClass() string { return ClassKeyboardButtonType } -func (*KeyboardButtonTypeRequestUser) GetType() string { - return TypeKeyboardButtonTypeRequestUser +func (*KeyboardButtonTypeRequestUsers) GetType() string { + return TypeKeyboardButtonTypeRequestUsers } -func (*KeyboardButtonTypeRequestUser) KeyboardButtonTypeType() string { - return TypeKeyboardButtonTypeRequestUser +func (*KeyboardButtonTypeRequestUsers) KeyboardButtonTypeType() string { + return TypeKeyboardButtonTypeRequestUsers } // A button that requests a chat to be shared by the current user; available only in private chats. Use the method shareChatWithBot to complete the request @@ -11818,6 +22167,12 @@ type KeyboardButtonTypeRequestChat struct { BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights"` // True, if the bot must be a member of the chat; for basic group and supergroup chats only BotIsMember bool `json:"bot_is_member"` + // Pass true to request title of the chat; bots only + RequestTitle bool `json:"request_title"` + // Pass true to request username of the chat; bots only + RequestUsername bool `json:"request_username"` + // Pass true to request photo of the chat; bots only + RequestPhoto bool `json:"request_photo"` } func (entity *KeyboardButtonTypeRequestChat) MarshalJSON() ([]byte, error) { @@ -11872,6 +22227,10 @@ type KeyboardButton struct { meta // Text of the button Text string `json:"text"` + // Identifier of the custom emoji that must be shown on the button; 0 if none + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` + // Style of the button + Style ButtonStyle `json:"style"` // Type of the button Type KeyboardButtonType `json:"type"` } @@ -11895,6 +22254,8 @@ func (*KeyboardButton) GetType() string { func (keyboardButton *KeyboardButton) UnmarshalJSON(data []byte) error { var tmp struct { Text string `json:"text"` + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` + Style json.RawMessage `json:"style"` Type json.RawMessage `json:"type"` } @@ -11904,6 +22265,10 @@ func (keyboardButton *KeyboardButton) UnmarshalJSON(data []byte) error { } keyboardButton.Text = tmp.Text + keyboardButton.IconCustomEmojiId = tmp.IconCustomEmojiId + + fieldStyle, _ := UnmarshalButtonStyle(tmp.Style) + keyboardButton.Style = fieldStyle fieldType, _ := UnmarshalKeyboardButtonType(tmp.Type) keyboardButton.Type = fieldType @@ -11914,7 +22279,7 @@ func (keyboardButton *KeyboardButton) UnmarshalJSON(data []byte) error { // A button that opens a specified URL type InlineKeyboardButtonTypeUrl struct { meta - // HTTP or tg:// URL to open + // HTTP or tg:// URL to open. If the link is of the type internalLinkTypeWebApp, then the button must be marked as a Web App button Url string `json:"url"` } @@ -12175,11 +22540,42 @@ func (*InlineKeyboardButtonTypeUser) InlineKeyboardButtonTypeType() string { return TypeInlineKeyboardButtonTypeUser } +// A button that copies specified text to clipboard +type InlineKeyboardButtonTypeCopyText struct { + meta + // The text to copy to clipboard + Text string `json:"text"` +} + +func (entity *InlineKeyboardButtonTypeCopyText) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InlineKeyboardButtonTypeCopyText + + return json.Marshal((*stub)(entity)) +} + +func (*InlineKeyboardButtonTypeCopyText) GetClass() string { + return ClassInlineKeyboardButtonType +} + +func (*InlineKeyboardButtonTypeCopyText) GetType() string { + return TypeInlineKeyboardButtonTypeCopyText +} + +func (*InlineKeyboardButtonTypeCopyText) InlineKeyboardButtonTypeType() string { + return TypeInlineKeyboardButtonTypeCopyText +} + // Represents a single button in an inline keyboard type InlineKeyboardButton struct { meta // Text of the button Text string `json:"text"` + // Identifier of the custom emoji that must be shown on the button; 0 if none + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` + // Style of the button + Style ButtonStyle `json:"style"` // Type of the button Type InlineKeyboardButtonType `json:"type"` } @@ -12203,6 +22599,8 @@ func (*InlineKeyboardButton) GetType() string { func (inlineKeyboardButton *InlineKeyboardButton) UnmarshalJSON(data []byte) error { var tmp struct { Text string `json:"text"` + IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` + Style json.RawMessage `json:"style"` Type json.RawMessage `json:"type"` } @@ -12212,6 +22610,10 @@ func (inlineKeyboardButton *InlineKeyboardButton) UnmarshalJSON(data []byte) err } inlineKeyboardButton.Text = tmp.Text + inlineKeyboardButton.IconCustomEmojiId = tmp.IconCustomEmojiId + + fieldStyle, _ := UnmarshalButtonStyle(tmp.Style) + inlineKeyboardButton.Style = fieldStyle fieldType, _ := UnmarshalInlineKeyboardButtonType(tmp.Type) inlineKeyboardButton.Type = fieldType @@ -12280,7 +22682,7 @@ type ReplyMarkupShowKeyboard struct { meta // A list of rows of bot keyboard buttons Rows [][]*KeyboardButton `json:"rows"` - // True, if the keyboard is supposed to always be shown when the ordinary keyboard is hidden + // True, if the keyboard is expected to always be shown when the ordinary keyboard is hidden IsPersistent bool `json:"is_persistent"` // True, if the application needs to resize the keyboard vertically ResizeKeyboard bool `json:"resize_keyboard"` @@ -12379,6 +22781,16 @@ type LoginUrlInfoRequestConfirmation struct { BotUserId int64 `json:"bot_user_id"` // True, if the user must be asked for the permission to the bot to send them messages RequestWriteAccess bool `json:"request_write_access"` + // True, if the user must be asked for the permission to share their phone number + RequestPhoneNumberAccess bool `json:"request_phone_number_access"` + // The version of a browser used for the authorization; may be empty if irrelevant + Browser string `json:"browser"` + // Operating system the browser is running on; may be empty if irrelevant + Platform string `json:"platform"` + // IP address from which the authorization is performed, in human-readable format; may be empty if irrelevant + IpAddress string `json:"ip_address"` + // Human-readable description of a country and a region from which the authorization is performed, based on the IP address; may be empty if irrelevant + Location string `json:"location"` } func (entity *LoginUrlInfoRequestConfirmation) MarshalJSON() ([]byte, error) { @@ -12401,6 +22813,132 @@ func (*LoginUrlInfoRequestConfirmation) LoginUrlInfoType() string { return TypeLoginUrlInfoRequestConfirmation } +// Contains parameters of the application theme +type ThemeParameters struct { + meta + // A color of the background in the RGB format + BackgroundColor int32 `json:"background_color"` + // A secondary color for the background in the RGB format + SecondaryBackgroundColor int32 `json:"secondary_background_color"` + // A color of the header background in the RGB format + HeaderBackgroundColor int32 `json:"header_background_color"` + // A color of the bottom bar background in the RGB format + BottomBarBackgroundColor int32 `json:"bottom_bar_background_color"` + // A color of the section background in the RGB format + SectionBackgroundColor int32 `json:"section_background_color"` + // A color of the section separator in the RGB format + SectionSeparatorColor int32 `json:"section_separator_color"` + // A color of text in the RGB format + TextColor int32 `json:"text_color"` + // An accent color of the text in the RGB format + AccentTextColor int32 `json:"accent_text_color"` + // A color of text on the section headers in the RGB format + SectionHeaderTextColor int32 `json:"section_header_text_color"` + // A color of the subtitle text in the RGB format + SubtitleTextColor int32 `json:"subtitle_text_color"` + // A color of the text for destructive actions in the RGB format + DestructiveTextColor int32 `json:"destructive_text_color"` + // A color of hints in the RGB format + HintColor int32 `json:"hint_color"` + // A color of links in the RGB format + LinkColor int32 `json:"link_color"` + // A color of the buttons in the RGB format + ButtonColor int32 `json:"button_color"` + // A color of text on the buttons in the RGB format + ButtonTextColor int32 `json:"button_text_color"` +} + +func (entity *ThemeParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThemeParameters + + return json.Marshal((*stub)(entity)) +} + +func (*ThemeParameters) GetClass() string { + return ClassThemeParameters +} + +func (*ThemeParameters) GetType() string { + return TypeThemeParameters +} + +// The Web App is opened in the compact mode +type WebAppOpenModeCompact struct{ + meta +} + +func (entity *WebAppOpenModeCompact) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenModeCompact + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenModeCompact) GetClass() string { + return ClassWebAppOpenMode +} + +func (*WebAppOpenModeCompact) GetType() string { + return TypeWebAppOpenModeCompact +} + +func (*WebAppOpenModeCompact) WebAppOpenModeType() string { + return TypeWebAppOpenModeCompact +} + +// The Web App is opened in the full-size mode +type WebAppOpenModeFullSize struct{ + meta +} + +func (entity *WebAppOpenModeFullSize) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenModeFullSize + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenModeFullSize) GetClass() string { + return ClassWebAppOpenMode +} + +func (*WebAppOpenModeFullSize) GetType() string { + return TypeWebAppOpenModeFullSize +} + +func (*WebAppOpenModeFullSize) WebAppOpenModeType() string { + return TypeWebAppOpenModeFullSize +} + +// The Web App is opened in the full-screen mode +type WebAppOpenModeFullScreen struct{ + meta +} + +func (entity *WebAppOpenModeFullScreen) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenModeFullScreen + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenModeFullScreen) GetClass() string { + return ClassWebAppOpenMode +} + +func (*WebAppOpenModeFullScreen) GetType() string { + return TypeWebAppOpenModeFullScreen +} + +func (*WebAppOpenModeFullScreen) WebAppOpenModeType() string { + return TypeWebAppOpenModeFullScreen +} + // Contains information about a Web App found by its short name type FoundWebApp struct { meta @@ -12453,6 +22991,98 @@ func (*WebAppInfo) GetType() string { return TypeWebAppInfo } +// Contains information about the main Web App of a bot +type MainWebApp struct { + meta + // URL of the Web App to open + Url string `json:"url"` + // The mode in which the Web App must be opened + Mode WebAppOpenMode `json:"mode"` +} + +func (entity *MainWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MainWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*MainWebApp) GetClass() string { + return ClassMainWebApp +} + +func (*MainWebApp) GetType() string { + return TypeMainWebApp +} + +func (mainWebApp *MainWebApp) UnmarshalJSON(data []byte) error { + var tmp struct { + Url string `json:"url"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + mainWebApp.Url = tmp.Url + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + mainWebApp.Mode = fieldMode + + return nil +} + +// Options to be used when a Web App is opened +type WebAppOpenParameters struct { + meta + // Preferred Web App theme; pass null to use the default theme + Theme *ThemeParameters `json:"theme"` + // Short name of the current application; 0-64 English letters, digits, and underscores + ApplicationName string `json:"application_name"` + // The mode in which the Web App is opened; pass null to open in webAppOpenModeFullSize + Mode WebAppOpenMode `json:"mode"` +} + +func (entity *WebAppOpenParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebAppOpenParameters + + return json.Marshal((*stub)(entity)) +} + +func (*WebAppOpenParameters) GetClass() string { + return ClassWebAppOpenParameters +} + +func (*WebAppOpenParameters) GetType() string { + return TypeWebAppOpenParameters +} + +func (webAppOpenParameters *WebAppOpenParameters) UnmarshalJSON(data []byte) error { + var tmp struct { + Theme *ThemeParameters `json:"theme"` + ApplicationName string `json:"application_name"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + webAppOpenParameters.Theme = tmp.Theme + webAppOpenParameters.ApplicationName = tmp.ApplicationName + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + webAppOpenParameters.Mode = fieldMode + + return nil +} + // Contains information about a message thread type MessageThreadInfo struct { meta @@ -12464,7 +23094,7 @@ type MessageThreadInfo struct { ReplyInfo *MessageReplyInfo `json:"reply_info"` // Approximate number of unread messages in the message thread UnreadMessageCount int32 `json:"unread_message_count"` - // The messages from which the thread starts. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id) + // The messages from which the thread starts. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id) Messages []*Message `json:"messages"` // A draft of a message in the message thread; may be null if none DraftMessage *DraftMessage `json:"draft_message"` @@ -12486,6 +23116,227 @@ func (*MessageThreadInfo) GetType() string { return TypeMessageThreadInfo } +// Topic containing messages sent by the current user of forwarded from an unknown chat +type SavedMessagesTopicTypeMyNotes struct{ + meta +} + +func (entity *SavedMessagesTopicTypeMyNotes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTopicTypeMyNotes + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTopicTypeMyNotes) GetClass() string { + return ClassSavedMessagesTopicType +} + +func (*SavedMessagesTopicTypeMyNotes) GetType() string { + return TypeSavedMessagesTopicTypeMyNotes +} + +func (*SavedMessagesTopicTypeMyNotes) SavedMessagesTopicTypeType() string { + return TypeSavedMessagesTopicTypeMyNotes +} + +// Topic containing messages forwarded from a user with hidden privacy +type SavedMessagesTopicTypeAuthorHidden struct{ + meta +} + +func (entity *SavedMessagesTopicTypeAuthorHidden) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTopicTypeAuthorHidden + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTopicTypeAuthorHidden) GetClass() string { + return ClassSavedMessagesTopicType +} + +func (*SavedMessagesTopicTypeAuthorHidden) GetType() string { + return TypeSavedMessagesTopicTypeAuthorHidden +} + +func (*SavedMessagesTopicTypeAuthorHidden) SavedMessagesTopicTypeType() string { + return TypeSavedMessagesTopicTypeAuthorHidden +} + +// Topic containing messages forwarded from a specific chat +type SavedMessagesTopicTypeSavedFromChat struct { + meta + // Identifier of the chat + ChatId int64 `json:"chat_id"` +} + +func (entity *SavedMessagesTopicTypeSavedFromChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTopicTypeSavedFromChat + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTopicTypeSavedFromChat) GetClass() string { + return ClassSavedMessagesTopicType +} + +func (*SavedMessagesTopicTypeSavedFromChat) GetType() string { + return TypeSavedMessagesTopicTypeSavedFromChat +} + +func (*SavedMessagesTopicTypeSavedFromChat) SavedMessagesTopicTypeType() string { + return TypeSavedMessagesTopicTypeSavedFromChat +} + +// Contains information about a Saved Messages topic +type SavedMessagesTopic struct { + meta + // Unique topic identifier + Id int64 `json:"id"` + // Type of the topic + Type SavedMessagesTopicType `json:"type"` + // True, if the topic is pinned + IsPinned bool `json:"is_pinned"` + // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order + Order JsonInt64 `json:"order"` + // Last message in the topic; may be null if none or unknown + LastMessage *Message `json:"last_message"` + // A draft of a message in the topic; may be null if none + DraftMessage *DraftMessage `json:"draft_message"` +} + +func (entity *SavedMessagesTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SavedMessagesTopic + + return json.Marshal((*stub)(entity)) +} + +func (*SavedMessagesTopic) GetClass() string { + return ClassSavedMessagesTopic +} + +func (*SavedMessagesTopic) GetType() string { + return TypeSavedMessagesTopic +} + +func (savedMessagesTopic *SavedMessagesTopic) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int64 `json:"id"` + Type json.RawMessage `json:"type"` + IsPinned bool `json:"is_pinned"` + Order JsonInt64 `json:"order"` + LastMessage *Message `json:"last_message"` + DraftMessage *DraftMessage `json:"draft_message"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + savedMessagesTopic.Id = tmp.Id + savedMessagesTopic.IsPinned = tmp.IsPinned + savedMessagesTopic.Order = tmp.Order + savedMessagesTopic.LastMessage = tmp.LastMessage + savedMessagesTopic.DraftMessage = tmp.DraftMessage + + fieldType, _ := UnmarshalSavedMessagesTopicType(tmp.Type) + savedMessagesTopic.Type = fieldType + + return nil +} + +// Contains information about a topic in a channel direct messages chat administered by the current user +type DirectMessagesChatTopic struct { + meta + // Identifier of the chat to which the topic belongs + ChatId int64 `json:"chat_id"` + // Unique topic identifier + Id int64 `json:"id"` + // Identifier of the user or chat that sends the messages to the topic + SenderId MessageSender `json:"sender_id"` + // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order + Order JsonInt64 `json:"order"` + // True, if the other party can send unpaid messages even if the chat has paid messages enabled + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` + // True, if the topic is marked as unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + // Number of unread messages in the chat + UnreadCount int64 `json:"unread_count"` + // Identifier of the last read incoming message + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + // Identifier of the last read outgoing message + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Number of messages with unread reactions in the chat + UnreadReactionCount int64 `json:"unread_reaction_count"` + // Last message in the topic; may be null if none or unknown + LastMessage *Message `json:"last_message"` + // A draft of a message in the topic; may be null if none + DraftMessage *DraftMessage `json:"draft_message"` +} + +func (entity *DirectMessagesChatTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DirectMessagesChatTopic + + return json.Marshal((*stub)(entity)) +} + +func (*DirectMessagesChatTopic) GetClass() string { + return ClassDirectMessagesChatTopic +} + +func (*DirectMessagesChatTopic) GetType() string { + return TypeDirectMessagesChatTopic +} + +func (directMessagesChatTopic *DirectMessagesChatTopic) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + Id int64 `json:"id"` + SenderId json.RawMessage `json:"sender_id"` + Order JsonInt64 `json:"order"` + CanSendUnpaidMessages bool `json:"can_send_unpaid_messages"` + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + UnreadCount int64 `json:"unread_count"` + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + UnreadReactionCount int64 `json:"unread_reaction_count"` + LastMessage *Message `json:"last_message"` + DraftMessage *DraftMessage `json:"draft_message"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + directMessagesChatTopic.ChatId = tmp.ChatId + directMessagesChatTopic.Id = tmp.Id + directMessagesChatTopic.Order = tmp.Order + directMessagesChatTopic.CanSendUnpaidMessages = tmp.CanSendUnpaidMessages + directMessagesChatTopic.IsMarkedAsUnread = tmp.IsMarkedAsUnread + directMessagesChatTopic.UnreadCount = tmp.UnreadCount + directMessagesChatTopic.LastReadInboxMessageId = tmp.LastReadInboxMessageId + directMessagesChatTopic.LastReadOutboxMessageId = tmp.LastReadOutboxMessageId + directMessagesChatTopic.UnreadReactionCount = tmp.UnreadReactionCount + directMessagesChatTopic.LastMessage = tmp.LastMessage + directMessagesChatTopic.DraftMessage = tmp.DraftMessage + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + directMessagesChatTopic.SenderId = fieldSenderId + + return nil +} + // Describes a forum topic icon type ForumTopicIcon struct { meta @@ -12514,8 +23365,10 @@ func (*ForumTopicIcon) GetType() string { // Contains basic information about a forum topic type ForumTopicInfo struct { meta - // Message thread identifier of the topic - MessageThreadId int64 `json:"message_thread_id"` + // Identifier of a forum supergroup chat or a chat with a bot to which the topic belongs + ChatId int64 `json:"chat_id"` + // Forum topic identifier of the topic + ForumTopicId int32 `json:"forum_topic_id"` // Name of the topic Name string `json:"name"` // Icon of the topic @@ -12524,14 +23377,16 @@ type ForumTopicInfo struct { CreationDate int32 `json:"creation_date"` // Identifier of the creator of the topic CreatorId MessageSender `json:"creator_id"` - // True, if the topic is the General topic list + // True, if the topic is the General topic IsGeneral bool `json:"is_general"` // True, if the topic was created by the current user IsOutgoing bool `json:"is_outgoing"` - // True, if the topic is closed + // True, if the topic is closed. If the topic is closed, then the user must have can_manage_topics administrator right in the supergroup or must be the creator of the topic to send messages there IsClosed bool `json:"is_closed"` // True, if the topic is hidden above the topic list and closed; for General topic only IsHidden bool `json:"is_hidden"` + // True, if the name of the topic wasn't added explicitly + IsNameImplicit bool `json:"is_name_implicit"` } func (entity *ForumTopicInfo) MarshalJSON() ([]byte, error) { @@ -12552,7 +23407,8 @@ func (*ForumTopicInfo) GetType() string { func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { var tmp struct { - MessageThreadId int64 `json:"message_thread_id"` + ChatId int64 `json:"chat_id"` + ForumTopicId int32 `json:"forum_topic_id"` Name string `json:"name"` Icon *ForumTopicIcon `json:"icon"` CreationDate int32 `json:"creation_date"` @@ -12561,6 +23417,7 @@ func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { IsOutgoing bool `json:"is_outgoing"` IsClosed bool `json:"is_closed"` IsHidden bool `json:"is_hidden"` + IsNameImplicit bool `json:"is_name_implicit"` } err := json.Unmarshal(data, &tmp) @@ -12568,7 +23425,8 @@ func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { return err } - forumTopicInfo.MessageThreadId = tmp.MessageThreadId + forumTopicInfo.ChatId = tmp.ChatId + forumTopicInfo.ForumTopicId = tmp.ForumTopicId forumTopicInfo.Name = tmp.Name forumTopicInfo.Icon = tmp.Icon forumTopicInfo.CreationDate = tmp.CreationDate @@ -12576,6 +23434,7 @@ func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { forumTopicInfo.IsOutgoing = tmp.IsOutgoing forumTopicInfo.IsClosed = tmp.IsClosed forumTopicInfo.IsHidden = tmp.IsHidden + forumTopicInfo.IsNameImplicit = tmp.IsNameImplicit fieldCreatorId, _ := UnmarshalMessageSender(tmp.CreatorId) forumTopicInfo.CreatorId = fieldCreatorId @@ -12590,6 +23449,8 @@ type ForumTopic struct { Info *ForumTopicInfo `json:"info"` // Last message in the topic; may be null if unknown LastMessage *Message `json:"last_message"` + // A parameter used to determine order of the topic in the topic list. Topics must be sorted by the order in descending order + Order JsonInt64 `json:"order"` // True, if the topic is pinned in the topic list IsPinned bool `json:"is_pinned"` // Number of unread messages in the topic @@ -12635,8 +23496,8 @@ type ForumTopics struct { NextOffsetDate int32 `json:"next_offset_date"` // Offset message identifier for the next getForumTopics request NextOffsetMessageId int64 `json:"next_offset_message_id"` - // Offset message thread identifier for the next getForumTopics request - NextOffsetMessageThreadId int64 `json:"next_offset_message_thread_id"` + // Offset forum topic identifier for the next getForumTopics request + NextOffsetForumTopicId int32 `json:"next_offset_forum_topic_id"` } func (entity *ForumTopics) MarshalJSON() ([]byte, error) { @@ -12686,6 +23547,253 @@ func (*LinkPreviewOptions) GetType() string { return TypeLinkPreviewOptions } +// Contains information about a user shared with a bot +type SharedUser struct { + meta + // User identifier + UserId int64 `json:"user_id"` + // First name of the user; for bots only + FirstName string `json:"first_name"` + // Last name of the user; for bots only + LastName string `json:"last_name"` + // Username of the user; for bots only + Username string `json:"username"` + // Profile photo of the user; for bots only; may be null + Photo *Photo `json:"photo"` +} + +func (entity *SharedUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SharedUser + + return json.Marshal((*stub)(entity)) +} + +func (*SharedUser) GetClass() string { + return ClassSharedUser +} + +func (*SharedUser) GetType() string { + return TypeSharedUser +} + +// Contains information about a chat shared with a bot +type SharedChat struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Title of the chat; for bots only + Title string `json:"title"` + // Username of the chat; for bots only + Username string `json:"username"` + // Photo of the chat; for bots only; may be null + Photo *Photo `json:"photo"` +} + +func (entity *SharedChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SharedChat + + return json.Marshal((*stub)(entity)) +} + +func (*SharedChat) GetClass() string { + return ClassSharedChat +} + +func (*SharedChat) GetType() string { + return TypeSharedChat +} + +// Classic light theme +type BuiltInThemeClassic struct{ + meta +} + +func (entity *BuiltInThemeClassic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeClassic + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeClassic) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeClassic) GetType() string { + return TypeBuiltInThemeClassic +} + +func (*BuiltInThemeClassic) BuiltInThemeType() string { + return TypeBuiltInThemeClassic +} + +// Regular light theme +type BuiltInThemeDay struct{ + meta +} + +func (entity *BuiltInThemeDay) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeDay + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeDay) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeDay) GetType() string { + return TypeBuiltInThemeDay +} + +func (*BuiltInThemeDay) BuiltInThemeType() string { + return TypeBuiltInThemeDay +} + +// Regular dark theme +type BuiltInThemeNight struct{ + meta +} + +func (entity *BuiltInThemeNight) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeNight + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeNight) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeNight) GetType() string { + return TypeBuiltInThemeNight +} + +func (*BuiltInThemeNight) BuiltInThemeType() string { + return TypeBuiltInThemeNight +} + +// Tinted dark theme +type BuiltInThemeTinted struct{ + meta +} + +func (entity *BuiltInThemeTinted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeTinted + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeTinted) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeTinted) GetType() string { + return TypeBuiltInThemeTinted +} + +func (*BuiltInThemeTinted) BuiltInThemeType() string { + return TypeBuiltInThemeTinted +} + +// Arctic light theme +type BuiltInThemeArctic struct{ + meta +} + +func (entity *BuiltInThemeArctic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BuiltInThemeArctic + + return json.Marshal((*stub)(entity)) +} + +func (*BuiltInThemeArctic) GetClass() string { + return ClassBuiltInTheme +} + +func (*BuiltInThemeArctic) GetType() string { + return TypeBuiltInThemeArctic +} + +func (*BuiltInThemeArctic) BuiltInThemeType() string { + return TypeBuiltInThemeArctic +} + +// Describes theme settings +type ThemeSettings struct { + meta + // Base theme for this theme + BaseTheme BuiltInTheme `json:"base_theme"` + // Theme accent color in ARGB format + AccentColor int32 `json:"accent_color"` + // The background to be used in chats; may be null + Background *Background `json:"background"` + // The fill to be used as a background for outgoing messages; may be null if the fill from the base theme must be used instead + OutgoingMessageFill BackgroundFill `json:"outgoing_message_fill"` + // If true, the freeform gradient fill needs to be animated on every sent message + AnimateOutgoingMessageFill bool `json:"animate_outgoing_message_fill"` + // Accent color of outgoing messages in ARGB format + OutgoingMessageAccentColor int32 `json:"outgoing_message_accent_color"` +} + +func (entity *ThemeSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ThemeSettings + + return json.Marshal((*stub)(entity)) +} + +func (*ThemeSettings) GetClass() string { + return ClassThemeSettings +} + +func (*ThemeSettings) GetType() string { + return TypeThemeSettings +} + +func (themeSettings *ThemeSettings) UnmarshalJSON(data []byte) error { + var tmp struct { + BaseTheme json.RawMessage `json:"base_theme"` + AccentColor int32 `json:"accent_color"` + Background *Background `json:"background"` + OutgoingMessageFill json.RawMessage `json:"outgoing_message_fill"` + AnimateOutgoingMessageFill bool `json:"animate_outgoing_message_fill"` + OutgoingMessageAccentColor int32 `json:"outgoing_message_accent_color"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + themeSettings.AccentColor = tmp.AccentColor + themeSettings.Background = tmp.Background + themeSettings.AnimateOutgoingMessageFill = tmp.AnimateOutgoingMessageFill + themeSettings.OutgoingMessageAccentColor = tmp.OutgoingMessageAccentColor + + fieldBaseTheme, _ := UnmarshalBuiltInTheme(tmp.BaseTheme) + themeSettings.BaseTheme = fieldBaseTheme + + fieldOutgoingMessageFill, _ := UnmarshalBackgroundFill(tmp.OutgoingMessageFill) + themeSettings.OutgoingMessageFill = fieldOutgoingMessageFill + + return nil +} + // A plain text type RichTextPlain struct { meta @@ -13236,7 +24344,7 @@ func (*RichTextIcon) RichTextType() string { return TypeRichTextIcon } -// A reference to a richTexts object on the same web page +// A reference to a richTexts object on the same page type RichTextReference struct { meta // The text @@ -13315,7 +24423,7 @@ func (*RichTextAnchor) RichTextType() string { return TypeRichTextAnchor } -// A link to an anchor on the same web page +// A link to an anchor on the same page type RichTextAnchorLink struct { meta // The link text @@ -13410,7 +24518,7 @@ func (richTexts *RichTexts) UnmarshalJSON(data []byte) error { return nil } -// Contains a caption of an instant view web page block, consisting of a text and a trailing credit +// Contains a caption of another block type PageBlockCaption struct { meta // Content of the caption @@ -14519,7 +25627,7 @@ func (pageBlockCover *PageBlockCover) UnmarshalJSON(data []byte) error { // An embedded web page type PageBlockEmbedded struct { meta - // Web page URL, if available + // URL of the embedded page, if available Url string `json:"url"` // HTML-markup of the embedded page Html string `json:"html"` @@ -14560,7 +25668,7 @@ func (*PageBlockEmbedded) PageBlockType() string { // An embedded post type PageBlockEmbeddedPost struct { meta - // Web page URL + // URL of the embedded post Url string `json:"url"` // Post author Author string `json:"author"` @@ -14946,7 +26054,7 @@ func (*PageBlockMap) PageBlockType() string { // Describes an instant view page for a web page type WebPageInstantView struct { meta - // Content of the web page + // Content of the instant view page PageBlocks []PageBlock `json:"page_blocks"` // Number of the instant view views; 0 if unknown ViewCount int32 `json:"view_count"` @@ -14954,7 +26062,7 @@ type WebPageInstantView struct { Version int32 `json:"version"` // True, if the instant view must be shown from right to left IsRtl bool `json:"is_rtl"` - // True, if the instant view contains the full page. A network request might be needed to get the full web page instant view + // True, if the instant view contains the full page. A network request might be needed to get the full instant view IsFull bool `json:"is_full"` // An internal link to be opened to leave feedback about the instant view FeedbackLink InternalLinkType `json:"feedback_link"` @@ -15005,79 +26113,1283 @@ func (webPageInstantView *WebPageInstantView) UnmarshalJSON(data []byte) error { return nil } +// The media is a photo +type LinkPreviewAlbumMediaPhoto struct { + meta + // Photo description + Photo *Photo `json:"photo"` +} + +func (entity *LinkPreviewAlbumMediaPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewAlbumMediaPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewAlbumMediaPhoto) GetClass() string { + return ClassLinkPreviewAlbumMedia +} + +func (*LinkPreviewAlbumMediaPhoto) GetType() string { + return TypeLinkPreviewAlbumMediaPhoto +} + +func (*LinkPreviewAlbumMediaPhoto) LinkPreviewAlbumMediaType() string { + return TypeLinkPreviewAlbumMediaPhoto +} + +// The media is a video +type LinkPreviewAlbumMediaVideo struct { + meta + // Video description + Video *Video `json:"video"` +} + +func (entity *LinkPreviewAlbumMediaVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewAlbumMediaVideo + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewAlbumMediaVideo) GetClass() string { + return ClassLinkPreviewAlbumMedia +} + +func (*LinkPreviewAlbumMediaVideo) GetType() string { + return TypeLinkPreviewAlbumMediaVideo +} + +func (*LinkPreviewAlbumMediaVideo) LinkPreviewAlbumMediaType() string { + return TypeLinkPreviewAlbumMediaVideo +} + +// The link is a link to a media album consisting of photos and videos +type LinkPreviewTypeAlbum struct { + meta + // The list of album media + Media []LinkPreviewAlbumMedia `json:"media"` + // Album caption + Caption string `json:"caption"` +} + +func (entity *LinkPreviewTypeAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeAlbum) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeAlbum) GetType() string { + return TypeLinkPreviewTypeAlbum +} + +func (*LinkPreviewTypeAlbum) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeAlbum +} + +func (linkPreviewTypeAlbum *LinkPreviewTypeAlbum) UnmarshalJSON(data []byte) error { + var tmp struct { + Media []json.RawMessage `json:"media"` + Caption string `json:"caption"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + linkPreviewTypeAlbum.Caption = tmp.Caption + + fieldMedia, _ := UnmarshalListOfLinkPreviewAlbumMedia(tmp.Media) + linkPreviewTypeAlbum.Media = fieldMedia + + return nil +} + +// The link is a link to an animation +type LinkPreviewTypeAnimation struct { + meta + // The animation + Animation *Animation `json:"animation"` +} + +func (entity *LinkPreviewTypeAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeAnimation) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeAnimation) GetType() string { + return TypeLinkPreviewTypeAnimation +} + +func (*LinkPreviewTypeAnimation) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeAnimation +} + +// The link is a link to an app at App Store or Google Play +type LinkPreviewTypeApp struct { + meta + // Photo for the app + Photo *Photo `json:"photo"` +} + +func (entity *LinkPreviewTypeApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeApp + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeApp) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeApp) GetType() string { + return TypeLinkPreviewTypeApp +} + +func (*LinkPreviewTypeApp) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeApp +} + +// The link is a link to a web site +type LinkPreviewTypeArticle struct { + meta + // Article's main photo; may be null + Photo *Photo `json:"photo"` +} + +func (entity *LinkPreviewTypeArticle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeArticle + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeArticle) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeArticle) GetType() string { + return TypeLinkPreviewTypeArticle +} + +func (*LinkPreviewTypeArticle) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeArticle +} + +// The link is a link to an audio +type LinkPreviewTypeAudio struct { + meta + // The audio description + Audio *Audio `json:"audio"` +} + +func (entity *LinkPreviewTypeAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeAudio + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeAudio) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeAudio) GetType() string { + return TypeLinkPreviewTypeAudio +} + +func (*LinkPreviewTypeAudio) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeAudio +} + +// The link is a link to a background. Link preview title and description are available only for filled backgrounds +type LinkPreviewTypeBackground struct { + meta + // Document with the background; may be null for filled backgrounds + Document *Document `json:"document"` + // Type of the background; may be null if unknown + BackgroundType BackgroundType `json:"background_type"` +} + +func (entity *LinkPreviewTypeBackground) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeBackground + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeBackground) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeBackground) GetType() string { + return TypeLinkPreviewTypeBackground +} + +func (*LinkPreviewTypeBackground) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeBackground +} + +func (linkPreviewTypeBackground *LinkPreviewTypeBackground) UnmarshalJSON(data []byte) error { + var tmp struct { + Document *Document `json:"document"` + BackgroundType json.RawMessage `json:"background_type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + linkPreviewTypeBackground.Document = tmp.Document + + fieldBackgroundType, _ := UnmarshalBackgroundType(tmp.BackgroundType) + linkPreviewTypeBackground.BackgroundType = fieldBackgroundType + + return nil +} + +// The link is a link to boost a channel chat +type LinkPreviewTypeChannelBoost struct { + meta + // Photo of the chat; may be null + Photo *ChatPhoto `json:"photo"` +} + +func (entity *LinkPreviewTypeChannelBoost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeChannelBoost + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeChannelBoost) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeChannelBoost) GetType() string { + return TypeLinkPreviewTypeChannelBoost +} + +func (*LinkPreviewTypeChannelBoost) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeChannelBoost +} + +// The link is a link to a chat +type LinkPreviewTypeChat struct { + meta + // Type of the chat + Type InviteLinkChatType `json:"type"` + // Photo of the chat; may be null + Photo *ChatPhoto `json:"photo"` + // True, if the link only creates join request + CreatesJoinRequest bool `json:"creates_join_request"` +} + +func (entity *LinkPreviewTypeChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeChat + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeChat) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeChat) GetType() string { + return TypeLinkPreviewTypeChat +} + +func (*LinkPreviewTypeChat) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeChat +} + +func (linkPreviewTypeChat *LinkPreviewTypeChat) UnmarshalJSON(data []byte) error { + var tmp struct { + Type json.RawMessage `json:"type"` + Photo *ChatPhoto `json:"photo"` + CreatesJoinRequest bool `json:"creates_join_request"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + linkPreviewTypeChat.Photo = tmp.Photo + linkPreviewTypeChat.CreatesJoinRequest = tmp.CreatesJoinRequest + + fieldType, _ := UnmarshalInviteLinkChatType(tmp.Type) + linkPreviewTypeChat.Type = fieldType + + return nil +} + +// The link is a link to a direct messages chat of a channel +type LinkPreviewTypeDirectMessagesChat struct { + meta + // Photo of the channel chat; may be null + Photo *ChatPhoto `json:"photo"` +} + +func (entity *LinkPreviewTypeDirectMessagesChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeDirectMessagesChat + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeDirectMessagesChat) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeDirectMessagesChat) GetType() string { + return TypeLinkPreviewTypeDirectMessagesChat +} + +func (*LinkPreviewTypeDirectMessagesChat) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeDirectMessagesChat +} + +// The link is a link to a general file +type LinkPreviewTypeDocument struct { + meta + // The document description + Document *Document `json:"document"` +} + +func (entity *LinkPreviewTypeDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeDocument + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeDocument) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeDocument) GetType() string { + return TypeLinkPreviewTypeDocument +} + +func (*LinkPreviewTypeDocument) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeDocument +} + +// The link is a link to an animation player +type LinkPreviewTypeEmbeddedAnimationPlayer struct { + meta + // URL of the external animation player + Url string `json:"url"` + // Thumbnail of the animation; may be null if unknown + Thumbnail *Photo `json:"thumbnail"` + // Duration of the animation, in seconds + Duration int32 `json:"duration"` + // Expected width of the embedded player + Width int32 `json:"width"` + // Expected height of the embedded player + Height int32 `json:"height"` +} + +func (entity *LinkPreviewTypeEmbeddedAnimationPlayer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeEmbeddedAnimationPlayer + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeEmbeddedAnimationPlayer) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeEmbeddedAnimationPlayer) GetType() string { + return TypeLinkPreviewTypeEmbeddedAnimationPlayer +} + +func (*LinkPreviewTypeEmbeddedAnimationPlayer) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeEmbeddedAnimationPlayer +} + +// The link is a link to an audio player +type LinkPreviewTypeEmbeddedAudioPlayer struct { + meta + // URL of the external audio player + Url string `json:"url"` + // Thumbnail of the audio; may be null if unknown + Thumbnail *Photo `json:"thumbnail"` + // Duration of the audio, in seconds + Duration int32 `json:"duration"` + // Expected width of the embedded player + Width int32 `json:"width"` + // Expected height of the embedded player + Height int32 `json:"height"` +} + +func (entity *LinkPreviewTypeEmbeddedAudioPlayer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeEmbeddedAudioPlayer + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeEmbeddedAudioPlayer) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeEmbeddedAudioPlayer) GetType() string { + return TypeLinkPreviewTypeEmbeddedAudioPlayer +} + +func (*LinkPreviewTypeEmbeddedAudioPlayer) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeEmbeddedAudioPlayer +} + +// The link is a link to a video player +type LinkPreviewTypeEmbeddedVideoPlayer struct { + meta + // URL of the external video player + Url string `json:"url"` + // Thumbnail of the video; may be null if unknown + Thumbnail *Photo `json:"thumbnail"` + // Duration of the video, in seconds + Duration int32 `json:"duration"` + // Expected width of the embedded player + Width int32 `json:"width"` + // Expected height of the embedded player + Height int32 `json:"height"` +} + +func (entity *LinkPreviewTypeEmbeddedVideoPlayer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeEmbeddedVideoPlayer + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeEmbeddedVideoPlayer) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeEmbeddedVideoPlayer) GetType() string { + return TypeLinkPreviewTypeEmbeddedVideoPlayer +} + +func (*LinkPreviewTypeEmbeddedVideoPlayer) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeEmbeddedVideoPlayer +} + +// The link is a link to an audio file +type LinkPreviewTypeExternalAudio struct { + meta + // URL of the audio file + Url string `json:"url"` + // MIME type of the audio file + MimeType string `json:"mime_type"` + // Duration of the audio, in seconds; 0 if unknown + Duration int32 `json:"duration"` +} + +func (entity *LinkPreviewTypeExternalAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeExternalAudio + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeExternalAudio) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeExternalAudio) GetType() string { + return TypeLinkPreviewTypeExternalAudio +} + +func (*LinkPreviewTypeExternalAudio) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeExternalAudio +} + +// The link is a link to a video file +type LinkPreviewTypeExternalVideo struct { + meta + // URL of the video file + Url string `json:"url"` + // MIME type of the video file + MimeType string `json:"mime_type"` + // Expected width of the video preview; 0 if unknown + Width int32 `json:"width"` + // Expected height of the video preview; 0 if unknown + Height int32 `json:"height"` + // Duration of the video, in seconds; 0 if unknown + Duration int32 `json:"duration"` +} + +func (entity *LinkPreviewTypeExternalVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeExternalVideo + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeExternalVideo) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeExternalVideo) GetType() string { + return TypeLinkPreviewTypeExternalVideo +} + +func (*LinkPreviewTypeExternalVideo) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeExternalVideo +} + +// The link is a link to a gift auction +type LinkPreviewTypeGiftAuction struct { + meta + // The gift + Gift *Gift `json:"gift"` + // Point in time (Unix timestamp) when the auction will be ended + AuctionEndDate int32 `json:"auction_end_date"` +} + +func (entity *LinkPreviewTypeGiftAuction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeGiftAuction + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeGiftAuction) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeGiftAuction) GetType() string { + return TypeLinkPreviewTypeGiftAuction +} + +func (*LinkPreviewTypeGiftAuction) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeGiftAuction +} + +// The link is a link to a gift collection +type LinkPreviewTypeGiftCollection struct { + meta + // Icons for some gifts from the collection; may be empty + Icons []*Sticker `json:"icons"` +} + +func (entity *LinkPreviewTypeGiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeGiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeGiftCollection) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeGiftCollection) GetType() string { + return TypeLinkPreviewTypeGiftCollection +} + +func (*LinkPreviewTypeGiftCollection) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeGiftCollection +} + +// The link is a link to a group call that isn't bound to a chat +type LinkPreviewTypeGroupCall struct{ + meta +} + +func (entity *LinkPreviewTypeGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeGroupCall) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeGroupCall) GetType() string { + return TypeLinkPreviewTypeGroupCall +} + +func (*LinkPreviewTypeGroupCall) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeGroupCall +} + +// The link is a link to an invoice +type LinkPreviewTypeInvoice struct{ + meta +} + +func (entity *LinkPreviewTypeInvoice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeInvoice + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeInvoice) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeInvoice) GetType() string { + return TypeLinkPreviewTypeInvoice +} + +func (*LinkPreviewTypeInvoice) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeInvoice +} + +// The link is a link to a live story group call +type LinkPreviewTypeLiveStory struct { + meta + // The identifier of the chat that posted the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` + // Story identifier + StoryId int32 `json:"story_id"` +} + +func (entity *LinkPreviewTypeLiveStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeLiveStory + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeLiveStory) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeLiveStory) GetType() string { + return TypeLinkPreviewTypeLiveStory +} + +func (*LinkPreviewTypeLiveStory) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeLiveStory +} + +// The link is a link to a text or a poll Telegram message +type LinkPreviewTypeMessage struct{ + meta +} + +func (entity *LinkPreviewTypeMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeMessage + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeMessage) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeMessage) GetType() string { + return TypeLinkPreviewTypeMessage +} + +func (*LinkPreviewTypeMessage) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeMessage +} + +// The link is a link to a photo +type LinkPreviewTypePhoto struct { + meta + // The photo + Photo *Photo `json:"photo"` +} + +func (entity *LinkPreviewTypePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypePhoto) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypePhoto) GetType() string { + return TypeLinkPreviewTypePhoto +} + +func (*LinkPreviewTypePhoto) LinkPreviewTypeType() string { + return TypeLinkPreviewTypePhoto +} + +// The link is a link to a Telegram Premium gift code +type LinkPreviewTypePremiumGiftCode struct{ + meta +} + +func (entity *LinkPreviewTypePremiumGiftCode) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypePremiumGiftCode + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypePremiumGiftCode) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypePremiumGiftCode) GetType() string { + return TypeLinkPreviewTypePremiumGiftCode +} + +func (*LinkPreviewTypePremiumGiftCode) LinkPreviewTypeType() string { + return TypeLinkPreviewTypePremiumGiftCode +} + +// The link is a link to a shareable chat folder +type LinkPreviewTypeShareableChatFolder struct{ + meta +} + +func (entity *LinkPreviewTypeShareableChatFolder) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeShareableChatFolder + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeShareableChatFolder) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeShareableChatFolder) GetType() string { + return TypeLinkPreviewTypeShareableChatFolder +} + +func (*LinkPreviewTypeShareableChatFolder) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeShareableChatFolder +} + +// The link is a link to a sticker +type LinkPreviewTypeSticker struct { + meta + // The sticker. It can be an arbitrary WEBP image and can have dimensions bigger than 512 + Sticker *Sticker `json:"sticker"` +} + +func (entity *LinkPreviewTypeSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeSticker + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeSticker) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeSticker) GetType() string { + return TypeLinkPreviewTypeSticker +} + +func (*LinkPreviewTypeSticker) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeSticker +} + +// The link is a link to a sticker set +type LinkPreviewTypeStickerSet struct { + meta + // Up to 4 stickers from the sticker set + Stickers []*Sticker `json:"stickers"` +} + +func (entity *LinkPreviewTypeStickerSet) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeStickerSet + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeStickerSet) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeStickerSet) GetType() string { + return TypeLinkPreviewTypeStickerSet +} + +func (*LinkPreviewTypeStickerSet) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeStickerSet +} + +// The link is a link to a story. Link preview description is unavailable +type LinkPreviewTypeStory struct { + meta + // The identifier of the chat that posted the story + StoryPosterChatId int64 `json:"story_poster_chat_id"` + // Story identifier + StoryId int32 `json:"story_id"` +} + +func (entity *LinkPreviewTypeStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeStory + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeStory) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeStory) GetType() string { + return TypeLinkPreviewTypeStory +} + +func (*LinkPreviewTypeStory) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeStory +} + +// The link is a link to an album of stories +type LinkPreviewTypeStoryAlbum struct { + meta + // Icon of the album; may be null if none + PhotoIcon *Photo `json:"photo_icon"` + // Video icon of the album; may be null if none + VideoIcon *Video `json:"video_icon"` +} + +func (entity *LinkPreviewTypeStoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeStoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeStoryAlbum) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeStoryAlbum) GetType() string { + return TypeLinkPreviewTypeStoryAlbum +} + +func (*LinkPreviewTypeStoryAlbum) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeStoryAlbum +} + +// The link is a link to boost a supergroup chat +type LinkPreviewTypeSupergroupBoost struct { + meta + // Photo of the chat; may be null + Photo *ChatPhoto `json:"photo"` +} + +func (entity *LinkPreviewTypeSupergroupBoost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeSupergroupBoost + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeSupergroupBoost) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeSupergroupBoost) GetType() string { + return TypeLinkPreviewTypeSupergroupBoost +} + +func (*LinkPreviewTypeSupergroupBoost) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeSupergroupBoost +} + +// The link is a link to a cloud theme. TDLib has no theme support yet +type LinkPreviewTypeTheme struct { + meta + // The list of files with theme description + Documents []*Document `json:"documents"` + // Settings for the cloud theme; may be null if unknown + Settings *ThemeSettings `json:"settings"` +} + +func (entity *LinkPreviewTypeTheme) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeTheme + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeTheme) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeTheme) GetType() string { + return TypeLinkPreviewTypeTheme +} + +func (*LinkPreviewTypeTheme) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeTheme +} + +// The link preview type is unsupported yet +type LinkPreviewTypeUnsupported struct{ + meta +} + +func (entity *LinkPreviewTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeUnsupported) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeUnsupported) GetType() string { + return TypeLinkPreviewTypeUnsupported +} + +func (*LinkPreviewTypeUnsupported) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeUnsupported +} + +// The link is a link to an upgraded gift +type LinkPreviewTypeUpgradedGift struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` +} + +func (entity *LinkPreviewTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeUpgradedGift) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeUpgradedGift) GetType() string { + return TypeLinkPreviewTypeUpgradedGift +} + +func (*LinkPreviewTypeUpgradedGift) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeUpgradedGift +} + +// The link is a link to a user +type LinkPreviewTypeUser struct { + meta + // Photo of the user; may be null if none + Photo *ChatPhoto `json:"photo"` + // True, if the user is a bot + IsBot bool `json:"is_bot"` +} + +func (entity *LinkPreviewTypeUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeUser + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeUser) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeUser) GetType() string { + return TypeLinkPreviewTypeUser +} + +func (*LinkPreviewTypeUser) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeUser +} + +// The link is a link to a video +type LinkPreviewTypeVideo struct { + meta + // The video description + Video *Video `json:"video"` + // Cover of the video; may be null if none + Cover *Photo `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` +} + +func (entity *LinkPreviewTypeVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeVideo + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeVideo) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeVideo) GetType() string { + return TypeLinkPreviewTypeVideo +} + +func (*LinkPreviewTypeVideo) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeVideo +} + +// The link is a link to a video chat +type LinkPreviewTypeVideoChat struct { + meta + // Photo of the chat with the video chat; may be null if none + Photo *ChatPhoto `json:"photo"` + // True, if the video chat is expected to be a live stream in a channel or a broadcast group + IsLiveStream bool `json:"is_live_stream"` + // True, if the user can use the link to join the video chat without being muted by administrators + JoinsAsSpeaker bool `json:"joins_as_speaker"` +} + +func (entity *LinkPreviewTypeVideoChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeVideoChat + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeVideoChat) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeVideoChat) GetType() string { + return TypeLinkPreviewTypeVideoChat +} + +func (*LinkPreviewTypeVideoChat) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeVideoChat +} + +// The link is a link to a video note message +type LinkPreviewTypeVideoNote struct { + meta + // The video note + VideoNote *VideoNote `json:"video_note"` +} + +func (entity *LinkPreviewTypeVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeVideoNote) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeVideoNote) GetType() string { + return TypeLinkPreviewTypeVideoNote +} + +func (*LinkPreviewTypeVideoNote) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeVideoNote +} + +// The link is a link to a voice note message +type LinkPreviewTypeVoiceNote struct { + meta + // The voice note + VoiceNote *VoiceNote `json:"voice_note"` +} + +func (entity *LinkPreviewTypeVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeVoiceNote) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeVoiceNote) GetType() string { + return TypeLinkPreviewTypeVoiceNote +} + +func (*LinkPreviewTypeVoiceNote) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeVoiceNote +} + +// The link is a link to a Web App +type LinkPreviewTypeWebApp struct { + meta + // Web App photo; may be null if none + Photo *Photo `json:"photo"` +} + +func (entity *LinkPreviewTypeWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LinkPreviewTypeWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*LinkPreviewTypeWebApp) GetClass() string { + return ClassLinkPreviewType +} + +func (*LinkPreviewTypeWebApp) GetType() string { + return TypeLinkPreviewTypeWebApp +} + +func (*LinkPreviewTypeWebApp) LinkPreviewTypeType() string { + return TypeLinkPreviewTypeWebApp +} + // Describes a link preview -type WebPage struct { +type LinkPreview struct { meta // Original URL of the link Url string `json:"url"` // URL to display DisplayUrl string `json:"display_url"` - // Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else - Type string `json:"type"` // Short name of the site (e.g., Google Docs, App Store) SiteName string `json:"site_name"` // Title of the content Title string `json:"title"` // Description of the content Description *FormattedText `json:"description"` - // Image representing the content; may be null - Photo *Photo `json:"photo"` - // URL to show in the embedded preview - EmbedUrl string `json:"embed_url"` - // MIME type of the embedded preview, (e.g., text/html or video/mp4) - EmbedType string `json:"embed_type"` - // Width of the embedded preview - EmbedWidth int32 `json:"embed_width"` - // Height of the embedded preview - EmbedHeight int32 `json:"embed_height"` - // Duration of the content, in seconds - Duration int32 `json:"duration"` // Author of the content Author string `json:"author"` - // True, if the preview has large media and its appearance can be changed + // Type of the link preview + Type LinkPreviewType `json:"type"` + // True, if size of media in the preview can be changed HasLargeMedia bool `json:"has_large_media"` - // True, if large media preview must be shown + // True, if large media preview must be shown; otherwise, the media preview must be shown small and only the first frame must be shown for videos ShowLargeMedia bool `json:"show_large_media"` + // True, if media must be shown above link preview description; otherwise, the media must be shown below the description + ShowMediaAboveDescription bool `json:"show_media_above_description"` // True, if there is no need to show an ordinary open URL confirmation, when opening the URL from the preview, because the URL is shown in the message text in clear SkipConfirmation bool `json:"skip_confirmation"` // True, if the link preview must be shown above message text; otherwise, the link preview must be shown below the message text ShowAboveText bool `json:"show_above_text"` - // Preview of the content as an animation, if available; may be null - Animation *Animation `json:"animation"` - // Preview of the content as an audio file, if available; may be null - Audio *Audio `json:"audio"` - // Preview of the content as a document, if available; may be null - Document *Document `json:"document"` - // Preview of the content as a sticker for small WEBP files, if available; may be null - Sticker *Sticker `json:"sticker"` - // Preview of the content as a video, if available; may be null - Video *Video `json:"video"` - // Preview of the content as a video note, if available; may be null - VideoNote *VideoNote `json:"video_note"` - // Preview of the content as a voice note, if available; may be null - VoiceNote *VoiceNote `json:"voice_note"` - // The identifier of the sender of the previewed story; 0 if none - StorySenderChatId int64 `json:"story_sender_chat_id"` - // The identifier of the previewed story; 0 if none - StoryId int32 `json:"story_id"` - // Version of web page instant view (currently, can be 1 or 2); 0 if none + // Version of instant view (currently, can be 1 or 2) for the web page; 0 if none InstantViewVersion int32 `json:"instant_view_version"` } -func (entity *WebPage) MarshalJSON() ([]byte, error) { +func (entity *LinkPreview) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub WebPage + type stub LinkPreview return json.Marshal((*stub)(entity)) } -func (*WebPage) GetClass() string { - return ClassWebPage +func (*LinkPreview) GetClass() string { + return ClassLinkPreview } -func (*WebPage) GetType() string { - return TypeWebPage +func (*LinkPreview) GetType() string { + return TypeLinkPreview +} + +func (linkPreview *LinkPreview) UnmarshalJSON(data []byte) error { + var tmp struct { + Url string `json:"url"` + DisplayUrl string `json:"display_url"` + SiteName string `json:"site_name"` + Title string `json:"title"` + Description *FormattedText `json:"description"` + Author string `json:"author"` + Type json.RawMessage `json:"type"` + HasLargeMedia bool `json:"has_large_media"` + ShowLargeMedia bool `json:"show_large_media"` + ShowMediaAboveDescription bool `json:"show_media_above_description"` + SkipConfirmation bool `json:"skip_confirmation"` + ShowAboveText bool `json:"show_above_text"` + InstantViewVersion int32 `json:"instant_view_version"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + linkPreview.Url = tmp.Url + linkPreview.DisplayUrl = tmp.DisplayUrl + linkPreview.SiteName = tmp.SiteName + linkPreview.Title = tmp.Title + linkPreview.Description = tmp.Description + linkPreview.Author = tmp.Author + linkPreview.HasLargeMedia = tmp.HasLargeMedia + linkPreview.ShowLargeMedia = tmp.ShowLargeMedia + linkPreview.ShowMediaAboveDescription = tmp.ShowMediaAboveDescription + linkPreview.SkipConfirmation = tmp.SkipConfirmation + linkPreview.ShowAboveText = tmp.ShowAboveText + linkPreview.InstantViewVersion = tmp.InstantViewVersion + + fieldType, _ := UnmarshalLinkPreviewType(tmp.Type) + linkPreview.Type = fieldType + + return nil } // Contains information about a country @@ -15143,7 +27455,7 @@ type PhoneNumberInfo struct { CountryCallingCode string `json:"country_calling_code"` // The phone number without country calling code formatted accordingly to local rules. Expected digits are returned as '-', but even more digits might be entered by the user FormattedPhoneNumber string `json:"formatted_phone_number"` - // True, if the phone number was bought on Fragment and isn't tied to a SIM card + // True, if the phone number was bought at https://fragment.com and isn't tied to a SIM card. Information about the phone number can be received using getCollectibleItemInfo IsAnonymous bool `json:"is_anonymous"` } @@ -15163,6 +27475,93 @@ func (*PhoneNumberInfo) GetType() string { return TypePhoneNumberInfo } +// A username +type CollectibleItemTypeUsername struct { + meta + // The username + Username string `json:"username"` +} + +func (entity *CollectibleItemTypeUsername) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CollectibleItemTypeUsername + + return json.Marshal((*stub)(entity)) +} + +func (*CollectibleItemTypeUsername) GetClass() string { + return ClassCollectibleItemType +} + +func (*CollectibleItemTypeUsername) GetType() string { + return TypeCollectibleItemTypeUsername +} + +func (*CollectibleItemTypeUsername) CollectibleItemTypeType() string { + return TypeCollectibleItemTypeUsername +} + +// A phone number +type CollectibleItemTypePhoneNumber struct { + meta + // The phone number + PhoneNumber string `json:"phone_number"` +} + +func (entity *CollectibleItemTypePhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CollectibleItemTypePhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*CollectibleItemTypePhoneNumber) GetClass() string { + return ClassCollectibleItemType +} + +func (*CollectibleItemTypePhoneNumber) GetType() string { + return TypeCollectibleItemTypePhoneNumber +} + +func (*CollectibleItemTypePhoneNumber) CollectibleItemTypeType() string { + return TypeCollectibleItemTypePhoneNumber +} + +// Contains information about a collectible item and its last purchase +type CollectibleItemInfo struct { + meta + // Point in time (Unix timestamp) when the item was purchased + PurchaseDate int32 `json:"purchase_date"` + // Currency for the paid amount + Currency string `json:"currency"` + // The paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Cryptocurrency used to pay for the item + Cryptocurrency string `json:"cryptocurrency"` + // The paid amount, in the smallest units of the cryptocurrency + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` + // Individual URL for the item on https://fragment.com + Url string `json:"url"` +} + +func (entity *CollectibleItemInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CollectibleItemInfo + + return json.Marshal((*stub)(entity)) +} + +func (*CollectibleItemInfo) GetClass() string { + return ClassCollectibleItemInfo +} + +func (*CollectibleItemInfo) GetType() string { + return TypeCollectibleItemInfo +} + // Describes an action associated with a bank card number type BankCardActionOpenUrl struct { meta @@ -15246,51 +27645,33 @@ func (*Address) GetType() string { return TypeAddress } -// Contains parameters of the application theme -type ThemeParameters struct { +// Describes an address of a location +type LocationAddress struct { meta - // A color of the background in the RGB24 format - BackgroundColor int32 `json:"background_color"` - // A secondary color for the background in the RGB24 format - SecondaryBackgroundColor int32 `json:"secondary_background_color"` - // A color of the header background in the RGB24 format - HeaderBackgroundColor int32 `json:"header_background_color"` - // A color of the section background in the RGB24 format - SectionBackgroundColor int32 `json:"section_background_color"` - // A color of text in the RGB24 format - TextColor int32 `json:"text_color"` - // An accent color of the text in the RGB24 format - AccentTextColor int32 `json:"accent_text_color"` - // A color of text on the section headers in the RGB24 format - SectionHeaderTextColor int32 `json:"section_header_text_color"` - // A color of the subtitle text in the RGB24 format - SubtitleTextColor int32 `json:"subtitle_text_color"` - // A color of the text for destructive actions in the RGB24 format - DestructiveTextColor int32 `json:"destructive_text_color"` - // A color of hints in the RGB24 format - HintColor int32 `json:"hint_color"` - // A color of links in the RGB24 format - LinkColor int32 `json:"link_color"` - // A color of the buttons in the RGB24 format - ButtonColor int32 `json:"button_color"` - // A color of text on the buttons in the RGB24 format - ButtonTextColor int32 `json:"button_text_color"` + // A two-letter ISO 3166-1 alpha-2 country code + CountryCode string `json:"country_code"` + // State, if applicable; empty if unknown + State string `json:"state"` + // City; empty if unknown + City string `json:"city"` + // The address; empty if unknown + Street string `json:"street"` } -func (entity *ThemeParameters) MarshalJSON() ([]byte, error) { +func (entity *LocationAddress) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ThemeParameters + type stub LocationAddress return json.Marshal((*stub)(entity)) } -func (*ThemeParameters) GetClass() string { - return ClassThemeParameters +func (*LocationAddress) GetClass() string { + return ClassLocationAddress } -func (*ThemeParameters) GetType() string { - return TypeThemeParameters +func (*LocationAddress) GetType() string { + return TypeLocationAddress } // Portion of the price of a product (e.g., "delivery cost", "tax amount") @@ -15325,6 +27706,8 @@ type Invoice struct { Currency string `json:"currency"` // A list of objects used to calculate the total price of the product PriceParts []*LabeledPricePart `json:"price_parts"` + // The number of seconds between consecutive Telegram Star debiting for subscription invoices; 0 if the invoice doesn't create subscription + SubscriptionPeriod int32 `json:"subscription_period"` // The maximum allowed amount of tip in the smallest units of the currency MaxTipAmount int64 `json:"max_tip_amount"` // Suggested amounts of tip in the smallest units of the currency @@ -15563,6 +27946,8 @@ type PaymentProviderSmartGlocal struct { meta // Public payment token PublicToken string `json:"public_token"` + // URL for sending card tokenization requests + TokenizeUrl string `json:"tokenize_url"` } func (entity *PaymentProviderSmartGlocal) MarshalJSON() ([]byte, error) { @@ -15670,15 +28055,11 @@ func (*PaymentOption) GetType() string { return TypePaymentOption } -// Contains information about an invoice payment form -type PaymentForm struct { +// The payment form is for a regular payment +type PaymentFormTypeRegular struct { meta - // The payment form identifier - Id JsonInt64 `json:"id"` // Full information about the invoice Invoice *Invoice `json:"invoice"` - // User identifier of the seller bot - SellerBotUserId int64 `json:"seller_bot_user_id"` // User identifier of the payment provider bot PaymentProviderUserId int64 `json:"payment_provider_user_id"` // Information about the payment provider @@ -15693,12 +28074,124 @@ type PaymentForm struct { CanSaveCredentials bool `json:"can_save_credentials"` // True, if the user will be able to save credentials, if sets up a 2-step verification password NeedPassword bool `json:"need_password"` - // Product title - ProductTitle string `json:"product_title"` - // Product description - ProductDescription *FormattedText `json:"product_description"` - // Product photo; may be null - ProductPhoto *Photo `json:"product_photo"` +} + +func (entity *PaymentFormTypeRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentFormTypeRegular + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentFormTypeRegular) GetClass() string { + return ClassPaymentFormType +} + +func (*PaymentFormTypeRegular) GetType() string { + return TypePaymentFormTypeRegular +} + +func (*PaymentFormTypeRegular) PaymentFormTypeType() string { + return TypePaymentFormTypeRegular +} + +func (paymentFormTypeRegular *PaymentFormTypeRegular) UnmarshalJSON(data []byte) error { + var tmp struct { + Invoice *Invoice `json:"invoice"` + PaymentProviderUserId int64 `json:"payment_provider_user_id"` + PaymentProvider json.RawMessage `json:"payment_provider"` + AdditionalPaymentOptions []*PaymentOption `json:"additional_payment_options"` + SavedOrderInfo *OrderInfo `json:"saved_order_info"` + SavedCredentials []*SavedCredentials `json:"saved_credentials"` + CanSaveCredentials bool `json:"can_save_credentials"` + NeedPassword bool `json:"need_password"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + paymentFormTypeRegular.Invoice = tmp.Invoice + paymentFormTypeRegular.PaymentProviderUserId = tmp.PaymentProviderUserId + paymentFormTypeRegular.AdditionalPaymentOptions = tmp.AdditionalPaymentOptions + paymentFormTypeRegular.SavedOrderInfo = tmp.SavedOrderInfo + paymentFormTypeRegular.SavedCredentials = tmp.SavedCredentials + paymentFormTypeRegular.CanSaveCredentials = tmp.CanSaveCredentials + paymentFormTypeRegular.NeedPassword = tmp.NeedPassword + + fieldPaymentProvider, _ := UnmarshalPaymentProvider(tmp.PaymentProvider) + paymentFormTypeRegular.PaymentProvider = fieldPaymentProvider + + return nil +} + +// The payment form is for a payment in Telegram Stars +type PaymentFormTypeStars struct { + meta + // Number of Telegram Stars that will be paid + StarCount int64 `json:"star_count"` +} + +func (entity *PaymentFormTypeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentFormTypeStars + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentFormTypeStars) GetClass() string { + return ClassPaymentFormType +} + +func (*PaymentFormTypeStars) GetType() string { + return TypePaymentFormTypeStars +} + +func (*PaymentFormTypeStars) PaymentFormTypeType() string { + return TypePaymentFormTypeStars +} + +// The payment form is for a payment in Telegram Stars for subscription +type PaymentFormTypeStarSubscription struct { + meta + // Information about subscription plan + Pricing *StarSubscriptionPricing `json:"pricing"` +} + +func (entity *PaymentFormTypeStarSubscription) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentFormTypeStarSubscription + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentFormTypeStarSubscription) GetClass() string { + return ClassPaymentFormType +} + +func (*PaymentFormTypeStarSubscription) GetType() string { + return TypePaymentFormTypeStarSubscription +} + +func (*PaymentFormTypeStarSubscription) PaymentFormTypeType() string { + return TypePaymentFormTypeStarSubscription +} + +// Contains information about an invoice payment form +type PaymentForm struct { + meta + // The payment form identifier + Id JsonInt64 `json:"id"` + // Type of the payment form + Type PaymentFormType `json:"type"` + // User identifier of the seller bot + SellerBotUserId int64 `json:"seller_bot_user_id"` + // Information about the product + ProductInfo *ProductInfo `json:"product_info"` } func (entity *PaymentForm) MarshalJSON() ([]byte, error) { @@ -15720,18 +28213,9 @@ func (*PaymentForm) GetType() string { func (paymentForm *PaymentForm) UnmarshalJSON(data []byte) error { var tmp struct { Id JsonInt64 `json:"id"` - Invoice *Invoice `json:"invoice"` + Type json.RawMessage `json:"type"` SellerBotUserId int64 `json:"seller_bot_user_id"` - PaymentProviderUserId int64 `json:"payment_provider_user_id"` - PaymentProvider json.RawMessage `json:"payment_provider"` - AdditionalPaymentOptions []*PaymentOption `json:"additional_payment_options"` - SavedOrderInfo *OrderInfo `json:"saved_order_info"` - SavedCredentials []*SavedCredentials `json:"saved_credentials"` - CanSaveCredentials bool `json:"can_save_credentials"` - NeedPassword bool `json:"need_password"` - ProductTitle string `json:"product_title"` - ProductDescription *FormattedText `json:"product_description"` - ProductPhoto *Photo `json:"product_photo"` + ProductInfo *ProductInfo `json:"product_info"` } err := json.Unmarshal(data, &tmp) @@ -15740,20 +28224,11 @@ func (paymentForm *PaymentForm) UnmarshalJSON(data []byte) error { } paymentForm.Id = tmp.Id - paymentForm.Invoice = tmp.Invoice paymentForm.SellerBotUserId = tmp.SellerBotUserId - paymentForm.PaymentProviderUserId = tmp.PaymentProviderUserId - paymentForm.AdditionalPaymentOptions = tmp.AdditionalPaymentOptions - paymentForm.SavedOrderInfo = tmp.SavedOrderInfo - paymentForm.SavedCredentials = tmp.SavedCredentials - paymentForm.CanSaveCredentials = tmp.CanSaveCredentials - paymentForm.NeedPassword = tmp.NeedPassword - paymentForm.ProductTitle = tmp.ProductTitle - paymentForm.ProductDescription = tmp.ProductDescription - paymentForm.ProductPhoto = tmp.ProductPhoto + paymentForm.ProductInfo = tmp.ProductInfo - fieldPaymentProvider, _ := UnmarshalPaymentProvider(tmp.PaymentProvider) - paymentForm.PaymentProvider = fieldPaymentProvider + fieldType, _ := UnmarshalPaymentFormType(tmp.Type) + paymentForm.Type = fieldType return nil } @@ -15808,19 +28283,9 @@ func (*PaymentResult) GetType() string { return TypePaymentResult } -// Contains information about a successful payment -type PaymentReceipt struct { +// The payment was done using a third-party payment provider +type PaymentReceiptTypeRegular struct { meta - // Product title - Title string `json:"title"` - // Product description - Description *FormattedText `json:"description"` - // Product photo; may be null - Photo *Photo `json:"photo"` - // Point in time (Unix timestamp) when the payment was made - Date int32 `json:"date"` - // User identifier of the seller bot - SellerBotUserId int64 `json:"seller_bot_user_id"` // User identifier of the payment provider bot PaymentProviderUserId int64 `json:"payment_provider_user_id"` // Information about the invoice @@ -15835,6 +28300,68 @@ type PaymentReceipt struct { TipAmount int64 `json:"tip_amount"` } +func (entity *PaymentReceiptTypeRegular) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentReceiptTypeRegular + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentReceiptTypeRegular) GetClass() string { + return ClassPaymentReceiptType +} + +func (*PaymentReceiptTypeRegular) GetType() string { + return TypePaymentReceiptTypeRegular +} + +func (*PaymentReceiptTypeRegular) PaymentReceiptTypeType() string { + return TypePaymentReceiptTypeRegular +} + +// The payment was done using Telegram Stars +type PaymentReceiptTypeStars struct { + meta + // Number of Telegram Stars that were paid + StarCount int64 `json:"star_count"` + // Unique identifier of the transaction that can be used to dispute it + TransactionId string `json:"transaction_id"` +} + +func (entity *PaymentReceiptTypeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PaymentReceiptTypeStars + + return json.Marshal((*stub)(entity)) +} + +func (*PaymentReceiptTypeStars) GetClass() string { + return ClassPaymentReceiptType +} + +func (*PaymentReceiptTypeStars) GetType() string { + return TypePaymentReceiptTypeStars +} + +func (*PaymentReceiptTypeStars) PaymentReceiptTypeType() string { + return TypePaymentReceiptTypeStars +} + +// Contains information about a successful payment +type PaymentReceipt struct { + meta + // Information about the product + ProductInfo *ProductInfo `json:"product_info"` + // Point in time (Unix timestamp) when the payment was made + Date int32 `json:"date"` + // User identifier of the seller bot + SellerBotUserId int64 `json:"seller_bot_user_id"` + // Type of the payment receipt + Type PaymentReceiptType `json:"type"` +} + func (entity *PaymentReceipt) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() @@ -15851,12 +28378,35 @@ func (*PaymentReceipt) GetType() string { return TypePaymentReceipt } -// An invoice from a message of the type messageInvoice +func (paymentReceipt *PaymentReceipt) UnmarshalJSON(data []byte) error { + var tmp struct { + ProductInfo *ProductInfo `json:"product_info"` + Date int32 `json:"date"` + SellerBotUserId int64 `json:"seller_bot_user_id"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + paymentReceipt.ProductInfo = tmp.ProductInfo + paymentReceipt.Date = tmp.Date + paymentReceipt.SellerBotUserId = tmp.SellerBotUserId + + fieldType, _ := UnmarshalPaymentReceiptType(tmp.Type) + paymentReceipt.Type = fieldType + + return nil +} + +// An invoice from a message of the type messageInvoice or paid media purchase from messagePaidMedia type InputInvoiceMessage struct { meta // Chat identifier of the message ChatId int64 `json:"chat_id"` - // Message identifier + // Message identifier. Use messageProperties.can_be_paid to check whether the message can be used in the method MessageId int64 `json:"message_id"` } @@ -15951,154 +28501,154 @@ func (inputInvoiceTelegram *InputInvoiceTelegram) UnmarshalJSON(data []byte) err } // The media is hidden until the invoice is paid -type MessageExtendedMediaPreview struct { +type PaidMediaPreview struct { meta // Media width; 0 if unknown Width int32 `json:"width"` // Media height; 0 if unknown Height int32 `json:"height"` - // Media duration; 0 if unknown + // Media duration, in seconds; 0 if unknown Duration int32 `json:"duration"` // Media minithumbnail; may be null Minithumbnail *Minithumbnail `json:"minithumbnail"` - // Media caption - Caption *FormattedText `json:"caption"` } -func (entity *MessageExtendedMediaPreview) MarshalJSON() ([]byte, error) { +func (entity *PaidMediaPreview) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageExtendedMediaPreview + type stub PaidMediaPreview return json.Marshal((*stub)(entity)) } -func (*MessageExtendedMediaPreview) GetClass() string { - return ClassMessageExtendedMedia +func (*PaidMediaPreview) GetClass() string { + return ClassPaidMedia } -func (*MessageExtendedMediaPreview) GetType() string { - return TypeMessageExtendedMediaPreview +func (*PaidMediaPreview) GetType() string { + return TypePaidMediaPreview } -func (*MessageExtendedMediaPreview) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaPreview +func (*PaidMediaPreview) PaidMediaType() string { + return TypePaidMediaPreview } // The media is a photo -type MessageExtendedMediaPhoto struct { +type PaidMediaPhoto struct { meta // The photo Photo *Photo `json:"photo"` - // Photo caption - Caption *FormattedText `json:"caption"` } -func (entity *MessageExtendedMediaPhoto) MarshalJSON() ([]byte, error) { +func (entity *PaidMediaPhoto) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageExtendedMediaPhoto + type stub PaidMediaPhoto return json.Marshal((*stub)(entity)) } -func (*MessageExtendedMediaPhoto) GetClass() string { - return ClassMessageExtendedMedia +func (*PaidMediaPhoto) GetClass() string { + return ClassPaidMedia } -func (*MessageExtendedMediaPhoto) GetType() string { - return TypeMessageExtendedMediaPhoto +func (*PaidMediaPhoto) GetType() string { + return TypePaidMediaPhoto } -func (*MessageExtendedMediaPhoto) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaPhoto +func (*PaidMediaPhoto) PaidMediaType() string { + return TypePaidMediaPhoto } // The media is a video -type MessageExtendedMediaVideo struct { +type PaidMediaVideo struct { meta // The video Video *Video `json:"video"` - // Photo caption - Caption *FormattedText `json:"caption"` + // Cover of the video; may be null if none + Cover *Photo `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` } -func (entity *MessageExtendedMediaVideo) MarshalJSON() ([]byte, error) { +func (entity *PaidMediaVideo) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageExtendedMediaVideo + type stub PaidMediaVideo return json.Marshal((*stub)(entity)) } -func (*MessageExtendedMediaVideo) GetClass() string { - return ClassMessageExtendedMedia +func (*PaidMediaVideo) GetClass() string { + return ClassPaidMedia } -func (*MessageExtendedMediaVideo) GetType() string { - return TypeMessageExtendedMediaVideo +func (*PaidMediaVideo) GetType() string { + return TypePaidMediaVideo } -func (*MessageExtendedMediaVideo) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaVideo +func (*PaidMediaVideo) PaidMediaType() string { + return TypePaidMediaVideo } // The media is unsupported -type MessageExtendedMediaUnsupported struct { +type PaidMediaUnsupported struct{ meta - // Media caption - Caption *FormattedText `json:"caption"` } -func (entity *MessageExtendedMediaUnsupported) MarshalJSON() ([]byte, error) { +func (entity *PaidMediaUnsupported) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageExtendedMediaUnsupported + type stub PaidMediaUnsupported return json.Marshal((*stub)(entity)) } -func (*MessageExtendedMediaUnsupported) GetClass() string { - return ClassMessageExtendedMedia +func (*PaidMediaUnsupported) GetClass() string { + return ClassPaidMedia } -func (*MessageExtendedMediaUnsupported) GetType() string { - return TypeMessageExtendedMediaUnsupported +func (*PaidMediaUnsupported) GetType() string { + return TypePaidMediaUnsupported } -func (*MessageExtendedMediaUnsupported) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaUnsupported +func (*PaidMediaUnsupported) PaidMediaType() string { + return TypePaidMediaUnsupported } -// Describes parameters of a Telegram Premium giveaway -type PremiumGiveawayParameters struct { +// Describes parameters of a giveaway +type GiveawayParameters struct { meta - // Identifier of the channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Premium subscription + // Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, or for the specified time. If the chat is a channel, then can_post_messages administrator right is required in the channel, otherwise, the user must be an administrator in the supergroup BoostedChatId int64 `json:"boosted_chat_id"` - // Identifiers of other channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats + // Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats AdditionalChatIds []int64 `json:"additional_chat_ids"` // Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways WinnersSelectionDate int32 `json:"winners_selection_date"` - // True, if only new subscribers of the chats will be eligible for the giveaway + // True, if only new members of the chats will be eligible for the giveaway OnlyNewMembers bool `json:"only_new_members"` - // The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought on Fragment can participate in any giveaway and the country code "FT" must not be specified in the list + // True, if the list of winners of the giveaway will be available to everyone + HasPublicWinners bool `json:"has_public_winners"` + // The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought at https://fragment.com can participate in any giveaway and the country code "FT" must not be specified in the list CountryCodes []string `json:"country_codes"` + // Additional description of the giveaway prize; 0-128 characters + PrizeDescription string `json:"prize_description"` } -func (entity *PremiumGiveawayParameters) MarshalJSON() ([]byte, error) { +func (entity *GiveawayParameters) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumGiveawayParameters + type stub GiveawayParameters return json.Marshal((*stub)(entity)) } -func (*PremiumGiveawayParameters) GetClass() string { - return ClassPremiumGiveawayParameters +func (*GiveawayParameters) GetClass() string { + return ClassGiveawayParameters } -func (*PremiumGiveawayParameters) GetType() string { - return TypePremiumGiveawayParameters +func (*GiveawayParameters) GetType() string { + return TypeGiveawayParameters } // File with the date it was uploaded @@ -18256,8 +30806,8 @@ type MessageText struct { // Text of the message Text *FormattedText `json:"text"` // A link preview attached to the message; may be null - WebPage *WebPage `json:"web_page"` - // Options which was used for generation of the link preview; may be null if default options were used + LinkPreview *LinkPreview `json:"link_preview"` + // Options which were used for generation of the link preview; may be null if default options were used LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options"` } @@ -18288,6 +30838,8 @@ type MessageAnimation struct { Animation *Animation `json:"animation"` // Animation caption Caption *FormattedText `json:"caption"` + // True, if the caption must be shown above the animation; otherwise, the caption must be shown below the animation + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the animation preview must be covered by a spoiler animation HasSpoiler bool `json:"has_spoiler"` // True, if the animation thumbnail must be blurred and the animation must be shown only while tapped @@ -18372,6 +30924,62 @@ func (*MessageDocument) MessageContentType() string { return TypeMessageDocument } +// A message with paid media +type MessagePaidMedia struct { + meta + // Number of Telegram Stars needed to buy access to the media in the message + StarCount int64 `json:"star_count"` + // Information about the media + Media []PaidMedia `json:"media"` + // Media caption + Caption *FormattedText `json:"caption"` + // True, if the caption must be shown above the media; otherwise, the caption must be shown below the media + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` +} + +func (entity *MessagePaidMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePaidMedia + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaidMedia) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaidMedia) GetType() string { + return TypeMessagePaidMedia +} + +func (*MessagePaidMedia) MessageContentType() string { + return TypeMessagePaidMedia +} + +func (messagePaidMedia *MessagePaidMedia) UnmarshalJSON(data []byte) error { + var tmp struct { + StarCount int64 `json:"star_count"` + Media []json.RawMessage `json:"media"` + Caption *FormattedText `json:"caption"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messagePaidMedia.StarCount = tmp.StarCount + messagePaidMedia.Caption = tmp.Caption + messagePaidMedia.ShowCaptionAboveMedia = tmp.ShowCaptionAboveMedia + + fieldMedia, _ := UnmarshalListOfPaidMedia(tmp.Media) + messagePaidMedia.Media = fieldMedia + + return nil +} + // A photo message type MessagePhoto struct { meta @@ -18379,6 +30987,8 @@ type MessagePhoto struct { Photo *Photo `json:"photo"` // Photo caption Caption *FormattedText `json:"caption"` + // True, if the caption must be shown above the photo; otherwise, the caption must be shown below the photo + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the photo preview must be covered by a spoiler animation HasSpoiler bool `json:"has_spoiler"` // True, if the photo must be blurred and must be shown only while tapped @@ -18405,31 +31015,6 @@ func (*MessagePhoto) MessageContentType() string { return TypeMessagePhoto } -// A self-destructed photo message -type MessageExpiredPhoto struct{ - meta -} - -func (entity *MessageExpiredPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageExpiredPhoto - - return json.Marshal((*stub)(entity)) -} - -func (*MessageExpiredPhoto) GetClass() string { - return ClassMessageContent -} - -func (*MessageExpiredPhoto) GetType() string { - return TypeMessageExpiredPhoto -} - -func (*MessageExpiredPhoto) MessageContentType() string { - return TypeMessageExpiredPhoto -} - // A sticker message type MessageSticker struct { meta @@ -18464,8 +31049,18 @@ type MessageVideo struct { meta // The video description Video *Video `json:"video"` + // Alternative qualities of the video + AlternativeVideos []*AlternativeVideo `json:"alternative_videos"` + // Available storyboards for the video + Storyboards []*VideoStoryboard `json:"storyboards"` + // Cover of the video; may be null if none + Cover *Photo `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` // Video caption Caption *FormattedText `json:"caption"` + // True, if the caption must be shown above the video; otherwise, the caption must be shown below the video + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the video preview must be covered by a spoiler animation HasSpoiler bool `json:"has_spoiler"` // True, if the video thumbnail must be blurred and the video must be shown only while tapped @@ -18492,31 +31087,6 @@ func (*MessageVideo) MessageContentType() string { return TypeMessageVideo } -// A self-destructed video message -type MessageExpiredVideo struct{ - meta -} - -func (entity *MessageExpiredVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageExpiredVideo - - return json.Marshal((*stub)(entity)) -} - -func (*MessageExpiredVideo) GetClass() string { - return ClassMessageContent -} - -func (*MessageExpiredVideo) GetType() string { - return TypeMessageExpiredVideo -} - -func (*MessageExpiredVideo) MessageContentType() string { - return TypeMessageExpiredVideo -} - // A video note message type MessageVideoNote struct { meta @@ -18579,14 +31149,114 @@ func (*MessageVoiceNote) MessageContentType() string { return TypeMessageVoiceNote } +// A self-destructed photo message +type MessageExpiredPhoto struct{ + meta +} + +func (entity *MessageExpiredPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExpiredPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExpiredPhoto) GetClass() string { + return ClassMessageContent +} + +func (*MessageExpiredPhoto) GetType() string { + return TypeMessageExpiredPhoto +} + +func (*MessageExpiredPhoto) MessageContentType() string { + return TypeMessageExpiredPhoto +} + +// A self-destructed video message +type MessageExpiredVideo struct{ + meta +} + +func (entity *MessageExpiredVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExpiredVideo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExpiredVideo) GetClass() string { + return ClassMessageContent +} + +func (*MessageExpiredVideo) GetType() string { + return TypeMessageExpiredVideo +} + +func (*MessageExpiredVideo) MessageContentType() string { + return TypeMessageExpiredVideo +} + +// A self-destructed video note message +type MessageExpiredVideoNote struct{ + meta +} + +func (entity *MessageExpiredVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExpiredVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExpiredVideoNote) GetClass() string { + return ClassMessageContent +} + +func (*MessageExpiredVideoNote) GetType() string { + return TypeMessageExpiredVideoNote +} + +func (*MessageExpiredVideoNote) MessageContentType() string { + return TypeMessageExpiredVideoNote +} + +// A self-destructed voice note message +type MessageExpiredVoiceNote struct{ + meta +} + +func (entity *MessageExpiredVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageExpiredVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*MessageExpiredVoiceNote) GetClass() string { + return ClassMessageContent +} + +func (*MessageExpiredVoiceNote) GetType() string { + return TypeMessageExpiredVoiceNote +} + +func (*MessageExpiredVoiceNote) MessageContentType() string { + return TypeMessageExpiredVoiceNote +} + // A message with a location type MessageLocation struct { meta // The location description Location *Location `json:"location"` - // Time relative to the message send date, for which the location can be updated, in seconds + // Time relative to the message send date, for which the location can be updated, in seconds; if 0x7FFFFFFF, then location can be updated forever LivePeriod int32 `json:"live_period"` - // Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes + // Left time for which the location can be updated, in seconds. If 0, then the location can't be updated anymore. The update updateMessageContent is not sent when this field changes ExpiresIn int32 `json:"expires_in"` // For live locations, a direction in which the location moves, in degrees; 1-360. If 0 the direction is unknown Heading int32 `json:"heading"` @@ -18700,13 +31370,13 @@ func (*MessageAnimatedEmoji) MessageContentType() string { // A dice message. The dice value is randomly generated by the server type MessageDice struct { meta - // The animated stickers with the initial dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known + // The animated stickers with the initial dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known InitialState DiceStickers `json:"initial_state"` - // The animated stickers with the final dice animation; may be null if unknown. updateMessageContent will be sent when the sticker became known + // The animated stickers with the final dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known FinalState DiceStickers `json:"final_state"` // Emoji on which the dice throw animation is based Emoji string `json:"emoji"` - // The dice value. If the value is 0, the dice don't have final state yet + // The dice value. If the value is 0, then the dice don't have final state yet Value int32 `json:"value"` // Number of frame after which a success animation like a shower of confetti needs to be shown on updateMessageSendSucceeded SuccessAnimationFrameNumber int32 `json:"success_animation_frame_number"` @@ -18813,11 +31483,73 @@ func (*MessagePoll) MessageContentType() string { return TypeMessagePoll } +// A stake dice message. The dice value is randomly generated by the server +type MessageStakeDice struct { + meta + // The animated stickers with the initial dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known + InitialState DiceStickers `json:"initial_state"` + // The animated stickers with the final dice animation; may be null if unknown. The update updateMessageContent will be sent when the sticker became known + FinalState DiceStickers `json:"final_state"` + // The dice value. If the value is 0, then the dice don't have final state yet + Value int32 `json:"value"` + // The Toncoin amount that was staked; in the smallest units of the currency + StakeToncoinAmount int64 `json:"stake_toncoin_amount"` + // The Toncoin amount that was gained from the roll; in the smallest units of the currency; -1 if the dice don't have final state yet + PrizeToncoinAmount int64 `json:"prize_toncoin_amount"` +} + +func (entity *MessageStakeDice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageStakeDice + + return json.Marshal((*stub)(entity)) +} + +func (*MessageStakeDice) GetClass() string { + return ClassMessageContent +} + +func (*MessageStakeDice) GetType() string { + return TypeMessageStakeDice +} + +func (*MessageStakeDice) MessageContentType() string { + return TypeMessageStakeDice +} + +func (messageStakeDice *MessageStakeDice) UnmarshalJSON(data []byte) error { + var tmp struct { + InitialState json.RawMessage `json:"initial_state"` + FinalState json.RawMessage `json:"final_state"` + Value int32 `json:"value"` + StakeToncoinAmount int64 `json:"stake_toncoin_amount"` + PrizeToncoinAmount int64 `json:"prize_toncoin_amount"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageStakeDice.Value = tmp.Value + messageStakeDice.StakeToncoinAmount = tmp.StakeToncoinAmount + messageStakeDice.PrizeToncoinAmount = tmp.PrizeToncoinAmount + + fieldInitialState, _ := UnmarshalDiceStickers(tmp.InitialState) + messageStakeDice.InitialState = fieldInitialState + + fieldFinalState, _ := UnmarshalDiceStickers(tmp.FinalState) + messageStakeDice.FinalState = fieldFinalState + + return nil +} + // A message with a forwarded story type MessageStory struct { meta // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` // True, if the story was automatically forwarded because of a mention of the user @@ -18844,15 +31576,38 @@ func (*MessageStory) MessageContentType() string { return TypeMessageStory } +// A message with a checklist +type MessageChecklist struct { + meta + // The checklist description + List *Checklist `json:"list"` +} + +func (entity *MessageChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklist) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklist) GetType() string { + return TypeMessageChecklist +} + +func (*MessageChecklist) MessageContentType() string { + return TypeMessageChecklist +} + // A message with an invoice from a bot. Use getInternalLink with internalLinkTypeBotStart to share the invoice type MessageInvoice struct { meta - // Product title - Title string `json:"title"` - // Product description - Description *FormattedText `json:"description"` - // Product photo; may be null - Photo *Photo `json:"photo"` + // Information about the product + ProductInfo *ProductInfo `json:"product_info"` // Currency for the product price Currency string `json:"currency"` // Product total price in the smallest units of the currency @@ -18865,8 +31620,10 @@ type MessageInvoice struct { NeedShippingAddress bool `json:"need_shipping_address"` // The identifier of the message with the receipt, after the product has been purchased ReceiptMessageId int64 `json:"receipt_message_id"` - // Extended media attached to the invoice; may be null - ExtendedMedia MessageExtendedMedia `json:"extended_media"` + // Extended media attached to the invoice; may be null if none + PaidMedia PaidMedia `json:"paid_media"` + // Extended media caption; may be null if none + PaidMediaCaption *FormattedText `json:"paid_media_caption"` } func (entity *MessageInvoice) MarshalJSON() ([]byte, error) { @@ -18891,16 +31648,15 @@ func (*MessageInvoice) MessageContentType() string { func (messageInvoice *MessageInvoice) UnmarshalJSON(data []byte) error { var tmp struct { - Title string `json:"title"` - Description *FormattedText `json:"description"` - Photo *Photo `json:"photo"` + ProductInfo *ProductInfo `json:"product_info"` Currency string `json:"currency"` TotalAmount int64 `json:"total_amount"` StartParameter string `json:"start_parameter"` IsTest bool `json:"is_test"` NeedShippingAddress bool `json:"need_shipping_address"` ReceiptMessageId int64 `json:"receipt_message_id"` - ExtendedMedia json.RawMessage `json:"extended_media"` + PaidMedia json.RawMessage `json:"paid_media"` + PaidMediaCaption *FormattedText `json:"paid_media_caption"` } err := json.Unmarshal(data, &tmp) @@ -18908,18 +31664,17 @@ func (messageInvoice *MessageInvoice) UnmarshalJSON(data []byte) error { return err } - messageInvoice.Title = tmp.Title - messageInvoice.Description = tmp.Description - messageInvoice.Photo = tmp.Photo + messageInvoice.ProductInfo = tmp.ProductInfo messageInvoice.Currency = tmp.Currency messageInvoice.TotalAmount = tmp.TotalAmount messageInvoice.StartParameter = tmp.StartParameter messageInvoice.IsTest = tmp.IsTest messageInvoice.NeedShippingAddress = tmp.NeedShippingAddress messageInvoice.ReceiptMessageId = tmp.ReceiptMessageId + messageInvoice.PaidMediaCaption = tmp.PaidMediaCaption - fieldExtendedMedia, _ := UnmarshalMessageExtendedMedia(tmp.ExtendedMedia) - messageInvoice.ExtendedMedia = fieldExtendedMedia + fieldPaidMedia, _ := UnmarshalPaidMedia(tmp.PaidMedia) + messageInvoice.PaidMedia = fieldPaidMedia return nil } @@ -18976,12 +31731,76 @@ func (messageCall *MessageCall) UnmarshalJSON(data []byte) error { return nil } +// A message with information about a group call not bound to a chat. If the message is incoming, the call isn't active, isn't missed, and has no duration, and getOption("can_accept_calls") is true, then incoming call screen must be shown to the user. Use getGroupCallParticipants to show current group call participants on the screen. Use joinGroupCall to accept the call or declineGroupCallInvitation to decline it. If the call become active or missed, then the call screen must be hidden +type MessageGroupCall struct { + meta + // Persistent unique group call identifier + UniqueId JsonInt64 `json:"unique_id"` + // True, if the call is active, i.e. the called user joined the call + IsActive bool `json:"is_active"` + // True, if the called user missed or declined the call + WasMissed bool `json:"was_missed"` + // True, if the call is a video call + IsVideo bool `json:"is_video"` + // Call duration, in seconds; for left calls only + Duration int32 `json:"duration"` + // Identifiers of some other call participants + OtherParticipantIds []MessageSender `json:"other_participant_ids"` +} + +func (entity *MessageGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGroupCall) GetClass() string { + return ClassMessageContent +} + +func (*MessageGroupCall) GetType() string { + return TypeMessageGroupCall +} + +func (*MessageGroupCall) MessageContentType() string { + return TypeMessageGroupCall +} + +func (messageGroupCall *MessageGroupCall) UnmarshalJSON(data []byte) error { + var tmp struct { + UniqueId JsonInt64 `json:"unique_id"` + IsActive bool `json:"is_active"` + WasMissed bool `json:"was_missed"` + IsVideo bool `json:"is_video"` + Duration int32 `json:"duration"` + OtherParticipantIds []json.RawMessage `json:"other_participant_ids"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageGroupCall.UniqueId = tmp.UniqueId + messageGroupCall.IsActive = tmp.IsActive + messageGroupCall.WasMissed = tmp.WasMissed + messageGroupCall.IsVideo = tmp.IsVideo + messageGroupCall.Duration = tmp.Duration + + fieldOtherParticipantIds, _ := UnmarshalListOfMessageSender(tmp.OtherParticipantIds) + messageGroupCall.OtherParticipantIds = fieldOtherParticipantIds + + return nil +} + // A new video chat was scheduled type MessageVideoChatScheduled struct { meta // Identifier of the video chat. The video chat can be received through the method getGroupCall GroupCallId int32 `json:"group_call_id"` - // Point in time (Unix timestamp) when the group call is supposed to be started by an administrator + // Point in time (Unix timestamp) when the group call is expected to be started by an administrator StartDate int32 `json:"start_date"` } @@ -19059,7 +31878,7 @@ func (*MessageVideoChatEnded) MessageContentType() string { return TypeMessageVideoChatEnded } -// A message with information about an invite to a video chat +// A message with information about an invitation to a video chat type MessageInviteVideoChatParticipants struct { meta // Identifier of the video chat. The video chat can be received through the method getGroupCall @@ -19223,6 +32042,60 @@ func (*MessageChatDeletePhoto) MessageContentType() string { return TypeMessageChatDeletePhoto } +// The owner of the chat has left +type MessageChatOwnerLeft struct { + meta + // Identifier of the user who will become the new owner of the chat if the previous owner isn't return; 0 if none + NewOwnerUserId int64 `json:"new_owner_user_id"` +} + +func (entity *MessageChatOwnerLeft) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatOwnerLeft + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatOwnerLeft) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatOwnerLeft) GetType() string { + return TypeMessageChatOwnerLeft +} + +func (*MessageChatOwnerLeft) MessageContentType() string { + return TypeMessageChatOwnerLeft +} + +// The owner of the chat has changed +type MessageChatOwnerChanged struct { + meta + // Identifier of the user who is the new owner of the chat + NewOwnerUserId int64 `json:"new_owner_user_id"` +} + +func (entity *MessageChatOwnerChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatOwnerChanged + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatOwnerChanged) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatOwnerChanged) GetType() string { + return TypeMessageChatOwnerChanged +} + +func (*MessageChatOwnerChanged) MessageContentType() string { + return TypeMessageChatOwnerChanged +} + // New chat members were added type MessageChatAddMembers struct { meta @@ -19442,6 +32315,8 @@ type MessageChatSetBackground struct { OldBackgroundMessageId int64 `json:"old_background_message_id"` // The new background Background *ChatBackground `json:"background"` + // True, if the background was set only for self + OnlyForSelf bool `json:"only_for_self"` } func (entity *MessageChatSetBackground) MarshalJSON() ([]byte, error) { @@ -19467,8 +32342,8 @@ func (*MessageChatSetBackground) MessageContentType() string { // A theme in the chat has been changed type MessageChatSetTheme struct { meta - // If non-empty, name of a new theme, set for the chat. Otherwise, chat theme was reset to the default one - ThemeName string `json:"theme_name"` + // New theme for the chat; may be null if chat theme was reset to the default one + Theme ChatTheme `json:"theme"` } func (entity *MessageChatSetTheme) MarshalJSON() ([]byte, error) { @@ -19491,6 +32366,22 @@ func (*MessageChatSetTheme) MessageContentType() string { return TypeMessageChatSetTheme } +func (messageChatSetTheme *MessageChatSetTheme) UnmarshalJSON(data []byte) error { + var tmp struct { + Theme json.RawMessage `json:"theme"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + messageChatSetTheme.Theme = fieldTheme + + return nil +} + // The auto-delete or self-destruct timer for messages in the chat has been changed type MessageChatSetMessageAutoDeleteTime struct { meta @@ -19520,11 +32411,40 @@ func (*MessageChatSetMessageAutoDeleteTime) MessageContentType() string { return TypeMessageChatSetMessageAutoDeleteTime } +// The chat was boosted by the sender of the message +type MessageChatBoost struct { + meta + // Number of times the chat was boosted + BoostCount int32 `json:"boost_count"` +} + +func (entity *MessageChatBoost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChatBoost + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChatBoost) GetClass() string { + return ClassMessageContent +} + +func (*MessageChatBoost) GetType() string { + return TypeMessageChatBoost +} + +func (*MessageChatBoost) MessageContentType() string { + return TypeMessageChatBoost +} + // A forum topic has been created type MessageForumTopicCreated struct { meta // Name of the topic Name string `json:"name"` + // True, if the name of the topic wasn't added explicitly + IsNameImplicit bool `json:"is_name_implicit"` // Icon of the topic Icon *ForumTopicIcon `json:"icon"` } @@ -19661,6 +32581,33 @@ func (*MessageSuggestProfilePhoto) MessageContentType() string { return TypeMessageSuggestProfilePhoto } +// A birthdate was suggested to be set +type MessageSuggestBirthdate struct { + meta + // The suggested birthdate. Use the method setBirthdate to apply the birthdate + Birthdate *Birthdate `json:"birthdate"` +} + +func (entity *MessageSuggestBirthdate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestBirthdate + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestBirthdate) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestBirthdate) GetType() string { + return TypeMessageSuggestBirthdate +} + +func (*MessageSuggestBirthdate) MessageContentType() string { + return TypeMessageSuggestBirthdate +} + // A non-standard action has happened in the chat type MessageCustomServiceAction struct { meta @@ -19719,17 +32666,19 @@ func (*MessageGameScore) MessageContentType() string { return TypeMessageGameScore } -// A payment has been completed +// A payment has been sent to a bot or a business account type MessagePaymentSuccessful struct { meta // Identifier of the chat, containing the corresponding invoice message InvoiceChatId int64 `json:"invoice_chat_id"` - // Identifier of the message with the corresponding invoice; can be 0 or an identifier of a deleted message + // Identifier of the message with the corresponding invoice; may be 0 or an identifier of a deleted message InvoiceMessageId int64 `json:"invoice_message_id"` // Currency for the price of the product Currency string `json:"currency"` // Total price for the product, in the smallest units of the currency TotalAmount int64 `json:"total_amount"` + // Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring + SubscriptionUntilDate int32 `json:"subscription_until_date"` // True, if this is a recurring payment IsRecurring bool `json:"is_recurring"` // True, if this is the first recurring payment @@ -19758,22 +32707,24 @@ func (*MessagePaymentSuccessful) MessageContentType() string { return TypeMessagePaymentSuccessful } -// A payment has been completed; for bots only +// A payment has been received by the bot or the business account type MessagePaymentSuccessfulBot struct { meta // Currency for price of the product Currency string `json:"currency"` // Total price for the product, in the smallest units of the currency TotalAmount int64 `json:"total_amount"` + // Point in time (Unix timestamp) when the subscription will expire; 0 if unknown or the payment isn't recurring + SubscriptionUntilDate int32 `json:"subscription_until_date"` // True, if this is a recurring payment IsRecurring bool `json:"is_recurring"` // True, if this is the first recurring payment IsFirstRecurring bool `json:"is_first_recurring"` // Invoice payload InvoicePayload []byte `json:"invoice_payload"` - // Identifier of the shipping option chosen by the user; may be empty if not applicable + // Identifier of the shipping option chosen by the user; may be empty if not applicable; for bots only ShippingOptionId string `json:"shipping_option_id"` - // Information about the order; may be null + // Information about the order; may be null; for bots only OrderInfo *OrderInfo `json:"order_info"` // Telegram payment identifier TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` @@ -19801,21 +32752,91 @@ func (*MessagePaymentSuccessfulBot) MessageContentType() string { return TypeMessagePaymentSuccessfulBot } -// Telegram Premium was gifted to the user +// A payment has been refunded +type MessagePaymentRefunded struct { + meta + // Identifier of the previous owner of the Telegram Stars that refunds them + OwnerId MessageSender `json:"owner_id"` + // Currency for the price of the product + Currency string `json:"currency"` + // Total price for the product, in the smallest units of the currency + TotalAmount int64 `json:"total_amount"` + // Invoice payload; only for bots + InvoicePayload []byte `json:"invoice_payload"` + // Telegram payment identifier + TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` + // Provider payment identifier + ProviderPaymentChargeId string `json:"provider_payment_charge_id"` +} + +func (entity *MessagePaymentRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePaymentRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaymentRefunded) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaymentRefunded) GetType() string { + return TypeMessagePaymentRefunded +} + +func (*MessagePaymentRefunded) MessageContentType() string { + return TypeMessagePaymentRefunded +} + +func (messagePaymentRefunded *MessagePaymentRefunded) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Currency string `json:"currency"` + TotalAmount int64 `json:"total_amount"` + InvoicePayload []byte `json:"invoice_payload"` + TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` + ProviderPaymentChargeId string `json:"provider_payment_charge_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messagePaymentRefunded.Currency = tmp.Currency + messagePaymentRefunded.TotalAmount = tmp.TotalAmount + messagePaymentRefunded.InvoicePayload = tmp.InvoicePayload + messagePaymentRefunded.TelegramPaymentChargeId = tmp.TelegramPaymentChargeId + messagePaymentRefunded.ProviderPaymentChargeId = tmp.ProviderPaymentChargeId + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + messagePaymentRefunded.OwnerId = fieldOwnerId + + return nil +} + +// Telegram Premium was gifted to a user type MessageGiftedPremium struct { meta - // The identifier of a user that gifted Telegram Premium; 0 if the gift was anonymous + // The identifier of a user who gifted Telegram Premium; 0 if the gift was anonymous or is outgoing GifterUserId int64 `json:"gifter_user_id"` + // The identifier of a user who received Telegram Premium; 0 if the gift is incoming + ReceiverUserId int64 `json:"receiver_user_id"` + // Message added to the gifted Telegram Premium by the sender + Text *FormattedText `json:"text"` // Currency for the paid amount Currency string `json:"currency"` // The paid amount, in the smallest units of the currency Amount int64 `json:"amount"` // Cryptocurrency used to pay for the gift; may be empty if none Cryptocurrency string `json:"cryptocurrency"` - // The paid amount, in the smallest units of the cryptocurrency + // The paid amount, in the smallest units of the cryptocurrency; 0 if none CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` - // Number of month the Telegram Premium subscription will be active + // Number of months the Telegram Premium subscription will be active after code activation; 0 if the number of months isn't integer MonthCount int32 `json:"month_count"` + // Number of days the Telegram Premium subscription will be active + DayCount int32 `json:"day_count"` // A sticker to be shown in the message; may be null if unknown Sticker *Sticker `json:"sticker"` } @@ -19843,14 +32864,26 @@ func (*MessageGiftedPremium) MessageContentType() string { // A Telegram Premium gift code was created for the user type MessagePremiumGiftCode struct { meta - // Identifier of a chat or a user that created the gift code + // Identifier of a chat or a user who created the gift code; may be null if unknown CreatorId MessageSender `json:"creator_id"` + // Message added to the gift + Text *FormattedText `json:"text"` // True, if the gift code was created for a giveaway IsFromGiveaway bool `json:"is_from_giveaway"` // True, if the winner for the corresponding Telegram Premium subscription wasn't chosen IsUnclaimed bool `json:"is_unclaimed"` - // Number of month the Telegram Premium subscription will be active after code activation + // Currency for the paid amount; empty if unknown + Currency string `json:"currency"` + // The paid amount, in the smallest units of the currency; 0 if unknown + Amount int64 `json:"amount"` + // Cryptocurrency used to pay for the gift; may be empty if none or unknown + Cryptocurrency string `json:"cryptocurrency"` + // The paid amount, in the smallest units of the cryptocurrency; 0 if unknown + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` + // Number of months the Telegram Premium subscription will be active after code activation; 0 if the number of months isn't integer MonthCount int32 `json:"month_count"` + // Number of days the Telegram Premium subscription will be active after code activation + DayCount int32 `json:"day_count"` // A sticker to be shown in the message; may be null if unknown Sticker *Sticker `json:"sticker"` // The gift code @@ -19880,9 +32913,15 @@ func (*MessagePremiumGiftCode) MessageContentType() string { func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) error { var tmp struct { CreatorId json.RawMessage `json:"creator_id"` + Text *FormattedText `json:"text"` IsFromGiveaway bool `json:"is_from_giveaway"` IsUnclaimed bool `json:"is_unclaimed"` + Currency string `json:"currency"` + Amount int64 `json:"amount"` + Cryptocurrency string `json:"cryptocurrency"` + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` MonthCount int32 `json:"month_count"` + DayCount int32 `json:"day_count"` Sticker *Sticker `json:"sticker"` Code string `json:"code"` } @@ -19892,9 +32931,15 @@ func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) return err } + messagePremiumGiftCode.Text = tmp.Text messagePremiumGiftCode.IsFromGiveaway = tmp.IsFromGiveaway messagePremiumGiftCode.IsUnclaimed = tmp.IsUnclaimed + messagePremiumGiftCode.Currency = tmp.Currency + messagePremiumGiftCode.Amount = tmp.Amount + messagePremiumGiftCode.Cryptocurrency = tmp.Cryptocurrency + messagePremiumGiftCode.CryptocurrencyAmount = tmp.CryptocurrencyAmount messagePremiumGiftCode.MonthCount = tmp.MonthCount + messagePremiumGiftCode.DayCount = tmp.DayCount messagePremiumGiftCode.Sticker = tmp.Sticker messagePremiumGiftCode.Code = tmp.Code @@ -19904,62 +32949,1064 @@ func (messagePremiumGiftCode *MessagePremiumGiftCode) UnmarshalJSON(data []byte) return nil } -// A Telegram Premium giveaway was created for the chat -type MessagePremiumGiveawayCreated struct{ +// A giveaway was created for the chat. Use telegramPaymentPurposePremiumGiveaway, storePaymentPurposePremiumGiveaway, telegramPaymentPurposeStarGiveaway, or storePaymentPurposeStarGiveaway to create a giveaway +type MessageGiveawayCreated struct { meta + // Number of Telegram Stars that will be shared by winners of the giveaway; 0 for Telegram Premium giveaways + StarCount int64 `json:"star_count"` } -func (entity *MessagePremiumGiveawayCreated) MarshalJSON() ([]byte, error) { +func (entity *MessageGiveawayCreated) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessagePremiumGiveawayCreated + type stub MessageGiveawayCreated return json.Marshal((*stub)(entity)) } -func (*MessagePremiumGiveawayCreated) GetClass() string { +func (*MessageGiveawayCreated) GetClass() string { return ClassMessageContent } -func (*MessagePremiumGiveawayCreated) GetType() string { - return TypeMessagePremiumGiveawayCreated +func (*MessageGiveawayCreated) GetType() string { + return TypeMessageGiveawayCreated } -func (*MessagePremiumGiveawayCreated) MessageContentType() string { - return TypeMessagePremiumGiveawayCreated +func (*MessageGiveawayCreated) MessageContentType() string { + return TypeMessageGiveawayCreated } -// A Telegram Premium giveaway -type MessagePremiumGiveaway struct { +// A giveaway +type MessageGiveaway struct { meta // Giveaway parameters - Parameters *PremiumGiveawayParameters `json:"parameters"` + Parameters *GiveawayParameters `json:"parameters"` // Number of users which will receive Telegram Premium subscription gift codes WinnerCount int32 `json:"winner_count"` - // Number of month the Telegram Premium subscription will be active after code activation - MonthCount int32 `json:"month_count"` + // Prize of the giveaway + Prize GiveawayPrize `json:"prize"` // A sticker to be shown in the message; may be null if unknown Sticker *Sticker `json:"sticker"` } -func (entity *MessagePremiumGiveaway) MarshalJSON() ([]byte, error) { +func (entity *MessageGiveaway) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessagePremiumGiveaway + type stub MessageGiveaway return json.Marshal((*stub)(entity)) } -func (*MessagePremiumGiveaway) GetClass() string { +func (*MessageGiveaway) GetClass() string { return ClassMessageContent } -func (*MessagePremiumGiveaway) GetType() string { - return TypeMessagePremiumGiveaway +func (*MessageGiveaway) GetType() string { + return TypeMessageGiveaway } -func (*MessagePremiumGiveaway) MessageContentType() string { - return TypeMessagePremiumGiveaway +func (*MessageGiveaway) MessageContentType() string { + return TypeMessageGiveaway +} + +func (messageGiveaway *MessageGiveaway) UnmarshalJSON(data []byte) error { + var tmp struct { + Parameters *GiveawayParameters `json:"parameters"` + WinnerCount int32 `json:"winner_count"` + Prize json.RawMessage `json:"prize"` + Sticker *Sticker `json:"sticker"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageGiveaway.Parameters = tmp.Parameters + messageGiveaway.WinnerCount = tmp.WinnerCount + messageGiveaway.Sticker = tmp.Sticker + + fieldPrize, _ := UnmarshalGiveawayPrize(tmp.Prize) + messageGiveaway.Prize = fieldPrize + + return nil +} + +// A giveaway without public winners has been completed for the chat +type MessageGiveawayCompleted struct { + meta + // Identifier of the message with the giveaway; may be 0 or an identifier of a deleted message + GiveawayMessageId int64 `json:"giveaway_message_id"` + // Number of winners in the giveaway + WinnerCount int32 `json:"winner_count"` + // True, if the giveaway is a Telegram Star giveaway + IsStarGiveaway bool `json:"is_star_giveaway"` + // Number of undistributed prizes; for Telegram Premium giveaways only + UnclaimedPrizeCount int32 `json:"unclaimed_prize_count"` +} + +func (entity *MessageGiveawayCompleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGiveawayCompleted + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGiveawayCompleted) GetClass() string { + return ClassMessageContent +} + +func (*MessageGiveawayCompleted) GetType() string { + return TypeMessageGiveawayCompleted +} + +func (*MessageGiveawayCompleted) MessageContentType() string { + return TypeMessageGiveawayCompleted +} + +// A giveaway with public winners has been completed for the chat +type MessageGiveawayWinners struct { + meta + // Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway + BoostedChatId int64 `json:"boosted_chat_id"` + // Identifier of the message with the giveaway in the boosted chat + GiveawayMessageId int64 `json:"giveaway_message_id"` + // Number of other chats that participated in the giveaway + AdditionalChatCount int32 `json:"additional_chat_count"` + // Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in parameters of the giveaway + ActualWinnersSelectionDate int32 `json:"actual_winners_selection_date"` + // True, if only new members of the chats were eligible for the giveaway + OnlyNewMembers bool `json:"only_new_members"` + // True, if the giveaway was canceled and was fully refunded + WasRefunded bool `json:"was_refunded"` + // Prize of the giveaway + Prize GiveawayPrize `json:"prize"` + // Additional description of the giveaway prize + PrizeDescription string `json:"prize_description"` + // Total number of winners in the giveaway + WinnerCount int32 `json:"winner_count"` + // Up to 100 user identifiers of the winners of the giveaway + WinnerUserIds []int64 `json:"winner_user_ids"` + // Number of undistributed prizes; for Telegram Premium giveaways only + UnclaimedPrizeCount int32 `json:"unclaimed_prize_count"` +} + +func (entity *MessageGiveawayWinners) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGiveawayWinners + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGiveawayWinners) GetClass() string { + return ClassMessageContent +} + +func (*MessageGiveawayWinners) GetType() string { + return TypeMessageGiveawayWinners +} + +func (*MessageGiveawayWinners) MessageContentType() string { + return TypeMessageGiveawayWinners +} + +func (messageGiveawayWinners *MessageGiveawayWinners) UnmarshalJSON(data []byte) error { + var tmp struct { + BoostedChatId int64 `json:"boosted_chat_id"` + GiveawayMessageId int64 `json:"giveaway_message_id"` + AdditionalChatCount int32 `json:"additional_chat_count"` + ActualWinnersSelectionDate int32 `json:"actual_winners_selection_date"` + OnlyNewMembers bool `json:"only_new_members"` + WasRefunded bool `json:"was_refunded"` + Prize json.RawMessage `json:"prize"` + PrizeDescription string `json:"prize_description"` + WinnerCount int32 `json:"winner_count"` + WinnerUserIds []int64 `json:"winner_user_ids"` + UnclaimedPrizeCount int32 `json:"unclaimed_prize_count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageGiveawayWinners.BoostedChatId = tmp.BoostedChatId + messageGiveawayWinners.GiveawayMessageId = tmp.GiveawayMessageId + messageGiveawayWinners.AdditionalChatCount = tmp.AdditionalChatCount + messageGiveawayWinners.ActualWinnersSelectionDate = tmp.ActualWinnersSelectionDate + messageGiveawayWinners.OnlyNewMembers = tmp.OnlyNewMembers + messageGiveawayWinners.WasRefunded = tmp.WasRefunded + messageGiveawayWinners.PrizeDescription = tmp.PrizeDescription + messageGiveawayWinners.WinnerCount = tmp.WinnerCount + messageGiveawayWinners.WinnerUserIds = tmp.WinnerUserIds + messageGiveawayWinners.UnclaimedPrizeCount = tmp.UnclaimedPrizeCount + + fieldPrize, _ := UnmarshalGiveawayPrize(tmp.Prize) + messageGiveawayWinners.Prize = fieldPrize + + return nil +} + +// Telegram Stars were gifted to a user +type MessageGiftedStars struct { + meta + // The identifier of a user who gifted Telegram Stars; 0 if the gift was anonymous or is outgoing + GifterUserId int64 `json:"gifter_user_id"` + // The identifier of a user who received Telegram Stars; 0 if the gift is incoming + ReceiverUserId int64 `json:"receiver_user_id"` + // Currency for the paid amount + Currency string `json:"currency"` + // The paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Cryptocurrency used to pay for the gift; may be empty if none + Cryptocurrency string `json:"cryptocurrency"` + // The paid amount, in the smallest units of the cryptocurrency; 0 if none + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` + // Number of Telegram Stars that were gifted + StarCount int64 `json:"star_count"` + // Identifier of the transaction for Telegram Stars purchase; for receiver only + TransactionId string `json:"transaction_id"` + // A sticker to be shown in the message; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessageGiftedStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGiftedStars + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGiftedStars) GetClass() string { + return ClassMessageContent +} + +func (*MessageGiftedStars) GetType() string { + return TypeMessageGiftedStars +} + +func (*MessageGiftedStars) MessageContentType() string { + return TypeMessageGiftedStars +} + +// Toncoins were gifted to a user +type MessageGiftedTon struct { + meta + // The identifier of a user who gifted Toncoins; 0 if the gift was anonymous or is outgoing + GifterUserId int64 `json:"gifter_user_id"` + // The identifier of a user who received Toncoins; 0 if the gift is incoming + ReceiverUserId int64 `json:"receiver_user_id"` + // The received Toncoin amount, in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` + // Identifier of the transaction for Toncoin credit; for receiver only + TransactionId string `json:"transaction_id"` + // A sticker to be shown in the message; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessageGiftedTon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGiftedTon + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGiftedTon) GetClass() string { + return ClassMessageContent +} + +func (*MessageGiftedTon) GetType() string { + return TypeMessageGiftedTon +} + +func (*MessageGiftedTon) MessageContentType() string { + return TypeMessageGiftedTon +} + +// A Telegram Stars were received by the current user from a giveaway +type MessageGiveawayPrizeStars struct { + meta + // Number of Telegram Stars that were received + StarCount int64 `json:"star_count"` + // Identifier of the transaction for Telegram Stars credit + TransactionId string `json:"transaction_id"` + // Identifier of the supergroup or channel chat, which was automatically boosted by the winners of the giveaway + BoostedChatId int64 `json:"boosted_chat_id"` + // Identifier of the message with the giveaway in the boosted chat; may be 0 or an identifier of a deleted message + GiveawayMessageId int64 `json:"giveaway_message_id"` + // True, if the corresponding winner wasn't chosen and the Telegram Stars were received by the owner of the boosted chat + IsUnclaimed bool `json:"is_unclaimed"` + // A sticker to be shown in the message; may be null if unknown + Sticker *Sticker `json:"sticker"` +} + +func (entity *MessageGiveawayPrizeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGiveawayPrizeStars + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGiveawayPrizeStars) GetClass() string { + return ClassMessageContent +} + +func (*MessageGiveawayPrizeStars) GetType() string { + return TypeMessageGiveawayPrizeStars +} + +func (*MessageGiveawayPrizeStars) MessageContentType() string { + return TypeMessageGiveawayPrizeStars +} + +// A regular gift was received or sent by the current user, or the current user was notified about a channel gift +type MessageGift struct { + meta + // The gift + Gift *Gift `json:"gift"` + // Sender of the gift; may be null for outgoing messages about prepaid upgrade of gifts from unknown users + SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` + // Unique identifier of the received gift for the current user; only for the receiver of the gift + ReceivedGiftId string `json:"received_gift_id"` + // Message added to the gift + Text *FormattedText `json:"text"` + // Unique number of the gift among gifts upgraded from the same gift after upgrade; 0 if yet unassigned + UniqueGiftNumber int32 `json:"unique_gift_number"` + // Number of Telegram Stars that can be claimed by the receiver instead of the regular gift; 0 if the gift can't be sold by the receiver + SellStarCount int64 `json:"sell_star_count"` + // Number of Telegram Stars that were paid by the sender for the ability to upgrade the gift + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + // True, if the upgrade was bought after the gift was sent. In this case, prepaid upgrade cost must not be added to the gift cost + IsUpgradeSeparate bool `json:"is_upgrade_separate"` + // True, if the message is a notification about a gift won on an auction + IsFromAuction bool `json:"is_from_auction"` + // True, if the sender and gift text are shown only to the gift receiver; otherwise, everyone will be able to see them + IsPrivate bool `json:"is_private"` + // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift + IsSaved bool `json:"is_saved"` + // True, if the message is about prepaid upgrade of the gift by another user + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` + // True, if the gift can be upgraded to a unique gift; only for the receiver of the gift + CanBeUpgraded bool `json:"can_be_upgraded"` + // True, if the gift was converted to Telegram Stars; only for the receiver of the gift + WasConverted bool `json:"was_converted"` + // True, if the gift was upgraded to a unique gift + WasUpgraded bool `json:"was_upgraded"` + // True, if the gift was refunded and isn't available anymore + WasRefunded bool `json:"was_refunded"` + // Identifier of the corresponding upgraded gift; may be empty if unknown. Use getReceivedGift to get information about the gift + UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` + // If non-empty, then the user can pay for an upgrade of the gift using buyGiftUpgrade + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` +} + +func (entity *MessageGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageGift + + return json.Marshal((*stub)(entity)) +} + +func (*MessageGift) GetClass() string { + return ClassMessageContent +} + +func (*MessageGift) GetType() string { + return TypeMessageGift +} + +func (*MessageGift) MessageContentType() string { + return TypeMessageGift +} + +func (messageGift *MessageGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *Gift `json:"gift"` + SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` + ReceivedGiftId string `json:"received_gift_id"` + Text *FormattedText `json:"text"` + UniqueGiftNumber int32 `json:"unique_gift_number"` + SellStarCount int64 `json:"sell_star_count"` + PrepaidUpgradeStarCount int64 `json:"prepaid_upgrade_star_count"` + IsUpgradeSeparate bool `json:"is_upgrade_separate"` + IsFromAuction bool `json:"is_from_auction"` + IsPrivate bool `json:"is_private"` + IsSaved bool `json:"is_saved"` + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` + CanBeUpgraded bool `json:"can_be_upgraded"` + WasConverted bool `json:"was_converted"` + WasUpgraded bool `json:"was_upgraded"` + WasRefunded bool `json:"was_refunded"` + UpgradedReceivedGiftId string `json:"upgraded_received_gift_id"` + PrepaidUpgradeHash string `json:"prepaid_upgrade_hash"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageGift.Gift = tmp.Gift + messageGift.ReceivedGiftId = tmp.ReceivedGiftId + messageGift.Text = tmp.Text + messageGift.UniqueGiftNumber = tmp.UniqueGiftNumber + messageGift.SellStarCount = tmp.SellStarCount + messageGift.PrepaidUpgradeStarCount = tmp.PrepaidUpgradeStarCount + messageGift.IsUpgradeSeparate = tmp.IsUpgradeSeparate + messageGift.IsFromAuction = tmp.IsFromAuction + messageGift.IsPrivate = tmp.IsPrivate + messageGift.IsSaved = tmp.IsSaved + messageGift.IsPrepaidUpgrade = tmp.IsPrepaidUpgrade + messageGift.CanBeUpgraded = tmp.CanBeUpgraded + messageGift.WasConverted = tmp.WasConverted + messageGift.WasUpgraded = tmp.WasUpgraded + messageGift.WasRefunded = tmp.WasRefunded + messageGift.UpgradedReceivedGiftId = tmp.UpgradedReceivedGiftId + messageGift.PrepaidUpgradeHash = tmp.PrepaidUpgradeHash + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + messageGift.SenderId = fieldSenderId + + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageGift.ReceiverId = fieldReceiverId + + return nil +} + +// An upgraded gift was received or sent by the current user, or the current user was notified about a channel gift +type MessageUpgradedGift struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // Sender of the gift; may be null for anonymous gifts + SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` + // Origin of the upgraded gift + Origin UpgradedGiftOrigin `json:"origin"` + // Unique identifier of the received gift for the current user; only for the receiver of the gift + ReceivedGiftId string `json:"received_gift_id"` + // True, if the gift is displayed on the user's or the channel's profile page; only for the receiver of the gift + IsSaved bool `json:"is_saved"` + // True, if the gift can be transferred to another owner; only for the receiver of the gift + CanBeTransferred bool `json:"can_be_transferred"` + // True, if the gift has already been transferred to another owner; only for the receiver of the gift + WasTransferred bool `json:"was_transferred"` + // Number of Telegram Stars that must be paid to transfer the upgraded gift; only for the receiver of the gift + TransferStarCount int64 `json:"transfer_star_count"` + // Number of Telegram Stars that must be paid to drop original details of the upgraded gift; 0 if not available; only for the receiver of the gift + DropOriginalDetailsStarCount int64 `json:"drop_original_details_star_count"` + // Point in time (Unix timestamp) when the gift can be transferred to another owner; can be in the past; 0 if the gift can be transferred immediately or transfer isn't possible; only for the receiver of the gift + NextTransferDate int32 `json:"next_transfer_date"` + // Point in time (Unix timestamp) when the gift can be resold to another user; can be in the past; 0 if the gift can't be resold; only for the receiver of the gift + NextResaleDate int32 `json:"next_resale_date"` + // Point in time (Unix timestamp) when the gift can be transferred to the TON blockchain as an NFT; can be in the past; 0 if NFT export isn't possible; only for the receiver of the gift + ExportDate int32 `json:"export_date"` + // Point in time (Unix timestamp) when the gift can be used to craft another gift can be in the past; only for the receiver of the gift + CraftDate int32 `json:"craft_date"` +} + +func (entity *MessageUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*MessageUpgradedGift) GetClass() string { + return ClassMessageContent +} + +func (*MessageUpgradedGift) GetType() string { + return TypeMessageUpgradedGift +} + +func (*MessageUpgradedGift) MessageContentType() string { + return TypeMessageUpgradedGift +} + +func (messageUpgradedGift *MessageUpgradedGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *UpgradedGift `json:"gift"` + SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` + Origin json.RawMessage `json:"origin"` + ReceivedGiftId string `json:"received_gift_id"` + IsSaved bool `json:"is_saved"` + CanBeTransferred bool `json:"can_be_transferred"` + WasTransferred bool `json:"was_transferred"` + TransferStarCount int64 `json:"transfer_star_count"` + DropOriginalDetailsStarCount int64 `json:"drop_original_details_star_count"` + NextTransferDate int32 `json:"next_transfer_date"` + NextResaleDate int32 `json:"next_resale_date"` + ExportDate int32 `json:"export_date"` + CraftDate int32 `json:"craft_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageUpgradedGift.Gift = tmp.Gift + messageUpgradedGift.ReceivedGiftId = tmp.ReceivedGiftId + messageUpgradedGift.IsSaved = tmp.IsSaved + messageUpgradedGift.CanBeTransferred = tmp.CanBeTransferred + messageUpgradedGift.WasTransferred = tmp.WasTransferred + messageUpgradedGift.TransferStarCount = tmp.TransferStarCount + messageUpgradedGift.DropOriginalDetailsStarCount = tmp.DropOriginalDetailsStarCount + messageUpgradedGift.NextTransferDate = tmp.NextTransferDate + messageUpgradedGift.NextResaleDate = tmp.NextResaleDate + messageUpgradedGift.ExportDate = tmp.ExportDate + messageUpgradedGift.CraftDate = tmp.CraftDate + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + messageUpgradedGift.SenderId = fieldSenderId + + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageUpgradedGift.ReceiverId = fieldReceiverId + + fieldOrigin, _ := UnmarshalUpgradedGiftOrigin(tmp.Origin) + messageUpgradedGift.Origin = fieldOrigin + + return nil +} + +// A gift which purchase, upgrade or transfer were refunded +type MessageRefundedUpgradedGift struct { + meta + // The gift + Gift *Gift `json:"gift"` + // Sender of the gift + SenderId MessageSender `json:"sender_id"` + // Receiver of the gift + ReceiverId MessageSender `json:"receiver_id"` + // Origin of the upgraded gift + Origin UpgradedGiftOrigin `json:"origin"` +} + +func (entity *MessageRefundedUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageRefundedUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*MessageRefundedUpgradedGift) GetClass() string { + return ClassMessageContent +} + +func (*MessageRefundedUpgradedGift) GetType() string { + return TypeMessageRefundedUpgradedGift +} + +func (*MessageRefundedUpgradedGift) MessageContentType() string { + return TypeMessageRefundedUpgradedGift +} + +func (messageRefundedUpgradedGift *MessageRefundedUpgradedGift) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *Gift `json:"gift"` + SenderId json.RawMessage `json:"sender_id"` + ReceiverId json.RawMessage `json:"receiver_id"` + Origin json.RawMessage `json:"origin"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageRefundedUpgradedGift.Gift = tmp.Gift + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + messageRefundedUpgradedGift.SenderId = fieldSenderId + + fieldReceiverId, _ := UnmarshalMessageSender(tmp.ReceiverId) + messageRefundedUpgradedGift.ReceiverId = fieldReceiverId + + fieldOrigin, _ := UnmarshalUpgradedGiftOrigin(tmp.Origin) + messageRefundedUpgradedGift.Origin = fieldOrigin + + return nil +} + +// An offer to purchase an upgraded gift was sent or received +type MessageUpgradedGiftPurchaseOffer struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // State of the offer + State GiftPurchaseOfferState `json:"state"` + // The proposed price + Price GiftResalePrice `json:"price"` + // Point in time (Unix timestamp) when the offer will expire or has expired + ExpirationDate int32 `json:"expiration_date"` +} + +func (entity *MessageUpgradedGiftPurchaseOffer) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageUpgradedGiftPurchaseOffer + + return json.Marshal((*stub)(entity)) +} + +func (*MessageUpgradedGiftPurchaseOffer) GetClass() string { + return ClassMessageContent +} + +func (*MessageUpgradedGiftPurchaseOffer) GetType() string { + return TypeMessageUpgradedGiftPurchaseOffer +} + +func (*MessageUpgradedGiftPurchaseOffer) MessageContentType() string { + return TypeMessageUpgradedGiftPurchaseOffer +} + +func (messageUpgradedGiftPurchaseOffer *MessageUpgradedGiftPurchaseOffer) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *UpgradedGift `json:"gift"` + State json.RawMessage `json:"state"` + Price json.RawMessage `json:"price"` + ExpirationDate int32 `json:"expiration_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageUpgradedGiftPurchaseOffer.Gift = tmp.Gift + messageUpgradedGiftPurchaseOffer.ExpirationDate = tmp.ExpirationDate + + fieldState, _ := UnmarshalGiftPurchaseOfferState(tmp.State) + messageUpgradedGiftPurchaseOffer.State = fieldState + + fieldPrice, _ := UnmarshalGiftResalePrice(tmp.Price) + messageUpgradedGiftPurchaseOffer.Price = fieldPrice + + return nil +} + +// An offer to purchase a gift was rejected or expired +type MessageUpgradedGiftPurchaseOfferRejected struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // The proposed price + Price GiftResalePrice `json:"price"` + // Identifier of the message with purchase offer which was rejected or expired; may be 0 or an identifier of a deleted message + OfferMessageId int64 `json:"offer_message_id"` + // True, if the offer has expired; otherwise, the offer was explicitly rejected + WasExpired bool `json:"was_expired"` +} + +func (entity *MessageUpgradedGiftPurchaseOfferRejected) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageUpgradedGiftPurchaseOfferRejected + + return json.Marshal((*stub)(entity)) +} + +func (*MessageUpgradedGiftPurchaseOfferRejected) GetClass() string { + return ClassMessageContent +} + +func (*MessageUpgradedGiftPurchaseOfferRejected) GetType() string { + return TypeMessageUpgradedGiftPurchaseOfferRejected +} + +func (*MessageUpgradedGiftPurchaseOfferRejected) MessageContentType() string { + return TypeMessageUpgradedGiftPurchaseOfferRejected +} + +func (messageUpgradedGiftPurchaseOfferRejected *MessageUpgradedGiftPurchaseOfferRejected) UnmarshalJSON(data []byte) error { + var tmp struct { + Gift *UpgradedGift `json:"gift"` + Price json.RawMessage `json:"price"` + OfferMessageId int64 `json:"offer_message_id"` + WasExpired bool `json:"was_expired"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageUpgradedGiftPurchaseOfferRejected.Gift = tmp.Gift + messageUpgradedGiftPurchaseOfferRejected.OfferMessageId = tmp.OfferMessageId + messageUpgradedGiftPurchaseOfferRejected.WasExpired = tmp.WasExpired + + fieldPrice, _ := UnmarshalGiftResalePrice(tmp.Price) + messageUpgradedGiftPurchaseOfferRejected.Price = fieldPrice + + return nil +} + +// Paid messages were refunded +type MessagePaidMessagesRefunded struct { + meta + // The number of refunded messages + MessageCount int32 `json:"message_count"` + // The number of refunded Telegram Stars + StarCount int64 `json:"star_count"` +} + +func (entity *MessagePaidMessagesRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePaidMessagesRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaidMessagesRefunded) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaidMessagesRefunded) GetType() string { + return TypeMessagePaidMessagesRefunded +} + +func (*MessagePaidMessagesRefunded) MessageContentType() string { + return TypeMessagePaidMessagesRefunded +} + +// A price for paid messages was changed in the supergroup chat +type MessagePaidMessagePriceChanged struct { + meta + // The new number of Telegram Stars that must be paid by non-administrator users of the supergroup chat for each sent message + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +func (entity *MessagePaidMessagePriceChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePaidMessagePriceChanged + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePaidMessagePriceChanged) GetClass() string { + return ClassMessageContent +} + +func (*MessagePaidMessagePriceChanged) GetType() string { + return TypeMessagePaidMessagePriceChanged +} + +func (*MessagePaidMessagePriceChanged) MessageContentType() string { + return TypeMessagePaidMessagePriceChanged +} + +// A price for direct messages was changed in the channel chat +type MessageDirectMessagePriceChanged struct { + meta + // True, if direct messages group was enabled for the channel; false otherwise + IsEnabled bool `json:"is_enabled"` + // The new number of Telegram Stars that must be paid by non-administrator users of the channel chat for each message sent to the direct messages group; 0 if the direct messages group was disabled or the messages are free + PaidMessageStarCount int64 `json:"paid_message_star_count"` +} + +func (entity *MessageDirectMessagePriceChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageDirectMessagePriceChanged + + return json.Marshal((*stub)(entity)) +} + +func (*MessageDirectMessagePriceChanged) GetClass() string { + return ClassMessageContent +} + +func (*MessageDirectMessagePriceChanged) GetType() string { + return TypeMessageDirectMessagePriceChanged +} + +func (*MessageDirectMessagePriceChanged) MessageContentType() string { + return TypeMessageDirectMessagePriceChanged +} + +// Some tasks from a checklist were marked as done or not done +type MessageChecklistTasksDone struct { + meta + // Identifier of the message with the checklist; may be 0 or an identifier of a deleted message + ChecklistMessageId int64 `json:"checklist_message_id"` + // Identifiers of tasks that were marked as done + MarkedAsDoneTaskIds []int32 `json:"marked_as_done_task_ids"` + // Identifiers of tasks that were marked as not done + MarkedAsNotDoneTaskIds []int32 `json:"marked_as_not_done_task_ids"` +} + +func (entity *MessageChecklistTasksDone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklistTasksDone + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklistTasksDone) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklistTasksDone) GetType() string { + return TypeMessageChecklistTasksDone +} + +func (*MessageChecklistTasksDone) MessageContentType() string { + return TypeMessageChecklistTasksDone +} + +// Some tasks were added to a checklist +type MessageChecklistTasksAdded struct { + meta + // Identifier of the message with the checklist; may be 0 or an identifier of a deleted message + ChecklistMessageId int64 `json:"checklist_message_id"` + // List of tasks added to the checklist + Tasks []*ChecklistTask `json:"tasks"` +} + +func (entity *MessageChecklistTasksAdded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageChecklistTasksAdded + + return json.Marshal((*stub)(entity)) +} + +func (*MessageChecklistTasksAdded) GetClass() string { + return ClassMessageContent +} + +func (*MessageChecklistTasksAdded) GetType() string { + return TypeMessageChecklistTasksAdded +} + +func (*MessageChecklistTasksAdded) MessageContentType() string { + return TypeMessageChecklistTasksAdded +} + +// Approval of suggested post has failed, because the user which proposed the post had no enough funds +type MessageSuggestedPostApprovalFailed struct { + meta + // Identifier of the message with the suggested post; may be 0 or an identifier of a deleted message + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Price of the suggested post + Price SuggestedPostPrice `json:"price"` +} + +func (entity *MessageSuggestedPostApprovalFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostApprovalFailed + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostApprovalFailed) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostApprovalFailed) GetType() string { + return TypeMessageSuggestedPostApprovalFailed +} + +func (*MessageSuggestedPostApprovalFailed) MessageContentType() string { + return TypeMessageSuggestedPostApprovalFailed +} + +func (messageSuggestedPostApprovalFailed *MessageSuggestedPostApprovalFailed) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Price json.RawMessage `json:"price"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostApprovalFailed.SuggestedPostMessageId = tmp.SuggestedPostMessageId + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + messageSuggestedPostApprovalFailed.Price = fieldPrice + + return nil +} + +// A suggested post was approved +type MessageSuggestedPostApproved struct { + meta + // Identifier of the message with the suggested post; may be 0 or an identifier of a deleted message + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Price of the suggested post; may be null if the post is non-paid + Price SuggestedPostPrice `json:"price"` + // Point in time (Unix timestamp) when the post is expected to be published + SendDate int32 `json:"send_date"` +} + +func (entity *MessageSuggestedPostApproved) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostApproved + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostApproved) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostApproved) GetType() string { + return TypeMessageSuggestedPostApproved +} + +func (*MessageSuggestedPostApproved) MessageContentType() string { + return TypeMessageSuggestedPostApproved +} + +func (messageSuggestedPostApproved *MessageSuggestedPostApproved) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Price json.RawMessage `json:"price"` + SendDate int32 `json:"send_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostApproved.SuggestedPostMessageId = tmp.SuggestedPostMessageId + messageSuggestedPostApproved.SendDate = tmp.SendDate + + fieldPrice, _ := UnmarshalSuggestedPostPrice(tmp.Price) + messageSuggestedPostApproved.Price = fieldPrice + + return nil +} + +// A suggested post was declined +type MessageSuggestedPostDeclined struct { + meta + // Identifier of the message with the suggested post; may be 0 or an identifier of a deleted message + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Comment added by administrator of the channel when the post was declined + Comment string `json:"comment"` +} + +func (entity *MessageSuggestedPostDeclined) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostDeclined + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostDeclined) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostDeclined) GetType() string { + return TypeMessageSuggestedPostDeclined +} + +func (*MessageSuggestedPostDeclined) MessageContentType() string { + return TypeMessageSuggestedPostDeclined +} + +// A suggested post was published for getOption("suggested_post_lifetime_min") seconds and payment for the post was received +type MessageSuggestedPostPaid struct { + meta + // Identifier of the message with the suggested post; may be 0 or an identifier of a deleted message + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // The amount of received Telegram Stars + StarAmount *StarAmount `json:"star_amount"` + // The amount of received Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` +} + +func (entity *MessageSuggestedPostPaid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostPaid + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostPaid) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostPaid) GetType() string { + return TypeMessageSuggestedPostPaid +} + +func (*MessageSuggestedPostPaid) MessageContentType() string { + return TypeMessageSuggestedPostPaid +} + +// A suggested post was refunded +type MessageSuggestedPostRefunded struct { + meta + // Identifier of the message with the suggested post; may be 0 or an identifier of a deleted message + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + // Reason of the refund + Reason SuggestedPostRefundReason `json:"reason"` +} + +func (entity *MessageSuggestedPostRefunded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSuggestedPostRefunded + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSuggestedPostRefunded) GetClass() string { + return ClassMessageContent +} + +func (*MessageSuggestedPostRefunded) GetType() string { + return TypeMessageSuggestedPostRefunded +} + +func (*MessageSuggestedPostRefunded) MessageContentType() string { + return TypeMessageSuggestedPostRefunded +} + +func (messageSuggestedPostRefunded *MessageSuggestedPostRefunded) UnmarshalJSON(data []byte) error { + var tmp struct { + SuggestedPostMessageId int64 `json:"suggested_post_message_id"` + Reason json.RawMessage `json:"reason"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageSuggestedPostRefunded.SuggestedPostMessageId = tmp.SuggestedPostMessageId + + fieldReason, _ := UnmarshalSuggestedPostRefundReason(tmp.Reason) + messageSuggestedPostRefunded.Reason = fieldReason + + return nil } // A contact has registered with Telegram @@ -19987,40 +34034,40 @@ func (*MessageContactRegistered) MessageContentType() string { return TypeMessageContactRegistered } -// The current user shared a user, which was requested by the bot -type MessageUserShared struct { +// The current user shared users, which were requested by the bot +type MessageUsersShared struct { meta - // Identifier of the shared user - UserId int64 `json:"user_id"` + // The shared users + Users []*SharedUser `json:"users"` // Identifier of the keyboard button with the request ButtonId int32 `json:"button_id"` } -func (entity *MessageUserShared) MarshalJSON() ([]byte, error) { +func (entity *MessageUsersShared) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageUserShared + type stub MessageUsersShared return json.Marshal((*stub)(entity)) } -func (*MessageUserShared) GetClass() string { +func (*MessageUsersShared) GetClass() string { return ClassMessageContent } -func (*MessageUserShared) GetType() string { - return TypeMessageUserShared +func (*MessageUsersShared) GetType() string { + return TypeMessageUsersShared } -func (*MessageUserShared) MessageContentType() string { - return TypeMessageUserShared +func (*MessageUsersShared) MessageContentType() string { + return TypeMessageUsersShared } // The current user shared a chat, which was requested by the bot type MessageChatShared struct { meta - // Identifier of the shared chat - ChatId int64 `json:"chat_id"` + // The shared chat + Chat *SharedChat `json:"chat"` // Identifier of the keyboard button with the request ButtonId int32 `json:"button_id"` } @@ -20320,7 +34367,7 @@ func (*TextEntityTypeMention) TextEntityTypeType() string { return TypeTextEntityTypeMention } -// A hashtag text, beginning with "#" +// A hashtag text, beginning with "#" and optionally containing a chat username at the end type TextEntityTypeHashtag struct{ meta } @@ -20345,7 +34392,7 @@ func (*TextEntityTypeHashtag) TextEntityTypeType() string { return TypeTextEntityTypeHashtag } -// A cashtag text, beginning with "$" and consisting of capital English letters (e.g., "$USD") +// A cashtag text, beginning with "$", consisting of capital English letters (e.g., "$USD"), and optionally containing a chat username at the end type TextEntityTypeCashtag struct{ meta } @@ -20697,7 +34744,7 @@ func (*TextEntityTypePreCode) TextEntityTypeType() string { return TypeTextEntityTypePreCode } -// Text that must be formatted as if inside a blockquote HTML tag +// Text that must be formatted as if inside a blockquote HTML tag; not supported in secret chats type TextEntityTypeBlockQuote struct{ meta } @@ -20722,6 +34769,31 @@ func (*TextEntityTypeBlockQuote) TextEntityTypeType() string { return TypeTextEntityTypeBlockQuote } +// Text that must be formatted as if inside a blockquote HTML tag and collapsed by default to 3 lines with the ability to show full text; not supported in secret chats +type TextEntityTypeExpandableBlockQuote struct{ + meta +} + +func (entity *TextEntityTypeExpandableBlockQuote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntityTypeExpandableBlockQuote + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntityTypeExpandableBlockQuote) GetClass() string { + return ClassTextEntityType +} + +func (*TextEntityTypeExpandableBlockQuote) GetType() string { + return TypeTextEntityTypeExpandableBlockQuote +} + +func (*TextEntityTypeExpandableBlockQuote) TextEntityTypeType() string { + return TypeTextEntityTypeExpandableBlockQuote +} + // A text description shown instead of a raw URL type TextEntityTypeTextUrl struct { meta @@ -20806,7 +34878,7 @@ func (*TextEntityTypeCustomEmoji) TextEntityTypeType() string { // A media timestamp type TextEntityTypeMediaTimestamp struct { meta - // Timestamp from which a video/audio/video note/voice note/story playing must start, in seconds. The media can be in the content or the web page preview of the current message, or in the same places in the replied message + // Timestamp from which a video/audio/video note/voice note/story playing must start, in seconds. The media can be in the content or the link preview of the current message, or in the same places in the replied message MediaTimestamp int32 `json:"media_timestamp"` } @@ -20878,11 +34950,156 @@ func (inputThumbnail *InputThumbnail) UnmarshalJSON(data []byte) error { return nil } +// The media is a photo. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20 +type InputPaidMediaTypePhoto struct{ + meta +} + +func (entity *InputPaidMediaTypePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPaidMediaTypePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*InputPaidMediaTypePhoto) GetClass() string { + return ClassInputPaidMediaType +} + +func (*InputPaidMediaTypePhoto) GetType() string { + return TypeInputPaidMediaTypePhoto +} + +func (*InputPaidMediaTypePhoto) InputPaidMediaTypeType() string { + return TypeInputPaidMediaTypePhoto +} + +// The media is a video +type InputPaidMediaTypeVideo struct { + meta + // Cover of the video; pass null to skip cover uploading + Cover InputFile `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` + // Duration of the video, in seconds + Duration int32 `json:"duration"` + // True, if the video is expected to be streamed + SupportsStreaming bool `json:"supports_streaming"` +} + +func (entity *InputPaidMediaTypeVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPaidMediaTypeVideo + + return json.Marshal((*stub)(entity)) +} + +func (*InputPaidMediaTypeVideo) GetClass() string { + return ClassInputPaidMediaType +} + +func (*InputPaidMediaTypeVideo) GetType() string { + return TypeInputPaidMediaTypeVideo +} + +func (*InputPaidMediaTypeVideo) InputPaidMediaTypeType() string { + return TypeInputPaidMediaTypeVideo +} + +func (inputPaidMediaTypeVideo *InputPaidMediaTypeVideo) UnmarshalJSON(data []byte) error { + var tmp struct { + Cover json.RawMessage `json:"cover"` + StartTimestamp int32 `json:"start_timestamp"` + Duration int32 `json:"duration"` + SupportsStreaming bool `json:"supports_streaming"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputPaidMediaTypeVideo.StartTimestamp = tmp.StartTimestamp + inputPaidMediaTypeVideo.Duration = tmp.Duration + inputPaidMediaTypeVideo.SupportsStreaming = tmp.SupportsStreaming + + fieldCover, _ := UnmarshalInputFile(tmp.Cover) + inputPaidMediaTypeVideo.Cover = fieldCover + + return nil +} + +// Describes a paid media to be sent +type InputPaidMedia struct { + meta + // Type of the media + Type InputPaidMediaType `json:"type"` + // Photo or video to be sent + Media InputFile `json:"media"` + // Media thumbnail; pass null to skip thumbnail uploading + Thumbnail *InputThumbnail `json:"thumbnail"` + // File identifiers of the stickers added to the media, if applicable + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + // Media width + Width int32 `json:"width"` + // Media height + Height int32 `json:"height"` +} + +func (entity *InputPaidMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputPaidMedia + + return json.Marshal((*stub)(entity)) +} + +func (*InputPaidMedia) GetClass() string { + return ClassInputPaidMedia +} + +func (*InputPaidMedia) GetType() string { + return TypeInputPaidMedia +} + +func (inputPaidMedia *InputPaidMedia) UnmarshalJSON(data []byte) error { + var tmp struct { + Type json.RawMessage `json:"type"` + Media json.RawMessage `json:"media"` + Thumbnail *InputThumbnail `json:"thumbnail"` + AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` + Width int32 `json:"width"` + Height int32 `json:"height"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputPaidMedia.Thumbnail = tmp.Thumbnail + inputPaidMedia.AddedStickerFileIds = tmp.AddedStickerFileIds + inputPaidMedia.Width = tmp.Width + inputPaidMedia.Height = tmp.Height + + fieldType, _ := UnmarshalInputPaidMediaType(tmp.Type) + inputPaidMedia.Type = fieldType + + fieldMedia, _ := UnmarshalInputFile(tmp.Media) + inputPaidMedia.Media = fieldMedia + + return nil +} + // The message will be sent at the specified date type MessageSchedulingStateSendAtDate struct { meta // Point in time (Unix timestamp) when the message will be sent. The date must be within 367 days in the future SendDate int32 `json:"send_date"` + // Period after which the message will be sent again; in seconds; 0 if never; for Telegram Premium users only; may be non-zero only in sendMessage and forwardMessages with one message requests; must be one of 0, 86400, 7 * 86400, 14 * 86400, 30 * 86400, 91 * 86400, 182 * 86400, 365 * 86400, or additionally 60, or 300 in the Test DC + RepeatPeriod int32 `json:"repeat_period"` } func (entity *MessageSchedulingStateSendAtDate) MarshalJSON() ([]byte, error) { @@ -20905,7 +35122,7 @@ func (*MessageSchedulingStateSendAtDate) MessageSchedulingStateType() string { return TypeMessageSchedulingStateSendAtDate } -// The message will be sent when the peer will be online. Applicable to private chats only and when the exact online status of the peer is known +// The message will be sent when the other user is online. Applicable to private chats only and when the exact online status of the other user is known type MessageSchedulingStateSendWhenOnline struct{ meta } @@ -20930,6 +35147,33 @@ func (*MessageSchedulingStateSendWhenOnline) MessageSchedulingStateType() string return TypeMessageSchedulingStateSendWhenOnline } +// The message will be sent when the video in the message is converted and optimized; can be used only by the server +type MessageSchedulingStateSendWhenVideoProcessed struct { + meta + // Approximate point in time (Unix timestamp) when the message is expected to be sent + SendDate int32 `json:"send_date"` +} + +func (entity *MessageSchedulingStateSendWhenVideoProcessed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageSchedulingStateSendWhenVideoProcessed + + return json.Marshal((*stub)(entity)) +} + +func (*MessageSchedulingStateSendWhenVideoProcessed) GetClass() string { + return ClassMessageSchedulingState +} + +func (*MessageSchedulingStateSendWhenVideoProcessed) GetType() string { + return TypeMessageSchedulingStateSendWhenVideoProcessed +} + +func (*MessageSchedulingStateSendWhenVideoProcessed) MessageSchedulingStateType() string { + return TypeMessageSchedulingStateSendWhenVideoProcessed +} + // The message will be self-destructed in the specified time after its content was opened type MessageSelfDestructTypeTimer struct { meta @@ -20985,16 +35229,24 @@ func (*MessageSelfDestructTypeImmediately) MessageSelfDestructTypeType() string // Options to be used when a message is sent type MessageSendOptions struct { meta + // Information about the suggested post; pass null if none. For messages to channel direct messages chat only. Applicable only to sendMessage and addOffer + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` // Pass true to disable notification for the message DisableNotification bool `json:"disable_notification"` // Pass true if the message is sent from the background FromBackground bool `json:"from_background"` // Pass true if the content of the message must be protected from forwarding and saving; for bots only ProtectContent bool `json:"protect_content"` + // Pass true to allow the message to ignore regular broadcast limits for a small fee; for bots only + AllowPaidBroadcast bool `json:"allow_paid_broadcast"` + // The number of Telegram Stars the user agreed to pay to send the messages + PaidMessageStarCount int64 `json:"paid_message_star_count"` // Pass true if the user explicitly chosen a sticker or a custom emoji from an installed sticker set; applicable only to sendMessage and sendMessageAlbum UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` - // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled + // Message scheduling state; pass null to send message immediately. Messages sent to a secret chat, to a chat with paid messages, to a channel direct messages chat, live location messages and self-destructing messages can't be scheduled SchedulingState MessageSchedulingState `json:"scheduling_state"` + // Identifier of the effect to apply to the message; pass 0 if none; applicable only to sendMessage, sendMessageAlbum in private chats and forwardMessages with one message to private chats + EffectId JsonInt64 `json:"effect_id"` // Non-persistent identifier, which will be returned back in messageSendingStatePending object and can be used to match sent messages and corresponding updateNewMessage updates SendingId int32 `json:"sending_id"` // Pass true to get a fake message instead of actually sending them @@ -21019,11 +35271,15 @@ func (*MessageSendOptions) GetType() string { func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { var tmp struct { + SuggestedPostInfo *InputSuggestedPostInfo `json:"suggested_post_info"` DisableNotification bool `json:"disable_notification"` FromBackground bool `json:"from_background"` ProtectContent bool `json:"protect_content"` + AllowPaidBroadcast bool `json:"allow_paid_broadcast"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` UpdateOrderOfInstalledStickerSets bool `json:"update_order_of_installed_sticker_sets"` SchedulingState json.RawMessage `json:"scheduling_state"` + EffectId JsonInt64 `json:"effect_id"` SendingId int32 `json:"sending_id"` OnlyPreview bool `json:"only_preview"` } @@ -21033,10 +35289,14 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { return err } + messageSendOptions.SuggestedPostInfo = tmp.SuggestedPostInfo messageSendOptions.DisableNotification = tmp.DisableNotification messageSendOptions.FromBackground = tmp.FromBackground messageSendOptions.ProtectContent = tmp.ProtectContent + messageSendOptions.AllowPaidBroadcast = tmp.AllowPaidBroadcast + messageSendOptions.PaidMessageStarCount = tmp.PaidMessageStarCount messageSendOptions.UpdateOrderOfInstalledStickerSets = tmp.UpdateOrderOfInstalledStickerSets + messageSendOptions.EffectId = tmp.EffectId messageSendOptions.SendingId = tmp.SendingId messageSendOptions.OnlyPreview = tmp.OnlyPreview @@ -21046,15 +35306,17 @@ func (messageSendOptions *MessageSendOptions) UnmarshalJSON(data []byte) error { return nil } -// Options to be used when a message content is copied without reference to the original sender. Service messages, and messages with messageInvoice or messagePremiumGiveaway content can't be copied +// Options to be used when a message content is copied without reference to the original sender. Service messages, messages with messageInvoice, messagePaidMedia, messageGiveaway, or messageGiveawayWinners content can't be copied type MessageCopyOptions struct { meta - // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local + // True, if content of the message needs to be copied without reference to the original sender. Always true if the message is forwarded to a secret chat or is local. Use messageProperties.can_be_copied and messageProperties.can_be_copied_to_secret_chat to check whether the message is suitable SendCopy bool `json:"send_copy"` // True, if media caption of the message copy needs to be replaced. Ignored if send_copy is false ReplaceCaption bool `json:"replace_caption"` // New message caption; pass null to copy message without caption. Ignored if replace_caption is false NewCaption *FormattedText `json:"new_caption"` + // True, if new caption must be shown above the media; otherwise, new caption must be shown below the media; not supported in secret chats. Ignored if replace_caption is false + NewShowCaptionAboveMedia bool `json:"new_show_caption_above_media"` } func (entity *MessageCopyOptions) MarshalJSON() ([]byte, error) { @@ -21076,11 +35338,11 @@ func (*MessageCopyOptions) GetType() string { // A text message type InputMessageText struct { meta - // Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually + // Formatted text to be sent; 0-getOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, ExpandableBlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually Text *FormattedText `json:"text"` - // Options to be used for generation of a link preview; pass null to use default link preview options + // Options to be used for generation of a link preview; may be null if none; pass null to use default link preview options LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options"` - // True, if a chat message draft must be deleted + // True, if the chat message draft must be deleted ClearDraft bool `json:"clear_draft"` } @@ -21121,6 +35383,8 @@ type InputMessageAnimation struct { Height int32 `json:"height"` // Animation caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` + // True, if the caption must be shown above the animation; otherwise, the caption must be shown below the animation; not supported in secret chats + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // True, if the animation preview must be covered by a spoiler animation; not supported in secret chats HasSpoiler bool `json:"has_spoiler"` } @@ -21154,6 +35418,7 @@ func (inputMessageAnimation *InputMessageAnimation) UnmarshalJSON(data []byte) e Width int32 `json:"width"` Height int32 `json:"height"` Caption *FormattedText `json:"caption"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` HasSpoiler bool `json:"has_spoiler"` } @@ -21168,6 +35433,7 @@ func (inputMessageAnimation *InputMessageAnimation) UnmarshalJSON(data []byte) e inputMessageAnimation.Width = tmp.Width inputMessageAnimation.Height = tmp.Height inputMessageAnimation.Caption = tmp.Caption + inputMessageAnimation.ShowCaptionAboveMedia = tmp.ShowCaptionAboveMedia inputMessageAnimation.HasSpoiler = tmp.HasSpoiler fieldAnimation, _ := UnmarshalInputFile(tmp.Animation) @@ -21247,7 +35513,7 @@ type InputMessageDocument struct { Document InputFile `json:"document"` // Document thumbnail; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` - // If true, automatic file type detection will be disabled and the document will always be sent as file. Always true for files sent to secret chats + // Pass true to disable automatic file type detection and send the document as a file. Always true for files sent to secret chats DisableContentTypeDetection bool `json:"disable_content_type_detection"` // Document caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` @@ -21296,6 +35562,41 @@ func (inputMessageDocument *InputMessageDocument) UnmarshalJSON(data []byte) err return nil } +// A message with paid media; can be used only in channel chats with supergroupFullInfo.has_paid_media_allowed +type InputMessagePaidMedia struct { + meta + // The number of Telegram Stars that must be paid to see the media; 1-getOption("paid_media_message_star_count_max") + StarCount int64 `json:"star_count"` + // The content of the paid media + PaidMedia []*InputPaidMedia `json:"paid_media"` + // Message caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters + Caption *FormattedText `json:"caption"` + // True, if the caption must be shown above the media; otherwise, the caption must be shown below the media; not supported in secret chats + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` + // Bot-provided data for the paid media; bots only + Payload string `json:"payload"` +} + +func (entity *InputMessagePaidMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessagePaidMedia + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessagePaidMedia) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessagePaidMedia) GetType() string { + return TypeInputMessagePaidMedia +} + +func (*InputMessagePaidMedia) InputMessageContentType() string { + return TypeInputMessagePaidMedia +} + // A photo message type InputMessagePhoto struct { meta @@ -21311,6 +35612,8 @@ type InputMessagePhoto struct { Height int32 `json:"height"` // Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` + // True, if the caption must be shown above the photo; otherwise, the caption must be shown below the photo; not supported in secret chats + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // Photo self-destruct type; pass null if none; private chats only SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // True, if the photo preview must be covered by a spoiler animation; not supported in secret chats @@ -21345,6 +35648,7 @@ func (inputMessagePhoto *InputMessagePhoto) UnmarshalJSON(data []byte) error { Width int32 `json:"width"` Height int32 `json:"height"` Caption *FormattedText `json:"caption"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` SelfDestructType json.RawMessage `json:"self_destruct_type"` HasSpoiler bool `json:"has_spoiler"` } @@ -21359,6 +35663,7 @@ func (inputMessagePhoto *InputMessagePhoto) UnmarshalJSON(data []byte) error { inputMessagePhoto.Width = tmp.Width inputMessagePhoto.Height = tmp.Height inputMessagePhoto.Caption = tmp.Caption + inputMessagePhoto.ShowCaptionAboveMedia = tmp.ShowCaptionAboveMedia inputMessagePhoto.HasSpoiler = tmp.HasSpoiler fieldPhoto, _ := UnmarshalInputFile(tmp.Photo) @@ -21433,10 +35738,14 @@ func (inputMessageSticker *InputMessageSticker) UnmarshalJSON(data []byte) error // A video message type InputMessageVideo struct { meta - // Video to be sent + // Video to be sent. The video is expected to be re-encoded to MPEG4 format with H.264 codec by the sender Video InputFile `json:"video"` // Video thumbnail; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` + // Cover of the video; pass null to skip cover uploading; not supported in secret chats and for self-destructing messages + Cover InputFile `json:"cover"` + // Timestamp from which the video playing must start, in seconds + StartTimestamp int32 `json:"start_timestamp"` // File identifiers of the stickers added to the video, if applicable AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` // Duration of the video, in seconds @@ -21445,10 +35754,12 @@ type InputMessageVideo struct { Width int32 `json:"width"` // Video height Height int32 `json:"height"` - // True, if the video is supposed to be streamed + // True, if the video is expected to be streamed SupportsStreaming bool `json:"supports_streaming"` // Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` + // True, if the caption must be shown above the video; otherwise, the caption must be shown below the video; not supported in secret chats + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` // Video self-destruct type; pass null if none; private chats only SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` // True, if the video preview must be covered by a spoiler animation; not supported in secret chats @@ -21479,12 +35790,15 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { var tmp struct { Video json.RawMessage `json:"video"` Thumbnail *InputThumbnail `json:"thumbnail"` + Cover json.RawMessage `json:"cover"` + StartTimestamp int32 `json:"start_timestamp"` AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` Duration int32 `json:"duration"` Width int32 `json:"width"` Height int32 `json:"height"` SupportsStreaming bool `json:"supports_streaming"` Caption *FormattedText `json:"caption"` + ShowCaptionAboveMedia bool `json:"show_caption_above_media"` SelfDestructType json.RawMessage `json:"self_destruct_type"` HasSpoiler bool `json:"has_spoiler"` } @@ -21495,17 +35809,22 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { } inputMessageVideo.Thumbnail = tmp.Thumbnail + inputMessageVideo.StartTimestamp = tmp.StartTimestamp inputMessageVideo.AddedStickerFileIds = tmp.AddedStickerFileIds inputMessageVideo.Duration = tmp.Duration inputMessageVideo.Width = tmp.Width inputMessageVideo.Height = tmp.Height inputMessageVideo.SupportsStreaming = tmp.SupportsStreaming inputMessageVideo.Caption = tmp.Caption + inputMessageVideo.ShowCaptionAboveMedia = tmp.ShowCaptionAboveMedia inputMessageVideo.HasSpoiler = tmp.HasSpoiler fieldVideo, _ := UnmarshalInputFile(tmp.Video) inputMessageVideo.Video = fieldVideo + fieldCover, _ := UnmarshalInputFile(tmp.Cover) + inputMessageVideo.Cover = fieldCover + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) inputMessageVideo.SelfDestructType = fieldSelfDestructType @@ -21515,14 +35834,16 @@ func (inputMessageVideo *InputMessageVideo) UnmarshalJSON(data []byte) error { // A video note message type InputMessageVideoNote struct { meta - // Video note to be sent + // Video note to be sent. The video is expected to be encoded to MPEG4 format with H.264 codec and have no data outside of the visible circle VideoNote InputFile `json:"video_note"` - // Video thumbnail; pass null to skip thumbnail uploading + // Video thumbnail; may be null if empty; pass null to skip thumbnail uploading Thumbnail *InputThumbnail `json:"thumbnail"` - // Duration of the video, in seconds + // Duration of the video, in seconds; 0-60 Duration int32 `json:"duration"` // Video width and height; must be positive and not greater than 640 Length int32 `json:"length"` + // Video note self-destruct type; may be null if none; pass null if none; private chats only + SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` } func (entity *InputMessageVideoNote) MarshalJSON() ([]byte, error) { @@ -21551,6 +35872,7 @@ func (inputMessageVideoNote *InputMessageVideoNote) UnmarshalJSON(data []byte) e Thumbnail *InputThumbnail `json:"thumbnail"` Duration int32 `json:"duration"` Length int32 `json:"length"` + SelfDestructType json.RawMessage `json:"self_destruct_type"` } err := json.Unmarshal(data, &tmp) @@ -21565,20 +35887,25 @@ func (inputMessageVideoNote *InputMessageVideoNote) UnmarshalJSON(data []byte) e fieldVideoNote, _ := UnmarshalInputFile(tmp.VideoNote) inputMessageVideoNote.VideoNote = fieldVideoNote + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) + inputMessageVideoNote.SelfDestructType = fieldSelfDestructType + return nil } // A voice note message type InputMessageVoiceNote struct { meta - // Voice note to be sent + // Voice note to be sent. The voice note must be encoded with the Opus codec and stored inside an OGG container with a single audio channel, or be in MP3 or M4A format as regular audio VoiceNote InputFile `json:"voice_note"` // Duration of the voice note, in seconds Duration int32 `json:"duration"` // Waveform representation of the voice note in 5-bit format Waveform []byte `json:"waveform"` - // Voice note caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters + // Voice note caption; may be null if empty; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` + // Voice note self-destruct type; may be null if none; pass null if none; private chats only + SelfDestructType MessageSelfDestructType `json:"self_destruct_type"` } func (entity *InputMessageVoiceNote) MarshalJSON() ([]byte, error) { @@ -21607,6 +35934,7 @@ func (inputMessageVoiceNote *InputMessageVoiceNote) UnmarshalJSON(data []byte) e Duration int32 `json:"duration"` Waveform []byte `json:"waveform"` Caption *FormattedText `json:"caption"` + SelfDestructType json.RawMessage `json:"self_destruct_type"` } err := json.Unmarshal(data, &tmp) @@ -21621,6 +35949,9 @@ func (inputMessageVoiceNote *InputMessageVoiceNote) UnmarshalJSON(data []byte) e fieldVoiceNote, _ := UnmarshalInputFile(tmp.VoiceNote) inputMessageVoiceNote.VoiceNote = fieldVoiceNote + fieldSelfDestructType, _ := UnmarshalMessageSelfDestructType(tmp.SelfDestructType) + inputMessageVoiceNote.SelfDestructType = fieldSelfDestructType + return nil } @@ -21629,7 +35960,7 @@ type InputMessageLocation struct { meta // Location to be sent Location *Location `json:"location"` - // Period for which the location can be updated, in seconds; must be between 60 and 86400 for a live location and 0 otherwise + // Period for which the location can be updated, in seconds; must be between 60 and 86400 for a temporary live location, 0x7FFFFFFF for permanent live location, and 0 otherwise LivePeriod int32 `json:"live_period"` // For live locations, a direction in which the location moves, in degrees; 1-360. Pass 0 if unknown Heading int32 `json:"heading"` @@ -21788,14 +36119,16 @@ type InputMessageInvoice struct { PhotoHeight int32 `json:"photo_height"` // The invoice payload Payload []byte `json:"payload"` - // Payment provider token + // Payment provider token; may be empty for payments in Telegram Stars ProviderToken string `json:"provider_token"` // JSON-encoded data about the invoice, which will be shared with the payment provider ProviderData string `json:"provider_data"` // Unique invoice bot deep link parameter for the generation of this invoice. If empty, it would be possible to pay directly from forwards of the invoice message StartParameter string `json:"start_parameter"` - // The content of extended media attached to the invoice. The content of the message to be sent. Must be one of the following types: inputMessagePhoto, inputMessageVideo - ExtendedMediaContent InputMessageContent `json:"extended_media_content"` + // The content of paid media attached to the invoice; pass null if none + PaidMedia *InputPaidMedia `json:"paid_media"` + // Paid media caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters + PaidMediaCaption *FormattedText `json:"paid_media_caption"` } func (entity *InputMessageInvoice) MarshalJSON() ([]byte, error) { @@ -21818,52 +36151,13 @@ func (*InputMessageInvoice) InputMessageContentType() string { return TypeInputMessageInvoice } -func (inputMessageInvoice *InputMessageInvoice) UnmarshalJSON(data []byte) error { - var tmp struct { - Invoice *Invoice `json:"invoice"` - Title string `json:"title"` - Description string `json:"description"` - PhotoUrl string `json:"photo_url"` - PhotoSize int32 `json:"photo_size"` - PhotoWidth int32 `json:"photo_width"` - PhotoHeight int32 `json:"photo_height"` - Payload []byte `json:"payload"` - ProviderToken string `json:"provider_token"` - ProviderData string `json:"provider_data"` - StartParameter string `json:"start_parameter"` - ExtendedMediaContent json.RawMessage `json:"extended_media_content"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inputMessageInvoice.Invoice = tmp.Invoice - inputMessageInvoice.Title = tmp.Title - inputMessageInvoice.Description = tmp.Description - inputMessageInvoice.PhotoUrl = tmp.PhotoUrl - inputMessageInvoice.PhotoSize = tmp.PhotoSize - inputMessageInvoice.PhotoWidth = tmp.PhotoWidth - inputMessageInvoice.PhotoHeight = tmp.PhotoHeight - inputMessageInvoice.Payload = tmp.Payload - inputMessageInvoice.ProviderToken = tmp.ProviderToken - inputMessageInvoice.ProviderData = tmp.ProviderData - inputMessageInvoice.StartParameter = tmp.StartParameter - - fieldExtendedMediaContent, _ := UnmarshalInputMessageContent(tmp.ExtendedMediaContent) - inputMessageInvoice.ExtendedMediaContent = fieldExtendedMediaContent - - return nil -} - -// A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot +// A message with a poll. Polls can't be sent to secret chats and channel direct messages chats. Polls can be sent to a private chat only if the chat is a chat with a bot or the Saved Messages chat type InputMessagePoll struct { meta - // Poll question; 1-255 characters (up to 300 characters for bots) - Question string `json:"question"` - // List of poll answer options, 2-10 strings 1-100 characters each - Options []string `json:"options"` + // Poll question; 1-255 characters (up to 300 characters for bots). Only custom emoji entities are allowed to be added and only by Premium users + Question *FormattedText `json:"question"` + // List of poll answer options, 2-getOption("poll_answer_count_max") strings 1-100 characters each. Only custom emoji entities are allowed to be added and only by Premium users + Options []*FormattedText `json:"options"` // True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels IsAnonymous bool `json:"is_anonymous"` // Type of the poll @@ -21898,8 +36192,8 @@ func (*InputMessagePoll) InputMessageContentType() string { func (inputMessagePoll *InputMessagePoll) UnmarshalJSON(data []byte) error { var tmp struct { - Question string `json:"question"` - Options []string `json:"options"` + Question *FormattedText `json:"question"` + Options []*FormattedText `json:"options"` IsAnonymous bool `json:"is_anonymous"` Type json.RawMessage `json:"type"` OpenPeriod int32 `json:"open_period"` @@ -21925,11 +36219,42 @@ func (inputMessagePoll *InputMessagePoll) UnmarshalJSON(data []byte) error { return nil } -// A message with a forwarded story. Stories can't be sent to secret chats. A story can be forwarded only if story.can_be_forwarded +// A stake dice message +type InputMessageStakeDice struct { + meta + // Hash of the stake dice state. The state hash can be used only if it was received recently enough. Otherwise, a new state must be requested using getStakeDiceState + StateHash string `json:"state_hash"` + // The Toncoin amount that will be staked; in the smallest units of the currency. Must be in the range getOption("stake_dice_stake_amount_min")-getOption("stake_dice_stake_amount_max") + StakeToncoinAmount int64 `json:"stake_toncoin_amount"` + // True, if the chat message draft must be deleted + ClearDraft bool `json:"clear_draft"` +} + +func (entity *InputMessageStakeDice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageStakeDice + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageStakeDice) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageStakeDice) GetType() string { + return TypeInputMessageStakeDice +} + +func (*InputMessageStakeDice) InputMessageContentType() string { + return TypeInputMessageStakeDice +} + +// A message with a forwarded story. Stories can't be forwarded to secret chats. A story can be forwarded only if story.can_be_forwarded type InputMessageStory struct { meta // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` } @@ -21954,15 +36279,46 @@ func (*InputMessageStory) InputMessageContentType() string { return TypeInputMessageStory } +// A message with a checklist. Checklists can't be sent to secret chats, channel chats and channel direct messages chats; for Telegram Premium users only +type InputMessageChecklist struct { + meta + // The checklist to send + Checklist *InputChecklist `json:"checklist"` +} + +func (entity *InputMessageChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessageChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessageChecklist) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessageChecklist) GetType() string { + return TypeInputMessageChecklist +} + +func (*InputMessageChecklist) InputMessageContentType() string { + return TypeInputMessageChecklist +} + // A forwarded message type InputMessageForwarded struct { meta // Identifier for the chat this forwarded message came from FromChatId int64 `json:"from_chat_id"` - // Identifier of the message to forward. A message can be forwarded only if message.can_be_forwarded + // Identifier of the message to forward. A message can be forwarded only if messageProperties.can_be_forwarded MessageId int64 `json:"message_id"` - // True, if a game message is being shared from a launched game; applies only to game messages + // Pass true if a game message is being shared from a launched game; applies only to game messages InGameShare bool `json:"in_game_share"` + // Pass true to replace video start timestamp in the forwarded message + ReplaceVideoStartTimestamp bool `json:"replace_video_start_timestamp"` + // The new video start timestamp; ignored if replace_video_start_timestamp == false + NewVideoStartTimestamp int32 `json:"new_video_start_timestamp"` // Options to be used to copy content of the message without reference to the original sender; pass null to forward the message as usual CopyOptions *MessageCopyOptions `json:"copy_options"` } @@ -21987,6 +36343,97 @@ func (*InputMessageForwarded) InputMessageContentType() string { return TypeInputMessageForwarded } +// Contains properties of a message and describes actions that can be done with the message right now +type MessageProperties struct { + meta + // True, if an offer can be added to the message using addOffer + CanAddOffer bool `json:"can_add_offer"` + // True, if tasks can be added to the message's checklist using addChecklistTasks if the current user has Telegram Premium subscription + CanAddTasks bool `json:"can_add_tasks"` + // True, if the message is a suggested post that can be approved by the user using approveSuggestedPost + CanBeApproved bool `json:"can_be_approved"` + // True, if content of the message can be copied using inputMessageForwarded or forwardMessages with copy options + CanBeCopied bool `json:"can_be_copied"` + // True, if content of the message can be copied to a secret chat using inputMessageForwarded or forwardMessages with copy options + CanBeCopiedToSecretChat bool `json:"can_be_copied_to_secret_chat"` + // True, if the message is a suggested post that can be declined by the user using declineSuggestedPost + CanBeDeclined bool `json:"can_be_declined"` + // True, if the message can be deleted only for the current user while other users will continue to see it using the method deleteMessages with revoke == false + CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` + // True, if the message can be deleted for all users using the method deleteMessages with revoke == true + CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` + // True, if the message can be edited using the methods editMessageText, editMessageCaption, or editMessageReplyMarkup. For live location, poll, and checklist messages this fields shows whether editMessageLiveLocation, stopPoll, or editMessageChecklist respectively can be used with this message + CanBeEdited bool `json:"can_be_edited"` + // True, if the message can be forwarded using inputMessageForwarded or forwardMessages without copy options + CanBeForwarded bool `json:"can_be_forwarded"` + // True, if the message can be paid using inputInvoiceMessage + CanBePaid bool `json:"can_be_paid"` + // True, if the message can be pinned or unpinned in the chat using pinChatMessage or unpinChatMessage + CanBePinned bool `json:"can_be_pinned"` + // True, if the message can be replied in the same chat and forum topic using inputMessageReplyToMessage + CanBeReplied bool `json:"can_be_replied"` + // True, if the message can be replied in another chat or forum topic using inputMessageReplyToExternalMessage + CanBeRepliedInAnotherChat bool `json:"can_be_replied_in_another_chat"` + // True, if content of the message can be saved locally + CanBeSaved bool `json:"can_be_saved"` + // True, if the message can be shared in a story using inputStoryAreaTypeMessage + CanBeSharedInStory bool `json:"can_be_shared_in_story"` + // True, if the message can be edited using the method editMessageMedia + CanEditMedia bool `json:"can_edit_media"` + // True, if scheduling state of the message can be edited + CanEditSchedulingState bool `json:"can_edit_scheduling_state"` + // True, if another price or post send time can be suggested using addOffer + CanEditSuggestedPostInfo bool `json:"can_edit_suggested_post_info"` + // True, if author of the message sent on behalf of a chat can be received through getMessageAuthor + CanGetAuthor bool `json:"can_get_author"` + // True, if code for message embedding can be received using getMessageEmbeddingCode + CanGetEmbeddingCode bool `json:"can_get_embedding_code"` + // True, if a link can be generated for the message using getMessageLink + CanGetLink bool `json:"can_get_link"` + // True, if media timestamp links can be generated for media timestamp entities in the message text, caption or link preview description using getMessageLink + CanGetMediaTimestampLinks bool `json:"can_get_media_timestamp_links"` + // True, if information about the message thread is available through getMessageThread and getMessageThreadHistory + CanGetMessageThread bool `json:"can_get_message_thread"` + // True, if read date of the message can be received through getMessageReadDate + CanGetReadDate bool `json:"can_get_read_date"` + // True, if message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards + CanGetStatistics bool `json:"can_get_statistics"` + // True, if advertisements for video of the message can be received though getVideoMessageAdvertisements + CanGetVideoAdvertisements bool `json:"can_get_video_advertisements"` + // True, if chat members already viewed the message can be received through getMessageViewers + CanGetViewers bool `json:"can_get_viewers"` + // True, if tasks can be marked as done or not done in the message's checklist using markChecklistTasksAsDone if the current user has Telegram Premium subscription + CanMarkTasksAsDone bool `json:"can_mark_tasks_as_done"` + // True, if speech can be recognized for the message through recognizeSpeech + CanRecognizeSpeech bool `json:"can_recognize_speech"` + // True, if the message can be reported using reportChat + CanReportChat bool `json:"can_report_chat"` + // True, if reactions on the message can be reported through reportMessageReactions + CanReportReactions bool `json:"can_report_reactions"` + // True, if the message can be reported using reportSupergroupSpam + CanReportSupergroupSpam bool `json:"can_report_supergroup_spam"` + // True, if fact check for the message can be changed through setMessageFactCheck + CanSetFactCheck bool `json:"can_set_fact_check"` + // True, if message statistics must be available from context menu of the message + NeedShowStatistics bool `json:"need_show_statistics"` +} + +func (entity *MessageProperties) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageProperties + + return json.Marshal((*stub)(entity)) +} + +func (*MessageProperties) GetClass() string { + return ClassMessageProperties +} + +func (*MessageProperties) GetType() string { + return TypeMessageProperties +} + // Returns all found messages, no filter is applied type SearchMessagesFilterEmpty struct{ meta @@ -22412,6 +36859,81 @@ func (*SearchMessagesFilterPinned) SearchMessagesFilterType() string { return TypeSearchMessagesFilterPinned } +// Returns only messages in private chats +type SearchMessagesChatTypeFilterPrivate struct{ + meta +} + +func (entity *SearchMessagesChatTypeFilterPrivate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesChatTypeFilterPrivate + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesChatTypeFilterPrivate) GetClass() string { + return ClassSearchMessagesChatTypeFilter +} + +func (*SearchMessagesChatTypeFilterPrivate) GetType() string { + return TypeSearchMessagesChatTypeFilterPrivate +} + +func (*SearchMessagesChatTypeFilterPrivate) SearchMessagesChatTypeFilterType() string { + return TypeSearchMessagesChatTypeFilterPrivate +} + +// Returns only messages in basic group and supergroup chats +type SearchMessagesChatTypeFilterGroup struct{ + meta +} + +func (entity *SearchMessagesChatTypeFilterGroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesChatTypeFilterGroup + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesChatTypeFilterGroup) GetClass() string { + return ClassSearchMessagesChatTypeFilter +} + +func (*SearchMessagesChatTypeFilterGroup) GetType() string { + return TypeSearchMessagesChatTypeFilterGroup +} + +func (*SearchMessagesChatTypeFilterGroup) SearchMessagesChatTypeFilterType() string { + return TypeSearchMessagesChatTypeFilterGroup +} + +// Returns only messages in channel chats +type SearchMessagesChatTypeFilterChannel struct{ + meta +} + +func (entity *SearchMessagesChatTypeFilterChannel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SearchMessagesChatTypeFilterChannel + + return json.Marshal((*stub)(entity)) +} + +func (*SearchMessagesChatTypeFilterChannel) GetClass() string { + return ClassSearchMessagesChatTypeFilter +} + +func (*SearchMessagesChatTypeFilterChannel) GetType() string { + return TypeSearchMessagesChatTypeFilterChannel +} + +func (*SearchMessagesChatTypeFilterChannel) SearchMessagesChatTypeFilterType() string { + return TypeSearchMessagesChatTypeFilterChannel +} + // The user is typing a message type ChatActionTyping struct{ meta @@ -22799,7 +37321,7 @@ func (*ChatActionCancel) ChatActionType() string { return TypeChatActionCancel } -// The user status was never changed +// The user's status has never been changed type UserStatusEmpty struct{ meta } @@ -22879,8 +37401,10 @@ func (*UserStatusOffline) UserStatusType() string { } // The user was online recently -type UserStatusRecently struct{ +type UserStatusRecently struct { meta + // Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium + ByMyPrivacySettings bool `json:"by_my_privacy_settings"` } func (entity *UserStatusRecently) MarshalJSON() ([]byte, error) { @@ -22904,8 +37428,10 @@ func (*UserStatusRecently) UserStatusType() string { } // The user is offline, but was online last week -type UserStatusLastWeek struct{ +type UserStatusLastWeek struct { meta + // Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium + ByMyPrivacySettings bool `json:"by_my_privacy_settings"` } func (entity *UserStatusLastWeek) MarshalJSON() ([]byte, error) { @@ -22929,8 +37455,10 @@ func (*UserStatusLastWeek) UserStatusType() string { } // The user is offline, but was online last month -type UserStatusLastMonth struct{ +type UserStatusLastMonth struct { meta + // Exact user's status is hidden because the current user enabled userPrivacySettingShowStatus privacy setting for the user and has no Telegram Premium + ByMyPrivacySettings bool `json:"by_my_privacy_settings"` } func (entity *UserStatusLastMonth) MarshalJSON() ([]byte, error) { @@ -22953,6 +37481,54 @@ func (*UserStatusLastMonth) UserStatusType() string { return TypeUserStatusLastMonth } +// Represents an emoji with its keyword +type EmojiKeyword struct { + meta + // The emoji + Emoji string `json:"emoji"` + // The keyword + Keyword string `json:"keyword"` +} + +func (entity *EmojiKeyword) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiKeyword + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiKeyword) GetClass() string { + return ClassEmojiKeyword +} + +func (*EmojiKeyword) GetType() string { + return TypeEmojiKeyword +} + +// Represents a list of emojis with their keywords +type EmojiKeywords struct { + meta + // List of emojis with their keywords + EmojiKeywords []*EmojiKeyword `json:"emoji_keywords"` +} + +func (entity *EmojiKeywords) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiKeywords + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiKeywords) GetClass() string { + return ClassEmojiKeywords +} + +func (*EmojiKeywords) GetType() string { + return TypeEmojiKeywords +} + // Represents a list of stickers type Stickers struct { meta @@ -22976,7 +37552,7 @@ func (*Stickers) GetType() string { return TypeStickers } -// Represents a list of emoji +// Represents a list of emojis type Emojis struct { meta // List of emojis @@ -23010,25 +37586,27 @@ type StickerSet struct { Name string `json:"name"` // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed Thumbnail *Thumbnail `json:"thumbnail"` - // Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + // Sticker set thumbnail's outline; may be null if unknown + ThumbnailOutline *Outline `json:"thumbnail_outline"` + // True, if the sticker set is owned by the current user + IsOwned bool `json:"is_owned"` // True, if the sticker set has been installed by the current user IsInstalled bool `json:"is_installed"` // True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously IsArchived bool `json:"is_archived"` // True, if the sticker set is official IsOfficial bool `json:"is_official"` - // Format of the stickers in the set - StickerFormat StickerFormat `json:"sticker_format"` // Type of the stickers in the set StickerType StickerType `json:"sticker_type"` // True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only NeedsRepainting bool `json:"needs_repainting"` + // True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only + IsAllowedAsChatEmojiStatus bool `json:"is_allowed_as_chat_emoji_status"` // True for already viewed trending sticker sets IsViewed bool `json:"is_viewed"` // List of stickers in this set Stickers []*Sticker `json:"stickers"` - // A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object + // A list of emojis corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object Emojis []*Emojis `json:"emojis"` } @@ -23054,13 +37632,14 @@ func (stickerSet *StickerSet) UnmarshalJSON(data []byte) error { Title string `json:"title"` Name string `json:"name"` Thumbnail *Thumbnail `json:"thumbnail"` - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + ThumbnailOutline *Outline `json:"thumbnail_outline"` + IsOwned bool `json:"is_owned"` IsInstalled bool `json:"is_installed"` IsArchived bool `json:"is_archived"` IsOfficial bool `json:"is_official"` - StickerFormat json.RawMessage `json:"sticker_format"` StickerType json.RawMessage `json:"sticker_type"` NeedsRepainting bool `json:"needs_repainting"` + IsAllowedAsChatEmojiStatus bool `json:"is_allowed_as_chat_emoji_status"` IsViewed bool `json:"is_viewed"` Stickers []*Sticker `json:"stickers"` Emojis []*Emojis `json:"emojis"` @@ -23076,17 +37655,16 @@ func (stickerSet *StickerSet) UnmarshalJSON(data []byte) error { stickerSet.Name = tmp.Name stickerSet.Thumbnail = tmp.Thumbnail stickerSet.ThumbnailOutline = tmp.ThumbnailOutline + stickerSet.IsOwned = tmp.IsOwned stickerSet.IsInstalled = tmp.IsInstalled stickerSet.IsArchived = tmp.IsArchived stickerSet.IsOfficial = tmp.IsOfficial stickerSet.NeedsRepainting = tmp.NeedsRepainting + stickerSet.IsAllowedAsChatEmojiStatus = tmp.IsAllowedAsChatEmojiStatus stickerSet.IsViewed = tmp.IsViewed stickerSet.Stickers = tmp.Stickers stickerSet.Emojis = tmp.Emojis - fieldStickerFormat, _ := UnmarshalStickerFormat(tmp.StickerFormat) - stickerSet.StickerFormat = fieldStickerFormat - fieldStickerType, _ := UnmarshalStickerType(tmp.StickerType) stickerSet.StickerType = fieldStickerType @@ -23102,22 +37680,24 @@ type StickerSetInfo struct { Title string `json:"title"` // Name of the sticker set Name string `json:"name"` - // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null + // Sticker set thumbnail in WEBP, TGS, or WEBM format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed Thumbnail *Thumbnail `json:"thumbnail"` - // Sticker set thumbnail's outline represented as a list of closed vector paths; may be empty. The coordinate system origin is in the upper-left corner - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + // Sticker set thumbnail's outline; may be null if unknown + ThumbnailOutline *Outline `json:"thumbnail_outline"` + // True, if the sticker set is owned by the current user + IsOwned bool `json:"is_owned"` // True, if the sticker set has been installed by the current user IsInstalled bool `json:"is_installed"` // True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously IsArchived bool `json:"is_archived"` // True, if the sticker set is official IsOfficial bool `json:"is_official"` - // Format of the stickers in the set - StickerFormat StickerFormat `json:"sticker_format"` // Type of the stickers in the set StickerType StickerType `json:"sticker_type"` // True, if stickers in the sticker set are custom emoji that must be repainted; for custom emoji sticker sets only NeedsRepainting bool `json:"needs_repainting"` + // True, if stickers in the sticker set are custom emoji that can be used as chat emoji status; for custom emoji sticker sets only + IsAllowedAsChatEmojiStatus bool `json:"is_allowed_as_chat_emoji_status"` // True for already viewed trending sticker sets IsViewed bool `json:"is_viewed"` // Total number of stickers in the set @@ -23148,13 +37728,14 @@ func (stickerSetInfo *StickerSetInfo) UnmarshalJSON(data []byte) error { Title string `json:"title"` Name string `json:"name"` Thumbnail *Thumbnail `json:"thumbnail"` - ThumbnailOutline []*ClosedVectorPath `json:"thumbnail_outline"` + ThumbnailOutline *Outline `json:"thumbnail_outline"` + IsOwned bool `json:"is_owned"` IsInstalled bool `json:"is_installed"` IsArchived bool `json:"is_archived"` IsOfficial bool `json:"is_official"` - StickerFormat json.RawMessage `json:"sticker_format"` StickerType json.RawMessage `json:"sticker_type"` NeedsRepainting bool `json:"needs_repainting"` + IsAllowedAsChatEmojiStatus bool `json:"is_allowed_as_chat_emoji_status"` IsViewed bool `json:"is_viewed"` Size int32 `json:"size"` Covers []*Sticker `json:"covers"` @@ -23170,17 +37751,16 @@ func (stickerSetInfo *StickerSetInfo) UnmarshalJSON(data []byte) error { stickerSetInfo.Name = tmp.Name stickerSetInfo.Thumbnail = tmp.Thumbnail stickerSetInfo.ThumbnailOutline = tmp.ThumbnailOutline + stickerSetInfo.IsOwned = tmp.IsOwned stickerSetInfo.IsInstalled = tmp.IsInstalled stickerSetInfo.IsArchived = tmp.IsArchived stickerSetInfo.IsOfficial = tmp.IsOfficial stickerSetInfo.NeedsRepainting = tmp.NeedsRepainting + stickerSetInfo.IsAllowedAsChatEmojiStatus = tmp.IsAllowedAsChatEmojiStatus stickerSetInfo.IsViewed = tmp.IsViewed stickerSetInfo.Size = tmp.Size stickerSetInfo.Covers = tmp.Covers - fieldStickerFormat, _ := UnmarshalStickerFormat(tmp.StickerFormat) - stickerSetInfo.StickerFormat = fieldStickerFormat - fieldStickerType, _ := UnmarshalStickerType(tmp.StickerType) stickerSetInfo.StickerType = fieldStickerType @@ -23239,15 +37819,69 @@ func (*TrendingStickerSets) GetType() string { return TypeTrendingStickerSets } -// Contains a list of similar emoji to search for in getStickers and searchStickers +// The category contains a list of similar emoji to search for in getStickers and searchStickers for stickers, or getInlineQueryResults with the bot getOption("animation_search_bot_username") for animations +type EmojiCategorySourceSearch struct { + meta + // List of emojis to search for + Emojis []string `json:"emojis"` +} + +func (entity *EmojiCategorySourceSearch) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiCategorySourceSearch + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiCategorySourceSearch) GetClass() string { + return ClassEmojiCategorySource +} + +func (*EmojiCategorySourceSearch) GetType() string { + return TypeEmojiCategorySourceSearch +} + +func (*EmojiCategorySourceSearch) EmojiCategorySourceType() string { + return TypeEmojiCategorySourceSearch +} + +// The category contains premium stickers that must be found by getPremiumStickers +type EmojiCategorySourcePremium struct{ + meta +} + +func (entity *EmojiCategorySourcePremium) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiCategorySourcePremium + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiCategorySourcePremium) GetClass() string { + return ClassEmojiCategorySource +} + +func (*EmojiCategorySourcePremium) GetType() string { + return TypeEmojiCategorySourcePremium +} + +func (*EmojiCategorySourcePremium) EmojiCategorySourceType() string { + return TypeEmojiCategorySourcePremium +} + +// Describes an emoji category type EmojiCategory struct { meta // Name of the category Name string `json:"name"` // Custom emoji sticker, which represents icon of the category Icon *Sticker `json:"icon"` - // List of emojis in the category - Emojis []string `json:"emojis"` + // Source of stickers for the emoji category + Source EmojiCategorySource `json:"source"` + // True, if the category must be shown first when choosing a sticker for the start page + IsGreeting bool `json:"is_greeting"` } func (entity *EmojiCategory) MarshalJSON() ([]byte, error) { @@ -23266,6 +37900,29 @@ func (*EmojiCategory) GetType() string { return TypeEmojiCategory } +func (emojiCategory *EmojiCategory) UnmarshalJSON(data []byte) error { + var tmp struct { + Name string `json:"name"` + Icon *Sticker `json:"icon"` + Source json.RawMessage `json:"source"` + IsGreeting bool `json:"is_greeting"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + emojiCategory.Name = tmp.Name + emojiCategory.Icon = tmp.Icon + emojiCategory.IsGreeting = tmp.IsGreeting + + fieldSource, _ := UnmarshalEmojiCategorySource(tmp.Source) + emojiCategory.Source = fieldSource + + return nil +} + // Represents a list of emoji categories type EmojiCategories struct { meta @@ -23289,7 +37946,7 @@ func (*EmojiCategories) GetType() string { return TypeEmojiCategories } -// The category must be used by default +// The category must be used by default (e.g., for custom emoji or animation search) type EmojiCategoryTypeDefault struct{ meta } @@ -23314,6 +37971,31 @@ func (*EmojiCategoryTypeDefault) EmojiCategoryTypeType() string { return TypeEmojiCategoryTypeDefault } +// The category must be used by default for regular sticker selection. It may contain greeting emoji category and premium stickers +type EmojiCategoryTypeRegularStickers struct{ + meta +} + +func (entity *EmojiCategoryTypeRegularStickers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmojiCategoryTypeRegularStickers + + return json.Marshal((*stub)(entity)) +} + +func (*EmojiCategoryTypeRegularStickers) GetClass() string { + return ClassEmojiCategoryType +} + +func (*EmojiCategoryTypeRegularStickers) GetType() string { + return TypeEmojiCategoryTypeRegularStickers +} + +func (*EmojiCategoryTypeRegularStickers) EmojiCategoryTypeType() string { + return TypeEmojiCategoryTypeRegularStickers +} + // The category must be used for emoji status selection type EmojiCategoryTypeEmojiStatus struct{ meta @@ -23364,87 +38046,29 @@ func (*EmojiCategoryTypeChatPhoto) EmojiCategoryTypeType() string { return TypeEmojiCategoryTypeChatPhoto } -// Represents a viewer of a story -type StoryViewer struct { +// Describes the current weather +type CurrentWeather struct { meta - // User identifier of the viewer - UserId int64 `json:"user_id"` - // Approximate point in time (Unix timestamp) when the story was viewed - ViewDate int32 `json:"view_date"` - // Block list to which the user is added; may be null if none - BlockList BlockList `json:"block_list"` - // Type of the reaction that was chosen by the user; may be null if none - ChosenReactionType ReactionType `json:"chosen_reaction_type"` + // Temperature, in degree Celsius + Temperature float64 `json:"temperature"` + // Emoji representing the weather + Emoji string `json:"emoji"` } -func (entity *StoryViewer) MarshalJSON() ([]byte, error) { +func (entity *CurrentWeather) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StoryViewer + type stub CurrentWeather return json.Marshal((*stub)(entity)) } -func (*StoryViewer) GetClass() string { - return ClassStoryViewer +func (*CurrentWeather) GetClass() string { + return ClassCurrentWeather } -func (*StoryViewer) GetType() string { - return TypeStoryViewer -} - -func (storyViewer *StoryViewer) UnmarshalJSON(data []byte) error { - var tmp struct { - UserId int64 `json:"user_id"` - ViewDate int32 `json:"view_date"` - BlockList json.RawMessage `json:"block_list"` - ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - storyViewer.UserId = tmp.UserId - storyViewer.ViewDate = tmp.ViewDate - - fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) - storyViewer.BlockList = fieldBlockList - - fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) - storyViewer.ChosenReactionType = fieldChosenReactionType - - return nil -} - -// Represents a list of story viewers -type StoryViewers struct { - meta - // Approximate total number of story viewers found - TotalCount int32 `json:"total_count"` - // Approximate total number of reactions set by found story viewers - TotalReactionCount int32 `json:"total_reaction_count"` - // List of story viewers - Viewers []*StoryViewer `json:"viewers"` - // The offset for the next request. If empty, there are no more results - NextOffset string `json:"next_offset"` -} - -func (entity *StoryViewers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub StoryViewers - - return json.Marshal((*stub)(entity)) -} - -func (*StoryViewers) GetClass() string { - return ClassStoryViewers -} - -func (*StoryViewers) GetType() string { - return TypeStoryViewers +func (*CurrentWeather) GetType() string { + return TypeCurrentWeather } // Describes position of a clickable rectangle area on a story media @@ -23460,6 +38084,8 @@ type StoryAreaPosition struct { HeightPercentage float64 `json:"height_percentage"` // Clockwise rotation angle of the rectangle, in degrees; 0-360 RotationAngle float64 `json:"rotation_angle"` + // The radius of the rectangle corner rounding, as a percentage of the media width + CornerRadiusPercentage float64 `json:"corner_radius_percentage"` } func (entity *StoryAreaPosition) MarshalJSON() ([]byte, error) { @@ -23483,6 +38109,8 @@ type StoryAreaTypeLocation struct { meta // The location Location *Location `json:"location"` + // Address of the location; may be null if unknown + Address *LocationAddress `json:"address"` } func (entity *StoryAreaTypeLocation) MarshalJSON() ([]byte, error) { @@ -23588,6 +38216,120 @@ func (storyAreaTypeSuggestedReaction *StoryAreaTypeSuggestedReaction) UnmarshalJ return nil } +// An area pointing to a message +type StoryAreaTypeMessage struct { + meta + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +func (entity *StoryAreaTypeMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeMessage + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeMessage) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeMessage) GetType() string { + return TypeStoryAreaTypeMessage +} + +func (*StoryAreaTypeMessage) StoryAreaTypeType() string { + return TypeStoryAreaTypeMessage +} + +// An area pointing to a HTTP or tg:// link +type StoryAreaTypeLink struct { + meta + // HTTP or tg:// URL to be opened when the area is clicked + Url string `json:"url"` +} + +func (entity *StoryAreaTypeLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeLink + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeLink) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeLink) GetType() string { + return TypeStoryAreaTypeLink +} + +func (*StoryAreaTypeLink) StoryAreaTypeType() string { + return TypeStoryAreaTypeLink +} + +// An area with information about weather +type StoryAreaTypeWeather struct { + meta + // Temperature, in degree Celsius + Temperature float64 `json:"temperature"` + // Emoji representing the weather + Emoji string `json:"emoji"` + // A color of the area background in the ARGB format + BackgroundColor int32 `json:"background_color"` +} + +func (entity *StoryAreaTypeWeather) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeWeather + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeWeather) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeWeather) GetType() string { + return TypeStoryAreaTypeWeather +} + +func (*StoryAreaTypeWeather) StoryAreaTypeType() string { + return TypeStoryAreaTypeWeather +} + +// An area with an upgraded gift +type StoryAreaTypeUpgradedGift struct { + meta + // Unique name of the upgraded gift + GiftName string `json:"gift_name"` +} + +func (entity *StoryAreaTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAreaTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAreaTypeUpgradedGift) GetClass() string { + return ClassStoryAreaType +} + +func (*StoryAreaTypeUpgradedGift) GetType() string { + return TypeStoryAreaTypeUpgradedGift +} + +func (*StoryAreaTypeUpgradedGift) StoryAreaTypeType() string { + return TypeStoryAreaTypeUpgradedGift +} + // Describes a clickable rectangle area on a story media type StoryArea struct { meta @@ -23637,6 +38379,8 @@ type InputStoryAreaTypeLocation struct { meta // The location Location *Location `json:"location"` + // Address of the location; pass null if unknown + Address *LocationAddress `json:"address"` } func (entity *InputStoryAreaTypeLocation) MarshalJSON() ([]byte, error) { @@ -23769,6 +38513,120 @@ func (inputStoryAreaTypeSuggestedReaction *InputStoryAreaTypeSuggestedReaction) return nil } +// An area pointing to a message +type InputStoryAreaTypeMessage struct { + meta + // Identifier of the chat with the message. Currently, the chat must be a supergroup or a channel chat + ChatId int64 `json:"chat_id"` + // Identifier of the message. Use messageProperties.can_be_shared_in_story to check whether the message is suitable + MessageId int64 `json:"message_id"` +} + +func (entity *InputStoryAreaTypeMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeMessage + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeMessage) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeMessage) GetType() string { + return TypeInputStoryAreaTypeMessage +} + +func (*InputStoryAreaTypeMessage) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeMessage +} + +// An area pointing to a HTTP or tg:// link +type InputStoryAreaTypeLink struct { + meta + // HTTP or tg:// URL to be opened when the area is clicked + Url string `json:"url"` +} + +func (entity *InputStoryAreaTypeLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeLink + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeLink) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeLink) GetType() string { + return TypeInputStoryAreaTypeLink +} + +func (*InputStoryAreaTypeLink) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeLink +} + +// An area with information about weather +type InputStoryAreaTypeWeather struct { + meta + // Temperature, in degree Celsius + Temperature float64 `json:"temperature"` + // Emoji representing the weather + Emoji string `json:"emoji"` + // A color of the area background in the ARGB format + BackgroundColor int32 `json:"background_color"` +} + +func (entity *InputStoryAreaTypeWeather) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeWeather + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeWeather) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeWeather) GetType() string { + return TypeInputStoryAreaTypeWeather +} + +func (*InputStoryAreaTypeWeather) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeWeather +} + +// An area with an upgraded gift +type InputStoryAreaTypeUpgradedGift struct { + meta + // Unique name of the upgraded gift + GiftName string `json:"gift_name"` +} + +func (entity *InputStoryAreaTypeUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputStoryAreaTypeUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*InputStoryAreaTypeUpgradedGift) GetClass() string { + return ClassInputStoryAreaType +} + +func (*InputStoryAreaTypeUpgradedGift) GetType() string { + return TypeInputStoryAreaTypeUpgradedGift +} + +func (*InputStoryAreaTypeUpgradedGift) InputStoryAreaTypeType() string { + return TypeInputStoryAreaTypeUpgradedGift +} + // Describes a clickable rectangle area on a story media to be added type InputStoryArea struct { meta @@ -23816,7 +38674,7 @@ func (inputStoryArea *InputStoryArea) UnmarshalJSON(data []byte) error { // Contains a list of story areas to be added type InputStoryAreas struct { meta - // List of 0-10 input story areas + // List of input story areas. Currently, a story can have up to 10 inputStoryAreaTypeLocation, inputStoryAreaTypeFoundVenue, and inputStoryAreaTypePreviousVenue areas, up to getOption("story_suggested_reaction_area_count_max") inputStoryAreaTypeSuggestedReaction areas, up to 1 inputStoryAreaTypeMessage area, up to getOption("story_link_area_count_max") inputStoryAreaTypeLink areas if the current user is a Telegram Premium user, up to 3 inputStoryAreaTypeWeather areas, and up to 1 inputStoryAreaTypeUpgradedGift area Areas []*InputStoryArea `json:"areas"` } @@ -23836,7 +38694,7 @@ func (*InputStoryAreas) GetType() string { return TypeInputStoryAreas } -// Describes a video file sent in a story +// Describes a video file posted as a story type StoryVideo struct { meta // Duration of the video, in seconds @@ -23853,8 +38711,10 @@ type StoryVideo struct { Minithumbnail *Minithumbnail `json:"minithumbnail"` // Video thumbnail in JPEG or MPEG4 format; may be null Thumbnail *Thumbnail `json:"thumbnail"` - // Size of file prefix, which is supposed to be preloaded, in bytes + // Size of file prefix, which is expected to be preloaded, in bytes PreloadPrefixSize int32 `json:"preload_prefix_size"` + // Timestamp of the frame used as video thumbnail + CoverFrameTimestamp float64 `json:"cover_frame_timestamp"` // File containing the video Video *File `json:"video"` } @@ -23875,6 +38735,106 @@ func (*StoryVideo) GetType() string { return TypeStoryVideo } +// A photo story +type StoryContentTypePhoto struct{ + meta +} + +func (entity *StoryContentTypePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryContentTypePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*StoryContentTypePhoto) GetClass() string { + return ClassStoryContentType +} + +func (*StoryContentTypePhoto) GetType() string { + return TypeStoryContentTypePhoto +} + +func (*StoryContentTypePhoto) StoryContentTypeType() string { + return TypeStoryContentTypePhoto +} + +// A video story +type StoryContentTypeVideo struct{ + meta +} + +func (entity *StoryContentTypeVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryContentTypeVideo + + return json.Marshal((*stub)(entity)) +} + +func (*StoryContentTypeVideo) GetClass() string { + return ClassStoryContentType +} + +func (*StoryContentTypeVideo) GetType() string { + return TypeStoryContentTypeVideo +} + +func (*StoryContentTypeVideo) StoryContentTypeType() string { + return TypeStoryContentTypeVideo +} + +// A live story +type StoryContentTypeLive struct{ + meta +} + +func (entity *StoryContentTypeLive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryContentTypeLive + + return json.Marshal((*stub)(entity)) +} + +func (*StoryContentTypeLive) GetClass() string { + return ClassStoryContentType +} + +func (*StoryContentTypeLive) GetType() string { + return TypeStoryContentTypeLive +} + +func (*StoryContentTypeLive) StoryContentTypeType() string { + return TypeStoryContentTypeLive +} + +// A story of unknown content type +type StoryContentTypeUnsupported struct{ + meta +} + +func (entity *StoryContentTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryContentTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*StoryContentTypeUnsupported) GetClass() string { + return ClassStoryContentType +} + +func (*StoryContentTypeUnsupported) GetType() string { + return TypeStoryContentTypeUnsupported +} + +func (*StoryContentTypeUnsupported) StoryContentTypeType() string { + return TypeStoryContentTypeUnsupported +} + // A photo story type StoryContentPhoto struct { meta @@ -23907,7 +38867,7 @@ type StoryContentVideo struct { meta // The video in MPEG4 format Video *StoryVideo `json:"video"` - // Alternative version of the video in MPEG4 format, encoded by x264 codec; may be null + // Alternative version of the video in MPEG4 format, encoded with H.264 codec; may be null AlternativeVideo *StoryVideo `json:"alternative_video"` } @@ -23931,6 +38891,35 @@ func (*StoryContentVideo) StoryContentType() string { return TypeStoryContentVideo } +// A live story +type StoryContentLive struct { + meta + // Identifier of the corresponding group call. The group call can be received through the method getGroupCall + GroupCallId int32 `json:"group_call_id"` + // True, if the call is an RTMP stream instead of an ordinary group call + IsRtmpStream bool `json:"is_rtmp_stream"` +} + +func (entity *StoryContentLive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryContentLive + + return json.Marshal((*stub)(entity)) +} + +func (*StoryContentLive) GetClass() string { + return ClassStoryContent +} + +func (*StoryContentLive) GetType() string { + return TypeStoryContentLive +} + +func (*StoryContentLive) StoryContentType() string { + return TypeStoryContentLive +} + // A story content that is not supported in the current TDLib version type StoryContentUnsupported struct{ meta @@ -24007,12 +38996,14 @@ func (inputStoryContentPhoto *InputStoryContentPhoto) UnmarshalJSON(data []byte) // A video story type InputStoryContentVideo struct { meta - // Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with x265 codec and key frames added each second + // Video to be sent. The video size must be 720x1280. The video must be streamable and stored in MPEG4 format, after encoding with H.265 codec and key frames added each second Video InputFile `json:"video"` // File identifiers of the stickers added to the video, if applicable AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` // Precise duration of the video, in seconds; 0-60 Duration float64 `json:"duration"` + // Timestamp of the frame, which will be used as video thumbnail + CoverFrameTimestamp float64 `json:"cover_frame_timestamp"` // True, if the video has no sound IsAnimation bool `json:"is_animation"` } @@ -24042,6 +39033,7 @@ func (inputStoryContentVideo *InputStoryContentVideo) UnmarshalJSON(data []byte) Video json.RawMessage `json:"video"` AddedStickerFileIds []int32 `json:"added_sticker_file_ids"` Duration float64 `json:"duration"` + CoverFrameTimestamp float64 `json:"cover_frame_timestamp"` IsAnimation bool `json:"is_animation"` } @@ -24052,6 +39044,7 @@ func (inputStoryContentVideo *InputStoryContentVideo) UnmarshalJSON(data []byte) inputStoryContentVideo.AddedStickerFileIds = tmp.AddedStickerFileIds inputStoryContentVideo.Duration = tmp.Duration + inputStoryContentVideo.CoverFrameTimestamp = tmp.CoverFrameTimestamp inputStoryContentVideo.IsAnimation = tmp.IsAnimation fieldVideo, _ := UnmarshalInputFile(tmp.Video) @@ -24110,6 +39103,106 @@ func (*StoryListArchive) StoryListType() string { return TypeStoryListArchive } +// The original story was a public story that was posted by a known chat +type StoryOriginPublicStory struct { + meta + // Identifier of the chat that posted original story + ChatId int64 `json:"chat_id"` + // Story identifier of the original story + StoryId int32 `json:"story_id"` +} + +func (entity *StoryOriginPublicStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryOriginPublicStory + + return json.Marshal((*stub)(entity)) +} + +func (*StoryOriginPublicStory) GetClass() string { + return ClassStoryOrigin +} + +func (*StoryOriginPublicStory) GetType() string { + return TypeStoryOriginPublicStory +} + +func (*StoryOriginPublicStory) StoryOriginType() string { + return TypeStoryOriginPublicStory +} + +// The original story was posted by an unknown user +type StoryOriginHiddenUser struct { + meta + // Name of the user or the chat that posted the story + PosterName string `json:"poster_name"` +} + +func (entity *StoryOriginHiddenUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryOriginHiddenUser + + return json.Marshal((*stub)(entity)) +} + +func (*StoryOriginHiddenUser) GetClass() string { + return ClassStoryOrigin +} + +func (*StoryOriginHiddenUser) GetType() string { + return TypeStoryOriginHiddenUser +} + +func (*StoryOriginHiddenUser) StoryOriginType() string { + return TypeStoryOriginHiddenUser +} + +// Contains information about original story that was reposted +type StoryRepostInfo struct { + meta + // Origin of the story that was reposted + Origin StoryOrigin `json:"origin"` + // True, if story content was modified during reposting; otherwise, story wasn't modified + IsContentModified bool `json:"is_content_modified"` +} + +func (entity *StoryRepostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryRepostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*StoryRepostInfo) GetClass() string { + return ClassStoryRepostInfo +} + +func (*StoryRepostInfo) GetType() string { + return TypeStoryRepostInfo +} + +func (storyRepostInfo *StoryRepostInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Origin json.RawMessage `json:"origin"` + IsContentModified bool `json:"is_content_modified"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + storyRepostInfo.IsContentModified = tmp.IsContentModified + + fieldOrigin, _ := UnmarshalStoryOrigin(tmp.Origin) + storyRepostInfo.Origin = fieldOrigin + + return nil +} + // Contains information about interactions with a story type StoryInteractionInfo struct { meta @@ -24142,36 +39235,46 @@ func (*StoryInteractionInfo) GetType() string { // Represents a story type Story struct { meta - // Unique story identifier among stories of the given sender + // Unique story identifier among stories posted by the given chat Id int32 `json:"id"` // Identifier of the chat that posted the story - SenderChatId int64 `json:"sender_chat_id"` + PosterChatId int64 `json:"poster_chat_id"` + // Identifier of the user or chat that posted the story; may be null if the story is posted on behalf of the poster_chat_id + PosterId MessageSender `json:"poster_id"` // Point in time (Unix timestamp) when the story was published Date int32 `json:"date"` - // True, if the story is being sent by the current user - IsBeingSent bool `json:"is_being_sent"` + // True, if the story is being posted by the current user + IsBeingPosted bool `json:"is_being_posted"` // True, if the story is being edited by the current user IsBeingEdited bool `json:"is_being_edited"` // True, if the story was edited IsEdited bool `json:"is_edited"` - // True, if the story is saved in the sender's profile and will be available there after expiration - IsPinned bool `json:"is_pinned"` + // True, if the story is saved in the profile of the chat that posted it and will be available there after expiration + IsPostedToChatPage bool `json:"is_posted_to_chat_page"` // True, if the story is visible only for the current user IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + // True, if the story can be added to an album using createStoryAlbum and addStoryAlbumStories + CanBeAddedToAlbum bool `json:"can_be_added_to_album"` // True, if the story can be deleted CanBeDeleted bool `json:"can_be_deleted"` // True, if the story can be edited CanBeEdited bool `json:"can_be_edited"` - // True, if the story can be forwarded as a message. Otherwise, screenshots and saving of the story content must be also forbidden + // True, if the story can be forwarded as a message or reposted as a story. Otherwise, screenshotting and saving of the story content must be also forbidden CanBeForwarded bool `json:"can_be_forwarded"` - // True, if the story can be replied in the chat with the story sender + // True, if the story can be replied in the chat with the user who posted the story CanBeReplied bool `json:"can_be_replied"` - // True, if the story's is_pinned value can be changed - CanToggleIsPinned bool `json:"can_toggle_is_pinned"` - // True, if users viewed the story can be received through getStoryViewers - CanGetViewers bool `json:"can_get_viewers"` + // True, if the story privacy settings can be changed + CanSetPrivacySettings bool `json:"can_set_privacy_settings"` + // True, if the story's is_posted_to_chat_page value can be changed + CanToggleIsPostedToChatPage bool `json:"can_toggle_is_posted_to_chat_page"` + // True, if the story statistics are available through getStoryStatistics + CanGetStatistics bool `json:"can_get_statistics"` + // True, if interactions with the story can be received through getStoryInteractions + CanGetInteractions bool `json:"can_get_interactions"` // True, if users viewed the story can't be received, because the story has expired more than getOption("story_viewers_expiration_delay") seconds ago HasExpiredViewers bool `json:"has_expired_viewers"` + // Information about the original story; may be null if the story wasn't reposted + RepostInfo *StoryRepostInfo `json:"repost_info"` // Information about interactions with the story; may be null if the story isn't owned or there were no interactions InteractionInfo *StoryInteractionInfo `json:"interaction_info"` // Type of the chosen reaction; may be null if none @@ -24184,6 +39287,8 @@ type Story struct { Areas []*StoryArea `json:"areas"` // Caption of the story Caption *FormattedText `json:"caption"` + // Identifiers of story albums to which the story is added; only for manageable stories + AlbumIds []int32 `json:"album_ids"` } func (entity *Story) MarshalJSON() ([]byte, error) { @@ -24205,26 +39310,32 @@ func (*Story) GetType() string { func (story *Story) UnmarshalJSON(data []byte) error { var tmp struct { Id int32 `json:"id"` - SenderChatId int64 `json:"sender_chat_id"` + PosterChatId int64 `json:"poster_chat_id"` + PosterId json.RawMessage `json:"poster_id"` Date int32 `json:"date"` - IsBeingSent bool `json:"is_being_sent"` + IsBeingPosted bool `json:"is_being_posted"` IsBeingEdited bool `json:"is_being_edited"` IsEdited bool `json:"is_edited"` - IsPinned bool `json:"is_pinned"` + IsPostedToChatPage bool `json:"is_posted_to_chat_page"` IsVisibleOnlyForSelf bool `json:"is_visible_only_for_self"` + CanBeAddedToAlbum bool `json:"can_be_added_to_album"` CanBeDeleted bool `json:"can_be_deleted"` CanBeEdited bool `json:"can_be_edited"` CanBeForwarded bool `json:"can_be_forwarded"` CanBeReplied bool `json:"can_be_replied"` - CanToggleIsPinned bool `json:"can_toggle_is_pinned"` - CanGetViewers bool `json:"can_get_viewers"` + CanSetPrivacySettings bool `json:"can_set_privacy_settings"` + CanToggleIsPostedToChatPage bool `json:"can_toggle_is_posted_to_chat_page"` + CanGetStatistics bool `json:"can_get_statistics"` + CanGetInteractions bool `json:"can_get_interactions"` HasExpiredViewers bool `json:"has_expired_viewers"` + RepostInfo *StoryRepostInfo `json:"repost_info"` InteractionInfo *StoryInteractionInfo `json:"interaction_info"` ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` PrivacySettings json.RawMessage `json:"privacy_settings"` Content json.RawMessage `json:"content"` Areas []*StoryArea `json:"areas"` Caption *FormattedText `json:"caption"` + AlbumIds []int32 `json:"album_ids"` } err := json.Unmarshal(data, &tmp) @@ -24233,23 +39344,31 @@ func (story *Story) UnmarshalJSON(data []byte) error { } story.Id = tmp.Id - story.SenderChatId = tmp.SenderChatId + story.PosterChatId = tmp.PosterChatId story.Date = tmp.Date - story.IsBeingSent = tmp.IsBeingSent + story.IsBeingPosted = tmp.IsBeingPosted story.IsBeingEdited = tmp.IsBeingEdited story.IsEdited = tmp.IsEdited - story.IsPinned = tmp.IsPinned + story.IsPostedToChatPage = tmp.IsPostedToChatPage story.IsVisibleOnlyForSelf = tmp.IsVisibleOnlyForSelf + story.CanBeAddedToAlbum = tmp.CanBeAddedToAlbum story.CanBeDeleted = tmp.CanBeDeleted story.CanBeEdited = tmp.CanBeEdited story.CanBeForwarded = tmp.CanBeForwarded story.CanBeReplied = tmp.CanBeReplied - story.CanToggleIsPinned = tmp.CanToggleIsPinned - story.CanGetViewers = tmp.CanGetViewers + story.CanSetPrivacySettings = tmp.CanSetPrivacySettings + story.CanToggleIsPostedToChatPage = tmp.CanToggleIsPostedToChatPage + story.CanGetStatistics = tmp.CanGetStatistics + story.CanGetInteractions = tmp.CanGetInteractions story.HasExpiredViewers = tmp.HasExpiredViewers + story.RepostInfo = tmp.RepostInfo story.InteractionInfo = tmp.InteractionInfo story.Areas = tmp.Areas story.Caption = tmp.Caption + story.AlbumIds = tmp.AlbumIds + + fieldPosterId, _ := UnmarshalMessageSender(tmp.PosterId) + story.PosterId = fieldPosterId fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) story.ChosenReactionType = fieldChosenReactionType @@ -24270,6 +39389,8 @@ type Stories struct { TotalCount int32 `json:"total_count"` // The list of stories Stories []*Story `json:"stories"` + // Identifiers of the pinned stories; returned only in getChatPostedToChatPageStories with from_story_id == 0 + PinnedStoryIds []int32 `json:"pinned_story_ids"` } func (entity *Stories) MarshalJSON() ([]byte, error) { @@ -24288,15 +39409,121 @@ func (*Stories) GetType() string { return TypeStories } +// Contains a list of stories found by a search +type FoundStories struct { + meta + // Approximate total number of stories found + TotalCount int32 `json:"total_count"` + // List of stories + Stories []*Story `json:"stories"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *FoundStories) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FoundStories + + return json.Marshal((*stub)(entity)) +} + +func (*FoundStories) GetClass() string { + return ClassFoundStories +} + +func (*FoundStories) GetType() string { + return TypeFoundStories +} + +// Describes album of stories +type StoryAlbum struct { + meta + // Unique identifier of the album + Id int32 `json:"id"` + // Name of the album + Name string `json:"name"` + // Icon of the album; may be null if none + PhotoIcon *Photo `json:"photo_icon"` + // Video icon of the album; may be null if none + VideoIcon *Video `json:"video_icon"` +} + +func (entity *StoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAlbum) GetClass() string { + return ClassStoryAlbum +} + +func (*StoryAlbum) GetType() string { + return TypeStoryAlbum +} + +// Represents a list of story albums +type StoryAlbums struct { + meta + // List of story albums + Albums []*StoryAlbum `json:"albums"` +} + +func (entity *StoryAlbums) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryAlbums + + return json.Marshal((*stub)(entity)) +} + +func (*StoryAlbums) GetClass() string { + return ClassStoryAlbums +} + +func (*StoryAlbums) GetType() string { + return TypeStoryAlbums +} + +// Contains identifier of a story along with identifier of the chat that posted it +type StoryFullId struct { + meta + // Identifier of the chat that posted the story + PosterChatId int64 `json:"poster_chat_id"` + // Unique story identifier among stories of the chat + StoryId int32 `json:"story_id"` +} + +func (entity *StoryFullId) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryFullId + + return json.Marshal((*stub)(entity)) +} + +func (*StoryFullId) GetClass() string { + return ClassStoryFullId +} + +func (*StoryFullId) GetType() string { + return TypeStoryFullId +} + // Contains basic information about a story type StoryInfo struct { meta - // Unique story identifier among stories of the given sender + // Unique story identifier among stories of the chat StoryId int32 `json:"story_id"` // Point in time (Unix timestamp) when the story was published Date int32 `json:"date"` // True, if the story is available only to close friends IsForCloseFriends bool `json:"is_for_close_friends"` + // True, if the story is a live story + IsLive bool `json:"is_live"` } func (entity *StoryInfo) MarshalJSON() ([]byte, error) { @@ -24322,11 +39549,13 @@ type ChatActiveStories struct { ChatId int64 `json:"chat_id"` // Identifier of the story list in which the stories are shown; may be null if the stories aren't shown in a story list List StoryList `json:"list"` - // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_sender_chat_id) in descending order + // A parameter used to determine order of the stories in the story list; 0 if the stories doesn't need to be shown in the story list. Stories must be sorted by the pair (order, story_poster_chat_id) in descending order Order int64 `json:"order"` + // True, if the stories are shown in the main story list and can be archived; otherwise, the stories can be hidden from the main story list only by calling removeTopChat with topChatCategoryUsers and the chat_id. Stories of the current user can't be archived nor hidden using removeTopChat + CanBeArchived bool `json:"can_be_archived"` // Identifier of the last read active story MaxReadStoryId int32 `json:"max_read_story_id"` - // Basic information about the stories; use getStory to get full information about the stories. The stories are in a chronological order (i.e., in order of increasing story identifiers) + // Basic information about the stories; use getStory to get full information about the stories. The stories are in chronological order (i.e., in order of increasing story identifiers) Stories []*StoryInfo `json:"stories"` } @@ -24351,6 +39580,7 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { ChatId int64 `json:"chat_id"` List json.RawMessage `json:"list"` Order int64 `json:"order"` + CanBeArchived bool `json:"can_be_archived"` MaxReadStoryId int32 `json:"max_read_story_id"` Stories []*StoryInfo `json:"stories"` } @@ -24362,6 +39592,7 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { chatActiveStories.ChatId = tmp.ChatId chatActiveStories.Order = tmp.Order + chatActiveStories.CanBeArchived = tmp.CanBeArchived chatActiveStories.MaxReadStoryId = tmp.MaxReadStoryId chatActiveStories.Stories = tmp.Stories @@ -24371,6 +39602,600 @@ func (chatActiveStories *ChatActiveStories) UnmarshalJSON(data []byte) error { return nil } +// A view of the story +type StoryInteractionTypeView struct { + meta + // Type of the reaction that was chosen by the viewer; may be null if none + ChosenReactionType ReactionType `json:"chosen_reaction_type"` +} + +func (entity *StoryInteractionTypeView) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryInteractionTypeView + + return json.Marshal((*stub)(entity)) +} + +func (*StoryInteractionTypeView) GetClass() string { + return ClassStoryInteractionType +} + +func (*StoryInteractionTypeView) GetType() string { + return TypeStoryInteractionTypeView +} + +func (*StoryInteractionTypeView) StoryInteractionTypeType() string { + return TypeStoryInteractionTypeView +} + +func (storyInteractionTypeView *StoryInteractionTypeView) UnmarshalJSON(data []byte) error { + var tmp struct { + ChosenReactionType json.RawMessage `json:"chosen_reaction_type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldChosenReactionType, _ := UnmarshalReactionType(tmp.ChosenReactionType) + storyInteractionTypeView.ChosenReactionType = fieldChosenReactionType + + return nil +} + +// A forward of the story as a message +type StoryInteractionTypeForward struct { + meta + // The message with story forward + Message *Message `json:"message"` +} + +func (entity *StoryInteractionTypeForward) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryInteractionTypeForward + + return json.Marshal((*stub)(entity)) +} + +func (*StoryInteractionTypeForward) GetClass() string { + return ClassStoryInteractionType +} + +func (*StoryInteractionTypeForward) GetType() string { + return TypeStoryInteractionTypeForward +} + +func (*StoryInteractionTypeForward) StoryInteractionTypeType() string { + return TypeStoryInteractionTypeForward +} + +// A repost of the story as a story +type StoryInteractionTypeRepost struct { + meta + // The reposted story + Story *Story `json:"story"` +} + +func (entity *StoryInteractionTypeRepost) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryInteractionTypeRepost + + return json.Marshal((*stub)(entity)) +} + +func (*StoryInteractionTypeRepost) GetClass() string { + return ClassStoryInteractionType +} + +func (*StoryInteractionTypeRepost) GetType() string { + return TypeStoryInteractionTypeRepost +} + +func (*StoryInteractionTypeRepost) StoryInteractionTypeType() string { + return TypeStoryInteractionTypeRepost +} + +// Represents interaction with a story +type StoryInteraction struct { + meta + // Identifier of the user or chat that made the interaction + ActorId MessageSender `json:"actor_id"` + // Approximate point in time (Unix timestamp) when the interaction happened + InteractionDate int32 `json:"interaction_date"` + // Block list to which the actor is added; may be null if none or for chat stories + BlockList BlockList `json:"block_list"` + // Type of the interaction + Type StoryInteractionType `json:"type"` +} + +func (entity *StoryInteraction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryInteraction + + return json.Marshal((*stub)(entity)) +} + +func (*StoryInteraction) GetClass() string { + return ClassStoryInteraction +} + +func (*StoryInteraction) GetType() string { + return TypeStoryInteraction +} + +func (storyInteraction *StoryInteraction) UnmarshalJSON(data []byte) error { + var tmp struct { + ActorId json.RawMessage `json:"actor_id"` + InteractionDate int32 `json:"interaction_date"` + BlockList json.RawMessage `json:"block_list"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + storyInteraction.InteractionDate = tmp.InteractionDate + + fieldActorId, _ := UnmarshalMessageSender(tmp.ActorId) + storyInteraction.ActorId = fieldActorId + + fieldBlockList, _ := UnmarshalBlockList(tmp.BlockList) + storyInteraction.BlockList = fieldBlockList + + fieldType, _ := UnmarshalStoryInteractionType(tmp.Type) + storyInteraction.Type = fieldType + + return nil +} + +// Represents a list of interactions with a story +type StoryInteractions struct { + meta + // Approximate total number of interactions found + TotalCount int32 `json:"total_count"` + // Approximate total number of found forwards and reposts; always 0 for chat stories + TotalForwardCount int32 `json:"total_forward_count"` + // Approximate total number of found reactions; always 0 for chat stories + TotalReactionCount int32 `json:"total_reaction_count"` + // List of story interactions + Interactions []*StoryInteraction `json:"interactions"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *StoryInteractions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryInteractions + + return json.Marshal((*stub)(entity)) +} + +func (*StoryInteractions) GetClass() string { + return ClassStoryInteractions +} + +func (*StoryInteractions) GetType() string { + return TypeStoryInteractions +} + +// Describes a message that can be used for quick reply +type QuickReplyMessage struct { + meta + // Unique message identifier among all quick replies + Id int64 `json:"id"` + // The sending state of the message; may be null if the message isn't being sent and didn't fail to be sent + SendingState MessageSendingState `json:"sending_state"` + // True, if the message can be edited + CanBeEdited bool `json:"can_be_edited"` + // The identifier of the quick reply message to which the message replies; 0 if none + ReplyToMessageId int64 `json:"reply_to_message_id"` + // If non-zero, the user identifier of the bot through which this message was sent + ViaBotUserId int64 `json:"via_bot_user_id"` + // Unique identifier of an album this message belongs to; 0 if none. Only audios, documents, photos and videos can be grouped together in albums + MediaAlbumId JsonInt64 `json:"media_album_id"` + // Content of the message + Content MessageContent `json:"content"` + // Inline keyboard reply markup for the message; may be null if none + ReplyMarkup ReplyMarkup `json:"reply_markup"` +} + +func (entity *QuickReplyMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub QuickReplyMessage + + return json.Marshal((*stub)(entity)) +} + +func (*QuickReplyMessage) GetClass() string { + return ClassQuickReplyMessage +} + +func (*QuickReplyMessage) GetType() string { + return TypeQuickReplyMessage +} + +func (quickReplyMessage *QuickReplyMessage) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int64 `json:"id"` + SendingState json.RawMessage `json:"sending_state"` + CanBeEdited bool `json:"can_be_edited"` + ReplyToMessageId int64 `json:"reply_to_message_id"` + ViaBotUserId int64 `json:"via_bot_user_id"` + MediaAlbumId JsonInt64 `json:"media_album_id"` + Content json.RawMessage `json:"content"` + ReplyMarkup json.RawMessage `json:"reply_markup"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + quickReplyMessage.Id = tmp.Id + quickReplyMessage.CanBeEdited = tmp.CanBeEdited + quickReplyMessage.ReplyToMessageId = tmp.ReplyToMessageId + quickReplyMessage.ViaBotUserId = tmp.ViaBotUserId + quickReplyMessage.MediaAlbumId = tmp.MediaAlbumId + + fieldSendingState, _ := UnmarshalMessageSendingState(tmp.SendingState) + quickReplyMessage.SendingState = fieldSendingState + + fieldContent, _ := UnmarshalMessageContent(tmp.Content) + quickReplyMessage.Content = fieldContent + + fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) + quickReplyMessage.ReplyMarkup = fieldReplyMarkup + + return nil +} + +// Contains a list of quick reply messages +type QuickReplyMessages struct { + meta + // List of quick reply messages; messages may be null + Messages []*QuickReplyMessage `json:"messages"` +} + +func (entity *QuickReplyMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub QuickReplyMessages + + return json.Marshal((*stub)(entity)) +} + +func (*QuickReplyMessages) GetClass() string { + return ClassQuickReplyMessages +} + +func (*QuickReplyMessages) GetType() string { + return TypeQuickReplyMessages +} + +// Describes a shortcut that can be used for a quick reply +type QuickReplyShortcut struct { + meta + // Unique shortcut identifier + Id int32 `json:"id"` + // The name of the shortcut that can be used to use the shortcut + Name string `json:"name"` + // The first shortcut message + FirstMessage *QuickReplyMessage `json:"first_message"` + // The total number of messages in the shortcut + MessageCount int32 `json:"message_count"` +} + +func (entity *QuickReplyShortcut) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub QuickReplyShortcut + + return json.Marshal((*stub)(entity)) +} + +func (*QuickReplyShortcut) GetClass() string { + return ClassQuickReplyShortcut +} + +func (*QuickReplyShortcut) GetType() string { + return TypeQuickReplyShortcut +} + +// Contains a public forward as a message +type PublicForwardMessage struct { + meta + // Information about the message + Message *Message `json:"message"` +} + +func (entity *PublicForwardMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicForwardMessage + + return json.Marshal((*stub)(entity)) +} + +func (*PublicForwardMessage) GetClass() string { + return ClassPublicForward +} + +func (*PublicForwardMessage) GetType() string { + return TypePublicForwardMessage +} + +func (*PublicForwardMessage) PublicForwardType() string { + return TypePublicForwardMessage +} + +// Contains a public repost to a story +type PublicForwardStory struct { + meta + // Information about the story + Story *Story `json:"story"` +} + +func (entity *PublicForwardStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicForwardStory + + return json.Marshal((*stub)(entity)) +} + +func (*PublicForwardStory) GetClass() string { + return ClassPublicForward +} + +func (*PublicForwardStory) GetType() string { + return TypePublicForwardStory +} + +func (*PublicForwardStory) PublicForwardType() string { + return TypePublicForwardStory +} + +// Represents a list of public forwards and reposts as a story of a message or a story +type PublicForwards struct { + meta + // Approximate total number of messages and stories found + TotalCount int32 `json:"total_count"` + // List of found public forwards and reposts + Forwards []PublicForward `json:"forwards"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *PublicForwards) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PublicForwards + + return json.Marshal((*stub)(entity)) +} + +func (*PublicForwards) GetClass() string { + return ClassPublicForwards +} + +func (*PublicForwards) GetType() string { + return TypePublicForwards +} + +func (publicForwards *PublicForwards) UnmarshalJSON(data []byte) error { + var tmp struct { + TotalCount int32 `json:"total_count"` + Forwards []json.RawMessage `json:"forwards"` + NextOffset string `json:"next_offset"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + publicForwards.TotalCount = tmp.TotalCount + publicForwards.NextOffset = tmp.NextOffset + + fieldForwards, _ := UnmarshalListOfPublicForward(tmp.Forwards) + publicForwards.Forwards = fieldForwards + + return nil +} + +// Describes media previews of a bot +type BotMediaPreview struct { + meta + // Point in time (Unix timestamp) when the preview was added or changed last time + Date int32 `json:"date"` + // Content of the preview; may only be of the types storyContentPhoto, storyContentVideo, or storyContentUnsupported + Content StoryContent `json:"content"` +} + +func (entity *BotMediaPreview) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotMediaPreview + + return json.Marshal((*stub)(entity)) +} + +func (*BotMediaPreview) GetClass() string { + return ClassBotMediaPreview +} + +func (*BotMediaPreview) GetType() string { + return TypeBotMediaPreview +} + +func (botMediaPreview *BotMediaPreview) UnmarshalJSON(data []byte) error { + var tmp struct { + Date int32 `json:"date"` + Content json.RawMessage `json:"content"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + botMediaPreview.Date = tmp.Date + + fieldContent, _ := UnmarshalStoryContent(tmp.Content) + botMediaPreview.Content = fieldContent + + return nil +} + +// Contains a list of media previews of a bot +type BotMediaPreviews struct { + meta + // List of media previews + Previews []*BotMediaPreview `json:"previews"` +} + +func (entity *BotMediaPreviews) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotMediaPreviews + + return json.Marshal((*stub)(entity)) +} + +func (*BotMediaPreviews) GetClass() string { + return ClassBotMediaPreviews +} + +func (*BotMediaPreviews) GetType() string { + return TypeBotMediaPreviews +} + +// Contains a list of media previews of a bot for the given language and the list of languages for which the bot has dedicated previews +type BotMediaPreviewInfo struct { + meta + // List of media previews + Previews []*BotMediaPreview `json:"previews"` + // List of language codes for which the bot has dedicated previews + LanguageCodes []string `json:"language_codes"` +} + +func (entity *BotMediaPreviewInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BotMediaPreviewInfo + + return json.Marshal((*stub)(entity)) +} + +func (*BotMediaPreviewInfo) GetClass() string { + return ClassBotMediaPreviewInfo +} + +func (*BotMediaPreviewInfo) GetType() string { + return TypeBotMediaPreviewInfo +} + +// Contains a list of features available on a specific chat boost level +type ChatBoostLevelFeatures struct { + meta + // Target chat boost level + Level int32 `json:"level"` + // Number of stories that the chat can publish daily + StoryPerDayCount int32 `json:"story_per_day_count"` + // Number of custom emoji reactions that can be added to the list of available reactions + CustomEmojiReactionCount int32 `json:"custom_emoji_reaction_count"` + // Number of custom colors for chat title + TitleColorCount int32 `json:"title_color_count"` + // Number of custom colors for profile photo background + ProfileAccentColorCount int32 `json:"profile_accent_color_count"` + // True, if custom emoji for profile background can be set + CanSetProfileBackgroundCustomEmoji bool `json:"can_set_profile_background_custom_emoji"` + // Number of custom colors for background of empty chat photo, replies to messages and link previews + AccentColorCount int32 `json:"accent_color_count"` + // True, if custom emoji for reply header and link preview background can be set + CanSetBackgroundCustomEmoji bool `json:"can_set_background_custom_emoji"` + // True, if emoji status can be set + CanSetEmojiStatus bool `json:"can_set_emoji_status"` + // Number of chat theme backgrounds that can be set as chat background + ChatThemeBackgroundCount int32 `json:"chat_theme_background_count"` + // True, if custom background can be set in the chat for all users + CanSetCustomBackground bool `json:"can_set_custom_background"` + // True, if custom emoji sticker set can be set for the chat + CanSetCustomEmojiStickerSet bool `json:"can_set_custom_emoji_sticker_set"` + // True, if automatic translation of messages can be enabled in the chat + CanEnableAutomaticTranslation bool `json:"can_enable_automatic_translation"` + // True, if speech recognition can be used for video note and voice note messages by all users + CanRecognizeSpeech bool `json:"can_recognize_speech"` + // True, if sponsored messages can be disabled in the chat + CanDisableSponsoredMessages bool `json:"can_disable_sponsored_messages"` +} + +func (entity *ChatBoostLevelFeatures) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostLevelFeatures + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostLevelFeatures) GetClass() string { + return ClassChatBoostLevelFeatures +} + +func (*ChatBoostLevelFeatures) GetType() string { + return TypeChatBoostLevelFeatures +} + +// Contains a list of features available on the first chat boost levels +type ChatBoostFeatures struct { + meta + // The list of features + Features []*ChatBoostLevelFeatures `json:"features"` + // The minimum boost level required to set custom emoji for profile background + MinProfileBackgroundCustomEmojiBoostLevel int32 `json:"min_profile_background_custom_emoji_boost_level"` + // The minimum boost level required to set custom emoji for reply header and link preview background; for channel chats only + MinBackgroundCustomEmojiBoostLevel int32 `json:"min_background_custom_emoji_boost_level"` + // The minimum boost level required to set emoji status + MinEmojiStatusBoostLevel int32 `json:"min_emoji_status_boost_level"` + // The minimum boost level required to set a chat theme background as chat background + MinChatThemeBackgroundBoostLevel int32 `json:"min_chat_theme_background_boost_level"` + // The minimum boost level required to set custom chat background + MinCustomBackgroundBoostLevel int32 `json:"min_custom_background_boost_level"` + // The minimum boost level required to set custom emoji sticker set for the chat; for supergroup chats only + MinCustomEmojiStickerSetBoostLevel int32 `json:"min_custom_emoji_sticker_set_boost_level"` + // The minimum boost level allowing to enable automatic translation of messages for non-Premium users; for channel chats only + MinAutomaticTranslationBoostLevel int32 `json:"min_automatic_translation_boost_level"` + // The minimum boost level allowing to recognize speech in video note and voice note messages for non-Premium users; for supergroup chats only + MinSpeechRecognitionBoostLevel int32 `json:"min_speech_recognition_boost_level"` + // The minimum boost level allowing to disable sponsored messages in the chat; for channel chats only + MinSponsoredMessageDisableBoostLevel int32 `json:"min_sponsored_message_disable_boost_level"` +} + +func (entity *ChatBoostFeatures) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatBoostFeatures + + return json.Marshal((*stub)(entity)) +} + +func (*ChatBoostFeatures) GetClass() string { + return ClassChatBoostFeatures +} + +func (*ChatBoostFeatures) GetType() string { + return TypeChatBoostFeatures +} + // The chat created a Telegram Premium gift code for a user type ChatBoostSourceGiftCode struct { meta @@ -24400,16 +40225,18 @@ func (*ChatBoostSourceGiftCode) ChatBoostSourceType() string { return TypeChatBoostSourceGiftCode } -// The chat created a Telegram Premium giveaway +// The chat created a giveaway type ChatBoostSourceGiveaway struct { meta - // Identifier of a user that won in the giveaway; 0 if none + // Identifier of a user who won in the giveaway; 0 if none UserId int64 `json:"user_id"` - // The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise + // The created Telegram Premium gift code if it was used by the user or can be claimed by the current user; an empty string otherwise; for Telegram Premium giveways only GiftCode string `json:"gift_code"` + // Number of Telegram Stars distributed among winners of the giveaway + StarCount int64 `json:"star_count"` // Identifier of the corresponding giveaway message; can be an identifier of a deleted message GiveawayMessageId int64 `json:"giveaway_message_id"` - // True, if the winner for the corresponding Telegram Premium subscription wasn't chosen, because there were not enough participants + // True, if the winner for the corresponding giveaway prize wasn't chosen, because there were not enough participants IsUnclaimed bool `json:"is_unclaimed"` } @@ -24460,33 +40287,60 @@ func (*ChatBoostSourcePremium) ChatBoostSourceType() string { return TypeChatBoostSourcePremium } -// Describes a prepaid Telegram Premium giveaway -type PrepaidPremiumGiveaway struct { +// Describes a prepaid giveaway +type PrepaidGiveaway struct { meta // Unique identifier of the prepaid giveaway Id JsonInt64 `json:"id"` - // Number of users which will receive Telegram Premium subscription gift codes + // Number of users which will receive giveaway prize WinnerCount int32 `json:"winner_count"` - // Number of month the Telegram Premium subscription will be active after code activation - MonthCount int32 `json:"month_count"` + // Prize of the giveaway + Prize GiveawayPrize `json:"prize"` + // The number of boosts received by the chat from the giveaway; for Telegram Star giveaways only + BoostCount int32 `json:"boost_count"` // Point in time (Unix timestamp) when the giveaway was paid PaymentDate int32 `json:"payment_date"` } -func (entity *PrepaidPremiumGiveaway) MarshalJSON() ([]byte, error) { +func (entity *PrepaidGiveaway) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PrepaidPremiumGiveaway + type stub PrepaidGiveaway return json.Marshal((*stub)(entity)) } -func (*PrepaidPremiumGiveaway) GetClass() string { - return ClassPrepaidPremiumGiveaway +func (*PrepaidGiveaway) GetClass() string { + return ClassPrepaidGiveaway } -func (*PrepaidPremiumGiveaway) GetType() string { - return TypePrepaidPremiumGiveaway +func (*PrepaidGiveaway) GetType() string { + return TypePrepaidGiveaway +} + +func (prepaidGiveaway *PrepaidGiveaway) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + WinnerCount int32 `json:"winner_count"` + Prize json.RawMessage `json:"prize"` + BoostCount int32 `json:"boost_count"` + PaymentDate int32 `json:"payment_date"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + prepaidGiveaway.Id = tmp.Id + prepaidGiveaway.WinnerCount = tmp.WinnerCount + prepaidGiveaway.BoostCount = tmp.BoostCount + prepaidGiveaway.PaymentDate = tmp.PaymentDate + + fieldPrize, _ := UnmarshalGiveawayPrize(tmp.Prize) + prepaidGiveaway.Prize = fieldPrize + + return nil } // Describes current boost status of a chat @@ -24511,7 +40365,7 @@ type ChatBoostStatus struct { // A percentage of Telegram Premium subscribers joined the chat; always 0 if the current user isn't an administrator in the chat PremiumMemberPercentage float64 `json:"premium_member_percentage"` // The list of prepaid giveaways available for the chat; only for chat administrators - PrepaidGiveaways []*PrepaidPremiumGiveaway `json:"prepaid_giveaways"` + PrepaidGiveaways []*PrepaidGiveaway `json:"prepaid_giveaways"` } func (entity *ChatBoostStatus) MarshalJSON() ([]byte, error) { @@ -24593,7 +40447,7 @@ type FoundChatBoosts struct { TotalCount int32 `json:"total_count"` // List of boosts Boosts []*ChatBoost `json:"boosts"` - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } @@ -24667,6 +40521,58 @@ func (*ChatBoostSlots) GetType() string { return TypeChatBoostSlots } +// The user requested to resend the code +type ResendCodeReasonUserRequest struct{ + meta +} + +func (entity *ResendCodeReasonUserRequest) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ResendCodeReasonUserRequest + + return json.Marshal((*stub)(entity)) +} + +func (*ResendCodeReasonUserRequest) GetClass() string { + return ClassResendCodeReason +} + +func (*ResendCodeReasonUserRequest) GetType() string { + return TypeResendCodeReasonUserRequest +} + +func (*ResendCodeReasonUserRequest) ResendCodeReasonType() string { + return TypeResendCodeReasonUserRequest +} + +// The code is re-sent, because device verification has failed +type ResendCodeReasonVerificationFailed struct { + meta + // Cause of the verification failure, for example, "PLAY_SERVICES_NOT_AVAILABLE", "APNS_RECEIVE_TIMEOUT", or "APNS_INIT_FAILED" + ErrorMessage string `json:"error_message"` +} + +func (entity *ResendCodeReasonVerificationFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ResendCodeReasonVerificationFailed + + return json.Marshal((*stub)(entity)) +} + +func (*ResendCodeReasonVerificationFailed) GetClass() string { + return ClassResendCodeReason +} + +func (*ResendCodeReasonVerificationFailed) GetType() string { + return TypeResendCodeReasonVerificationFailed +} + +func (*ResendCodeReasonVerificationFailed) ResendCodeReasonType() string { + return TypeResendCodeReasonVerificationFailed +} + // The call wasn't discarded, or the reason is unknown type CallDiscardReasonEmpty struct{ meta @@ -24792,6 +40698,33 @@ func (*CallDiscardReasonHungUp) CallDiscardReasonType() string { return TypeCallDiscardReasonHungUp } +// The call was ended because it has been upgraded to a group call +type CallDiscardReasonUpgradeToGroupCall struct { + meta + // Invite link for the group call + InviteLink string `json:"invite_link"` +} + +func (entity *CallDiscardReasonUpgradeToGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CallDiscardReasonUpgradeToGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*CallDiscardReasonUpgradeToGroupCall) GetClass() string { + return ClassCallDiscardReason +} + +func (*CallDiscardReasonUpgradeToGroupCall) GetType() string { + return TypeCallDiscardReasonUpgradeToGroupCall +} + +func (*CallDiscardReasonUpgradeToGroupCall) CallDiscardReasonType() string { + return TypeCallDiscardReasonUpgradeToGroupCall +} + // Specifies the supported call protocols type CallProtocol struct { meta @@ -25044,7 +40977,7 @@ func (*CallStateExchangingKeys) CallStateType() string { // The call is ready to use type CallStateReady struct { meta - // Call protocols supported by the peer + // Call protocols supported by the other call participant Protocol *CallProtocol `json:"protocol"` // List of available call servers Servers []*CallServer `json:"servers"` @@ -25052,10 +40985,14 @@ type CallStateReady struct { Config string `json:"config"` // Call encryption key EncryptionKey []byte `json:"encryption_key"` - // Encryption key emojis fingerprint + // Encryption key fingerprint represented as 4 emoji Emojis []string `json:"emojis"` // True, if peer-to-peer connection is allowed by users privacy settings AllowP2p bool `json:"allow_p2p"` + // True, if the other party supports upgrading of the call to a group call + IsGroupCallSupported bool `json:"is_group_call_supported"` + // Custom JSON-encoded call parameters to be passed to tgcalls + CustomParameters string `json:"custom_parameters"` } func (entity *CallStateReady) MarshalJSON() ([]byte, error) { @@ -25186,6 +41123,35 @@ func (*CallStateError) CallStateType() string { return TypeCallStateError } +// Describes parameters used to join a group call +type GroupCallJoinParameters struct { + meta + // Audio channel synchronization source identifier; received from tgcalls + AudioSourceId int32 `json:"audio_source_id"` + // Group call join payload; received from tgcalls + Payload string `json:"payload"` + // Pass true to join the call with muted microphone + IsMuted bool `json:"is_muted"` + // Pass true if the user's video is enabled + IsMyVideoEnabled bool `json:"is_my_video_enabled"` +} + +func (entity *GroupCallJoinParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallJoinParameters + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallJoinParameters) GetClass() string { + return ClassGroupCallJoinParameters +} + +func (*GroupCallJoinParameters) GetType() string { + return TypeGroupCallJoinParameters +} + // The worst available video quality type GroupCallVideoQualityThumbnail struct{ meta @@ -25261,7 +41227,7 @@ func (*GroupCallVideoQualityFull) GroupCallVideoQualityType() string { return TypeGroupCallVideoQualityFull } -// Describes an available stream in a group call +// Describes an available stream in a video chat or a live story type GroupCallStream struct { meta // Identifier of an audio/video channel @@ -25385,28 +41351,42 @@ type GroupCall struct { meta // Group call identifier Id int32 `json:"id"` - // Group call title + // Persistent unique group call identifier + UniqueId JsonInt64 `json:"unique_id"` + // Group call title; for video chats only Title string `json:"title"` - // Point in time (Unix timestamp) when the group call is supposed to be started by an administrator; 0 if it is already active or was ended + // Invite link for the group call; for group calls that aren't bound to a chat. For video chats call getVideoChatInviteLink to get the link. For live stories in chats with username call getInternalLink with internalLinkTypeLiveStory + InviteLink string `json:"invite_link"` + // The minimum number of Telegram Stars that must be paid by general participant for each sent message to the call; for live stories only + PaidMessageStarCount int64 `json:"paid_message_star_count"` + // Point in time (Unix timestamp) when the group call is expected to be started by an administrator; 0 if it is already active or was ended; for video chats only ScheduledStartDate int32 `json:"scheduled_start_date"` - // True, if the group call is scheduled and the current user will receive a notification when the group call will start + // True, if the group call is scheduled and the current user will receive a notification when the group call starts; for video chats only EnabledStartNotification bool `json:"enabled_start_notification"` // True, if the call is active IsActive bool `json:"is_active"` - // True, if the chat is an RTMP stream instead of an ordinary video chat + // True, if the call is bound to a chat + IsVideoChat bool `json:"is_video_chat"` + // True, if the call is a live story of a chat + IsLiveStory bool `json:"is_live_story"` + // True, if the call is an RTMP stream instead of an ordinary video chat; for video chats and live stories only IsRtmpStream bool `json:"is_rtmp_stream"` // True, if the call is joined IsJoined bool `json:"is_joined"` // True, if user was kicked from the call because of network loss and the call needs to be rejoined NeedRejoin bool `json:"need_rejoin"` - // True, if the current user can manage the group call + // True, if the user is the owner of the call and can end the call, change volume level of other users, or ban users there; for group calls that aren't bound to a chat + IsOwned bool `json:"is_owned"` + // True, if the current user can manage the group call; for video chats and live stories only CanBeManaged bool `json:"can_be_managed"` // Number of participants in the group call ParticipantCount int32 `json:"participant_count"` - // True, if group call participants, which are muted, aren't returned in participant list + // True, if group call participants, which are muted, aren't returned in participant list; for video chats only HasHiddenListeners bool `json:"has_hidden_listeners"` // True, if all group call participants are loaded LoadedAllParticipants bool `json:"loaded_all_participants"` + // Message sender chosen to send messages to the group call; for live stories only; may be null if the call isn't a live story + MessageSenderId MessageSender `json:"message_sender_id"` // At most 3 recently speaking users in the group call RecentSpeakers []*GroupCallRecentSpeaker `json:"recent_speakers"` // True, if the current user's video is enabled @@ -25415,10 +41395,18 @@ type GroupCall struct { IsMyVideoPaused bool `json:"is_my_video_paused"` // True, if the current user can broadcast video or share screen CanEnableVideo bool `json:"can_enable_video"` - // True, if only group call administrators can unmute new participants + // True, if only group call administrators can unmute new participants; for video chats only MuteNewParticipants bool `json:"mute_new_participants"` - // True, if the current user can enable or disable mute_new_participants setting + // True, if the current user can enable or disable mute_new_participants setting; for video chats only CanToggleMuteNewParticipants bool `json:"can_toggle_mute_new_participants"` + // True, if the current user can send messages to the group call + CanSendMessages bool `json:"can_send_messages"` + // True, if sending of messages is allowed in the group call + AreMessagesAllowed bool `json:"are_messages_allowed"` + // True, if the current user can enable or disable sending of messages in the group call + CanToggleAreMessagesAllowed bool `json:"can_toggle_are_messages_allowed"` + // True, if the user can delete messages in the group call + CanDeleteMessages bool `json:"can_delete_messages"` // Duration of the ongoing group call recording, in seconds; 0 if none. An updateGroupCall update is not triggered when value of this field changes, but the same recording goes on RecordDuration int32 `json:"record_duration"` // True, if a video file is being recorded for the call @@ -25443,6 +41431,85 @@ func (*GroupCall) GetType() string { return TypeGroupCall } +func (groupCall *GroupCall) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int32 `json:"id"` + UniqueId JsonInt64 `json:"unique_id"` + Title string `json:"title"` + InviteLink string `json:"invite_link"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` + ScheduledStartDate int32 `json:"scheduled_start_date"` + EnabledStartNotification bool `json:"enabled_start_notification"` + IsActive bool `json:"is_active"` + IsVideoChat bool `json:"is_video_chat"` + IsLiveStory bool `json:"is_live_story"` + IsRtmpStream bool `json:"is_rtmp_stream"` + IsJoined bool `json:"is_joined"` + NeedRejoin bool `json:"need_rejoin"` + IsOwned bool `json:"is_owned"` + CanBeManaged bool `json:"can_be_managed"` + ParticipantCount int32 `json:"participant_count"` + HasHiddenListeners bool `json:"has_hidden_listeners"` + LoadedAllParticipants bool `json:"loaded_all_participants"` + MessageSenderId json.RawMessage `json:"message_sender_id"` + RecentSpeakers []*GroupCallRecentSpeaker `json:"recent_speakers"` + IsMyVideoEnabled bool `json:"is_my_video_enabled"` + IsMyVideoPaused bool `json:"is_my_video_paused"` + CanEnableVideo bool `json:"can_enable_video"` + MuteNewParticipants bool `json:"mute_new_participants"` + CanToggleMuteNewParticipants bool `json:"can_toggle_mute_new_participants"` + CanSendMessages bool `json:"can_send_messages"` + AreMessagesAllowed bool `json:"are_messages_allowed"` + CanToggleAreMessagesAllowed bool `json:"can_toggle_are_messages_allowed"` + CanDeleteMessages bool `json:"can_delete_messages"` + RecordDuration int32 `json:"record_duration"` + IsVideoRecorded bool `json:"is_video_recorded"` + Duration int32 `json:"duration"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + groupCall.Id = tmp.Id + groupCall.UniqueId = tmp.UniqueId + groupCall.Title = tmp.Title + groupCall.InviteLink = tmp.InviteLink + groupCall.PaidMessageStarCount = tmp.PaidMessageStarCount + groupCall.ScheduledStartDate = tmp.ScheduledStartDate + groupCall.EnabledStartNotification = tmp.EnabledStartNotification + groupCall.IsActive = tmp.IsActive + groupCall.IsVideoChat = tmp.IsVideoChat + groupCall.IsLiveStory = tmp.IsLiveStory + groupCall.IsRtmpStream = tmp.IsRtmpStream + groupCall.IsJoined = tmp.IsJoined + groupCall.NeedRejoin = tmp.NeedRejoin + groupCall.IsOwned = tmp.IsOwned + groupCall.CanBeManaged = tmp.CanBeManaged + groupCall.ParticipantCount = tmp.ParticipantCount + groupCall.HasHiddenListeners = tmp.HasHiddenListeners + groupCall.LoadedAllParticipants = tmp.LoadedAllParticipants + groupCall.RecentSpeakers = tmp.RecentSpeakers + groupCall.IsMyVideoEnabled = tmp.IsMyVideoEnabled + groupCall.IsMyVideoPaused = tmp.IsMyVideoPaused + groupCall.CanEnableVideo = tmp.CanEnableVideo + groupCall.MuteNewParticipants = tmp.MuteNewParticipants + groupCall.CanToggleMuteNewParticipants = tmp.CanToggleMuteNewParticipants + groupCall.CanSendMessages = tmp.CanSendMessages + groupCall.AreMessagesAllowed = tmp.AreMessagesAllowed + groupCall.CanToggleAreMessagesAllowed = tmp.CanToggleAreMessagesAllowed + groupCall.CanDeleteMessages = tmp.CanDeleteMessages + groupCall.RecordDuration = tmp.RecordDuration + groupCall.IsVideoRecorded = tmp.IsVideoRecorded + groupCall.Duration = tmp.Duration + + fieldMessageSenderId, _ := UnmarshalMessageSender(tmp.MessageSenderId) + groupCall.MessageSenderId = fieldMessageSenderId + + return nil +} + // Describes a group of video synchronization source identifiers type GroupCallVideoSourceGroup struct { meta @@ -25603,6 +41670,384 @@ func (groupCallParticipant *GroupCallParticipant) UnmarshalJSON(data []byte) err return nil } +// Contains identifiers of group call participants +type GroupCallParticipants struct { + meta + // Total number of group call participants + TotalCount int32 `json:"total_count"` + // Identifiers of the participants + ParticipantIds []MessageSender `json:"participant_ids"` +} + +func (entity *GroupCallParticipants) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallParticipants + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallParticipants) GetClass() string { + return ClassGroupCallParticipants +} + +func (*GroupCallParticipants) GetType() string { + return TypeGroupCallParticipants +} + +func (groupCallParticipants *GroupCallParticipants) UnmarshalJSON(data []byte) error { + var tmp struct { + TotalCount int32 `json:"total_count"` + ParticipantIds []json.RawMessage `json:"participant_ids"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + groupCallParticipants.TotalCount = tmp.TotalCount + + fieldParticipantIds, _ := UnmarshalListOfMessageSender(tmp.ParticipantIds) + groupCallParticipants.ParticipantIds = fieldParticipantIds + + return nil +} + +// Contains information about a just created or just joined group call +type GroupCallInfo struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // Join response payload for tgcalls; empty if the call isn't joined + JoinPayload string `json:"join_payload"` +} + +func (entity *GroupCallInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallInfo + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallInfo) GetClass() string { + return ClassGroupCallInfo +} + +func (*GroupCallInfo) GetType() string { + return TypeGroupCallInfo +} + +// Represents a message sent in a group call +type GroupCallMessage struct { + meta + // Unique message identifier within the group call + MessageId int32 `json:"message_id"` + // Identifier of the sender of the message + SenderId MessageSender `json:"sender_id"` + // Point in time (Unix timestamp) when the message was sent + Date int32 `json:"date"` + // Text of the message. If empty, then the message is a paid reaction in a live story + Text *FormattedText `json:"text"` + // The number of Telegram Stars that were paid to send the message; for live stories only + PaidMessageStarCount int64 `json:"paid_message_star_count"` + // True, if the message is sent by the owner of the call and must be treated as a message of the maximum level; for live stories only + IsFromOwner bool `json:"is_from_owner"` + // True, if the message can be deleted by the current user; for live stories only + CanBeDeleted bool `json:"can_be_deleted"` +} + +func (entity *GroupCallMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallMessage + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallMessage) GetClass() string { + return ClassGroupCallMessage +} + +func (*GroupCallMessage) GetType() string { + return TypeGroupCallMessage +} + +func (groupCallMessage *GroupCallMessage) UnmarshalJSON(data []byte) error { + var tmp struct { + MessageId int32 `json:"message_id"` + SenderId json.RawMessage `json:"sender_id"` + Date int32 `json:"date"` + Text *FormattedText `json:"text"` + PaidMessageStarCount int64 `json:"paid_message_star_count"` + IsFromOwner bool `json:"is_from_owner"` + CanBeDeleted bool `json:"can_be_deleted"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + groupCallMessage.MessageId = tmp.MessageId + groupCallMessage.Date = tmp.Date + groupCallMessage.Text = tmp.Text + groupCallMessage.PaidMessageStarCount = tmp.PaidMessageStarCount + groupCallMessage.IsFromOwner = tmp.IsFromOwner + groupCallMessage.CanBeDeleted = tmp.CanBeDeleted + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + groupCallMessage.SenderId = fieldSenderId + + return nil +} + +// Represents a level of features for a message sent in a live story group call +type GroupCallMessageLevel struct { + meta + // The minimum number of Telegram Stars required to get features of the level + MinStarCount int64 `json:"min_star_count"` + // The amount of time the message of this level will be pinned, in seconds + PinDuration int32 `json:"pin_duration"` + // The maximum allowed length of the message text + MaxTextLength int32 `json:"max_text_length"` + // The maximum allowed number of custom emoji in the message text + MaxCustomEmojiCount int32 `json:"max_custom_emoji_count"` + // The first color used to show the message text in the RGB format + FirstColor int32 `json:"first_color"` + // The second color used to show the message text in the RGB format + SecondColor int32 `json:"second_color"` + // Background color for the message the RGB format + BackgroundColor int32 `json:"background_color"` +} + +func (entity *GroupCallMessageLevel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallMessageLevel + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallMessageLevel) GetClass() string { + return ClassGroupCallMessageLevel +} + +func (*GroupCallMessageLevel) GetType() string { + return TypeGroupCallMessageLevel +} + +// The user can't be invited due to their privacy settings +type InviteGroupCallParticipantResultUserPrivacyRestricted struct{ + meta +} + +func (entity *InviteGroupCallParticipantResultUserPrivacyRestricted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultUserPrivacyRestricted + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultUserPrivacyRestricted) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultUserPrivacyRestricted) GetType() string { + return TypeInviteGroupCallParticipantResultUserPrivacyRestricted +} + +func (*InviteGroupCallParticipantResultUserPrivacyRestricted) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultUserPrivacyRestricted +} + +// The user can't be invited because they are already a participant of the call +type InviteGroupCallParticipantResultUserAlreadyParticipant struct{ + meta +} + +func (entity *InviteGroupCallParticipantResultUserAlreadyParticipant) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultUserAlreadyParticipant + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultUserAlreadyParticipant) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultUserAlreadyParticipant) GetType() string { + return TypeInviteGroupCallParticipantResultUserAlreadyParticipant +} + +func (*InviteGroupCallParticipantResultUserAlreadyParticipant) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultUserAlreadyParticipant +} + +// The user can't be invited because they were banned by the owner of the call and can be invited back only by the owner of the group call +type InviteGroupCallParticipantResultUserWasBanned struct{ + meta +} + +func (entity *InviteGroupCallParticipantResultUserWasBanned) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultUserWasBanned + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultUserWasBanned) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultUserWasBanned) GetType() string { + return TypeInviteGroupCallParticipantResultUserWasBanned +} + +func (*InviteGroupCallParticipantResultUserWasBanned) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultUserWasBanned +} + +// The user was invited and a service message of the type messageGroupCall was sent which can be used in declineGroupCallInvitation to cancel the invitation +type InviteGroupCallParticipantResultSuccess struct { + meta + // Identifier of the chat with the invitation message + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +func (entity *InviteGroupCallParticipantResultSuccess) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InviteGroupCallParticipantResultSuccess + + return json.Marshal((*stub)(entity)) +} + +func (*InviteGroupCallParticipantResultSuccess) GetClass() string { + return ClassInviteGroupCallParticipantResult +} + +func (*InviteGroupCallParticipantResultSuccess) GetType() string { + return TypeInviteGroupCallParticipantResultSuccess +} + +func (*InviteGroupCallParticipantResultSuccess) InviteGroupCallParticipantResultType() string { + return TypeInviteGroupCallParticipantResultSuccess +} + +// The main data channel for audio and video data +type GroupCallDataChannelMain struct{ + meta +} + +func (entity *GroupCallDataChannelMain) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallDataChannelMain + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallDataChannelMain) GetClass() string { + return ClassGroupCallDataChannel +} + +func (*GroupCallDataChannelMain) GetType() string { + return TypeGroupCallDataChannelMain +} + +func (*GroupCallDataChannelMain) GroupCallDataChannelType() string { + return TypeGroupCallDataChannelMain +} + +// The data channel for screen sharing +type GroupCallDataChannelScreenSharing struct{ + meta +} + +func (entity *GroupCallDataChannelScreenSharing) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GroupCallDataChannelScreenSharing + + return json.Marshal((*stub)(entity)) +} + +func (*GroupCallDataChannelScreenSharing) GetClass() string { + return ClassGroupCallDataChannel +} + +func (*GroupCallDataChannelScreenSharing) GetType() string { + return TypeGroupCallDataChannelScreenSharing +} + +func (*GroupCallDataChannelScreenSharing) GroupCallDataChannelType() string { + return TypeGroupCallDataChannelScreenSharing +} + +// The group call is accessible through a link +type InputGroupCallLink struct { + meta + // The link for the group call + Link string `json:"link"` +} + +func (entity *InputGroupCallLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputGroupCallLink + + return json.Marshal((*stub)(entity)) +} + +func (*InputGroupCallLink) GetClass() string { + return ClassInputGroupCall +} + +func (*InputGroupCallLink) GetType() string { + return TypeInputGroupCallLink +} + +func (*InputGroupCallLink) InputGroupCallType() string { + return TypeInputGroupCallLink +} + +// The group call is accessible through a message of the type messageGroupCall +type InputGroupCallMessage struct { + meta + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the message of the type messageGroupCall + MessageId int64 `json:"message_id"` +} + +func (entity *InputGroupCallMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputGroupCallMessage + + return json.Marshal((*stub)(entity)) +} + +func (*InputGroupCallMessage) GetClass() string { + return ClassInputGroupCall +} + +func (*InputGroupCallMessage) GetType() string { + return TypeInputGroupCallMessage +} + +func (*InputGroupCallMessage) InputGroupCallType() string { + return TypeInputGroupCallMessage +} + // The user heard their own voice type CallProblemEcho struct{ meta @@ -25833,7 +42278,9 @@ type Call struct { meta // Call identifier, not persistent Id int32 `json:"id"` - // Peer user identifier + // Persistent unique call identifier; 0 if isn't assigned yet by the server + UniqueId JsonInt64 `json:"unique_id"` + // User identifier of the other call participant UserId int64 `json:"user_id"` // True, if the call is outgoing IsOutgoing bool `json:"is_outgoing"` @@ -25862,6 +42309,7 @@ func (*Call) GetType() string { func (call *Call) UnmarshalJSON(data []byte) error { var tmp struct { Id int32 `json:"id"` + UniqueId JsonInt64 `json:"unique_id"` UserId int64 `json:"user_id"` IsOutgoing bool `json:"is_outgoing"` IsVideo bool `json:"is_video"` @@ -25874,6 +42322,7 @@ func (call *Call) UnmarshalJSON(data []byte) error { } call.Id = tmp.Id + call.UniqueId = tmp.UniqueId call.UserId = tmp.UserId call.IsOutgoing = tmp.IsOutgoing call.IsVideo = tmp.IsVideo @@ -25947,11 +42396,13 @@ type PhoneNumberAuthenticationSettings struct { AllowMissedCall bool `json:"allow_missed_call"` // Pass true if the authenticated phone number is used on the current device IsCurrentPhoneNumber bool `json:"is_current_phone_number"` + // Pass true if there is a SIM card in the current device, but it is not possible to check whether phone number matches + HasUnknownPhoneNumber bool `json:"has_unknown_phone_number"` // For official applications only. True, if the application can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details AllowSmsRetrieverApi bool `json:"allow_sms_retriever_api"` // For official Android and iOS applications only; pass null otherwise. Settings for Firebase Authentication FirebaseAuthenticationSettings FirebaseAuthenticationSettings `json:"firebase_authentication_settings"` - // List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions + // List of up to 20 authentication tokens, recently received in updateOption("authentication_token") in previously logged out sessions; for setAuthenticationPhoneNumber only AuthenticationTokens []string `json:"authentication_tokens"` } @@ -25976,6 +42427,7 @@ func (phoneNumberAuthenticationSettings *PhoneNumberAuthenticationSettings) Unma AllowFlashCall bool `json:"allow_flash_call"` AllowMissedCall bool `json:"allow_missed_call"` IsCurrentPhoneNumber bool `json:"is_current_phone_number"` + HasUnknownPhoneNumber bool `json:"has_unknown_phone_number"` AllowSmsRetrieverApi bool `json:"allow_sms_retriever_api"` FirebaseAuthenticationSettings json.RawMessage `json:"firebase_authentication_settings"` AuthenticationTokens []string `json:"authentication_tokens"` @@ -25989,6 +42441,7 @@ func (phoneNumberAuthenticationSettings *PhoneNumberAuthenticationSettings) Unma phoneNumberAuthenticationSettings.AllowFlashCall = tmp.AllowFlashCall phoneNumberAuthenticationSettings.AllowMissedCall = tmp.AllowMissedCall phoneNumberAuthenticationSettings.IsCurrentPhoneNumber = tmp.IsCurrentPhoneNumber + phoneNumberAuthenticationSettings.HasUnknownPhoneNumber = tmp.HasUnknownPhoneNumber phoneNumberAuthenticationSettings.AllowSmsRetrieverApi = tmp.AllowSmsRetrieverApi phoneNumberAuthenticationSettings.AuthenticationTokens = tmp.AuthenticationTokens @@ -26059,7 +42512,7 @@ type AddedReactions struct { TotalCount int32 `json:"total_count"` // The list of added reactions Reactions []*AddedReaction `json:"reactions"` - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } @@ -26132,8 +42585,12 @@ type AvailableReactions struct { RecentReactions []*AvailableReaction `json:"recent_reactions"` // List of popular reactions PopularReactions []*AvailableReaction `json:"popular_reactions"` - // True, if custom emoji reactions could be added by Telegram Premium subscribers + // True, if any custom emoji reaction can be added by Telegram Premium subscribers AllowCustomEmoji bool `json:"allow_custom_emoji"` + // True, if the reactions will be tags and the message can be found by them + AreTags bool `json:"are_tags"` + // The reason why the current user can't add reactions to the message, despite some other users can; may be null if none + UnavailabilityReason ReactionUnavailabilityReason `json:"unavailability_reason"` } func (entity *AvailableReactions) MarshalJSON() ([]byte, error) { @@ -26152,7 +42609,34 @@ func (*AvailableReactions) GetType() string { return TypeAvailableReactions } -// Contains information about a emoji reaction +func (availableReactions *AvailableReactions) UnmarshalJSON(data []byte) error { + var tmp struct { + TopReactions []*AvailableReaction `json:"top_reactions"` + RecentReactions []*AvailableReaction `json:"recent_reactions"` + PopularReactions []*AvailableReaction `json:"popular_reactions"` + AllowCustomEmoji bool `json:"allow_custom_emoji"` + AreTags bool `json:"are_tags"` + UnavailabilityReason json.RawMessage `json:"unavailability_reason"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + availableReactions.TopReactions = tmp.TopReactions + availableReactions.RecentReactions = tmp.RecentReactions + availableReactions.PopularReactions = tmp.PopularReactions + availableReactions.AllowCustomEmoji = tmp.AllowCustomEmoji + availableReactions.AreTags = tmp.AreTags + + fieldUnavailabilityReason, _ := UnmarshalReactionUnavailabilityReason(tmp.UnavailabilityReason) + availableReactions.UnavailabilityReason = fieldUnavailabilityReason + + return nil +} + +// Contains information about an emoji reaction type EmojiReaction struct { meta // Text representation of the reaction @@ -26193,6 +42677,56 @@ func (*EmojiReaction) GetType() string { return TypeEmojiReaction } +// The user is an anonymous administrator in the supergroup, but isn't a creator of it, so they can't vote on behalf of the supergroup +type ReactionUnavailabilityReasonAnonymousAdministrator struct{ + meta +} + +func (entity *ReactionUnavailabilityReasonAnonymousAdministrator) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionUnavailabilityReasonAnonymousAdministrator + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionUnavailabilityReasonAnonymousAdministrator) GetClass() string { + return ClassReactionUnavailabilityReason +} + +func (*ReactionUnavailabilityReasonAnonymousAdministrator) GetType() string { + return TypeReactionUnavailabilityReasonAnonymousAdministrator +} + +func (*ReactionUnavailabilityReasonAnonymousAdministrator) ReactionUnavailabilityReasonType() string { + return TypeReactionUnavailabilityReasonAnonymousAdministrator +} + +// The user isn't a member of the supergroup and can't send messages and reactions there without joining +type ReactionUnavailabilityReasonGuest struct{ + meta +} + +func (entity *ReactionUnavailabilityReasonGuest) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReactionUnavailabilityReasonGuest + + return json.Marshal((*stub)(entity)) +} + +func (*ReactionUnavailabilityReasonGuest) GetClass() string { + return ClassReactionUnavailabilityReason +} + +func (*ReactionUnavailabilityReasonGuest) GetType() string { + return TypeReactionUnavailabilityReasonGuest +} + +func (*ReactionUnavailabilityReasonGuest) ReactionUnavailabilityReasonType() string { + return TypeReactionUnavailabilityReasonGuest +} + // Represents a list of animations type Animations struct { meta @@ -26278,6 +42812,35 @@ func (*DiceStickersSlotMachine) DiceStickersType() string { return TypeDiceStickersSlotMachine } +// Describes a contact to import +type ImportedContact struct { + meta + // Phone number of the user + PhoneNumber string `json:"phone_number"` + // First name of the user; 1-64 characters + FirstName string `json:"first_name"` + // Last name of the user; 0-64 characters + LastName string `json:"last_name"` + // Note to add about the user; 0-getOption("user_note_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed; pass null to keep the current user's note + Note *FormattedText `json:"note"` +} + +func (entity *ImportedContact) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ImportedContact + + return json.Marshal((*stub)(entity)) +} + +func (*ImportedContact) GetClass() string { + return ClassImportedContact +} + +func (*ImportedContact) GetType() string { + return TypeImportedContact +} + // Represents the result of an importContacts request type ImportedContacts struct { meta @@ -26360,7 +42923,7 @@ func (*SpeechRecognitionResultText) SpeechRecognitionResultType() string { // The speech recognition failed type SpeechRecognitionResultError struct { meta - // Recognition error + // Recognition error. An error with a message "MSG_VOICE_TOO_LONG" is returned when media duration is too big to be recognized Error *Error `json:"error"` } @@ -26384,12 +42947,45 @@ func (*SpeechRecognitionResultError) SpeechRecognitionResultType() string { return TypeSpeechRecognitionResultError } +// Describes a connection of the bot with a business account +type BusinessConnection struct { + meta + // Unique identifier of the connection + Id string `json:"id"` + // Identifier of the business user who created the connection + UserId int64 `json:"user_id"` + // Chat identifier of the private chat with the user + UserChatId int64 `json:"user_chat_id"` + // Point in time (Unix timestamp) when the connection was established + Date int32 `json:"date"` + // Rights of the bot; may be null if the connection was disabled + Rights *BusinessBotRights `json:"rights"` + // True, if the connection is enabled; false otherwise + IsEnabled bool `json:"is_enabled"` +} + +func (entity *BusinessConnection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessConnection + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessConnection) GetClass() string { + return ClassBusinessConnection +} + +func (*BusinessConnection) GetType() string { + return TypeBusinessConnection +} + // Describes a color to highlight a bot added to attachment menu type AttachmentMenuBotColor struct { meta - // Color in the RGB24 format for light themes + // Color in the RGB format for light themes LightColor int32 `json:"light_color"` - // Color in the RGB24 format for dark themes + // Color in the RGB format for dark themes DarkColor int32 `json:"dark_color"` } @@ -26651,6 +43247,130 @@ func (*UserLink) GetType() string { return TypeUserLink } +// Describes allowed types for the target chat +type TargetChatTypes struct { + meta + // True, if private chats with ordinary users are allowed + AllowUserChats bool `json:"allow_user_chats"` + // True, if private chats with other bots are allowed + AllowBotChats bool `json:"allow_bot_chats"` + // True, if basic group and supergroup chats are allowed + AllowGroupChats bool `json:"allow_group_chats"` + // True, if channel chats are allowed + AllowChannelChats bool `json:"allow_channel_chats"` +} + +func (entity *TargetChatTypes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatTypes + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatTypes) GetClass() string { + return ClassTargetChatTypes +} + +func (*TargetChatTypes) GetType() string { + return TypeTargetChatTypes +} + +// The currently opened chat and forum topic must be kept +type TargetChatCurrent struct{ + meta +} + +func (entity *TargetChatCurrent) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatCurrent + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatCurrent) GetClass() string { + return ClassTargetChat +} + +func (*TargetChatCurrent) GetType() string { + return TypeTargetChatCurrent +} + +func (*TargetChatCurrent) TargetChatType() string { + return TypeTargetChatCurrent +} + +// The chat needs to be chosen by the user among chats of the specified types +type TargetChatChosen struct { + meta + // Allowed types for the chat + Types *TargetChatTypes `json:"types"` +} + +func (entity *TargetChatChosen) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatChosen + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatChosen) GetClass() string { + return ClassTargetChat +} + +func (*TargetChatChosen) GetType() string { + return TypeTargetChatChosen +} + +func (*TargetChatChosen) TargetChatType() string { + return TypeTargetChatChosen +} + +// The chat needs to be open with the provided internal link +type TargetChatInternalLink struct { + meta + // An internal link pointing to the chat + Link InternalLinkType `json:"link"` +} + +func (entity *TargetChatInternalLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TargetChatInternalLink + + return json.Marshal((*stub)(entity)) +} + +func (*TargetChatInternalLink) GetClass() string { + return ClassTargetChat +} + +func (*TargetChatInternalLink) GetType() string { + return TypeTargetChatInternalLink +} + +func (*TargetChatInternalLink) TargetChatType() string { + return TypeTargetChatInternalLink +} + +func (targetChatInternalLink *TargetChatInternalLink) UnmarshalJSON(data []byte) error { + var tmp struct { + Link json.RawMessage `json:"link"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) + targetChatInternalLink.Link = fieldLink + + return nil +} + // Represents a link to an animated GIF or an animated (i.e., without sound) H.264/MPEG-4 AVC video type InputInlineQueryResultAnimation struct { meta @@ -26744,8 +43464,6 @@ type InputInlineQueryResultArticle struct { Id string `json:"id"` // URL of the result, if it exists Url string `json:"url"` - // True, if the URL must be not shown - HideUrl bool `json:"hide_url"` // Title of the result Title string `json:"title"` // A short description of the result @@ -26786,7 +43504,6 @@ func (inputInlineQueryResultArticle *InputInlineQueryResultArticle) UnmarshalJSO var tmp struct { Id string `json:"id"` Url string `json:"url"` - HideUrl bool `json:"hide_url"` Title string `json:"title"` Description string `json:"description"` ThumbnailUrl string `json:"thumbnail_url"` @@ -26803,7 +43520,6 @@ func (inputInlineQueryResultArticle *InputInlineQueryResultArticle) UnmarshalJSO inputInlineQueryResultArticle.Id = tmp.Id inputInlineQueryResultArticle.Url = tmp.Url - inputInlineQueryResultArticle.HideUrl = tmp.HideUrl inputInlineQueryResultArticle.Title = tmp.Title inputInlineQueryResultArticle.Description = tmp.Description inputInlineQueryResultArticle.ThumbnailUrl = tmp.ThumbnailUrl @@ -27548,8 +44264,6 @@ type InlineQueryResultArticle struct { Id string `json:"id"` // URL of the result, if it exists Url string `json:"url"` - // True, if the URL must be not shown - HideUrl bool `json:"hide_url"` // Title of the result Title string `json:"title"` // A short description of the result @@ -28028,7 +44742,7 @@ type InlineQueryResults struct { Button *InlineQueryResultsButton `json:"button"` // Results of the query Results []InlineQueryResult `json:"results"` - // The offset for the next request. If empty, there are no more results + // The offset for the next request. If empty, then there are no more results NextOffset string `json:"next_offset"` } @@ -28071,6 +44785,79 @@ func (inlineQueryResults *InlineQueryResults) UnmarshalJSON(data []byte) error { return nil } +// Represents an inline message that can be sent via the bot +type PreparedInlineMessageId struct { + meta + // Unique identifier for the message + Id string `json:"id"` + // Point in time (Unix timestamp) when the message can't be used anymore + ExpirationDate int32 `json:"expiration_date"` +} + +func (entity *PreparedInlineMessageId) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PreparedInlineMessageId + + return json.Marshal((*stub)(entity)) +} + +func (*PreparedInlineMessageId) GetClass() string { + return ClassPreparedInlineMessageId +} + +func (*PreparedInlineMessageId) GetType() string { + return TypePreparedInlineMessageId +} + +// Represents a ready to send inline message. Use sendInlineQueryResultMessage to send the message +type PreparedInlineMessage struct { + meta + // Unique identifier of the inline query to pass to sendInlineQueryResultMessage + InlineQueryId JsonInt64 `json:"inline_query_id"` + // Resulted inline message of the query + Result InlineQueryResult `json:"result"` + // Types of the chats to which the message can be sent + ChatTypes *TargetChatTypes `json:"chat_types"` +} + +func (entity *PreparedInlineMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PreparedInlineMessage + + return json.Marshal((*stub)(entity)) +} + +func (*PreparedInlineMessage) GetClass() string { + return ClassPreparedInlineMessage +} + +func (*PreparedInlineMessage) GetType() string { + return TypePreparedInlineMessage +} + +func (preparedInlineMessage *PreparedInlineMessage) UnmarshalJSON(data []byte) error { + var tmp struct { + InlineQueryId JsonInt64 `json:"inline_query_id"` + Result json.RawMessage `json:"result"` + ChatTypes *TargetChatTypes `json:"chat_types"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + preparedInlineMessage.InlineQueryId = tmp.InlineQueryId + preparedInlineMessage.ChatTypes = tmp.ChatTypes + + fieldResult, _ := UnmarshalInlineQueryResult(tmp.Result) + preparedInlineMessage.Result = fieldResult + + return nil +} + // The payload for a general callback button type CallbackQueryPayloadData struct { meta @@ -28658,6 +45445,60 @@ func (chatEventMemberRestricted *ChatEventMemberRestricted) UnmarshalJSON(data [ return nil } +// A chat member extended their subscription to the chat +type ChatEventMemberSubscriptionExtended struct { + meta + // Affected chat member user identifier + UserId int64 `json:"user_id"` + // Previous status of the chat member + OldStatus ChatMemberStatus `json:"old_status"` + // New status of the chat member + NewStatus ChatMemberStatus `json:"new_status"` +} + +func (entity *ChatEventMemberSubscriptionExtended) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventMemberSubscriptionExtended + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventMemberSubscriptionExtended) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventMemberSubscriptionExtended) GetType() string { + return TypeChatEventMemberSubscriptionExtended +} + +func (*ChatEventMemberSubscriptionExtended) ChatEventActionType() string { + return TypeChatEventMemberSubscriptionExtended +} + +func (chatEventMemberSubscriptionExtended *ChatEventMemberSubscriptionExtended) UnmarshalJSON(data []byte) error { + var tmp struct { + UserId int64 `json:"user_id"` + OldStatus json.RawMessage `json:"old_status"` + NewStatus json.RawMessage `json:"new_status"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatEventMemberSubscriptionExtended.UserId = tmp.UserId + + fieldOldStatus, _ := UnmarshalChatMemberStatus(tmp.OldStatus) + chatEventMemberSubscriptionExtended.OldStatus = fieldOldStatus + + fieldNewStatus, _ := UnmarshalChatMemberStatus(tmp.NewStatus) + chatEventMemberSubscriptionExtended.NewStatus = fieldNewStatus + + return nil +} + // The chat available reactions were changed type ChatEventAvailableReactionsChanged struct { meta @@ -28707,6 +45548,35 @@ func (chatEventAvailableReactionsChanged *ChatEventAvailableReactionsChanged) Un return nil } +// The chat background was changed +type ChatEventBackgroundChanged struct { + meta + // Previous background; may be null if none + OldBackground *ChatBackground `json:"old_background"` + // New background; may be null if none + NewBackground *ChatBackground `json:"new_background"` +} + +func (entity *ChatEventBackgroundChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventBackgroundChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventBackgroundChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventBackgroundChanged) GetType() string { + return TypeChatEventBackgroundChanged +} + +func (*ChatEventBackgroundChanged) ChatEventActionType() string { + return TypeChatEventBackgroundChanged +} + // The chat description was changed type ChatEventDescriptionChanged struct { meta @@ -28736,6 +45606,35 @@ func (*ChatEventDescriptionChanged) ChatEventActionType() string { return TypeChatEventDescriptionChanged } +// The chat emoji status was changed +type ChatEventEmojiStatusChanged struct { + meta + // Previous emoji status; may be null if none + OldEmojiStatus *EmojiStatus `json:"old_emoji_status"` + // New emoji status; may be null if none + NewEmojiStatus *EmojiStatus `json:"new_emoji_status"` +} + +func (entity *ChatEventEmojiStatusChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventEmojiStatusChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventEmojiStatusChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventEmojiStatusChanged) GetType() string { + return TypeChatEventEmojiStatusChanged +} + +func (*ChatEventEmojiStatusChanged) ChatEventActionType() string { + return TypeChatEventEmojiStatusChanged +} + // The linked chat of a supergroup was changed type ChatEventLinkedChatChanged struct { meta @@ -28823,7 +45722,7 @@ func (*ChatEventMessageAutoDeleteTimeChanged) ChatEventActionType() string { return TypeChatEventMessageAutoDeleteTimeChanged } -// The chat permissions was changed +// The chat permissions were changed type ChatEventPermissionsChanged struct { meta // Previous chat permissions @@ -28939,6 +45838,35 @@ func (*ChatEventStickerSetChanged) ChatEventActionType() string { return TypeChatEventStickerSetChanged } +// The supergroup sticker set with allowed custom emoji was changed +type ChatEventCustomEmojiStickerSetChanged struct { + meta + // Previous identifier of the chat sticker set; 0 if none + OldStickerSetId JsonInt64 `json:"old_sticker_set_id"` + // New identifier of the chat sticker set; 0 if none + NewStickerSetId JsonInt64 `json:"new_sticker_set_id"` +} + +func (entity *ChatEventCustomEmojiStickerSetChanged) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventCustomEmojiStickerSetChanged + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventCustomEmojiStickerSetChanged) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventCustomEmojiStickerSetChanged) GetType() string { + return TypeChatEventCustomEmojiStickerSetChanged +} + +func (*ChatEventCustomEmojiStickerSetChanged) ChatEventActionType() string { + return TypeChatEventCustomEmojiStickerSetChanged +} + // The chat title was changed type ChatEventTitleChanged struct { meta @@ -29026,13 +45954,17 @@ func (*ChatEventActiveUsernamesChanged) ChatEventActionType() string { return TypeChatEventActiveUsernamesChanged } -// The chat accent color was changed +// The chat accent color or background custom emoji were changed type ChatEventAccentColorChanged struct { meta // Previous identifier of chat accent color OldAccentColorId int32 `json:"old_accent_color_id"` + // Previous identifier of the custom emoji; 0 if none + OldBackgroundCustomEmojiId JsonInt64 `json:"old_background_custom_emoji_id"` // New identifier of chat accent color NewAccentColorId int32 `json:"new_accent_color_id"` + // New identifier of the custom emoji; 0 if none + NewBackgroundCustomEmojiId JsonInt64 `json:"new_background_custom_emoji_id"` } func (entity *ChatEventAccentColorChanged) MarshalJSON() ([]byte, error) { @@ -29055,33 +45987,37 @@ func (*ChatEventAccentColorChanged) ChatEventActionType() string { return TypeChatEventAccentColorChanged } -// The chat's custom emoji for reply background was changed -type ChatEventBackgroundCustomEmojiChanged struct { +// The chat's profile accent color or profile background custom emoji were changed +type ChatEventProfileAccentColorChanged struct { meta + // Previous identifier of chat's profile accent color; -1 if none + OldProfileAccentColorId int32 `json:"old_profile_accent_color_id"` // Previous identifier of the custom emoji; 0 if none - OldBackgroundCustomEmojiId JsonInt64 `json:"old_background_custom_emoji_id"` + OldProfileBackgroundCustomEmojiId JsonInt64 `json:"old_profile_background_custom_emoji_id"` + // New identifier of chat's profile accent color; -1 if none + NewProfileAccentColorId int32 `json:"new_profile_accent_color_id"` // New identifier of the custom emoji; 0 if none - NewBackgroundCustomEmojiId JsonInt64 `json:"new_background_custom_emoji_id"` + NewProfileBackgroundCustomEmojiId JsonInt64 `json:"new_profile_background_custom_emoji_id"` } -func (entity *ChatEventBackgroundCustomEmojiChanged) MarshalJSON() ([]byte, error) { +func (entity *ChatEventProfileAccentColorChanged) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatEventBackgroundCustomEmojiChanged + type stub ChatEventProfileAccentColorChanged return json.Marshal((*stub)(entity)) } -func (*ChatEventBackgroundCustomEmojiChanged) GetClass() string { +func (*ChatEventProfileAccentColorChanged) GetClass() string { return ClassChatEventAction } -func (*ChatEventBackgroundCustomEmojiChanged) GetType() string { - return TypeChatEventBackgroundCustomEmojiChanged +func (*ChatEventProfileAccentColorChanged) GetType() string { + return TypeChatEventProfileAccentColorChanged } -func (*ChatEventBackgroundCustomEmojiChanged) ChatEventActionType() string { - return TypeChatEventBackgroundCustomEmojiChanged +func (*ChatEventProfileAccentColorChanged) ChatEventActionType() string { + return TypeChatEventProfileAccentColorChanged } // The has_protected_content setting of a channel was toggled @@ -29219,6 +46155,60 @@ func (*ChatEventSignMessagesToggled) ChatEventActionType() string { return TypeChatEventSignMessagesToggled } +// The show_message_sender setting of a channel was toggled +type ChatEventShowMessageSenderToggled struct { + meta + // New value of show_message_sender + ShowMessageSender bool `json:"show_message_sender"` +} + +func (entity *ChatEventShowMessageSenderToggled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventShowMessageSenderToggled + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventShowMessageSenderToggled) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventShowMessageSenderToggled) GetType() string { + return TypeChatEventShowMessageSenderToggled +} + +func (*ChatEventShowMessageSenderToggled) ChatEventActionType() string { + return TypeChatEventShowMessageSenderToggled +} + +// The has_automatic_translation setting of a channel was toggled +type ChatEventAutomaticTranslationToggled struct { + meta + // New value of has_automatic_translation + HasAutomaticTranslation bool `json:"has_automatic_translation"` +} + +func (entity *ChatEventAutomaticTranslationToggled) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatEventAutomaticTranslationToggled + + return json.Marshal((*stub)(entity)) +} + +func (*ChatEventAutomaticTranslationToggled) GetClass() string { + return ClassChatEventAction +} + +func (*ChatEventAutomaticTranslationToggled) GetType() string { + return TypeChatEventAutomaticTranslationToggled +} + +func (*ChatEventAutomaticTranslationToggled) ChatEventActionType() string { + return TypeChatEventAutomaticTranslationToggled +} + // A chat invite link was edited type ChatEventInviteLinkEdited struct { meta @@ -29778,6 +46768,8 @@ type ChatEventLogFilters struct { VideoChatChanges bool `json:"video_chat_changes"` // True, if forum-related actions need to be returned ForumChanges bool `json:"forum_changes"` + // True, if subscription extensions need to be returned + SubscriptionExtensions bool `json:"subscription_extensions"` } func (entity *ChatEventLogFilters) MarshalJSON() ([]byte, error) { @@ -30222,6 +47214,31 @@ func (*PremiumLimitTypePinnedArchivedChatCount) PremiumLimitTypeType() string { return TypePremiumLimitTypePinnedArchivedChatCount } +// The maximum number of pinned Saved Messages topics +type PremiumLimitTypePinnedSavedMessagesTopicCount struct{ + meta +} + +func (entity *PremiumLimitTypePinnedSavedMessagesTopicCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumLimitTypePinnedSavedMessagesTopicCount + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumLimitTypePinnedSavedMessagesTopicCount) GetClass() string { + return ClassPremiumLimitType +} + +func (*PremiumLimitTypePinnedSavedMessagesTopicCount) GetType() string { + return TypePremiumLimitTypePinnedSavedMessagesTopicCount +} + +func (*PremiumLimitTypePinnedSavedMessagesTopicCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypePinnedSavedMessagesTopicCount +} + // The maximum length of sent media caption type PremiumLimitTypeCaptionLength struct{ meta @@ -30347,57 +47364,57 @@ func (*PremiumLimitTypeActiveStoryCount) PremiumLimitTypeType() string { return TypePremiumLimitTypeActiveStoryCount } -// The maximum number of stories sent per week -type PremiumLimitTypeWeeklySentStoryCount struct{ +// The maximum number of stories posted per week +type PremiumLimitTypeWeeklyPostedStoryCount struct{ meta } -func (entity *PremiumLimitTypeWeeklySentStoryCount) MarshalJSON() ([]byte, error) { +func (entity *PremiumLimitTypeWeeklyPostedStoryCount) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumLimitTypeWeeklySentStoryCount + type stub PremiumLimitTypeWeeklyPostedStoryCount return json.Marshal((*stub)(entity)) } -func (*PremiumLimitTypeWeeklySentStoryCount) GetClass() string { +func (*PremiumLimitTypeWeeklyPostedStoryCount) GetClass() string { return ClassPremiumLimitType } -func (*PremiumLimitTypeWeeklySentStoryCount) GetType() string { - return TypePremiumLimitTypeWeeklySentStoryCount +func (*PremiumLimitTypeWeeklyPostedStoryCount) GetType() string { + return TypePremiumLimitTypeWeeklyPostedStoryCount } -func (*PremiumLimitTypeWeeklySentStoryCount) PremiumLimitTypeType() string { - return TypePremiumLimitTypeWeeklySentStoryCount +func (*PremiumLimitTypeWeeklyPostedStoryCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypeWeeklyPostedStoryCount } -// The maximum number of stories sent per month -type PremiumLimitTypeMonthlySentStoryCount struct{ +// The maximum number of stories posted per month +type PremiumLimitTypeMonthlyPostedStoryCount struct{ meta } -func (entity *PremiumLimitTypeMonthlySentStoryCount) MarshalJSON() ([]byte, error) { +func (entity *PremiumLimitTypeMonthlyPostedStoryCount) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PremiumLimitTypeMonthlySentStoryCount + type stub PremiumLimitTypeMonthlyPostedStoryCount return json.Marshal((*stub)(entity)) } -func (*PremiumLimitTypeMonthlySentStoryCount) GetClass() string { +func (*PremiumLimitTypeMonthlyPostedStoryCount) GetClass() string { return ClassPremiumLimitType } -func (*PremiumLimitTypeMonthlySentStoryCount) GetType() string { - return TypePremiumLimitTypeMonthlySentStoryCount +func (*PremiumLimitTypeMonthlyPostedStoryCount) GetType() string { + return TypePremiumLimitTypeMonthlyPostedStoryCount } -func (*PremiumLimitTypeMonthlySentStoryCount) PremiumLimitTypeType() string { - return TypePremiumLimitTypeMonthlySentStoryCount +func (*PremiumLimitTypeMonthlyPostedStoryCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypeMonthlyPostedStoryCount } -// The maximum length of captions of sent stories +// The maximum length of captions of posted stories type PremiumLimitTypeStoryCaptionLength struct{ meta } @@ -30447,6 +47464,31 @@ func (*PremiumLimitTypeStorySuggestedReactionAreaCount) PremiumLimitTypeType() s return TypePremiumLimitTypeStorySuggestedReactionAreaCount } +// The maximum number of received similar chats +type PremiumLimitTypeSimilarChatCount struct{ + meta +} + +func (entity *PremiumLimitTypeSimilarChatCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumLimitTypeSimilarChatCount + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumLimitTypeSimilarChatCount) GetClass() string { + return ClassPremiumLimitType +} + +func (*PremiumLimitTypeSimilarChatCount) GetType() string { + return TypePremiumLimitTypeSimilarChatCount +} + +func (*PremiumLimitTypeSimilarChatCount) PremiumLimitTypeType() string { + return TypePremiumLimitTypeSimilarChatCount +} + // Increased limits type PremiumFeatureIncreasedLimits struct{ meta @@ -30697,7 +47739,7 @@ func (*PremiumFeatureProfileBadge) PremiumFeatureType() string { return TypePremiumFeatureProfileBadge } -// An emoji status shown along with the user's name +// The ability to show an emoji status along with the user's name type PremiumFeatureEmojiStatus struct{ meta } @@ -30872,7 +47914,7 @@ func (*PremiumFeatureChatBoost) PremiumFeatureType() string { return TypePremiumFeatureChatBoost } -// The ability to choose accent color +// The ability to choose accent color for replies and user profile type PremiumFeatureAccentColor struct{ meta } @@ -30897,7 +47939,482 @@ func (*PremiumFeatureAccentColor) PremiumFeatureType() string { return TypePremiumFeatureAccentColor } -// User stories are displayed before stories of non-premium contacts and channels +// The ability to set private chat background for both users +type PremiumFeatureBackgroundForBoth struct{ + meta +} + +func (entity *PremiumFeatureBackgroundForBoth) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureBackgroundForBoth + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureBackgroundForBoth) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureBackgroundForBoth) GetType() string { + return TypePremiumFeatureBackgroundForBoth +} + +func (*PremiumFeatureBackgroundForBoth) PremiumFeatureType() string { + return TypePremiumFeatureBackgroundForBoth +} + +// The ability to use tags in Saved Messages +type PremiumFeatureSavedMessagesTags struct{ + meta +} + +func (entity *PremiumFeatureSavedMessagesTags) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureSavedMessagesTags + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureSavedMessagesTags) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureSavedMessagesTags) GetType() string { + return TypePremiumFeatureSavedMessagesTags +} + +func (*PremiumFeatureSavedMessagesTags) PremiumFeatureType() string { + return TypePremiumFeatureSavedMessagesTags +} + +// The ability to disallow incoming voice and video note messages in private chats using setUserPrivacySettingRules with userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages and to restrict incoming messages from non-contacts using setNewChatPrivacySettings +type PremiumFeatureMessagePrivacy struct{ + meta +} + +func (entity *PremiumFeatureMessagePrivacy) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureMessagePrivacy + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureMessagePrivacy) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureMessagePrivacy) GetType() string { + return TypePremiumFeatureMessagePrivacy +} + +func (*PremiumFeatureMessagePrivacy) PremiumFeatureType() string { + return TypePremiumFeatureMessagePrivacy +} + +// The ability to view last seen and read times of other users even if they can't view last seen or read time for the current user +type PremiumFeatureLastSeenTimes struct{ + meta +} + +func (entity *PremiumFeatureLastSeenTimes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureLastSeenTimes + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureLastSeenTimes) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureLastSeenTimes) GetType() string { + return TypePremiumFeatureLastSeenTimes +} + +func (*PremiumFeatureLastSeenTimes) PremiumFeatureType() string { + return TypePremiumFeatureLastSeenTimes +} + +// The ability to use Business features +type PremiumFeatureBusiness struct{ + meta +} + +func (entity *PremiumFeatureBusiness) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureBusiness + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureBusiness) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureBusiness) GetType() string { + return TypePremiumFeatureBusiness +} + +func (*PremiumFeatureBusiness) PremiumFeatureType() string { + return TypePremiumFeatureBusiness +} + +// The ability to use all available message effects +type PremiumFeatureMessageEffects struct{ + meta +} + +func (entity *PremiumFeatureMessageEffects) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureMessageEffects + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureMessageEffects) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureMessageEffects) GetType() string { + return TypePremiumFeatureMessageEffects +} + +func (*PremiumFeatureMessageEffects) PremiumFeatureType() string { + return TypePremiumFeatureMessageEffects +} + +// The ability to create and use checklist messages +type PremiumFeatureChecklists struct{ + meta +} + +func (entity *PremiumFeatureChecklists) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeatureChecklists + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeatureChecklists) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeatureChecklists) GetType() string { + return TypePremiumFeatureChecklists +} + +func (*PremiumFeatureChecklists) PremiumFeatureType() string { + return TypePremiumFeatureChecklists +} + +// The ability to require a payment for incoming messages in new chats +type PremiumFeaturePaidMessages struct{ + meta +} + +func (entity *PremiumFeaturePaidMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumFeaturePaidMessages + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumFeaturePaidMessages) GetClass() string { + return ClassPremiumFeature +} + +func (*PremiumFeaturePaidMessages) GetType() string { + return TypePremiumFeaturePaidMessages +} + +func (*PremiumFeaturePaidMessages) PremiumFeatureType() string { + return TypePremiumFeaturePaidMessages +} + +// The ability to set location +type BusinessFeatureLocation struct{ + meta +} + +func (entity *BusinessFeatureLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureLocation + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureLocation) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureLocation) GetType() string { + return TypeBusinessFeatureLocation +} + +func (*BusinessFeatureLocation) BusinessFeatureType() string { + return TypeBusinessFeatureLocation +} + +// The ability to set opening hours +type BusinessFeatureOpeningHours struct{ + meta +} + +func (entity *BusinessFeatureOpeningHours) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureOpeningHours + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureOpeningHours) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureOpeningHours) GetType() string { + return TypeBusinessFeatureOpeningHours +} + +func (*BusinessFeatureOpeningHours) BusinessFeatureType() string { + return TypeBusinessFeatureOpeningHours +} + +// The ability to use quick replies +type BusinessFeatureQuickReplies struct{ + meta +} + +func (entity *BusinessFeatureQuickReplies) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureQuickReplies + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureQuickReplies) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureQuickReplies) GetType() string { + return TypeBusinessFeatureQuickReplies +} + +func (*BusinessFeatureQuickReplies) BusinessFeatureType() string { + return TypeBusinessFeatureQuickReplies +} + +// The ability to set up a greeting message +type BusinessFeatureGreetingMessage struct{ + meta +} + +func (entity *BusinessFeatureGreetingMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureGreetingMessage + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureGreetingMessage) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureGreetingMessage) GetType() string { + return TypeBusinessFeatureGreetingMessage +} + +func (*BusinessFeatureGreetingMessage) BusinessFeatureType() string { + return TypeBusinessFeatureGreetingMessage +} + +// The ability to set up an away message +type BusinessFeatureAwayMessage struct{ + meta +} + +func (entity *BusinessFeatureAwayMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureAwayMessage + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureAwayMessage) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureAwayMessage) GetType() string { + return TypeBusinessFeatureAwayMessage +} + +func (*BusinessFeatureAwayMessage) BusinessFeatureType() string { + return TypeBusinessFeatureAwayMessage +} + +// The ability to create links to the business account with predefined message text +type BusinessFeatureAccountLinks struct{ + meta +} + +func (entity *BusinessFeatureAccountLinks) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureAccountLinks + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureAccountLinks) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureAccountLinks) GetType() string { + return TypeBusinessFeatureAccountLinks +} + +func (*BusinessFeatureAccountLinks) BusinessFeatureType() string { + return TypeBusinessFeatureAccountLinks +} + +// The ability to customize start page +type BusinessFeatureStartPage struct{ + meta +} + +func (entity *BusinessFeatureStartPage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureStartPage + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureStartPage) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureStartPage) GetType() string { + return TypeBusinessFeatureStartPage +} + +func (*BusinessFeatureStartPage) BusinessFeatureType() string { + return TypeBusinessFeatureStartPage +} + +// The ability to connect a bot to the account +type BusinessFeatureBots struct{ + meta +} + +func (entity *BusinessFeatureBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureBots + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureBots) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureBots) GetType() string { + return TypeBusinessFeatureBots +} + +func (*BusinessFeatureBots) BusinessFeatureType() string { + return TypeBusinessFeatureBots +} + +// The ability to show an emoji status along with the business name +type BusinessFeatureEmojiStatus struct{ + meta +} + +func (entity *BusinessFeatureEmojiStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureEmojiStatus + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureEmojiStatus) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureEmojiStatus) GetType() string { + return TypeBusinessFeatureEmojiStatus +} + +func (*BusinessFeatureEmojiStatus) BusinessFeatureType() string { + return TypeBusinessFeatureEmojiStatus +} + +// The ability to display folder names for each chat in the chat list +type BusinessFeatureChatFolderTags struct{ + meta +} + +func (entity *BusinessFeatureChatFolderTags) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureChatFolderTags + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureChatFolderTags) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureChatFolderTags) GetType() string { + return TypeBusinessFeatureChatFolderTags +} + +func (*BusinessFeatureChatFolderTags) BusinessFeatureType() string { + return TypeBusinessFeatureChatFolderTags +} + +// Allowed to use many additional features for stories +type BusinessFeatureUpgradedStories struct{ + meta +} + +func (entity *BusinessFeatureUpgradedStories) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatureUpgradedStories + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatureUpgradedStories) GetClass() string { + return ClassBusinessFeature +} + +func (*BusinessFeatureUpgradedStories) GetType() string { + return TypeBusinessFeatureUpgradedStories +} + +func (*BusinessFeatureUpgradedStories) BusinessFeatureType() string { + return TypeBusinessFeatureUpgradedStories +} + +// Stories of the current user are displayed before stories of non-Premium contacts, supergroups, and channels type PremiumStoryFeaturePriorityOrder struct{ meta } @@ -31022,7 +48539,7 @@ func (*PremiumStoryFeatureSaveStories) PremiumStoryFeatureType() string { return TypePremiumStoryFeatureSaveStories } -// The ability to use links and formatting in story caption +// The ability to use links and formatting in story caption, and use inputStoryAreaTypeLink areas type PremiumStoryFeatureLinksAndFormatting struct{ meta } @@ -31047,6 +48564,31 @@ func (*PremiumStoryFeatureLinksAndFormatting) PremiumStoryFeatureType() string { return TypePremiumStoryFeatureLinksAndFormatting } +// The ability to choose better quality for viewed stories +type PremiumStoryFeatureVideoQuality struct{ + meta +} + +func (entity *PremiumStoryFeatureVideoQuality) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumStoryFeatureVideoQuality + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumStoryFeatureVideoQuality) GetClass() string { + return ClassPremiumStoryFeature +} + +func (*PremiumStoryFeatureVideoQuality) GetType() string { + return TypePremiumStoryFeatureVideoQuality +} + +func (*PremiumStoryFeatureVideoQuality) PremiumStoryFeatureType() string { + return TypePremiumStoryFeatureVideoQuality +} + // Contains information about a limit, increased for Premium users type PremiumLimit struct { meta @@ -31145,6 +48687,45 @@ func (premiumFeatures *PremiumFeatures) UnmarshalJSON(data []byte) error { return nil } +// Contains information about features, available to Business user accounts +type BusinessFeatures struct { + meta + // The list of available business features + Features []BusinessFeature `json:"features"` +} + +func (entity *BusinessFeatures) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeatures + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeatures) GetClass() string { + return ClassBusinessFeatures +} + +func (*BusinessFeatures) GetType() string { + return TypeBusinessFeatures +} + +func (businessFeatures *BusinessFeatures) UnmarshalJSON(data []byte) error { + var tmp struct { + Features []json.RawMessage `json:"features"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldFeatures, _ := UnmarshalListOfBusinessFeature(tmp.Features) + businessFeatures.Features = fieldFeatures + + return nil +} + // A limit was exceeded type PremiumSourceLimitExceeded struct { meta @@ -31231,6 +48812,49 @@ func (premiumSourceFeature *PremiumSourceFeature) UnmarshalJSON(data []byte) err return nil } +// A user tried to use a Business feature +type PremiumSourceBusinessFeature struct { + meta + // The used feature; pass null if none specific feature was used + Feature BusinessFeature `json:"feature"` +} + +func (entity *PremiumSourceBusinessFeature) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PremiumSourceBusinessFeature + + return json.Marshal((*stub)(entity)) +} + +func (*PremiumSourceBusinessFeature) GetClass() string { + return ClassPremiumSource +} + +func (*PremiumSourceBusinessFeature) GetType() string { + return TypePremiumSourceBusinessFeature +} + +func (*PremiumSourceBusinessFeature) PremiumSourceType() string { + return TypePremiumSourceBusinessFeature +} + +func (premiumSourceBusinessFeature *PremiumSourceBusinessFeature) UnmarshalJSON(data []byte) error { + var tmp struct { + Feature json.RawMessage `json:"feature"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldFeature, _ := UnmarshalBusinessFeature(tmp.Feature) + premiumSourceBusinessFeature.Feature = fieldFeature + + return nil +} + // A user tried to use a Premium story feature type PremiumSourceStoryFeature struct { meta @@ -31274,7 +48898,7 @@ func (premiumSourceStoryFeature *PremiumSourceStoryFeature) UnmarshalJSON(data [ return nil } -// A user opened an internal link of the type internalLinkTypePremiumFeatures +// A user opened an internal link of the type internalLinkTypePremiumFeaturesPage type PremiumSourceLink struct { meta // The referrer from the link @@ -31370,6 +48994,50 @@ func (premiumFeaturePromotionAnimation *PremiumFeaturePromotionAnimation) Unmars return nil } +// Describes a promotion animation for a Business feature +type BusinessFeaturePromotionAnimation struct { + meta + // Business feature + Feature BusinessFeature `json:"feature"` + // Promotion animation for the feature + Animation *Animation `json:"animation"` +} + +func (entity *BusinessFeaturePromotionAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BusinessFeaturePromotionAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*BusinessFeaturePromotionAnimation) GetClass() string { + return ClassBusinessFeaturePromotionAnimation +} + +func (*BusinessFeaturePromotionAnimation) GetType() string { + return TypeBusinessFeaturePromotionAnimation +} + +func (businessFeaturePromotionAnimation *BusinessFeaturePromotionAnimation) UnmarshalJSON(data []byte) error { + var tmp struct { + Feature json.RawMessage `json:"feature"` + Animation *Animation `json:"animation"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + businessFeaturePromotionAnimation.Animation = tmp.Animation + + fieldFeature, _ := UnmarshalBusinessFeature(tmp.Feature) + businessFeaturePromotionAnimation.Feature = fieldFeature + + return nil +} + // Contains state of Telegram Premium subscription and promotion videos for Premium features type PremiumState struct { meta @@ -31379,6 +49047,8 @@ type PremiumState struct { PaymentOptions []*PremiumStatePaymentOption `json:"payment_options"` // The list of available promotion animations for Premium features Animations []*PremiumFeaturePromotionAnimation `json:"animations"` + // The list of available promotion animations for Business features + BusinessAnimations []*BusinessFeaturePromotionAnimation `json:"business_animations"` } func (entity *PremiumState) MarshalJSON() ([]byte, error) { @@ -31427,40 +49097,42 @@ func (*StorePaymentPurposePremiumSubscription) StorePaymentPurposeType() string } // The user gifting Telegram Premium to another user -type StorePaymentPurposeGiftedPremium struct { +type StorePaymentPurposePremiumGift struct { meta - // Identifier of the user to which Premium was gifted - UserId int64 `json:"user_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` // Paid amount, in the smallest units of the currency Amount int64 `json:"amount"` + // Identifiers of the user which will receive Telegram Premium + UserId int64 `json:"user_id"` + // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` } -func (entity *StorePaymentPurposeGiftedPremium) MarshalJSON() ([]byte, error) { +func (entity *StorePaymentPurposePremiumGift) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub StorePaymentPurposeGiftedPremium + type stub StorePaymentPurposePremiumGift return json.Marshal((*stub)(entity)) } -func (*StorePaymentPurposeGiftedPremium) GetClass() string { +func (*StorePaymentPurposePremiumGift) GetClass() string { return ClassStorePaymentPurpose } -func (*StorePaymentPurposeGiftedPremium) GetType() string { - return TypeStorePaymentPurposeGiftedPremium +func (*StorePaymentPurposePremiumGift) GetType() string { + return TypeStorePaymentPurposePremiumGift } -func (*StorePaymentPurposeGiftedPremium) StorePaymentPurposeType() string { - return TypeStorePaymentPurposeGiftedPremium +func (*StorePaymentPurposePremiumGift) StorePaymentPurposeType() string { + return TypeStorePaymentPurposePremiumGift } -// The user creating Telegram Premium gift codes for other users +// The user boosting a chat by creating Telegram Premium gift codes for other users type StorePaymentPurposePremiumGiftCodes struct { meta - // Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -31468,6 +49140,8 @@ type StorePaymentPurposePremiumGiftCodes struct { Amount int64 `json:"amount"` // Identifiers of the users which can activate the gift codes UserIds []int64 `json:"user_ids"` + // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` } func (entity *StorePaymentPurposePremiumGiftCodes) MarshalJSON() ([]byte, error) { @@ -31490,11 +49164,11 @@ func (*StorePaymentPurposePremiumGiftCodes) StorePaymentPurposeType() string { return TypeStorePaymentPurposePremiumGiftCodes } -// The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +// The user creating a Telegram Premium giveaway type StorePaymentPurposePremiumGiveaway struct { meta // Giveaway parameters - Parameters *PremiumGiveawayParameters `json:"parameters"` + Parameters *GiveawayParameters `json:"parameters"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` // Paid amount, in the smallest units of the currency @@ -31521,10 +49195,204 @@ func (*StorePaymentPurposePremiumGiveaway) StorePaymentPurposeType() string { return TypeStorePaymentPurposePremiumGiveaway } -// The user creating Telegram Premium gift codes for other users +// The user creating a Telegram Star giveaway +type StorePaymentPurposeStarGiveaway struct { + meta + // Giveaway parameters + Parameters *GiveawayParameters `json:"parameters"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // The number of users to receive Telegram Stars + WinnerCount int32 `json:"winner_count"` + // The number of Telegram Stars to be distributed through the giveaway + StarCount int64 `json:"star_count"` +} + +func (entity *StorePaymentPurposeStarGiveaway) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorePaymentPurposeStarGiveaway + + return json.Marshal((*stub)(entity)) +} + +func (*StorePaymentPurposeStarGiveaway) GetClass() string { + return ClassStorePaymentPurpose +} + +func (*StorePaymentPurposeStarGiveaway) GetType() string { + return TypeStorePaymentPurposeStarGiveaway +} + +func (*StorePaymentPurposeStarGiveaway) StorePaymentPurposeType() string { + return TypeStorePaymentPurposeStarGiveaway +} + +// The user buying Telegram Stars +type StorePaymentPurposeStars struct { + meta + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of bought Telegram Stars + StarCount int64 `json:"star_count"` + // Identifier of the chat that is supposed to receive the Telegram Stars; pass 0 if none + ChatId int64 `json:"chat_id"` +} + +func (entity *StorePaymentPurposeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorePaymentPurposeStars + + return json.Marshal((*stub)(entity)) +} + +func (*StorePaymentPurposeStars) GetClass() string { + return ClassStorePaymentPurpose +} + +func (*StorePaymentPurposeStars) GetType() string { + return TypeStorePaymentPurposeStars +} + +func (*StorePaymentPurposeStars) StorePaymentPurposeType() string { + return TypeStorePaymentPurposeStars +} + +// The user buying Telegram Stars for other users +type StorePaymentPurposeGiftedStars struct { + meta + // Identifier of the user to which Telegram Stars are gifted + UserId int64 `json:"user_id"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of bought Telegram Stars + StarCount int64 `json:"star_count"` +} + +func (entity *StorePaymentPurposeGiftedStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StorePaymentPurposeGiftedStars + + return json.Marshal((*stub)(entity)) +} + +func (*StorePaymentPurposeGiftedStars) GetClass() string { + return ClassStorePaymentPurpose +} + +func (*StorePaymentPurposeGiftedStars) GetType() string { + return TypeStorePaymentPurposeGiftedStars +} + +func (*StorePaymentPurposeGiftedStars) StorePaymentPurposeType() string { + return TypeStorePaymentPurposeGiftedStars +} + +// A purchase through App Store +type StoreTransactionAppStore struct { + meta + // App Store receipt + Receipt []byte `json:"receipt"` +} + +func (entity *StoreTransactionAppStore) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoreTransactionAppStore + + return json.Marshal((*stub)(entity)) +} + +func (*StoreTransactionAppStore) GetClass() string { + return ClassStoreTransaction +} + +func (*StoreTransactionAppStore) GetType() string { + return TypeStoreTransactionAppStore +} + +func (*StoreTransactionAppStore) StoreTransactionType() string { + return TypeStoreTransactionAppStore +} + +// A purchase through Google Play +type StoreTransactionGooglePlay struct { + meta + // Application package name + PackageName string `json:"package_name"` + // Identifier of the purchased store product + StoreProductId string `json:"store_product_id"` + // Google Play purchase token + PurchaseToken string `json:"purchase_token"` +} + +func (entity *StoreTransactionGooglePlay) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoreTransactionGooglePlay + + return json.Marshal((*stub)(entity)) +} + +func (*StoreTransactionGooglePlay) GetClass() string { + return ClassStoreTransaction +} + +func (*StoreTransactionGooglePlay) GetType() string { + return TypeStoreTransactionGooglePlay +} + +func (*StoreTransactionGooglePlay) StoreTransactionType() string { + return TypeStoreTransactionGooglePlay +} + +// The user gifting Telegram Premium to another user +type TelegramPaymentPurposePremiumGift struct { + meta + // ISO 4217 currency code of the payment currency, or "XTR" for payments in Telegram Stars + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Identifier of the user which will receive Telegram Premium + UserId int64 `json:"user_id"` + // Number of months the Telegram Premium subscription will be active for the user + MonthCount int32 `json:"month_count"` + // Text to show to the user receiving Telegram Premium; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` +} + +func (entity *TelegramPaymentPurposePremiumGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposePremiumGift + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposePremiumGift) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposePremiumGift) GetType() string { + return TypeTelegramPaymentPurposePremiumGift +} + +func (*TelegramPaymentPurposePremiumGift) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposePremiumGift +} + +// The user boosting a chat by creating Telegram Premium gift codes for other users type TelegramPaymentPurposePremiumGiftCodes struct { meta - // Identifier of the channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user; 0 if none + // Identifier of the supergroup or channel chat, which will be automatically boosted by the users for duration of the Premium subscription and which is administered by the user BoostedChatId int64 `json:"boosted_chat_id"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` @@ -31532,8 +49400,10 @@ type TelegramPaymentPurposePremiumGiftCodes struct { Amount int64 `json:"amount"` // Identifiers of the users which can activate the gift codes UserIds []int64 `json:"user_ids"` - // Number of month the Telegram Premium subscription will be active for the users + // Number of months the Telegram Premium subscription will be active for the users MonthCount int32 `json:"month_count"` + // Text to show along with the gift codes; 0-getOption("gift_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities are allowed + Text *FormattedText `json:"text"` } func (entity *TelegramPaymentPurposePremiumGiftCodes) MarshalJSON() ([]byte, error) { @@ -31556,18 +49426,18 @@ func (*TelegramPaymentPurposePremiumGiftCodes) TelegramPaymentPurposeType() stri return TypeTelegramPaymentPurposePremiumGiftCodes } -// The user creating a Telegram Premium giveaway for subscribers of channel chats; requires can_post_messages rights in the channels +// The user creating a Telegram Premium giveaway type TelegramPaymentPurposePremiumGiveaway struct { meta // Giveaway parameters - Parameters *PremiumGiveawayParameters `json:"parameters"` + Parameters *GiveawayParameters `json:"parameters"` // ISO 4217 currency code of the payment currency Currency string `json:"currency"` // Paid amount, in the smallest units of the currency Amount int64 `json:"amount"` // Number of users which will be able to activate the gift codes WinnerCount int32 `json:"winner_count"` - // Number of month the Telegram Premium subscription will be active for the users + // Number of months the Telegram Premium subscription will be active for the users MonthCount int32 `json:"month_count"` } @@ -31591,6 +49461,134 @@ func (*TelegramPaymentPurposePremiumGiveaway) TelegramPaymentPurposeType() strin return TypeTelegramPaymentPurposePremiumGiveaway } +// The user buying Telegram Stars +type TelegramPaymentPurposeStars struct { + meta + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of bought Telegram Stars + StarCount int64 `json:"star_count"` + // Identifier of the chat that is supposed to receive the Telegram Stars; pass 0 if none + ChatId int64 `json:"chat_id"` +} + +func (entity *TelegramPaymentPurposeStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposeStars + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposeStars) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposeStars) GetType() string { + return TypeTelegramPaymentPurposeStars +} + +func (*TelegramPaymentPurposeStars) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposeStars +} + +// The user buying Telegram Stars for other users +type TelegramPaymentPurposeGiftedStars struct { + meta + // Identifier of the user to which Telegram Stars are gifted + UserId int64 `json:"user_id"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // Number of bought Telegram Stars + StarCount int64 `json:"star_count"` +} + +func (entity *TelegramPaymentPurposeGiftedStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposeGiftedStars + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposeGiftedStars) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposeGiftedStars) GetType() string { + return TypeTelegramPaymentPurposeGiftedStars +} + +func (*TelegramPaymentPurposeGiftedStars) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposeGiftedStars +} + +// The user creating a Telegram Star giveaway +type TelegramPaymentPurposeStarGiveaway struct { + meta + // Giveaway parameters + Parameters *GiveawayParameters `json:"parameters"` + // ISO 4217 currency code of the payment currency + Currency string `json:"currency"` + // Paid amount, in the smallest units of the currency + Amount int64 `json:"amount"` + // The number of users to receive Telegram Stars + WinnerCount int32 `json:"winner_count"` + // The number of Telegram Stars to be distributed through the giveaway + StarCount int64 `json:"star_count"` +} + +func (entity *TelegramPaymentPurposeStarGiveaway) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposeStarGiveaway + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposeStarGiveaway) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposeStarGiveaway) GetType() string { + return TypeTelegramPaymentPurposeStarGiveaway +} + +func (*TelegramPaymentPurposeStarGiveaway) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposeStarGiveaway +} + +// The user joins a chat and subscribes to regular payments in Telegram Stars +type TelegramPaymentPurposeJoinChat struct { + meta + // Invite link to use + InviteLink string `json:"invite_link"` +} + +func (entity *TelegramPaymentPurposeJoinChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TelegramPaymentPurposeJoinChat + + return json.Marshal((*stub)(entity)) +} + +func (*TelegramPaymentPurposeJoinChat) GetClass() string { + return ClassTelegramPaymentPurpose +} + +func (*TelegramPaymentPurposeJoinChat) GetType() string { + return TypeTelegramPaymentPurposeJoinChat +} + +func (*TelegramPaymentPurposeJoinChat) TelegramPaymentPurposeType() string { + return TypeTelegramPaymentPurposeJoinChat +} + // A token for Firebase Cloud Messaging type DeviceTokenFirebaseCloudMessaging struct { meta @@ -31955,7 +49953,7 @@ func (*PushReceiverId) GetType() string { // Describes a solid fill of a background type BackgroundFillSolid struct { meta - // A color of the background in the RGB24 format + // A color of the background in the RGB format Color int32 `json:"color"` } @@ -31982,9 +49980,9 @@ func (*BackgroundFillSolid) BackgroundFillType() string { // Describes a gradient fill of a background type BackgroundFillGradient struct { meta - // A top color of the background in the RGB24 format + // A top color of the background in the RGB format TopColor int32 `json:"top_color"` - // A bottom color of the background in the RGB24 format + // A bottom color of the background in the RGB format BottomColor int32 `json:"bottom_color"` // Clockwise rotation angle of the gradient, in degrees; 0-359. Must always be divisible by 45 RotationAngle int32 `json:"rotation_angle"` @@ -32013,7 +50011,7 @@ func (*BackgroundFillGradient) BackgroundFillType() string { // Describes a freeform gradient fill of a background type BackgroundFillFreeformGradient struct { meta - // A list of 3 or 4 colors of the freeform gradients in the RGB24 format + // A list of 3 or 4 colors of the freeform gradient in the RGB format Colors []int32 `json:"colors"` } @@ -32071,7 +50069,7 @@ type BackgroundTypePattern struct { meta // Fill of the background Fill BackgroundFill `json:"fill"` - // Intensity of the pattern when it is shown above the filled background; 0-100. + // Intensity of the pattern when it is shown above the filled background; 0-100 Intensity int32 `json:"intensity"` // True, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only IsInverted bool `json:"is_inverted"` @@ -32165,6 +50163,33 @@ func (backgroundTypeFill *BackgroundTypeFill) UnmarshalJSON(data []byte) error { return nil } +// A background from a chat theme based on an emoji; can be used only as a chat background in channels +type BackgroundTypeChatTheme struct { + meta + // Name of the emoji chat theme + ThemeName string `json:"theme_name"` +} + +func (entity *BackgroundTypeChatTheme) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub BackgroundTypeChatTheme + + return json.Marshal((*stub)(entity)) +} + +func (*BackgroundTypeChatTheme) GetClass() string { + return ClassBackgroundType +} + +func (*BackgroundTypeChatTheme) GetType() string { + return TypeBackgroundTypeChatTheme +} + +func (*BackgroundTypeChatTheme) BackgroundTypeType() string { + return TypeBackgroundTypeChatTheme +} + // A background from a local file type InputBackgroundLocal struct { meta @@ -32262,64 +50287,8 @@ func (*InputBackgroundPrevious) InputBackgroundType() string { return TypeInputBackgroundPrevious } -// Describes theme settings -type ThemeSettings struct { - meta - // Theme accent color in ARGB format - AccentColor int32 `json:"accent_color"` - // The background to be used in chats; may be null - Background *Background `json:"background"` - // The fill to be used as a background for outgoing messages - OutgoingMessageFill BackgroundFill `json:"outgoing_message_fill"` - // If true, the freeform gradient fill needs to be animated on every sent message - AnimateOutgoingMessageFill bool `json:"animate_outgoing_message_fill"` - // Accent color of outgoing messages in ARGB format - OutgoingMessageAccentColor int32 `json:"outgoing_message_accent_color"` -} - -func (entity *ThemeSettings) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ThemeSettings - - return json.Marshal((*stub)(entity)) -} - -func (*ThemeSettings) GetClass() string { - return ClassThemeSettings -} - -func (*ThemeSettings) GetType() string { - return TypeThemeSettings -} - -func (themeSettings *ThemeSettings) UnmarshalJSON(data []byte) error { - var tmp struct { - AccentColor int32 `json:"accent_color"` - Background *Background `json:"background"` - OutgoingMessageFill json.RawMessage `json:"outgoing_message_fill"` - AnimateOutgoingMessageFill bool `json:"animate_outgoing_message_fill"` - OutgoingMessageAccentColor int32 `json:"outgoing_message_accent_color"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - themeSettings.AccentColor = tmp.AccentColor - themeSettings.Background = tmp.Background - themeSettings.AnimateOutgoingMessageFill = tmp.AnimateOutgoingMessageFill - themeSettings.OutgoingMessageAccentColor = tmp.OutgoingMessageAccentColor - - fieldOutgoingMessageFill, _ := UnmarshalBackgroundFill(tmp.OutgoingMessageFill) - themeSettings.OutgoingMessageFill = fieldOutgoingMessageFill - - return nil -} - -// Describes a chat theme -type ChatTheme struct { +// Describes a chat theme based on an emoji +type EmojiChatTheme struct { meta // Theme name Name string `json:"name"` @@ -32329,20 +50298,230 @@ type ChatTheme struct { DarkSettings *ThemeSettings `json:"dark_settings"` } -func (entity *ChatTheme) MarshalJSON() ([]byte, error) { +func (entity *EmojiChatTheme) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatTheme + type stub EmojiChatTheme return json.Marshal((*stub)(entity)) } -func (*ChatTheme) GetClass() string { +func (*EmojiChatTheme) GetClass() string { + return ClassEmojiChatTheme +} + +func (*EmojiChatTheme) GetType() string { + return TypeEmojiChatTheme +} + +// Describes a chat theme based on an upgraded gift +type GiftChatTheme struct { + meta + // The gift + Gift *UpgradedGift `json:"gift"` + // Theme settings for a light chat theme + LightSettings *ThemeSettings `json:"light_settings"` + // Theme settings for a dark chat theme + DarkSettings *ThemeSettings `json:"dark_settings"` +} + +func (entity *GiftChatTheme) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftChatTheme + + return json.Marshal((*stub)(entity)) +} + +func (*GiftChatTheme) GetClass() string { + return ClassGiftChatTheme +} + +func (*GiftChatTheme) GetType() string { + return TypeGiftChatTheme +} + +// Contains a list of chat themes based on upgraded gifts +type GiftChatThemes struct { + meta + // A list of chat themes + Themes []*GiftChatTheme `json:"themes"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *GiftChatThemes) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub GiftChatThemes + + return json.Marshal((*stub)(entity)) +} + +func (*GiftChatThemes) GetClass() string { + return ClassGiftChatThemes +} + +func (*GiftChatThemes) GetType() string { + return TypeGiftChatThemes +} + +// A chat theme based on an emoji +type ChatThemeEmoji struct { + meta + // Name of the theme; full theme description is received through updateEmojiChatThemes + Name string `json:"name"` +} + +func (entity *ChatThemeEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatThemeEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*ChatThemeEmoji) GetClass() string { return ClassChatTheme } -func (*ChatTheme) GetType() string { - return TypeChatTheme +func (*ChatThemeEmoji) GetType() string { + return TypeChatThemeEmoji +} + +func (*ChatThemeEmoji) ChatThemeType() string { + return TypeChatThemeEmoji +} + +// A chat theme based on an upgraded gift +type ChatThemeGift struct { + meta + // The chat theme + GiftTheme *GiftChatTheme `json:"gift_theme"` +} + +func (entity *ChatThemeGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatThemeGift + + return json.Marshal((*stub)(entity)) +} + +func (*ChatThemeGift) GetClass() string { + return ClassChatTheme +} + +func (*ChatThemeGift) GetType() string { + return TypeChatThemeGift +} + +func (*ChatThemeGift) ChatThemeType() string { + return TypeChatThemeGift +} + +// A theme based on an emoji +type InputChatThemeEmoji struct { + meta + // Name of the theme + Name string `json:"name"` +} + +func (entity *InputChatThemeEmoji) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatThemeEmoji + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatThemeEmoji) GetClass() string { + return ClassInputChatTheme +} + +func (*InputChatThemeEmoji) GetType() string { + return TypeInputChatThemeEmoji +} + +func (*InputChatThemeEmoji) InputChatThemeType() string { + return TypeInputChatThemeEmoji +} + +// A theme based on an upgraded gift +type InputChatThemeGift struct { + meta + // Name of the upgraded gift. A gift can be used only in one chat in a time. When the same gift is used in another chat, theme in the previous chat is reset to default + Name string `json:"name"` +} + +func (entity *InputChatThemeGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputChatThemeGift + + return json.Marshal((*stub)(entity)) +} + +func (*InputChatThemeGift) GetClass() string { + return ClassInputChatTheme +} + +func (*InputChatThemeGift) GetType() string { + return TypeInputChatThemeGift +} + +func (*InputChatThemeGift) InputChatThemeType() string { + return TypeInputChatThemeGift +} + +// Describes a time zone +type TimeZone struct { + meta + // Unique time zone identifier + Id string `json:"id"` + // Time zone name + Name string `json:"name"` + // Current UTC time offset for the time zone + UtcTimeOffset int32 `json:"utc_time_offset"` +} + +func (entity *TimeZone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TimeZone + + return json.Marshal((*stub)(entity)) +} + +func (*TimeZone) GetClass() string { + return ClassTimeZone +} + +func (*TimeZone) GetType() string { + return TypeTimeZone +} + +// Contains a list of time zones +type TimeZones struct { + meta + // A list of time zones + TimeZones []*TimeZone `json:"time_zones"` +} + +func (entity *TimeZones) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TimeZones + + return json.Marshal((*stub)(entity)) +} + +func (*TimeZones) GetClass() string { + return ClassTimeZones +} + +func (*TimeZones) GetType() string { + return TypeTimeZones } // Contains a list of hashtags @@ -32369,157 +50548,256 @@ func (*Hashtags) GetType() string { } // A story can be sent -type CanSendStoryResultOk struct{ +type CanPostStoryResultOk struct { meta + // Number of stories that can be posted by the user + StoryCount int32 `json:"story_count"` } -func (entity *CanSendStoryResultOk) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultOk) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultOk + type stub CanPostStoryResultOk return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultOk) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultOk) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultOk) GetType() string { - return TypeCanSendStoryResultOk +func (*CanPostStoryResultOk) GetType() string { + return TypeCanPostStoryResultOk } -func (*CanSendStoryResultOk) CanSendStoryResultType() string { - return TypeCanSendStoryResultOk +func (*CanPostStoryResultOk) CanPostStoryResultType() string { + return TypeCanPostStoryResultOk } // The user must subscribe to Telegram Premium to be able to post stories -type CanSendStoryResultPremiumNeeded struct{ +type CanPostStoryResultPremiumNeeded struct{ meta } -func (entity *CanSendStoryResultPremiumNeeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultPremiumNeeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultPremiumNeeded + type stub CanPostStoryResultPremiumNeeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultPremiumNeeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultPremiumNeeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultPremiumNeeded) GetType() string { - return TypeCanSendStoryResultPremiumNeeded +func (*CanPostStoryResultPremiumNeeded) GetType() string { + return TypeCanPostStoryResultPremiumNeeded } -func (*CanSendStoryResultPremiumNeeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultPremiumNeeded +func (*CanPostStoryResultPremiumNeeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultPremiumNeeded } -// The channel chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat -type CanSendStoryResultBoostNeeded struct{ +// The chat must be boosted first by Telegram Premium subscribers to post more stories. Call getChatBoostStatus to get current boost status of the chat +type CanPostStoryResultBoostNeeded struct{ meta } -func (entity *CanSendStoryResultBoostNeeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultBoostNeeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultBoostNeeded + type stub CanPostStoryResultBoostNeeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultBoostNeeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultBoostNeeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultBoostNeeded) GetType() string { - return TypeCanSendStoryResultBoostNeeded +func (*CanPostStoryResultBoostNeeded) GetType() string { + return TypeCanPostStoryResultBoostNeeded } -func (*CanSendStoryResultBoostNeeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultBoostNeeded +func (*CanPostStoryResultBoostNeeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultBoostNeeded } // The limit for the number of active stories exceeded. The user can buy Telegram Premium, delete an active story, or wait for the oldest story to expire -type CanSendStoryResultActiveStoryLimitExceeded struct{ +type CanPostStoryResultActiveStoryLimitExceeded struct{ meta } -func (entity *CanSendStoryResultActiveStoryLimitExceeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultActiveStoryLimitExceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultActiveStoryLimitExceeded + type stub CanPostStoryResultActiveStoryLimitExceeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultActiveStoryLimitExceeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultActiveStoryLimitExceeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultActiveStoryLimitExceeded) GetType() string { - return TypeCanSendStoryResultActiveStoryLimitExceeded +func (*CanPostStoryResultActiveStoryLimitExceeded) GetType() string { + return TypeCanPostStoryResultActiveStoryLimitExceeded } -func (*CanSendStoryResultActiveStoryLimitExceeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultActiveStoryLimitExceeded +func (*CanPostStoryResultActiveStoryLimitExceeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultActiveStoryLimitExceeded } // The weekly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time -type CanSendStoryResultWeeklyLimitExceeded struct { +type CanPostStoryResultWeeklyLimitExceeded struct { meta - // Time left before the user can send the next story + // Time left before the user can post the next story, in seconds RetryAfter int32 `json:"retry_after"` } -func (entity *CanSendStoryResultWeeklyLimitExceeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultWeeklyLimitExceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultWeeklyLimitExceeded + type stub CanPostStoryResultWeeklyLimitExceeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultWeeklyLimitExceeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultWeeklyLimitExceeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultWeeklyLimitExceeded) GetType() string { - return TypeCanSendStoryResultWeeklyLimitExceeded +func (*CanPostStoryResultWeeklyLimitExceeded) GetType() string { + return TypeCanPostStoryResultWeeklyLimitExceeded } -func (*CanSendStoryResultWeeklyLimitExceeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultWeeklyLimitExceeded +func (*CanPostStoryResultWeeklyLimitExceeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultWeeklyLimitExceeded } // The monthly limit for the number of posted stories exceeded. The user needs to buy Telegram Premium or wait specified time -type CanSendStoryResultMonthlyLimitExceeded struct { +type CanPostStoryResultMonthlyLimitExceeded struct { meta - // Time left before the user can send the next story + // Time left before the user can post the next story, in seconds RetryAfter int32 `json:"retry_after"` } -func (entity *CanSendStoryResultMonthlyLimitExceeded) MarshalJSON() ([]byte, error) { +func (entity *CanPostStoryResultMonthlyLimitExceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub CanSendStoryResultMonthlyLimitExceeded + type stub CanPostStoryResultMonthlyLimitExceeded return json.Marshal((*stub)(entity)) } -func (*CanSendStoryResultMonthlyLimitExceeded) GetClass() string { - return ClassCanSendStoryResult +func (*CanPostStoryResultMonthlyLimitExceeded) GetClass() string { + return ClassCanPostStoryResult } -func (*CanSendStoryResultMonthlyLimitExceeded) GetType() string { - return TypeCanSendStoryResultMonthlyLimitExceeded +func (*CanPostStoryResultMonthlyLimitExceeded) GetType() string { + return TypeCanPostStoryResultMonthlyLimitExceeded } -func (*CanSendStoryResultMonthlyLimitExceeded) CanSendStoryResultType() string { - return TypeCanSendStoryResultMonthlyLimitExceeded +func (*CanPostStoryResultMonthlyLimitExceeded) CanPostStoryResultType() string { + return TypeCanPostStoryResultMonthlyLimitExceeded +} + +// The user or the chat has an active live story. The live story must be deleted first +type CanPostStoryResultLiveStoryIsActive struct { + meta + // Identifier of the active live story + StoryId int32 `json:"story_id"` +} + +func (entity *CanPostStoryResultLiveStoryIsActive) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanPostStoryResultLiveStoryIsActive + + return json.Marshal((*stub)(entity)) +} + +func (*CanPostStoryResultLiveStoryIsActive) GetClass() string { + return ClassCanPostStoryResult +} + +func (*CanPostStoryResultLiveStoryIsActive) GetType() string { + return TypeCanPostStoryResultLiveStoryIsActive +} + +func (*CanPostStoryResultLiveStoryIsActive) CanPostStoryResultType() string { + return TypeCanPostStoryResultLiveStoryIsActive +} + +// The live story was successfully posted +type StartLiveStoryResultOk struct { + meta + // The live story + Story *Story `json:"story"` +} + +func (entity *StartLiveStoryResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StartLiveStoryResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*StartLiveStoryResultOk) GetClass() string { + return ClassStartLiveStoryResult +} + +func (*StartLiveStoryResultOk) GetType() string { + return TypeStartLiveStoryResultOk +} + +func (*StartLiveStoryResultOk) StartLiveStoryResultType() string { + return TypeStartLiveStoryResultOk +} + +// The live story failed to post with an error to be handled +type StartLiveStoryResultFail struct { + meta + // Type of the error; other error types may be returned as regular errors + ErrorType CanPostStoryResult `json:"error_type"` +} + +func (entity *StartLiveStoryResultFail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StartLiveStoryResultFail + + return json.Marshal((*stub)(entity)) +} + +func (*StartLiveStoryResultFail) GetClass() string { + return ClassStartLiveStoryResult +} + +func (*StartLiveStoryResultFail) GetType() string { + return TypeStartLiveStoryResultFail +} + +func (*StartLiveStoryResultFail) StartLiveStoryResultType() string { + return TypeStartLiveStoryResultFail +} + +func (startLiveStoryResultFail *StartLiveStoryResultFail) UnmarshalJSON(data []byte) error { + var tmp struct { + ErrorType json.RawMessage `json:"error_type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldErrorType, _ := UnmarshalCanPostStoryResult(tmp.ErrorType) + startLiveStoryResultFail.ErrorType = fieldErrorType + + return nil } // The session can be used @@ -32701,7 +50979,7 @@ func (*CheckChatUsernameResultUsernameOccupied) CheckChatUsernameResultType() st return TypeCheckChatUsernameResultUsernameOccupied } -// The username can be purchased at fragment.com +// The username can be purchased at https://fragment.com. Information about the username can be received using getCollectibleItemInfo type CheckChatUsernameResultUsernamePurchasable struct{ meta } @@ -32930,7 +51208,7 @@ func (*ResetPasswordResultDeclined) ResetPasswordResultType() string { return TypeResetPasswordResultDeclined } -// The messages was exported from a private chat +// The messages were exported from a private chat type MessageFileTypePrivate struct { meta // Name of the other party; may be empty if unrecognized @@ -32957,7 +51235,7 @@ func (*MessageFileTypePrivate) MessageFileTypeType() string { return TypeMessageFileTypePrivate } -// The messages was exported from a group chat +// The messages were exported from a group chat type MessageFileTypeGroup struct { meta // Title of the group chat; may be empty if unrecognized @@ -32984,7 +51262,7 @@ func (*MessageFileTypeGroup) MessageFileTypeType() string { return TypeMessageFileTypeGroup } -// The messages was exported from a chat of unknown type +// The messages were exported from a chat of unknown type type MessageFileTypeUnknown struct{ meta } @@ -33126,8 +51404,10 @@ func (*PushMessageContentContact) PushMessageContentType() string { } // A contact has registered with Telegram -type PushMessageContentContactRegistered struct{ +type PushMessageContentContactRegistered struct { meta + // True, if the user joined Telegram as a Telegram Premium account + AsPremiumAccount bool `json:"as_premium_account"` } func (entity *PushMessageContentContactRegistered) MarshalJSON() ([]byte, error) { @@ -33297,6 +51577,35 @@ func (*PushMessageContentLocation) PushMessageContentType() string { return TypePushMessageContentLocation } +// A message with paid media +type PushMessageContentPaidMedia struct { + meta + // Number of Telegram Stars needed to buy access to the media in the message; 0 for pinned message + StarCount int64 `json:"star_count"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentPaidMedia) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentPaidMedia + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentPaidMedia) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentPaidMedia) GetType() string { + return TypePushMessageContentPaidMedia +} + +func (*PushMessageContentPaidMedia) PushMessageContentType() string { + return TypePushMessageContentPaidMedia +} + // A photo message type PushMessageContentPhoto struct { meta @@ -33364,7 +51673,7 @@ func (*PushMessageContentPoll) PushMessageContentType() string { // A message with a Telegram Premium gift code created for the user type PushMessageContentPremiumGiftCode struct { meta - // Number of month the Telegram Premium subscription will be active after code activation + // Number of months the Telegram Premium subscription will be active after code activation MonthCount int32 `json:"month_count"` } @@ -33388,35 +51697,114 @@ func (*PushMessageContentPremiumGiftCode) PushMessageContentType() string { return TypePushMessageContentPremiumGiftCode } -// A message with a Telegram Premium giveaway -type PushMessageContentPremiumGiveaway struct { +// A message with a giveaway +type PushMessageContentGiveaway struct { meta - // Number of users which will receive Telegram Premium subscription gift codes; 0 for pinned message + // Number of users which will receive giveaway prizes; 0 for pinned message WinnerCount int32 `json:"winner_count"` - // Number of month the Telegram Premium subscription will be active after code activation; 0 for pinned message - MonthCount int32 `json:"month_count"` + // Prize of the giveaway; may be null for pinned message + Prize GiveawayPrize `json:"prize"` // True, if the message is a pinned message with the specified content IsPinned bool `json:"is_pinned"` } -func (entity *PushMessageContentPremiumGiveaway) MarshalJSON() ([]byte, error) { +func (entity *PushMessageContentGiveaway) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub PushMessageContentPremiumGiveaway + type stub PushMessageContentGiveaway return json.Marshal((*stub)(entity)) } -func (*PushMessageContentPremiumGiveaway) GetClass() string { +func (*PushMessageContentGiveaway) GetClass() string { return ClassPushMessageContent } -func (*PushMessageContentPremiumGiveaway) GetType() string { - return TypePushMessageContentPremiumGiveaway +func (*PushMessageContentGiveaway) GetType() string { + return TypePushMessageContentGiveaway } -func (*PushMessageContentPremiumGiveaway) PushMessageContentType() string { - return TypePushMessageContentPremiumGiveaway +func (*PushMessageContentGiveaway) PushMessageContentType() string { + return TypePushMessageContentGiveaway +} + +func (pushMessageContentGiveaway *PushMessageContentGiveaway) UnmarshalJSON(data []byte) error { + var tmp struct { + WinnerCount int32 `json:"winner_count"` + Prize json.RawMessage `json:"prize"` + IsPinned bool `json:"is_pinned"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pushMessageContentGiveaway.WinnerCount = tmp.WinnerCount + pushMessageContentGiveaway.IsPinned = tmp.IsPinned + + fieldPrize, _ := UnmarshalGiveawayPrize(tmp.Prize) + pushMessageContentGiveaway.Prize = fieldPrize + + return nil +} + +// A message with a gift +type PushMessageContentGift struct { + meta + // Number of Telegram Stars that sender paid for the gift + StarCount int64 `json:"star_count"` + // True, if the message is about prepaid upgrade of the gift by another user instead of actual receiving of a new gift + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` +} + +func (entity *PushMessageContentGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentGift + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentGift) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentGift) GetType() string { + return TypePushMessageContentGift +} + +func (*PushMessageContentGift) PushMessageContentType() string { + return TypePushMessageContentGift +} + +// A message with an upgraded gift +type PushMessageContentUpgradedGift struct { + meta + // True, if the gift was obtained by upgrading of a previously received gift; otherwise, if is_prepaid_upgrade == false, then this is a transferred or resold gift + IsUpgrade bool `json:"is_upgrade"` + // True, if the message is about completion of prepaid upgrade of the gift instead of actual receiving of a new gift + IsPrepaidUpgrade bool `json:"is_prepaid_upgrade"` +} + +func (entity *PushMessageContentUpgradedGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentUpgradedGift + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentUpgradedGift) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentUpgradedGift) GetType() string { + return TypePushMessageContentUpgradedGift +} + +func (*PushMessageContentUpgradedGift) PushMessageContentType() string { + return TypePushMessageContentUpgradedGift } // A screenshot of a message in the chat has been taken @@ -33478,6 +51866,8 @@ func (*PushMessageContentSticker) PushMessageContentType() string { // A message with a story type PushMessageContentStory struct { meta + // True, if the user was mentioned in the story + IsMention bool `json:"is_mention"` // True, if the message is a pinned message with the specified content IsPinned bool `json:"is_pinned"` } @@ -33531,6 +51921,35 @@ func (*PushMessageContentText) PushMessageContentType() string { return TypePushMessageContentText } +// A message with a checklist +type PushMessageContentChecklist struct { + meta + // Checklist title + Title string `json:"title"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentChecklist) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklist + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklist) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklist) GetType() string { + return TypePushMessageContentChecklist +} + +func (*PushMessageContentChecklist) PushMessageContentType() string { + return TypePushMessageContentChecklist +} + // A video message type PushMessageContentVideo struct { meta @@ -33647,6 +52066,83 @@ func (*PushMessageContentBasicGroupChatCreate) PushMessageContentType() string { return TypePushMessageContentBasicGroupChatCreate } +// A video chat or live stream was started +type PushMessageContentVideoChatStarted struct{ + meta +} + +func (entity *PushMessageContentVideoChatStarted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideoChatStarted + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideoChatStarted) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideoChatStarted) GetType() string { + return TypePushMessageContentVideoChatStarted +} + +func (*PushMessageContentVideoChatStarted) PushMessageContentType() string { + return TypePushMessageContentVideoChatStarted +} + +// A video chat or live stream has ended +type PushMessageContentVideoChatEnded struct{ + meta +} + +func (entity *PushMessageContentVideoChatEnded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideoChatEnded + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideoChatEnded) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideoChatEnded) GetType() string { + return TypePushMessageContentVideoChatEnded +} + +func (*PushMessageContentVideoChatEnded) PushMessageContentType() string { + return TypePushMessageContentVideoChatEnded +} + +// An invitation of participants to a video chat or live stream +type PushMessageContentInviteVideoChatParticipants struct { + meta + // True, if the current user was invited to the video chat or the live stream + IsCurrentUser bool `json:"is_current_user"` +} + +func (entity *PushMessageContentInviteVideoChatParticipants) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentInviteVideoChatParticipants + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentInviteVideoChatParticipants) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentInviteVideoChatParticipants) GetType() string { + return TypePushMessageContentInviteVideoChatParticipants +} + +func (*PushMessageContentInviteVideoChatParticipants) PushMessageContentType() string { + return TypePushMessageContentInviteVideoChatParticipants +} + // New chat members were invited to a group type PushMessageContentChatAddMembers struct { meta @@ -33760,8 +52256,8 @@ func (*PushMessageContentChatSetBackground) PushMessageContentType() string { // A chat theme was edited type PushMessageContentChatSetTheme struct { meta - // If non-empty, name of a new theme, set for the chat. Otherwise, the chat theme was reset to the default one - ThemeName string `json:"theme_name"` + // If non-empty, human-readable name of the new theme. Otherwise, the chat theme was reset to the default one + Name string `json:"name"` } func (entity *PushMessageContentChatSetTheme) MarshalJSON() ([]byte, error) { @@ -33917,6 +52413,112 @@ func (*PushMessageContentSuggestProfilePhoto) PushMessageContentType() string { return TypePushMessageContentSuggestProfilePhoto } +// A birthdate was suggested to be set +type PushMessageContentSuggestBirthdate struct{ + meta +} + +func (entity *PushMessageContentSuggestBirthdate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentSuggestBirthdate + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentSuggestBirthdate) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentSuggestBirthdate) GetType() string { + return TypePushMessageContentSuggestBirthdate +} + +func (*PushMessageContentSuggestBirthdate) PushMessageContentType() string { + return TypePushMessageContentSuggestBirthdate +} + +// A user in the chat came within proximity alert range from the current user +type PushMessageContentProximityAlertTriggered struct { + meta + // The distance to the user + Distance int32 `json:"distance"` +} + +func (entity *PushMessageContentProximityAlertTriggered) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentProximityAlertTriggered + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentProximityAlertTriggered) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentProximityAlertTriggered) GetType() string { + return TypePushMessageContentProximityAlertTriggered +} + +func (*PushMessageContentProximityAlertTriggered) PushMessageContentType() string { + return TypePushMessageContentProximityAlertTriggered +} + +// Some tasks were added to a checklist +type PushMessageContentChecklistTasksAdded struct { + meta + // Number of added tasks + TaskCount int32 `json:"task_count"` +} + +func (entity *PushMessageContentChecklistTasksAdded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklistTasksAdded + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklistTasksAdded) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklistTasksAdded) GetType() string { + return TypePushMessageContentChecklistTasksAdded +} + +func (*PushMessageContentChecklistTasksAdded) PushMessageContentType() string { + return TypePushMessageContentChecklistTasksAdded +} + +// Some tasks from a checklist were marked as done or not done +type PushMessageContentChecklistTasksDone struct { + meta + // Number of changed tasks + TaskCount int32 `json:"task_count"` +} + +func (entity *PushMessageContentChecklistTasksDone) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChecklistTasksDone + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChecklistTasksDone) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChecklistTasksDone) GetType() string { + return TypePushMessageContentChecklistTasksDone +} + +func (*PushMessageContentChecklistTasksDone) PushMessageContentType() string { + return TypePushMessageContentChecklistTasksDone +} + // A forwarded messages type PushMessageContentMessageForwards struct { meta @@ -34386,6 +52988,54 @@ func (notificationGroup *NotificationGroup) UnmarshalJSON(data []byte) error { return nil } +// Describes a proxy server +type Proxy struct { + meta + // Proxy server domain or IP address + Server string `json:"server"` + // Proxy server port + Port int32 `json:"port"` + // Type of the proxy + Type ProxyType `json:"type"` +} + +func (entity *Proxy) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Proxy + + return json.Marshal((*stub)(entity)) +} + +func (*Proxy) GetClass() string { + return ClassProxy +} + +func (*Proxy) GetType() string { + return TypeProxy +} + +func (proxy *Proxy) UnmarshalJSON(data []byte) error { + var tmp struct { + Server string `json:"server"` + Port int32 `json:"port"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + proxy.Server = tmp.Server + proxy.Port = tmp.Port + + fieldType, _ := UnmarshalProxyType(tmp.Type) + proxy.Type = fieldType + + return nil +} + // Represents a boolean option type OptionValueBoolean struct { meta @@ -34868,6 +53518,56 @@ func (*UserPrivacySettingRuleAllowContacts) UserPrivacySettingRuleType() string return TypeUserPrivacySettingRuleAllowContacts } +// A rule to allow all bots to do something +type UserPrivacySettingRuleAllowBots struct{ + meta +} + +func (entity *UserPrivacySettingRuleAllowBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleAllowBots + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleAllowBots) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleAllowBots) GetType() string { + return TypeUserPrivacySettingRuleAllowBots +} + +func (*UserPrivacySettingRuleAllowBots) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleAllowBots +} + +// A rule to allow all Premium Users to do something; currently, allowed only for userPrivacySettingAllowChatInvites +type UserPrivacySettingRuleAllowPremiumUsers struct{ + meta +} + +func (entity *UserPrivacySettingRuleAllowPremiumUsers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleAllowPremiumUsers + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleAllowPremiumUsers) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleAllowPremiumUsers) GetType() string { + return TypeUserPrivacySettingRuleAllowPremiumUsers +} + +func (*UserPrivacySettingRuleAllowPremiumUsers) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleAllowPremiumUsers +} + // A rule to allow certain specified users to do something type UserPrivacySettingRuleAllowUsers struct { meta @@ -34972,6 +53672,31 @@ func (*UserPrivacySettingRuleRestrictContacts) UserPrivacySettingRuleType() stri return TypeUserPrivacySettingRuleRestrictContacts } +// A rule to restrict all bots from doing something +type UserPrivacySettingRuleRestrictBots struct{ + meta +} + +func (entity *UserPrivacySettingRuleRestrictBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingRuleRestrictBots + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingRuleRestrictBots) GetClass() string { + return ClassUserPrivacySettingRule +} + +func (*UserPrivacySettingRuleRestrictBots) GetType() string { + return TypeUserPrivacySettingRuleRestrictBots +} + +func (*UserPrivacySettingRuleRestrictBots) UserPrivacySettingRuleType() string { + return TypeUserPrivacySettingRuleRestrictBots +} + // A rule to restrict all specified users from doing something type UserPrivacySettingRuleRestrictUsers struct { meta @@ -35190,6 +53915,56 @@ func (*UserPrivacySettingShowBio) UserPrivacySettingType() string { return TypeUserPrivacySettingShowBio } +// A privacy setting for managing whether the user's birthdate is visible +type UserPrivacySettingShowBirthdate struct{ + meta +} + +func (entity *UserPrivacySettingShowBirthdate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingShowBirthdate + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingShowBirthdate) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingShowBirthdate) GetType() string { + return TypeUserPrivacySettingShowBirthdate +} + +func (*UserPrivacySettingShowBirthdate) UserPrivacySettingType() string { + return TypeUserPrivacySettingShowBirthdate +} + +// A privacy setting for managing whether the user's profile audio files are visible +type UserPrivacySettingShowProfileAudio struct{ + meta +} + +func (entity *UserPrivacySettingShowProfileAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingShowProfileAudio + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingShowProfileAudio) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingShowProfileAudio) GetType() string { + return TypeUserPrivacySettingShowProfileAudio +} + +func (*UserPrivacySettingShowProfileAudio) UserPrivacySettingType() string { + return TypeUserPrivacySettingShowProfileAudio +} + // A privacy setting for managing whether the user can be invited to chats type UserPrivacySettingAllowChatInvites struct{ meta @@ -35290,7 +54065,7 @@ func (*UserPrivacySettingAllowFindingByPhoneNumber) UserPrivacySettingType() str return TypeUserPrivacySettingAllowFindingByPhoneNumber } -// A privacy setting for managing whether the user can receive voice and video messages in private chats +// A privacy setting for managing whether the user can receive voice and video messages in private chats; for Telegram Premium users only type UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages struct{ meta } @@ -35315,10 +54090,210 @@ func (*UserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages) UserPrivacySetti return TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages } +// A privacy setting for managing whether received gifts are automatically shown on the user's profile page +type UserPrivacySettingAutosaveGifts struct{ + meta +} + +func (entity *UserPrivacySettingAutosaveGifts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingAutosaveGifts + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingAutosaveGifts) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingAutosaveGifts) GetType() string { + return TypeUserPrivacySettingAutosaveGifts +} + +func (*UserPrivacySettingAutosaveGifts) UserPrivacySettingType() string { + return TypeUserPrivacySettingAutosaveGifts +} + +// A privacy setting for managing whether the user can receive messages without additional payment +type UserPrivacySettingAllowUnpaidMessages struct{ + meta +} + +func (entity *UserPrivacySettingAllowUnpaidMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingAllowUnpaidMessages + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingAllowUnpaidMessages) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingAllowUnpaidMessages) GetType() string { + return TypeUserPrivacySettingAllowUnpaidMessages +} + +func (*UserPrivacySettingAllowUnpaidMessages) UserPrivacySettingType() string { + return TypeUserPrivacySettingAllowUnpaidMessages +} + +// Contains privacy settings for message read date in private chats. Read dates are always shown to the users that can see online status of the current user regardless of this setting +type ReadDatePrivacySettings struct { + meta + // True, if message read date is shown to other users in private chats. If false and the current user isn't a Telegram Premium user, then they will not be able to see other's message read date + ShowReadDate bool `json:"show_read_date"` +} + +func (entity *ReadDatePrivacySettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReadDatePrivacySettings + + return json.Marshal((*stub)(entity)) +} + +func (*ReadDatePrivacySettings) GetClass() string { + return ClassReadDatePrivacySettings +} + +func (*ReadDatePrivacySettings) GetType() string { + return TypeReadDatePrivacySettings +} + +// Contains privacy settings for chats with non-contacts +type NewChatPrivacySettings struct { + meta + // True, if non-contacts users are able to write first to the current user. Telegram Premium subscribers are able to write first regardless of this setting + AllowNewChatsFromUnknownUsers bool `json:"allow_new_chats_from_unknown_users"` + // Number of Telegram Stars that must be paid for every incoming private message by non-contacts; 0-getOption("paid_message_star_count_max"). If positive, then allow_new_chats_from_unknown_users must be true. The current user will receive getOption("paid_message_earnings_per_mille") Telegram Stars for each 1000 Telegram Stars paid for message sending. Can be positive, only if getOption("can_enable_paid_messages") is true + IncomingPaidMessageStarCount int64 `json:"incoming_paid_message_star_count"` +} + +func (entity *NewChatPrivacySettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NewChatPrivacySettings + + return json.Marshal((*stub)(entity)) +} + +func (*NewChatPrivacySettings) GetClass() string { + return ClassNewChatPrivacySettings +} + +func (*NewChatPrivacySettings) GetType() string { + return TypeNewChatPrivacySettings +} + +// The user can be messaged +type CanSendMessageToUserResultOk struct{ + meta +} + +func (entity *CanSendMessageToUserResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendMessageToUserResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendMessageToUserResultOk) GetClass() string { + return ClassCanSendMessageToUserResult +} + +func (*CanSendMessageToUserResultOk) GetType() string { + return TypeCanSendMessageToUserResultOk +} + +func (*CanSendMessageToUserResultOk) CanSendMessageToUserResultType() string { + return TypeCanSendMessageToUserResultOk +} + +// The user can be messaged, but the messages are paid +type CanSendMessageToUserResultUserHasPaidMessages struct { + meta + // Number of Telegram Stars that must be paid by the current user for each sent message to the user + OutgoingPaidMessageStarCount int64 `json:"outgoing_paid_message_star_count"` +} + +func (entity *CanSendMessageToUserResultUserHasPaidMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendMessageToUserResultUserHasPaidMessages + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) GetClass() string { + return ClassCanSendMessageToUserResult +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) GetType() string { + return TypeCanSendMessageToUserResultUserHasPaidMessages +} + +func (*CanSendMessageToUserResultUserHasPaidMessages) CanSendMessageToUserResultType() string { + return TypeCanSendMessageToUserResultUserHasPaidMessages +} + +// The user can't be messaged, because they are deleted or unknown +type CanSendMessageToUserResultUserIsDeleted struct{ + meta +} + +func (entity *CanSendMessageToUserResultUserIsDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendMessageToUserResultUserIsDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendMessageToUserResultUserIsDeleted) GetClass() string { + return ClassCanSendMessageToUserResult +} + +func (*CanSendMessageToUserResultUserIsDeleted) GetType() string { + return TypeCanSendMessageToUserResultUserIsDeleted +} + +func (*CanSendMessageToUserResultUserIsDeleted) CanSendMessageToUserResultType() string { + return TypeCanSendMessageToUserResultUserIsDeleted +} + +// The user can't be messaged, because they restrict new chats with non-contacts +type CanSendMessageToUserResultUserRestrictsNewChats struct{ + meta +} + +func (entity *CanSendMessageToUserResultUserRestrictsNewChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub CanSendMessageToUserResultUserRestrictsNewChats + + return json.Marshal((*stub)(entity)) +} + +func (*CanSendMessageToUserResultUserRestrictsNewChats) GetClass() string { + return ClassCanSendMessageToUserResult +} + +func (*CanSendMessageToUserResultUserRestrictsNewChats) GetType() string { + return TypeCanSendMessageToUserResultUserRestrictsNewChats +} + +func (*CanSendMessageToUserResultUserRestrictsNewChats) CanSendMessageToUserResultType() string { + return TypeCanSendMessageToUserResultUserRestrictsNewChats +} + // Contains information about the period of inactivity after which the current user's account will automatically be deleted type AccountTtl struct { meta - // Number of days of inactivity before the account will be flagged for deletion; 30-366 days + // Number of days of inactivity before the account will be flagged for deletion; 30-730 days Days int32 `json:"days"` } @@ -36260,133 +55235,751 @@ func (*ReportReasonCustom) ReportReasonType() string { return TypeReportReasonCustom } -// The currently opened chat needs to be kept -type TargetChatCurrent struct{ +// The chat was reported successfully +type ReportChatResultOk struct{ meta } -func (entity *TargetChatCurrent) MarshalJSON() ([]byte, error) { +func (entity *ReportChatResultOk) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub TargetChatCurrent + type stub ReportChatResultOk return json.Marshal((*stub)(entity)) } -func (*TargetChatCurrent) GetClass() string { - return ClassTargetChat +func (*ReportChatResultOk) GetClass() string { + return ClassReportChatResult } -func (*TargetChatCurrent) GetType() string { - return TypeTargetChatCurrent +func (*ReportChatResultOk) GetType() string { + return TypeReportChatResultOk } -func (*TargetChatCurrent) TargetChatType() string { - return TypeTargetChatCurrent +func (*ReportChatResultOk) ReportChatResultType() string { + return TypeReportChatResultOk } -// The chat needs to be chosen by the user among chats of the specified types -type TargetChatChosen struct { +// The user must choose an option to report the chat and repeat request with the chosen option +type ReportChatResultOptionRequired struct { meta - // True, if private chats with ordinary users are allowed - AllowUserChats bool `json:"allow_user_chats"` - // True, if private chats with other bots are allowed - AllowBotChats bool `json:"allow_bot_chats"` - // True, if basic group and supergroup chats are allowed - AllowGroupChats bool `json:"allow_group_chats"` - // True, if channel chats are allowed - AllowChannelChats bool `json:"allow_channel_chats"` + // Title for the option choice + Title string `json:"title"` + // List of available options + Options []*ReportOption `json:"options"` } -func (entity *TargetChatChosen) MarshalJSON() ([]byte, error) { +func (entity *ReportChatResultOptionRequired) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub TargetChatChosen + type stub ReportChatResultOptionRequired return json.Marshal((*stub)(entity)) } -func (*TargetChatChosen) GetClass() string { - return ClassTargetChat +func (*ReportChatResultOptionRequired) GetClass() string { + return ClassReportChatResult } -func (*TargetChatChosen) GetType() string { - return TypeTargetChatChosen +func (*ReportChatResultOptionRequired) GetType() string { + return TypeReportChatResultOptionRequired } -func (*TargetChatChosen) TargetChatType() string { - return TypeTargetChatChosen +func (*ReportChatResultOptionRequired) ReportChatResultType() string { + return TypeReportChatResultOptionRequired } -// The chat needs to be open with the provided internal link -type TargetChatInternalLink struct { +// The user must add additional text details to the report +type ReportChatResultTextRequired struct { meta - // An internal link pointing to the chat - Link InternalLinkType `json:"link"` + // Option identifier for the next reportChat request + OptionId []byte `json:"option_id"` + // True, if the user can skip text adding + IsOptional bool `json:"is_optional"` } -func (entity *TargetChatInternalLink) MarshalJSON() ([]byte, error) { +func (entity *ReportChatResultTextRequired) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub TargetChatInternalLink + type stub ReportChatResultTextRequired return json.Marshal((*stub)(entity)) } -func (*TargetChatInternalLink) GetClass() string { - return ClassTargetChat +func (*ReportChatResultTextRequired) GetClass() string { + return ClassReportChatResult } -func (*TargetChatInternalLink) GetType() string { - return TypeTargetChatInternalLink +func (*ReportChatResultTextRequired) GetType() string { + return TypeReportChatResultTextRequired } -func (*TargetChatInternalLink) TargetChatType() string { - return TypeTargetChatInternalLink +func (*ReportChatResultTextRequired) ReportChatResultType() string { + return TypeReportChatResultTextRequired } -func (targetChatInternalLink *TargetChatInternalLink) UnmarshalJSON(data []byte) error { - var tmp struct { - Link json.RawMessage `json:"link"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) - targetChatInternalLink.Link = fieldLink - - return nil -} - -// The link is a link to the active sessions section of the application. Use getActiveSessions to handle the link -type InternalLinkTypeActiveSessions struct{ +// The user must choose messages to report and repeat the reportChat request with the chosen messages +type ReportChatResultMessagesRequired struct{ meta } -func (entity *InternalLinkTypeActiveSessions) MarshalJSON() ([]byte, error) { +func (entity *ReportChatResultMessagesRequired) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub InternalLinkTypeActiveSessions + type stub ReportChatResultMessagesRequired return json.Marshal((*stub)(entity)) } -func (*InternalLinkTypeActiveSessions) GetClass() string { - return ClassInternalLinkType +func (*ReportChatResultMessagesRequired) GetClass() string { + return ClassReportChatResult } -func (*InternalLinkTypeActiveSessions) GetType() string { - return TypeInternalLinkTypeActiveSessions +func (*ReportChatResultMessagesRequired) GetType() string { + return TypeReportChatResultMessagesRequired } -func (*InternalLinkTypeActiveSessions) InternalLinkTypeType() string { - return TypeInternalLinkTypeActiveSessions +func (*ReportChatResultMessagesRequired) ReportChatResultType() string { + return TypeReportChatResultMessagesRequired } -// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL +// The story was reported successfully +type ReportStoryResultOk struct{ + meta +} + +func (entity *ReportStoryResultOk) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportStoryResultOk + + return json.Marshal((*stub)(entity)) +} + +func (*ReportStoryResultOk) GetClass() string { + return ClassReportStoryResult +} + +func (*ReportStoryResultOk) GetType() string { + return TypeReportStoryResultOk +} + +func (*ReportStoryResultOk) ReportStoryResultType() string { + return TypeReportStoryResultOk +} + +// The user must choose an option to report the story and repeat request with the chosen option +type ReportStoryResultOptionRequired struct { + meta + // Title for the option choice + Title string `json:"title"` + // List of available options + Options []*ReportOption `json:"options"` +} + +func (entity *ReportStoryResultOptionRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportStoryResultOptionRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportStoryResultOptionRequired) GetClass() string { + return ClassReportStoryResult +} + +func (*ReportStoryResultOptionRequired) GetType() string { + return TypeReportStoryResultOptionRequired +} + +func (*ReportStoryResultOptionRequired) ReportStoryResultType() string { + return TypeReportStoryResultOptionRequired +} + +// The user must add additional text details to the report +type ReportStoryResultTextRequired struct { + meta + // Option identifier for the next reportStory request + OptionId []byte `json:"option_id"` + // True, if the user can skip text adding + IsOptional bool `json:"is_optional"` +} + +func (entity *ReportStoryResultTextRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ReportStoryResultTextRequired + + return json.Marshal((*stub)(entity)) +} + +func (*ReportStoryResultTextRequired) GetClass() string { + return ClassReportStoryResult +} + +func (*ReportStoryResultTextRequired) GetType() string { + return TypeReportStoryResultTextRequired +} + +func (*ReportStoryResultTextRequired) ReportStoryResultType() string { + return TypeReportStoryResultTextRequired +} + +// The appearance section +type SettingsSectionAppearance struct { + meta + // Subsection of the section; may be one of "", "themes", "themes/edit", "themes/create", "wallpapers", "wallpapers/edit", "wallpapers/set", "wallpapers/choose-photo", "your-color/profile", "your-color/profile/add-icons", "your-color/profile/use-gift", "your-color/profile/reset", "your-color/name", "your-color/name/add-icons", "your-color/name/use-gift", "night-mode", "auto-night-mode", "text-size", "text-size/use-system", "message-corners", "animations", "stickers-and-emoji", "stickers-and-emoji/edit", "stickers-and-emoji/trending", "stickers-and-emoji/archived", "stickers-and-emoji/archived/edit", "stickers-and-emoji/emoji", "stickers-and-emoji/emoji/edit", "stickers-and-emoji/emoji/archived", "stickers-and-emoji/emoji/archived/edit", "stickers-and-emoji/emoji/suggest", "stickers-and-emoji/emoji/quick-reaction", "stickers-and-emoji/emoji/quick-reaction/choose", "stickers-and-emoji/suggest-by-emoji", "stickers-and-emoji/large-emoji", "stickers-and-emoji/dynamic-order", "stickers-and-emoji/emoji/show-more", "app-icon", "tap-for-next-media" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionAppearance) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionAppearance + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionAppearance) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionAppearance) GetType() string { + return TypeSettingsSectionAppearance +} + +func (*SettingsSectionAppearance) SettingsSectionType() string { + return TypeSettingsSectionAppearance +} + +// The "Ask a question" section +type SettingsSectionAskQuestion struct{ + meta +} + +func (entity *SettingsSectionAskQuestion) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionAskQuestion + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionAskQuestion) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionAskQuestion) GetType() string { + return TypeSettingsSectionAskQuestion +} + +func (*SettingsSectionAskQuestion) SettingsSectionType() string { + return TypeSettingsSectionAskQuestion +} + +// The "Telegram Business" section +type SettingsSectionBusiness struct { + meta + // Subsection of the section; may be one of "", "do-not-hide-ads" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionBusiness) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionBusiness + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionBusiness) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionBusiness) GetType() string { + return TypeSettingsSectionBusiness +} + +func (*SettingsSectionBusiness) SettingsSectionType() string { + return TypeSettingsSectionBusiness +} + +// The chat folder settings section +type SettingsSectionChatFolders struct { + meta + // Subsection of the section; may be one of "", "edit", "create", "add-recommended", "show-tags", "tab-view" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionChatFolders) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionChatFolders + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionChatFolders) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionChatFolders) GetType() string { + return TypeSettingsSectionChatFolders +} + +func (*SettingsSectionChatFolders) SettingsSectionType() string { + return TypeSettingsSectionChatFolders +} + +// The data and storage settings section +type SettingsSectionDataAndStorage struct { + meta + // Subsection of the section; may be one of "", "storage", "storage/edit", "storage/auto-remove", "storage/clear-cache", "storage/max-cache", "usage", "usage/mobile", "usage/wifi", "usage/reset", "usage/roaming", "auto-download/mobile", "auto-download/mobile/enable", "auto-download/mobile/usage", "auto-download/mobile/photos", "auto-download/mobile/stories", "auto-download/mobile/videos", "auto-download/mobile/files", "auto-download/wifi", "auto-download/wifi/enable", "auto-download/wifi/usage", "auto-download/wifi/photos", "auto-download/wifi/stories", "auto-download/wifi/videos", "auto-download/wifi/files", "auto-download/roaming", "auto-download/roaming/enable", "auto-download/roaming/usage", "auto-download/roaming/photos", "auto-download/roaming/stories", "auto-download/roaming/videos", "auto-download/roaming/files", "auto-download/reset", "save-to-photos/chats", "save-to-photos/chats/max-video-size", "save-to-photos/chats/add-exception", "save-to-photos/chats/delete-all", "save-to-photos/groups", "save-to-photos/groups/max-video-size", "save-to-photos/groups/add-exception", "save-to-photos/groups/delete-all", "save-to-photos/channels", "save-to-photos/channels/max-video-size", "save-to-photos/channels/add-exception", "save-to-photos/channels/delete-all", "less-data-calls", "open-links", "share-sheet", "share-sheet/suggested-chats", "share-sheet/suggest-by", "share-sheet/reset", "saved-edited-photos", "pause-music", "raise-to-listen", "raise-to-speak", "show-18-content", "proxy", "proxy/edit", "proxy/use-proxy", "proxy/add-proxy", "proxy/share-list", "proxy/use-for-calls" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionDataAndStorage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionDataAndStorage + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionDataAndStorage) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionDataAndStorage) GetType() string { + return TypeSettingsSectionDataAndStorage +} + +func (*SettingsSectionDataAndStorage) SettingsSectionType() string { + return TypeSettingsSectionDataAndStorage +} + +// The Devices section +type SettingsSectionDevices struct { + meta + // Subsection of the section; may be one of "", "edit", "link-desktop", "terminate-sessions", "auto-terminate" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionDevices) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionDevices + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionDevices) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionDevices) GetType() string { + return TypeSettingsSectionDevices +} + +func (*SettingsSectionDevices) SettingsSectionType() string { + return TypeSettingsSectionDevices +} + +// The profile edit section +type SettingsSectionEditProfile struct { + meta + // Subsection of the section; may be one of "", "set-photo", "first-name", "last-name", "emoji-status", "bio", "birthday", "change-number", "username", "your-color", "channel", "add-account", "log-out", "profile-color/profile", "profile-color/profile/add-icons", "profile-color/profile/use-gift", "profile-color/name", "profile-color/name/add-icons", "profile-color/name/use-gift", "profile-photo/use-emoji" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionEditProfile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionEditProfile + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionEditProfile) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionEditProfile) GetType() string { + return TypeSettingsSectionEditProfile +} + +func (*SettingsSectionEditProfile) SettingsSectionType() string { + return TypeSettingsSectionEditProfile +} + +// The FAQ section +type SettingsSectionFaq struct{ + meta +} + +func (entity *SettingsSectionFaq) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionFaq + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionFaq) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionFaq) GetType() string { + return TypeSettingsSectionFaq +} + +func (*SettingsSectionFaq) SettingsSectionType() string { + return TypeSettingsSectionFaq +} + +// The "Telegram Features" section +type SettingsSectionFeatures struct{ + meta +} + +func (entity *SettingsSectionFeatures) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionFeatures + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionFeatures) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionFeatures) GetType() string { + return TypeSettingsSectionFeatures +} + +func (*SettingsSectionFeatures) SettingsSectionType() string { + return TypeSettingsSectionFeatures +} + +// The in-app browser settings section +type SettingsSectionInAppBrowser struct { + meta + // Subsection of the section; may be one of "", "enable-browser", "clear-cookies", "clear-cache", "history", "clear-history", "never-open", "clear-list", "search" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionInAppBrowser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionInAppBrowser + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionInAppBrowser) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionInAppBrowser) GetType() string { + return TypeSettingsSectionInAppBrowser +} + +func (*SettingsSectionInAppBrowser) SettingsSectionType() string { + return TypeSettingsSectionInAppBrowser +} + +// The application language section +type SettingsSectionLanguage struct { + meta + // Subsection of the section; may be one of "", "show-button" for Show Translate Button toggle, "translate-chats" for Translate Entire Chats toggle, "do-not-translate" - for Do Not Translate language list + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionLanguage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionLanguage + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionLanguage) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionLanguage) GetType() string { + return TypeSettingsSectionLanguage +} + +func (*SettingsSectionLanguage) SettingsSectionType() string { + return TypeSettingsSectionLanguage +} + +// The Telegram Star balance and transaction section +type SettingsSectionMyStars struct { + meta + // Subsection of the section; may be one of "", "top-up", "stats", "gift", "earn" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionMyStars) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionMyStars + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionMyStars) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionMyStars) GetType() string { + return TypeSettingsSectionMyStars +} + +func (*SettingsSectionMyStars) SettingsSectionType() string { + return TypeSettingsSectionMyStars +} + +// The Toncoin balance and transaction section +type SettingsSectionMyToncoins struct{ + meta +} + +func (entity *SettingsSectionMyToncoins) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionMyToncoins + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionMyToncoins) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionMyToncoins) GetType() string { + return TypeSettingsSectionMyToncoins +} + +func (*SettingsSectionMyToncoins) SettingsSectionType() string { + return TypeSettingsSectionMyToncoins +} + +// The notification settings section +type SettingsSectionNotifications struct { + meta + // Subsection of the section; may be one of "", "accounts", "private-chats", "private-chats/edit", "private-chats/show", "private-chats/preview", "private-chats/sound", "private-chats/add-exception", "private-chats/delete-exceptions", "private-chats/light-color", "private-chats/vibrate", "private-chats/priority", "groups", "groups/edit", "groups/show", "groups/preview", "groups/sound", "groups/add-exception", "groups/delete-exceptions", "groups/light-color", "groups/vibrate", "groups/priority", "channels", "channels/edit", "channels/show", "channels/preview", "channels/sound", "channels/add-exception", "channels/delete-exceptions", "channels/light-color", "channels/vibrate", "channels/priority", "stories", "stories/new", "stories/important", "stories/show-sender", "stories/sound", "stories/add-exception", "stories/delete-exceptions", "stories/light-color", "stories/vibrate", "stories/priority", "reactions", "reactions/messages", "reactions/stories", "reactions/show-sender", "reactions/sound", "reactions/light-color", "reactions/vibrate", "reactions/priority", "in-app-sounds", "in-app-vibrate", "in-app-preview", "in-chat-sounds", "in-app-popup", "lock-screen-names", "include-channels", "include-muted-chats", "count-unread-messages", "new-contacts", "pinned-messages", "reset", "web" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionNotifications) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionNotifications + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionNotifications) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionNotifications) GetType() string { + return TypeSettingsSectionNotifications +} + +func (*SettingsSectionNotifications) SettingsSectionType() string { + return TypeSettingsSectionNotifications +} + +// The power saving settings section +type SettingsSectionPowerSaving struct { + meta + // Subsection of the section; may be one of "", "videos", "gifs", "stickers", "emoji", "effects", "preload", "background", "call-animations", "particles", "transitions" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionPowerSaving) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionPowerSaving + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionPowerSaving) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionPowerSaving) GetType() string { + return TypeSettingsSectionPowerSaving +} + +func (*SettingsSectionPowerSaving) SettingsSectionType() string { + return TypeSettingsSectionPowerSaving +} + +// The "Telegram Premium" section +type SettingsSectionPremium struct{ + meta +} + +func (entity *SettingsSectionPremium) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionPremium + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionPremium) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionPremium) GetType() string { + return TypeSettingsSectionPremium +} + +func (*SettingsSectionPremium) SettingsSectionType() string { + return TypeSettingsSectionPremium +} + +// The privacy and security section +type SettingsSectionPrivacyAndSecurity struct { + meta + // Subsection of the section; may be one of "", "blocked", "blocked/edit", "blocked/block-user", "blocked/block-user/chats", "blocked/block-user/contacts", "active-websites", "active-websites/edit", "active-websites/disconnect-all", "passcode", "passcode/disable", "passcode/change", "passcode/auto-lock", "passcode/face-id", "passcode/fingerprint", "2sv", "2sv/change", "2sv/disable", "2sv/change-email", "passkey", "passkey/create", "auto-delete", "auto-delete/set-custom", "login-email", "phone-number", "phone-number/never", "phone-number/always", "last-seen", "last-seen/never", "last-seen/always", "last-seen/hide-read-time", "profile-photos", "profile-photos/never", "profile-photos/always", "profile-photos/set-public", "profile-photos/update-public", "profile-photos/remove-public", "bio", "bio/never", "bio/always", "gifts", "gifts/show-icon", "gifts/never", "gifts/always", "gifts/accepted-types", "birthday", "birthday/add", "birthday/never", "birthday/always", "saved-music", "saved-music/never", "saved-music/always", "forwards", "forwards/never", "forwards/always", "calls", "calls/never", "calls/always", "calls/p2p", "calls/p2p/never", "calls/p2p/always", "calls/ios-integration", "voice", "voice/never", "voice/always", "messages", "messages/set-price", "messages/exceptions", "invites", "invites/never", "invites/always", "self-destruct", "data-settings", "data-settings/sync-contacts", "data-settings/delete-synced", "data-settings/suggest-contacts", "data-settings/delete-cloud-drafts", "data-settings/clear-payment-info", "data-settings/link-previews", "data-settings/bot-settings", "data-settings/map-provider", "archive-and-mute" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionPrivacyAndSecurity) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionPrivacyAndSecurity + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionPrivacyAndSecurity) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionPrivacyAndSecurity) GetType() string { + return TypeSettingsSectionPrivacyAndSecurity +} + +func (*SettingsSectionPrivacyAndSecurity) SettingsSectionType() string { + return TypeSettingsSectionPrivacyAndSecurity +} + +// The "Privacy Policy" section +type SettingsSectionPrivacyPolicy struct{ + meta +} + +func (entity *SettingsSectionPrivacyPolicy) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionPrivacyPolicy + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionPrivacyPolicy) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionPrivacyPolicy) GetType() string { + return TypeSettingsSectionPrivacyPolicy +} + +func (*SettingsSectionPrivacyPolicy) SettingsSectionType() string { + return TypeSettingsSectionPrivacyPolicy +} + +// The current user's QR code section +type SettingsSectionQrCode struct { + meta + // Subsection of the section; may be one of "", "share", "scan" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionQrCode) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionQrCode + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionQrCode) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionQrCode) GetType() string { + return TypeSettingsSectionQrCode +} + +func (*SettingsSectionQrCode) SettingsSectionType() string { + return TypeSettingsSectionQrCode +} + +// Search in Settings +type SettingsSectionSearch struct{ + meta +} + +func (entity *SettingsSectionSearch) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionSearch + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionSearch) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionSearch) GetType() string { + return TypeSettingsSectionSearch +} + +func (*SettingsSectionSearch) SettingsSectionType() string { + return TypeSettingsSectionSearch +} + +// The "Send a gift" section +type SettingsSectionSendGift struct { + meta + // Subsection of the section; may be one of "", "self" + Subsection string `json:"subsection"` +} + +func (entity *SettingsSectionSendGift) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SettingsSectionSendGift + + return json.Marshal((*stub)(entity)) +} + +func (*SettingsSectionSendGift) GetClass() string { + return ClassSettingsSection +} + +func (*SettingsSectionSendGift) GetType() string { + return TypeSettingsSectionSendGift +} + +func (*SettingsSectionSendGift) SettingsSectionType() string { + return TypeSettingsSectionSendGift +} + +// The link is a link to an attachment menu bot to be opened in the specified or a chosen chat. Process given target_chat to open the chat. Then, call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to attachment menu, then show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the attachment menu bot can't be used in the opened chat, show an error to the user. If the bot is added to attachment menu and can be used in the chat, then use openWebApp with the given URL type InternalLinkTypeAttachmentMenuBot struct { meta // Target chat to be opened @@ -36465,7 +56058,7 @@ func (*InternalLinkTypeAuthenticationCode) InternalLinkTypeType() string { return TypeInternalLinkTypeAuthenticationCode } -// The link is a link to a background. Call searchBackground with the given background name to process the link +// The link is a link to a background. Call searchBackground with the given background name to process the link. If background is found and the user wants to apply it, then call setDefaultBackground type InternalLinkTypeBackground struct { meta // Name of the background @@ -36492,7 +56085,7 @@ func (*InternalLinkTypeBackground) InternalLinkTypeType() string { return TypeInternalLinkTypeBackground } -// The link is a link to a Telegram bot, which is supposed to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, ask the current user to select a channel chat to add the bot to as an administrator. Then, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights +// The link is a link to a Telegram bot, which is expected to be added to a channel chat as an administrator. Call searchPublicChat with the given bot username and check that the user is a bot, ask the current user to select a channel chat to add the bot to as an administrator. Then, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights and combine received rights with the requested administrator rights. Then, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed rights type InternalLinkTypeBotAddToChannel struct { meta // Username of the bot @@ -36552,7 +56145,7 @@ func (*InternalLinkTypeBotStart) InternalLinkTypeType() string { return TypeInternalLinkTypeBotStart } -// The link is a link to a Telegram bot, which is supposed to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat. +// The link is a link to a Telegram bot, which is expected to be added to a group chat. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to groups, ask the current user to select a basic group or a supergroup chat to add the bot to, taking into account that bots can be added to a public supergroup only by administrators of the supergroup. If administrator rights are provided by the link, call getChatMember to receive the current bot rights in the chat and if the bot already is an administrator, check that the current user can edit its administrator rights, combine received rights with the requested administrator rights, show confirmation box to the user, and call setChatMemberStatus with the chosen chat and confirmed administrator rights. Before call to setChatMemberStatus it may be required to upgrade the chosen basic group chat to a supergroup chat. Then, if start_parameter isn't empty, call sendBotStartMessage with the given start parameter and the chosen chat; otherwise, just send /start message with bot's username added to the chat type InternalLinkTypeBotStartInGroup struct { meta // Username of the bot @@ -36583,29 +56176,87 @@ func (*InternalLinkTypeBotStartInGroup) InternalLinkTypeType() string { return TypeInternalLinkTypeBotStartInGroup } -// The link is a link to the change phone number section of the app -type InternalLinkTypeChangePhoneNumber struct{ +// The link is a link to a business chat. Use getBusinessChatLinkInfo with the provided link name to get information about the link, then open received private chat and replace chat draft with the provided text +type InternalLinkTypeBusinessChat struct { meta + // Name of the link + LinkName string `json:"link_name"` } -func (entity *InternalLinkTypeChangePhoneNumber) MarshalJSON() ([]byte, error) { +func (entity *InternalLinkTypeBusinessChat) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub InternalLinkTypeChangePhoneNumber + type stub InternalLinkTypeBusinessChat return json.Marshal((*stub)(entity)) } -func (*InternalLinkTypeChangePhoneNumber) GetClass() string { +func (*InternalLinkTypeBusinessChat) GetClass() string { return ClassInternalLinkType } -func (*InternalLinkTypeChangePhoneNumber) GetType() string { - return TypeInternalLinkTypeChangePhoneNumber +func (*InternalLinkTypeBusinessChat) GetType() string { + return TypeInternalLinkTypeBusinessChat } -func (*InternalLinkTypeChangePhoneNumber) InternalLinkTypeType() string { - return TypeInternalLinkTypeChangePhoneNumber +func (*InternalLinkTypeBusinessChat) InternalLinkTypeType() string { + return TypeInternalLinkTypeBusinessChat +} + +// The link is a link to the Call tab or page +type InternalLinkTypeCallsPage struct { + meta + // Section of the page; may be one of "", "all", "missed", "edit", "show-tab", "start-call" + Section string `json:"section"` +} + +func (entity *InternalLinkTypeCallsPage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeCallsPage + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeCallsPage) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeCallsPage) GetType() string { + return TypeInternalLinkTypeCallsPage +} + +func (*InternalLinkTypeCallsPage) InternalLinkTypeType() string { + return TypeInternalLinkTypeCallsPage +} + +// 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 @@ -36635,7 +56286,7 @@ func (*InternalLinkTypeChatBoost) InternalLinkTypeType() string { return TypeInternalLinkTypeChatBoost } -// The link is an invite link to a chat folder. Call checkChatFolderInviteLink with the given invite link to process the link +// The link is an invite link to a chat folder. Call checkChatFolderInviteLink with the given invite link to process the link. If the link is valid and the user wants to join the chat folder, then call addChatFolderByInviteLink type InternalLinkTypeChatFolderInvite struct { meta // Internal representation of the invite link @@ -36662,32 +56313,7 @@ func (*InternalLinkTypeChatFolderInvite) InternalLinkTypeType() string { return TypeInternalLinkTypeChatFolderInvite } -// The link is a link to the folder section of the app settings -type InternalLinkTypeChatFolderSettings struct{ - meta -} - -func (entity *InternalLinkTypeChatFolderSettings) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InternalLinkTypeChatFolderSettings - - return json.Marshal((*stub)(entity)) -} - -func (*InternalLinkTypeChatFolderSettings) GetClass() string { - return ClassInternalLinkType -} - -func (*InternalLinkTypeChatFolderSettings) GetType() string { - return TypeInternalLinkTypeChatFolderSettings -} - -func (*InternalLinkTypeChatFolderSettings) InternalLinkTypeType() string { - return TypeInternalLinkTypeChatFolderSettings -} - -// The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link +// The link is a chat invite link. Call checkChatInviteLink with the given invite link to process the link. If the link is valid and the user wants to join the chat, then call joinChatByInviteLink type InternalLinkTypeChatInvite struct { meta // Internal representation of the invite link @@ -36714,54 +56340,83 @@ func (*InternalLinkTypeChatInvite) InternalLinkTypeType() string { return TypeInternalLinkTypeChatInvite } -// The link is a link to the default message auto-delete timer settings section of the app settings -type InternalLinkTypeDefaultMessageAutoDeleteTimerSettings struct{ +// The link is a link that allows to select some chats +type InternalLinkTypeChatSelection struct{ meta } -func (entity *InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) MarshalJSON() ([]byte, error) { +func (entity *InternalLinkTypeChatSelection) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub InternalLinkTypeDefaultMessageAutoDeleteTimerSettings + type stub InternalLinkTypeChatSelection return json.Marshal((*stub)(entity)) } -func (*InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) GetClass() string { +func (*InternalLinkTypeChatSelection) GetClass() string { return ClassInternalLinkType } -func (*InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) GetType() string { - return TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings +func (*InternalLinkTypeChatSelection) GetType() string { + return TypeInternalLinkTypeChatSelection } -func (*InternalLinkTypeDefaultMessageAutoDeleteTimerSettings) InternalLinkTypeType() string { - return TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings +func (*InternalLinkTypeChatSelection) InternalLinkTypeType() string { + return TypeInternalLinkTypeChatSelection } -// The link is a link to the edit profile section of the app settings -type InternalLinkTypeEditProfileSettings struct{ +// The link is a link to the Contacts tab or page +type InternalLinkTypeContactsPage struct { meta + // Section of the page; may be one of "", "search", "sort", "new", "invite", "manage" + Section string `json:"section"` } -func (entity *InternalLinkTypeEditProfileSettings) MarshalJSON() ([]byte, error) { +func (entity *InternalLinkTypeContactsPage) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub InternalLinkTypeEditProfileSettings + type stub InternalLinkTypeContactsPage return json.Marshal((*stub)(entity)) } -func (*InternalLinkTypeEditProfileSettings) GetClass() string { +func (*InternalLinkTypeContactsPage) GetClass() string { return ClassInternalLinkType } -func (*InternalLinkTypeEditProfileSettings) GetType() string { - return TypeInternalLinkTypeEditProfileSettings +func (*InternalLinkTypeContactsPage) GetType() string { + return TypeInternalLinkTypeContactsPage } -func (*InternalLinkTypeEditProfileSettings) InternalLinkTypeType() string { - return TypeInternalLinkTypeEditProfileSettings +func (*InternalLinkTypeContactsPage) InternalLinkTypeType() string { + return TypeInternalLinkTypeContactsPage +} + +// The link is a link to a channel direct messages chat by username of the channel. Call searchPublicChat with the given chat username to process the link. If the chat is found and is channel, open the direct messages chat of the channel +type InternalLinkTypeDirectMessagesChat struct { + meta + // Username of the channel + ChannelUsername string `json:"channel_username"` +} + +func (entity *InternalLinkTypeDirectMessagesChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeDirectMessagesChat + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeDirectMessagesChat) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeDirectMessagesChat) GetType() string { + return TypeInternalLinkTypeDirectMessagesChat +} + +func (*InternalLinkTypeDirectMessagesChat) InternalLinkTypeType() string { + return TypeInternalLinkTypeDirectMessagesChat } // The link is a link to a game. Call searchPublicChat with the given bot username, check that the user is a bot, ask the current user to select a chat to send the game, and then call sendMessage with inputMessageGame @@ -36793,7 +56448,90 @@ func (*InternalLinkTypeGame) InternalLinkTypeType() string { return TypeInternalLinkTypeGame } -// The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link +// The link is a link to a gift auction. Call getGiftAuctionState with the given auction identifier to process the link +type InternalLinkTypeGiftAuction struct { + meta + // Unique identifier of the auction + AuctionId string `json:"auction_id"` +} + +func (entity *InternalLinkTypeGiftAuction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeGiftAuction + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeGiftAuction) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeGiftAuction) GetType() string { + return TypeInternalLinkTypeGiftAuction +} + +func (*InternalLinkTypeGiftAuction) InternalLinkTypeType() string { + return TypeInternalLinkTypeGiftAuction +} + +// The link is a link to a gift collection. Call searchPublicChat with the given username, then call getReceivedGifts with the received gift owner identifier and the given collection identifier, then show the collection if received +type InternalLinkTypeGiftCollection struct { + meta + // Username of the owner of the gift collection + GiftOwnerUsername string `json:"gift_owner_username"` + // Gift collection identifier + CollectionId int32 `json:"collection_id"` +} + +func (entity *InternalLinkTypeGiftCollection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeGiftCollection + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeGiftCollection) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeGiftCollection) GetType() string { + return TypeInternalLinkTypeGiftCollection +} + +func (*InternalLinkTypeGiftCollection) InternalLinkTypeType() string { + return TypeInternalLinkTypeGiftCollection +} + +// The link is a link to a group call that isn't bound to a chat. Use getGroupCallParticipants to get the list of group call participants and show them on the join group call screen. Call joinGroupCall with the given invite_link to join the call +type InternalLinkTypeGroupCall struct { + meta + // Internal representation of the invite link + InviteLink string `json:"invite_link"` +} + +func (entity *InternalLinkTypeGroupCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeGroupCall + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeGroupCall) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeGroupCall) GetType() string { + return TypeInternalLinkTypeGroupCall +} + +func (*InternalLinkTypeGroupCall) InternalLinkTypeType() string { + return TypeInternalLinkTypeGroupCall +} + +// The link must be opened in an Instant View. Call getWebPageInstantView with the given URL to process the link. If Instant View is found, then show it, otherwise, open the fallback URL in an external browser type InternalLinkTypeInstantView struct { meta // URL to be passed to getWebPageInstantView @@ -36849,7 +56587,7 @@ func (*InternalLinkTypeInvoice) InternalLinkTypeType() string { return TypeInternalLinkTypeInvoice } -// The link is a link to a language pack. Call getLanguagePackInfo with the given language pack identifier to process the link +// The link is a link to a language pack. Call getLanguagePackInfo with the given language pack identifier to process the link. If the language pack is found and the user wants to apply it, then call setOption for the option "language_pack_id" type InternalLinkTypeLanguagePack struct { meta // Language pack identifier @@ -36876,32 +56614,86 @@ func (*InternalLinkTypeLanguagePack) InternalLinkTypeType() string { return TypeInternalLinkTypeLanguagePack } -// The link is a link to the language section of the app settings -type InternalLinkTypeLanguageSettings struct{ +// The link is a link to a live story. Call searchPublicChat with the given chat username, then getChatActiveStories to get active stories in the chat, then find a live story among active stories of the chat, and then joinLiveStory to join the live story +type InternalLinkTypeLiveStory struct { meta + // Username of the poster of the story + StoryPosterUsername string `json:"story_poster_username"` } -func (entity *InternalLinkTypeLanguageSettings) MarshalJSON() ([]byte, error) { +func (entity *InternalLinkTypeLiveStory) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub InternalLinkTypeLanguageSettings + type stub InternalLinkTypeLiveStory return json.Marshal((*stub)(entity)) } -func (*InternalLinkTypeLanguageSettings) GetClass() string { +func (*InternalLinkTypeLiveStory) GetClass() string { return ClassInternalLinkType } -func (*InternalLinkTypeLanguageSettings) GetType() string { - return TypeInternalLinkTypeLanguageSettings +func (*InternalLinkTypeLiveStory) GetType() string { + return TypeInternalLinkTypeLiveStory } -func (*InternalLinkTypeLanguageSettings) InternalLinkTypeType() string { - return TypeInternalLinkTypeLanguageSettings +func (*InternalLinkTypeLiveStory) InternalLinkTypeType() string { + return TypeInternalLinkTypeLiveStory } -// The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link +// The link is a link to the main Web App of a bot. Call searchPublicChat with the given bot username, check that the user is a bot and has the main Web App. If the bot can be added to attachment menu, then use getAttachmentMenuBot to receive information about the bot, then if the bot isn't added to side menu, show a disclaimer about Mini Apps being third-party applications, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu, then if the user accepts the terms and confirms adding, use toggleBotIsAddedToAttachmentMenu to add the bot. Then, use getMainWebApp with the given start parameter and mode and open the returned URL as a Web App +type InternalLinkTypeMainWebApp struct { + meta + // Username of the bot + BotUsername string `json:"bot_username"` + // Start parameter to be passed to getMainWebApp + StartParameter string `json:"start_parameter"` + // The mode to be passed to getMainWebApp + Mode WebAppOpenMode `json:"mode"` +} + +func (entity *InternalLinkTypeMainWebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeMainWebApp + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeMainWebApp) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeMainWebApp) GetType() string { + return TypeInternalLinkTypeMainWebApp +} + +func (*InternalLinkTypeMainWebApp) InternalLinkTypeType() string { + return TypeInternalLinkTypeMainWebApp +} + +func (internalLinkTypeMainWebApp *InternalLinkTypeMainWebApp) UnmarshalJSON(data []byte) error { + var tmp struct { + BotUsername string `json:"bot_username"` + StartParameter string `json:"start_parameter"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + internalLinkTypeMainWebApp.BotUsername = tmp.BotUsername + internalLinkTypeMainWebApp.StartParameter = tmp.StartParameter + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + internalLinkTypeMainWebApp.Mode = fieldMode + + return nil +} + +// The link is a link to a Telegram message or a forum topic. Call getMessageLinkInfo with the given URL to process the link, and then open received forum topic or chat and show the message there type InternalLinkTypeMessage struct { meta // URL to be passed to getMessageLinkInfo @@ -36957,10 +56749,155 @@ func (*InternalLinkTypeMessageDraft) InternalLinkTypeType() string { return TypeInternalLinkTypeMessageDraft } +// The link is a link to the My Profile application page +type InternalLinkTypeMyProfilePage struct { + meta + // Section of the page; may be one of "", "posts", "posts/all-stories", "posts/add-album", "gifts", "archived-posts" + Section string `json:"section"` +} + +func (entity *InternalLinkTypeMyProfilePage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeMyProfilePage + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeMyProfilePage) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeMyProfilePage) GetType() string { + return TypeInternalLinkTypeMyProfilePage +} + +func (*InternalLinkTypeMyProfilePage) InternalLinkTypeType() string { + return TypeInternalLinkTypeMyProfilePage +} + +// The link is a link to the screen for creating a new channel chat +type InternalLinkTypeNewChannelChat struct{ + meta +} + +func (entity *InternalLinkTypeNewChannelChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeNewChannelChat + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeNewChannelChat) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeNewChannelChat) GetType() string { + return TypeInternalLinkTypeNewChannelChat +} + +func (*InternalLinkTypeNewChannelChat) InternalLinkTypeType() string { + return TypeInternalLinkTypeNewChannelChat +} + +// The link is a link to the screen for creating a new group chat +type InternalLinkTypeNewGroupChat struct{ + meta +} + +func (entity *InternalLinkTypeNewGroupChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeNewGroupChat + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeNewGroupChat) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeNewGroupChat) GetType() string { + return TypeInternalLinkTypeNewGroupChat +} + +func (*InternalLinkTypeNewGroupChat) InternalLinkTypeType() string { + return TypeInternalLinkTypeNewGroupChat +} + +// The link is a link to the screen for creating a new private chat with a contact +type InternalLinkTypeNewPrivateChat struct{ + meta +} + +func (entity *InternalLinkTypeNewPrivateChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeNewPrivateChat + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeNewPrivateChat) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeNewPrivateChat) GetType() string { + return TypeInternalLinkTypeNewPrivateChat +} + +func (*InternalLinkTypeNewPrivateChat) InternalLinkTypeType() string { + return TypeInternalLinkTypeNewPrivateChat +} + +// The link is a link to open the story posting interface +type InternalLinkTypeNewStory struct { + meta + // The type of the content of the story to post; may be null if unspecified + ContentType StoryContentType `json:"content_type"` +} + +func (entity *InternalLinkTypeNewStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeNewStory + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeNewStory) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeNewStory) GetType() string { + return TypeInternalLinkTypeNewStory +} + +func (*InternalLinkTypeNewStory) InternalLinkTypeType() string { + return TypeInternalLinkTypeNewStory +} + +func (internalLinkTypeNewStory *InternalLinkTypeNewStory) UnmarshalJSON(data []byte) error { + var tmp struct { + ContentType json.RawMessage `json:"content_type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldContentType, _ := UnmarshalStoryContentType(tmp.ContentType) + internalLinkTypeNewStory.ContentType = fieldContentType + + return nil +} + // The link contains a request of Telegram passport data. Call getPassportAuthorizationForm with the given parameters to process the link if the link was received from outside of the application; otherwise, ignore it type InternalLinkTypePassportDataRequest struct { meta - // User identifier of the service's bot + // User identifier of the service's bot; the corresponding user may be unknown yet BotUserId int64 `json:"bot_user_id"` // Telegram Passport element types requested by the service Scope string `json:"scope"` @@ -36992,7 +56929,7 @@ func (*InternalLinkTypePassportDataRequest) InternalLinkTypeType() string { return TypeInternalLinkTypePassportDataRequest } -// The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberConfirmationCode with the given hash and phone number to process the link +// The link can be used to confirm ownership of a phone number to prevent account deletion. Call sendPhoneNumberCode with the given phone number and with phoneNumberCodeTypeConfirmOwnership with the given hash to process the link. If succeeded, call checkPhoneNumberCode to check entered by the user code, or resendPhoneNumberCode to resend it type InternalLinkTypePhoneNumberConfirmation struct { meta // Hash value from the link @@ -37022,30 +56959,30 @@ func (*InternalLinkTypePhoneNumberConfirmation) InternalLinkTypeType() string { } // The link is a link to the Premium features screen of the application from which the user can subscribe to Telegram Premium. Call getPremiumFeatures with the given referrer to process the link -type InternalLinkTypePremiumFeatures struct { +type InternalLinkTypePremiumFeaturesPage struct { meta // Referrer specified in the link Referrer string `json:"referrer"` } -func (entity *InternalLinkTypePremiumFeatures) MarshalJSON() ([]byte, error) { +func (entity *InternalLinkTypePremiumFeaturesPage) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub InternalLinkTypePremiumFeatures + type stub InternalLinkTypePremiumFeaturesPage return json.Marshal((*stub)(entity)) } -func (*InternalLinkTypePremiumFeatures) GetClass() string { +func (*InternalLinkTypePremiumFeaturesPage) GetClass() string { return ClassInternalLinkType } -func (*InternalLinkTypePremiumFeatures) GetType() string { - return TypeInternalLinkTypePremiumFeatures +func (*InternalLinkTypePremiumFeaturesPage) GetType() string { + return TypeInternalLinkTypePremiumFeaturesPage } -func (*InternalLinkTypePremiumFeatures) InternalLinkTypeType() string { - return TypeInternalLinkTypePremiumFeatures +func (*InternalLinkTypePremiumFeaturesPage) InternalLinkTypeType() string { + return TypeInternalLinkTypePremiumFeaturesPage } // The link is a link with a Telegram Premium gift code. Call checkPremiumGiftCode with the given code to process the link. If the code is valid and the user wants to apply it, then call applyPremiumGiftCode @@ -37075,40 +57012,38 @@ func (*InternalLinkTypePremiumGiftCode) InternalLinkTypeType() string { return TypeInternalLinkTypePremiumGiftCode } -// The link is a link to the privacy and security section of the app settings -type InternalLinkTypePrivacyAndSecuritySettings struct{ +// The link is a link to the screen for gifting Telegram Premium subscriptions to friends via inputInvoiceTelegram with telegramPaymentPurposePremiumGift payments or in-store purchases +type InternalLinkTypePremiumGiftPurchase struct { meta + // Referrer specified in the link + Referrer string `json:"referrer"` } -func (entity *InternalLinkTypePrivacyAndSecuritySettings) MarshalJSON() ([]byte, error) { +func (entity *InternalLinkTypePremiumGiftPurchase) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub InternalLinkTypePrivacyAndSecuritySettings + type stub InternalLinkTypePremiumGiftPurchase return json.Marshal((*stub)(entity)) } -func (*InternalLinkTypePrivacyAndSecuritySettings) GetClass() string { +func (*InternalLinkTypePremiumGiftPurchase) GetClass() string { return ClassInternalLinkType } -func (*InternalLinkTypePrivacyAndSecuritySettings) GetType() string { - return TypeInternalLinkTypePrivacyAndSecuritySettings +func (*InternalLinkTypePremiumGiftPurchase) GetType() string { + return TypeInternalLinkTypePremiumGiftPurchase } -func (*InternalLinkTypePrivacyAndSecuritySettings) InternalLinkTypeType() string { - return TypeInternalLinkTypePrivacyAndSecuritySettings +func (*InternalLinkTypePremiumGiftPurchase) InternalLinkTypeType() string { + return TypeInternalLinkTypePremiumGiftPurchase } // The link is a link to a proxy. Call addProxy with the given parameters to process the link and add the proxy type InternalLinkTypeProxy struct { meta - // Proxy server domain or IP address - Server string `json:"server"` - // Proxy server port - Port int32 `json:"port"` - // Type of the proxy - Type ProxyType `json:"type"` + // The proxy; may be null if the proxy is unsupported, in which case an alert can be shown to the user + Proxy *Proxy `json:"proxy"` } func (entity *InternalLinkTypeProxy) MarshalJSON() ([]byte, error) { @@ -37131,32 +57066,15 @@ func (*InternalLinkTypeProxy) InternalLinkTypeType() string { return TypeInternalLinkTypeProxy } -func (internalLinkTypeProxy *InternalLinkTypeProxy) UnmarshalJSON(data []byte) error { - var tmp struct { - Server string `json:"server"` - Port int32 `json:"port"` - Type json.RawMessage `json:"type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - internalLinkTypeProxy.Server = tmp.Server - internalLinkTypeProxy.Port = tmp.Port - - fieldType, _ := UnmarshalProxyType(tmp.Type) - internalLinkTypeProxy.Type = fieldType - - return nil -} - -// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link +// The link is a link to a chat by its username. Call searchPublicChat with the given chat username to process the link. If the chat is found, open its profile information screen or the chat itself. If draft text isn't empty and the chat is a private chat with a regular user, then put the draft text in the input field type InternalLinkTypePublicChat struct { meta // Username of the chat ChatUsername string `json:"chat_username"` + // Draft text for message to send in the chat + DraftText string `json:"draft_text"` + // True, if chat profile information screen must be opened; otherwise, the chat itself must be opened + OpenProfile bool `json:"open_profile"` } func (entity *InternalLinkTypePublicChat) MarshalJSON() ([]byte, error) { @@ -37229,11 +57147,63 @@ func (*InternalLinkTypeRestorePurchases) InternalLinkTypeType() string { return TypeInternalLinkTypeRestorePurchases } -// The link is a link to application settings -type InternalLinkTypeSettings struct{ +// The link is a link to the Saved Messages chat. Call createPrivateChat with getOption("my_id") and open the chat +type InternalLinkTypeSavedMessages struct{ meta } +func (entity *InternalLinkTypeSavedMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeSavedMessages + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeSavedMessages) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeSavedMessages) GetType() string { + return TypeInternalLinkTypeSavedMessages +} + +func (*InternalLinkTypeSavedMessages) InternalLinkTypeType() string { + return TypeInternalLinkTypeSavedMessages +} + +// The link is a link to the global chat and messages search field +type InternalLinkTypeSearch struct{ + meta +} + +func (entity *InternalLinkTypeSearch) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeSearch + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeSearch) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeSearch) GetType() string { + return TypeInternalLinkTypeSearch +} + +func (*InternalLinkTypeSearch) InternalLinkTypeType() string { + return TypeInternalLinkTypeSearch +} + +// The link is a link to application settings +type InternalLinkTypeSettings struct { + meta + // Section of the application settings to open; may be null if none + Section SettingsSection `json:"section"` +} + func (entity *InternalLinkTypeSettings) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() @@ -37254,36 +57224,52 @@ func (*InternalLinkTypeSettings) InternalLinkTypeType() string { return TypeInternalLinkTypeSettings } -// The link is a link to a bot, which can be installed to the side menu. Call searchPublicChat with the given bot username, check that the user is a bot and can be added to attachment menu. Then, use getAttachmentMenuBot to receive information about the bot. If the bot isn't added to side menu, then show a disclaimer about Mini Apps being a third-party apps, ask the user to accept their Terms of service and confirm adding the bot to side and attachment menu. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. If the bot is added to side menu, then use getWebAppUrl with the given URL -type InternalLinkTypeSideMenuBot struct { - meta - // Username of the bot - BotUsername string `json:"bot_username"` - // URL to be passed to getWebAppUrl - Url string `json:"url"` +func (internalLinkTypeSettings *InternalLinkTypeSettings) UnmarshalJSON(data []byte) error { + var tmp struct { + Section json.RawMessage `json:"section"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldSection, _ := UnmarshalSettingsSection(tmp.Section) + internalLinkTypeSettings.Section = fieldSection + + return nil } -func (entity *InternalLinkTypeSideMenuBot) MarshalJSON() ([]byte, error) { +// The link is a link to the Telegram Star purchase section of the application +type InternalLinkTypeStarPurchase struct { + meta + // The number of Telegram Stars that must be owned by the user + StarCount int64 `json:"star_count"` + // Purpose of Telegram Star purchase. Arbitrary string specified by the server, for example, "subs" if the Telegram Stars are required to extend channel subscriptions + Purpose string `json:"purpose"` +} + +func (entity *InternalLinkTypeStarPurchase) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub InternalLinkTypeSideMenuBot + type stub InternalLinkTypeStarPurchase return json.Marshal((*stub)(entity)) } -func (*InternalLinkTypeSideMenuBot) GetClass() string { +func (*InternalLinkTypeStarPurchase) GetClass() string { return ClassInternalLinkType } -func (*InternalLinkTypeSideMenuBot) GetType() string { - return TypeInternalLinkTypeSideMenuBot +func (*InternalLinkTypeStarPurchase) GetType() string { + return TypeInternalLinkTypeStarPurchase } -func (*InternalLinkTypeSideMenuBot) InternalLinkTypeType() string { - return TypeInternalLinkTypeSideMenuBot +func (*InternalLinkTypeStarPurchase) InternalLinkTypeType() string { + return TypeInternalLinkTypeStarPurchase } -// The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set +// The link is a link to a sticker set. Call searchStickerSet with the given sticker set name to process the link and show the sticker set. If the sticker set is found and the user wants to add it, then call changeStickerSet type InternalLinkTypeStickerSet struct { meta // Name of the sticker set @@ -37312,11 +57298,11 @@ func (*InternalLinkTypeStickerSet) InternalLinkTypeType() string { return TypeInternalLinkTypeStickerSet } -// The link is a link to a story. Call searchPublicChat with the given sender username, then call getStory with the received chat identifier and the given story identifier +// The link is a link to a story. Call searchPublicChat with the given poster username, then call getStory with the received chat identifier and the given story identifier, then show the story if received type InternalLinkTypeStory struct { meta - // Username of the sender of the story - StorySenderUsername string `json:"story_sender_username"` + // Username of the poster of the story + StoryPosterUsername string `json:"story_poster_username"` // Story identifier StoryId int32 `json:"story_id"` } @@ -37341,7 +57327,36 @@ func (*InternalLinkTypeStory) InternalLinkTypeType() string { return TypeInternalLinkTypeStory } -// The link is a link to a theme. TDLib has no theme support yet +// The link is a link to an album of stories. Call searchPublicChat with the given username, then call getStoryAlbumStories with the received chat identifier and the given story album identifier, then show the story album if received +type InternalLinkTypeStoryAlbum struct { + meta + // Username of the owner of the story album + StoryAlbumOwnerUsername string `json:"story_album_owner_username"` + // Story album identifier + StoryAlbumId int32 `json:"story_album_id"` +} + +func (entity *InternalLinkTypeStoryAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InternalLinkTypeStoryAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*InternalLinkTypeStoryAlbum) GetClass() string { + return ClassInternalLinkType +} + +func (*InternalLinkTypeStoryAlbum) GetType() string { + return TypeInternalLinkTypeStoryAlbum +} + +func (*InternalLinkTypeStoryAlbum) InternalLinkTypeType() string { + return TypeInternalLinkTypeStoryAlbum +} + +// The link is a link to a cloud theme. TDLib has no theme support yet type InternalLinkTypeTheme struct { meta // Name of the theme @@ -37368,31 +57383,6 @@ func (*InternalLinkTypeTheme) InternalLinkTypeType() string { return TypeInternalLinkTypeTheme } -// The link is a link to the theme section of the app settings -type InternalLinkTypeThemeSettings struct{ - meta -} - -func (entity *InternalLinkTypeThemeSettings) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InternalLinkTypeThemeSettings - - return json.Marshal((*stub)(entity)) -} - -func (*InternalLinkTypeThemeSettings) GetClass() string { - return ClassInternalLinkType -} - -func (*InternalLinkTypeThemeSettings) GetType() string { - return TypeInternalLinkTypeThemeSettings -} - -func (*InternalLinkTypeThemeSettings) InternalLinkTypeType() string { - return TypeInternalLinkTypeThemeSettings -} - // The link is an unknown tg: link. Call getDeepLinkInfo to process the link type InternalLinkTypeUnknownDeepLink struct { meta @@ -37420,36 +57410,42 @@ func (*InternalLinkTypeUnknownDeepLink) InternalLinkTypeType() string { return TypeInternalLinkTypeUnknownDeepLink } -// The link is a link to an unsupported proxy. An alert can be shown to the user -type InternalLinkTypeUnsupportedProxy struct{ +// The link is a link to an upgraded gift. Call getUpgradedGift with the given name to process the link +type InternalLinkTypeUpgradedGift struct { meta + // Name of the unique gift + Name string `json:"name"` } -func (entity *InternalLinkTypeUnsupportedProxy) MarshalJSON() ([]byte, error) { +func (entity *InternalLinkTypeUpgradedGift) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub InternalLinkTypeUnsupportedProxy + type stub InternalLinkTypeUpgradedGift return json.Marshal((*stub)(entity)) } -func (*InternalLinkTypeUnsupportedProxy) GetClass() string { +func (*InternalLinkTypeUpgradedGift) GetClass() string { return ClassInternalLinkType } -func (*InternalLinkTypeUnsupportedProxy) GetType() string { - return TypeInternalLinkTypeUnsupportedProxy +func (*InternalLinkTypeUpgradedGift) GetType() string { + return TypeInternalLinkTypeUpgradedGift } -func (*InternalLinkTypeUnsupportedProxy) InternalLinkTypeType() string { - return TypeInternalLinkTypeUnsupportedProxy +func (*InternalLinkTypeUpgradedGift) InternalLinkTypeType() string { + return TypeInternalLinkTypeUpgradedGift } -// The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link +// The link is a link to a user by its phone number. Call searchUserByPhoneNumber with the given phone number to process the link. If the user is found, then call createPrivateChat and open user's profile information screen or the chat itself. If draft text isn't empty, then put the draft text in the input field type InternalLinkTypeUserPhoneNumber struct { meta // Phone number of the user PhoneNumber string `json:"phone_number"` + // Draft text for message to send in the chat + DraftText string `json:"draft_text"` + // True, if user's profile information screen must be opened; otherwise, the chat itself must be opened + OpenProfile bool `json:"open_profile"` } func (entity *InternalLinkTypeUserPhoneNumber) MarshalJSON() ([]byte, error) { @@ -37472,7 +57468,7 @@ func (*InternalLinkTypeUserPhoneNumber) InternalLinkTypeType() string { return TypeInternalLinkTypeUserPhoneNumber } -// The link is a link to a user by a temporary token. Call searchUserByToken with the given token to process the link +// The link is a link to a user by a temporary token. Call searchUserByToken with the given token to process the link. If the user is found, then call createPrivateChat and open the chat type InternalLinkTypeUserToken struct { meta // The token @@ -37499,7 +57495,7 @@ func (*InternalLinkTypeUserToken) InternalLinkTypeType() string { return TypeInternalLinkTypeUserToken } -// The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinGroupCall with the given invite hash to process the link +// The link is a link to a video chat. Call searchPublicChat with the given chat username, and then joinVideoChat with the given invite hash to process the link type InternalLinkTypeVideoChat struct { meta // Username of the chat with the video chat @@ -37530,7 +57526,7 @@ func (*InternalLinkTypeVideoChat) InternalLinkTypeType() string { return TypeInternalLinkTypeVideoChat } -// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot, then call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being a third-party apps instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then, call getWebAppLinkUrl and open the returned URL as a Web App +// The link is a link to a Web App. Call searchPublicChat with the given bot username, check that the user is a bot. If the bot is restricted for the current user, then show an error message. Otherwise, call searchWebApp with the received bot and the given web_app_short_name. Process received foundWebApp by showing a confirmation dialog if needed. If the bot can be added to attachment or side menu, but isn't added yet, then show a disclaimer about Mini Apps being third-party applications instead of the dialog and ask the user to accept their Terms of service. If the user accept the terms and confirms adding, then use toggleBotIsAddedToAttachmentMenu to add the bot. Then, call getWebAppLinkUrl and open the returned URL as a Web App type InternalLinkTypeWebApp struct { meta // Username of the bot that owns the Web App @@ -37539,6 +57535,8 @@ type InternalLinkTypeWebApp struct { WebAppShortName string `json:"web_app_short_name"` // Start parameter to be passed to getWebAppLinkUrl StartParameter string `json:"start_parameter"` + // The mode in which the Web App must be opened + Mode WebAppOpenMode `json:"mode"` } func (entity *InternalLinkTypeWebApp) MarshalJSON() ([]byte, error) { @@ -37561,6 +57559,29 @@ func (*InternalLinkTypeWebApp) InternalLinkTypeType() string { return TypeInternalLinkTypeWebApp } +func (internalLinkTypeWebApp *InternalLinkTypeWebApp) UnmarshalJSON(data []byte) error { + var tmp struct { + BotUsername string `json:"bot_username"` + WebAppShortName string `json:"web_app_short_name"` + StartParameter string `json:"start_parameter"` + Mode json.RawMessage `json:"mode"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + internalLinkTypeWebApp.BotUsername = tmp.BotUsername + internalLinkTypeWebApp.WebAppShortName = tmp.WebAppShortName + internalLinkTypeWebApp.StartParameter = tmp.StartParameter + + fieldMode, _ := UnmarshalWebAppOpenMode(tmp.Mode) + internalLinkTypeWebApp.Mode = fieldMode + + return nil +} + // Contains an HTTPS link to a message in a supergroup or channel, or a forum topic type MessageLink struct { meta @@ -37593,11 +57614,11 @@ type MessageLinkInfo struct { IsPublic bool `json:"is_public"` // If found, identifier of the chat to which the link points, 0 otherwise ChatId int64 `json:"chat_id"` - // If found, identifier of the message thread in which to open the message, or a forum topic to open if the message is missing - MessageThreadId int64 `json:"message_thread_id"` + // Identifier of the specific topic in which the message must be opened, or a topic to open if the message is missing; may be null if none + TopicId MessageTopic `json:"topic_id"` // If found, the linked message; may be null Message *Message `json:"message"` - // Timestamp from which the video/audio/video note/voice note/story playing must start, in seconds; 0 if not specified. The media can be in the message content or in its web page preview + // Timestamp from which the video/audio/video note/voice note/story playing must start, in seconds; 0 if not specified. The media can be in the message content or in its link preview MediaTimestamp int32 `json:"media_timestamp"` // True, if the whole media album to which the message belongs is linked ForAlbum bool `json:"for_album"` @@ -37619,6 +57640,33 @@ func (*MessageLinkInfo) GetType() string { return TypeMessageLinkInfo } +func (messageLinkInfo *MessageLinkInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + IsPublic bool `json:"is_public"` + ChatId int64 `json:"chat_id"` + TopicId json.RawMessage `json:"topic_id"` + Message *Message `json:"message"` + MediaTimestamp int32 `json:"media_timestamp"` + ForAlbum bool `json:"for_album"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageLinkInfo.IsPublic = tmp.IsPublic + messageLinkInfo.ChatId = tmp.ChatId + messageLinkInfo.Message = tmp.Message + messageLinkInfo.MediaTimestamp = tmp.MediaTimestamp + messageLinkInfo.ForAlbum = tmp.ForAlbum + + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + messageLinkInfo.TopicId = fieldTopicId + + return nil +} + // Contains an HTTPS link to boost a chat type ChatBoostLink struct { meta @@ -37719,29 +57767,6 @@ func (*BlockListStories) BlockListType() string { return TypeBlockListStories } -// Contains a part of a file -type FilePart struct { - meta - // File bytes - Data []byte `json:"data"` -} - -func (entity *FilePart) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub FilePart - - return json.Marshal((*stub)(entity)) -} - -func (*FilePart) GetClass() string { - return ClassFilePart -} - -func (*FilePart) GetType() string { - return TypeFilePart -} - // The data is not a file type FileTypeNone struct{ meta @@ -38017,6 +58042,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 @@ -38700,11 +58825,11 @@ func (*AutoDownloadSettings) GetType() string { // Contains auto-download settings presets for the current user type AutoDownloadSettingsPresets struct { meta - // Preset with lowest settings; supposed to be used by default when roaming + // Preset with lowest settings; expected to be used by default when roaming Low *AutoDownloadSettings `json:"low"` - // Preset with medium settings; supposed to be used by default when using mobile data + // Preset with medium settings; expected to be used by default when using mobile data Medium *AutoDownloadSettings `json:"medium"` - // Preset with highest settings; supposed to be used by default when connected on Wi-Fi + // Preset with highest settings; expected to be used by default when connected on Wi-Fi High *AutoDownloadSettings `json:"high"` } @@ -38907,7 +59032,7 @@ func (*AutosaveSettings) GetType() string { return TypeAutosaveSettings } -// Currently waiting for the network to become available. Use setNetworkType to change the available network type +// Waiting for the network to become available. Use setNetworkType to change the available network type type ConnectionStateWaitingForNetwork struct{ meta } @@ -38932,7 +59057,7 @@ func (*ConnectionStateWaitingForNetwork) ConnectionStateType() string { return TypeConnectionStateWaitingForNetwork } -// Currently establishing a connection with a proxy server +// Establishing a connection with a proxy server type ConnectionStateConnectingToProxy struct{ meta } @@ -38957,7 +59082,7 @@ func (*ConnectionStateConnectingToProxy) ConnectionStateType() string { return TypeConnectionStateConnectingToProxy } -// Currently establishing a connection to the Telegram servers +// Establishing a connection to the Telegram servers type ConnectionStateConnecting struct{ meta } @@ -38982,7 +59107,7 @@ func (*ConnectionStateConnecting) ConnectionStateType() string { return TypeConnectionStateConnecting } -// Downloading data received while the application was offline +// Downloading data expected to be received while the application was offline type ConnectionStateUpdating struct{ meta } @@ -39032,6 +59157,33 @@ func (*ConnectionStateReady) ConnectionStateType() string { return TypeConnectionStateReady } +// Describes parameters for age verification of the current user +type AgeVerificationParameters struct { + meta + // The minimum age required to view restricted content + MinAge int32 `json:"min_age"` + // Username of the bot which main Web App may be used to verify age of the user + VerificationBotUsername string `json:"verification_bot_username"` + // Unique name for the country or region, which legislation required age verification. May be used to get the corresponding localization key + Country string `json:"country"` +} + +func (entity *AgeVerificationParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AgeVerificationParameters + + return json.Marshal((*stub)(entity)) +} + +func (*AgeVerificationParameters) GetClass() string { + return ClassAgeVerificationParameters +} + +func (*AgeVerificationParameters) GetType() string { + return TypeAgeVerificationParameters +} + // A category containing frequently used private chats with non-bot users type TopChatCategoryUsers struct{ meta @@ -39157,6 +59309,31 @@ func (*TopChatCategoryInlineBots) TopChatCategoryType() string { return TypeTopChatCategoryInlineBots } +// A category containing frequently used chats with bots, which Web Apps were opened +type TopChatCategoryWebAppBots struct{ + meta +} + +func (entity *TopChatCategoryWebAppBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TopChatCategoryWebAppBots + + return json.Marshal((*stub)(entity)) +} + +func (*TopChatCategoryWebAppBots) GetClass() string { + return ClassTopChatCategory +} + +func (*TopChatCategoryWebAppBots) GetType() string { + return TypeTopChatCategoryWebAppBots +} + +func (*TopChatCategoryWebAppBots) TopChatCategoryType() string { + return TypeTopChatCategoryWebAppBots +} + // A category containing frequently used chats used for calls type TopChatCategoryCalls struct{ meta @@ -39659,6 +59836,218 @@ func (*SuggestedActionSubscribeToAnnualPremium) SuggestedActionType() string { return TypeSuggestedActionSubscribeToAnnualPremium } +// Suggests the user to gift Telegram Premium to friends for Christmas +type SuggestedActionGiftPremiumForChristmas struct{ + meta +} + +func (entity *SuggestedActionGiftPremiumForChristmas) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionGiftPremiumForChristmas + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionGiftPremiumForChristmas) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionGiftPremiumForChristmas) GetType() string { + return TypeSuggestedActionGiftPremiumForChristmas +} + +func (*SuggestedActionGiftPremiumForChristmas) SuggestedActionType() string { + return TypeSuggestedActionGiftPremiumForChristmas +} + +// Suggests the user to set birthdate +type SuggestedActionSetBirthdate struct{ + meta +} + +func (entity *SuggestedActionSetBirthdate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionSetBirthdate + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionSetBirthdate) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionSetBirthdate) GetType() string { + return TypeSuggestedActionSetBirthdate +} + +func (*SuggestedActionSetBirthdate) SuggestedActionType() string { + return TypeSuggestedActionSetBirthdate +} + +// Suggests the user to set profile photo +type SuggestedActionSetProfilePhoto struct{ + meta +} + +func (entity *SuggestedActionSetProfilePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionSetProfilePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionSetProfilePhoto) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionSetProfilePhoto) GetType() string { + return TypeSuggestedActionSetProfilePhoto +} + +func (*SuggestedActionSetProfilePhoto) SuggestedActionType() string { + return TypeSuggestedActionSetProfilePhoto +} + +// Suggests the user to extend their expiring Telegram Premium subscription +type SuggestedActionExtendPremium struct { + meta + // A URL for managing Telegram Premium subscription + ManagePremiumSubscriptionUrl string `json:"manage_premium_subscription_url"` +} + +func (entity *SuggestedActionExtendPremium) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionExtendPremium + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionExtendPremium) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionExtendPremium) GetType() string { + return TypeSuggestedActionExtendPremium +} + +func (*SuggestedActionExtendPremium) SuggestedActionType() string { + return TypeSuggestedActionExtendPremium +} + +// Suggests the user to extend their expiring Telegram Star subscriptions. Call getStarSubscriptions with only_expiring == true to get the number of expiring subscriptions and the number of required to buy Telegram Stars +type SuggestedActionExtendStarSubscriptions struct{ + meta +} + +func (entity *SuggestedActionExtendStarSubscriptions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionExtendStarSubscriptions + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionExtendStarSubscriptions) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionExtendStarSubscriptions) GetType() string { + return TypeSuggestedActionExtendStarSubscriptions +} + +func (*SuggestedActionExtendStarSubscriptions) SuggestedActionType() string { + return TypeSuggestedActionExtendStarSubscriptions +} + +// A custom suggestion to be shown at the top of the chat list +type SuggestedActionCustom struct { + meta + // Unique name of the suggestion + Name string `json:"name"` + // Title of the suggestion + Title *FormattedText `json:"title"` + // Description of the suggestion + Description *FormattedText `json:"description"` + // The link to open when the suggestion is clicked + Url string `json:"url"` +} + +func (entity *SuggestedActionCustom) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionCustom + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionCustom) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionCustom) GetType() string { + return TypeSuggestedActionCustom +} + +func (*SuggestedActionCustom) SuggestedActionType() string { + return TypeSuggestedActionCustom +} + +// Suggests the user to add login email address. Call isLoginEmailAddressRequired, and then setLoginEmailAddress or checkLoginEmailAddressCode to change the login email address +type SuggestedActionSetLoginEmailAddress struct { + meta + // True, if the suggested action can be hidden using hideSuggestedAction. Otherwise, the user must not be able to use the app without setting up the email address + CanBeHidden bool `json:"can_be_hidden"` +} + +func (entity *SuggestedActionSetLoginEmailAddress) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionSetLoginEmailAddress + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionSetLoginEmailAddress) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionSetLoginEmailAddress) GetType() string { + return TypeSuggestedActionSetLoginEmailAddress +} + +func (*SuggestedActionSetLoginEmailAddress) SuggestedActionType() string { + return TypeSuggestedActionSetLoginEmailAddress +} + +// Suggests the user to add a passkey for login using addLoginPasskey +type SuggestedActionAddLoginPasskey struct{ + meta +} + +func (entity *SuggestedActionAddLoginPasskey) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub SuggestedActionAddLoginPasskey + + return json.Marshal((*stub)(entity)) +} + +func (*SuggestedActionAddLoginPasskey) GetClass() string { + return ClassSuggestedAction +} + +func (*SuggestedActionAddLoginPasskey) GetType() string { + return TypeSuggestedActionAddLoginPasskey +} + +func (*SuggestedActionAddLoginPasskey) SuggestedActionType() string { + return TypeSuggestedActionAddLoginPasskey +} + // Contains a counter type Count struct { meta @@ -39705,6 +60094,29 @@ func (*Text) GetType() string { return TypeText } +// Contains some binary data +type Data struct { + meta + // Data + Data []byte `json:"data"` +} + +func (entity *Data) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Data + + return json.Marshal((*stub)(entity)) +} + +func (*Data) GetClass() string { + return ClassData +} + +func (*Data) GetType() string { + return TypeData +} + // Contains a value representing a number of seconds type Seconds struct { meta @@ -39751,6 +60163,29 @@ func (*FileDownloadedPrefixSize) GetType() string { return TypeFileDownloadedPrefixSize } +// Contains a number of Telegram Stars +type StarCount struct { + meta + // Number of Telegram Stars + StarCount int64 `json:"star_count"` +} + +func (entity *StarCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarCount + + return json.Marshal((*stub)(entity)) +} + +func (*StarCount) GetClass() string { + return ClassStarCount +} + +func (*StarCount) GetType() string { + return TypeStarCount +} + // Contains information about a tg: deep link type DeepLinkInfo struct { meta @@ -39915,87 +60350,56 @@ func (*ProxyTypeMtproto) ProxyTypeType() string { return TypeProxyTypeMtproto } -// Contains information about a proxy server -type Proxy struct { +// Contains information about a proxy server added to the list of proxies +type AddedProxy struct { meta // Unique identifier of the proxy Id int32 `json:"id"` - // Proxy server domain or IP address - Server string `json:"server"` - // Proxy server port - Port int32 `json:"port"` // Point in time (Unix timestamp) when the proxy was last used; 0 if never LastUsedDate int32 `json:"last_used_date"` // True, if the proxy is enabled now IsEnabled bool `json:"is_enabled"` - // Type of the proxy - Type ProxyType `json:"type"` + // The proxy + Proxy *Proxy `json:"proxy"` } -func (entity *Proxy) MarshalJSON() ([]byte, error) { +func (entity *AddedProxy) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub Proxy + type stub AddedProxy return json.Marshal((*stub)(entity)) } -func (*Proxy) GetClass() string { - return ClassProxy +func (*AddedProxy) GetClass() string { + return ClassAddedProxy } -func (*Proxy) GetType() string { - return TypeProxy +func (*AddedProxy) GetType() string { + return TypeAddedProxy } -func (proxy *Proxy) UnmarshalJSON(data []byte) error { - var tmp struct { - Id int32 `json:"id"` - Server string `json:"server"` - Port int32 `json:"port"` - LastUsedDate int32 `json:"last_used_date"` - IsEnabled bool `json:"is_enabled"` - Type json.RawMessage `json:"type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - proxy.Id = tmp.Id - proxy.Server = tmp.Server - proxy.Port = tmp.Port - proxy.LastUsedDate = tmp.LastUsedDate - proxy.IsEnabled = tmp.IsEnabled - - fieldType, _ := UnmarshalProxyType(tmp.Type) - proxy.Type = fieldType - - return nil -} - -// Represents a list of proxy servers -type Proxies struct { +// Represents a list of added proxy servers +type AddedProxies struct { meta // List of proxy servers - Proxies []*Proxy `json:"proxies"` + Proxies []*AddedProxy `json:"proxies"` } -func (entity *Proxies) MarshalJSON() ([]byte, error) { +func (entity *AddedProxies) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub Proxies + type stub AddedProxies return json.Marshal((*stub)(entity)) } -func (*Proxies) GetClass() string { - return ClassProxies +func (*AddedProxies) GetClass() string { + return ClassAddedProxies } -func (*Proxies) GetType() string { - return TypeProxies +func (*AddedProxies) GetType() string { + return TypeAddedProxies } // A sticker to be added to a sticker set @@ -40003,6 +60407,8 @@ type InputSticker struct { meta // File with the sticker; must fit in a 512x512 square. For WEBP stickers the file must be in WEBP or PNG format, which will be converted to WEBP server-side. See https://core.telegram.org/animated_stickers#technical-requirements for technical requirements Sticker InputFile `json:"sticker"` + // Format of the sticker + Format StickerFormat `json:"format"` // String with 1-20 emoji corresponding to the sticker Emojis string `json:"emojis"` // Position where the mask is placed; pass null if not specified @@ -40030,6 +60436,7 @@ func (*InputSticker) GetType() string { func (inputSticker *InputSticker) UnmarshalJSON(data []byte) error { var tmp struct { Sticker json.RawMessage `json:"sticker"` + Format json.RawMessage `json:"format"` Emojis string `json:"emojis"` MaskPosition *MaskPosition `json:"mask_position"` Keywords []string `json:"keywords"` @@ -40047,6 +60454,9 @@ func (inputSticker *InputSticker) UnmarshalJSON(data []byte) error { fieldSticker, _ := UnmarshalInputFile(tmp.Sticker) inputSticker.Sticker = fieldSticker + fieldFormat, _ := UnmarshalStickerFormat(tmp.Format) + inputSticker.Format = fieldFormat + return nil } @@ -40185,31 +60595,110 @@ func (*StatisticalGraphError) StatisticalGraphType() string { return TypeStatisticalGraphError } -// Contains statistics about interactions with a message -type ChatStatisticsMessageInteractionInfo struct { +// Describes a message sent in the chat +type ChatStatisticsObjectTypeMessage struct { meta // Message identifier MessageId int64 `json:"message_id"` - // Number of times the message was viewed - ViewCount int32 `json:"view_count"` - // Number of times the message was forwarded - ForwardCount int32 `json:"forward_count"` } -func (entity *ChatStatisticsMessageInteractionInfo) MarshalJSON() ([]byte, error) { +func (entity *ChatStatisticsObjectTypeMessage) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ChatStatisticsMessageInteractionInfo + type stub ChatStatisticsObjectTypeMessage return json.Marshal((*stub)(entity)) } -func (*ChatStatisticsMessageInteractionInfo) GetClass() string { - return ClassChatStatisticsMessageInteractionInfo +func (*ChatStatisticsObjectTypeMessage) GetClass() string { + return ClassChatStatisticsObjectType } -func (*ChatStatisticsMessageInteractionInfo) GetType() string { - return TypeChatStatisticsMessageInteractionInfo +func (*ChatStatisticsObjectTypeMessage) GetType() string { + return TypeChatStatisticsObjectTypeMessage +} + +func (*ChatStatisticsObjectTypeMessage) ChatStatisticsObjectTypeType() string { + return TypeChatStatisticsObjectTypeMessage +} + +// Describes a story posted on behalf of the chat +type ChatStatisticsObjectTypeStory struct { + meta + // Story identifier + StoryId int32 `json:"story_id"` +} + +func (entity *ChatStatisticsObjectTypeStory) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatStatisticsObjectTypeStory + + return json.Marshal((*stub)(entity)) +} + +func (*ChatStatisticsObjectTypeStory) GetClass() string { + return ClassChatStatisticsObjectType +} + +func (*ChatStatisticsObjectTypeStory) GetType() string { + return TypeChatStatisticsObjectTypeStory +} + +func (*ChatStatisticsObjectTypeStory) ChatStatisticsObjectTypeType() string { + return TypeChatStatisticsObjectTypeStory +} + +// Contains statistics about interactions with a message sent in the chat or a story posted on behalf of the chat +type ChatStatisticsInteractionInfo struct { + meta + // Type of the object + ObjectType ChatStatisticsObjectType `json:"object_type"` + // Number of times the object was viewed + ViewCount int32 `json:"view_count"` + // Number of times the object was forwarded + ForwardCount int32 `json:"forward_count"` + // Number of times reactions were added to the object + ReactionCount int32 `json:"reaction_count"` +} + +func (entity *ChatStatisticsInteractionInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatStatisticsInteractionInfo + + return json.Marshal((*stub)(entity)) +} + +func (*ChatStatisticsInteractionInfo) GetClass() string { + return ClassChatStatisticsInteractionInfo +} + +func (*ChatStatisticsInteractionInfo) GetType() string { + return TypeChatStatisticsInteractionInfo +} + +func (chatStatisticsInteractionInfo *ChatStatisticsInteractionInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + ObjectType json.RawMessage `json:"object_type"` + ViewCount int32 `json:"view_count"` + ForwardCount int32 `json:"forward_count"` + ReactionCount int32 `json:"reaction_count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatStatisticsInteractionInfo.ViewCount = tmp.ViewCount + chatStatisticsInteractionInfo.ForwardCount = tmp.ForwardCount + chatStatisticsInteractionInfo.ReactionCount = tmp.ReactionCount + + fieldObjectType, _ := UnmarshalChatStatisticsObjectType(tmp.ObjectType) + chatStatisticsInteractionInfo.ObjectType = fieldObjectType + + return nil } // Contains statistics about messages sent by a user @@ -40418,10 +60907,18 @@ type ChatStatisticsChannel struct { Period *DateRange `json:"period"` // Number of members in the chat MemberCount *StatisticalValue `json:"member_count"` - // Mean number of times the recently sent messages was viewed - MeanViewCount *StatisticalValue `json:"mean_view_count"` - // Mean number of times the recently sent messages was shared - MeanShareCount *StatisticalValue `json:"mean_share_count"` + // Mean number of times the recently sent messages were viewed + MeanMessageViewCount *StatisticalValue `json:"mean_message_view_count"` + // Mean number of times the recently sent messages were shared + MeanMessageShareCount *StatisticalValue `json:"mean_message_share_count"` + // Mean number of times reactions were added to the recently sent messages + MeanMessageReactionCount *StatisticalValue `json:"mean_message_reaction_count"` + // Mean number of times the recently posted stories were viewed + MeanStoryViewCount *StatisticalValue `json:"mean_story_view_count"` + // Mean number of times the recently posted stories were shared + MeanStoryShareCount *StatisticalValue `json:"mean_story_share_count"` + // Mean number of times reactions were added to the recently posted stories + MeanStoryReactionCount *StatisticalValue `json:"mean_story_reaction_count"` // A percentage of users with enabled notifications for the chat; 0-100 EnabledNotificationsPercentage float64 `json:"enabled_notifications_percentage"` // A graph containing number of members in the chat @@ -40440,10 +60937,16 @@ type ChatStatisticsChannel struct { LanguageGraph StatisticalGraph `json:"language_graph"` // A graph containing number of chat message views and shares MessageInteractionGraph StatisticalGraph `json:"message_interaction_graph"` + // A graph containing number of reactions on messages + MessageReactionGraph StatisticalGraph `json:"message_reaction_graph"` + // A graph containing number of story views and shares + StoryInteractionGraph StatisticalGraph `json:"story_interaction_graph"` + // A graph containing number of reactions on stories + StoryReactionGraph StatisticalGraph `json:"story_reaction_graph"` // A graph containing number of views of associated with the chat instant views InstantViewInteractionGraph StatisticalGraph `json:"instant_view_interaction_graph"` - // Detailed statistics about number of views and shares of recently sent messages - RecentMessageInteractions []*ChatStatisticsMessageInteractionInfo `json:"recent_message_interactions"` + // Detailed statistics about number of views and shares of recently sent messages and posted stories + RecentInteractions []*ChatStatisticsInteractionInfo `json:"recent_interactions"` } func (entity *ChatStatisticsChannel) MarshalJSON() ([]byte, error) { @@ -40470,8 +60973,12 @@ func (chatStatisticsChannel *ChatStatisticsChannel) UnmarshalJSON(data []byte) e var tmp struct { Period *DateRange `json:"period"` MemberCount *StatisticalValue `json:"member_count"` - MeanViewCount *StatisticalValue `json:"mean_view_count"` - MeanShareCount *StatisticalValue `json:"mean_share_count"` + MeanMessageViewCount *StatisticalValue `json:"mean_message_view_count"` + MeanMessageShareCount *StatisticalValue `json:"mean_message_share_count"` + MeanMessageReactionCount *StatisticalValue `json:"mean_message_reaction_count"` + MeanStoryViewCount *StatisticalValue `json:"mean_story_view_count"` + MeanStoryShareCount *StatisticalValue `json:"mean_story_share_count"` + MeanStoryReactionCount *StatisticalValue `json:"mean_story_reaction_count"` EnabledNotificationsPercentage float64 `json:"enabled_notifications_percentage"` MemberCountGraph json.RawMessage `json:"member_count_graph"` JoinGraph json.RawMessage `json:"join_graph"` @@ -40481,8 +60988,11 @@ func (chatStatisticsChannel *ChatStatisticsChannel) UnmarshalJSON(data []byte) e JoinBySourceGraph json.RawMessage `json:"join_by_source_graph"` LanguageGraph json.RawMessage `json:"language_graph"` MessageInteractionGraph json.RawMessage `json:"message_interaction_graph"` + MessageReactionGraph json.RawMessage `json:"message_reaction_graph"` + StoryInteractionGraph json.RawMessage `json:"story_interaction_graph"` + StoryReactionGraph json.RawMessage `json:"story_reaction_graph"` InstantViewInteractionGraph json.RawMessage `json:"instant_view_interaction_graph"` - RecentMessageInteractions []*ChatStatisticsMessageInteractionInfo `json:"recent_message_interactions"` + RecentInteractions []*ChatStatisticsInteractionInfo `json:"recent_interactions"` } err := json.Unmarshal(data, &tmp) @@ -40492,10 +61002,14 @@ func (chatStatisticsChannel *ChatStatisticsChannel) UnmarshalJSON(data []byte) e chatStatisticsChannel.Period = tmp.Period chatStatisticsChannel.MemberCount = tmp.MemberCount - chatStatisticsChannel.MeanViewCount = tmp.MeanViewCount - chatStatisticsChannel.MeanShareCount = tmp.MeanShareCount + chatStatisticsChannel.MeanMessageViewCount = tmp.MeanMessageViewCount + chatStatisticsChannel.MeanMessageShareCount = tmp.MeanMessageShareCount + chatStatisticsChannel.MeanMessageReactionCount = tmp.MeanMessageReactionCount + chatStatisticsChannel.MeanStoryViewCount = tmp.MeanStoryViewCount + chatStatisticsChannel.MeanStoryShareCount = tmp.MeanStoryShareCount + chatStatisticsChannel.MeanStoryReactionCount = tmp.MeanStoryReactionCount chatStatisticsChannel.EnabledNotificationsPercentage = tmp.EnabledNotificationsPercentage - chatStatisticsChannel.RecentMessageInteractions = tmp.RecentMessageInteractions + chatStatisticsChannel.RecentInteractions = tmp.RecentInteractions fieldMemberCountGraph, _ := UnmarshalStatisticalGraph(tmp.MemberCountGraph) chatStatisticsChannel.MemberCountGraph = fieldMemberCountGraph @@ -40521,17 +61035,113 @@ func (chatStatisticsChannel *ChatStatisticsChannel) UnmarshalJSON(data []byte) e fieldMessageInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.MessageInteractionGraph) chatStatisticsChannel.MessageInteractionGraph = fieldMessageInteractionGraph + fieldMessageReactionGraph, _ := UnmarshalStatisticalGraph(tmp.MessageReactionGraph) + chatStatisticsChannel.MessageReactionGraph = fieldMessageReactionGraph + + fieldStoryInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.StoryInteractionGraph) + chatStatisticsChannel.StoryInteractionGraph = fieldStoryInteractionGraph + + fieldStoryReactionGraph, _ := UnmarshalStatisticalGraph(tmp.StoryReactionGraph) + chatStatisticsChannel.StoryReactionGraph = fieldStoryReactionGraph + fieldInstantViewInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.InstantViewInteractionGraph) chatStatisticsChannel.InstantViewInteractionGraph = fieldInstantViewInteractionGraph return nil } +// Contains information about revenue earned from sponsored messages in a chat +type ChatRevenueAmount struct { + meta + // Cryptocurrency in which revenue is calculated + Cryptocurrency string `json:"cryptocurrency"` + // Total amount of the cryptocurrency earned, in the smallest units of the cryptocurrency + TotalAmount JsonInt64 `json:"total_amount"` + // Amount of the cryptocurrency that isn't withdrawn yet, in the smallest units of the cryptocurrency + BalanceAmount JsonInt64 `json:"balance_amount"` + // Amount of the cryptocurrency available for withdrawal, in the smallest units of the cryptocurrency + AvailableAmount JsonInt64 `json:"available_amount"` + // True, if Telegram Stars can be withdrawn now or later + WithdrawalEnabled bool `json:"withdrawal_enabled"` +} + +func (entity *ChatRevenueAmount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueAmount + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueAmount) GetClass() string { + return ClassChatRevenueAmount +} + +func (*ChatRevenueAmount) GetType() string { + return TypeChatRevenueAmount +} + +// A detailed statistics about revenue earned from sponsored messages in a chat +type ChatRevenueStatistics struct { + meta + // A graph containing amount of revenue in a given hour + RevenueByHourGraph StatisticalGraph `json:"revenue_by_hour_graph"` + // A graph containing amount of revenue + RevenueGraph StatisticalGraph `json:"revenue_graph"` + // Amount of earned revenue + RevenueAmount *ChatRevenueAmount `json:"revenue_amount"` + // Current conversion rate of the cryptocurrency in which revenue is calculated to USD + UsdRate float64 `json:"usd_rate"` +} + +func (entity *ChatRevenueStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueStatistics) GetClass() string { + return ClassChatRevenueStatistics +} + +func (*ChatRevenueStatistics) GetType() string { + return TypeChatRevenueStatistics +} + +func (chatRevenueStatistics *ChatRevenueStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + RevenueByHourGraph json.RawMessage `json:"revenue_by_hour_graph"` + RevenueGraph json.RawMessage `json:"revenue_graph"` + RevenueAmount *ChatRevenueAmount `json:"revenue_amount"` + UsdRate float64 `json:"usd_rate"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatRevenueStatistics.RevenueAmount = tmp.RevenueAmount + chatRevenueStatistics.UsdRate = tmp.UsdRate + + fieldRevenueByHourGraph, _ := UnmarshalStatisticalGraph(tmp.RevenueByHourGraph) + chatRevenueStatistics.RevenueByHourGraph = fieldRevenueByHourGraph + + fieldRevenueGraph, _ := UnmarshalStatisticalGraph(tmp.RevenueGraph) + chatRevenueStatistics.RevenueGraph = fieldRevenueGraph + + return nil +} + // A detailed statistics about a message type MessageStatistics struct { meta // A graph containing number of message views and shares MessageInteractionGraph StatisticalGraph `json:"message_interaction_graph"` + // A graph containing number of message reactions + MessageReactionGraph StatisticalGraph `json:"message_reaction_graph"` } func (entity *MessageStatistics) MarshalJSON() ([]byte, error) { @@ -40553,6 +61163,7 @@ func (*MessageStatistics) GetType() string { func (messageStatistics *MessageStatistics) UnmarshalJSON(data []byte) error { var tmp struct { MessageInteractionGraph json.RawMessage `json:"message_interaction_graph"` + MessageReactionGraph json.RawMessage `json:"message_reaction_graph"` } err := json.Unmarshal(data, &tmp) @@ -40563,6 +61174,520 @@ func (messageStatistics *MessageStatistics) UnmarshalJSON(data []byte) error { fieldMessageInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.MessageInteractionGraph) messageStatistics.MessageInteractionGraph = fieldMessageInteractionGraph + fieldMessageReactionGraph, _ := UnmarshalStatisticalGraph(tmp.MessageReactionGraph) + messageStatistics.MessageReactionGraph = fieldMessageReactionGraph + + return nil +} + +// A detailed statistics about a story +type StoryStatistics struct { + meta + // A graph containing number of story views and shares + StoryInteractionGraph StatisticalGraph `json:"story_interaction_graph"` + // A graph containing number of story reactions + StoryReactionGraph StatisticalGraph `json:"story_reaction_graph"` +} + +func (entity *StoryStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StoryStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*StoryStatistics) GetClass() string { + return ClassStoryStatistics +} + +func (*StoryStatistics) GetType() string { + return TypeStoryStatistics +} + +func (storyStatistics *StoryStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + StoryInteractionGraph json.RawMessage `json:"story_interaction_graph"` + StoryReactionGraph json.RawMessage `json:"story_reaction_graph"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldStoryInteractionGraph, _ := UnmarshalStatisticalGraph(tmp.StoryInteractionGraph) + storyStatistics.StoryInteractionGraph = fieldStoryInteractionGraph + + fieldStoryReactionGraph, _ := UnmarshalStatisticalGraph(tmp.StoryReactionGraph) + storyStatistics.StoryReactionGraph = fieldStoryReactionGraph + + return nil +} + +// Withdrawal is pending +type RevenueWithdrawalStatePending struct{ + meta +} + +func (entity *RevenueWithdrawalStatePending) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RevenueWithdrawalStatePending + + return json.Marshal((*stub)(entity)) +} + +func (*RevenueWithdrawalStatePending) GetClass() string { + return ClassRevenueWithdrawalState +} + +func (*RevenueWithdrawalStatePending) GetType() string { + return TypeRevenueWithdrawalStatePending +} + +func (*RevenueWithdrawalStatePending) RevenueWithdrawalStateType() string { + return TypeRevenueWithdrawalStatePending +} + +// Withdrawal succeeded +type RevenueWithdrawalStateSucceeded struct { + meta + // Point in time (Unix timestamp) when the withdrawal was completed + Date int32 `json:"date"` + // The URL where the withdrawal transaction can be viewed + Url string `json:"url"` +} + +func (entity *RevenueWithdrawalStateSucceeded) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RevenueWithdrawalStateSucceeded + + return json.Marshal((*stub)(entity)) +} + +func (*RevenueWithdrawalStateSucceeded) GetClass() string { + return ClassRevenueWithdrawalState +} + +func (*RevenueWithdrawalStateSucceeded) GetType() string { + return TypeRevenueWithdrawalStateSucceeded +} + +func (*RevenueWithdrawalStateSucceeded) RevenueWithdrawalStateType() string { + return TypeRevenueWithdrawalStateSucceeded +} + +// Withdrawal failed +type RevenueWithdrawalStateFailed struct{ + meta +} + +func (entity *RevenueWithdrawalStateFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RevenueWithdrawalStateFailed + + return json.Marshal((*stub)(entity)) +} + +func (*RevenueWithdrawalStateFailed) GetClass() string { + return ClassRevenueWithdrawalState +} + +func (*RevenueWithdrawalStateFailed) GetType() string { + return TypeRevenueWithdrawalStateFailed +} + +func (*RevenueWithdrawalStateFailed) RevenueWithdrawalStateType() string { + return TypeRevenueWithdrawalStateFailed +} + +// Describes an unsupported transaction +type ChatRevenueTransactionTypeUnsupported struct{ + meta +} + +func (entity *ChatRevenueTransactionTypeUnsupported) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeUnsupported + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeUnsupported) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeUnsupported) GetType() string { + return TypeChatRevenueTransactionTypeUnsupported +} + +func (*ChatRevenueTransactionTypeUnsupported) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeUnsupported +} + +// Describes earnings from sponsored messages in a chat in some time frame +type ChatRevenueTransactionTypeSponsoredMessageEarnings struct { + meta + // Point in time (Unix timestamp) when the earnings started + StartDate int32 `json:"start_date"` + // Point in time (Unix timestamp) when the earnings ended + EndDate int32 `json:"end_date"` +} + +func (entity *ChatRevenueTransactionTypeSponsoredMessageEarnings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeSponsoredMessageEarnings + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) GetType() string { + return TypeChatRevenueTransactionTypeSponsoredMessageEarnings +} + +func (*ChatRevenueTransactionTypeSponsoredMessageEarnings) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeSponsoredMessageEarnings +} + +// Describes earnings from a published suggested post +type ChatRevenueTransactionTypeSuggestedPostEarnings struct { + meta + // Identifier of the user who paid for the suggested post + UserId int64 `json:"user_id"` +} + +func (entity *ChatRevenueTransactionTypeSuggestedPostEarnings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeSuggestedPostEarnings + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) GetType() string { + return TypeChatRevenueTransactionTypeSuggestedPostEarnings +} + +func (*ChatRevenueTransactionTypeSuggestedPostEarnings) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeSuggestedPostEarnings +} + +// Describes a withdrawal of earnings through Fragment +type ChatRevenueTransactionTypeFragmentWithdrawal struct { + meta + // Point in time (Unix timestamp) when the earnings withdrawal started + WithdrawalDate int32 `json:"withdrawal_date"` + // State of the withdrawal + State RevenueWithdrawalState `json:"state"` +} + +func (entity *ChatRevenueTransactionTypeFragmentWithdrawal) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeFragmentWithdrawal + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeFragmentWithdrawal) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeFragmentWithdrawal) GetType() string { + return TypeChatRevenueTransactionTypeFragmentWithdrawal +} + +func (*ChatRevenueTransactionTypeFragmentWithdrawal) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeFragmentWithdrawal +} + +func (chatRevenueTransactionTypeFragmentWithdrawal *ChatRevenueTransactionTypeFragmentWithdrawal) UnmarshalJSON(data []byte) error { + var tmp struct { + WithdrawalDate int32 `json:"withdrawal_date"` + State json.RawMessage `json:"state"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatRevenueTransactionTypeFragmentWithdrawal.WithdrawalDate = tmp.WithdrawalDate + + fieldState, _ := UnmarshalRevenueWithdrawalState(tmp.State) + chatRevenueTransactionTypeFragmentWithdrawal.State = fieldState + + return nil +} + +// Describes a refund for failed withdrawal of earnings through Fragment +type ChatRevenueTransactionTypeFragmentRefund struct { + meta + // Point in time (Unix timestamp) when the transaction was refunded + RefundDate int32 `json:"refund_date"` +} + +func (entity *ChatRevenueTransactionTypeFragmentRefund) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactionTypeFragmentRefund + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactionTypeFragmentRefund) GetClass() string { + return ClassChatRevenueTransactionType +} + +func (*ChatRevenueTransactionTypeFragmentRefund) GetType() string { + return TypeChatRevenueTransactionTypeFragmentRefund +} + +func (*ChatRevenueTransactionTypeFragmentRefund) ChatRevenueTransactionTypeType() string { + return TypeChatRevenueTransactionTypeFragmentRefund +} + +// Contains a chat revenue transactions +type ChatRevenueTransaction struct { + meta + // Cryptocurrency in which revenue is calculated + Cryptocurrency string `json:"cryptocurrency"` + // The withdrawn amount, in the smallest units of the cryptocurrency + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` + // Type of the transaction + Type ChatRevenueTransactionType `json:"type"` +} + +func (entity *ChatRevenueTransaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransaction + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransaction) GetClass() string { + return ClassChatRevenueTransaction +} + +func (*ChatRevenueTransaction) GetType() string { + return TypeChatRevenueTransaction +} + +func (chatRevenueTransaction *ChatRevenueTransaction) UnmarshalJSON(data []byte) error { + var tmp struct { + Cryptocurrency string `json:"cryptocurrency"` + CryptocurrencyAmount JsonInt64 `json:"cryptocurrency_amount"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + chatRevenueTransaction.Cryptocurrency = tmp.Cryptocurrency + chatRevenueTransaction.CryptocurrencyAmount = tmp.CryptocurrencyAmount + + fieldType, _ := UnmarshalChatRevenueTransactionType(tmp.Type) + chatRevenueTransaction.Type = fieldType + + return nil +} + +// Contains a list of chat revenue transactions +type ChatRevenueTransactions struct { + meta + // The amount of owned Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` + // List of transactions + Transactions []*ChatRevenueTransaction `json:"transactions"` + // The offset for the next request. If empty, then there are no more results + NextOffset string `json:"next_offset"` +} + +func (entity *ChatRevenueTransactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatRevenueTransactions + + return json.Marshal((*stub)(entity)) +} + +func (*ChatRevenueTransactions) GetClass() string { + return ClassChatRevenueTransactions +} + +func (*ChatRevenueTransactions) GetType() string { + return TypeChatRevenueTransactions +} + +// Contains information about Telegram Stars earned by a user or a chat +type StarRevenueStatus struct { + meta + // Total Telegram Star amount earned + TotalAmount *StarAmount `json:"total_amount"` + // The Telegram Star amount that isn't withdrawn yet + CurrentAmount *StarAmount `json:"current_amount"` + // The Telegram Star amount that is 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 + NextWithdrawalIn int32 `json:"next_withdrawal_in"` +} + +func (entity *StarRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*StarRevenueStatus) GetClass() string { + return ClassStarRevenueStatus +} + +func (*StarRevenueStatus) GetType() string { + return TypeStarRevenueStatus +} + +// A detailed statistics about Telegram Stars earned by a user or a chat +type StarRevenueStatistics struct { + meta + // A graph containing amount of revenue in a given day + RevenueByDayGraph StatisticalGraph `json:"revenue_by_day_graph"` + // Telegram Star revenue status + Status *StarRevenueStatus `json:"status"` + // Current conversion rate of a Telegram Star to USD + UsdRate float64 `json:"usd_rate"` +} + +func (entity *StarRevenueStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub StarRevenueStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*StarRevenueStatistics) GetClass() string { + return ClassStarRevenueStatistics +} + +func (*StarRevenueStatistics) GetType() string { + return TypeStarRevenueStatistics +} + +func (starRevenueStatistics *StarRevenueStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + RevenueByDayGraph json.RawMessage `json:"revenue_by_day_graph"` + Status *StarRevenueStatus `json:"status"` + UsdRate float64 `json:"usd_rate"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + starRevenueStatistics.Status = tmp.Status + starRevenueStatistics.UsdRate = tmp.UsdRate + + fieldRevenueByDayGraph, _ := UnmarshalStatisticalGraph(tmp.RevenueByDayGraph) + starRevenueStatistics.RevenueByDayGraph = fieldRevenueByDayGraph + + return nil +} + +// Contains information about Toncoins earned by the current user +type TonRevenueStatus struct { + meta + // Total Toncoin amount earned; in the smallest units of the cryptocurrency + TotalAmount JsonInt64 `json:"total_amount"` + // The Toncoin amount that isn't withdrawn yet; in the smallest units of the cryptocurrency + BalanceAmount JsonInt64 `json:"balance_amount"` + // The Toncoin amount that is available for withdrawal; in the smallest units of the cryptocurrency + AvailableAmount JsonInt64 `json:"available_amount"` + // True, if Toncoins can be withdrawn + WithdrawalEnabled bool `json:"withdrawal_enabled"` +} + +func (entity *TonRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*TonRevenueStatus) GetClass() string { + return ClassTonRevenueStatus +} + +func (*TonRevenueStatus) GetType() string { + return TypeTonRevenueStatus +} + +// A detailed statistics about Toncoins earned by the current user +type TonRevenueStatistics struct { + meta + // A graph containing amount of revenue in a given day + RevenueByDayGraph StatisticalGraph `json:"revenue_by_day_graph"` + // Amount of earned revenue + Status *TonRevenueStatus `json:"status"` + // Current conversion rate of nanotoncoin to USD cents + UsdRate float64 `json:"usd_rate"` +} + +func (entity *TonRevenueStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TonRevenueStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*TonRevenueStatistics) GetClass() string { + return ClassTonRevenueStatistics +} + +func (*TonRevenueStatistics) GetType() string { + return TypeTonRevenueStatistics +} + +func (tonRevenueStatistics *TonRevenueStatistics) UnmarshalJSON(data []byte) error { + var tmp struct { + RevenueByDayGraph json.RawMessage `json:"revenue_by_day_graph"` + Status *TonRevenueStatus `json:"status"` + UsdRate float64 `json:"usd_rate"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + tonRevenueStatistics.Status = tmp.Status + tonRevenueStatistics.UsdRate = tmp.UsdRate + + fieldRevenueByDayGraph, _ := UnmarshalStatisticalGraph(tmp.RevenueByDayGraph) + tonRevenueStatistics.RevenueByDayGraph = fieldRevenueByDayGraph + return nil } @@ -40618,7 +61743,7 @@ func (*VectorPathCommandLine) VectorPathCommandType() string { return TypeVectorPathCommandLine } -// A cubic Bézier curve to a given point +// A cubic Bézier curve to a given point type VectorPathCommandCubicBezierCurve struct { meta // The start control point of the curve @@ -40832,6 +61957,83 @@ func (*BotCommandScopeChatMember) BotCommandScopeType() string { return TypeBotCommandScopeChatMember } +// Checks ownership of a new phone number to change the user's authentication phone number; for official Android and iOS applications only +type PhoneNumberCodeTypeChange struct{ + meta +} + +func (entity *PhoneNumberCodeTypeChange) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PhoneNumberCodeTypeChange + + return json.Marshal((*stub)(entity)) +} + +func (*PhoneNumberCodeTypeChange) GetClass() string { + return ClassPhoneNumberCodeType +} + +func (*PhoneNumberCodeTypeChange) GetType() string { + return TypePhoneNumberCodeTypeChange +} + +func (*PhoneNumberCodeTypeChange) PhoneNumberCodeTypeType() string { + return TypePhoneNumberCodeTypeChange +} + +// Verifies ownership of a phone number to be added to the user's Telegram Passport +type PhoneNumberCodeTypeVerify struct{ + meta +} + +func (entity *PhoneNumberCodeTypeVerify) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PhoneNumberCodeTypeVerify + + return json.Marshal((*stub)(entity)) +} + +func (*PhoneNumberCodeTypeVerify) GetClass() string { + return ClassPhoneNumberCodeType +} + +func (*PhoneNumberCodeTypeVerify) GetType() string { + return TypePhoneNumberCodeTypeVerify +} + +func (*PhoneNumberCodeTypeVerify) PhoneNumberCodeTypeType() string { + return TypePhoneNumberCodeTypeVerify +} + +// Confirms ownership of a phone number to prevent account deletion while handling links of the type internalLinkTypePhoneNumberConfirmation +type PhoneNumberCodeTypeConfirmOwnership struct { + meta + // Hash value from the link + Hash string `json:"hash"` +} + +func (entity *PhoneNumberCodeTypeConfirmOwnership) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PhoneNumberCodeTypeConfirmOwnership + + return json.Marshal((*stub)(entity)) +} + +func (*PhoneNumberCodeTypeConfirmOwnership) GetClass() string { + return ClassPhoneNumberCodeType +} + +func (*PhoneNumberCodeTypeConfirmOwnership) GetType() string { + return TypePhoneNumberCodeTypeConfirmOwnership +} + +func (*PhoneNumberCodeTypeConfirmOwnership) PhoneNumberCodeTypeType() string { + return TypePhoneNumberCodeTypeConfirmOwnership +} + // The user authorization state has changed type UpdateAuthorizationState struct { meta @@ -40902,7 +62104,7 @@ func (*UpdateNewMessage) UpdateType() string { return TypeUpdateNewMessage } -// A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully or even that the send message request will be processed. This update will be sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message +// A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully. This update is sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message type UpdateMessageSendAcknowledged struct { meta // The chat identifier of the sent message @@ -40934,7 +62136,7 @@ func (*UpdateMessageSendAcknowledged) UpdateType() string { // A message has been successfully sent type UpdateMessageSendSucceeded struct { meta - // The sent message. Usually only the message identifier, date, and content are changed, but almost all other fields can also change + // The sent message. Almost any field of the new message can be different from the corresponding field of the original message. For example, the field scheduling_state may change, making the message scheduled, or non-scheduled Message *Message `json:"message"` // The previous temporary message identifier OldMessageId int64 `json:"old_message_id"` @@ -41254,7 +62456,69 @@ func (*UpdateMessageUnreadReactions) UpdateType() string { return TypeUpdateMessageUnreadReactions } -// A message with a live location was viewed. When the update is received, the application is supposed to update the live location +// A fact-check added to a message was changed +type UpdateMessageFactCheck struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // The new fact-check + FactCheck *FactCheck `json:"fact_check"` +} + +func (entity *UpdateMessageFactCheck) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageFactCheck + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageFactCheck) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageFactCheck) GetType() string { + return TypeUpdateMessageFactCheck +} + +func (*UpdateMessageFactCheck) UpdateType() string { + return TypeUpdateMessageFactCheck +} + +// Information about suggested post of a message was changed +type UpdateMessageSuggestedPostInfo struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // The new information about the suggested post + SuggestedPostInfo *SuggestedPostInfo `json:"suggested_post_info"` +} + +func (entity *UpdateMessageSuggestedPostInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageSuggestedPostInfo + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageSuggestedPostInfo) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageSuggestedPostInfo) GetType() string { + return TypeUpdateMessageSuggestedPostInfo +} + +func (*UpdateMessageSuggestedPostInfo) UpdateType() string { + return TypeUpdateMessageSuggestedPostInfo +} + +// A message with a live location was viewed. When the update is received, the application is expected to update the live location type UpdateMessageLiveLocationViewed struct { meta // Identifier of the chat with the live location message @@ -41283,6 +62547,35 @@ func (*UpdateMessageLiveLocationViewed) UpdateType() string { return TypeUpdateMessageLiveLocationViewed } +// An automatically scheduled message with video has been successfully sent after conversion +type UpdateVideoPublished struct { + meta + // Identifier of the chat with the message + ChatId int64 `json:"chat_id"` + // Identifier of the sent message + MessageId int64 `json:"message_id"` +} + +func (entity *UpdateVideoPublished) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateVideoPublished + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateVideoPublished) GetClass() string { + return ClassUpdate +} + +func (*UpdateVideoPublished) GetType() string { + return TypeUpdateVideoPublished +} + +func (*UpdateVideoPublished) UpdateType() string { + return TypeUpdateVideoPublished +} + // A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the application. The chat field changes will be reported through separate updates type UpdateNewChat struct { meta @@ -41368,65 +62661,44 @@ func (*UpdateChatPhoto) UpdateType() string { return TypeUpdateChatPhoto } -// A chat accent color has changed -type UpdateChatAccentColor struct { +// Chat accent colors have changed +type UpdateChatAccentColors struct { meta // Chat identifier ChatId int64 `json:"chat_id"` // The new chat accent color identifier AccentColorId int32 `json:"accent_color_id"` -} - -func (entity *UpdateChatAccentColor) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UpdateChatAccentColor - - return json.Marshal((*stub)(entity)) -} - -func (*UpdateChatAccentColor) GetClass() string { - return ClassUpdate -} - -func (*UpdateChatAccentColor) GetType() string { - return TypeUpdateChatAccentColor -} - -func (*UpdateChatAccentColor) UpdateType() string { - return TypeUpdateChatAccentColor -} - -// A chat's custom emoji for reply background has changed -type UpdateChatBackgroundCustomEmoji struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // The new tdentifier of a custom emoji to be shown on the reply header background + // The new 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"` + // Color scheme based on an upgraded gift to be used for the chat instead of accent_color_id and background_custom_emoji_id; may be null if none + UpgradedGiftColors *UpgradedGiftColors `json:"upgraded_gift_colors"` + // The new chat profile accent color identifier; -1 if none + ProfileAccentColorId int32 `json:"profile_accent_color_id"` + // The new identifier of a custom emoji to be shown on the profile background; 0 if none + ProfileBackgroundCustomEmojiId JsonInt64 `json:"profile_background_custom_emoji_id"` } -func (entity *UpdateChatBackgroundCustomEmoji) MarshalJSON() ([]byte, error) { +func (entity *UpdateChatAccentColors) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateChatBackgroundCustomEmoji + type stub UpdateChatAccentColors return json.Marshal((*stub)(entity)) } -func (*UpdateChatBackgroundCustomEmoji) GetClass() string { +func (*UpdateChatAccentColors) GetClass() string { return ClassUpdate } -func (*UpdateChatBackgroundCustomEmoji) GetType() string { - return TypeUpdateChatBackgroundCustomEmoji +func (*UpdateChatAccentColors) GetType() string { + return TypeUpdateChatAccentColors } -func (*UpdateChatBackgroundCustomEmoji) UpdateType() string { - return TypeUpdateChatBackgroundCustomEmoji +func (*UpdateChatAccentColors) UpdateType() string { + return TypeUpdateChatAccentColors } -// Chat permissions was changed +// Chat permissions were changed type UpdateChatPermissions struct { meta // Chat identifier @@ -41515,6 +62787,102 @@ func (*UpdateChatPosition) UpdateType() string { return TypeUpdateChatPosition } +// A chat was added to a chat list +type UpdateChatAddedToList struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The chat list to which the chat was added + ChatList ChatList `json:"chat_list"` +} + +func (entity *UpdateChatAddedToList) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatAddedToList + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatAddedToList) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatAddedToList) GetType() string { + return TypeUpdateChatAddedToList +} + +func (*UpdateChatAddedToList) UpdateType() string { + return TypeUpdateChatAddedToList +} + +func (updateChatAddedToList *UpdateChatAddedToList) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + ChatList json.RawMessage `json:"chat_list"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateChatAddedToList.ChatId = tmp.ChatId + + fieldChatList, _ := UnmarshalChatList(tmp.ChatList) + updateChatAddedToList.ChatList = fieldChatList + + return nil +} + +// A chat was removed from a chat list +type UpdateChatRemovedFromList struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The chat list from which the chat was removed + ChatList ChatList `json:"chat_list"` +} + +func (entity *UpdateChatRemovedFromList) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatRemovedFromList + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatRemovedFromList) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatRemovedFromList) GetType() string { + return TypeUpdateChatRemovedFromList +} + +func (*UpdateChatRemovedFromList) UpdateType() string { + return TypeUpdateChatRemovedFromList +} + +func (updateChatRemovedFromList *UpdateChatRemovedFromList) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + ChatList json.RawMessage `json:"chat_list"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateChatRemovedFromList.ChatId = tmp.ChatId + + fieldChatList, _ := UnmarshalChatList(tmp.ChatList) + updateChatRemovedFromList.ChatList = fieldChatList + + return nil +} + // Incoming messages were read or the number of unread messages has been changed type UpdateChatReadInbox struct { meta @@ -41623,6 +62991,35 @@ func (updateChatActionBar *UpdateChatActionBar) UnmarshalJSON(data []byte) error return nil } +// The bar for managing business bot was changed in a chat +type UpdateChatBusinessBotManageBar struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new value of the business bot manage bar; may be null + BusinessBotManageBar *BusinessBotManageBar `json:"business_bot_manage_bar"` +} + +func (entity *UpdateChatBusinessBotManageBar) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatBusinessBotManageBar + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatBusinessBotManageBar) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatBusinessBotManageBar) GetType() string { + return TypeUpdateChatBusinessBotManageBar +} + +func (*UpdateChatBusinessBotManageBar) UpdateType() string { + return TypeUpdateChatBusinessBotManageBar +} + // The chat available reactions were changed type UpdateChatAvailableReactions struct { meta @@ -41676,7 +63073,7 @@ type UpdateChatDraftMessage struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // The new draft message; may be null + // The new draft message; may be null if none DraftMessage *DraftMessage `json:"draft_message"` // The new chat positions in the chat lists Positions []*ChatPosition `json:"positions"` @@ -41702,6 +63099,35 @@ func (*UpdateChatDraftMessage) UpdateType() string { return TypeUpdateChatDraftMessage } +// Chat emoji status has changed +type UpdateChatEmojiStatus struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new chat emoji status; may be null + EmojiStatus *EmojiStatus `json:"emoji_status"` +} + +func (entity *UpdateChatEmojiStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatEmojiStatus + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatEmojiStatus) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatEmojiStatus) GetType() string { + return TypeUpdateChatEmojiStatus +} + +func (*UpdateChatEmojiStatus) UpdateType() string { + return TypeUpdateChatEmojiStatus +} + // The message sender that is selected to send messages in a chat has changed type UpdateChatMessageSender struct { meta @@ -41900,8 +63326,8 @@ type UpdateChatTheme struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // The new name of the chat theme; may be empty if theme was reset to default - ThemeName string `json:"theme_name"` + // The new theme of the chat; may be null if theme was reset to default + Theme ChatTheme `json:"theme"` } func (entity *UpdateChatTheme) MarshalJSON() ([]byte, error) { @@ -41924,6 +63350,25 @@ func (*UpdateChatTheme) UpdateType() string { return TypeUpdateChatTheme } +func (updateChatTheme *UpdateChatTheme) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + Theme json.RawMessage `json:"theme"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateChatTheme.ChatId = tmp.ChatId + + fieldTheme, _ := UnmarshalChatTheme(tmp.Theme) + updateChatTheme.Theme = fieldTheme + + return nil +} + // The chat unread_mention_count has changed type UpdateChatUnreadMentionCount struct { meta @@ -42127,6 +63572,35 @@ func (*UpdateChatIsMarkedAsUnread) UpdateType() string { return TypeUpdateChatIsMarkedAsUnread } +// A chat default appearance has changed +type UpdateChatViewAsTopics struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of view_as_topics + ViewAsTopics bool `json:"view_as_topics"` +} + +func (entity *UpdateChatViewAsTopics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatViewAsTopics + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatViewAsTopics) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatViewAsTopics) GetType() string { + return TypeUpdateChatViewAsTopics +} + +func (*UpdateChatViewAsTopics) UpdateType() string { + return TypeUpdateChatViewAsTopics +} + // A chat was blocked or unblocked type UpdateChatBlockList struct { meta @@ -42211,6 +63685,8 @@ type UpdateChatFolders struct { ChatFolders []*ChatFolderInfo `json:"chat_folders"` // Position of the main chat list among chat folders, 0-based MainChatListPosition int32 `json:"main_chat_list_position"` + // True, if folder tags are enabled + AreTagsEnabled bool `json:"are_tags_enabled"` } func (entity *UpdateChatFolders) MarshalJSON() ([]byte, error) { @@ -42233,7 +63709,7 @@ func (*UpdateChatFolders) UpdateType() string { return TypeUpdateChatFolders } -// The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. There is no guarantee that it will be sent just after the number of online users has changed +// The number of online group members has changed. This update with non-zero number of online group members is sent only for currently opened chats. There is no guarantee that it is sent just after the number of online users has changed type UpdateChatOnlineMemberCount struct { meta // Identifier of the chat @@ -42262,11 +63738,252 @@ func (*UpdateChatOnlineMemberCount) UpdateType() string { return TypeUpdateChatOnlineMemberCount } +// Basic information about a Saved Messages topic has changed. This update is guaranteed to come before the topic identifier is returned to the application +type UpdateSavedMessagesTopic struct { + meta + // New data about the topic + Topic *SavedMessagesTopic `json:"topic"` +} + +func (entity *UpdateSavedMessagesTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSavedMessagesTopic + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSavedMessagesTopic) GetClass() string { + return ClassUpdate +} + +func (*UpdateSavedMessagesTopic) GetType() string { + return TypeUpdateSavedMessagesTopic +} + +func (*UpdateSavedMessagesTopic) UpdateType() string { + return TypeUpdateSavedMessagesTopic +} + +// Number of Saved Messages topics has changed +type UpdateSavedMessagesTopicCount struct { + meta + // Approximate total number of Saved Messages topics + TopicCount int32 `json:"topic_count"` +} + +func (entity *UpdateSavedMessagesTopicCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSavedMessagesTopicCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSavedMessagesTopicCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateSavedMessagesTopicCount) GetType() string { + return TypeUpdateSavedMessagesTopicCount +} + +func (*UpdateSavedMessagesTopicCount) UpdateType() string { + return TypeUpdateSavedMessagesTopicCount +} + +// Basic information about a topic in a channel direct messages chat administered by the current user has changed. This update is guaranteed to come before the topic identifier is returned to the application +type UpdateDirectMessagesChatTopic struct { + meta + // New data about the topic + Topic *DirectMessagesChatTopic `json:"topic"` +} + +func (entity *UpdateDirectMessagesChatTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateDirectMessagesChatTopic + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateDirectMessagesChatTopic) GetClass() string { + return ClassUpdate +} + +func (*UpdateDirectMessagesChatTopic) GetType() string { + return TypeUpdateDirectMessagesChatTopic +} + +func (*UpdateDirectMessagesChatTopic) UpdateType() string { + return TypeUpdateDirectMessagesChatTopic +} + +// Number of messages in a topic has changed; for Saved Messages and channel direct messages chat topics only +type UpdateTopicMessageCount struct { + meta + // Identifier of the chat in topic of which the number of messages has changed + ChatId int64 `json:"chat_id"` + // Identifier of the topic + TopicId MessageTopic `json:"topic_id"` + // Approximate number of messages in the topic + MessageCount int32 `json:"message_count"` +} + +func (entity *UpdateTopicMessageCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTopicMessageCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTopicMessageCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateTopicMessageCount) GetType() string { + return TypeUpdateTopicMessageCount +} + +func (*UpdateTopicMessageCount) UpdateType() string { + return TypeUpdateTopicMessageCount +} + +func (updateTopicMessageCount *UpdateTopicMessageCount) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + TopicId json.RawMessage `json:"topic_id"` + MessageCount int32 `json:"message_count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateTopicMessageCount.ChatId = tmp.ChatId + updateTopicMessageCount.MessageCount = tmp.MessageCount + + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + updateTopicMessageCount.TopicId = fieldTopicId + + return nil +} + +// Basic information about a quick reply shortcut has changed. This update is guaranteed to come before the quick shortcut name is returned to the application +type UpdateQuickReplyShortcut struct { + meta + // New data about the shortcut + Shortcut *QuickReplyShortcut `json:"shortcut"` +} + +func (entity *UpdateQuickReplyShortcut) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateQuickReplyShortcut + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateQuickReplyShortcut) GetClass() string { + return ClassUpdate +} + +func (*UpdateQuickReplyShortcut) GetType() string { + return TypeUpdateQuickReplyShortcut +} + +func (*UpdateQuickReplyShortcut) UpdateType() string { + return TypeUpdateQuickReplyShortcut +} + +// A quick reply shortcut and all its messages were deleted +type UpdateQuickReplyShortcutDeleted struct { + meta + // The identifier of the deleted shortcut + ShortcutId int32 `json:"shortcut_id"` +} + +func (entity *UpdateQuickReplyShortcutDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateQuickReplyShortcutDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateQuickReplyShortcutDeleted) GetClass() string { + return ClassUpdate +} + +func (*UpdateQuickReplyShortcutDeleted) GetType() string { + return TypeUpdateQuickReplyShortcutDeleted +} + +func (*UpdateQuickReplyShortcutDeleted) UpdateType() string { + return TypeUpdateQuickReplyShortcutDeleted +} + +// The list of quick reply shortcuts has changed +type UpdateQuickReplyShortcuts struct { + meta + // The new list of identifiers of quick reply shortcuts + ShortcutIds []int32 `json:"shortcut_ids"` +} + +func (entity *UpdateQuickReplyShortcuts) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateQuickReplyShortcuts + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateQuickReplyShortcuts) GetClass() string { + return ClassUpdate +} + +func (*UpdateQuickReplyShortcuts) GetType() string { + return TypeUpdateQuickReplyShortcuts +} + +func (*UpdateQuickReplyShortcuts) UpdateType() string { + return TypeUpdateQuickReplyShortcuts +} + +// The list of quick reply shortcut messages has changed +type UpdateQuickReplyShortcutMessages struct { + meta + // The identifier of the shortcut + ShortcutId int32 `json:"shortcut_id"` + // The new list of quick reply messages for the shortcut in order from the first to the last sent + Messages []*QuickReplyMessage `json:"messages"` +} + +func (entity *UpdateQuickReplyShortcutMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateQuickReplyShortcutMessages + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateQuickReplyShortcutMessages) GetClass() string { + return ClassUpdate +} + +func (*UpdateQuickReplyShortcutMessages) GetType() string { + return TypeUpdateQuickReplyShortcutMessages +} + +func (*UpdateQuickReplyShortcutMessages) UpdateType() string { + return TypeUpdateQuickReplyShortcutMessages +} + // Basic information about a topic in a forum chat was changed type UpdateForumTopicInfo struct { meta - // Chat identifier - ChatId int64 `json:"chat_id"` // New information about the topic Info *ForumTopicInfo `json:"info"` } @@ -42291,6 +64008,49 @@ func (*UpdateForumTopicInfo) UpdateType() string { return TypeUpdateForumTopicInfo } +// Information about a topic in a forum chat was changed +type UpdateForumTopic struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Forum topic identifier of the topic + ForumTopicId int32 `json:"forum_topic_id"` + // True, if the topic is pinned in the topic list + IsPinned bool `json:"is_pinned"` + // Identifier of the last read incoming message + LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` + // Identifier of the last read outgoing message + LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` + // Number of unread messages with a mention/reply in the topic + UnreadMentionCount int32 `json:"unread_mention_count"` + // Number of messages with unread reactions in the topic + UnreadReactionCount int32 `json:"unread_reaction_count"` + // Notification settings for the topic + NotificationSettings *ChatNotificationSettings `json:"notification_settings"` + // A draft of a message in the topic; may be null if none + DraftMessage *DraftMessage `json:"draft_message"` +} + +func (entity *UpdateForumTopic) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateForumTopic + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateForumTopic) GetClass() string { + return ClassUpdate +} + +func (*UpdateForumTopic) GetType() string { + return TypeUpdateForumTopic +} + +func (*UpdateForumTopic) UpdateType() string { + return TypeUpdateForumTopic +} + // Notification settings for some type of chats were updated type UpdateScopeNotificationSettings struct { meta @@ -42339,6 +64099,33 @@ func (updateScopeNotificationSettings *UpdateScopeNotificationSettings) Unmarsha return nil } +// Notification settings for reactions were updated +type UpdateReactionNotificationSettings struct { + meta + // The new notification settings + NotificationSettings *ReactionNotificationSettings `json:"notification_settings"` +} + +func (entity *UpdateReactionNotificationSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateReactionNotificationSettings + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateReactionNotificationSettings) GetClass() string { + return ClassUpdate +} + +func (*UpdateReactionNotificationSettings) GetType() string { + return TypeUpdateReactionNotificationSettings +} + +func (*UpdateReactionNotificationSettings) UpdateType() string { + return TypeUpdateReactionNotificationSettings +} + // A notification was changed type UpdateNotification struct { meta @@ -42440,7 +64227,7 @@ func (updateNotificationGroup *UpdateNotificationGroup) UnmarshalJSON(data []byt return nil } -// Contains active notifications that was shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update +// Contains active notifications that were shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update type UpdateActiveNotifications struct { meta // Lists of active notification groups @@ -42534,8 +64321,8 @@ type UpdateChatAction struct { meta // Chat identifier ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the action was performed - MessageThreadId int64 `json:"message_thread_id"` + // Identifier of the specific topic in which the action was performed; may be null if none + TopicId MessageTopic `json:"topic_id"` // Identifier of a message sender performing the action SenderId MessageSender `json:"sender_id"` // The action @@ -42565,7 +64352,7 @@ func (*UpdateChatAction) UpdateType() string { func (updateChatAction *UpdateChatAction) UnmarshalJSON(data []byte) error { var tmp struct { ChatId int64 `json:"chat_id"` - MessageThreadId int64 `json:"message_thread_id"` + TopicId json.RawMessage `json:"topic_id"` SenderId json.RawMessage `json:"sender_id"` Action json.RawMessage `json:"action"` } @@ -42576,7 +64363,9 @@ func (updateChatAction *UpdateChatAction) UnmarshalJSON(data []byte) error { } updateChatAction.ChatId = tmp.ChatId - updateChatAction.MessageThreadId = tmp.MessageThreadId + + fieldTopicId, _ := UnmarshalMessageTopic(tmp.TopicId) + updateChatAction.TopicId = fieldTopicId fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) updateChatAction.SenderId = fieldSenderId @@ -42587,6 +64376,39 @@ func (updateChatAction *UpdateChatAction) UnmarshalJSON(data []byte) error { return nil } +// A new pending text message was received in a chat with a bot. The message must be shown in the chat for at most getOption("pending_text_message_period") seconds, replace any other pending message with the same draft_id, and be deleted whenever any incoming message from the bot in the message thread is received +type UpdatePendingTextMessage struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The forum topic identifier in which the message will be sent; 0 if none + ForumTopicId int32 `json:"forum_topic_id"` + // Unique identifier of the message draft within the message thread + DraftId JsonInt64 `json:"draft_id"` + // Text of the pending message + Text *FormattedText `json:"text"` +} + +func (entity *UpdatePendingTextMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdatePendingTextMessage + + return json.Marshal((*stub)(entity)) +} + +func (*UpdatePendingTextMessage) GetClass() string { + return ClassUpdate +} + +func (*UpdatePendingTextMessage) GetType() string { + return TypeUpdatePendingTextMessage +} + +func (*UpdatePendingTextMessage) UpdateType() string { + return TypeUpdatePendingTextMessage +} + // The user went online or offline type UpdateUserStatus struct { meta @@ -42905,16 +64727,16 @@ func (*UpdateFile) UpdateType() string { return TypeUpdateFile } -// The file generation process needs to be started by the application +// The file generation process needs to be started by the application. Use setFileGenerationProgress and finishFileGeneration to generate the file type UpdateFileGenerationStart struct { meta // Unique identifier for the generation process GenerationId JsonInt64 `json:"generation_id"` - // The path to a file from which a new file is generated; may be empty + // The original path specified by the application in inputFileGenerated OriginalPath string `json:"original_path"` - // The path to a file that must be created and where the new file is generated + // The path to a file that must be created and where the new file must be generated by the application. If the application has no access to the path, it can use writeGeneratedFilePart to generate the file DestinationPath string `json:"destination_path"` - // String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file, which must be downloaded by the application + // If the conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file that must be downloaded by the application. Otherwise, this is the conversion specified by the application in inputFileGenerated Conversion string `json:"conversion"` } @@ -43087,6 +64909,68 @@ func (*UpdateFileRemovedFromDownloads) UpdateType() string { return TypeUpdateFileRemovedFromDownloads } +// A request can't be completed unless application verification is performed; for official mobile applications only. The method setApplicationVerificationToken must be called once the verification is completed or failed +type UpdateApplicationVerificationRequired struct { + meta + // Unique identifier for the verification process + VerificationId int64 `json:"verification_id"` + // Unique base64url-encoded nonce for the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) for Android, or a unique string to compare with verify_nonce field from a push notification for iOS + Nonce string `json:"nonce"` + // Cloud project number to pass to the Play Integrity API on Android + CloudProjectNumber JsonInt64 `json:"cloud_project_number"` +} + +func (entity *UpdateApplicationVerificationRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateApplicationVerificationRequired + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateApplicationVerificationRequired) GetClass() string { + return ClassUpdate +} + +func (*UpdateApplicationVerificationRequired) GetType() string { + return TypeUpdateApplicationVerificationRequired +} + +func (*UpdateApplicationVerificationRequired) UpdateType() string { + return TypeUpdateApplicationVerificationRequired +} + +// A request can't be completed unless reCAPTCHA verification is performed; for official mobile applications only. The method setApplicationVerificationToken must be called once the verification is completed or failed +type UpdateApplicationRecaptchaVerificationRequired struct { + meta + // Unique identifier for the verification process + VerificationId int64 `json:"verification_id"` + // The action for the check + Action string `json:"action"` + // Identifier of the reCAPTCHA key + RecaptchaKeyId string `json:"recaptcha_key_id"` +} + +func (entity *UpdateApplicationRecaptchaVerificationRequired) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateApplicationRecaptchaVerificationRequired + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateApplicationRecaptchaVerificationRequired) GetClass() string { + return ClassUpdate +} + +func (*UpdateApplicationRecaptchaVerificationRequired) GetType() string { + return TypeUpdateApplicationRecaptchaVerificationRequired +} + +func (*UpdateApplicationRecaptchaVerificationRequired) UpdateType() string { + return TypeUpdateApplicationRecaptchaVerificationRequired +} + // New call was created or information about a call was updated type UpdateCall struct { meta @@ -43117,7 +65001,7 @@ func (*UpdateCall) UpdateType() string { // Information about a group call was updated type UpdateGroupCall struct { meta - // New data about a group call + // New data about the group call GroupCall *GroupCall `json:"group_call"` } @@ -43144,9 +65028,9 @@ func (*UpdateGroupCall) UpdateType() string { // Information about a group call participant was changed. The updates are sent only after the group call is received through getGroupCall and only if the call is joined or being joined type UpdateGroupCallParticipant struct { meta - // Identifier of group call + // Identifier of the group call GroupCallId int32 `json:"group_call_id"` - // New data about a participant + // New data about the participant Participant *GroupCallParticipant `json:"participant"` } @@ -43170,6 +65054,236 @@ func (*UpdateGroupCallParticipant) UpdateType() string { return TypeUpdateGroupCallParticipant } +// The list of group call participants that can send and receive encrypted call data has changed; for group calls not bound to a chat only +type UpdateGroupCallParticipants struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // New list of group call participant user identifiers. The identifiers may be invalid or the corresponding users may be unknown. The participants must be shown in the list of group call participants even if there is no information about them + ParticipantUserIds []JsonInt64 `json:"participant_user_ids"` +} + +func (entity *UpdateGroupCallParticipants) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateGroupCallParticipants + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateGroupCallParticipants) GetClass() string { + return ClassUpdate +} + +func (*UpdateGroupCallParticipants) GetType() string { + return TypeUpdateGroupCallParticipants +} + +func (*UpdateGroupCallParticipants) UpdateType() string { + return TypeUpdateGroupCallParticipants +} + +// The verification state of an encrypted group call has changed; for group calls not bound to a chat only +type UpdateGroupCallVerificationState struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // The call state generation to which the emoji corresponds. If generation is different for two users, then their emoji may be also different + Generation int32 `json:"generation"` + // Group call state fingerprint represented as 4 emoji; may be empty if the state isn't verified yet + Emojis []string `json:"emojis"` +} + +func (entity *UpdateGroupCallVerificationState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateGroupCallVerificationState + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateGroupCallVerificationState) GetClass() string { + return ClassUpdate +} + +func (*UpdateGroupCallVerificationState) GetType() string { + return TypeUpdateGroupCallVerificationState +} + +func (*UpdateGroupCallVerificationState) UpdateType() string { + return TypeUpdateGroupCallVerificationState +} + +// A new message was received in a group call +type UpdateNewGroupCallMessage struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // The message + Message *GroupCallMessage `json:"message"` +} + +func (entity *UpdateNewGroupCallMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewGroupCallMessage + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewGroupCallMessage) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewGroupCallMessage) GetType() string { + return TypeUpdateNewGroupCallMessage +} + +func (*UpdateNewGroupCallMessage) UpdateType() string { + return TypeUpdateNewGroupCallMessage +} + +// A new paid reaction was received in a live story group call +type UpdateNewGroupCallPaidReaction struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // Identifier of the sender of the reaction + SenderId MessageSender `json:"sender_id"` + // The number of Telegram Stars that were paid to send the reaction + StarCount int64 `json:"star_count"` +} + +func (entity *UpdateNewGroupCallPaidReaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewGroupCallPaidReaction + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewGroupCallPaidReaction) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewGroupCallPaidReaction) GetType() string { + return TypeUpdateNewGroupCallPaidReaction +} + +func (*UpdateNewGroupCallPaidReaction) UpdateType() string { + return TypeUpdateNewGroupCallPaidReaction +} + +func (updateNewGroupCallPaidReaction *UpdateNewGroupCallPaidReaction) UnmarshalJSON(data []byte) error { + var tmp struct { + GroupCallId int32 `json:"group_call_id"` + SenderId json.RawMessage `json:"sender_id"` + StarCount int64 `json:"star_count"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateNewGroupCallPaidReaction.GroupCallId = tmp.GroupCallId + updateNewGroupCallPaidReaction.StarCount = tmp.StarCount + + fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) + updateNewGroupCallPaidReaction.SenderId = fieldSenderId + + return nil +} + +// A group call message failed to send +type UpdateGroupCallMessageSendFailed struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // Message identifier + MessageId int32 `json:"message_id"` + // The cause of the message sending failure + Error *Error `json:"error"` +} + +func (entity *UpdateGroupCallMessageSendFailed) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateGroupCallMessageSendFailed + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateGroupCallMessageSendFailed) GetClass() string { + return ClassUpdate +} + +func (*UpdateGroupCallMessageSendFailed) GetType() string { + return TypeUpdateGroupCallMessageSendFailed +} + +func (*UpdateGroupCallMessageSendFailed) UpdateType() string { + return TypeUpdateGroupCallMessageSendFailed +} + +// Some group call messages were deleted +type UpdateGroupCallMessagesDeleted struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // Identifiers of the deleted messages + MessageIds []int32 `json:"message_ids"` +} + +func (entity *UpdateGroupCallMessagesDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateGroupCallMessagesDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateGroupCallMessagesDeleted) GetClass() string { + return ClassUpdate +} + +func (*UpdateGroupCallMessagesDeleted) GetType() string { + return TypeUpdateGroupCallMessagesDeleted +} + +func (*UpdateGroupCallMessagesDeleted) UpdateType() string { + return TypeUpdateGroupCallMessagesDeleted +} + +// The list of top donors in live story group call has changed +type UpdateLiveStoryTopDonors struct { + meta + // Identifier of the group call + GroupCallId int32 `json:"group_call_id"` + // New list of live story donors + Donors *LiveStoryDonors `json:"donors"` +} + +func (entity *UpdateLiveStoryTopDonors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateLiveStoryTopDonors + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateLiveStoryTopDonors) GetClass() string { + return ClassUpdate +} + +func (*UpdateLiveStoryTopDonors) GetType() string { + return TypeUpdateLiveStoryTopDonors +} + +func (*UpdateLiveStoryTopDonors) UpdateType() string { + return TypeUpdateLiveStoryTopDonors +} + // New call signaling data arrived type UpdateNewCallSignalingData struct { meta @@ -43199,6 +65313,60 @@ func (*UpdateNewCallSignalingData) UpdateType() string { return TypeUpdateNewCallSignalingData } +// State of a gift auction was updated +type UpdateGiftAuctionState struct { + meta + // New state of the auction + State *GiftAuctionState `json:"state"` +} + +func (entity *UpdateGiftAuctionState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateGiftAuctionState + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateGiftAuctionState) GetClass() string { + return ClassUpdate +} + +func (*UpdateGiftAuctionState) GetType() string { + return TypeUpdateGiftAuctionState +} + +func (*UpdateGiftAuctionState) UpdateType() string { + return TypeUpdateGiftAuctionState +} + +// The list of auctions in which participate the current user has changed +type UpdateActiveGiftAuctions struct { + meta + // New states of the auctions + States []*GiftAuctionState `json:"states"` +} + +func (entity *UpdateActiveGiftAuctions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateActiveGiftAuctions + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateActiveGiftAuctions) GetClass() string { + return ClassUpdate +} + +func (*UpdateActiveGiftAuctions) GetType() string { + return TypeUpdateActiveGiftAuctions +} + +func (*UpdateActiveGiftAuctions) UpdateType() string { + return TypeUpdateActiveGiftAuctions +} + // Some privacy setting rules have been changed type UpdateUserPrivacySettingRules struct { meta @@ -43394,7 +65562,7 @@ func (*UpdateStory) UpdateType() string { type UpdateStoryDeleted struct { meta // Identifier of the chat that posted the story - StorySenderChatId int64 `json:"story_sender_chat_id"` + StoryPosterChatId int64 `json:"story_poster_chat_id"` // Story identifier StoryId int32 `json:"story_id"` } @@ -43419,67 +65587,67 @@ func (*UpdateStoryDeleted) UpdateType() string { return TypeUpdateStoryDeleted } -// A story has been successfully sent -type UpdateStorySendSucceeded struct { +// A story has been successfully posted +type UpdateStoryPostSucceeded struct { meta - // The sent story + // The posted story Story *Story `json:"story"` // The previous temporary story identifier OldStoryId int32 `json:"old_story_id"` } -func (entity *UpdateStorySendSucceeded) MarshalJSON() ([]byte, error) { +func (entity *UpdateStoryPostSucceeded) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateStorySendSucceeded + type stub UpdateStoryPostSucceeded return json.Marshal((*stub)(entity)) } -func (*UpdateStorySendSucceeded) GetClass() string { +func (*UpdateStoryPostSucceeded) GetClass() string { return ClassUpdate } -func (*UpdateStorySendSucceeded) GetType() string { - return TypeUpdateStorySendSucceeded +func (*UpdateStoryPostSucceeded) GetType() string { + return TypeUpdateStoryPostSucceeded } -func (*UpdateStorySendSucceeded) UpdateType() string { - return TypeUpdateStorySendSucceeded +func (*UpdateStoryPostSucceeded) UpdateType() string { + return TypeUpdateStoryPostSucceeded } -// A story failed to send. If the story sending is canceled, then updateStoryDeleted will be received instead of this update -type UpdateStorySendFailed struct { +// A story failed to post. If the story posting is canceled, then updateStoryDeleted will be received instead of this update +type UpdateStoryPostFailed struct { meta - // The failed to send story + // The failed to post story Story *Story `json:"story"` - // The cause of the story sending failure + // The cause of the story posting failure Error *Error `json:"error"` // Type of the error; may be null if unknown - ErrorType CanSendStoryResult `json:"error_type"` + ErrorType CanPostStoryResult `json:"error_type"` } -func (entity *UpdateStorySendFailed) MarshalJSON() ([]byte, error) { +func (entity *UpdateStoryPostFailed) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateStorySendFailed + type stub UpdateStoryPostFailed return json.Marshal((*stub)(entity)) } -func (*UpdateStorySendFailed) GetClass() string { +func (*UpdateStoryPostFailed) GetClass() string { return ClassUpdate } -func (*UpdateStorySendFailed) GetType() string { - return TypeUpdateStorySendFailed +func (*UpdateStoryPostFailed) GetType() string { + return TypeUpdateStoryPostFailed } -func (*UpdateStorySendFailed) UpdateType() string { - return TypeUpdateStorySendFailed +func (*UpdateStoryPostFailed) UpdateType() string { + return TypeUpdateStoryPostFailed } -func (updateStorySendFailed *UpdateStorySendFailed) UnmarshalJSON(data []byte) error { +func (updateStoryPostFailed *UpdateStoryPostFailed) UnmarshalJSON(data []byte) error { var tmp struct { Story *Story `json:"story"` Error *Error `json:"error"` @@ -43491,11 +65659,11 @@ func (updateStorySendFailed *UpdateStorySendFailed) UnmarshalJSON(data []byte) e return err } - updateStorySendFailed.Story = tmp.Story - updateStorySendFailed.Error = tmp.Error + updateStoryPostFailed.Story = tmp.Story + updateStoryPostFailed.Error = tmp.Error - fieldErrorType, _ := UnmarshalCanSendStoryResult(tmp.ErrorType) - updateStorySendFailed.ErrorType = fieldErrorType + fieldErrorType, _ := UnmarshalCanPostStoryResult(tmp.ErrorType) + updateStoryPostFailed.ErrorType = fieldErrorType return nil } @@ -43604,6 +65772,33 @@ func (*UpdateStoryStealthMode) UpdateType() string { return TypeUpdateStoryStealthMode } +// Lists of bots which Mini Apps must be allowed to read text from clipboard and must be opened without a warning +type UpdateTrustedMiniAppBots struct { + meta + // List of user identifiers of the bots; the corresponding users may not be sent using updateUser updates and may not be accessible + BotUserIds []int64 `json:"bot_user_ids"` +} + +func (entity *UpdateTrustedMiniAppBots) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTrustedMiniAppBots + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTrustedMiniAppBots) GetClass() string { + return ClassUpdate +} + +func (*UpdateTrustedMiniAppBots) GetType() string { + return TypeUpdateTrustedMiniAppBots +} + +func (*UpdateTrustedMiniAppBots) UpdateType() string { + return TypeUpdateTrustedMiniAppBots +} + // An option changed its value type UpdateOption struct { meta @@ -43858,7 +66053,7 @@ func (*UpdateSavedAnimations) UpdateType() string { return TypeUpdateSavedAnimations } -// The list of saved notifications sounds was updated. This update may not be sent until information about a notification sound was requested for the first time +// The list of saved notification sounds was updated. This update may not be sent until information about a notification sound was requested for the first time type UpdateSavedNotificationSounds struct { meta // The new list of identifiers of saved notification sounds @@ -43885,60 +66080,60 @@ func (*UpdateSavedNotificationSounds) UpdateType() string { return TypeUpdateSavedNotificationSounds } -// The selected background has changed -type UpdateSelectedBackground struct { +// The default background has changed +type UpdateDefaultBackground struct { meta - // True, if background for dark theme has changed + // True, if default background for dark theme has changed ForDarkTheme bool `json:"for_dark_theme"` - // The new selected background; may be null + // The new default background; may be null Background *Background `json:"background"` } -func (entity *UpdateSelectedBackground) MarshalJSON() ([]byte, error) { +func (entity *UpdateDefaultBackground) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateSelectedBackground + type stub UpdateDefaultBackground return json.Marshal((*stub)(entity)) } -func (*UpdateSelectedBackground) GetClass() string { +func (*UpdateDefaultBackground) GetClass() string { return ClassUpdate } -func (*UpdateSelectedBackground) GetType() string { - return TypeUpdateSelectedBackground +func (*UpdateDefaultBackground) GetType() string { + return TypeUpdateDefaultBackground } -func (*UpdateSelectedBackground) UpdateType() string { - return TypeUpdateSelectedBackground +func (*UpdateDefaultBackground) UpdateType() string { + return TypeUpdateDefaultBackground } -// The list of available chat themes has changed -type UpdateChatThemes struct { +// The list of available emoji chat themes has changed +type UpdateEmojiChatThemes struct { meta - // The new list of chat themes - ChatThemes []*ChatTheme `json:"chat_themes"` + // The new list of emoji chat themes + ChatThemes []*EmojiChatTheme `json:"chat_themes"` } -func (entity *UpdateChatThemes) MarshalJSON() ([]byte, error) { +func (entity *UpdateEmojiChatThemes) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateChatThemes + type stub UpdateEmojiChatThemes return json.Marshal((*stub)(entity)) } -func (*UpdateChatThemes) GetClass() string { +func (*UpdateEmojiChatThemes) GetClass() string { return ClassUpdate } -func (*UpdateChatThemes) GetType() string { - return TypeUpdateChatThemes +func (*UpdateEmojiChatThemes) GetType() string { + return TypeUpdateEmojiChatThemes } -func (*UpdateChatThemes) UpdateType() string { - return TypeUpdateChatThemes +func (*UpdateEmojiChatThemes) UpdateType() string { + return TypeUpdateEmojiChatThemes } // The list of supported accent colors has changed @@ -43946,7 +66141,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"` } @@ -43970,6 +66165,35 @@ func (*UpdateAccentColors) UpdateType() string { return TypeUpdateAccentColors } +// The list of supported accent colors for user profiles has changed +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 specified order + AvailableAccentColorIds []int32 `json:"available_accent_color_ids"` +} + +func (entity *UpdateProfileAccentColors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateProfileAccentColors + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateProfileAccentColors) GetClass() string { + return ClassUpdate +} + +func (*UpdateProfileAccentColors) GetType() string { + return TypeUpdateProfileAccentColors +} + +func (*UpdateProfileAccentColors) UpdateType() string { + return TypeUpdateProfileAccentColors +} + // Some language pack strings have been updated type UpdateLanguagePackStrings struct { meta @@ -44044,6 +66268,66 @@ func (updateConnectionState *UpdateConnectionState) UnmarshalJSON(data []byte) e return nil } +// The freeze state of the current user's account has changed +type UpdateFreezeState struct { + meta + // True, if the account is frozen + IsFrozen bool `json:"is_frozen"` + // Point in time (Unix timestamp) when the account was frozen; 0 if the account isn't frozen + FreezingDate int32 `json:"freezing_date"` + // Point in time (Unix timestamp) when the account will be deleted and can't be unfrozen; 0 if the account isn't frozen + DeletionDate int32 `json:"deletion_date"` + // The link to open to send an appeal to unfreeze the account + AppealLink string `json:"appeal_link"` +} + +func (entity *UpdateFreezeState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateFreezeState + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateFreezeState) GetClass() string { + return ClassUpdate +} + +func (*UpdateFreezeState) GetType() string { + return TypeUpdateFreezeState +} + +func (*UpdateFreezeState) UpdateType() string { + return TypeUpdateFreezeState +} + +// The parameters for age verification of the current user's account has changed +type UpdateAgeVerificationParameters struct { + meta + // Parameters for the age verification; may be null if age verification isn't needed + Parameters *AgeVerificationParameters `json:"parameters"` +} + +func (entity *UpdateAgeVerificationParameters) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAgeVerificationParameters + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAgeVerificationParameters) GetClass() string { + return ClassUpdate +} + +func (*UpdateAgeVerificationParameters) GetType() string { + return TypeUpdateAgeVerificationParameters +} + +func (*UpdateAgeVerificationParameters) UpdateType() string { + return TypeUpdateAgeVerificationParameters +} + // New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method must be called with the reason "Decline ToS update" type UpdateTermsOfService struct { meta @@ -44073,33 +66357,6 @@ func (*UpdateTermsOfService) UpdateType() string { return TypeUpdateTermsOfService } -// The list of users nearby has changed. The update is guaranteed to be sent only 60 seconds after a successful searchChatsNearby request -type UpdateUsersNearby struct { - meta - // The new list of users nearby - UsersNearby []*ChatNearby `json:"users_nearby"` -} - -func (entity *UpdateUsersNearby) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UpdateUsersNearby - - return json.Marshal((*stub)(entity)) -} - -func (*UpdateUsersNearby) GetClass() string { - return ClassUpdate -} - -func (*UpdateUsersNearby) GetType() string { - return TypeUpdateUsersNearby -} - -func (*UpdateUsersNearby) UpdateType() string { - return TypeUpdateUsersNearby -} - // The first unconfirmed session has changed type UpdateUnconfirmedSession struct { meta @@ -44208,6 +66465,35 @@ func (*UpdateActiveEmojiReactions) UpdateType() string { return TypeUpdateActiveEmojiReactions } +// The list of available message effects has changed +type UpdateAvailableMessageEffects struct { + meta + // The new list of available message effects from emoji reactions + ReactionEffectIds []JsonInt64 `json:"reaction_effect_ids"` + // The new list of available message effects from Premium stickers + StickerEffectIds []JsonInt64 `json:"sticker_effect_ids"` +} + +func (entity *UpdateAvailableMessageEffects) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateAvailableMessageEffects + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateAvailableMessageEffects) GetClass() string { + return ClassUpdate +} + +func (*UpdateAvailableMessageEffects) GetType() string { + return TypeUpdateAvailableMessageEffects +} + +func (*UpdateAvailableMessageEffects) UpdateType() string { + return TypeUpdateAvailableMessageEffects +} + // The type of default reaction has changed type UpdateDefaultReactionType struct { meta @@ -44251,6 +66537,323 @@ func (updateDefaultReactionType *UpdateDefaultReactionType) UnmarshalJSON(data [ return nil } +// The type of default paid reaction has changed +type UpdateDefaultPaidReactionType struct { + meta + // The new type of the default paid reaction + Type PaidReactionType `json:"type"` +} + +func (entity *UpdateDefaultPaidReactionType) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateDefaultPaidReactionType + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateDefaultPaidReactionType) GetClass() string { + return ClassUpdate +} + +func (*UpdateDefaultPaidReactionType) GetType() string { + return TypeUpdateDefaultPaidReactionType +} + +func (*UpdateDefaultPaidReactionType) UpdateType() string { + return TypeUpdateDefaultPaidReactionType +} + +func (updateDefaultPaidReactionType *UpdateDefaultPaidReactionType) UnmarshalJSON(data []byte) error { + var tmp struct { + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldType, _ := UnmarshalPaidReactionType(tmp.Type) + updateDefaultPaidReactionType.Type = fieldType + + return nil +} + +// Tags used in Saved Messages or a Saved Messages topic have changed +type UpdateSavedMessagesTags struct { + meta + // Identifier of Saved Messages topic which tags were changed; 0 if tags for the whole chat has changed + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` + // The new tags + Tags *SavedMessagesTags `json:"tags"` +} + +func (entity *UpdateSavedMessagesTags) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSavedMessagesTags + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSavedMessagesTags) GetClass() string { + return ClassUpdate +} + +func (*UpdateSavedMessagesTags) GetType() string { + return TypeUpdateSavedMessagesTags +} + +func (*UpdateSavedMessagesTags) UpdateType() string { + return TypeUpdateSavedMessagesTags +} + +// The list of messages with active live location that need to be updated by the application has changed. The list is persistent across application restarts only if the message database is used +type UpdateActiveLiveLocationMessages struct { + meta + // The list of messages with active live locations + Messages []*Message `json:"messages"` +} + +func (entity *UpdateActiveLiveLocationMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateActiveLiveLocationMessages + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateActiveLiveLocationMessages) GetClass() string { + return ClassUpdate +} + +func (*UpdateActiveLiveLocationMessages) GetType() string { + return TypeUpdateActiveLiveLocationMessages +} + +func (*UpdateActiveLiveLocationMessages) UpdateType() string { + return TypeUpdateActiveLiveLocationMessages +} + +// The number of Telegram Stars owned by the current user has changed +type UpdateOwnedStarCount struct { + meta + // The new amount of owned Telegram Stars + StarAmount *StarAmount `json:"star_amount"` +} + +func (entity *UpdateOwnedStarCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateOwnedStarCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateOwnedStarCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateOwnedStarCount) GetType() string { + return TypeUpdateOwnedStarCount +} + +func (*UpdateOwnedStarCount) UpdateType() string { + return TypeUpdateOwnedStarCount +} + +// The number of Toncoins owned by the current user has changed +type UpdateOwnedTonCount struct { + meta + // The new amount of owned Toncoins; in the smallest units of the cryptocurrency + TonAmount int64 `json:"ton_amount"` +} + +func (entity *UpdateOwnedTonCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateOwnedTonCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateOwnedTonCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateOwnedTonCount) GetType() string { + return TypeUpdateOwnedTonCount +} + +func (*UpdateOwnedTonCount) UpdateType() string { + return TypeUpdateOwnedTonCount +} + +// 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 +type UpdateChatRevenueAmount struct { + meta + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // New amount of earned revenue + RevenueAmount *ChatRevenueAmount `json:"revenue_amount"` +} + +func (entity *UpdateChatRevenueAmount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatRevenueAmount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatRevenueAmount) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatRevenueAmount) GetType() string { + return TypeUpdateChatRevenueAmount +} + +func (*UpdateChatRevenueAmount) UpdateType() string { + return TypeUpdateChatRevenueAmount +} + +// The Telegram Star revenue earned by a user or a chat has changed. If Telegram Star transaction screen of the chat is opened, then getStarTransactions may be called to fetch new transactions +type UpdateStarRevenueStatus struct { + meta + // Identifier of the owner of the Telegram Stars + OwnerId MessageSender `json:"owner_id"` + // New Telegram Star revenue status + Status *StarRevenueStatus `json:"status"` +} + +func (entity *UpdateStarRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateStarRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateStarRevenueStatus) GetClass() string { + return ClassUpdate +} + +func (*UpdateStarRevenueStatus) GetType() string { + return TypeUpdateStarRevenueStatus +} + +func (*UpdateStarRevenueStatus) UpdateType() string { + return TypeUpdateStarRevenueStatus +} + +func (updateStarRevenueStatus *UpdateStarRevenueStatus) UnmarshalJSON(data []byte) error { + var tmp struct { + OwnerId json.RawMessage `json:"owner_id"` + Status *StarRevenueStatus `json:"status"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateStarRevenueStatus.Status = tmp.Status + + fieldOwnerId, _ := UnmarshalMessageSender(tmp.OwnerId) + updateStarRevenueStatus.OwnerId = fieldOwnerId + + return nil +} + +// The Toncoin revenue earned by the current user has changed. If Toncoin transaction screen of the chat is opened, then getTonTransactions may be called to fetch new transactions +type UpdateTonRevenueStatus struct { + meta + // New Toncoin revenue status + Status *TonRevenueStatus `json:"status"` +} + +func (entity *UpdateTonRevenueStatus) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTonRevenueStatus + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTonRevenueStatus) GetClass() string { + return ClassUpdate +} + +func (*UpdateTonRevenueStatus) GetType() string { + return TypeUpdateTonRevenueStatus +} + +func (*UpdateTonRevenueStatus) UpdateType() string { + return TypeUpdateTonRevenueStatus +} + +// The parameters of speech recognition without Telegram Premium subscription has changed +type UpdateSpeechRecognitionTrial struct { + meta + // The maximum allowed duration of media for speech recognition without Telegram Premium subscription, in seconds + MaxMediaDuration int32 `json:"max_media_duration"` + // The total number of allowed speech recognitions per week; 0 if none + WeeklyCount int32 `json:"weekly_count"` + // Number of left speech recognition attempts this week + LeftCount int32 `json:"left_count"` + // Point in time (Unix timestamp) when the weekly number of tries will reset; 0 if unknown + NextResetDate int32 `json:"next_reset_date"` +} + +func (entity *UpdateSpeechRecognitionTrial) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateSpeechRecognitionTrial + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateSpeechRecognitionTrial) GetClass() string { + return ClassUpdate +} + +func (*UpdateSpeechRecognitionTrial) GetType() string { + return TypeUpdateSpeechRecognitionTrial +} + +func (*UpdateSpeechRecognitionTrial) UpdateType() string { + return TypeUpdateSpeechRecognitionTrial +} + +// The levels of live story group call messages have changed +type UpdateGroupCallMessageLevels struct { + meta + // New description of the levels in decreasing order of groupCallMessageLevel.min_star_count + Levels []*GroupCallMessageLevel `json:"levels"` +} + +func (entity *UpdateGroupCallMessageLevels) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateGroupCallMessageLevels + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateGroupCallMessageLevels) GetClass() string { + return ClassUpdate +} + +func (*UpdateGroupCallMessageLevels) GetType() string { + return TypeUpdateGroupCallMessageLevels +} + +func (*UpdateGroupCallMessageLevels) UpdateType() string { + return TypeUpdateGroupCallMessageLevels +} + // The list of supported dice emojis has changed type UpdateDiceEmojis struct { meta @@ -44278,6 +66881,33 @@ func (*UpdateDiceEmojis) UpdateType() string { return TypeUpdateDiceEmojis } +// The stake dice state has changed +type UpdateStakeDiceState struct { + meta + // The new state. The state can be used only if it was received recently enough. Otherwise, a new state must be requested using getStakeDiceState + State *StakeDiceState `json:"state"` +} + +func (entity *UpdateStakeDiceState) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateStakeDiceState + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateStakeDiceState) GetClass() string { + return ClassUpdate +} + +func (*UpdateStakeDiceState) GetType() string { + return TypeUpdateStakeDiceState +} + +func (*UpdateStakeDiceState) UpdateType() string { + return TypeUpdateStakeDiceState +} + // Some animated emoji message was clicked and a big animated sticker must be played if the message is visible on the screen. chatActionWatchingAnimations with the text of the message needs to be sent if the sticker is played type UpdateAnimatedEmojiMessageClicked struct { meta @@ -44387,33 +67017,58 @@ func (updateSuggestedActions *UpdateSuggestedActions) UnmarshalJSON(data []byte) return nil } -// Adding users to a chat has failed because of their privacy settings. An invite link can be shared with the users if appropriate -type UpdateAddChatMembersPrivacyForbidden struct { +// Download or upload file speed for the user was limited, but it can be restored by subscription to Telegram Premium. The notification can be postponed until a being downloaded or uploaded file is visible to the user. Use getOption("premium_download_speedup") or getOption("premium_upload_speedup") to get expected speedup after subscription to Telegram Premium +type UpdateSpeedLimitNotification struct { meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // Identifiers of users, which weren't added because of their privacy settings - UserIds []int64 `json:"user_ids"` + // True, if upload speed was limited; false, if download speed was limited + IsUpload bool `json:"is_upload"` } -func (entity *UpdateAddChatMembersPrivacyForbidden) MarshalJSON() ([]byte, error) { +func (entity *UpdateSpeedLimitNotification) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateAddChatMembersPrivacyForbidden + type stub UpdateSpeedLimitNotification return json.Marshal((*stub)(entity)) } -func (*UpdateAddChatMembersPrivacyForbidden) GetClass() string { +func (*UpdateSpeedLimitNotification) GetClass() string { return ClassUpdate } -func (*UpdateAddChatMembersPrivacyForbidden) GetType() string { - return TypeUpdateAddChatMembersPrivacyForbidden +func (*UpdateSpeedLimitNotification) GetType() string { + return TypeUpdateSpeedLimitNotification } -func (*UpdateAddChatMembersPrivacyForbidden) UpdateType() string { - return TypeUpdateAddChatMembersPrivacyForbidden +func (*UpdateSpeedLimitNotification) UpdateType() string { + return TypeUpdateSpeedLimitNotification +} + +// The list of contacts that had birthdays recently or will have birthday soon has changed +type UpdateContactCloseBirthdays struct { + meta + // List of contact users with close birthday + CloseBirthdayUsers []*CloseBirthdayUser `json:"close_birthday_users"` +} + +func (entity *UpdateContactCloseBirthdays) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateContactCloseBirthdays + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateContactCloseBirthdays) GetClass() string { + return ClassUpdate +} + +func (*UpdateContactCloseBirthdays) GetType() string { + return TypeUpdateContactCloseBirthdays +} + +func (*UpdateContactCloseBirthdays) UpdateType() string { + return TypeUpdateContactCloseBirthdays } // Autosave settings for some type of chats were updated @@ -44464,6 +67119,122 @@ func (updateAutosaveSettings *UpdateAutosaveSettings) UnmarshalJSON(data []byte) return nil } +// A business connection has changed; for bots only +type UpdateBusinessConnection struct { + meta + // New data about the connection + Connection *BusinessConnection `json:"connection"` +} + +func (entity *UpdateBusinessConnection) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateBusinessConnection + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateBusinessConnection) GetClass() string { + return ClassUpdate +} + +func (*UpdateBusinessConnection) GetType() string { + return TypeUpdateBusinessConnection +} + +func (*UpdateBusinessConnection) UpdateType() string { + return TypeUpdateBusinessConnection +} + +// A new message was added to a business account; for bots only +type UpdateNewBusinessMessage struct { + meta + // Unique identifier of the business connection + ConnectionId string `json:"connection_id"` + // The new message + Message *BusinessMessage `json:"message"` +} + +func (entity *UpdateNewBusinessMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewBusinessMessage + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewBusinessMessage) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewBusinessMessage) GetType() string { + return TypeUpdateNewBusinessMessage +} + +func (*UpdateNewBusinessMessage) UpdateType() string { + return TypeUpdateNewBusinessMessage +} + +// A message in a business account was edited; for bots only +type UpdateBusinessMessageEdited struct { + meta + // Unique identifier of the business connection + ConnectionId string `json:"connection_id"` + // The edited message + Message *BusinessMessage `json:"message"` +} + +func (entity *UpdateBusinessMessageEdited) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateBusinessMessageEdited + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateBusinessMessageEdited) GetClass() string { + return ClassUpdate +} + +func (*UpdateBusinessMessageEdited) GetType() string { + return TypeUpdateBusinessMessageEdited +} + +func (*UpdateBusinessMessageEdited) UpdateType() string { + return TypeUpdateBusinessMessageEdited +} + +// Messages in a business account were deleted; for bots only +type UpdateBusinessMessagesDeleted struct { + meta + // Unique identifier of the business connection + ConnectionId string `json:"connection_id"` + // Identifier of a chat in the business account in which messages were deleted + ChatId int64 `json:"chat_id"` + // Unique message identifiers of the deleted messages + MessageIds []int64 `json:"message_ids"` +} + +func (entity *UpdateBusinessMessagesDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateBusinessMessagesDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateBusinessMessagesDeleted) GetClass() string { + return ClassUpdate +} + +func (*UpdateBusinessMessagesDeleted) GetType() string { + return TypeUpdateBusinessMessagesDeleted +} + +func (*UpdateBusinessMessagesDeleted) UpdateType() string { + return TypeUpdateBusinessMessagesDeleted +} + // A new incoming inline query; for bots only type UpdateNewInlineQuery struct { meta @@ -44687,6 +67458,70 @@ func (updateNewInlineCallbackQuery *UpdateNewInlineCallbackQuery) UnmarshalJSON( return nil } +// A new incoming callback query from a business message; for bots only +type UpdateNewBusinessCallbackQuery struct { + meta + // Unique query identifier + Id JsonInt64 `json:"id"` + // Identifier of the user who sent the query + SenderUserId int64 `json:"sender_user_id"` + // Unique identifier of the business connection + ConnectionId string `json:"connection_id"` + // The message from the business account from which the query originated + Message *BusinessMessage `json:"message"` + // An identifier uniquely corresponding to the chat a message was sent to + ChatInstance JsonInt64 `json:"chat_instance"` + // Query payload + Payload CallbackQueryPayload `json:"payload"` +} + +func (entity *UpdateNewBusinessCallbackQuery) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNewBusinessCallbackQuery + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNewBusinessCallbackQuery) GetClass() string { + return ClassUpdate +} + +func (*UpdateNewBusinessCallbackQuery) GetType() string { + return TypeUpdateNewBusinessCallbackQuery +} + +func (*UpdateNewBusinessCallbackQuery) UpdateType() string { + return TypeUpdateNewBusinessCallbackQuery +} + +func (updateNewBusinessCallbackQuery *UpdateNewBusinessCallbackQuery) UnmarshalJSON(data []byte) error { + var tmp struct { + Id JsonInt64 `json:"id"` + SenderUserId int64 `json:"sender_user_id"` + ConnectionId string `json:"connection_id"` + Message *BusinessMessage `json:"message"` + ChatInstance JsonInt64 `json:"chat_instance"` + Payload json.RawMessage `json:"payload"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateNewBusinessCallbackQuery.Id = tmp.Id + updateNewBusinessCallbackQuery.SenderUserId = tmp.SenderUserId + updateNewBusinessCallbackQuery.ConnectionId = tmp.ConnectionId + updateNewBusinessCallbackQuery.Message = tmp.Message + updateNewBusinessCallbackQuery.ChatInstance = tmp.ChatInstance + + fieldPayload, _ := UnmarshalCallbackQueryPayload(tmp.Payload) + updateNewBusinessCallbackQuery.Payload = fieldPayload + + return nil +} + // A new incoming shipping query; for bots only. Only for invoices with flexible price type UpdateNewShippingQuery struct { meta @@ -44903,10 +67738,12 @@ type UpdateChatMember struct { ChatId int64 `json:"chat_id"` // Identifier of the user, changing the rights ActorUserId int64 `json:"actor_user_id"` - // Point in time (Unix timestamp) when the user rights was changed + // Point in time (Unix timestamp) when the user rights were changed Date int32 `json:"date"` // If user has joined the chat using an invite link, the invite link; may be null InviteLink *ChatInviteLink `json:"invite_link"` + // True, if the user has joined the chat after sending a join request and being approved by an administrator + ViaJoinRequest bool `json:"via_join_request"` // True, if the user has joined the chat using an invite link for a chat folder ViaChatFolderInviteLink bool `json:"via_chat_folder_invite_link"` // Previous chat member @@ -44997,6 +67834,136 @@ func (*UpdateChatBoost) UpdateType() string { return TypeUpdateChatBoost } +// User changed its reactions on a message with public reactions; for bots only +type UpdateMessageReaction struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // Identifier of the user or chat that changed reactions + ActorId MessageSender `json:"actor_id"` + // Point in time (Unix timestamp) when the reactions were changed + Date int32 `json:"date"` + // Old list of chosen reactions + OldReactionTypes []ReactionType `json:"old_reaction_types"` + // New list of chosen reactions + NewReactionTypes []ReactionType `json:"new_reaction_types"` +} + +func (entity *UpdateMessageReaction) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageReaction + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageReaction) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageReaction) GetType() string { + return TypeUpdateMessageReaction +} + +func (*UpdateMessageReaction) UpdateType() string { + return TypeUpdateMessageReaction +} + +func (updateMessageReaction *UpdateMessageReaction) UnmarshalJSON(data []byte) error { + var tmp struct { + ChatId int64 `json:"chat_id"` + MessageId int64 `json:"message_id"` + ActorId json.RawMessage `json:"actor_id"` + Date int32 `json:"date"` + OldReactionTypes []json.RawMessage `json:"old_reaction_types"` + NewReactionTypes []json.RawMessage `json:"new_reaction_types"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateMessageReaction.ChatId = tmp.ChatId + updateMessageReaction.MessageId = tmp.MessageId + updateMessageReaction.Date = tmp.Date + + fieldActorId, _ := UnmarshalMessageSender(tmp.ActorId) + updateMessageReaction.ActorId = fieldActorId + + fieldOldReactionTypes, _ := UnmarshalListOfReactionType(tmp.OldReactionTypes) + updateMessageReaction.OldReactionTypes = fieldOldReactionTypes + + fieldNewReactionTypes, _ := UnmarshalListOfReactionType(tmp.NewReactionTypes) + updateMessageReaction.NewReactionTypes = fieldNewReactionTypes + + return nil +} + +// Reactions added to a message with anonymous reactions have changed; for bots only +type UpdateMessageReactions struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // Message identifier + MessageId int64 `json:"message_id"` + // Point in time (Unix timestamp) when the reactions were changed + Date int32 `json:"date"` + // The list of reactions added to the message + Reactions []*MessageReaction `json:"reactions"` +} + +func (entity *UpdateMessageReactions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateMessageReactions + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateMessageReactions) GetClass() string { + return ClassUpdate +} + +func (*UpdateMessageReactions) GetType() string { + return TypeUpdateMessageReactions +} + +func (*UpdateMessageReactions) UpdateType() string { + return TypeUpdateMessageReactions +} + +// Paid media were purchased by a user; for bots only +type UpdatePaidMediaPurchased struct { + meta + // User identifier + UserId int64 `json:"user_id"` + // Bot-specified payload for the paid media + Payload string `json:"payload"` +} + +func (entity *UpdatePaidMediaPurchased) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdatePaidMediaPurchased + + return json.Marshal((*stub)(entity)) +} + +func (*UpdatePaidMediaPurchased) GetClass() string { + return ClassUpdate +} + +func (*UpdatePaidMediaPurchased) GetType() string { + return TypeUpdatePaidMediaPurchased +} + +func (*UpdatePaidMediaPurchased) UpdateType() string { + return TypeUpdatePaidMediaPurchased +} + // Contains a list of updates type Updates struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 3af611e..5319fa2 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -22,6 +22,12 @@ func UnmarshalAuthenticationCodeType(data json.RawMessage) (AuthenticationCodeTy case TypeAuthenticationCodeTypeSms: return UnmarshalAuthenticationCodeTypeSms(data) + case TypeAuthenticationCodeTypeSmsWord: + return UnmarshalAuthenticationCodeTypeSmsWord(data) + + case TypeAuthenticationCodeTypeSmsPhrase: + return UnmarshalAuthenticationCodeTypeSmsPhrase(data) + case TypeAuthenticationCodeTypeCall: return UnmarshalAuthenticationCodeTypeCall(data) @@ -145,6 +151,9 @@ func UnmarshalAuthorizationState(data json.RawMessage) (AuthorizationState, erro case TypeAuthorizationStateWaitPhoneNumber: return UnmarshalAuthorizationStateWaitPhoneNumber(data) + case TypeAuthorizationStateWaitPremiumPurchase: + return UnmarshalAuthorizationStateWaitPremiumPurchase(data) + case TypeAuthorizationStateWaitEmailAddress: return UnmarshalAuthorizationStateWaitEmailAddress(data) @@ -194,6 +203,40 @@ func UnmarshalListOfAuthorizationState(dataList []json.RawMessage) ([]Authorizat return list, nil } +func UnmarshalFirebaseDeviceVerificationParameters(data json.RawMessage) (FirebaseDeviceVerificationParameters, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeFirebaseDeviceVerificationParametersSafetyNet: + return UnmarshalFirebaseDeviceVerificationParametersSafetyNet(data) + + case TypeFirebaseDeviceVerificationParametersPlayIntegrity: + return UnmarshalFirebaseDeviceVerificationParametersPlayIntegrity(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfFirebaseDeviceVerificationParameters(dataList []json.RawMessage) ([]FirebaseDeviceVerificationParameters, error) { + list := []FirebaseDeviceVerificationParameters{} + + for _, data := range dataList { + entity, err := UnmarshalFirebaseDeviceVerificationParameters(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputFile(data json.RawMessage) (InputFile, error) { var meta meta @@ -468,6 +511,58 @@ func UnmarshalListOfPollType(dataList []json.RawMessage) ([]PollType, error) { return list, nil } +func UnmarshalProfileTab(data json.RawMessage) (ProfileTab, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeProfileTabPosts: + return UnmarshalProfileTabPosts(data) + + case TypeProfileTabGifts: + return UnmarshalProfileTabGifts(data) + + case TypeProfileTabMedia: + return UnmarshalProfileTabMedia(data) + + case TypeProfileTabFiles: + return UnmarshalProfileTabFiles(data) + + case TypeProfileTabLinks: + return UnmarshalProfileTabLinks(data) + + case TypeProfileTabMusic: + return UnmarshalProfileTabMusic(data) + + case TypeProfileTabVoice: + return UnmarshalProfileTabVoice(data) + + case TypeProfileTabGifs: + return UnmarshalProfileTabGifs(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfProfileTab(dataList []json.RawMessage) ([]ProfileTab, error) { + list := []ProfileTab{} + + for _, data := range dataList { + entity, err := UnmarshalProfileTab(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUserType(data json.RawMessage) (UserType, error) { var meta meta @@ -508,6 +603,43 @@ func UnmarshalListOfUserType(dataList []json.RawMessage) ([]UserType, error) { return list, nil } +func UnmarshalBusinessAwayMessageSchedule(data json.RawMessage) (BusinessAwayMessageSchedule, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBusinessAwayMessageScheduleAlways: + return UnmarshalBusinessAwayMessageScheduleAlways(data) + + case TypeBusinessAwayMessageScheduleOutsideOfOpeningHours: + return UnmarshalBusinessAwayMessageScheduleOutsideOfOpeningHours(data) + + case TypeBusinessAwayMessageScheduleCustom: + return UnmarshalBusinessAwayMessageScheduleCustom(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBusinessAwayMessageSchedule(dataList []json.RawMessage) ([]BusinessAwayMessageSchedule, error) { + list := []BusinessAwayMessageSchedule{} + + for _, data := range dataList { + entity, err := UnmarshalBusinessAwayMessageSchedule(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatPhotoStickerType(data json.RawMessage) (ChatPhotoStickerType, error) { var meta meta @@ -582,7 +714,7 @@ func UnmarshalListOfInputChatPhoto(dataList []json.RawMessage) ([]InputChatPhoto return list, nil } -func UnmarshalPremiumGiveawayParticipantStatus(data json.RawMessage) (PremiumGiveawayParticipantStatus, error) { +func UnmarshalGiftResalePrice(data json.RawMessage) (GiftResalePrice, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -591,31 +723,22 @@ func UnmarshalPremiumGiveawayParticipantStatus(data json.RawMessage) (PremiumGiv } switch meta.Type { - case TypePremiumGiveawayParticipantStatusEligible: - return UnmarshalPremiumGiveawayParticipantStatusEligible(data) + case TypeGiftResalePriceStar: + return UnmarshalGiftResalePriceStar(data) - case TypePremiumGiveawayParticipantStatusParticipating: - return UnmarshalPremiumGiveawayParticipantStatusParticipating(data) - - case TypePremiumGiveawayParticipantStatusAlreadyWasMember: - return UnmarshalPremiumGiveawayParticipantStatusAlreadyWasMember(data) - - case TypePremiumGiveawayParticipantStatusAdministrator: - return UnmarshalPremiumGiveawayParticipantStatusAdministrator(data) - - case TypePremiumGiveawayParticipantStatusDisallowedCountry: - return UnmarshalPremiumGiveawayParticipantStatusDisallowedCountry(data) + case TypeGiftResalePriceTon: + return UnmarshalGiftResalePriceTon(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfPremiumGiveawayParticipantStatus(dataList []json.RawMessage) ([]PremiumGiveawayParticipantStatus, error) { - list := []PremiumGiveawayParticipantStatus{} +func UnmarshalListOfGiftResalePrice(dataList []json.RawMessage) ([]GiftResalePrice, error) { + list := []GiftResalePrice{} for _, data := range dataList { - entity, err := UnmarshalPremiumGiveawayParticipantStatus(data) + entity, err := UnmarshalGiftResalePrice(data) if err != nil { return nil, err } @@ -625,7 +748,7 @@ func UnmarshalListOfPremiumGiveawayParticipantStatus(dataList []json.RawMessage) return list, nil } -func UnmarshalPremiumGiveawayInfo(data json.RawMessage) (PremiumGiveawayInfo, error) { +func UnmarshalGiftPurchaseOfferState(data json.RawMessage) (GiftPurchaseOfferState, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -634,22 +757,1014 @@ func UnmarshalPremiumGiveawayInfo(data json.RawMessage) (PremiumGiveawayInfo, er } switch meta.Type { - case TypePremiumGiveawayInfoOngoing: - return UnmarshalPremiumGiveawayInfoOngoing(data) + case TypeGiftPurchaseOfferStatePending: + return UnmarshalGiftPurchaseOfferStatePending(data) - case TypePremiumGiveawayInfoCompleted: - return UnmarshalPremiumGiveawayInfoCompleted(data) + case TypeGiftPurchaseOfferStateAccepted: + return UnmarshalGiftPurchaseOfferStateAccepted(data) + + case TypeGiftPurchaseOfferStateRejected: + return UnmarshalGiftPurchaseOfferStateRejected(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfPremiumGiveawayInfo(dataList []json.RawMessage) ([]PremiumGiveawayInfo, error) { - list := []PremiumGiveawayInfo{} +func UnmarshalListOfGiftPurchaseOfferState(dataList []json.RawMessage) ([]GiftPurchaseOfferState, error) { + list := []GiftPurchaseOfferState{} for _, data := range dataList { - entity, err := UnmarshalPremiumGiveawayInfo(data) + entity, err := UnmarshalGiftPurchaseOfferState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSuggestedPostPrice(data json.RawMessage) (SuggestedPostPrice, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostPriceStar: + return UnmarshalSuggestedPostPriceStar(data) + + case TypeSuggestedPostPriceTon: + return UnmarshalSuggestedPostPriceTon(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostPrice(dataList []json.RawMessage) ([]SuggestedPostPrice, error) { + list := []SuggestedPostPrice{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostPrice(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSuggestedPostState(data json.RawMessage) (SuggestedPostState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostStatePending: + return UnmarshalSuggestedPostStatePending(data) + + case TypeSuggestedPostStateApproved: + return UnmarshalSuggestedPostStateApproved(data) + + case TypeSuggestedPostStateDeclined: + return UnmarshalSuggestedPostStateDeclined(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostState(dataList []json.RawMessage) ([]SuggestedPostState, error) { + list := []SuggestedPostState{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSuggestedPostRefundReason(data json.RawMessage) (SuggestedPostRefundReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSuggestedPostRefundReasonPostDeleted: + return UnmarshalSuggestedPostRefundReasonPostDeleted(data) + + case TypeSuggestedPostRefundReasonPaymentRefunded: + return UnmarshalSuggestedPostRefundReasonPaymentRefunded(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSuggestedPostRefundReason(dataList []json.RawMessage) ([]SuggestedPostRefundReason, error) { + list := []SuggestedPostRefundReason{} + + for _, data := range dataList { + entity, err := UnmarshalSuggestedPostRefundReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalStarSubscriptionType(data json.RawMessage) (StarSubscriptionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStarSubscriptionTypeChannel: + return UnmarshalStarSubscriptionTypeChannel(data) + + case TypeStarSubscriptionTypeBot: + return UnmarshalStarSubscriptionTypeBot(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStarSubscriptionType(dataList []json.RawMessage) ([]StarSubscriptionType, error) { + list := []StarSubscriptionType{} + + for _, data := range dataList { + entity, err := UnmarshalStarSubscriptionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalAffiliateType(data json.RawMessage) (AffiliateType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeAffiliateTypeCurrentUser: + return UnmarshalAffiliateTypeCurrentUser(data) + + case TypeAffiliateTypeBot: + return UnmarshalAffiliateTypeBot(data) + + case TypeAffiliateTypeChannel: + return UnmarshalAffiliateTypeChannel(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfAffiliateType(dataList []json.RawMessage) ([]AffiliateType, error) { + list := []AffiliateType{} + + for _, data := range dataList { + entity, err := UnmarshalAffiliateType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + 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 UnmarshalCanSendGiftResult(data json.RawMessage) (CanSendGiftResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCanSendGiftResult(dataList []json.RawMessage) ([]CanSendGiftResult, error) { + list := []CanSendGiftResult{} + + for _, data := range dataList { + entity, err := UnmarshalCanSendGiftResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalUpgradedGiftOrigin(data json.RawMessage) (UpgradedGiftOrigin, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUpgradedGiftOriginUpgrade: + return UnmarshalUpgradedGiftOriginUpgrade(data) + + case TypeUpgradedGiftOriginTransfer: + return UnmarshalUpgradedGiftOriginTransfer(data) + + case TypeUpgradedGiftOriginResale: + return UnmarshalUpgradedGiftOriginResale(data) + + case TypeUpgradedGiftOriginBlockchain: + return UnmarshalUpgradedGiftOriginBlockchain(data) + + case TypeUpgradedGiftOriginPrepaidUpgrade: + return UnmarshalUpgradedGiftOriginPrepaidUpgrade(data) + + case TypeUpgradedGiftOriginOffer: + return UnmarshalUpgradedGiftOriginOffer(data) + + case TypeUpgradedGiftOriginCraft: + return UnmarshalUpgradedGiftOriginCraft(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUpgradedGiftOrigin(dataList []json.RawMessage) ([]UpgradedGiftOrigin, error) { + list := []UpgradedGiftOrigin{} + + for _, data := range dataList { + entity, err := UnmarshalUpgradedGiftOrigin(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalUpgradedGiftAttributeRarity(data json.RawMessage) (UpgradedGiftAttributeRarity, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUpgradedGiftAttributeRarityPerMille: + return UnmarshalUpgradedGiftAttributeRarityPerMille(data) + + case TypeUpgradedGiftAttributeRarityUncommon: + return UnmarshalUpgradedGiftAttributeRarityUncommon(data) + + case TypeUpgradedGiftAttributeRarityRare: + return UnmarshalUpgradedGiftAttributeRarityRare(data) + + case TypeUpgradedGiftAttributeRarityEpic: + return UnmarshalUpgradedGiftAttributeRarityEpic(data) + + case TypeUpgradedGiftAttributeRarityLegendary: + return UnmarshalUpgradedGiftAttributeRarityLegendary(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUpgradedGiftAttributeRarity(dataList []json.RawMessage) ([]UpgradedGiftAttributeRarity, error) { + list := []UpgradedGiftAttributeRarity{} + + for _, data := range dataList { + entity, err := UnmarshalUpgradedGiftAttributeRarity(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalCraftGiftResult(data json.RawMessage) (CraftGiftResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCraftGiftResultSuccess: + return UnmarshalCraftGiftResultSuccess(data) + + case TypeCraftGiftResultTooEarly: + return UnmarshalCraftGiftResultTooEarly(data) + + case TypeCraftGiftResultInvalidGift: + return UnmarshalCraftGiftResultInvalidGift(data) + + case TypeCraftGiftResultFail: + return UnmarshalCraftGiftResultFail(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCraftGiftResult(dataList []json.RawMessage) ([]CraftGiftResult, error) { + list := []CraftGiftResult{} + + for _, data := range dataList { + entity, err := UnmarshalCraftGiftResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalUpgradedGiftAttributeId(data json.RawMessage) (UpgradedGiftAttributeId, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeUpgradedGiftAttributeIdModel: + return UnmarshalUpgradedGiftAttributeIdModel(data) + + case TypeUpgradedGiftAttributeIdSymbol: + return UnmarshalUpgradedGiftAttributeIdSymbol(data) + + case TypeUpgradedGiftAttributeIdBackdrop: + return UnmarshalUpgradedGiftAttributeIdBackdrop(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfUpgradedGiftAttributeId(dataList []json.RawMessage) ([]UpgradedGiftAttributeId, error) { + list := []UpgradedGiftAttributeId{} + + for _, data := range dataList { + entity, err := UnmarshalUpgradedGiftAttributeId(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGiftForResaleOrder(data json.RawMessage) (GiftForResaleOrder, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiftForResaleOrderPrice: + return UnmarshalGiftForResaleOrderPrice(data) + + case TypeGiftForResaleOrderPriceChangeDate: + return UnmarshalGiftForResaleOrderPriceChangeDate(data) + + case TypeGiftForResaleOrderNumber: + return UnmarshalGiftForResaleOrderNumber(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiftForResaleOrder(dataList []json.RawMessage) ([]GiftForResaleOrder, error) { + list := []GiftForResaleOrder{} + + for _, data := range dataList { + entity, err := UnmarshalGiftForResaleOrder(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGiftResaleResult(data json.RawMessage) (GiftResaleResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiftResaleResult(dataList []json.RawMessage) ([]GiftResaleResult, error) { + list := []GiftResaleResult{} + + for _, data := range dataList { + entity, err := UnmarshalGiftResaleResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSentGift(data json.RawMessage) (SentGift, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSentGiftRegular: + return UnmarshalSentGiftRegular(data) + + case TypeSentGiftUpgraded: + return UnmarshalSentGiftUpgraded(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSentGift(dataList []json.RawMessage) ([]SentGift, error) { + list := []SentGift{} + + for _, data := range dataList { + entity, err := UnmarshalSentGift(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalAuctionState(data json.RawMessage) (AuctionState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeAuctionStateActive: + return UnmarshalAuctionStateActive(data) + + case TypeAuctionStateFinished: + return UnmarshalAuctionStateFinished(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfAuctionState(dataList []json.RawMessage) ([]AuctionState, error) { + list := []AuctionState{} + + for _, data := range dataList { + entity, err := UnmarshalAuctionState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalTransactionDirection(data json.RawMessage) (TransactionDirection, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTransactionDirectionIncoming: + return UnmarshalTransactionDirectionIncoming(data) + + case TypeTransactionDirectionOutgoing: + return UnmarshalTransactionDirectionOutgoing(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTransactionDirection(dataList []json.RawMessage) ([]TransactionDirection, error) { + list := []TransactionDirection{} + + for _, data := range dataList { + entity, err := UnmarshalTransactionDirection(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalStarTransactionType(data json.RawMessage) (StarTransactionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStarTransactionTypePremiumBotDeposit: + return UnmarshalStarTransactionTypePremiumBotDeposit(data) + + case TypeStarTransactionTypeAppStoreDeposit: + return UnmarshalStarTransactionTypeAppStoreDeposit(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 TypeStarTransactionTypeGiftAuctionBid: + return UnmarshalStarTransactionTypeGiftAuctionBid(data) + + case TypeStarTransactionTypeGiftPurchase: + return UnmarshalStarTransactionTypeGiftPurchase(data) + + case TypeStarTransactionTypeGiftPurchaseOffer: + return UnmarshalStarTransactionTypeGiftPurchaseOffer(data) + + case TypeStarTransactionTypeGiftTransfer: + return UnmarshalStarTransactionTypeGiftTransfer(data) + + case TypeStarTransactionTypeGiftOriginalDetailsDrop: + return UnmarshalStarTransactionTypeGiftOriginalDetailsDrop(data) + + case TypeStarTransactionTypeGiftSale: + return UnmarshalStarTransactionTypeGiftSale(data) + + case TypeStarTransactionTypeGiftUpgrade: + return UnmarshalStarTransactionTypeGiftUpgrade(data) + + case TypeStarTransactionTypeGiftUpgradePurchase: + return UnmarshalStarTransactionTypeGiftUpgradePurchase(data) + + case TypeStarTransactionTypeUpgradedGiftPurchase: + return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) + + case TypeStarTransactionTypeUpgradedGiftSale: + return UnmarshalStarTransactionTypeUpgradedGiftSale(data) + + case TypeStarTransactionTypeChannelPaidReactionSend: + return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) + + case TypeStarTransactionTypeChannelPaidReactionReceive: + return UnmarshalStarTransactionTypeChannelPaidReactionReceive(data) + + case TypeStarTransactionTypeAffiliateProgramCommission: + return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + + case TypeStarTransactionTypePaidMessageSend: + return UnmarshalStarTransactionTypePaidMessageSend(data) + + case TypeStarTransactionTypePaidMessageReceive: + return UnmarshalStarTransactionTypePaidMessageReceive(data) + + case TypeStarTransactionTypePaidGroupCallMessageSend: + return UnmarshalStarTransactionTypePaidGroupCallMessageSend(data) + + case TypeStarTransactionTypePaidGroupCallMessageReceive: + return UnmarshalStarTransactionTypePaidGroupCallMessageReceive(data) + + case TypeStarTransactionTypePaidGroupCallReactionSend: + return UnmarshalStarTransactionTypePaidGroupCallReactionSend(data) + + case TypeStarTransactionTypePaidGroupCallReactionReceive: + return UnmarshalStarTransactionTypePaidGroupCallReactionReceive(data) + + case TypeStarTransactionTypeSuggestedPostPaymentSend: + return UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data) + + case TypeStarTransactionTypeSuggestedPostPaymentReceive: + return UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data) + + case TypeStarTransactionTypePremiumPurchase: + return UnmarshalStarTransactionTypePremiumPurchase(data) + + case TypeStarTransactionTypeBusinessBotTransferSend: + return UnmarshalStarTransactionTypeBusinessBotTransferSend(data) + + case TypeStarTransactionTypeBusinessBotTransferReceive: + return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + + case TypeStarTransactionTypePublicPostSearch: + return UnmarshalStarTransactionTypePublicPostSearch(data) + + case TypeStarTransactionTypeUnsupported: + return UnmarshalStarTransactionTypeUnsupported(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStarTransactionType(dataList []json.RawMessage) ([]StarTransactionType, error) { + list := []StarTransactionType{} + + for _, data := range dataList { + entity, err := UnmarshalStarTransactionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalTonTransactionType(data json.RawMessage) (TonTransactionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTonTransactionTypeFragmentDeposit: + return UnmarshalTonTransactionTypeFragmentDeposit(data) + + case TypeTonTransactionTypeFragmentWithdrawal: + return UnmarshalTonTransactionTypeFragmentWithdrawal(data) + + case TypeTonTransactionTypeSuggestedPostPayment: + return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + + case TypeTonTransactionTypeGiftPurchaseOffer: + return UnmarshalTonTransactionTypeGiftPurchaseOffer(data) + + case TypeTonTransactionTypeUpgradedGiftPurchase: + return UnmarshalTonTransactionTypeUpgradedGiftPurchase(data) + + case TypeTonTransactionTypeUpgradedGiftSale: + return UnmarshalTonTransactionTypeUpgradedGiftSale(data) + + case TypeTonTransactionTypeStakeDiceStake: + return UnmarshalTonTransactionTypeStakeDiceStake(data) + + case TypeTonTransactionTypeStakeDicePayout: + return UnmarshalTonTransactionTypeStakeDicePayout(data) + + case TypeTonTransactionTypeUnsupported: + return UnmarshalTonTransactionTypeUnsupported(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTonTransactionType(dataList []json.RawMessage) ([]TonTransactionType, error) { + list := []TonTransactionType{} + + for _, data := range dataList { + entity, err := UnmarshalTonTransactionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalActiveStoryState(data json.RawMessage) (ActiveStoryState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeActiveStoryStateLive: + return UnmarshalActiveStoryStateLive(data) + + case TypeActiveStoryStateUnread: + return UnmarshalActiveStoryStateUnread(data) + + case TypeActiveStoryStateRead: + return UnmarshalActiveStoryStateRead(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfActiveStoryState(dataList []json.RawMessage) ([]ActiveStoryState, error) { + list := []ActiveStoryState{} + + for _, data := range dataList { + entity, err := UnmarshalActiveStoryState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGiveawayParticipantStatus(data json.RawMessage) (GiveawayParticipantStatus, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiveawayParticipantStatusEligible: + return UnmarshalGiveawayParticipantStatusEligible(data) + + case TypeGiveawayParticipantStatusParticipating: + return UnmarshalGiveawayParticipantStatusParticipating(data) + + case TypeGiveawayParticipantStatusAlreadyWasMember: + return UnmarshalGiveawayParticipantStatusAlreadyWasMember(data) + + case TypeGiveawayParticipantStatusAdministrator: + return UnmarshalGiveawayParticipantStatusAdministrator(data) + + case TypeGiveawayParticipantStatusDisallowedCountry: + return UnmarshalGiveawayParticipantStatusDisallowedCountry(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiveawayParticipantStatus(dataList []json.RawMessage) ([]GiveawayParticipantStatus, error) { + list := []GiveawayParticipantStatus{} + + for _, data := range dataList { + entity, err := UnmarshalGiveawayParticipantStatus(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGiveawayInfo(data json.RawMessage) (GiveawayInfo, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiveawayInfoOngoing: + return UnmarshalGiveawayInfoOngoing(data) + + case TypeGiveawayInfoCompleted: + return UnmarshalGiveawayInfoCompleted(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiveawayInfo(dataList []json.RawMessage) ([]GiveawayInfo, error) { + list := []GiveawayInfo{} + + for _, data := range dataList { + entity, err := UnmarshalGiveawayInfo(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGiveawayPrize(data json.RawMessage) (GiveawayPrize, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGiveawayPrizePremium: + return UnmarshalGiveawayPrizePremium(data) + + case TypeGiveawayPrizeStars: + return UnmarshalGiveawayPrizeStars(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGiveawayPrize(dataList []json.RawMessage) ([]GiveawayPrize, error) { + list := []GiveawayPrize{} + + for _, data := range dataList { + entity, err := UnmarshalGiveawayPrize(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalEmojiStatusType(data json.RawMessage) (EmojiStatusType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeEmojiStatusTypeCustomEmoji: + return UnmarshalEmojiStatusTypeCustomEmoji(data) + + case TypeEmojiStatusTypeUpgradedGift: + return UnmarshalEmojiStatusTypeUpgradedGift(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfEmojiStatusType(dataList []json.RawMessage) ([]EmojiStatusType, error) { + list := []EmojiStatusType{} + + for _, data := range dataList { + entity, err := UnmarshalEmojiStatusType(data) if err != nil { return nil, err } @@ -914,6 +2029,49 @@ func UnmarshalListOfMessageSender(dataList []json.RawMessage) ([]MessageSender, return list, nil } +func UnmarshalMessageReadDate(data json.RawMessage) (MessageReadDate, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageReadDateRead: + return UnmarshalMessageReadDateRead(data) + + case TypeMessageReadDateUnread: + return UnmarshalMessageReadDateUnread(data) + + case TypeMessageReadDateTooOld: + return UnmarshalMessageReadDateTooOld(data) + + case TypeMessageReadDateUserPrivacyRestricted: + return UnmarshalMessageReadDateUserPrivacyRestricted(data) + + case TypeMessageReadDateMyPrivacyRestricted: + return UnmarshalMessageReadDateMyPrivacyRestricted(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageReadDate(dataList []json.RawMessage) ([]MessageReadDate, error) { + list := []MessageReadDate{} + + for _, data := range dataList { + entity, err := UnmarshalMessageReadDate(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageOrigin(data json.RawMessage) (MessageOrigin, error) { var meta meta @@ -969,6 +2127,9 @@ func UnmarshalReactionType(data json.RawMessage) (ReactionType, error) { case TypeReactionTypeCustomEmoji: return UnmarshalReactionTypeCustomEmoji(data) + case TypeReactionTypePaid: + return UnmarshalReactionTypePaid(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -988,6 +2149,117 @@ func UnmarshalListOfReactionType(dataList []json.RawMessage) ([]ReactionType, er return list, nil } +func UnmarshalPaidReactionType(data json.RawMessage) (PaidReactionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePaidReactionTypeRegular: + return UnmarshalPaidReactionTypeRegular(data) + + case TypePaidReactionTypeAnonymous: + return UnmarshalPaidReactionTypeAnonymous(data) + + case TypePaidReactionTypeChat: + return UnmarshalPaidReactionTypeChat(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPaidReactionType(dataList []json.RawMessage) ([]PaidReactionType, error) { + list := []PaidReactionType{} + + for _, data := range dataList { + entity, err := UnmarshalPaidReactionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalMessageTopic(data json.RawMessage) (MessageTopic, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageTopicThread: + return UnmarshalMessageTopicThread(data) + + case TypeMessageTopicForum: + return UnmarshalMessageTopicForum(data) + + case TypeMessageTopicDirectMessages: + return UnmarshalMessageTopicDirectMessages(data) + + case TypeMessageTopicSavedMessages: + return UnmarshalMessageTopicSavedMessages(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageTopic(dataList []json.RawMessage) ([]MessageTopic, error) { + list := []MessageTopic{} + + for _, data := range dataList { + entity, err := UnmarshalMessageTopic(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalMessageEffectType(data json.RawMessage) (MessageEffectType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeMessageEffectTypeEmojiReaction: + return UnmarshalMessageEffectTypeEmojiReaction(data) + + case TypeMessageEffectTypePremiumSticker: + return UnmarshalMessageEffectTypePremiumSticker(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfMessageEffectType(dataList []json.RawMessage) ([]MessageEffectType, error) { + list := []MessageEffectType{} + + for _, data := range dataList { + entity, err := UnmarshalMessageEffectType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageSendingState(data json.RawMessage) (MessageSendingState, error) { var meta meta @@ -1068,6 +2340,9 @@ func UnmarshalInputMessageReplyTo(data json.RawMessage) (InputMessageReplyTo, er case TypeInputMessageReplyToMessage: return UnmarshalInputMessageReplyToMessage(data) + case TypeInputMessageReplyToExternalMessage: + return UnmarshalInputMessageReplyToExternalMessage(data) + case TypeInputMessageReplyToStory: return UnmarshalInputMessageReplyToStory(data) @@ -1108,6 +2383,9 @@ func UnmarshalMessageSource(data json.RawMessage) (MessageSource, error) { case TypeMessageSourceForumTopicHistory: return UnmarshalMessageSourceForumTopicHistory(data) + case TypeMessageSourceDirectMessagesChatTopicHistory: + return UnmarshalMessageSourceDirectMessagesChatTopicHistory(data) + case TypeMessageSourceHistoryPreview: return UnmarshalMessageSourceHistoryPreview(data) @@ -1148,7 +2426,7 @@ func UnmarshalListOfMessageSource(dataList []json.RawMessage) ([]MessageSource, return list, nil } -func UnmarshalMessageSponsorType(data json.RawMessage) (MessageSponsorType, error) { +func UnmarshalReportSponsoredResult(data json.RawMessage) (ReportSponsoredResult, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -1157,28 +2435,31 @@ func UnmarshalMessageSponsorType(data json.RawMessage) (MessageSponsorType, erro } switch meta.Type { - case TypeMessageSponsorTypeBot: - return UnmarshalMessageSponsorTypeBot(data) + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(data) - case TypeMessageSponsorTypePublicChannel: - return UnmarshalMessageSponsorTypePublicChannel(data) + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(data) - case TypeMessageSponsorTypePrivateChannel: - return UnmarshalMessageSponsorTypePrivateChannel(data) + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(data) - case TypeMessageSponsorTypeWebsite: - return UnmarshalMessageSponsorTypeWebsite(data) + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(data) + + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfMessageSponsorType(dataList []json.RawMessage) ([]MessageSponsorType, error) { - list := []MessageSponsorType{} +func UnmarshalListOfReportSponsoredResult(dataList []json.RawMessage) ([]ReportSponsoredResult, error) { + list := []ReportSponsoredResult{} for _, data := range dataList { - entity, err := UnmarshalMessageSponsorType(data) + entity, err := UnmarshalReportSponsoredResult(data) if err != nil { return nil, err } @@ -1225,6 +2506,43 @@ func UnmarshalListOfNotificationSettingsScope(dataList []json.RawMessage) ([]Not return list, nil } +func UnmarshalReactionNotificationSource(data json.RawMessage) (ReactionNotificationSource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeReactionNotificationSourceNone: + return UnmarshalReactionNotificationSourceNone(data) + + case TypeReactionNotificationSourceContacts: + return UnmarshalReactionNotificationSourceContacts(data) + + case TypeReactionNotificationSourceAll: + return UnmarshalReactionNotificationSourceAll(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfReactionNotificationSource(dataList []json.RawMessage) ([]ReactionNotificationSource, error) { + list := []ReactionNotificationSource{} + + for _, data := range dataList { + entity, err := UnmarshalReactionNotificationSource(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatType(data json.RawMessage) (ChatType, error) { var meta meta @@ -1416,9 +2734,6 @@ func UnmarshalChatActionBar(data json.RawMessage) (ChatActionBar, error) { case TypeChatActionBarReportSpam: return UnmarshalChatActionBarReportSpam(data) - case TypeChatActionBarReportUnrelatedLocation: - return UnmarshalChatActionBarReportUnrelatedLocation(data) - case TypeChatActionBarInviteMembers: return UnmarshalChatActionBarInviteMembers(data) @@ -1453,6 +2768,46 @@ func UnmarshalListOfChatActionBar(dataList []json.RawMessage) ([]ChatActionBar, return list, nil } +func UnmarshalButtonStyle(data json.RawMessage) (ButtonStyle, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeButtonStyleDefault: + return UnmarshalButtonStyleDefault(data) + + case TypeButtonStylePrimary: + return UnmarshalButtonStylePrimary(data) + + case TypeButtonStyleDanger: + return UnmarshalButtonStyleDanger(data) + + case TypeButtonStyleSuccess: + return UnmarshalButtonStyleSuccess(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfButtonStyle(dataList []json.RawMessage) ([]ButtonStyle, error) { + list := []ButtonStyle{} + + for _, data := range dataList { + entity, err := UnmarshalButtonStyle(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalKeyboardButtonType(data json.RawMessage) (KeyboardButtonType, error) { var meta meta @@ -1474,8 +2829,8 @@ func UnmarshalKeyboardButtonType(data json.RawMessage) (KeyboardButtonType, erro case TypeKeyboardButtonTypeRequestPoll: return UnmarshalKeyboardButtonTypeRequestPoll(data) - case TypeKeyboardButtonTypeRequestUser: - return UnmarshalKeyboardButtonTypeRequestUser(data) + case TypeKeyboardButtonTypeRequestUsers: + return UnmarshalKeyboardButtonTypeRequestUsers(data) case TypeKeyboardButtonTypeRequestChat: return UnmarshalKeyboardButtonTypeRequestChat(data) @@ -1538,6 +2893,9 @@ func UnmarshalInlineKeyboardButtonType(data json.RawMessage) (InlineKeyboardButt case TypeInlineKeyboardButtonTypeUser: return UnmarshalInlineKeyboardButtonTypeUser(data) + case TypeInlineKeyboardButtonTypeCopyText: + return UnmarshalInlineKeyboardButtonTypeCopyText(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -1631,6 +2989,123 @@ func UnmarshalListOfLoginUrlInfo(dataList []json.RawMessage) ([]LoginUrlInfo, er return list, nil } +func UnmarshalWebAppOpenMode(data json.RawMessage) (WebAppOpenMode, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeWebAppOpenModeCompact: + return UnmarshalWebAppOpenModeCompact(data) + + case TypeWebAppOpenModeFullSize: + return UnmarshalWebAppOpenModeFullSize(data) + + case TypeWebAppOpenModeFullScreen: + return UnmarshalWebAppOpenModeFullScreen(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfWebAppOpenMode(dataList []json.RawMessage) ([]WebAppOpenMode, error) { + list := []WebAppOpenMode{} + + for _, data := range dataList { + entity, err := UnmarshalWebAppOpenMode(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSavedMessagesTopicType(data json.RawMessage) (SavedMessagesTopicType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSavedMessagesTopicTypeMyNotes: + return UnmarshalSavedMessagesTopicTypeMyNotes(data) + + case TypeSavedMessagesTopicTypeAuthorHidden: + return UnmarshalSavedMessagesTopicTypeAuthorHidden(data) + + case TypeSavedMessagesTopicTypeSavedFromChat: + return UnmarshalSavedMessagesTopicTypeSavedFromChat(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSavedMessagesTopicType(dataList []json.RawMessage) ([]SavedMessagesTopicType, error) { + list := []SavedMessagesTopicType{} + + for _, data := range dataList { + entity, err := UnmarshalSavedMessagesTopicType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalBuiltInTheme(data json.RawMessage) (BuiltInTheme, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBuiltInThemeClassic: + return UnmarshalBuiltInThemeClassic(data) + + case TypeBuiltInThemeDay: + return UnmarshalBuiltInThemeDay(data) + + case TypeBuiltInThemeNight: + return UnmarshalBuiltInThemeNight(data) + + case TypeBuiltInThemeTinted: + return UnmarshalBuiltInThemeTinted(data) + + case TypeBuiltInThemeArctic: + return UnmarshalBuiltInThemeArctic(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBuiltInTheme(dataList []json.RawMessage) ([]BuiltInTheme, error) { + list := []BuiltInTheme{} + + for _, data := range dataList { + entity, err := UnmarshalBuiltInTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalRichText(data json.RawMessage) (RichText, error) { var meta meta @@ -1899,6 +3374,216 @@ func UnmarshalListOfPageBlock(dataList []json.RawMessage) ([]PageBlock, error) { return list, nil } +func UnmarshalLinkPreviewAlbumMedia(data json.RawMessage) (LinkPreviewAlbumMedia, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeLinkPreviewAlbumMediaPhoto: + return UnmarshalLinkPreviewAlbumMediaPhoto(data) + + case TypeLinkPreviewAlbumMediaVideo: + return UnmarshalLinkPreviewAlbumMediaVideo(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfLinkPreviewAlbumMedia(dataList []json.RawMessage) ([]LinkPreviewAlbumMedia, error) { + list := []LinkPreviewAlbumMedia{} + + for _, data := range dataList { + entity, err := UnmarshalLinkPreviewAlbumMedia(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalLinkPreviewType(data json.RawMessage) (LinkPreviewType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeLinkPreviewTypeAlbum: + return UnmarshalLinkPreviewTypeAlbum(data) + + case TypeLinkPreviewTypeAnimation: + return UnmarshalLinkPreviewTypeAnimation(data) + + case TypeLinkPreviewTypeApp: + return UnmarshalLinkPreviewTypeApp(data) + + case TypeLinkPreviewTypeArticle: + return UnmarshalLinkPreviewTypeArticle(data) + + case TypeLinkPreviewTypeAudio: + return UnmarshalLinkPreviewTypeAudio(data) + + case TypeLinkPreviewTypeBackground: + return UnmarshalLinkPreviewTypeBackground(data) + + case TypeLinkPreviewTypeChannelBoost: + return UnmarshalLinkPreviewTypeChannelBoost(data) + + case TypeLinkPreviewTypeChat: + return UnmarshalLinkPreviewTypeChat(data) + + case TypeLinkPreviewTypeDirectMessagesChat: + return UnmarshalLinkPreviewTypeDirectMessagesChat(data) + + case TypeLinkPreviewTypeDocument: + return UnmarshalLinkPreviewTypeDocument(data) + + case TypeLinkPreviewTypeEmbeddedAnimationPlayer: + return UnmarshalLinkPreviewTypeEmbeddedAnimationPlayer(data) + + case TypeLinkPreviewTypeEmbeddedAudioPlayer: + return UnmarshalLinkPreviewTypeEmbeddedAudioPlayer(data) + + case TypeLinkPreviewTypeEmbeddedVideoPlayer: + return UnmarshalLinkPreviewTypeEmbeddedVideoPlayer(data) + + case TypeLinkPreviewTypeExternalAudio: + return UnmarshalLinkPreviewTypeExternalAudio(data) + + case TypeLinkPreviewTypeExternalVideo: + return UnmarshalLinkPreviewTypeExternalVideo(data) + + case TypeLinkPreviewTypeGiftAuction: + return UnmarshalLinkPreviewTypeGiftAuction(data) + + case TypeLinkPreviewTypeGiftCollection: + return UnmarshalLinkPreviewTypeGiftCollection(data) + + case TypeLinkPreviewTypeGroupCall: + return UnmarshalLinkPreviewTypeGroupCall(data) + + case TypeLinkPreviewTypeInvoice: + return UnmarshalLinkPreviewTypeInvoice(data) + + case TypeLinkPreviewTypeLiveStory: + return UnmarshalLinkPreviewTypeLiveStory(data) + + case TypeLinkPreviewTypeMessage: + return UnmarshalLinkPreviewTypeMessage(data) + + case TypeLinkPreviewTypePhoto: + return UnmarshalLinkPreviewTypePhoto(data) + + case TypeLinkPreviewTypePremiumGiftCode: + return UnmarshalLinkPreviewTypePremiumGiftCode(data) + + case TypeLinkPreviewTypeShareableChatFolder: + return UnmarshalLinkPreviewTypeShareableChatFolder(data) + + case TypeLinkPreviewTypeSticker: + return UnmarshalLinkPreviewTypeSticker(data) + + case TypeLinkPreviewTypeStickerSet: + return UnmarshalLinkPreviewTypeStickerSet(data) + + case TypeLinkPreviewTypeStory: + return UnmarshalLinkPreviewTypeStory(data) + + case TypeLinkPreviewTypeStoryAlbum: + return UnmarshalLinkPreviewTypeStoryAlbum(data) + + case TypeLinkPreviewTypeSupergroupBoost: + return UnmarshalLinkPreviewTypeSupergroupBoost(data) + + case TypeLinkPreviewTypeTheme: + return UnmarshalLinkPreviewTypeTheme(data) + + case TypeLinkPreviewTypeUnsupported: + return UnmarshalLinkPreviewTypeUnsupported(data) + + case TypeLinkPreviewTypeUpgradedGift: + return UnmarshalLinkPreviewTypeUpgradedGift(data) + + case TypeLinkPreviewTypeUser: + return UnmarshalLinkPreviewTypeUser(data) + + case TypeLinkPreviewTypeVideo: + return UnmarshalLinkPreviewTypeVideo(data) + + case TypeLinkPreviewTypeVideoChat: + return UnmarshalLinkPreviewTypeVideoChat(data) + + case TypeLinkPreviewTypeVideoNote: + return UnmarshalLinkPreviewTypeVideoNote(data) + + case TypeLinkPreviewTypeVoiceNote: + return UnmarshalLinkPreviewTypeVoiceNote(data) + + case TypeLinkPreviewTypeWebApp: + return UnmarshalLinkPreviewTypeWebApp(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfLinkPreviewType(dataList []json.RawMessage) ([]LinkPreviewType, error) { + list := []LinkPreviewType{} + + for _, data := range dataList { + entity, err := UnmarshalLinkPreviewType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalCollectibleItemType(data json.RawMessage) (CollectibleItemType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCollectibleItemTypeUsername: + return UnmarshalCollectibleItemTypeUsername(data) + + case TypeCollectibleItemTypePhoneNumber: + return UnmarshalCollectibleItemTypePhoneNumber(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCollectibleItemType(dataList []json.RawMessage) ([]CollectibleItemType, error) { + list := []CollectibleItemType{} + + for _, data := range dataList { + entity, err := UnmarshalCollectibleItemType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputCredentials(data json.RawMessage) (InputCredentials, error) { var meta meta @@ -1976,6 +3661,77 @@ func UnmarshalListOfPaymentProvider(dataList []json.RawMessage) ([]PaymentProvid return list, nil } +func UnmarshalPaymentFormType(data json.RawMessage) (PaymentFormType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePaymentFormTypeRegular: + return UnmarshalPaymentFormTypeRegular(data) + + case TypePaymentFormTypeStars: + return UnmarshalPaymentFormTypeStars(data) + + case TypePaymentFormTypeStarSubscription: + return UnmarshalPaymentFormTypeStarSubscription(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPaymentFormType(dataList []json.RawMessage) ([]PaymentFormType, error) { + list := []PaymentFormType{} + + for _, data := range dataList { + entity, err := UnmarshalPaymentFormType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPaymentReceiptType(data json.RawMessage) (PaymentReceiptType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePaymentReceiptTypeRegular: + return UnmarshalPaymentReceiptTypeRegular(data) + + case TypePaymentReceiptTypeStars: + return UnmarshalPaymentReceiptTypeStars(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPaymentReceiptType(dataList []json.RawMessage) ([]PaymentReceiptType, error) { + list := []PaymentReceiptType{} + + for _, data := range dataList { + entity, err := UnmarshalPaymentReceiptType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputInvoice(data json.RawMessage) (InputInvoice, error) { var meta meta @@ -2013,7 +3769,7 @@ func UnmarshalListOfInputInvoice(dataList []json.RawMessage) ([]InputInvoice, er return list, nil } -func UnmarshalMessageExtendedMedia(data json.RawMessage) (MessageExtendedMedia, error) { +func UnmarshalPaidMedia(data json.RawMessage) (PaidMedia, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -2022,28 +3778,28 @@ func UnmarshalMessageExtendedMedia(data json.RawMessage) (MessageExtendedMedia, } switch meta.Type { - case TypeMessageExtendedMediaPreview: - return UnmarshalMessageExtendedMediaPreview(data) + case TypePaidMediaPreview: + return UnmarshalPaidMediaPreview(data) - case TypeMessageExtendedMediaPhoto: - return UnmarshalMessageExtendedMediaPhoto(data) + case TypePaidMediaPhoto: + return UnmarshalPaidMediaPhoto(data) - case TypeMessageExtendedMediaVideo: - return UnmarshalMessageExtendedMediaVideo(data) + case TypePaidMediaVideo: + return UnmarshalPaidMediaVideo(data) - case TypeMessageExtendedMediaUnsupported: - return UnmarshalMessageExtendedMediaUnsupported(data) + case TypePaidMediaUnsupported: + return UnmarshalPaidMediaUnsupported(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfMessageExtendedMedia(dataList []json.RawMessage) ([]MessageExtendedMedia, error) { - list := []MessageExtendedMedia{} +func UnmarshalListOfPaidMedia(dataList []json.RawMessage) ([]PaidMedia, error) { + list := []PaidMedia{} for _, data := range dataList { - entity, err := UnmarshalMessageExtendedMedia(data) + entity, err := UnmarshalPaidMedia(data) if err != nil { return nil, err } @@ -2385,27 +4141,36 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageDocument: return UnmarshalMessageDocument(data) + case TypeMessagePaidMedia: + return UnmarshalMessagePaidMedia(data) + case TypeMessagePhoto: return UnmarshalMessagePhoto(data) - case TypeMessageExpiredPhoto: - return UnmarshalMessageExpiredPhoto(data) - case TypeMessageSticker: return UnmarshalMessageSticker(data) case TypeMessageVideo: return UnmarshalMessageVideo(data) - case TypeMessageExpiredVideo: - return UnmarshalMessageExpiredVideo(data) - case TypeMessageVideoNote: return UnmarshalMessageVideoNote(data) case TypeMessageVoiceNote: return UnmarshalMessageVoiceNote(data) + case TypeMessageExpiredPhoto: + return UnmarshalMessageExpiredPhoto(data) + + case TypeMessageExpiredVideo: + return UnmarshalMessageExpiredVideo(data) + + case TypeMessageExpiredVideoNote: + return UnmarshalMessageExpiredVideoNote(data) + + case TypeMessageExpiredVoiceNote: + return UnmarshalMessageExpiredVoiceNote(data) + case TypeMessageLocation: return UnmarshalMessageLocation(data) @@ -2427,15 +4192,24 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessagePoll: return UnmarshalMessagePoll(data) + case TypeMessageStakeDice: + return UnmarshalMessageStakeDice(data) + case TypeMessageStory: return UnmarshalMessageStory(data) + case TypeMessageChecklist: + return UnmarshalMessageChecklist(data) + case TypeMessageInvoice: return UnmarshalMessageInvoice(data) case TypeMessageCall: return UnmarshalMessageCall(data) + case TypeMessageGroupCall: + return UnmarshalMessageGroupCall(data) + case TypeMessageVideoChatScheduled: return UnmarshalMessageVideoChatScheduled(data) @@ -2463,6 +4237,12 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageChatDeletePhoto: return UnmarshalMessageChatDeletePhoto(data) + case TypeMessageChatOwnerLeft: + return UnmarshalMessageChatOwnerLeft(data) + + case TypeMessageChatOwnerChanged: + return UnmarshalMessageChatOwnerChanged(data) + case TypeMessageChatAddMembers: return UnmarshalMessageChatAddMembers(data) @@ -2496,6 +4276,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageChatSetMessageAutoDeleteTime: return UnmarshalMessageChatSetMessageAutoDeleteTime(data) + case TypeMessageChatBoost: + return UnmarshalMessageChatBoost(data) + case TypeMessageForumTopicCreated: return UnmarshalMessageForumTopicCreated(data) @@ -2511,6 +4294,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageSuggestProfilePhoto: return UnmarshalMessageSuggestProfilePhoto(data) + case TypeMessageSuggestBirthdate: + return UnmarshalMessageSuggestBirthdate(data) + case TypeMessageCustomServiceAction: return UnmarshalMessageCustomServiceAction(data) @@ -2523,23 +4309,86 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessagePaymentSuccessfulBot: return UnmarshalMessagePaymentSuccessfulBot(data) + case TypeMessagePaymentRefunded: + return UnmarshalMessagePaymentRefunded(data) + case TypeMessageGiftedPremium: return UnmarshalMessageGiftedPremium(data) case TypeMessagePremiumGiftCode: return UnmarshalMessagePremiumGiftCode(data) - case TypeMessagePremiumGiveawayCreated: - return UnmarshalMessagePremiumGiveawayCreated(data) + case TypeMessageGiveawayCreated: + return UnmarshalMessageGiveawayCreated(data) - case TypeMessagePremiumGiveaway: - return UnmarshalMessagePremiumGiveaway(data) + case TypeMessageGiveaway: + return UnmarshalMessageGiveaway(data) + + case TypeMessageGiveawayCompleted: + return UnmarshalMessageGiveawayCompleted(data) + + case TypeMessageGiveawayWinners: + return UnmarshalMessageGiveawayWinners(data) + + case TypeMessageGiftedStars: + return UnmarshalMessageGiftedStars(data) + + case TypeMessageGiftedTon: + return UnmarshalMessageGiftedTon(data) + + case TypeMessageGiveawayPrizeStars: + return UnmarshalMessageGiveawayPrizeStars(data) + + case TypeMessageGift: + return UnmarshalMessageGift(data) + + case TypeMessageUpgradedGift: + return UnmarshalMessageUpgradedGift(data) + + case TypeMessageRefundedUpgradedGift: + return UnmarshalMessageRefundedUpgradedGift(data) + + case TypeMessageUpgradedGiftPurchaseOffer: + return UnmarshalMessageUpgradedGiftPurchaseOffer(data) + + case TypeMessageUpgradedGiftPurchaseOfferRejected: + return UnmarshalMessageUpgradedGiftPurchaseOfferRejected(data) + + case TypeMessagePaidMessagesRefunded: + return UnmarshalMessagePaidMessagesRefunded(data) + + case TypeMessagePaidMessagePriceChanged: + return UnmarshalMessagePaidMessagePriceChanged(data) + + case TypeMessageDirectMessagePriceChanged: + return UnmarshalMessageDirectMessagePriceChanged(data) + + case TypeMessageChecklistTasksDone: + return UnmarshalMessageChecklistTasksDone(data) + + case TypeMessageChecklistTasksAdded: + return UnmarshalMessageChecklistTasksAdded(data) + + case TypeMessageSuggestedPostApprovalFailed: + return UnmarshalMessageSuggestedPostApprovalFailed(data) + + case TypeMessageSuggestedPostApproved: + return UnmarshalMessageSuggestedPostApproved(data) + + case TypeMessageSuggestedPostDeclined: + return UnmarshalMessageSuggestedPostDeclined(data) + + case TypeMessageSuggestedPostPaid: + return UnmarshalMessageSuggestedPostPaid(data) + + case TypeMessageSuggestedPostRefunded: + return UnmarshalMessageSuggestedPostRefunded(data) case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) - case TypeMessageUserShared: - return UnmarshalMessageUserShared(data) + case TypeMessageUsersShared: + return UnmarshalMessageUsersShared(data) case TypeMessageChatShared: return UnmarshalMessageChatShared(data) @@ -2644,6 +4493,9 @@ func UnmarshalTextEntityType(data json.RawMessage) (TextEntityType, error) { case TypeTextEntityTypeBlockQuote: return UnmarshalTextEntityTypeBlockQuote(data) + case TypeTextEntityTypeExpandableBlockQuote: + return UnmarshalTextEntityTypeExpandableBlockQuote(data) + case TypeTextEntityTypeTextUrl: return UnmarshalTextEntityTypeTextUrl(data) @@ -2675,6 +4527,40 @@ func UnmarshalListOfTextEntityType(dataList []json.RawMessage) ([]TextEntityType return list, nil } +func UnmarshalInputPaidMediaType(data json.RawMessage) (InputPaidMediaType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputPaidMediaTypePhoto: + return UnmarshalInputPaidMediaTypePhoto(data) + + case TypeInputPaidMediaTypeVideo: + return UnmarshalInputPaidMediaTypeVideo(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputPaidMediaType(dataList []json.RawMessage) ([]InputPaidMediaType, error) { + list := []InputPaidMediaType{} + + for _, data := range dataList { + entity, err := UnmarshalInputPaidMediaType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalMessageSchedulingState(data json.RawMessage) (MessageSchedulingState, error) { var meta meta @@ -2690,6 +4576,9 @@ func UnmarshalMessageSchedulingState(data json.RawMessage) (MessageSchedulingSta case TypeMessageSchedulingStateSendWhenOnline: return UnmarshalMessageSchedulingStateSendWhenOnline(data) + case TypeMessageSchedulingStateSendWhenVideoProcessed: + return UnmarshalMessageSchedulingStateSendWhenVideoProcessed(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -2764,6 +4653,9 @@ func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, er case TypeInputMessageDocument: return UnmarshalInputMessageDocument(data) + case TypeInputMessagePaidMedia: + return UnmarshalInputMessagePaidMedia(data) + case TypeInputMessagePhoto: return UnmarshalInputMessagePhoto(data) @@ -2800,9 +4692,15 @@ func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, er case TypeInputMessagePoll: return UnmarshalInputMessagePoll(data) + case TypeInputMessageStakeDice: + return UnmarshalInputMessageStakeDice(data) + case TypeInputMessageStory: return UnmarshalInputMessageStory(data) + case TypeInputMessageChecklist: + return UnmarshalInputMessageChecklist(data) + case TypeInputMessageForwarded: return UnmarshalInputMessageForwarded(data) @@ -2904,6 +4802,43 @@ func UnmarshalListOfSearchMessagesFilter(dataList []json.RawMessage) ([]SearchMe return list, nil } +func UnmarshalSearchMessagesChatTypeFilter(data json.RawMessage) (SearchMessagesChatTypeFilter, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSearchMessagesChatTypeFilterPrivate: + return UnmarshalSearchMessagesChatTypeFilterPrivate(data) + + case TypeSearchMessagesChatTypeFilterGroup: + return UnmarshalSearchMessagesChatTypeFilterGroup(data) + + case TypeSearchMessagesChatTypeFilterChannel: + return UnmarshalSearchMessagesChatTypeFilterChannel(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSearchMessagesChatTypeFilter(dataList []json.RawMessage) ([]SearchMessagesChatTypeFilter, error) { + list := []SearchMessagesChatTypeFilter{} + + for _, data := range dataList { + entity, err := UnmarshalSearchMessagesChatTypeFilter(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatAction(data json.RawMessage) (ChatAction, error) { var meta meta @@ -3023,6 +4958,40 @@ func UnmarshalListOfUserStatus(dataList []json.RawMessage) ([]UserStatus, error) return list, nil } +func UnmarshalEmojiCategorySource(data json.RawMessage) (EmojiCategorySource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeEmojiCategorySourceSearch: + return UnmarshalEmojiCategorySourceSearch(data) + + case TypeEmojiCategorySourcePremium: + return UnmarshalEmojiCategorySourcePremium(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfEmojiCategorySource(dataList []json.RawMessage) ([]EmojiCategorySource, error) { + list := []EmojiCategorySource{} + + for _, data := range dataList { + entity, err := UnmarshalEmojiCategorySource(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalEmojiCategoryType(data json.RawMessage) (EmojiCategoryType, error) { var meta meta @@ -3035,6 +5004,9 @@ func UnmarshalEmojiCategoryType(data json.RawMessage) (EmojiCategoryType, error) case TypeEmojiCategoryTypeDefault: return UnmarshalEmojiCategoryTypeDefault(data) + case TypeEmojiCategoryTypeRegularStickers: + return UnmarshalEmojiCategoryTypeRegularStickers(data) + case TypeEmojiCategoryTypeEmojiStatus: return UnmarshalEmojiCategoryTypeEmojiStatus(data) @@ -3078,6 +5050,18 @@ func UnmarshalStoryAreaType(data json.RawMessage) (StoryAreaType, error) { case TypeStoryAreaTypeSuggestedReaction: return UnmarshalStoryAreaTypeSuggestedReaction(data) + case TypeStoryAreaTypeMessage: + return UnmarshalStoryAreaTypeMessage(data) + + case TypeStoryAreaTypeLink: + return UnmarshalStoryAreaTypeLink(data) + + case TypeStoryAreaTypeWeather: + return UnmarshalStoryAreaTypeWeather(data) + + case TypeStoryAreaTypeUpgradedGift: + return UnmarshalStoryAreaTypeUpgradedGift(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3118,6 +5102,18 @@ func UnmarshalInputStoryAreaType(data json.RawMessage) (InputStoryAreaType, erro case TypeInputStoryAreaTypeSuggestedReaction: return UnmarshalInputStoryAreaTypeSuggestedReaction(data) + case TypeInputStoryAreaTypeMessage: + return UnmarshalInputStoryAreaTypeMessage(data) + + case TypeInputStoryAreaTypeLink: + return UnmarshalInputStoryAreaTypeLink(data) + + case TypeInputStoryAreaTypeWeather: + return UnmarshalInputStoryAreaTypeWeather(data) + + case TypeInputStoryAreaTypeUpgradedGift: + return UnmarshalInputStoryAreaTypeUpgradedGift(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3137,6 +5133,46 @@ func UnmarshalListOfInputStoryAreaType(dataList []json.RawMessage) ([]InputStory return list, nil } +func UnmarshalStoryContentType(data json.RawMessage) (StoryContentType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoryContentTypePhoto: + return UnmarshalStoryContentTypePhoto(data) + + case TypeStoryContentTypeVideo: + return UnmarshalStoryContentTypeVideo(data) + + case TypeStoryContentTypeLive: + return UnmarshalStoryContentTypeLive(data) + + case TypeStoryContentTypeUnsupported: + return UnmarshalStoryContentTypeUnsupported(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoryContentType(dataList []json.RawMessage) ([]StoryContentType, error) { + list := []StoryContentType{} + + for _, data := range dataList { + entity, err := UnmarshalStoryContentType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalStoryContent(data json.RawMessage) (StoryContent, error) { var meta meta @@ -3152,6 +5188,9 @@ func UnmarshalStoryContent(data json.RawMessage) (StoryContent, error) { case TypeStoryContentVideo: return UnmarshalStoryContentVideo(data) + case TypeStoryContentLive: + return UnmarshalStoryContentLive(data) + case TypeStoryContentUnsupported: return UnmarshalStoryContentUnsupported(data) @@ -3242,6 +5281,111 @@ func UnmarshalListOfStoryList(dataList []json.RawMessage) ([]StoryList, error) { return list, nil } +func UnmarshalStoryOrigin(data json.RawMessage) (StoryOrigin, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoryOriginPublicStory: + return UnmarshalStoryOriginPublicStory(data) + + case TypeStoryOriginHiddenUser: + return UnmarshalStoryOriginHiddenUser(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoryOrigin(dataList []json.RawMessage) ([]StoryOrigin, error) { + list := []StoryOrigin{} + + for _, data := range dataList { + entity, err := UnmarshalStoryOrigin(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalStoryInteractionType(data json.RawMessage) (StoryInteractionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoryInteractionTypeView: + return UnmarshalStoryInteractionTypeView(data) + + case TypeStoryInteractionTypeForward: + return UnmarshalStoryInteractionTypeForward(data) + + case TypeStoryInteractionTypeRepost: + return UnmarshalStoryInteractionTypeRepost(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoryInteractionType(dataList []json.RawMessage) ([]StoryInteractionType, error) { + list := []StoryInteractionType{} + + for _, data := range dataList { + entity, err := UnmarshalStoryInteractionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalPublicForward(data json.RawMessage) (PublicForward, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePublicForwardMessage: + return UnmarshalPublicForwardMessage(data) + + case TypePublicForwardStory: + return UnmarshalPublicForwardStory(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPublicForward(dataList []json.RawMessage) ([]PublicForward, error) { + list := []PublicForward{} + + for _, data := range dataList { + entity, err := UnmarshalPublicForward(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatBoostSource(data json.RawMessage) (ChatBoostSource, error) { var meta meta @@ -3279,6 +5423,40 @@ func UnmarshalListOfChatBoostSource(dataList []json.RawMessage) ([]ChatBoostSour return list, nil } +func UnmarshalResendCodeReason(data json.RawMessage) (ResendCodeReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeResendCodeReasonUserRequest: + return UnmarshalResendCodeReasonUserRequest(data) + + case TypeResendCodeReasonVerificationFailed: + return UnmarshalResendCodeReasonVerificationFailed(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfResendCodeReason(dataList []json.RawMessage) ([]ResendCodeReason, error) { + list := []ResendCodeReason{} + + for _, data := range dataList { + entity, err := UnmarshalResendCodeReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) { var meta meta @@ -3303,6 +5481,9 @@ func UnmarshalCallDiscardReason(data json.RawMessage) (CallDiscardReason, error) case TypeCallDiscardReasonHungUp: return UnmarshalCallDiscardReasonHungUp(data) + case TypeCallDiscardReasonUpgradeToGroupCall: + return UnmarshalCallDiscardReasonUpgradeToGroupCall(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -3439,6 +5620,114 @@ func UnmarshalListOfGroupCallVideoQuality(dataList []json.RawMessage) ([]GroupCa return list, nil } +func UnmarshalInviteGroupCallParticipantResult(data json.RawMessage) (InviteGroupCallParticipantResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInviteGroupCallParticipantResultUserPrivacyRestricted: + return UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(data) + + case TypeInviteGroupCallParticipantResultUserAlreadyParticipant: + return UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(data) + + case TypeInviteGroupCallParticipantResultUserWasBanned: + return UnmarshalInviteGroupCallParticipantResultUserWasBanned(data) + + case TypeInviteGroupCallParticipantResultSuccess: + return UnmarshalInviteGroupCallParticipantResultSuccess(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInviteGroupCallParticipantResult(dataList []json.RawMessage) ([]InviteGroupCallParticipantResult, error) { + list := []InviteGroupCallParticipantResult{} + + for _, data := range dataList { + entity, err := UnmarshalInviteGroupCallParticipantResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalGroupCallDataChannel(data json.RawMessage) (GroupCallDataChannel, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeGroupCallDataChannelMain: + return UnmarshalGroupCallDataChannelMain(data) + + case TypeGroupCallDataChannelScreenSharing: + return UnmarshalGroupCallDataChannelScreenSharing(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfGroupCallDataChannel(dataList []json.RawMessage) ([]GroupCallDataChannel, error) { + list := []GroupCallDataChannel{} + + for _, data := range dataList { + entity, err := UnmarshalGroupCallDataChannel(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputGroupCall(data json.RawMessage) (InputGroupCall, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputGroupCallLink: + return UnmarshalInputGroupCallLink(data) + + case TypeInputGroupCallMessage: + return UnmarshalInputGroupCallMessage(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputGroupCall(dataList []json.RawMessage) ([]InputGroupCall, error) { + list := []InputGroupCall{} + + for _, data := range dataList { + entity, err := UnmarshalInputGroupCall(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalCallProblem(data json.RawMessage) (CallProblem, error) { var meta meta @@ -3528,6 +5817,40 @@ func UnmarshalListOfFirebaseAuthenticationSettings(dataList []json.RawMessage) ( return list, nil } +func UnmarshalReactionUnavailabilityReason(data json.RawMessage) (ReactionUnavailabilityReason, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeReactionUnavailabilityReasonAnonymousAdministrator: + return UnmarshalReactionUnavailabilityReasonAnonymousAdministrator(data) + + case TypeReactionUnavailabilityReasonGuest: + return UnmarshalReactionUnavailabilityReasonGuest(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfReactionUnavailabilityReason(dataList []json.RawMessage) ([]ReactionUnavailabilityReason, error) { + list := []ReactionUnavailabilityReason{} + + for _, data := range dataList { + entity, err := UnmarshalReactionUnavailabilityReason(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalDiceStickers(data json.RawMessage) (DiceStickers, error) { var meta meta @@ -3639,6 +5962,43 @@ func UnmarshalListOfBotWriteAccessAllowReason(dataList []json.RawMessage) ([]Bot return list, nil } +func UnmarshalTargetChat(data json.RawMessage) (TargetChat, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeTargetChatCurrent: + return UnmarshalTargetChatCurrent(data) + + case TypeTargetChatChosen: + return UnmarshalTargetChatChosen(data) + + case TypeTargetChatInternalLink: + return UnmarshalTargetChatInternalLink(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfTargetChat(dataList []json.RawMessage) ([]TargetChat, error) { + list := []TargetChat{} + + for _, data := range dataList { + entity, err := UnmarshalTargetChat(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalInputInlineQueryResult(data json.RawMessage) (InputInlineQueryResult, error) { var meta meta @@ -3883,12 +6243,21 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventMemberRestricted: return UnmarshalChatEventMemberRestricted(data) + case TypeChatEventMemberSubscriptionExtended: + return UnmarshalChatEventMemberSubscriptionExtended(data) + case TypeChatEventAvailableReactionsChanged: return UnmarshalChatEventAvailableReactionsChanged(data) + case TypeChatEventBackgroundChanged: + return UnmarshalChatEventBackgroundChanged(data) + case TypeChatEventDescriptionChanged: return UnmarshalChatEventDescriptionChanged(data) + case TypeChatEventEmojiStatusChanged: + return UnmarshalChatEventEmojiStatusChanged(data) + case TypeChatEventLinkedChatChanged: return UnmarshalChatEventLinkedChatChanged(data) @@ -3910,6 +6279,9 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventStickerSetChanged: return UnmarshalChatEventStickerSetChanged(data) + case TypeChatEventCustomEmojiStickerSetChanged: + return UnmarshalChatEventCustomEmojiStickerSetChanged(data) + case TypeChatEventTitleChanged: return UnmarshalChatEventTitleChanged(data) @@ -3922,8 +6294,8 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventAccentColorChanged: return UnmarshalChatEventAccentColorChanged(data) - case TypeChatEventBackgroundCustomEmojiChanged: - return UnmarshalChatEventBackgroundCustomEmojiChanged(data) + case TypeChatEventProfileAccentColorChanged: + return UnmarshalChatEventProfileAccentColorChanged(data) case TypeChatEventHasProtectedContentToggled: return UnmarshalChatEventHasProtectedContentToggled(data) @@ -3940,6 +6312,12 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { case TypeChatEventSignMessagesToggled: return UnmarshalChatEventSignMessagesToggled(data) + case TypeChatEventShowMessageSenderToggled: + return UnmarshalChatEventShowMessageSenderToggled(data) + + case TypeChatEventAutomaticTranslationToggled: + return UnmarshalChatEventAutomaticTranslationToggled(data) + case TypeChatEventInviteLinkEdited: return UnmarshalChatEventInviteLinkEdited(data) @@ -4074,6 +6452,9 @@ func UnmarshalPremiumLimitType(data json.RawMessage) (PremiumLimitType, error) { case TypePremiumLimitTypePinnedArchivedChatCount: return UnmarshalPremiumLimitTypePinnedArchivedChatCount(data) + case TypePremiumLimitTypePinnedSavedMessagesTopicCount: + return UnmarshalPremiumLimitTypePinnedSavedMessagesTopicCount(data) + case TypePremiumLimitTypeCaptionLength: return UnmarshalPremiumLimitTypeCaptionLength(data) @@ -4089,11 +6470,11 @@ func UnmarshalPremiumLimitType(data json.RawMessage) (PremiumLimitType, error) { case TypePremiumLimitTypeActiveStoryCount: return UnmarshalPremiumLimitTypeActiveStoryCount(data) - case TypePremiumLimitTypeWeeklySentStoryCount: - return UnmarshalPremiumLimitTypeWeeklySentStoryCount(data) + case TypePremiumLimitTypeWeeklyPostedStoryCount: + return UnmarshalPremiumLimitTypeWeeklyPostedStoryCount(data) - case TypePremiumLimitTypeMonthlySentStoryCount: - return UnmarshalPremiumLimitTypeMonthlySentStoryCount(data) + case TypePremiumLimitTypeMonthlyPostedStoryCount: + return UnmarshalPremiumLimitTypeMonthlyPostedStoryCount(data) case TypePremiumLimitTypeStoryCaptionLength: return UnmarshalPremiumLimitTypeStoryCaptionLength(data) @@ -4101,6 +6482,9 @@ func UnmarshalPremiumLimitType(data json.RawMessage) (PremiumLimitType, error) { case TypePremiumLimitTypeStorySuggestedReactionAreaCount: return UnmarshalPremiumLimitTypeStorySuggestedReactionAreaCount(data) + case TypePremiumLimitTypeSimilarChatCount: + return UnmarshalPremiumLimitTypeSimilarChatCount(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4183,6 +6567,30 @@ func UnmarshalPremiumFeature(data json.RawMessage) (PremiumFeature, error) { case TypePremiumFeatureAccentColor: return UnmarshalPremiumFeatureAccentColor(data) + case TypePremiumFeatureBackgroundForBoth: + return UnmarshalPremiumFeatureBackgroundForBoth(data) + + case TypePremiumFeatureSavedMessagesTags: + return UnmarshalPremiumFeatureSavedMessagesTags(data) + + case TypePremiumFeatureMessagePrivacy: + return UnmarshalPremiumFeatureMessagePrivacy(data) + + case TypePremiumFeatureLastSeenTimes: + return UnmarshalPremiumFeatureLastSeenTimes(data) + + case TypePremiumFeatureBusiness: + return UnmarshalPremiumFeatureBusiness(data) + + case TypePremiumFeatureMessageEffects: + return UnmarshalPremiumFeatureMessageEffects(data) + + case TypePremiumFeatureChecklists: + return UnmarshalPremiumFeatureChecklists(data) + + case TypePremiumFeaturePaidMessages: + return UnmarshalPremiumFeaturePaidMessages(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4202,6 +6610,67 @@ func UnmarshalListOfPremiumFeature(dataList []json.RawMessage) ([]PremiumFeature return list, nil } +func UnmarshalBusinessFeature(data json.RawMessage) (BusinessFeature, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeBusinessFeatureLocation: + return UnmarshalBusinessFeatureLocation(data) + + case TypeBusinessFeatureOpeningHours: + return UnmarshalBusinessFeatureOpeningHours(data) + + case TypeBusinessFeatureQuickReplies: + return UnmarshalBusinessFeatureQuickReplies(data) + + case TypeBusinessFeatureGreetingMessage: + return UnmarshalBusinessFeatureGreetingMessage(data) + + case TypeBusinessFeatureAwayMessage: + return UnmarshalBusinessFeatureAwayMessage(data) + + case TypeBusinessFeatureAccountLinks: + return UnmarshalBusinessFeatureAccountLinks(data) + + case TypeBusinessFeatureStartPage: + return UnmarshalBusinessFeatureStartPage(data) + + case TypeBusinessFeatureBots: + return UnmarshalBusinessFeatureBots(data) + + case TypeBusinessFeatureEmojiStatus: + return UnmarshalBusinessFeatureEmojiStatus(data) + + case TypeBusinessFeatureChatFolderTags: + return UnmarshalBusinessFeatureChatFolderTags(data) + + case TypeBusinessFeatureUpgradedStories: + return UnmarshalBusinessFeatureUpgradedStories(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfBusinessFeature(dataList []json.RawMessage) ([]BusinessFeature, error) { + list := []BusinessFeature{} + + for _, data := range dataList { + entity, err := UnmarshalBusinessFeature(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalPremiumStoryFeature(data json.RawMessage) (PremiumStoryFeature, error) { var meta meta @@ -4229,6 +6698,9 @@ func UnmarshalPremiumStoryFeature(data json.RawMessage) (PremiumStoryFeature, er case TypePremiumStoryFeatureLinksAndFormatting: return UnmarshalPremiumStoryFeatureLinksAndFormatting(data) + case TypePremiumStoryFeatureVideoQuality: + return UnmarshalPremiumStoryFeatureVideoQuality(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4263,6 +6735,9 @@ func UnmarshalPremiumSource(data json.RawMessage) (PremiumSource, error) { case TypePremiumSourceFeature: return UnmarshalPremiumSourceFeature(data) + case TypePremiumSourceBusinessFeature: + return UnmarshalPremiumSourceBusinessFeature(data) + case TypePremiumSourceStoryFeature: return UnmarshalPremiumSourceStoryFeature(data) @@ -4303,8 +6778,8 @@ func UnmarshalStorePaymentPurpose(data json.RawMessage) (StorePaymentPurpose, er case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) - case TypeStorePaymentPurposeGiftedPremium: - return UnmarshalStorePaymentPurposeGiftedPremium(data) + case TypeStorePaymentPurposePremiumGift: + return UnmarshalStorePaymentPurposePremiumGift(data) case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -4312,6 +6787,15 @@ func UnmarshalStorePaymentPurpose(data json.RawMessage) (StorePaymentPurpose, er case TypeStorePaymentPurposePremiumGiveaway: return UnmarshalStorePaymentPurposePremiumGiveaway(data) + case TypeStorePaymentPurposeStarGiveaway: + return UnmarshalStorePaymentPurposeStarGiveaway(data) + + case TypeStorePaymentPurposeStars: + return UnmarshalStorePaymentPurposeStars(data) + + case TypeStorePaymentPurposeGiftedStars: + return UnmarshalStorePaymentPurposeGiftedStars(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4331,6 +6815,40 @@ func UnmarshalListOfStorePaymentPurpose(dataList []json.RawMessage) ([]StorePaym return list, nil } +func UnmarshalStoreTransaction(data json.RawMessage) (StoreTransaction, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStoreTransactionAppStore: + return UnmarshalStoreTransactionAppStore(data) + + case TypeStoreTransactionGooglePlay: + return UnmarshalStoreTransactionGooglePlay(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStoreTransaction(dataList []json.RawMessage) ([]StoreTransaction, error) { + list := []StoreTransaction{} + + for _, data := range dataList { + entity, err := UnmarshalStoreTransaction(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpose, error) { var meta meta @@ -4340,12 +6858,27 @@ func UnmarshalTelegramPaymentPurpose(data json.RawMessage) (TelegramPaymentPurpo } switch meta.Type { + case TypeTelegramPaymentPurposePremiumGift: + return UnmarshalTelegramPaymentPurposePremiumGift(data) + case TypeTelegramPaymentPurposePremiumGiftCodes: return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) case TypeTelegramPaymentPurposePremiumGiveaway: return UnmarshalTelegramPaymentPurposePremiumGiveaway(data) + case TypeTelegramPaymentPurposeStars: + return UnmarshalTelegramPaymentPurposeStars(data) + + case TypeTelegramPaymentPurposeGiftedStars: + return UnmarshalTelegramPaymentPurposeGiftedStars(data) + + case TypeTelegramPaymentPurposeStarGiveaway: + return UnmarshalTelegramPaymentPurposeStarGiveaway(data) + + case TypeTelegramPaymentPurposeJoinChat: + return UnmarshalTelegramPaymentPurposeJoinChat(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4484,6 +7017,9 @@ func UnmarshalBackgroundType(data json.RawMessage) (BackgroundType, error) { case TypeBackgroundTypeFill: return UnmarshalBackgroundTypeFill(data) + case TypeBackgroundTypeChatTheme: + return UnmarshalBackgroundTypeChatTheme(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -4540,7 +7076,7 @@ func UnmarshalListOfInputBackground(dataList []json.RawMessage) ([]InputBackgrou return list, nil } -func UnmarshalCanSendStoryResult(data json.RawMessage) (CanSendStoryResult, error) { +func UnmarshalChatTheme(data json.RawMessage) (ChatTheme, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -4549,34 +7085,139 @@ func UnmarshalCanSendStoryResult(data json.RawMessage) (CanSendStoryResult, erro } switch meta.Type { - case TypeCanSendStoryResultOk: - return UnmarshalCanSendStoryResultOk(data) + case TypeChatThemeEmoji: + return UnmarshalChatThemeEmoji(data) - case TypeCanSendStoryResultPremiumNeeded: - return UnmarshalCanSendStoryResultPremiumNeeded(data) - - case TypeCanSendStoryResultBoostNeeded: - return UnmarshalCanSendStoryResultBoostNeeded(data) - - case TypeCanSendStoryResultActiveStoryLimitExceeded: - return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data) - - case TypeCanSendStoryResultWeeklyLimitExceeded: - return UnmarshalCanSendStoryResultWeeklyLimitExceeded(data) - - case TypeCanSendStoryResultMonthlyLimitExceeded: - return UnmarshalCanSendStoryResultMonthlyLimitExceeded(data) + case TypeChatThemeGift: + return UnmarshalChatThemeGift(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfCanSendStoryResult(dataList []json.RawMessage) ([]CanSendStoryResult, error) { - list := []CanSendStoryResult{} +func UnmarshalListOfChatTheme(dataList []json.RawMessage) ([]ChatTheme, error) { + list := []ChatTheme{} for _, data := range dataList { - entity, err := UnmarshalCanSendStoryResult(data) + entity, err := UnmarshalChatTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalInputChatTheme(data json.RawMessage) (InputChatTheme, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputChatThemeEmoji: + return UnmarshalInputChatThemeEmoji(data) + + case TypeInputChatThemeGift: + return UnmarshalInputChatThemeGift(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfInputChatTheme(dataList []json.RawMessage) ([]InputChatTheme, error) { + list := []InputChatTheme{} + + for _, data := range dataList { + entity, err := UnmarshalInputChatTheme(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalCanPostStoryResult(data json.RawMessage) (CanPostStoryResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCanPostStoryResultOk: + return UnmarshalCanPostStoryResultOk(data) + + case TypeCanPostStoryResultPremiumNeeded: + return UnmarshalCanPostStoryResultPremiumNeeded(data) + + case TypeCanPostStoryResultBoostNeeded: + return UnmarshalCanPostStoryResultBoostNeeded(data) + + case TypeCanPostStoryResultActiveStoryLimitExceeded: + return UnmarshalCanPostStoryResultActiveStoryLimitExceeded(data) + + case TypeCanPostStoryResultWeeklyLimitExceeded: + return UnmarshalCanPostStoryResultWeeklyLimitExceeded(data) + + case TypeCanPostStoryResultMonthlyLimitExceeded: + return UnmarshalCanPostStoryResultMonthlyLimitExceeded(data) + + case TypeCanPostStoryResultLiveStoryIsActive: + return UnmarshalCanPostStoryResultLiveStoryIsActive(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCanPostStoryResult(dataList []json.RawMessage) ([]CanPostStoryResult, error) { + list := []CanPostStoryResult{} + + for _, data := range dataList { + entity, err := UnmarshalCanPostStoryResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalStartLiveStoryResult(data json.RawMessage) (StartLiveStoryResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeStartLiveStoryResultOk: + return UnmarshalStartLiveStoryResultOk(data) + + case TypeStartLiveStoryResultFail: + return UnmarshalStartLiveStoryResultFail(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfStartLiveStoryResult(dataList []json.RawMessage) ([]StartLiveStoryResult, error) { + list := []StartLiveStoryResult{} + + for _, data := range dataList { + entity, err := UnmarshalStartLiveStoryResult(data) if err != nil { return nil, err } @@ -4822,6 +7463,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentLocation: return UnmarshalPushMessageContentLocation(data) + case TypePushMessageContentPaidMedia: + return UnmarshalPushMessageContentPaidMedia(data) + case TypePushMessageContentPhoto: return UnmarshalPushMessageContentPhoto(data) @@ -4831,8 +7475,14 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentPremiumGiftCode: return UnmarshalPushMessageContentPremiumGiftCode(data) - case TypePushMessageContentPremiumGiveaway: - return UnmarshalPushMessageContentPremiumGiveaway(data) + case TypePushMessageContentGiveaway: + return UnmarshalPushMessageContentGiveaway(data) + + case TypePushMessageContentGift: + return UnmarshalPushMessageContentGift(data) + + case TypePushMessageContentUpgradedGift: + return UnmarshalPushMessageContentUpgradedGift(data) case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -4846,6 +7496,9 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentText: return UnmarshalPushMessageContentText(data) + case TypePushMessageContentChecklist: + return UnmarshalPushMessageContentChecklist(data) + case TypePushMessageContentVideo: return UnmarshalPushMessageContentVideo(data) @@ -4858,6 +7511,15 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentBasicGroupChatCreate: return UnmarshalPushMessageContentBasicGroupChatCreate(data) + case TypePushMessageContentVideoChatStarted: + return UnmarshalPushMessageContentVideoChatStarted(data) + + case TypePushMessageContentVideoChatEnded: + return UnmarshalPushMessageContentVideoChatEnded(data) + + case TypePushMessageContentInviteVideoChatParticipants: + return UnmarshalPushMessageContentInviteVideoChatParticipants(data) + case TypePushMessageContentChatAddMembers: return UnmarshalPushMessageContentChatAddMembers(data) @@ -4888,6 +7550,18 @@ func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, erro case TypePushMessageContentSuggestProfilePhoto: return UnmarshalPushMessageContentSuggestProfilePhoto(data) + case TypePushMessageContentSuggestBirthdate: + return UnmarshalPushMessageContentSuggestBirthdate(data) + + case TypePushMessageContentProximityAlertTriggered: + return UnmarshalPushMessageContentProximityAlertTriggered(data) + + case TypePushMessageContentChecklistTasksAdded: + return UnmarshalPushMessageContentChecklistTasksAdded(data) + + case TypePushMessageContentChecklistTasksDone: + return UnmarshalPushMessageContentChecklistTasksDone(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) @@ -5134,6 +7808,12 @@ func UnmarshalUserPrivacySettingRule(data json.RawMessage) (UserPrivacySettingRu case TypeUserPrivacySettingRuleAllowContacts: return UnmarshalUserPrivacySettingRuleAllowContacts(data) + case TypeUserPrivacySettingRuleAllowBots: + return UnmarshalUserPrivacySettingRuleAllowBots(data) + + case TypeUserPrivacySettingRuleAllowPremiumUsers: + return UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data) + case TypeUserPrivacySettingRuleAllowUsers: return UnmarshalUserPrivacySettingRuleAllowUsers(data) @@ -5146,6 +7826,9 @@ func UnmarshalUserPrivacySettingRule(data json.RawMessage) (UserPrivacySettingRu case TypeUserPrivacySettingRuleRestrictContacts: return UnmarshalUserPrivacySettingRuleRestrictContacts(data) + case TypeUserPrivacySettingRuleRestrictBots: + return UnmarshalUserPrivacySettingRuleRestrictBots(data) + case TypeUserPrivacySettingRuleRestrictUsers: return UnmarshalUserPrivacySettingRuleRestrictUsers(data) @@ -5195,6 +7878,12 @@ func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, erro case TypeUserPrivacySettingShowBio: return UnmarshalUserPrivacySettingShowBio(data) + case TypeUserPrivacySettingShowBirthdate: + return UnmarshalUserPrivacySettingShowBirthdate(data) + + case TypeUserPrivacySettingShowProfileAudio: + return UnmarshalUserPrivacySettingShowProfileAudio(data) + case TypeUserPrivacySettingAllowChatInvites: return UnmarshalUserPrivacySettingAllowChatInvites(data) @@ -5210,6 +7899,12 @@ func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, erro case TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages: return UnmarshalUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(data) + case TypeUserPrivacySettingAutosaveGifts: + return UnmarshalUserPrivacySettingAutosaveGifts(data) + + case TypeUserPrivacySettingAllowUnpaidMessages: + return UnmarshalUserPrivacySettingAllowUnpaidMessages(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -5229,6 +7924,46 @@ func UnmarshalListOfUserPrivacySetting(dataList []json.RawMessage) ([]UserPrivac return list, nil } +func UnmarshalCanSendMessageToUserResult(data json.RawMessage) (CanSendMessageToUserResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeCanSendMessageToUserResultOk: + return UnmarshalCanSendMessageToUserResultOk(data) + + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data) + + case TypeCanSendMessageToUserResultUserIsDeleted: + return UnmarshalCanSendMessageToUserResultUserIsDeleted(data) + + case TypeCanSendMessageToUserResultUserRestrictsNewChats: + return UnmarshalCanSendMessageToUserResultUserRestrictsNewChats(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfCanSendMessageToUserResult(dataList []json.RawMessage) ([]CanSendMessageToUserResult, error) { + list := []CanSendMessageToUserResult{} + + for _, data := range dataList { + entity, err := UnmarshalCanSendMessageToUserResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalSessionType(data json.RawMessage) (SessionType, error) { var meta meta @@ -5366,7 +8101,7 @@ func UnmarshalListOfReportReason(dataList []json.RawMessage) ([]ReportReason, er return list, nil } -func UnmarshalTargetChat(data json.RawMessage) (TargetChat, error) { +func UnmarshalReportChatResult(data json.RawMessage) (ReportChatResult, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -5375,25 +8110,156 @@ func UnmarshalTargetChat(data json.RawMessage) (TargetChat, error) { } switch meta.Type { - case TypeTargetChatCurrent: - return UnmarshalTargetChatCurrent(data) + case TypeReportChatResultOk: + return UnmarshalReportChatResultOk(data) - case TypeTargetChatChosen: - return UnmarshalTargetChatChosen(data) + case TypeReportChatResultOptionRequired: + return UnmarshalReportChatResultOptionRequired(data) - case TypeTargetChatInternalLink: - return UnmarshalTargetChatInternalLink(data) + case TypeReportChatResultTextRequired: + return UnmarshalReportChatResultTextRequired(data) + + case TypeReportChatResultMessagesRequired: + return UnmarshalReportChatResultMessagesRequired(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } } -func UnmarshalListOfTargetChat(dataList []json.RawMessage) ([]TargetChat, error) { - list := []TargetChat{} +func UnmarshalListOfReportChatResult(dataList []json.RawMessage) ([]ReportChatResult, error) { + list := []ReportChatResult{} for _, data := range dataList { - entity, err := UnmarshalTargetChat(data) + entity, err := UnmarshalReportChatResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalReportStoryResult(data json.RawMessage) (ReportStoryResult, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeReportStoryResultOk: + return UnmarshalReportStoryResultOk(data) + + case TypeReportStoryResultOptionRequired: + return UnmarshalReportStoryResultOptionRequired(data) + + case TypeReportStoryResultTextRequired: + return UnmarshalReportStoryResultTextRequired(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfReportStoryResult(dataList []json.RawMessage) ([]ReportStoryResult, error) { + list := []ReportStoryResult{} + + for _, data := range dataList { + entity, err := UnmarshalReportStoryResult(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalSettingsSection(data json.RawMessage) (SettingsSection, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeSettingsSectionAppearance: + return UnmarshalSettingsSectionAppearance(data) + + case TypeSettingsSectionAskQuestion: + return UnmarshalSettingsSectionAskQuestion(data) + + case TypeSettingsSectionBusiness: + return UnmarshalSettingsSectionBusiness(data) + + case TypeSettingsSectionChatFolders: + return UnmarshalSettingsSectionChatFolders(data) + + case TypeSettingsSectionDataAndStorage: + return UnmarshalSettingsSectionDataAndStorage(data) + + case TypeSettingsSectionDevices: + return UnmarshalSettingsSectionDevices(data) + + case TypeSettingsSectionEditProfile: + return UnmarshalSettingsSectionEditProfile(data) + + case TypeSettingsSectionFaq: + return UnmarshalSettingsSectionFaq(data) + + case TypeSettingsSectionFeatures: + return UnmarshalSettingsSectionFeatures(data) + + case TypeSettingsSectionInAppBrowser: + return UnmarshalSettingsSectionInAppBrowser(data) + + case TypeSettingsSectionLanguage: + return UnmarshalSettingsSectionLanguage(data) + + case TypeSettingsSectionMyStars: + return UnmarshalSettingsSectionMyStars(data) + + case TypeSettingsSectionMyToncoins: + return UnmarshalSettingsSectionMyToncoins(data) + + case TypeSettingsSectionNotifications: + return UnmarshalSettingsSectionNotifications(data) + + case TypeSettingsSectionPowerSaving: + return UnmarshalSettingsSectionPowerSaving(data) + + case TypeSettingsSectionPremium: + return UnmarshalSettingsSectionPremium(data) + + case TypeSettingsSectionPrivacyAndSecurity: + return UnmarshalSettingsSectionPrivacyAndSecurity(data) + + case TypeSettingsSectionPrivacyPolicy: + return UnmarshalSettingsSectionPrivacyPolicy(data) + + case TypeSettingsSectionQrCode: + return UnmarshalSettingsSectionQrCode(data) + + case TypeSettingsSectionSearch: + return UnmarshalSettingsSectionSearch(data) + + case TypeSettingsSectionSendGift: + return UnmarshalSettingsSectionSendGift(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfSettingsSection(dataList []json.RawMessage) ([]SettingsSection, error) { + list := []SettingsSection{} + + for _, data := range dataList { + entity, err := UnmarshalSettingsSection(data) if err != nil { return nil, err } @@ -5412,9 +8278,6 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { } switch meta.Type { - case TypeInternalLinkTypeActiveSessions: - return UnmarshalInternalLinkTypeActiveSessions(data) - case TypeInternalLinkTypeAttachmentMenuBot: return UnmarshalInternalLinkTypeAttachmentMenuBot(data) @@ -5433,8 +8296,14 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(data) - case TypeInternalLinkTypeChangePhoneNumber: - return UnmarshalInternalLinkTypeChangePhoneNumber(data) + case TypeInternalLinkTypeBusinessChat: + return UnmarshalInternalLinkTypeBusinessChat(data) + + case TypeInternalLinkTypeCallsPage: + return UnmarshalInternalLinkTypeCallsPage(data) + + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(data) case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(data) @@ -5442,21 +8311,30 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeChatFolderInvite: return UnmarshalInternalLinkTypeChatFolderInvite(data) - case TypeInternalLinkTypeChatFolderSettings: - return UnmarshalInternalLinkTypeChatFolderSettings(data) - case TypeInternalLinkTypeChatInvite: return UnmarshalInternalLinkTypeChatInvite(data) - case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: - return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data) + case TypeInternalLinkTypeChatSelection: + return UnmarshalInternalLinkTypeChatSelection(data) - case TypeInternalLinkTypeEditProfileSettings: - return UnmarshalInternalLinkTypeEditProfileSettings(data) + case TypeInternalLinkTypeContactsPage: + return UnmarshalInternalLinkTypeContactsPage(data) + + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGiftAuction: + return UnmarshalInternalLinkTypeGiftAuction(data) + + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(data) + + case TypeInternalLinkTypeGroupCall: + return UnmarshalInternalLinkTypeGroupCall(data) + case TypeInternalLinkTypeInstantView: return UnmarshalInternalLinkTypeInstantView(data) @@ -5466,8 +8344,11 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeLanguagePack: return UnmarshalInternalLinkTypeLanguagePack(data) - case TypeInternalLinkTypeLanguageSettings: - return UnmarshalInternalLinkTypeLanguageSettings(data) + case TypeInternalLinkTypeLiveStory: + return UnmarshalInternalLinkTypeLiveStory(data) + + case TypeInternalLinkTypeMainWebApp: + return UnmarshalInternalLinkTypeMainWebApp(data) case TypeInternalLinkTypeMessage: return UnmarshalInternalLinkTypeMessage(data) @@ -5475,20 +8356,35 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(data) + case TypeInternalLinkTypeMyProfilePage: + return UnmarshalInternalLinkTypeMyProfilePage(data) + + case TypeInternalLinkTypeNewChannelChat: + return UnmarshalInternalLinkTypeNewChannelChat(data) + + case TypeInternalLinkTypeNewGroupChat: + return UnmarshalInternalLinkTypeNewGroupChat(data) + + case TypeInternalLinkTypeNewPrivateChat: + return UnmarshalInternalLinkTypeNewPrivateChat(data) + + case TypeInternalLinkTypeNewStory: + return UnmarshalInternalLinkTypeNewStory(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) case TypeInternalLinkTypePhoneNumberConfirmation: return UnmarshalInternalLinkTypePhoneNumberConfirmation(data) - case TypeInternalLinkTypePremiumFeatures: - return UnmarshalInternalLinkTypePremiumFeatures(data) + case TypeInternalLinkTypePremiumFeaturesPage: + return UnmarshalInternalLinkTypePremiumFeaturesPage(data) case TypeInternalLinkTypePremiumGiftCode: return UnmarshalInternalLinkTypePremiumGiftCode(data) - case TypeInternalLinkTypePrivacyAndSecuritySettings: - return UnmarshalInternalLinkTypePrivacyAndSecuritySettings(data) + case TypeInternalLinkTypePremiumGiftPurchase: + return UnmarshalInternalLinkTypePremiumGiftPurchase(data) case TypeInternalLinkTypeProxy: return UnmarshalInternalLinkTypeProxy(data) @@ -5502,11 +8398,17 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeRestorePurchases: return UnmarshalInternalLinkTypeRestorePurchases(data) + case TypeInternalLinkTypeSavedMessages: + return UnmarshalInternalLinkTypeSavedMessages(data) + + case TypeInternalLinkTypeSearch: + return UnmarshalInternalLinkTypeSearch(data) + case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(data) - case TypeInternalLinkTypeSideMenuBot: - return UnmarshalInternalLinkTypeSideMenuBot(data) + case TypeInternalLinkTypeStarPurchase: + return UnmarshalInternalLinkTypeStarPurchase(data) case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(data) @@ -5514,17 +8416,17 @@ func UnmarshalInternalLinkType(data json.RawMessage) (InternalLinkType, error) { case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(data) - case TypeInternalLinkTypeThemeSettings: - return UnmarshalInternalLinkTypeThemeSettings(data) - case TypeInternalLinkTypeUnknownDeepLink: return UnmarshalInternalLinkTypeUnknownDeepLink(data) - case TypeInternalLinkTypeUnsupportedProxy: - return UnmarshalInternalLinkTypeUnsupportedProxy(data) + case TypeInternalLinkTypeUpgradedGift: + return UnmarshalInternalLinkTypeUpgradedGift(data) case TypeInternalLinkTypeUserPhoneNumber: return UnmarshalInternalLinkTypeUserPhoneNumber(data) @@ -5633,6 +8535,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) @@ -5860,6 +8774,9 @@ func UnmarshalTopChatCategory(data json.RawMessage) (TopChatCategory, error) { case TypeTopChatCategoryInlineBots: return UnmarshalTopChatCategoryInlineBots(data) + case TypeTopChatCategoryWebAppBots: + return UnmarshalTopChatCategoryWebAppBots(data) + case TypeTopChatCategoryCalls: return UnmarshalTopChatCategoryCalls(data) @@ -5961,6 +8878,30 @@ func UnmarshalSuggestedAction(data json.RawMessage) (SuggestedAction, error) { case TypeSuggestedActionSubscribeToAnnualPremium: return UnmarshalSuggestedActionSubscribeToAnnualPremium(data) + case TypeSuggestedActionGiftPremiumForChristmas: + return UnmarshalSuggestedActionGiftPremiumForChristmas(data) + + case TypeSuggestedActionSetBirthdate: + return UnmarshalSuggestedActionSetBirthdate(data) + + case TypeSuggestedActionSetProfilePhoto: + return UnmarshalSuggestedActionSetProfilePhoto(data) + + case TypeSuggestedActionExtendPremium: + return UnmarshalSuggestedActionExtendPremium(data) + + case TypeSuggestedActionExtendStarSubscriptions: + return UnmarshalSuggestedActionExtendStarSubscriptions(data) + + case TypeSuggestedActionCustom: + return UnmarshalSuggestedActionCustom(data) + + case TypeSuggestedActionSetLoginEmailAddress: + return UnmarshalSuggestedActionSetLoginEmailAddress(data) + + case TypeSuggestedActionAddLoginPasskey: + return UnmarshalSuggestedActionAddLoginPasskey(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6088,6 +9029,40 @@ func UnmarshalListOfStatisticalGraph(dataList []json.RawMessage) ([]StatisticalG return list, nil } +func UnmarshalChatStatisticsObjectType(data json.RawMessage) (ChatStatisticsObjectType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatStatisticsObjectTypeMessage: + return UnmarshalChatStatisticsObjectTypeMessage(data) + + case TypeChatStatisticsObjectTypeStory: + return UnmarshalChatStatisticsObjectTypeStory(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatStatisticsObjectType(dataList []json.RawMessage) ([]ChatStatisticsObjectType, error) { + list := []ChatStatisticsObjectType{} + + for _, data := range dataList { + entity, err := UnmarshalChatStatisticsObjectType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalChatStatistics(data json.RawMessage) (ChatStatistics, error) { var meta meta @@ -6122,6 +9097,86 @@ func UnmarshalListOfChatStatistics(dataList []json.RawMessage) ([]ChatStatistics return list, nil } +func UnmarshalRevenueWithdrawalState(data json.RawMessage) (RevenueWithdrawalState, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeRevenueWithdrawalStatePending: + return UnmarshalRevenueWithdrawalStatePending(data) + + case TypeRevenueWithdrawalStateSucceeded: + return UnmarshalRevenueWithdrawalStateSucceeded(data) + + case TypeRevenueWithdrawalStateFailed: + return UnmarshalRevenueWithdrawalStateFailed(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfRevenueWithdrawalState(dataList []json.RawMessage) ([]RevenueWithdrawalState, error) { + list := []RevenueWithdrawalState{} + + for _, data := range dataList { + entity, err := UnmarshalRevenueWithdrawalState(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + +func UnmarshalChatRevenueTransactionType(data json.RawMessage) (ChatRevenueTransactionType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatRevenueTransactionTypeUnsupported: + return UnmarshalChatRevenueTransactionTypeUnsupported(data) + + case TypeChatRevenueTransactionTypeSponsoredMessageEarnings: + return UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data) + + case TypeChatRevenueTransactionTypeSuggestedPostEarnings: + return UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data) + + case TypeChatRevenueTransactionTypeFragmentWithdrawal: + return UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data) + + case TypeChatRevenueTransactionTypeFragmentRefund: + return UnmarshalChatRevenueTransactionTypeFragmentRefund(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfChatRevenueTransactionType(dataList []json.RawMessage) ([]ChatRevenueTransactionType, error) { + list := []ChatRevenueTransactionType{} + + for _, data := range dataList { + entity, err := UnmarshalChatRevenueTransactionType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalVectorPathCommand(data json.RawMessage) (VectorPathCommand, error) { var meta meta @@ -6205,6 +9260,43 @@ func UnmarshalListOfBotCommandScope(dataList []json.RawMessage) ([]BotCommandSco return list, nil } +func UnmarshalPhoneNumberCodeType(data json.RawMessage) (PhoneNumberCodeType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePhoneNumberCodeTypeChange: + return UnmarshalPhoneNumberCodeTypeChange(data) + + case TypePhoneNumberCodeTypeVerify: + return UnmarshalPhoneNumberCodeTypeVerify(data) + + case TypePhoneNumberCodeTypeConfirmOwnership: + return UnmarshalPhoneNumberCodeTypeConfirmOwnership(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalListOfPhoneNumberCodeType(dataList []json.RawMessage) ([]PhoneNumberCodeType, error) { + list := []PhoneNumberCodeType{} + + for _, data := range dataList { + entity, err := UnmarshalPhoneNumberCodeType(data) + if err != nil { + return nil, err + } + list = append(list, entity) + } + + return list, nil +} + func UnmarshalUpdate(data json.RawMessage) (Update, error) { var meta meta @@ -6250,9 +9342,18 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateMessageUnreadReactions: return UnmarshalUpdateMessageUnreadReactions(data) + case TypeUpdateMessageFactCheck: + return UnmarshalUpdateMessageFactCheck(data) + + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) + case TypeUpdateVideoPublished: + return UnmarshalUpdateVideoPublished(data) + case TypeUpdateNewChat: return UnmarshalUpdateNewChat(data) @@ -6262,11 +9363,8 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(data) - case TypeUpdateChatAccentColor: - return UnmarshalUpdateChatAccentColor(data) - - case TypeUpdateChatBackgroundCustomEmoji: - return UnmarshalUpdateChatBackgroundCustomEmoji(data) + case TypeUpdateChatAccentColors: + return UnmarshalUpdateChatAccentColors(data) case TypeUpdateChatPermissions: return UnmarshalUpdateChatPermissions(data) @@ -6277,6 +9375,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatPosition: return UnmarshalUpdateChatPosition(data) + case TypeUpdateChatAddedToList: + return UnmarshalUpdateChatAddedToList(data) + + case TypeUpdateChatRemovedFromList: + return UnmarshalUpdateChatRemovedFromList(data) + case TypeUpdateChatReadInbox: return UnmarshalUpdateChatReadInbox(data) @@ -6286,12 +9390,18 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatActionBar: return UnmarshalUpdateChatActionBar(data) + case TypeUpdateChatBusinessBotManageBar: + return UnmarshalUpdateChatBusinessBotManageBar(data) + case TypeUpdateChatAvailableReactions: return UnmarshalUpdateChatAvailableReactions(data) case TypeUpdateChatDraftMessage: return UnmarshalUpdateChatDraftMessage(data) + case TypeUpdateChatEmojiStatus: + return UnmarshalUpdateChatEmojiStatus(data) + case TypeUpdateChatMessageSender: return UnmarshalUpdateChatMessageSender(data) @@ -6334,6 +9444,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatIsMarkedAsUnread: return UnmarshalUpdateChatIsMarkedAsUnread(data) + case TypeUpdateChatViewAsTopics: + return UnmarshalUpdateChatViewAsTopics(data) + case TypeUpdateChatBlockList: return UnmarshalUpdateChatBlockList(data) @@ -6346,12 +9459,42 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(data) + case TypeUpdateSavedMessagesTopic: + return UnmarshalUpdateSavedMessagesTopic(data) + + case TypeUpdateSavedMessagesTopicCount: + return UnmarshalUpdateSavedMessagesTopicCount(data) + + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(data) + + case TypeUpdateQuickReplyShortcut: + return UnmarshalUpdateQuickReplyShortcut(data) + + case TypeUpdateQuickReplyShortcutDeleted: + return UnmarshalUpdateQuickReplyShortcutDeleted(data) + + case TypeUpdateQuickReplyShortcuts: + return UnmarshalUpdateQuickReplyShortcuts(data) + + case TypeUpdateQuickReplyShortcutMessages: + return UnmarshalUpdateQuickReplyShortcutMessages(data) + case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) + case TypeUpdateForumTopic: + return UnmarshalUpdateForumTopic(data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) + case TypeUpdateReactionNotificationSettings: + return UnmarshalUpdateReactionNotificationSettings(data) + case TypeUpdateNotification: return UnmarshalUpdateNotification(data) @@ -6370,6 +9513,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatAction: return UnmarshalUpdateChatAction(data) + case TypeUpdatePendingTextMessage: + return UnmarshalUpdatePendingTextMessage(data) + case TypeUpdateUserStatus: return UnmarshalUpdateUserStatus(data) @@ -6418,6 +9564,12 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateFileRemovedFromDownloads: return UnmarshalUpdateFileRemovedFromDownloads(data) + case TypeUpdateApplicationVerificationRequired: + return UnmarshalUpdateApplicationVerificationRequired(data) + + case TypeUpdateApplicationRecaptchaVerificationRequired: + return UnmarshalUpdateApplicationRecaptchaVerificationRequired(data) + case TypeUpdateCall: return UnmarshalUpdateCall(data) @@ -6427,9 +9579,36 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateGroupCallParticipant: return UnmarshalUpdateGroupCallParticipant(data) + case TypeUpdateGroupCallParticipants: + return UnmarshalUpdateGroupCallParticipants(data) + + case TypeUpdateGroupCallVerificationState: + return UnmarshalUpdateGroupCallVerificationState(data) + + case TypeUpdateNewGroupCallMessage: + return UnmarshalUpdateNewGroupCallMessage(data) + + case TypeUpdateNewGroupCallPaidReaction: + return UnmarshalUpdateNewGroupCallPaidReaction(data) + + case TypeUpdateGroupCallMessageSendFailed: + return UnmarshalUpdateGroupCallMessageSendFailed(data) + + case TypeUpdateGroupCallMessagesDeleted: + return UnmarshalUpdateGroupCallMessagesDeleted(data) + + case TypeUpdateLiveStoryTopDonors: + return UnmarshalUpdateLiveStoryTopDonors(data) + case TypeUpdateNewCallSignalingData: return UnmarshalUpdateNewCallSignalingData(data) + case TypeUpdateGiftAuctionState: + return UnmarshalUpdateGiftAuctionState(data) + + case TypeUpdateActiveGiftAuctions: + return UnmarshalUpdateActiveGiftAuctions(data) + case TypeUpdateUserPrivacySettingRules: return UnmarshalUpdateUserPrivacySettingRules(data) @@ -6445,11 +9624,11 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateStoryDeleted: return UnmarshalUpdateStoryDeleted(data) - case TypeUpdateStorySendSucceeded: - return UnmarshalUpdateStorySendSucceeded(data) + case TypeUpdateStoryPostSucceeded: + return UnmarshalUpdateStoryPostSucceeded(data) - case TypeUpdateStorySendFailed: - return UnmarshalUpdateStorySendFailed(data) + case TypeUpdateStoryPostFailed: + return UnmarshalUpdateStoryPostFailed(data) case TypeUpdateChatActiveStories: return UnmarshalUpdateChatActiveStories(data) @@ -6460,6 +9639,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateStoryStealthMode: return UnmarshalUpdateStoryStealthMode(data) + case TypeUpdateTrustedMiniAppBots: + return UnmarshalUpdateTrustedMiniAppBots(data) + case TypeUpdateOption: return UnmarshalUpdateOption(data) @@ -6484,27 +9666,33 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSavedNotificationSounds: return UnmarshalUpdateSavedNotificationSounds(data) - case TypeUpdateSelectedBackground: - return UnmarshalUpdateSelectedBackground(data) + case TypeUpdateDefaultBackground: + return UnmarshalUpdateDefaultBackground(data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(data) + case TypeUpdateProfileAccentColors: + return UnmarshalUpdateProfileAccentColors(data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(data) case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(data) + case TypeUpdateFreezeState: + return UnmarshalUpdateFreezeState(data) + + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) - case TypeUpdateUsersNearby: - return UnmarshalUpdateUsersNearby(data) - case TypeUpdateUnconfirmedSession: return UnmarshalUpdateUnconfirmedSession(data) @@ -6517,12 +9705,48 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateActiveEmojiReactions: return UnmarshalUpdateActiveEmojiReactions(data) + case TypeUpdateAvailableMessageEffects: + return UnmarshalUpdateAvailableMessageEffects(data) + case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) + case TypeUpdateDefaultPaidReactionType: + return UnmarshalUpdateDefaultPaidReactionType(data) + + case TypeUpdateSavedMessagesTags: + return UnmarshalUpdateSavedMessagesTags(data) + + case TypeUpdateActiveLiveLocationMessages: + return UnmarshalUpdateActiveLiveLocationMessages(data) + + case TypeUpdateOwnedStarCount: + return UnmarshalUpdateOwnedStarCount(data) + + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(data) + + case TypeUpdateChatRevenueAmount: + return UnmarshalUpdateChatRevenueAmount(data) + + case TypeUpdateStarRevenueStatus: + return UnmarshalUpdateStarRevenueStatus(data) + + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(data) + + case TypeUpdateSpeechRecognitionTrial: + return UnmarshalUpdateSpeechRecognitionTrial(data) + + case TypeUpdateGroupCallMessageLevels: + return UnmarshalUpdateGroupCallMessageLevels(data) + case TypeUpdateDiceEmojis: return UnmarshalUpdateDiceEmojis(data) + case TypeUpdateStakeDiceState: + return UnmarshalUpdateStakeDiceState(data) + case TypeUpdateAnimatedEmojiMessageClicked: return UnmarshalUpdateAnimatedEmojiMessageClicked(data) @@ -6532,12 +9756,27 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(data) - case TypeUpdateAddChatMembersPrivacyForbidden: - return UnmarshalUpdateAddChatMembersPrivacyForbidden(data) + case TypeUpdateSpeedLimitNotification: + return UnmarshalUpdateSpeedLimitNotification(data) + + case TypeUpdateContactCloseBirthdays: + return UnmarshalUpdateContactCloseBirthdays(data) case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(data) + case TypeUpdateBusinessConnection: + return UnmarshalUpdateBusinessConnection(data) + + case TypeUpdateNewBusinessMessage: + return UnmarshalUpdateNewBusinessMessage(data) + + case TypeUpdateBusinessMessageEdited: + return UnmarshalUpdateBusinessMessageEdited(data) + + case TypeUpdateBusinessMessagesDeleted: + return UnmarshalUpdateBusinessMessagesDeleted(data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(data) @@ -6550,6 +9789,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateNewInlineCallbackQuery: return UnmarshalUpdateNewInlineCallbackQuery(data) + case TypeUpdateNewBusinessCallbackQuery: + return UnmarshalUpdateNewBusinessCallbackQuery(data) + case TypeUpdateNewShippingQuery: return UnmarshalUpdateNewShippingQuery(data) @@ -6577,6 +9819,15 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatBoost: return UnmarshalUpdateChatBoost(data) + case TypeUpdateMessageReaction: + return UnmarshalUpdateMessageReaction(data) + + case TypeUpdateMessageReactions: + return UnmarshalUpdateMessageReactions(data) + + case TypeUpdatePaidMediaPurchased: + return UnmarshalUpdatePaidMediaPurchased(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -6665,6 +9916,22 @@ func UnmarshalAuthenticationCodeTypeSms(data json.RawMessage) (*AuthenticationCo return &resp, err } +func UnmarshalAuthenticationCodeTypeSmsWord(data json.RawMessage) (*AuthenticationCodeTypeSmsWord, error) { + var resp AuthenticationCodeTypeSmsWord + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuthenticationCodeTypeSmsPhrase(data json.RawMessage) (*AuthenticationCodeTypeSmsPhrase, error) { + var resp AuthenticationCodeTypeSmsPhrase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAuthenticationCodeTypeCall(data json.RawMessage) (*AuthenticationCodeTypeCall, error) { var resp AuthenticationCodeTypeCall @@ -6801,6 +10068,22 @@ func UnmarshalTermsOfService(data json.RawMessage) (*TermsOfService, error) { return &resp, err } +func UnmarshalPasskey(data json.RawMessage) (*Passkey, error) { + var resp Passkey + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPasskeys(data json.RawMessage) (*Passkeys, error) { + var resp Passkeys + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAuthorizationStateWaitTdlibParameters(data json.RawMessage) (*AuthorizationStateWaitTdlibParameters, error) { var resp AuthorizationStateWaitTdlibParameters @@ -6817,6 +10100,14 @@ func UnmarshalAuthorizationStateWaitPhoneNumber(data json.RawMessage) (*Authoriz return &resp, err } +func UnmarshalAuthorizationStateWaitPremiumPurchase(data json.RawMessage) (*AuthorizationStateWaitPremiumPurchase, error) { + var resp AuthorizationStateWaitPremiumPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAuthorizationStateWaitEmailAddress(data json.RawMessage) (*AuthorizationStateWaitEmailAddress, error) { var resp AuthorizationStateWaitEmailAddress @@ -6897,6 +10188,22 @@ func UnmarshalAuthorizationStateClosed(data json.RawMessage) (*AuthorizationStat return &resp, err } +func UnmarshalFirebaseDeviceVerificationParametersSafetyNet(data json.RawMessage) (*FirebaseDeviceVerificationParametersSafetyNet, error) { + var resp FirebaseDeviceVerificationParametersSafetyNet + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFirebaseDeviceVerificationParametersPlayIntegrity(data json.RawMessage) (*FirebaseDeviceVerificationParametersPlayIntegrity, error) { + var resp FirebaseDeviceVerificationParametersPlayIntegrity + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPasswordState(data json.RawMessage) (*PasswordState, error) { var resp PasswordState @@ -7177,6 +10484,14 @@ func UnmarshalClosedVectorPath(data json.RawMessage) (*ClosedVectorPath, error) return &resp, err } +func UnmarshalOutline(data json.RawMessage) (*Outline, error) { + var resp Outline + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPollOption(data json.RawMessage) (*PollOption, error) { var resp PollOption @@ -7201,6 +10516,38 @@ func UnmarshalPollTypeQuiz(data json.RawMessage) (*PollTypeQuiz, error) { return &resp, err } +func UnmarshalChecklistTask(data json.RawMessage) (*ChecklistTask, error) { + var resp ChecklistTask + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChecklistTask(data json.RawMessage) (*InputChecklistTask, error) { + var resp InputChecklistTask + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChecklist(data json.RawMessage) (*Checklist, error) { + var resp Checklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChecklist(data json.RawMessage) (*InputChecklist, error) { + var resp InputChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAnimation(data json.RawMessage) (*Animation, error) { var resp Animation @@ -7217,6 +10564,14 @@ func UnmarshalAudio(data json.RawMessage) (*Audio, error) { return &resp, err } +func UnmarshalAudios(data json.RawMessage) (*Audios, error) { + var resp Audios + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDocument(data json.RawMessage) (*Document, error) { var resp Document @@ -7305,6 +10660,14 @@ func UnmarshalGame(data json.RawMessage) (*Game, error) { return &resp, err } +func UnmarshalStakeDiceState(data json.RawMessage) (*StakeDiceState, error) { + var resp StakeDiceState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalWebApp(data json.RawMessage) (*WebApp, error) { var resp WebApp @@ -7321,6 +10684,22 @@ func UnmarshalPoll(data json.RawMessage) (*Poll, error) { return &resp, err } +func UnmarshalAlternativeVideo(data json.RawMessage) (*AlternativeVideo, error) { + var resp AlternativeVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVideoStoryboard(data json.RawMessage) (*VideoStoryboard, error) { + var resp VideoStoryboard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBackground(data json.RawMessage) (*Background, error) { var resp Background @@ -7361,6 +10740,70 @@ func UnmarshalChatPhotoInfo(data json.RawMessage) (*ChatPhotoInfo, error) { return &resp, err } +func UnmarshalProfileTabPosts(data json.RawMessage) (*ProfileTabPosts, error) { + var resp ProfileTabPosts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabGifts(data json.RawMessage) (*ProfileTabGifts, error) { + var resp ProfileTabGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabMedia(data json.RawMessage) (*ProfileTabMedia, error) { + var resp ProfileTabMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabFiles(data json.RawMessage) (*ProfileTabFiles, error) { + var resp ProfileTabFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabLinks(data json.RawMessage) (*ProfileTabLinks, error) { + var resp ProfileTabLinks + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabMusic(data json.RawMessage) (*ProfileTabMusic, error) { + var resp ProfileTabMusic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabVoice(data json.RawMessage) (*ProfileTabVoice, error) { + var resp ProfileTabVoice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileTabGifs(data json.RawMessage) (*ProfileTabGifs, error) { + var resp ProfileTabGifs + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserTypeRegular(data json.RawMessage) (*UserTypeRegular, error) { var resp UserTypeRegular @@ -7417,6 +10860,30 @@ func UnmarshalBotMenuButton(data json.RawMessage) (*BotMenuButton, error) { return &resp, err } +func UnmarshalBotVerificationParameters(data json.RawMessage) (*BotVerificationParameters, error) { + var resp BotVerificationParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotVerification(data json.RawMessage) (*BotVerification, error) { + var resp BotVerification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVerificationStatus(data json.RawMessage) (*VerificationStatus, error) { + var resp VerificationStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatLocation(data json.RawMessage) (*ChatLocation, error) { var resp ChatLocation @@ -7425,6 +10892,166 @@ func UnmarshalChatLocation(data json.RawMessage) (*ChatLocation, error) { return &resp, err } +func UnmarshalBirthdate(data json.RawMessage) (*Birthdate, error) { + var resp Birthdate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCloseBirthdayUser(data json.RawMessage) (*CloseBirthdayUser, error) { + var resp CloseBirthdayUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessAwayMessageScheduleAlways(data json.RawMessage) (*BusinessAwayMessageScheduleAlways, error) { + var resp BusinessAwayMessageScheduleAlways + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessAwayMessageScheduleOutsideOfOpeningHours(data json.RawMessage) (*BusinessAwayMessageScheduleOutsideOfOpeningHours, error) { + var resp BusinessAwayMessageScheduleOutsideOfOpeningHours + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessAwayMessageScheduleCustom(data json.RawMessage) (*BusinessAwayMessageScheduleCustom, error) { + var resp BusinessAwayMessageScheduleCustom + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessLocation(data json.RawMessage) (*BusinessLocation, error) { + var resp BusinessLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessRecipients(data json.RawMessage) (*BusinessRecipients, error) { + var resp BusinessRecipients + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessAwayMessageSettings(data json.RawMessage) (*BusinessAwayMessageSettings, error) { + var resp BusinessAwayMessageSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessGreetingMessageSettings(data json.RawMessage) (*BusinessGreetingMessageSettings, error) { + var resp BusinessGreetingMessageSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessBotRights(data json.RawMessage) (*BusinessBotRights, error) { + var resp BusinessBotRights + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessConnectedBot(data json.RawMessage) (*BusinessConnectedBot, error) { + var resp BusinessConnectedBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessStartPage(data json.RawMessage) (*BusinessStartPage, error) { + var resp BusinessStartPage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputBusinessStartPage(data json.RawMessage) (*InputBusinessStartPage, error) { + var resp InputBusinessStartPage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessOpeningHoursInterval(data json.RawMessage) (*BusinessOpeningHoursInterval, error) { + var resp BusinessOpeningHoursInterval + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessOpeningHours(data json.RawMessage) (*BusinessOpeningHours, error) { + var resp BusinessOpeningHours + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessInfo(data json.RawMessage) (*BusinessInfo, error) { + var resp BusinessInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessChatLink(data json.RawMessage) (*BusinessChatLink, error) { + var resp BusinessChatLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessChatLinks(data json.RawMessage) (*BusinessChatLinks, error) { + var resp BusinessChatLinks + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputBusinessChatLink(data json.RawMessage) (*InputBusinessChatLink, error) { + var resp InputBusinessChatLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessChatLinkInfo(data json.RawMessage) (*BusinessChatLinkInfo, error) { + var resp BusinessChatLinkInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatPhotoStickerTypeRegularOrMask(data json.RawMessage) (*ChatPhotoStickerTypeRegularOrMask, error) { var resp ChatPhotoStickerTypeRegularOrMask @@ -7521,6 +11148,278 @@ func UnmarshalChatAdministratorRights(data json.RawMessage) (*ChatAdministratorR return &resp, err } +func UnmarshalGiftResalePriceStar(data json.RawMessage) (*GiftResalePriceStar, error) { + var resp GiftResalePriceStar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResalePriceTon(data json.RawMessage) (*GiftResalePriceTon, error) { + var resp GiftResalePriceTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftPurchaseOfferStatePending(data json.RawMessage) (*GiftPurchaseOfferStatePending, error) { + var resp GiftPurchaseOfferStatePending + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftPurchaseOfferStateAccepted(data json.RawMessage) (*GiftPurchaseOfferStateAccepted, error) { + var resp GiftPurchaseOfferStateAccepted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftPurchaseOfferStateRejected(data json.RawMessage) (*GiftPurchaseOfferStateRejected, error) { + var resp GiftPurchaseOfferStateRejected + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostPriceStar(data json.RawMessage) (*SuggestedPostPriceStar, error) { + var resp SuggestedPostPriceStar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostPriceTon(data json.RawMessage) (*SuggestedPostPriceTon, error) { + var resp SuggestedPostPriceTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStatePending(data json.RawMessage) (*SuggestedPostStatePending, error) { + var resp SuggestedPostStatePending + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStateApproved(data json.RawMessage) (*SuggestedPostStateApproved, error) { + var resp SuggestedPostStateApproved + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostStateDeclined(data json.RawMessage) (*SuggestedPostStateDeclined, error) { + var resp SuggestedPostStateDeclined + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostInfo(data json.RawMessage) (*SuggestedPostInfo, error) { + var resp SuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputSuggestedPostInfo(data json.RawMessage) (*InputSuggestedPostInfo, error) { + var resp InputSuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostRefundReasonPostDeleted(data json.RawMessage) (*SuggestedPostRefundReasonPostDeleted, error) { + var resp SuggestedPostRefundReasonPostDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedPostRefundReasonPaymentRefunded(data json.RawMessage) (*SuggestedPostRefundReasonPaymentRefunded, error) { + var resp SuggestedPostRefundReasonPaymentRefunded + + err := json.Unmarshal(data, &resp) + + 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 + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarSubscriptionTypeBot(data json.RawMessage) (*StarSubscriptionTypeBot, error) { + var resp StarSubscriptionTypeBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarSubscriptionPricing(data json.RawMessage) (*StarSubscriptionPricing, error) { + var resp StarSubscriptionPricing + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarSubscription(data json.RawMessage) (*StarSubscription, error) { + var resp StarSubscription + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarSubscriptions(data json.RawMessage) (*StarSubscriptions, error) { + var resp StarSubscriptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateTypeCurrentUser(data json.RawMessage) (*AffiliateTypeCurrentUser, error) { + var resp AffiliateTypeCurrentUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateTypeBot(data json.RawMessage) (*AffiliateTypeBot, error) { + var resp AffiliateTypeBot + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAffiliateTypeChannel(data json.RawMessage) (*AffiliateTypeChannel, error) { + var resp AffiliateTypeChannel + + err := json.Unmarshal(data, &resp) + + 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 UnmarshalConnectedAffiliateProgram(data json.RawMessage) (*ConnectedAffiliateProgram, error) { + var resp ConnectedAffiliateProgram + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalConnectedAffiliatePrograms(data json.RawMessage) (*ConnectedAffiliatePrograms, error) { + var resp ConnectedAffiliatePrograms + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProductInfo(data json.RawMessage) (*ProductInfo, error) { + var resp ProductInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumPaymentOption(data json.RawMessage) (*PremiumPaymentOption, error) { var resp PremiumPaymentOption @@ -7537,16 +11436,32 @@ func UnmarshalPremiumStatePaymentOption(data json.RawMessage) (*PremiumStatePaym return &resp, err } -func UnmarshalPremiumGiftCodePaymentOption(data json.RawMessage) (*PremiumGiftCodePaymentOption, error) { - var resp PremiumGiftCodePaymentOption +func UnmarshalPremiumGiftPaymentOption(data json.RawMessage) (*PremiumGiftPaymentOption, error) { + var resp PremiumGiftPaymentOption err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiftCodePaymentOptions(data json.RawMessage) (*PremiumGiftCodePaymentOptions, error) { - var resp PremiumGiftCodePaymentOptions +func UnmarshalPremiumGiftPaymentOptions(data json.RawMessage) (*PremiumGiftPaymentOptions, error) { + var resp PremiumGiftPaymentOptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayPaymentOption(data json.RawMessage) (*PremiumGiveawayPaymentOption, error) { + var resp PremiumGiveawayPaymentOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumGiveawayPaymentOptions(data json.RawMessage) (*PremiumGiveawayPaymentOptions, error) { + var resp PremiumGiveawayPaymentOptions err := json.Unmarshal(data, &resp) @@ -7561,56 +11476,1160 @@ func UnmarshalPremiumGiftCodeInfo(data json.RawMessage) (*PremiumGiftCodeInfo, e return &resp, err } -func UnmarshalPremiumGiveawayParticipantStatusEligible(data json.RawMessage) (*PremiumGiveawayParticipantStatusEligible, error) { - var resp PremiumGiveawayParticipantStatusEligible +func UnmarshalStarPaymentOption(data json.RawMessage) (*StarPaymentOption, error) { + var resp StarPaymentOption err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayParticipantStatusParticipating(data json.RawMessage) (*PremiumGiveawayParticipantStatusParticipating, error) { - var resp PremiumGiveawayParticipantStatusParticipating +func UnmarshalStarPaymentOptions(data json.RawMessage) (*StarPaymentOptions, error) { + var resp StarPaymentOptions err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayParticipantStatusAlreadyWasMember(data json.RawMessage) (*PremiumGiveawayParticipantStatusAlreadyWasMember, error) { - var resp PremiumGiveawayParticipantStatusAlreadyWasMember +func UnmarshalStarGiveawayWinnerOption(data json.RawMessage) (*StarGiveawayWinnerOption, error) { + var resp StarGiveawayWinnerOption err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayParticipantStatusAdministrator(data json.RawMessage) (*PremiumGiveawayParticipantStatusAdministrator, error) { - var resp PremiumGiveawayParticipantStatusAdministrator +func UnmarshalStarGiveawayPaymentOption(data json.RawMessage) (*StarGiveawayPaymentOption, error) { + var resp StarGiveawayPaymentOption err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayParticipantStatusDisallowedCountry(data json.RawMessage) (*PremiumGiveawayParticipantStatusDisallowedCountry, error) { - var resp PremiumGiveawayParticipantStatusDisallowedCountry +func UnmarshalStarGiveawayPaymentOptions(data json.RawMessage) (*StarGiveawayPaymentOptions, error) { + var resp StarGiveawayPaymentOptions err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayInfoOngoing(data json.RawMessage) (*PremiumGiveawayInfoOngoing, error) { - var resp PremiumGiveawayInfoOngoing +func UnmarshalAcceptedGiftTypes(data json.RawMessage) (*AcceptedGiftTypes, error) { + var resp AcceptedGiftTypes err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayInfoCompleted(data json.RawMessage) (*PremiumGiveawayInfoCompleted, error) { - var resp PremiumGiveawayInfoCompleted +func UnmarshalGiftSettings(data json.RawMessage) (*GiftSettings, error) { + var resp GiftSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftAuction(data json.RawMessage) (*GiftAuction, error) { + var resp GiftAuction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftBackground(data json.RawMessage) (*GiftBackground, error) { + var resp GiftBackground + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftPurchaseLimits(data json.RawMessage) (*GiftPurchaseLimits, error) { + var resp GiftPurchaseLimits + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResaleParameters(data json.RawMessage) (*GiftResaleParameters, error) { + var resp GiftResaleParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftCollection(data json.RawMessage) (*GiftCollection, error) { + var resp GiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftCollections(data json.RawMessage) (*GiftCollections, error) { + var resp GiftCollections + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendGiftResultOk(data json.RawMessage) (*CanSendGiftResultOk, error) { + var resp CanSendGiftResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendGiftResultFail(data json.RawMessage) (*CanSendGiftResultFail, error) { + var resp CanSendGiftResultFail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginUpgrade(data json.RawMessage) (*UpgradedGiftOriginUpgrade, error) { + var resp UpgradedGiftOriginUpgrade + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginTransfer(data json.RawMessage) (*UpgradedGiftOriginTransfer, error) { + var resp UpgradedGiftOriginTransfer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginResale(data json.RawMessage) (*UpgradedGiftOriginResale, error) { + var resp UpgradedGiftOriginResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginBlockchain(data json.RawMessage) (*UpgradedGiftOriginBlockchain, error) { + var resp UpgradedGiftOriginBlockchain + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginPrepaidUpgrade(data json.RawMessage) (*UpgradedGiftOriginPrepaidUpgrade, error) { + var resp UpgradedGiftOriginPrepaidUpgrade + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginOffer(data json.RawMessage) (*UpgradedGiftOriginOffer, error) { + var resp UpgradedGiftOriginOffer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginCraft(data json.RawMessage) (*UpgradedGiftOriginCraft, error) { + var resp UpgradedGiftOriginCraft + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeRarityPerMille(data json.RawMessage) (*UpgradedGiftAttributeRarityPerMille, error) { + var resp UpgradedGiftAttributeRarityPerMille + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeRarityUncommon(data json.RawMessage) (*UpgradedGiftAttributeRarityUncommon, error) { + var resp UpgradedGiftAttributeRarityUncommon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeRarityRare(data json.RawMessage) (*UpgradedGiftAttributeRarityRare, error) { + var resp UpgradedGiftAttributeRarityRare + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeRarityEpic(data json.RawMessage) (*UpgradedGiftAttributeRarityEpic, error) { + var resp UpgradedGiftAttributeRarityEpic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeRarityLegendary(data json.RawMessage) (*UpgradedGiftAttributeRarityLegendary, error) { + var resp UpgradedGiftAttributeRarityLegendary + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftModel(data json.RawMessage) (*UpgradedGiftModel, error) { + var resp UpgradedGiftModel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftSymbol(data json.RawMessage) (*UpgradedGiftSymbol, error) { + var resp UpgradedGiftSymbol + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftBackdropColors(data json.RawMessage) (*UpgradedGiftBackdropColors, error) { + var resp UpgradedGiftBackdropColors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftBackdrop(data json.RawMessage) (*UpgradedGiftBackdrop, error) { + var resp UpgradedGiftBackdrop + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftOriginalDetails(data json.RawMessage) (*UpgradedGiftOriginalDetails, error) { + var resp UpgradedGiftOriginalDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftColors(data json.RawMessage) (*UpgradedGiftColors, error) { + var resp UpgradedGiftColors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGift(data json.RawMessage) (*Gift, error) { + var resp Gift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGift(data json.RawMessage) (*UpgradedGift, error) { + var resp UpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftValueInfo(data json.RawMessage) (*UpgradedGiftValueInfo, error) { + var resp UpgradedGiftValueInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradeGiftResult(data json.RawMessage) (*UpgradeGiftResult, error) { + var resp UpgradeGiftResult + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCraftGiftResultSuccess(data json.RawMessage) (*CraftGiftResultSuccess, error) { + var resp CraftGiftResultSuccess + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCraftGiftResultTooEarly(data json.RawMessage) (*CraftGiftResultTooEarly, error) { + var resp CraftGiftResultTooEarly + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCraftGiftResultInvalidGift(data json.RawMessage) (*CraftGiftResultInvalidGift, error) { + var resp CraftGiftResultInvalidGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCraftGiftResultFail(data json.RawMessage) (*CraftGiftResultFail, error) { + var resp CraftGiftResultFail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAvailableGift(data json.RawMessage) (*AvailableGift, error) { + var resp AvailableGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAvailableGifts(data json.RawMessage) (*AvailableGifts, error) { + var resp AvailableGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftUpgradePrice(data json.RawMessage) (*GiftUpgradePrice, error) { + var resp GiftUpgradePrice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdModel(data json.RawMessage) (*UpgradedGiftAttributeIdModel, error) { + var resp UpgradedGiftAttributeIdModel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdSymbol(data json.RawMessage) (*UpgradedGiftAttributeIdSymbol, error) { + var resp UpgradedGiftAttributeIdSymbol + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftAttributeIdBackdrop(data json.RawMessage) (*UpgradedGiftAttributeIdBackdrop, error) { + var resp UpgradedGiftAttributeIdBackdrop + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftModelCount(data json.RawMessage) (*UpgradedGiftModelCount, error) { + var resp UpgradedGiftModelCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftSymbolCount(data json.RawMessage) (*UpgradedGiftSymbolCount, error) { + var resp UpgradedGiftSymbolCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpgradedGiftBackdropCount(data json.RawMessage) (*UpgradedGiftBackdropCount, error) { + var resp UpgradedGiftBackdropCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderPrice(data json.RawMessage) (*GiftForResaleOrderPrice, error) { + var resp GiftForResaleOrderPrice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderPriceChangeDate(data json.RawMessage) (*GiftForResaleOrderPriceChangeDate, error) { + var resp GiftForResaleOrderPriceChangeDate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResaleOrderNumber(data json.RawMessage) (*GiftForResaleOrderNumber, error) { + var resp GiftForResaleOrderNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftForResale(data json.RawMessage) (*GiftForResale, error) { + var resp GiftForResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftsForResale(data json.RawMessage) (*GiftsForResale, error) { + var resp GiftsForResale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResaleResultOk(data json.RawMessage) (*GiftResaleResultOk, error) { + var resp GiftResaleResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftResaleResultPriceIncreased(data json.RawMessage) (*GiftResaleResultPriceIncreased, error) { + var resp GiftResaleResultPriceIncreased + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSentGiftRegular(data json.RawMessage) (*SentGiftRegular, error) { + var resp SentGiftRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSentGiftUpgraded(data json.RawMessage) (*SentGiftUpgraded, error) { + var resp SentGiftUpgraded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReceivedGift(data json.RawMessage) (*ReceivedGift, error) { + var resp ReceivedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReceivedGifts(data json.RawMessage) (*ReceivedGifts, error) { + var resp ReceivedGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAttributeCraftPersistenceProbability(data json.RawMessage) (*AttributeCraftPersistenceProbability, error) { + var resp AttributeCraftPersistenceProbability + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftsForCrafting(data json.RawMessage) (*GiftsForCrafting, error) { + var resp GiftsForCrafting + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftUpgradePreview(data json.RawMessage) (*GiftUpgradePreview, error) { + var resp GiftUpgradePreview + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftUpgradeVariants(data json.RawMessage) (*GiftUpgradeVariants, error) { + var resp GiftUpgradeVariants + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuctionBid(data json.RawMessage) (*AuctionBid, error) { + var resp AuctionBid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserAuctionBid(data json.RawMessage) (*UserAuctionBid, error) { + var resp UserAuctionBid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuctionRound(data json.RawMessage) (*AuctionRound, error) { + var resp AuctionRound + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuctionStateActive(data json.RawMessage) (*AuctionStateActive, error) { + var resp AuctionStateActive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalAuctionStateFinished(data json.RawMessage) (*AuctionStateFinished, error) { + var resp AuctionStateFinished + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftAuctionState(data json.RawMessage) (*GiftAuctionState, error) { + var resp GiftAuctionState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftAuctionAcquiredGift(data json.RawMessage) (*GiftAuctionAcquiredGift, error) { + var resp GiftAuctionAcquiredGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftAuctionAcquiredGifts(data json.RawMessage) (*GiftAuctionAcquiredGifts, error) { + var resp GiftAuctionAcquiredGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTransactionDirectionIncoming(data json.RawMessage) (*TransactionDirectionIncoming, error) { + var resp TransactionDirectionIncoming + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTransactionDirectionOutgoing(data json.RawMessage) (*TransactionDirectionOutgoing, error) { + var resp TransactionDirectionOutgoing + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePremiumBotDeposit(data json.RawMessage) (*StarTransactionTypePremiumBotDeposit, error) { + var resp StarTransactionTypePremiumBotDeposit + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeAppStoreDeposit(data json.RawMessage) (*StarTransactionTypeAppStoreDeposit, error) { + var resp StarTransactionTypeAppStoreDeposit + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeGooglePlayDeposit(data json.RawMessage) (*StarTransactionTypeGooglePlayDeposit, error) { + var resp StarTransactionTypeGooglePlayDeposit + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeFragmentDeposit(data json.RawMessage) (*StarTransactionTypeFragmentDeposit, error) { + var resp StarTransactionTypeFragmentDeposit + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeUserDeposit(data json.RawMessage) (*StarTransactionTypeUserDeposit, error) { + var resp StarTransactionTypeUserDeposit + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeGiveawayDeposit(data json.RawMessage) (*StarTransactionTypeGiveawayDeposit, error) { + var resp StarTransactionTypeGiveawayDeposit + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeFragmentWithdrawal(data json.RawMessage) (*StarTransactionTypeFragmentWithdrawal, error) { + var resp StarTransactionTypeFragmentWithdrawal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeTelegramAdsWithdrawal(data json.RawMessage) (*StarTransactionTypeTelegramAdsWithdrawal, error) { + var resp StarTransactionTypeTelegramAdsWithdrawal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeTelegramApiUsage(data json.RawMessage) (*StarTransactionTypeTelegramApiUsage, error) { + var resp StarTransactionTypeTelegramApiUsage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeBotPaidMediaPurchase(data json.RawMessage) (*StarTransactionTypeBotPaidMediaPurchase, error) { + var resp StarTransactionTypeBotPaidMediaPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeBotPaidMediaSale(data json.RawMessage) (*StarTransactionTypeBotPaidMediaSale, error) { + var resp StarTransactionTypeBotPaidMediaSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeChannelPaidMediaPurchase(data json.RawMessage) (*StarTransactionTypeChannelPaidMediaPurchase, error) { + var resp StarTransactionTypeChannelPaidMediaPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeChannelPaidMediaSale(data json.RawMessage) (*StarTransactionTypeChannelPaidMediaSale, error) { + var resp StarTransactionTypeChannelPaidMediaSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeBotInvoicePurchase(data json.RawMessage) (*StarTransactionTypeBotInvoicePurchase, error) { + var resp StarTransactionTypeBotInvoicePurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeBotInvoiceSale(data json.RawMessage) (*StarTransactionTypeBotInvoiceSale, error) { + var resp StarTransactionTypeBotInvoiceSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeBotSubscriptionPurchase(data json.RawMessage) (*StarTransactionTypeBotSubscriptionPurchase, error) { + var resp StarTransactionTypeBotSubscriptionPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeBotSubscriptionSale(data json.RawMessage) (*StarTransactionTypeBotSubscriptionSale, error) { + var resp StarTransactionTypeBotSubscriptionSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeChannelSubscriptionPurchase(data json.RawMessage) (*StarTransactionTypeChannelSubscriptionPurchase, error) { + var resp StarTransactionTypeChannelSubscriptionPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeChannelSubscriptionSale(data json.RawMessage) (*StarTransactionTypeChannelSubscriptionSale, error) { + var resp StarTransactionTypeChannelSubscriptionSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeGiftAuctionBid(data json.RawMessage) (*StarTransactionTypeGiftAuctionBid, error) { + var resp StarTransactionTypeGiftAuctionBid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeGiftPurchase(data json.RawMessage) (*StarTransactionTypeGiftPurchase, error) { + var resp StarTransactionTypeGiftPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeGiftPurchaseOffer(data json.RawMessage) (*StarTransactionTypeGiftPurchaseOffer, error) { + var resp StarTransactionTypeGiftPurchaseOffer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeGiftTransfer(data json.RawMessage) (*StarTransactionTypeGiftTransfer, error) { + var resp StarTransactionTypeGiftTransfer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeGiftOriginalDetailsDrop(data json.RawMessage) (*StarTransactionTypeGiftOriginalDetailsDrop, error) { + var resp StarTransactionTypeGiftOriginalDetailsDrop + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeGiftSale(data json.RawMessage) (*StarTransactionTypeGiftSale, error) { + var resp StarTransactionTypeGiftSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeGiftUpgrade(data json.RawMessage) (*StarTransactionTypeGiftUpgrade, error) { + var resp StarTransactionTypeGiftUpgrade + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeGiftUpgradePurchase(data json.RawMessage) (*StarTransactionTypeGiftUpgradePurchase, error) { + var resp StarTransactionTypeGiftUpgradePurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeUpgradedGiftPurchase(data json.RawMessage) (*StarTransactionTypeUpgradedGiftPurchase, error) { + var resp StarTransactionTypeUpgradedGiftPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeUpgradedGiftSale(data json.RawMessage) (*StarTransactionTypeUpgradedGiftSale, error) { + var resp StarTransactionTypeUpgradedGiftSale + + 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 UnmarshalStarTransactionTypePaidMessageSend(data json.RawMessage) (*StarTransactionTypePaidMessageSend, error) { + var resp StarTransactionTypePaidMessageSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePaidMessageReceive(data json.RawMessage) (*StarTransactionTypePaidMessageReceive, error) { + var resp StarTransactionTypePaidMessageReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePaidGroupCallMessageSend(data json.RawMessage) (*StarTransactionTypePaidGroupCallMessageSend, error) { + var resp StarTransactionTypePaidGroupCallMessageSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePaidGroupCallMessageReceive(data json.RawMessage) (*StarTransactionTypePaidGroupCallMessageReceive, error) { + var resp StarTransactionTypePaidGroupCallMessageReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePaidGroupCallReactionSend(data json.RawMessage) (*StarTransactionTypePaidGroupCallReactionSend, error) { + var resp StarTransactionTypePaidGroupCallReactionSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePaidGroupCallReactionReceive(data json.RawMessage) (*StarTransactionTypePaidGroupCallReactionReceive, error) { + var resp StarTransactionTypePaidGroupCallReactionReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data json.RawMessage) (*StarTransactionTypeSuggestedPostPaymentSend, error) { + var resp StarTransactionTypeSuggestedPostPaymentSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data json.RawMessage) (*StarTransactionTypeSuggestedPostPaymentReceive, error) { + var resp StarTransactionTypeSuggestedPostPaymentReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePremiumPurchase(data json.RawMessage) (*StarTransactionTypePremiumPurchase, error) { + var resp StarTransactionTypePremiumPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeBusinessBotTransferSend(data json.RawMessage) (*StarTransactionTypeBusinessBotTransferSend, error) { + var resp StarTransactionTypeBusinessBotTransferSend + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeBusinessBotTransferReceive(data json.RawMessage) (*StarTransactionTypeBusinessBotTransferReceive, error) { + var resp StarTransactionTypeBusinessBotTransferReceive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypePublicPostSearch(data json.RawMessage) (*StarTransactionTypePublicPostSearch, error) { + var resp StarTransactionTypePublicPostSearch + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactionTypeUnsupported(data json.RawMessage) (*StarTransactionTypeUnsupported, error) { + var resp StarTransactionTypeUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransaction(data json.RawMessage) (*StarTransaction, error) { + var resp StarTransaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarTransactions(data json.RawMessage) (*StarTransactions, error) { + var resp StarTransactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeFragmentDeposit(data json.RawMessage) (*TonTransactionTypeFragmentDeposit, error) { + var resp TonTransactionTypeFragmentDeposit + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeFragmentWithdrawal(data json.RawMessage) (*TonTransactionTypeFragmentWithdrawal, error) { + var resp TonTransactionTypeFragmentWithdrawal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeSuggestedPostPayment(data json.RawMessage) (*TonTransactionTypeSuggestedPostPayment, error) { + var resp TonTransactionTypeSuggestedPostPayment + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeGiftPurchaseOffer(data json.RawMessage) (*TonTransactionTypeGiftPurchaseOffer, error) { + var resp TonTransactionTypeGiftPurchaseOffer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeUpgradedGiftPurchase(data json.RawMessage) (*TonTransactionTypeUpgradedGiftPurchase, error) { + var resp TonTransactionTypeUpgradedGiftPurchase + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeUpgradedGiftSale(data json.RawMessage) (*TonTransactionTypeUpgradedGiftSale, error) { + var resp TonTransactionTypeUpgradedGiftSale + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeStakeDiceStake(data json.RawMessage) (*TonTransactionTypeStakeDiceStake, error) { + var resp TonTransactionTypeStakeDiceStake + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeStakeDicePayout(data json.RawMessage) (*TonTransactionTypeStakeDicePayout, error) { + var resp TonTransactionTypeStakeDicePayout + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactionTypeUnsupported(data json.RawMessage) (*TonTransactionTypeUnsupported, error) { + var resp TonTransactionTypeUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransaction(data json.RawMessage) (*TonTransaction, error) { + var resp TonTransaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonTransactions(data json.RawMessage) (*TonTransactions, error) { + var resp TonTransactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalActiveStoryStateLive(data json.RawMessage) (*ActiveStoryStateLive, error) { + var resp ActiveStoryStateLive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalActiveStoryStateUnread(data json.RawMessage) (*ActiveStoryStateUnread, error) { + var resp ActiveStoryStateUnread + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalActiveStoryStateRead(data json.RawMessage) (*ActiveStoryStateRead, error) { + var resp ActiveStoryStateRead + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiveawayParticipantStatusEligible(data json.RawMessage) (*GiveawayParticipantStatusEligible, error) { + var resp GiveawayParticipantStatusEligible + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiveawayParticipantStatusParticipating(data json.RawMessage) (*GiveawayParticipantStatusParticipating, error) { + var resp GiveawayParticipantStatusParticipating + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiveawayParticipantStatusAlreadyWasMember(data json.RawMessage) (*GiveawayParticipantStatusAlreadyWasMember, error) { + var resp GiveawayParticipantStatusAlreadyWasMember + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiveawayParticipantStatusAdministrator(data json.RawMessage) (*GiveawayParticipantStatusAdministrator, error) { + var resp GiveawayParticipantStatusAdministrator + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiveawayParticipantStatusDisallowedCountry(data json.RawMessage) (*GiveawayParticipantStatusDisallowedCountry, error) { + var resp GiveawayParticipantStatusDisallowedCountry + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiveawayInfoOngoing(data json.RawMessage) (*GiveawayInfoOngoing, error) { + var resp GiveawayInfoOngoing + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiveawayInfoCompleted(data json.RawMessage) (*GiveawayInfoCompleted, error) { + var resp GiveawayInfoCompleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiveawayPrizePremium(data json.RawMessage) (*GiveawayPrizePremium, error) { + var resp GiveawayPrizePremium + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiveawayPrizeStars(data json.RawMessage) (*GiveawayPrizeStars, error) { + var resp GiveawayPrizeStars err := json.Unmarshal(data, &resp) @@ -7625,6 +12644,54 @@ func UnmarshalAccentColor(data json.RawMessage) (*AccentColor, error) { return &resp, err } +func UnmarshalProfileAccentColors(data json.RawMessage) (*ProfileAccentColors, error) { + var resp ProfileAccentColors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProfileAccentColor(data json.RawMessage) (*ProfileAccentColor, error) { + var resp ProfileAccentColor + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserRating(data json.RawMessage) (*UserRating, error) { + var resp UserRating + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRestrictionInfo(data json.RawMessage) (*RestrictionInfo, error) { + var resp RestrictionInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiStatusTypeCustomEmoji(data json.RawMessage) (*EmojiStatusTypeCustomEmoji, error) { + var resp EmojiStatusTypeCustomEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiStatusTypeUpgradedGift(data json.RawMessage) (*EmojiStatusTypeUpgradedGift, error) { + var resp EmojiStatusTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiStatus(data json.RawMessage) (*EmojiStatus, error) { var resp EmojiStatus @@ -7641,6 +12708,14 @@ func UnmarshalEmojiStatuses(data json.RawMessage) (*EmojiStatuses, error) { return &resp, err } +func UnmarshalEmojiStatusCustomEmojis(data json.RawMessage) (*EmojiStatusCustomEmojis, error) { + var resp EmojiStatusCustomEmojis + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUsernames(data json.RawMessage) (*Usernames, error) { var resp Usernames @@ -7681,6 +12756,14 @@ func UnmarshalUsers(data json.RawMessage) (*Users, error) { return &resp, err } +func UnmarshalFoundUsers(data json.RawMessage) (*FoundUsers, error) { + var resp FoundUsers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatAdministrator(data json.RawMessage) (*ChatAdministrator, error) { var resp ChatAdministrator @@ -7953,6 +13036,14 @@ func UnmarshalInviteLinkChatTypeChannel(data json.RawMessage) (*InviteLinkChatTy return &resp, err } +func UnmarshalChatInviteLinkSubscriptionInfo(data json.RawMessage) (*ChatInviteLinkSubscriptionInfo, error) { + var resp ChatInviteLinkSubscriptionInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatInviteLinkInfo(data json.RawMessage) (*ChatInviteLinkInfo, error) { var resp ChatInviteLinkInfo @@ -8049,6 +13140,14 @@ func UnmarshalSecretChat(data json.RawMessage) (*SecretChat, error) { return &resp, err } +func UnmarshalPublicPostSearchLimits(data json.RawMessage) (*PublicPostSearchLimits, error) { + var resp PublicPostSearchLimits + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSenderUser(data json.RawMessage) (*MessageSenderUser, error) { var resp MessageSenderUser @@ -8089,6 +13188,46 @@ func UnmarshalChatMessageSenders(data json.RawMessage) (*ChatMessageSenders, err return &resp, err } +func UnmarshalMessageReadDateRead(data json.RawMessage) (*MessageReadDateRead, error) { + var resp MessageReadDateRead + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageReadDateUnread(data json.RawMessage) (*MessageReadDateUnread, error) { + var resp MessageReadDateUnread + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageReadDateTooOld(data json.RawMessage) (*MessageReadDateTooOld, error) { + var resp MessageReadDateTooOld + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageReadDateUserPrivacyRestricted(data json.RawMessage) (*MessageReadDateUserPrivacyRestricted, error) { + var resp MessageReadDateUserPrivacyRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageReadDateMyPrivacyRestricted(data json.RawMessage) (*MessageReadDateMyPrivacyRestricted, error) { + var resp MessageReadDateMyPrivacyRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageViewer(data json.RawMessage) (*MessageViewer, error) { var resp MessageViewer @@ -8137,6 +13276,14 @@ func UnmarshalMessageOriginChannel(data json.RawMessage) (*MessageOriginChannel, return &resp, err } +func UnmarshalForwardSource(data json.RawMessage) (*ForwardSource, error) { + var resp ForwardSource + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalReactionTypeEmoji(data json.RawMessage) (*ReactionTypeEmoji, error) { var resp ReactionTypeEmoji @@ -8153,6 +13300,54 @@ func UnmarshalReactionTypeCustomEmoji(data json.RawMessage) (*ReactionTypeCustom return &resp, err } +func UnmarshalReactionTypePaid(data json.RawMessage) (*ReactionTypePaid, error) { + var resp ReactionTypePaid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaidReactionTypeRegular(data json.RawMessage) (*PaidReactionTypeRegular, error) { + var resp PaidReactionTypeRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaidReactionTypeAnonymous(data json.RawMessage) (*PaidReactionTypeAnonymous, error) { + var resp PaidReactionTypeAnonymous + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaidReactionTypeChat(data json.RawMessage) (*PaidReactionTypeChat, error) { + var resp PaidReactionTypeChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaidReactor(data json.RawMessage) (*PaidReactor, error) { + var resp PaidReactor + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLiveStoryDonors(data json.RawMessage) (*LiveStoryDonors, error) { + var resp LiveStoryDonors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageForwardInfo(data json.RawMessage) (*MessageForwardInfo, error) { var resp MessageForwardInfo @@ -8185,6 +13380,14 @@ func UnmarshalMessageReaction(data json.RawMessage) (*MessageReaction, error) { return &resp, err } +func UnmarshalMessageReactions(data json.RawMessage) (*MessageReactions, error) { + var resp MessageReactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageInteractionInfo(data json.RawMessage) (*MessageInteractionInfo, error) { var resp MessageInteractionInfo @@ -8201,6 +13404,62 @@ func UnmarshalUnreadReaction(data json.RawMessage) (*UnreadReaction, error) { return &resp, err } +func UnmarshalMessageTopicThread(data json.RawMessage) (*MessageTopicThread, error) { + var resp MessageTopicThread + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageTopicForum(data json.RawMessage) (*MessageTopicForum, error) { + var resp MessageTopicForum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageTopicDirectMessages(data json.RawMessage) (*MessageTopicDirectMessages, error) { + var resp MessageTopicDirectMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageTopicSavedMessages(data json.RawMessage) (*MessageTopicSavedMessages, error) { + var resp MessageTopicSavedMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageEffectTypeEmojiReaction(data json.RawMessage) (*MessageEffectTypeEmojiReaction, error) { + var resp MessageEffectTypeEmojiReaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageEffectTypePremiumSticker(data json.RawMessage) (*MessageEffectTypePremiumSticker, error) { + var resp MessageEffectTypePremiumSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageEffect(data json.RawMessage) (*MessageEffect, error) { + var resp MessageEffect + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSendingStatePending(data json.RawMessage) (*MessageSendingStatePending, error) { var resp MessageSendingStatePending @@ -8217,6 +13476,22 @@ func UnmarshalMessageSendingStateFailed(data json.RawMessage) (*MessageSendingSt return &resp, err } +func UnmarshalTextQuote(data json.RawMessage) (*TextQuote, error) { + var resp TextQuote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputTextQuote(data json.RawMessage) (*InputTextQuote, error) { + var resp InputTextQuote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageReplyToMessage(data json.RawMessage) (*MessageReplyToMessage, error) { var resp MessageReplyToMessage @@ -8241,6 +13516,14 @@ func UnmarshalInputMessageReplyToMessage(data json.RawMessage) (*InputMessageRep return &resp, err } +func UnmarshalInputMessageReplyToExternalMessage(data json.RawMessage) (*InputMessageReplyToExternalMessage, error) { + var resp InputMessageReplyToExternalMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputMessageReplyToStory(data json.RawMessage) (*InputMessageReplyToStory, error) { var resp InputMessageReplyToStory @@ -8249,6 +13532,14 @@ func UnmarshalInputMessageReplyToStory(data json.RawMessage) (*InputMessageReply return &resp, err } +func UnmarshalFactCheck(data json.RawMessage) (*FactCheck, error) { + var resp FactCheck + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessage(data json.RawMessage) (*Message, error) { var resp Message @@ -8281,6 +13572,14 @@ func UnmarshalFoundChatMessages(data json.RawMessage) (*FoundChatMessages, error return &resp, err } +func UnmarshalFoundPublicPosts(data json.RawMessage) (*FoundPublicPosts, error) { + var resp FoundPublicPosts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessagePosition(data json.RawMessage) (*MessagePosition, error) { var resp MessagePosition @@ -8313,6 +13612,22 @@ func UnmarshalMessageCalendar(data json.RawMessage) (*MessageCalendar, error) { return &resp, err } +func UnmarshalBusinessMessage(data json.RawMessage) (*BusinessMessage, error) { + var resp BusinessMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessMessages(data json.RawMessage) (*BusinessMessages, error) { + var resp BusinessMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSourceChatHistory(data json.RawMessage) (*MessageSourceChatHistory, error) { var resp MessageSourceChatHistory @@ -8337,6 +13652,14 @@ func UnmarshalMessageSourceForumTopicHistory(data json.RawMessage) (*MessageSour return &resp, err } +func UnmarshalMessageSourceDirectMessagesChatTopicHistory(data json.RawMessage) (*MessageSourceDirectMessagesChatTopicHistory, error) { + var resp MessageSourceDirectMessagesChatTopicHistory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSourceHistoryPreview(data json.RawMessage) (*MessageSourceHistoryPreview, error) { var resp MessageSourceHistoryPreview @@ -8393,40 +13716,8 @@ func UnmarshalMessageSourceOther(data json.RawMessage) (*MessageSourceOther, err return &resp, err } -func UnmarshalMessageSponsorTypeBot(data json.RawMessage) (*MessageSponsorTypeBot, error) { - var resp MessageSponsorTypeBot - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalMessageSponsorTypePublicChannel(data json.RawMessage) (*MessageSponsorTypePublicChannel, error) { - var resp MessageSponsorTypePublicChannel - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalMessageSponsorTypePrivateChannel(data json.RawMessage) (*MessageSponsorTypePrivateChannel, error) { - var resp MessageSponsorTypePrivateChannel - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalMessageSponsorTypeWebsite(data json.RawMessage) (*MessageSponsorTypeWebsite, error) { - var resp MessageSponsorTypeWebsite - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalMessageSponsor(data json.RawMessage) (*MessageSponsor, error) { - var resp MessageSponsor +func UnmarshalAdvertisementSponsor(data json.RawMessage) (*AdvertisementSponsor, error) { + var resp AdvertisementSponsor err := json.Unmarshal(data, &resp) @@ -8449,6 +13740,86 @@ func UnmarshalSponsoredMessages(data json.RawMessage) (*SponsoredMessages, error return &resp, err } +func UnmarshalSponsoredChat(data json.RawMessage) (*SponsoredChat, error) { + var resp SponsoredChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSponsoredChats(data json.RawMessage) (*SponsoredChats, error) { + var resp SponsoredChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVideoMessageAdvertisement(data json.RawMessage) (*VideoMessageAdvertisement, error) { + var resp VideoMessageAdvertisement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalVideoMessageAdvertisements(data json.RawMessage) (*VideoMessageAdvertisements, error) { + var resp VideoMessageAdvertisements + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportOption(data json.RawMessage) (*ReportOption, error) { + var resp ReportOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportSponsoredResultOk(data json.RawMessage) (*ReportSponsoredResultOk, error) { + var resp ReportSponsoredResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportSponsoredResultFailed(data json.RawMessage) (*ReportSponsoredResultFailed, error) { + var resp ReportSponsoredResultFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportSponsoredResultOptionRequired(data json.RawMessage) (*ReportSponsoredResultOptionRequired, error) { + var resp ReportSponsoredResultOptionRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportSponsoredResultAdsHidden(data json.RawMessage) (*ReportSponsoredResultAdsHidden, error) { + var resp ReportSponsoredResultAdsHidden + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportSponsoredResultPremiumRequired(data json.RawMessage) (*ReportSponsoredResultPremiumRequired, error) { + var resp ReportSponsoredResultPremiumRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFileDownload(data json.RawMessage) (*FileDownload, error) { var resp FileDownload @@ -8513,6 +13884,38 @@ func UnmarshalScopeNotificationSettings(data json.RawMessage) (*ScopeNotificatio return &resp, err } +func UnmarshalReactionNotificationSourceNone(data json.RawMessage) (*ReactionNotificationSourceNone, error) { + var resp ReactionNotificationSourceNone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReactionNotificationSourceContacts(data json.RawMessage) (*ReactionNotificationSourceContacts, error) { + var resp ReactionNotificationSourceContacts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReactionNotificationSourceAll(data json.RawMessage) (*ReactionNotificationSourceAll, error) { + var resp ReactionNotificationSourceAll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReactionNotificationSettings(data json.RawMessage) (*ReactionNotificationSettings, error) { + var resp ReactionNotificationSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDraftMessage(data json.RawMessage) (*DraftMessage, error) { var resp DraftMessage @@ -8561,6 +13964,14 @@ func UnmarshalChatFolderIcon(data json.RawMessage) (*ChatFolderIcon, error) { return &resp, err } +func UnmarshalChatFolderName(data json.RawMessage) (*ChatFolderName, error) { + var resp ChatFolderName + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatFolder(data json.RawMessage) (*ChatFolder, error) { var resp ChatFolder @@ -8697,6 +14108,30 @@ func UnmarshalChatAvailableReactionsSome(data json.RawMessage) (*ChatAvailableRe return &resp, err } +func UnmarshalSavedMessagesTag(data json.RawMessage) (*SavedMessagesTag, error) { + var resp SavedMessagesTag + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSavedMessagesTags(data json.RawMessage) (*SavedMessagesTags, error) { + var resp SavedMessagesTags + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessBotManageBar(data json.RawMessage) (*BusinessBotManageBar, error) { + var resp BusinessBotManageBar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalVideoChat(data json.RawMessage) (*VideoChat, error) { var resp VideoChat @@ -8721,16 +14156,24 @@ func UnmarshalChats(data json.RawMessage) (*Chats, error) { return &resp, err } -func UnmarshalChatNearby(data json.RawMessage) (*ChatNearby, error) { - var resp ChatNearby +func UnmarshalFailedToAddMember(data json.RawMessage) (*FailedToAddMember, error) { + var resp FailedToAddMember err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatsNearby(data json.RawMessage) (*ChatsNearby, error) { - var resp ChatsNearby +func UnmarshalFailedToAddMembers(data json.RawMessage) (*FailedToAddMembers, error) { + var resp FailedToAddMembers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCreatedBasicGroupChat(data json.RawMessage) (*CreatedBasicGroupChat, error) { + var resp CreatedBasicGroupChat err := json.Unmarshal(data, &resp) @@ -8753,16 +14196,16 @@ func UnmarshalPublicChatTypeIsLocationBased(data json.RawMessage) (*PublicChatTy return &resp, err } -func UnmarshalChatActionBarReportSpam(data json.RawMessage) (*ChatActionBarReportSpam, error) { - var resp ChatActionBarReportSpam +func UnmarshalAccountInfo(data json.RawMessage) (*AccountInfo, error) { + var resp AccountInfo err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatActionBarReportUnrelatedLocation(data json.RawMessage) (*ChatActionBarReportUnrelatedLocation, error) { - var resp ChatActionBarReportUnrelatedLocation +func UnmarshalChatActionBarReportSpam(data json.RawMessage) (*ChatActionBarReportSpam, error) { + var resp ChatActionBarReportSpam err := json.Unmarshal(data, &resp) @@ -8809,6 +14252,38 @@ func UnmarshalChatActionBarJoinRequest(data json.RawMessage) (*ChatActionBarJoin return &resp, err } +func UnmarshalButtonStyleDefault(data json.RawMessage) (*ButtonStyleDefault, error) { + var resp ButtonStyleDefault + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalButtonStylePrimary(data json.RawMessage) (*ButtonStylePrimary, error) { + var resp ButtonStylePrimary + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalButtonStyleDanger(data json.RawMessage) (*ButtonStyleDanger, error) { + var resp ButtonStyleDanger + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalButtonStyleSuccess(data json.RawMessage) (*ButtonStyleSuccess, error) { + var resp ButtonStyleSuccess + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalKeyboardButtonTypeText(data json.RawMessage) (*KeyboardButtonTypeText, error) { var resp KeyboardButtonTypeText @@ -8841,8 +14316,8 @@ func UnmarshalKeyboardButtonTypeRequestPoll(data json.RawMessage) (*KeyboardButt return &resp, err } -func UnmarshalKeyboardButtonTypeRequestUser(data json.RawMessage) (*KeyboardButtonTypeRequestUser, error) { - var resp KeyboardButtonTypeRequestUser +func UnmarshalKeyboardButtonTypeRequestUsers(data json.RawMessage) (*KeyboardButtonTypeRequestUsers, error) { + var resp KeyboardButtonTypeRequestUsers err := json.Unmarshal(data, &resp) @@ -8945,6 +14420,14 @@ func UnmarshalInlineKeyboardButtonTypeUser(data json.RawMessage) (*InlineKeyboar return &resp, err } +func UnmarshalInlineKeyboardButtonTypeCopyText(data json.RawMessage) (*InlineKeyboardButtonTypeCopyText, error) { + var resp InlineKeyboardButtonTypeCopyText + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInlineKeyboardButton(data json.RawMessage) (*InlineKeyboardButton, error) { var resp InlineKeyboardButton @@ -9001,6 +14484,38 @@ func UnmarshalLoginUrlInfoRequestConfirmation(data json.RawMessage) (*LoginUrlIn return &resp, err } +func UnmarshalThemeParameters(data json.RawMessage) (*ThemeParameters, error) { + var resp ThemeParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebAppOpenModeCompact(data json.RawMessage) (*WebAppOpenModeCompact, error) { + var resp WebAppOpenModeCompact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebAppOpenModeFullSize(data json.RawMessage) (*WebAppOpenModeFullSize, error) { + var resp WebAppOpenModeFullSize + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebAppOpenModeFullScreen(data json.RawMessage) (*WebAppOpenModeFullScreen, error) { + var resp WebAppOpenModeFullScreen + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFoundWebApp(data json.RawMessage) (*FoundWebApp, error) { var resp FoundWebApp @@ -9017,6 +14532,22 @@ func UnmarshalWebAppInfo(data json.RawMessage) (*WebAppInfo, error) { return &resp, err } +func UnmarshalMainWebApp(data json.RawMessage) (*MainWebApp, error) { + var resp MainWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalWebAppOpenParameters(data json.RawMessage) (*WebAppOpenParameters, error) { + var resp WebAppOpenParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageThreadInfo(data json.RawMessage) (*MessageThreadInfo, error) { var resp MessageThreadInfo @@ -9025,6 +14556,46 @@ func UnmarshalMessageThreadInfo(data json.RawMessage) (*MessageThreadInfo, error return &resp, err } +func UnmarshalSavedMessagesTopicTypeMyNotes(data json.RawMessage) (*SavedMessagesTopicTypeMyNotes, error) { + var resp SavedMessagesTopicTypeMyNotes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSavedMessagesTopicTypeAuthorHidden(data json.RawMessage) (*SavedMessagesTopicTypeAuthorHidden, error) { + var resp SavedMessagesTopicTypeAuthorHidden + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSavedMessagesTopicTypeSavedFromChat(data json.RawMessage) (*SavedMessagesTopicTypeSavedFromChat, error) { + var resp SavedMessagesTopicTypeSavedFromChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSavedMessagesTopic(data json.RawMessage) (*SavedMessagesTopic, error) { + var resp SavedMessagesTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDirectMessagesChatTopic(data json.RawMessage) (*DirectMessagesChatTopic, error) { + var resp DirectMessagesChatTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalForumTopicIcon(data json.RawMessage) (*ForumTopicIcon, error) { var resp ForumTopicIcon @@ -9065,6 +14636,70 @@ func UnmarshalLinkPreviewOptions(data json.RawMessage) (*LinkPreviewOptions, err return &resp, err } +func UnmarshalSharedUser(data json.RawMessage) (*SharedUser, error) { + var resp SharedUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSharedChat(data json.RawMessage) (*SharedChat, error) { + var resp SharedChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeClassic(data json.RawMessage) (*BuiltInThemeClassic, error) { + var resp BuiltInThemeClassic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeDay(data json.RawMessage) (*BuiltInThemeDay, error) { + var resp BuiltInThemeDay + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeNight(data json.RawMessage) (*BuiltInThemeNight, error) { + var resp BuiltInThemeNight + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeTinted(data json.RawMessage) (*BuiltInThemeTinted, error) { + var resp BuiltInThemeTinted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBuiltInThemeArctic(data json.RawMessage) (*BuiltInThemeArctic, error) { + var resp BuiltInThemeArctic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalThemeSettings(data json.RawMessage) (*ThemeSettings, error) { + var resp ThemeSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalRichTextPlain(data json.RawMessage) (*RichTextPlain, error) { var resp RichTextPlain @@ -9521,8 +15156,328 @@ func UnmarshalWebPageInstantView(data json.RawMessage) (*WebPageInstantView, err return &resp, err } -func UnmarshalWebPage(data json.RawMessage) (*WebPage, error) { - var resp WebPage +func UnmarshalLinkPreviewAlbumMediaPhoto(data json.RawMessage) (*LinkPreviewAlbumMediaPhoto, error) { + var resp LinkPreviewAlbumMediaPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewAlbumMediaVideo(data json.RawMessage) (*LinkPreviewAlbumMediaVideo, error) { + var resp LinkPreviewAlbumMediaVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeAlbum(data json.RawMessage) (*LinkPreviewTypeAlbum, error) { + var resp LinkPreviewTypeAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeAnimation(data json.RawMessage) (*LinkPreviewTypeAnimation, error) { + var resp LinkPreviewTypeAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeApp(data json.RawMessage) (*LinkPreviewTypeApp, error) { + var resp LinkPreviewTypeApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeArticle(data json.RawMessage) (*LinkPreviewTypeArticle, error) { + var resp LinkPreviewTypeArticle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeAudio(data json.RawMessage) (*LinkPreviewTypeAudio, error) { + var resp LinkPreviewTypeAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeBackground(data json.RawMessage) (*LinkPreviewTypeBackground, error) { + var resp LinkPreviewTypeBackground + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeChannelBoost(data json.RawMessage) (*LinkPreviewTypeChannelBoost, error) { + var resp LinkPreviewTypeChannelBoost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeChat(data json.RawMessage) (*LinkPreviewTypeChat, error) { + var resp LinkPreviewTypeChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeDirectMessagesChat(data json.RawMessage) (*LinkPreviewTypeDirectMessagesChat, error) { + var resp LinkPreviewTypeDirectMessagesChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeDocument(data json.RawMessage) (*LinkPreviewTypeDocument, error) { + var resp LinkPreviewTypeDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeEmbeddedAnimationPlayer(data json.RawMessage) (*LinkPreviewTypeEmbeddedAnimationPlayer, error) { + var resp LinkPreviewTypeEmbeddedAnimationPlayer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeEmbeddedAudioPlayer(data json.RawMessage) (*LinkPreviewTypeEmbeddedAudioPlayer, error) { + var resp LinkPreviewTypeEmbeddedAudioPlayer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeEmbeddedVideoPlayer(data json.RawMessage) (*LinkPreviewTypeEmbeddedVideoPlayer, error) { + var resp LinkPreviewTypeEmbeddedVideoPlayer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeExternalAudio(data json.RawMessage) (*LinkPreviewTypeExternalAudio, error) { + var resp LinkPreviewTypeExternalAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeExternalVideo(data json.RawMessage) (*LinkPreviewTypeExternalVideo, error) { + var resp LinkPreviewTypeExternalVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeGiftAuction(data json.RawMessage) (*LinkPreviewTypeGiftAuction, error) { + var resp LinkPreviewTypeGiftAuction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeGiftCollection(data json.RawMessage) (*LinkPreviewTypeGiftCollection, error) { + var resp LinkPreviewTypeGiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeGroupCall(data json.RawMessage) (*LinkPreviewTypeGroupCall, error) { + var resp LinkPreviewTypeGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeInvoice(data json.RawMessage) (*LinkPreviewTypeInvoice, error) { + var resp LinkPreviewTypeInvoice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeLiveStory(data json.RawMessage) (*LinkPreviewTypeLiveStory, error) { + var resp LinkPreviewTypeLiveStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeMessage(data json.RawMessage) (*LinkPreviewTypeMessage, error) { + var resp LinkPreviewTypeMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypePhoto(data json.RawMessage) (*LinkPreviewTypePhoto, error) { + var resp LinkPreviewTypePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypePremiumGiftCode(data json.RawMessage) (*LinkPreviewTypePremiumGiftCode, error) { + var resp LinkPreviewTypePremiumGiftCode + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeShareableChatFolder(data json.RawMessage) (*LinkPreviewTypeShareableChatFolder, error) { + var resp LinkPreviewTypeShareableChatFolder + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeSticker(data json.RawMessage) (*LinkPreviewTypeSticker, error) { + var resp LinkPreviewTypeSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeStickerSet(data json.RawMessage) (*LinkPreviewTypeStickerSet, error) { + var resp LinkPreviewTypeStickerSet + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeStory(data json.RawMessage) (*LinkPreviewTypeStory, error) { + var resp LinkPreviewTypeStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeStoryAlbum(data json.RawMessage) (*LinkPreviewTypeStoryAlbum, error) { + var resp LinkPreviewTypeStoryAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeSupergroupBoost(data json.RawMessage) (*LinkPreviewTypeSupergroupBoost, error) { + var resp LinkPreviewTypeSupergroupBoost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeTheme(data json.RawMessage) (*LinkPreviewTypeTheme, error) { + var resp LinkPreviewTypeTheme + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeUnsupported(data json.RawMessage) (*LinkPreviewTypeUnsupported, error) { + var resp LinkPreviewTypeUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeUpgradedGift(data json.RawMessage) (*LinkPreviewTypeUpgradedGift, error) { + var resp LinkPreviewTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeUser(data json.RawMessage) (*LinkPreviewTypeUser, error) { + var resp LinkPreviewTypeUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeVideo(data json.RawMessage) (*LinkPreviewTypeVideo, error) { + var resp LinkPreviewTypeVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeVideoChat(data json.RawMessage) (*LinkPreviewTypeVideoChat, error) { + var resp LinkPreviewTypeVideoChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeVideoNote(data json.RawMessage) (*LinkPreviewTypeVideoNote, error) { + var resp LinkPreviewTypeVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeVoiceNote(data json.RawMessage) (*LinkPreviewTypeVoiceNote, error) { + var resp LinkPreviewTypeVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreviewTypeWebApp(data json.RawMessage) (*LinkPreviewTypeWebApp, error) { + var resp LinkPreviewTypeWebApp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLinkPreview(data json.RawMessage) (*LinkPreview, error) { + var resp LinkPreview err := json.Unmarshal(data, &resp) @@ -9553,6 +15508,30 @@ func UnmarshalPhoneNumberInfo(data json.RawMessage) (*PhoneNumberInfo, error) { return &resp, err } +func UnmarshalCollectibleItemTypeUsername(data json.RawMessage) (*CollectibleItemTypeUsername, error) { + var resp CollectibleItemTypeUsername + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCollectibleItemTypePhoneNumber(data json.RawMessage) (*CollectibleItemTypePhoneNumber, error) { + var resp CollectibleItemTypePhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCollectibleItemInfo(data json.RawMessage) (*CollectibleItemInfo, error) { + var resp CollectibleItemInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalBankCardActionOpenUrl(data json.RawMessage) (*BankCardActionOpenUrl, error) { var resp BankCardActionOpenUrl @@ -9577,8 +15556,8 @@ func UnmarshalAddress(data json.RawMessage) (*Address, error) { return &resp, err } -func UnmarshalThemeParameters(data json.RawMessage) (*ThemeParameters, error) { - var resp ThemeParameters +func UnmarshalLocationAddress(data json.RawMessage) (*LocationAddress, error) { + var resp LocationAddress err := json.Unmarshal(data, &resp) @@ -9689,6 +15668,30 @@ func UnmarshalPaymentOption(data json.RawMessage) (*PaymentOption, error) { return &resp, err } +func UnmarshalPaymentFormTypeRegular(data json.RawMessage) (*PaymentFormTypeRegular, error) { + var resp PaymentFormTypeRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaymentFormTypeStars(data json.RawMessage) (*PaymentFormTypeStars, error) { + var resp PaymentFormTypeStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaymentFormTypeStarSubscription(data json.RawMessage) (*PaymentFormTypeStarSubscription, error) { + var resp PaymentFormTypeStarSubscription + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPaymentForm(data json.RawMessage) (*PaymentForm, error) { var resp PaymentForm @@ -9713,6 +15716,22 @@ func UnmarshalPaymentResult(data json.RawMessage) (*PaymentResult, error) { return &resp, err } +func UnmarshalPaymentReceiptTypeRegular(data json.RawMessage) (*PaymentReceiptTypeRegular, error) { + var resp PaymentReceiptTypeRegular + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPaymentReceiptTypeStars(data json.RawMessage) (*PaymentReceiptTypeStars, error) { + var resp PaymentReceiptTypeStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPaymentReceipt(data json.RawMessage) (*PaymentReceipt, error) { var resp PaymentReceipt @@ -9745,40 +15764,40 @@ func UnmarshalInputInvoiceTelegram(data json.RawMessage) (*InputInvoiceTelegram, return &resp, err } -func UnmarshalMessageExtendedMediaPreview(data json.RawMessage) (*MessageExtendedMediaPreview, error) { - var resp MessageExtendedMediaPreview +func UnmarshalPaidMediaPreview(data json.RawMessage) (*PaidMediaPreview, error) { + var resp PaidMediaPreview err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessageExtendedMediaPhoto(data json.RawMessage) (*MessageExtendedMediaPhoto, error) { - var resp MessageExtendedMediaPhoto +func UnmarshalPaidMediaPhoto(data json.RawMessage) (*PaidMediaPhoto, error) { + var resp PaidMediaPhoto err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessageExtendedMediaVideo(data json.RawMessage) (*MessageExtendedMediaVideo, error) { - var resp MessageExtendedMediaVideo +func UnmarshalPaidMediaVideo(data json.RawMessage) (*PaidMediaVideo, error) { + var resp PaidMediaVideo err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessageExtendedMediaUnsupported(data json.RawMessage) (*MessageExtendedMediaUnsupported, error) { - var resp MessageExtendedMediaUnsupported +func UnmarshalPaidMediaUnsupported(data json.RawMessage) (*PaidMediaUnsupported, error) { + var resp PaidMediaUnsupported err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumGiveawayParameters(data json.RawMessage) (*PremiumGiveawayParameters, error) { - var resp PremiumGiveawayParameters +func UnmarshalGiveawayParameters(data json.RawMessage) (*GiveawayParameters, error) { + var resp GiveawayParameters err := json.Unmarshal(data, &resp) @@ -10401,16 +16420,16 @@ func UnmarshalMessageDocument(data json.RawMessage) (*MessageDocument, error) { return &resp, err } -func UnmarshalMessagePhoto(data json.RawMessage) (*MessagePhoto, error) { - var resp MessagePhoto +func UnmarshalMessagePaidMedia(data json.RawMessage) (*MessagePaidMedia, error) { + var resp MessagePaidMedia err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessageExpiredPhoto(data json.RawMessage) (*MessageExpiredPhoto, error) { - var resp MessageExpiredPhoto +func UnmarshalMessagePhoto(data json.RawMessage) (*MessagePhoto, error) { + var resp MessagePhoto err := json.Unmarshal(data, &resp) @@ -10433,14 +16452,6 @@ func UnmarshalMessageVideo(data json.RawMessage) (*MessageVideo, error) { return &resp, err } -func UnmarshalMessageExpiredVideo(data json.RawMessage) (*MessageExpiredVideo, error) { - var resp MessageExpiredVideo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalMessageVideoNote(data json.RawMessage) (*MessageVideoNote, error) { var resp MessageVideoNote @@ -10457,6 +16468,38 @@ func UnmarshalMessageVoiceNote(data json.RawMessage) (*MessageVoiceNote, error) return &resp, err } +func UnmarshalMessageExpiredPhoto(data json.RawMessage) (*MessageExpiredPhoto, error) { + var resp MessageExpiredPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageExpiredVideo(data json.RawMessage) (*MessageExpiredVideo, error) { + var resp MessageExpiredVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageExpiredVideoNote(data json.RawMessage) (*MessageExpiredVideoNote, error) { + var resp MessageExpiredVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageExpiredVoiceNote(data json.RawMessage) (*MessageExpiredVoiceNote, error) { + var resp MessageExpiredVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageLocation(data json.RawMessage) (*MessageLocation, error) { var resp MessageLocation @@ -10513,6 +16556,14 @@ func UnmarshalMessagePoll(data json.RawMessage) (*MessagePoll, error) { return &resp, err } +func UnmarshalMessageStakeDice(data json.RawMessage) (*MessageStakeDice, error) { + var resp MessageStakeDice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageStory(data json.RawMessage) (*MessageStory, error) { var resp MessageStory @@ -10521,6 +16572,14 @@ func UnmarshalMessageStory(data json.RawMessage) (*MessageStory, error) { return &resp, err } +func UnmarshalMessageChecklist(data json.RawMessage) (*MessageChecklist, error) { + var resp MessageChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageInvoice(data json.RawMessage) (*MessageInvoice, error) { var resp MessageInvoice @@ -10537,6 +16596,14 @@ func UnmarshalMessageCall(data json.RawMessage) (*MessageCall, error) { return &resp, err } +func UnmarshalMessageGroupCall(data json.RawMessage) (*MessageGroupCall, error) { + var resp MessageGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageVideoChatScheduled(data json.RawMessage) (*MessageVideoChatScheduled, error) { var resp MessageVideoChatScheduled @@ -10609,6 +16676,22 @@ func UnmarshalMessageChatDeletePhoto(data json.RawMessage) (*MessageChatDeletePh return &resp, err } +func UnmarshalMessageChatOwnerLeft(data json.RawMessage) (*MessageChatOwnerLeft, error) { + var resp MessageChatOwnerLeft + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChatOwnerChanged(data json.RawMessage) (*MessageChatOwnerChanged, error) { + var resp MessageChatOwnerChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageChatAddMembers(data json.RawMessage) (*MessageChatAddMembers, error) { var resp MessageChatAddMembers @@ -10697,6 +16780,14 @@ func UnmarshalMessageChatSetMessageAutoDeleteTime(data json.RawMessage) (*Messag return &resp, err } +func UnmarshalMessageChatBoost(data json.RawMessage) (*MessageChatBoost, error) { + var resp MessageChatBoost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageForumTopicCreated(data json.RawMessage) (*MessageForumTopicCreated, error) { var resp MessageForumTopicCreated @@ -10737,6 +16828,14 @@ func UnmarshalMessageSuggestProfilePhoto(data json.RawMessage) (*MessageSuggestP return &resp, err } +func UnmarshalMessageSuggestBirthdate(data json.RawMessage) (*MessageSuggestBirthdate, error) { + var resp MessageSuggestBirthdate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageCustomServiceAction(data json.RawMessage) (*MessageCustomServiceAction, error) { var resp MessageCustomServiceAction @@ -10769,6 +16868,14 @@ func UnmarshalMessagePaymentSuccessfulBot(data json.RawMessage) (*MessagePayment return &resp, err } +func UnmarshalMessagePaymentRefunded(data json.RawMessage) (*MessagePaymentRefunded, error) { + var resp MessagePaymentRefunded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageGiftedPremium(data json.RawMessage) (*MessageGiftedPremium, error) { var resp MessageGiftedPremium @@ -10785,16 +16892,176 @@ func UnmarshalMessagePremiumGiftCode(data json.RawMessage) (*MessagePremiumGiftC return &resp, err } -func UnmarshalMessagePremiumGiveawayCreated(data json.RawMessage) (*MessagePremiumGiveawayCreated, error) { - var resp MessagePremiumGiveawayCreated +func UnmarshalMessageGiveawayCreated(data json.RawMessage) (*MessageGiveawayCreated, error) { + var resp MessageGiveawayCreated err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessagePremiumGiveaway(data json.RawMessage) (*MessagePremiumGiveaway, error) { - var resp MessagePremiumGiveaway +func UnmarshalMessageGiveaway(data json.RawMessage) (*MessageGiveaway, error) { + var resp MessageGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageGiveawayCompleted(data json.RawMessage) (*MessageGiveawayCompleted, error) { + var resp MessageGiveawayCompleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageGiveawayWinners(data json.RawMessage) (*MessageGiveawayWinners, error) { + var resp MessageGiveawayWinners + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageGiftedStars(data json.RawMessage) (*MessageGiftedStars, error) { + var resp MessageGiftedStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageGiftedTon(data json.RawMessage) (*MessageGiftedTon, error) { + var resp MessageGiftedTon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageGiveawayPrizeStars(data json.RawMessage) (*MessageGiveawayPrizeStars, error) { + var resp MessageGiveawayPrizeStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageGift(data json.RawMessage) (*MessageGift, error) { + var resp MessageGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageUpgradedGift(data json.RawMessage) (*MessageUpgradedGift, error) { + var resp MessageUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageRefundedUpgradedGift(data json.RawMessage) (*MessageRefundedUpgradedGift, error) { + var resp MessageRefundedUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageUpgradedGiftPurchaseOffer(data json.RawMessage) (*MessageUpgradedGiftPurchaseOffer, error) { + var resp MessageUpgradedGiftPurchaseOffer + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageUpgradedGiftPurchaseOfferRejected(data json.RawMessage) (*MessageUpgradedGiftPurchaseOfferRejected, error) { + var resp MessageUpgradedGiftPurchaseOfferRejected + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePaidMessagesRefunded(data json.RawMessage) (*MessagePaidMessagesRefunded, error) { + var resp MessagePaidMessagesRefunded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePaidMessagePriceChanged(data json.RawMessage) (*MessagePaidMessagePriceChanged, error) { + var resp MessagePaidMessagePriceChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageDirectMessagePriceChanged(data json.RawMessage) (*MessageDirectMessagePriceChanged, error) { + var resp MessageDirectMessagePriceChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChecklistTasksDone(data json.RawMessage) (*MessageChecklistTasksDone, error) { + var resp MessageChecklistTasksDone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageChecklistTasksAdded(data json.RawMessage) (*MessageChecklistTasksAdded, error) { + var resp MessageChecklistTasksAdded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostApprovalFailed(data json.RawMessage) (*MessageSuggestedPostApprovalFailed, error) { + var resp MessageSuggestedPostApprovalFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostApproved(data json.RawMessage) (*MessageSuggestedPostApproved, error) { + var resp MessageSuggestedPostApproved + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostDeclined(data json.RawMessage) (*MessageSuggestedPostDeclined, error) { + var resp MessageSuggestedPostDeclined + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostPaid(data json.RawMessage) (*MessageSuggestedPostPaid, error) { + var resp MessageSuggestedPostPaid + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageSuggestedPostRefunded(data json.RawMessage) (*MessageSuggestedPostRefunded, error) { + var resp MessageSuggestedPostRefunded err := json.Unmarshal(data, &resp) @@ -10809,8 +17076,8 @@ func UnmarshalMessageContactRegistered(data json.RawMessage) (*MessageContactReg return &resp, err } -func UnmarshalMessageUserShared(data json.RawMessage) (*MessageUserShared, error) { - var resp MessageUserShared +func UnmarshalMessageUsersShared(data json.RawMessage) (*MessageUsersShared, error) { + var resp MessageUsersShared err := json.Unmarshal(data, &resp) @@ -11017,6 +17284,14 @@ func UnmarshalTextEntityTypeBlockQuote(data json.RawMessage) (*TextEntityTypeBlo return &resp, err } +func UnmarshalTextEntityTypeExpandableBlockQuote(data json.RawMessage) (*TextEntityTypeExpandableBlockQuote, error) { + var resp TextEntityTypeExpandableBlockQuote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTextEntityTypeTextUrl(data json.RawMessage) (*TextEntityTypeTextUrl, error) { var resp TextEntityTypeTextUrl @@ -11057,6 +17332,30 @@ func UnmarshalInputThumbnail(data json.RawMessage) (*InputThumbnail, error) { return &resp, err } +func UnmarshalInputPaidMediaTypePhoto(data json.RawMessage) (*InputPaidMediaTypePhoto, error) { + var resp InputPaidMediaTypePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPaidMediaTypeVideo(data json.RawMessage) (*InputPaidMediaTypeVideo, error) { + var resp InputPaidMediaTypeVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPaidMedia(data json.RawMessage) (*InputPaidMedia, error) { + var resp InputPaidMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSchedulingStateSendAtDate(data json.RawMessage) (*MessageSchedulingStateSendAtDate, error) { var resp MessageSchedulingStateSendAtDate @@ -11073,6 +17372,14 @@ func UnmarshalMessageSchedulingStateSendWhenOnline(data json.RawMessage) (*Messa return &resp, err } +func UnmarshalMessageSchedulingStateSendWhenVideoProcessed(data json.RawMessage) (*MessageSchedulingStateSendWhenVideoProcessed, error) { + var resp MessageSchedulingStateSendWhenVideoProcessed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageSelfDestructTypeTimer(data json.RawMessage) (*MessageSelfDestructTypeTimer, error) { var resp MessageSelfDestructTypeTimer @@ -11137,6 +17444,14 @@ func UnmarshalInputMessageDocument(data json.RawMessage) (*InputMessageDocument, return &resp, err } +func UnmarshalInputMessagePaidMedia(data json.RawMessage) (*InputMessagePaidMedia, error) { + var resp InputMessagePaidMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputMessagePhoto(data json.RawMessage) (*InputMessagePhoto, error) { var resp InputMessagePhoto @@ -11233,6 +17548,14 @@ func UnmarshalInputMessagePoll(data json.RawMessage) (*InputMessagePoll, error) return &resp, err } +func UnmarshalInputMessageStakeDice(data json.RawMessage) (*InputMessageStakeDice, error) { + var resp InputMessageStakeDice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputMessageStory(data json.RawMessage) (*InputMessageStory, error) { var resp InputMessageStory @@ -11241,6 +17564,14 @@ func UnmarshalInputMessageStory(data json.RawMessage) (*InputMessageStory, error return &resp, err } +func UnmarshalInputMessageChecklist(data json.RawMessage) (*InputMessageChecklist, error) { + var resp InputMessageChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputMessageForwarded(data json.RawMessage) (*InputMessageForwarded, error) { var resp InputMessageForwarded @@ -11249,6 +17580,14 @@ func UnmarshalInputMessageForwarded(data json.RawMessage) (*InputMessageForwarde return &resp, err } +func UnmarshalMessageProperties(data json.RawMessage) (*MessageProperties, error) { + var resp MessageProperties + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSearchMessagesFilterEmpty(data json.RawMessage) (*SearchMessagesFilterEmpty, error) { var resp SearchMessagesFilterEmpty @@ -11385,6 +17724,30 @@ func UnmarshalSearchMessagesFilterPinned(data json.RawMessage) (*SearchMessagesF return &resp, err } +func UnmarshalSearchMessagesChatTypeFilterPrivate(data json.RawMessage) (*SearchMessagesChatTypeFilterPrivate, error) { + var resp SearchMessagesChatTypeFilterPrivate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesChatTypeFilterGroup(data json.RawMessage) (*SearchMessagesChatTypeFilterGroup, error) { + var resp SearchMessagesChatTypeFilterGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSearchMessagesChatTypeFilterChannel(data json.RawMessage) (*SearchMessagesChatTypeFilterChannel, error) { + var resp SearchMessagesChatTypeFilterChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatActionTyping(data json.RawMessage) (*ChatActionTyping, error) { var resp ChatActionTyping @@ -11553,6 +17916,22 @@ func UnmarshalUserStatusLastMonth(data json.RawMessage) (*UserStatusLastMonth, e return &resp, err } +func UnmarshalEmojiKeyword(data json.RawMessage) (*EmojiKeyword, error) { + var resp EmojiKeyword + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiKeywords(data json.RawMessage) (*EmojiKeywords, error) { + var resp EmojiKeywords + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStickers(data json.RawMessage) (*Stickers, error) { var resp Stickers @@ -11601,6 +17980,22 @@ func UnmarshalTrendingStickerSets(data json.RawMessage) (*TrendingStickerSets, e return &resp, err } +func UnmarshalEmojiCategorySourceSearch(data json.RawMessage) (*EmojiCategorySourceSearch, error) { + var resp EmojiCategorySourceSearch + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEmojiCategorySourcePremium(data json.RawMessage) (*EmojiCategorySourcePremium, error) { + var resp EmojiCategorySourcePremium + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiCategory(data json.RawMessage) (*EmojiCategory, error) { var resp EmojiCategory @@ -11625,6 +18020,14 @@ func UnmarshalEmojiCategoryTypeDefault(data json.RawMessage) (*EmojiCategoryType return &resp, err } +func UnmarshalEmojiCategoryTypeRegularStickers(data json.RawMessage) (*EmojiCategoryTypeRegularStickers, error) { + var resp EmojiCategoryTypeRegularStickers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEmojiCategoryTypeEmojiStatus(data json.RawMessage) (*EmojiCategoryTypeEmojiStatus, error) { var resp EmojiCategoryTypeEmojiStatus @@ -11641,16 +18044,8 @@ func UnmarshalEmojiCategoryTypeChatPhoto(data json.RawMessage) (*EmojiCategoryTy return &resp, err } -func UnmarshalStoryViewer(data json.RawMessage) (*StoryViewer, error) { - var resp StoryViewer - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalStoryViewers(data json.RawMessage) (*StoryViewers, error) { - var resp StoryViewers +func UnmarshalCurrentWeather(data json.RawMessage) (*CurrentWeather, error) { + var resp CurrentWeather err := json.Unmarshal(data, &resp) @@ -11689,6 +18084,38 @@ func UnmarshalStoryAreaTypeSuggestedReaction(data json.RawMessage) (*StoryAreaTy return &resp, err } +func UnmarshalStoryAreaTypeMessage(data json.RawMessage) (*StoryAreaTypeMessage, error) { + var resp StoryAreaTypeMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAreaTypeLink(data json.RawMessage) (*StoryAreaTypeLink, error) { + var resp StoryAreaTypeLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAreaTypeWeather(data json.RawMessage) (*StoryAreaTypeWeather, error) { + var resp StoryAreaTypeWeather + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAreaTypeUpgradedGift(data json.RawMessage) (*StoryAreaTypeUpgradedGift, error) { + var resp StoryAreaTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryArea(data json.RawMessage) (*StoryArea, error) { var resp StoryArea @@ -11729,6 +18156,38 @@ func UnmarshalInputStoryAreaTypeSuggestedReaction(data json.RawMessage) (*InputS return &resp, err } +func UnmarshalInputStoryAreaTypeMessage(data json.RawMessage) (*InputStoryAreaTypeMessage, error) { + var resp InputStoryAreaTypeMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryAreaTypeLink(data json.RawMessage) (*InputStoryAreaTypeLink, error) { + var resp InputStoryAreaTypeLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryAreaTypeWeather(data json.RawMessage) (*InputStoryAreaTypeWeather, error) { + var resp InputStoryAreaTypeWeather + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputStoryAreaTypeUpgradedGift(data json.RawMessage) (*InputStoryAreaTypeUpgradedGift, error) { + var resp InputStoryAreaTypeUpgradedGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputStoryArea(data json.RawMessage) (*InputStoryArea, error) { var resp InputStoryArea @@ -11753,6 +18212,38 @@ func UnmarshalStoryVideo(data json.RawMessage) (*StoryVideo, error) { return &resp, err } +func UnmarshalStoryContentTypePhoto(data json.RawMessage) (*StoryContentTypePhoto, error) { + var resp StoryContentTypePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryContentTypeVideo(data json.RawMessage) (*StoryContentTypeVideo, error) { + var resp StoryContentTypeVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryContentTypeLive(data json.RawMessage) (*StoryContentTypeLive, error) { + var resp StoryContentTypeLive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryContentTypeUnsupported(data json.RawMessage) (*StoryContentTypeUnsupported, error) { + var resp StoryContentTypeUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryContentPhoto(data json.RawMessage) (*StoryContentPhoto, error) { var resp StoryContentPhoto @@ -11769,6 +18260,14 @@ func UnmarshalStoryContentVideo(data json.RawMessage) (*StoryContentVideo, error return &resp, err } +func UnmarshalStoryContentLive(data json.RawMessage) (*StoryContentLive, error) { + var resp StoryContentLive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryContentUnsupported(data json.RawMessage) (*StoryContentUnsupported, error) { var resp StoryContentUnsupported @@ -11809,6 +18308,30 @@ func UnmarshalStoryListArchive(data json.RawMessage) (*StoryListArchive, error) return &resp, err } +func UnmarshalStoryOriginPublicStory(data json.RawMessage) (*StoryOriginPublicStory, error) { + var resp StoryOriginPublicStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryOriginHiddenUser(data json.RawMessage) (*StoryOriginHiddenUser, error) { + var resp StoryOriginHiddenUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryRepostInfo(data json.RawMessage) (*StoryRepostInfo, error) { + var resp StoryRepostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryInteractionInfo(data json.RawMessage) (*StoryInteractionInfo, error) { var resp StoryInteractionInfo @@ -11833,6 +18356,38 @@ func UnmarshalStories(data json.RawMessage) (*Stories, error) { return &resp, err } +func UnmarshalFoundStories(data json.RawMessage) (*FoundStories, error) { + var resp FoundStories + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAlbum(data json.RawMessage) (*StoryAlbum, error) { + var resp StoryAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryAlbums(data json.RawMessage) (*StoryAlbums, error) { + var resp StoryAlbums + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryFullId(data json.RawMessage) (*StoryFullId, error) { + var resp StoryFullId + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalStoryInfo(data json.RawMessage) (*StoryInfo, error) { var resp StoryInfo @@ -11849,6 +18404,134 @@ func UnmarshalChatActiveStories(data json.RawMessage) (*ChatActiveStories, error return &resp, err } +func UnmarshalStoryInteractionTypeView(data json.RawMessage) (*StoryInteractionTypeView, error) { + var resp StoryInteractionTypeView + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryInteractionTypeForward(data json.RawMessage) (*StoryInteractionTypeForward, error) { + var resp StoryInteractionTypeForward + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryInteractionTypeRepost(data json.RawMessage) (*StoryInteractionTypeRepost, error) { + var resp StoryInteractionTypeRepost + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryInteraction(data json.RawMessage) (*StoryInteraction, error) { + var resp StoryInteraction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoryInteractions(data json.RawMessage) (*StoryInteractions, error) { + var resp StoryInteractions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalQuickReplyMessage(data json.RawMessage) (*QuickReplyMessage, error) { + var resp QuickReplyMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalQuickReplyMessages(data json.RawMessage) (*QuickReplyMessages, error) { + var resp QuickReplyMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalQuickReplyShortcut(data json.RawMessage) (*QuickReplyShortcut, error) { + var resp QuickReplyShortcut + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPublicForwardMessage(data json.RawMessage) (*PublicForwardMessage, error) { + var resp PublicForwardMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPublicForwardStory(data json.RawMessage) (*PublicForwardStory, error) { + var resp PublicForwardStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPublicForwards(data json.RawMessage) (*PublicForwards, error) { + var resp PublicForwards + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotMediaPreview(data json.RawMessage) (*BotMediaPreview, error) { + var resp BotMediaPreview + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotMediaPreviews(data json.RawMessage) (*BotMediaPreviews, error) { + var resp BotMediaPreviews + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBotMediaPreviewInfo(data json.RawMessage) (*BotMediaPreviewInfo, error) { + var resp BotMediaPreviewInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatBoostLevelFeatures(data json.RawMessage) (*ChatBoostLevelFeatures, error) { + var resp ChatBoostLevelFeatures + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatBoostFeatures(data json.RawMessage) (*ChatBoostFeatures, error) { + var resp ChatBoostFeatures + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatBoostSourceGiftCode(data json.RawMessage) (*ChatBoostSourceGiftCode, error) { var resp ChatBoostSourceGiftCode @@ -11873,8 +18556,8 @@ func UnmarshalChatBoostSourcePremium(data json.RawMessage) (*ChatBoostSourcePrem return &resp, err } -func UnmarshalPrepaidPremiumGiveaway(data json.RawMessage) (*PrepaidPremiumGiveaway, error) { - var resp PrepaidPremiumGiveaway +func UnmarshalPrepaidGiveaway(data json.RawMessage) (*PrepaidGiveaway, error) { + var resp PrepaidGiveaway err := json.Unmarshal(data, &resp) @@ -11921,6 +18604,22 @@ func UnmarshalChatBoostSlots(data json.RawMessage) (*ChatBoostSlots, error) { return &resp, err } +func UnmarshalResendCodeReasonUserRequest(data json.RawMessage) (*ResendCodeReasonUserRequest, error) { + var resp ResendCodeReasonUserRequest + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalResendCodeReasonVerificationFailed(data json.RawMessage) (*ResendCodeReasonVerificationFailed, error) { + var resp ResendCodeReasonVerificationFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallDiscardReasonEmpty(data json.RawMessage) (*CallDiscardReasonEmpty, error) { var resp CallDiscardReasonEmpty @@ -11961,6 +18660,14 @@ func UnmarshalCallDiscardReasonHungUp(data json.RawMessage) (*CallDiscardReasonH return &resp, err } +func UnmarshalCallDiscardReasonUpgradeToGroupCall(data json.RawMessage) (*CallDiscardReasonUpgradeToGroupCall, error) { + var resp CallDiscardReasonUpgradeToGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallProtocol(data json.RawMessage) (*CallProtocol, error) { var resp CallProtocol @@ -12057,6 +18764,14 @@ func UnmarshalCallStateError(data json.RawMessage) (*CallStateError, error) { return &resp, err } +func UnmarshalGroupCallJoinParameters(data json.RawMessage) (*GroupCallJoinParameters, error) { + var resp GroupCallJoinParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalGroupCallVideoQualityThumbnail(data json.RawMessage) (*GroupCallVideoQualityThumbnail, error) { var resp GroupCallVideoQualityThumbnail @@ -12145,6 +18860,102 @@ func UnmarshalGroupCallParticipant(data json.RawMessage) (*GroupCallParticipant, return &resp, err } +func UnmarshalGroupCallParticipants(data json.RawMessage) (*GroupCallParticipants, error) { + var resp GroupCallParticipants + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGroupCallInfo(data json.RawMessage) (*GroupCallInfo, error) { + var resp GroupCallInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGroupCallMessage(data json.RawMessage) (*GroupCallMessage, error) { + var resp GroupCallMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGroupCallMessageLevel(data json.RawMessage) (*GroupCallMessageLevel, error) { + var resp GroupCallMessageLevel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(data json.RawMessage) (*InviteGroupCallParticipantResultUserPrivacyRestricted, error) { + var resp InviteGroupCallParticipantResultUserPrivacyRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(data json.RawMessage) (*InviteGroupCallParticipantResultUserAlreadyParticipant, error) { + var resp InviteGroupCallParticipantResultUserAlreadyParticipant + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultUserWasBanned(data json.RawMessage) (*InviteGroupCallParticipantResultUserWasBanned, error) { + var resp InviteGroupCallParticipantResultUserWasBanned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInviteGroupCallParticipantResultSuccess(data json.RawMessage) (*InviteGroupCallParticipantResultSuccess, error) { + var resp InviteGroupCallParticipantResultSuccess + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGroupCallDataChannelMain(data json.RawMessage) (*GroupCallDataChannelMain, error) { + var resp GroupCallDataChannelMain + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGroupCallDataChannelScreenSharing(data json.RawMessage) (*GroupCallDataChannelScreenSharing, error) { + var resp GroupCallDataChannelScreenSharing + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputGroupCallLink(data json.RawMessage) (*InputGroupCallLink, error) { + var resp InputGroupCallLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputGroupCallMessage(data json.RawMessage) (*InputGroupCallMessage, error) { + var resp InputGroupCallMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallProblemEcho(data json.RawMessage) (*CallProblemEcho, error) { var resp CallProblemEcho @@ -12289,6 +19100,22 @@ func UnmarshalEmojiReaction(data json.RawMessage) (*EmojiReaction, error) { return &resp, err } +func UnmarshalReactionUnavailabilityReasonAnonymousAdministrator(data json.RawMessage) (*ReactionUnavailabilityReasonAnonymousAdministrator, error) { + var resp ReactionUnavailabilityReasonAnonymousAdministrator + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReactionUnavailabilityReasonGuest(data json.RawMessage) (*ReactionUnavailabilityReasonGuest, error) { + var resp ReactionUnavailabilityReasonGuest + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAnimations(data json.RawMessage) (*Animations, error) { var resp Animations @@ -12313,6 +19140,14 @@ func UnmarshalDiceStickersSlotMachine(data json.RawMessage) (*DiceStickersSlotMa return &resp, err } +func UnmarshalImportedContact(data json.RawMessage) (*ImportedContact, error) { + var resp ImportedContact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalImportedContacts(data json.RawMessage) (*ImportedContacts, error) { var resp ImportedContacts @@ -12345,6 +19180,14 @@ func UnmarshalSpeechRecognitionResultError(data json.RawMessage) (*SpeechRecogni return &resp, err } +func UnmarshalBusinessConnection(data json.RawMessage) (*BusinessConnection, error) { + var resp BusinessConnection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAttachmentMenuBotColor(data json.RawMessage) (*AttachmentMenuBotColor, error) { var resp AttachmentMenuBotColor @@ -12417,6 +19260,38 @@ func UnmarshalUserLink(data json.RawMessage) (*UserLink, error) { return &resp, err } +func UnmarshalTargetChatTypes(data json.RawMessage) (*TargetChatTypes, error) { + var resp TargetChatTypes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTargetChatCurrent(data json.RawMessage) (*TargetChatCurrent, error) { + var resp TargetChatCurrent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTargetChatChosen(data json.RawMessage) (*TargetChatChosen, error) { + var resp TargetChatChosen + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTargetChatInternalLink(data json.RawMessage) (*TargetChatInternalLink, error) { + var resp TargetChatInternalLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputInlineQueryResultAnimation(data json.RawMessage) (*InputInlineQueryResultAnimation, error) { var resp InputInlineQueryResultAnimation @@ -12641,6 +19516,22 @@ func UnmarshalInlineQueryResults(data json.RawMessage) (*InlineQueryResults, err return &resp, err } +func UnmarshalPreparedInlineMessageId(data json.RawMessage) (*PreparedInlineMessageId, error) { + var resp PreparedInlineMessageId + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPreparedInlineMessage(data json.RawMessage) (*PreparedInlineMessage, error) { + var resp PreparedInlineMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCallbackQueryPayloadData(data json.RawMessage) (*CallbackQueryPayloadData, error) { var resp CallbackQueryPayloadData @@ -12793,6 +19684,14 @@ func UnmarshalChatEventMemberRestricted(data json.RawMessage) (*ChatEventMemberR return &resp, err } +func UnmarshalChatEventMemberSubscriptionExtended(data json.RawMessage) (*ChatEventMemberSubscriptionExtended, error) { + var resp ChatEventMemberSubscriptionExtended + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventAvailableReactionsChanged(data json.RawMessage) (*ChatEventAvailableReactionsChanged, error) { var resp ChatEventAvailableReactionsChanged @@ -12801,6 +19700,14 @@ func UnmarshalChatEventAvailableReactionsChanged(data json.RawMessage) (*ChatEve return &resp, err } +func UnmarshalChatEventBackgroundChanged(data json.RawMessage) (*ChatEventBackgroundChanged, error) { + var resp ChatEventBackgroundChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventDescriptionChanged(data json.RawMessage) (*ChatEventDescriptionChanged, error) { var resp ChatEventDescriptionChanged @@ -12809,6 +19716,14 @@ func UnmarshalChatEventDescriptionChanged(data json.RawMessage) (*ChatEventDescr return &resp, err } +func UnmarshalChatEventEmojiStatusChanged(data json.RawMessage) (*ChatEventEmojiStatusChanged, error) { + var resp ChatEventEmojiStatusChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventLinkedChatChanged(data json.RawMessage) (*ChatEventLinkedChatChanged, error) { var resp ChatEventLinkedChatChanged @@ -12865,6 +19780,14 @@ func UnmarshalChatEventStickerSetChanged(data json.RawMessage) (*ChatEventSticke return &resp, err } +func UnmarshalChatEventCustomEmojiStickerSetChanged(data json.RawMessage) (*ChatEventCustomEmojiStickerSetChanged, error) { + var resp ChatEventCustomEmojiStickerSetChanged + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventTitleChanged(data json.RawMessage) (*ChatEventTitleChanged, error) { var resp ChatEventTitleChanged @@ -12897,8 +19820,8 @@ func UnmarshalChatEventAccentColorChanged(data json.RawMessage) (*ChatEventAccen return &resp, err } -func UnmarshalChatEventBackgroundCustomEmojiChanged(data json.RawMessage) (*ChatEventBackgroundCustomEmojiChanged, error) { - var resp ChatEventBackgroundCustomEmojiChanged +func UnmarshalChatEventProfileAccentColorChanged(data json.RawMessage) (*ChatEventProfileAccentColorChanged, error) { + var resp ChatEventProfileAccentColorChanged err := json.Unmarshal(data, &resp) @@ -12945,6 +19868,22 @@ func UnmarshalChatEventSignMessagesToggled(data json.RawMessage) (*ChatEventSign return &resp, err } +func UnmarshalChatEventShowMessageSenderToggled(data json.RawMessage) (*ChatEventShowMessageSenderToggled, error) { + var resp ChatEventShowMessageSenderToggled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatEventAutomaticTranslationToggled(data json.RawMessage) (*ChatEventAutomaticTranslationToggled, error) { + var resp ChatEventAutomaticTranslationToggled + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatEventInviteLinkEdited(data json.RawMessage) (*ChatEventInviteLinkEdited, error) { var resp ChatEventInviteLinkEdited @@ -13209,6 +20148,14 @@ func UnmarshalPremiumLimitTypePinnedArchivedChatCount(data json.RawMessage) (*Pr return &resp, err } +func UnmarshalPremiumLimitTypePinnedSavedMessagesTopicCount(data json.RawMessage) (*PremiumLimitTypePinnedSavedMessagesTopicCount, error) { + var resp PremiumLimitTypePinnedSavedMessagesTopicCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumLimitTypeCaptionLength(data json.RawMessage) (*PremiumLimitTypeCaptionLength, error) { var resp PremiumLimitTypeCaptionLength @@ -13249,16 +20196,16 @@ func UnmarshalPremiumLimitTypeActiveStoryCount(data json.RawMessage) (*PremiumLi return &resp, err } -func UnmarshalPremiumLimitTypeWeeklySentStoryCount(data json.RawMessage) (*PremiumLimitTypeWeeklySentStoryCount, error) { - var resp PremiumLimitTypeWeeklySentStoryCount +func UnmarshalPremiumLimitTypeWeeklyPostedStoryCount(data json.RawMessage) (*PremiumLimitTypeWeeklyPostedStoryCount, error) { + var resp PremiumLimitTypeWeeklyPostedStoryCount err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalPremiumLimitTypeMonthlySentStoryCount(data json.RawMessage) (*PremiumLimitTypeMonthlySentStoryCount, error) { - var resp PremiumLimitTypeMonthlySentStoryCount +func UnmarshalPremiumLimitTypeMonthlyPostedStoryCount(data json.RawMessage) (*PremiumLimitTypeMonthlyPostedStoryCount, error) { + var resp PremiumLimitTypeMonthlyPostedStoryCount err := json.Unmarshal(data, &resp) @@ -13281,6 +20228,14 @@ func UnmarshalPremiumLimitTypeStorySuggestedReactionAreaCount(data json.RawMessa return &resp, err } +func UnmarshalPremiumLimitTypeSimilarChatCount(data json.RawMessage) (*PremiumLimitTypeSimilarChatCount, error) { + var resp PremiumLimitTypeSimilarChatCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumFeatureIncreasedLimits(data json.RawMessage) (*PremiumFeatureIncreasedLimits, error) { var resp PremiumFeatureIncreasedLimits @@ -13425,6 +20380,158 @@ func UnmarshalPremiumFeatureAccentColor(data json.RawMessage) (*PremiumFeatureAc return &resp, err } +func UnmarshalPremiumFeatureBackgroundForBoth(data json.RawMessage) (*PremiumFeatureBackgroundForBoth, error) { + var resp PremiumFeatureBackgroundForBoth + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumFeatureSavedMessagesTags(data json.RawMessage) (*PremiumFeatureSavedMessagesTags, error) { + var resp PremiumFeatureSavedMessagesTags + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumFeatureMessagePrivacy(data json.RawMessage) (*PremiumFeatureMessagePrivacy, error) { + var resp PremiumFeatureMessagePrivacy + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumFeatureLastSeenTimes(data json.RawMessage) (*PremiumFeatureLastSeenTimes, error) { + var resp PremiumFeatureLastSeenTimes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumFeatureBusiness(data json.RawMessage) (*PremiumFeatureBusiness, error) { + var resp PremiumFeatureBusiness + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumFeatureMessageEffects(data json.RawMessage) (*PremiumFeatureMessageEffects, error) { + var resp PremiumFeatureMessageEffects + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumFeatureChecklists(data json.RawMessage) (*PremiumFeatureChecklists, error) { + var resp PremiumFeatureChecklists + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPremiumFeaturePaidMessages(data json.RawMessage) (*PremiumFeaturePaidMessages, error) { + var resp PremiumFeaturePaidMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureLocation(data json.RawMessage) (*BusinessFeatureLocation, error) { + var resp BusinessFeatureLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureOpeningHours(data json.RawMessage) (*BusinessFeatureOpeningHours, error) { + var resp BusinessFeatureOpeningHours + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureQuickReplies(data json.RawMessage) (*BusinessFeatureQuickReplies, error) { + var resp BusinessFeatureQuickReplies + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureGreetingMessage(data json.RawMessage) (*BusinessFeatureGreetingMessage, error) { + var resp BusinessFeatureGreetingMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureAwayMessage(data json.RawMessage) (*BusinessFeatureAwayMessage, error) { + var resp BusinessFeatureAwayMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureAccountLinks(data json.RawMessage) (*BusinessFeatureAccountLinks, error) { + var resp BusinessFeatureAccountLinks + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureStartPage(data json.RawMessage) (*BusinessFeatureStartPage, error) { + var resp BusinessFeatureStartPage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureBots(data json.RawMessage) (*BusinessFeatureBots, error) { + var resp BusinessFeatureBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureEmojiStatus(data json.RawMessage) (*BusinessFeatureEmojiStatus, error) { + var resp BusinessFeatureEmojiStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureChatFolderTags(data json.RawMessage) (*BusinessFeatureChatFolderTags, error) { + var resp BusinessFeatureChatFolderTags + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalBusinessFeatureUpgradedStories(data json.RawMessage) (*BusinessFeatureUpgradedStories, error) { + var resp BusinessFeatureUpgradedStories + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumStoryFeaturePriorityOrder(data json.RawMessage) (*PremiumStoryFeaturePriorityOrder, error) { var resp PremiumStoryFeaturePriorityOrder @@ -13473,6 +20580,14 @@ func UnmarshalPremiumStoryFeatureLinksAndFormatting(data json.RawMessage) (*Prem return &resp, err } +func UnmarshalPremiumStoryFeatureVideoQuality(data json.RawMessage) (*PremiumStoryFeatureVideoQuality, error) { + var resp PremiumStoryFeatureVideoQuality + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumLimit(data json.RawMessage) (*PremiumLimit, error) { var resp PremiumLimit @@ -13489,6 +20604,14 @@ func UnmarshalPremiumFeatures(data json.RawMessage) (*PremiumFeatures, error) { return &resp, err } +func UnmarshalBusinessFeatures(data json.RawMessage) (*BusinessFeatures, error) { + var resp BusinessFeatures + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumSourceLimitExceeded(data json.RawMessage) (*PremiumSourceLimitExceeded, error) { var resp PremiumSourceLimitExceeded @@ -13505,6 +20628,14 @@ func UnmarshalPremiumSourceFeature(data json.RawMessage) (*PremiumSourceFeature, return &resp, err } +func UnmarshalPremiumSourceBusinessFeature(data json.RawMessage) (*PremiumSourceBusinessFeature, error) { + var resp PremiumSourceBusinessFeature + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumSourceStoryFeature(data json.RawMessage) (*PremiumSourceStoryFeature, error) { var resp PremiumSourceStoryFeature @@ -13537,6 +20668,14 @@ func UnmarshalPremiumFeaturePromotionAnimation(data json.RawMessage) (*PremiumFe return &resp, err } +func UnmarshalBusinessFeaturePromotionAnimation(data json.RawMessage) (*BusinessFeaturePromotionAnimation, error) { + var resp BusinessFeaturePromotionAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPremiumState(data json.RawMessage) (*PremiumState, error) { var resp PremiumState @@ -13553,8 +20692,8 @@ func UnmarshalStorePaymentPurposePremiumSubscription(data json.RawMessage) (*Sto return &resp, err } -func UnmarshalStorePaymentPurposeGiftedPremium(data json.RawMessage) (*StorePaymentPurposeGiftedPremium, error) { - var resp StorePaymentPurposeGiftedPremium +func UnmarshalStorePaymentPurposePremiumGift(data json.RawMessage) (*StorePaymentPurposePremiumGift, error) { + var resp StorePaymentPurposePremiumGift err := json.Unmarshal(data, &resp) @@ -13577,6 +20716,54 @@ func UnmarshalStorePaymentPurposePremiumGiveaway(data json.RawMessage) (*StorePa return &resp, err } +func UnmarshalStorePaymentPurposeStarGiveaway(data json.RawMessage) (*StorePaymentPurposeStarGiveaway, error) { + var resp StorePaymentPurposeStarGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStorePaymentPurposeStars(data json.RawMessage) (*StorePaymentPurposeStars, error) { + var resp StorePaymentPurposeStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStorePaymentPurposeGiftedStars(data json.RawMessage) (*StorePaymentPurposeGiftedStars, error) { + var resp StorePaymentPurposeGiftedStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoreTransactionAppStore(data json.RawMessage) (*StoreTransactionAppStore, error) { + var resp StoreTransactionAppStore + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStoreTransactionGooglePlay(data json.RawMessage) (*StoreTransactionGooglePlay, error) { + var resp StoreTransactionGooglePlay + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTelegramPaymentPurposePremiumGift(data json.RawMessage) (*TelegramPaymentPurposePremiumGift, error) { + var resp TelegramPaymentPurposePremiumGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTelegramPaymentPurposePremiumGiftCodes(data json.RawMessage) (*TelegramPaymentPurposePremiumGiftCodes, error) { var resp TelegramPaymentPurposePremiumGiftCodes @@ -13593,6 +20780,38 @@ func UnmarshalTelegramPaymentPurposePremiumGiveaway(data json.RawMessage) (*Tele return &resp, err } +func UnmarshalTelegramPaymentPurposeStars(data json.RawMessage) (*TelegramPaymentPurposeStars, error) { + var resp TelegramPaymentPurposeStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTelegramPaymentPurposeGiftedStars(data json.RawMessage) (*TelegramPaymentPurposeGiftedStars, error) { + var resp TelegramPaymentPurposeGiftedStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTelegramPaymentPurposeStarGiveaway(data json.RawMessage) (*TelegramPaymentPurposeStarGiveaway, error) { + var resp TelegramPaymentPurposeStarGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTelegramPaymentPurposeJoinChat(data json.RawMessage) (*TelegramPaymentPurposeJoinChat, error) { + var resp TelegramPaymentPurposeJoinChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDeviceTokenFirebaseCloudMessaging(data json.RawMessage) (*DeviceTokenFirebaseCloudMessaging, error) { var resp DeviceTokenFirebaseCloudMessaging @@ -13745,6 +20964,14 @@ func UnmarshalBackgroundTypeFill(data json.RawMessage) (*BackgroundTypeFill, err return &resp, err } +func UnmarshalBackgroundTypeChatTheme(data json.RawMessage) (*BackgroundTypeChatTheme, error) { + var resp BackgroundTypeChatTheme + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputBackgroundLocal(data json.RawMessage) (*InputBackgroundLocal, error) { var resp InputBackgroundLocal @@ -13769,16 +20996,72 @@ func UnmarshalInputBackgroundPrevious(data json.RawMessage) (*InputBackgroundPre return &resp, err } -func UnmarshalThemeSettings(data json.RawMessage) (*ThemeSettings, error) { - var resp ThemeSettings +func UnmarshalEmojiChatTheme(data json.RawMessage) (*EmojiChatTheme, error) { + var resp EmojiChatTheme err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalChatTheme(data json.RawMessage) (*ChatTheme, error) { - var resp ChatTheme +func UnmarshalGiftChatTheme(data json.RawMessage) (*GiftChatTheme, error) { + var resp GiftChatTheme + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalGiftChatThemes(data json.RawMessage) (*GiftChatThemes, error) { + var resp GiftChatThemes + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatThemeEmoji(data json.RawMessage) (*ChatThemeEmoji, error) { + var resp ChatThemeEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatThemeGift(data json.RawMessage) (*ChatThemeGift, error) { + var resp ChatThemeGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChatThemeEmoji(data json.RawMessage) (*InputChatThemeEmoji, error) { + var resp InputChatThemeEmoji + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputChatThemeGift(data json.RawMessage) (*InputChatThemeGift, error) { + var resp InputChatThemeGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTimeZone(data json.RawMessage) (*TimeZone, error) { + var resp TimeZone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTimeZones(data json.RawMessage) (*TimeZones, error) { + var resp TimeZones err := json.Unmarshal(data, &resp) @@ -13793,48 +21076,72 @@ func UnmarshalHashtags(data json.RawMessage) (*Hashtags, error) { return &resp, err } -func UnmarshalCanSendStoryResultOk(data json.RawMessage) (*CanSendStoryResultOk, error) { - var resp CanSendStoryResultOk +func UnmarshalCanPostStoryResultOk(data json.RawMessage) (*CanPostStoryResultOk, error) { + var resp CanPostStoryResultOk err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultPremiumNeeded(data json.RawMessage) (*CanSendStoryResultPremiumNeeded, error) { - var resp CanSendStoryResultPremiumNeeded +func UnmarshalCanPostStoryResultPremiumNeeded(data json.RawMessage) (*CanPostStoryResultPremiumNeeded, error) { + var resp CanPostStoryResultPremiumNeeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultBoostNeeded(data json.RawMessage) (*CanSendStoryResultBoostNeeded, error) { - var resp CanSendStoryResultBoostNeeded +func UnmarshalCanPostStoryResultBoostNeeded(data json.RawMessage) (*CanPostStoryResultBoostNeeded, error) { + var resp CanPostStoryResultBoostNeeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data json.RawMessage) (*CanSendStoryResultActiveStoryLimitExceeded, error) { - var resp CanSendStoryResultActiveStoryLimitExceeded +func UnmarshalCanPostStoryResultActiveStoryLimitExceeded(data json.RawMessage) (*CanPostStoryResultActiveStoryLimitExceeded, error) { + var resp CanPostStoryResultActiveStoryLimitExceeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultWeeklyLimitExceeded(data json.RawMessage) (*CanSendStoryResultWeeklyLimitExceeded, error) { - var resp CanSendStoryResultWeeklyLimitExceeded +func UnmarshalCanPostStoryResultWeeklyLimitExceeded(data json.RawMessage) (*CanPostStoryResultWeeklyLimitExceeded, error) { + var resp CanPostStoryResultWeeklyLimitExceeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalCanSendStoryResultMonthlyLimitExceeded(data json.RawMessage) (*CanSendStoryResultMonthlyLimitExceeded, error) { - var resp CanSendStoryResultMonthlyLimitExceeded +func UnmarshalCanPostStoryResultMonthlyLimitExceeded(data json.RawMessage) (*CanPostStoryResultMonthlyLimitExceeded, error) { + var resp CanPostStoryResultMonthlyLimitExceeded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanPostStoryResultLiveStoryIsActive(data json.RawMessage) (*CanPostStoryResultLiveStoryIsActive, error) { + var resp CanPostStoryResultLiveStoryIsActive + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStartLiveStoryResultOk(data json.RawMessage) (*StartLiveStoryResultOk, error) { + var resp StartLiveStoryResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStartLiveStoryResultFail(data json.RawMessage) (*StartLiveStoryResultFail, error) { + var resp StartLiveStoryResultFail err := json.Unmarshal(data, &resp) @@ -14073,6 +21380,14 @@ func UnmarshalPushMessageContentLocation(data json.RawMessage) (*PushMessageCont return &resp, err } +func UnmarshalPushMessageContentPaidMedia(data json.RawMessage) (*PushMessageContentPaidMedia, error) { + var resp PushMessageContentPaidMedia + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentPhoto(data json.RawMessage) (*PushMessageContentPhoto, error) { var resp PushMessageContentPhoto @@ -14097,8 +21412,24 @@ func UnmarshalPushMessageContentPremiumGiftCode(data json.RawMessage) (*PushMess return &resp, err } -func UnmarshalPushMessageContentPremiumGiveaway(data json.RawMessage) (*PushMessageContentPremiumGiveaway, error) { - var resp PushMessageContentPremiumGiveaway +func UnmarshalPushMessageContentGiveaway(data json.RawMessage) (*PushMessageContentGiveaway, error) { + var resp PushMessageContentGiveaway + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentGift(data json.RawMessage) (*PushMessageContentGift, error) { + var resp PushMessageContentGift + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentUpgradedGift(data json.RawMessage) (*PushMessageContentUpgradedGift, error) { + var resp PushMessageContentUpgradedGift err := json.Unmarshal(data, &resp) @@ -14137,6 +21468,14 @@ func UnmarshalPushMessageContentText(data json.RawMessage) (*PushMessageContentT return &resp, err } +func UnmarshalPushMessageContentChecklist(data json.RawMessage) (*PushMessageContentChecklist, error) { + var resp PushMessageContentChecklist + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentVideo(data json.RawMessage) (*PushMessageContentVideo, error) { var resp PushMessageContentVideo @@ -14169,6 +21508,30 @@ func UnmarshalPushMessageContentBasicGroupChatCreate(data json.RawMessage) (*Pus return &resp, err } +func UnmarshalPushMessageContentVideoChatStarted(data json.RawMessage) (*PushMessageContentVideoChatStarted, error) { + var resp PushMessageContentVideoChatStarted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentVideoChatEnded(data json.RawMessage) (*PushMessageContentVideoChatEnded, error) { + var resp PushMessageContentVideoChatEnded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentInviteVideoChatParticipants(data json.RawMessage) (*PushMessageContentInviteVideoChatParticipants, error) { + var resp PushMessageContentInviteVideoChatParticipants + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentChatAddMembers(data json.RawMessage) (*PushMessageContentChatAddMembers, error) { var resp PushMessageContentChatAddMembers @@ -14249,6 +21612,38 @@ func UnmarshalPushMessageContentSuggestProfilePhoto(data json.RawMessage) (*Push return &resp, err } +func UnmarshalPushMessageContentSuggestBirthdate(data json.RawMessage) (*PushMessageContentSuggestBirthdate, error) { + var resp PushMessageContentSuggestBirthdate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentProximityAlertTriggered(data json.RawMessage) (*PushMessageContentProximityAlertTriggered, error) { + var resp PushMessageContentProximityAlertTriggered + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChecklistTasksAdded(data json.RawMessage) (*PushMessageContentChecklistTasksAdded, error) { + var resp PushMessageContentChecklistTasksAdded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChecklistTasksDone(data json.RawMessage) (*PushMessageContentChecklistTasksDone, error) { + var resp PushMessageContentChecklistTasksDone + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPushMessageContentMessageForwards(data json.RawMessage) (*PushMessageContentMessageForwards, error) { var resp PushMessageContentMessageForwards @@ -14361,6 +21756,14 @@ func UnmarshalNotificationGroup(data json.RawMessage) (*NotificationGroup, error return &resp, err } +func UnmarshalProxy(data json.RawMessage) (*Proxy, error) { + var resp Proxy + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalOptionValueBoolean(data json.RawMessage) (*OptionValueBoolean, error) { var resp OptionValueBoolean @@ -14497,6 +21900,22 @@ func UnmarshalUserPrivacySettingRuleAllowContacts(data json.RawMessage) (*UserPr return &resp, err } +func UnmarshalUserPrivacySettingRuleAllowBots(data json.RawMessage) (*UserPrivacySettingRuleAllowBots, error) { + var resp UserPrivacySettingRuleAllowBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data json.RawMessage) (*UserPrivacySettingRuleAllowPremiumUsers, error) { + var resp UserPrivacySettingRuleAllowPremiumUsers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserPrivacySettingRuleAllowUsers(data json.RawMessage) (*UserPrivacySettingRuleAllowUsers, error) { var resp UserPrivacySettingRuleAllowUsers @@ -14529,6 +21948,14 @@ func UnmarshalUserPrivacySettingRuleRestrictContacts(data json.RawMessage) (*Use return &resp, err } +func UnmarshalUserPrivacySettingRuleRestrictBots(data json.RawMessage) (*UserPrivacySettingRuleRestrictBots, error) { + var resp UserPrivacySettingRuleRestrictBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserPrivacySettingRuleRestrictUsers(data json.RawMessage) (*UserPrivacySettingRuleRestrictUsers, error) { var resp UserPrivacySettingRuleRestrictUsers @@ -14593,6 +22020,22 @@ func UnmarshalUserPrivacySettingShowBio(data json.RawMessage) (*UserPrivacySetti return &resp, err } +func UnmarshalUserPrivacySettingShowBirthdate(data json.RawMessage) (*UserPrivacySettingShowBirthdate, error) { + var resp UserPrivacySettingShowBirthdate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingShowProfileAudio(data json.RawMessage) (*UserPrivacySettingShowProfileAudio, error) { + var resp UserPrivacySettingShowProfileAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserPrivacySettingAllowChatInvites(data json.RawMessage) (*UserPrivacySettingAllowChatInvites, error) { var resp UserPrivacySettingAllowChatInvites @@ -14633,6 +22076,70 @@ func UnmarshalUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(data json. return &resp, err } +func UnmarshalUserPrivacySettingAutosaveGifts(data json.RawMessage) (*UserPrivacySettingAutosaveGifts, error) { + var resp UserPrivacySettingAutosaveGifts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUserPrivacySettingAllowUnpaidMessages(data json.RawMessage) (*UserPrivacySettingAllowUnpaidMessages, error) { + var resp UserPrivacySettingAllowUnpaidMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReadDatePrivacySettings(data json.RawMessage) (*ReadDatePrivacySettings, error) { + var resp ReadDatePrivacySettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNewChatPrivacySettings(data json.RawMessage) (*NewChatPrivacySettings, error) { + var resp NewChatPrivacySettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendMessageToUserResultOk(data json.RawMessage) (*CanSendMessageToUserResultOk, error) { + var resp CanSendMessageToUserResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data json.RawMessage) (*CanSendMessageToUserResultUserHasPaidMessages, error) { + var resp CanSendMessageToUserResultUserHasPaidMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendMessageToUserResultUserIsDeleted(data json.RawMessage) (*CanSendMessageToUserResultUserIsDeleted, error) { + var resp CanSendMessageToUserResultUserIsDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalCanSendMessageToUserResultUserRestrictsNewChats(data json.RawMessage) (*CanSendMessageToUserResultUserRestrictsNewChats, error) { + var resp CanSendMessageToUserResultUserRestrictsNewChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAccountTtl(data json.RawMessage) (*AccountTtl, error) { var resp AccountTtl @@ -14905,32 +22412,224 @@ func UnmarshalReportReasonCustom(data json.RawMessage) (*ReportReasonCustom, err return &resp, err } -func UnmarshalTargetChatCurrent(data json.RawMessage) (*TargetChatCurrent, error) { - var resp TargetChatCurrent +func UnmarshalReportChatResultOk(data json.RawMessage) (*ReportChatResultOk, error) { + var resp ReportChatResultOk err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalTargetChatChosen(data json.RawMessage) (*TargetChatChosen, error) { - var resp TargetChatChosen +func UnmarshalReportChatResultOptionRequired(data json.RawMessage) (*ReportChatResultOptionRequired, error) { + var resp ReportChatResultOptionRequired err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalTargetChatInternalLink(data json.RawMessage) (*TargetChatInternalLink, error) { - var resp TargetChatInternalLink +func UnmarshalReportChatResultTextRequired(data json.RawMessage) (*ReportChatResultTextRequired, error) { + var resp ReportChatResultTextRequired err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalInternalLinkTypeActiveSessions(data json.RawMessage) (*InternalLinkTypeActiveSessions, error) { - var resp InternalLinkTypeActiveSessions +func UnmarshalReportChatResultMessagesRequired(data json.RawMessage) (*ReportChatResultMessagesRequired, error) { + var resp ReportChatResultMessagesRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportStoryResultOk(data json.RawMessage) (*ReportStoryResultOk, error) { + var resp ReportStoryResultOk + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportStoryResultOptionRequired(data json.RawMessage) (*ReportStoryResultOptionRequired, error) { + var resp ReportStoryResultOptionRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalReportStoryResultTextRequired(data json.RawMessage) (*ReportStoryResultTextRequired, error) { + var resp ReportStoryResultTextRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionAppearance(data json.RawMessage) (*SettingsSectionAppearance, error) { + var resp SettingsSectionAppearance + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionAskQuestion(data json.RawMessage) (*SettingsSectionAskQuestion, error) { + var resp SettingsSectionAskQuestion + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionBusiness(data json.RawMessage) (*SettingsSectionBusiness, error) { + var resp SettingsSectionBusiness + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionChatFolders(data json.RawMessage) (*SettingsSectionChatFolders, error) { + var resp SettingsSectionChatFolders + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionDataAndStorage(data json.RawMessage) (*SettingsSectionDataAndStorage, error) { + var resp SettingsSectionDataAndStorage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionDevices(data json.RawMessage) (*SettingsSectionDevices, error) { + var resp SettingsSectionDevices + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionEditProfile(data json.RawMessage) (*SettingsSectionEditProfile, error) { + var resp SettingsSectionEditProfile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionFaq(data json.RawMessage) (*SettingsSectionFaq, error) { + var resp SettingsSectionFaq + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionFeatures(data json.RawMessage) (*SettingsSectionFeatures, error) { + var resp SettingsSectionFeatures + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionInAppBrowser(data json.RawMessage) (*SettingsSectionInAppBrowser, error) { + var resp SettingsSectionInAppBrowser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionLanguage(data json.RawMessage) (*SettingsSectionLanguage, error) { + var resp SettingsSectionLanguage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionMyStars(data json.RawMessage) (*SettingsSectionMyStars, error) { + var resp SettingsSectionMyStars + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionMyToncoins(data json.RawMessage) (*SettingsSectionMyToncoins, error) { + var resp SettingsSectionMyToncoins + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionNotifications(data json.RawMessage) (*SettingsSectionNotifications, error) { + var resp SettingsSectionNotifications + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionPowerSaving(data json.RawMessage) (*SettingsSectionPowerSaving, error) { + var resp SettingsSectionPowerSaving + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionPremium(data json.RawMessage) (*SettingsSectionPremium, error) { + var resp SettingsSectionPremium + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionPrivacyAndSecurity(data json.RawMessage) (*SettingsSectionPrivacyAndSecurity, error) { + var resp SettingsSectionPrivacyAndSecurity + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionPrivacyPolicy(data json.RawMessage) (*SettingsSectionPrivacyPolicy, error) { + var resp SettingsSectionPrivacyPolicy + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionQrCode(data json.RawMessage) (*SettingsSectionQrCode, error) { + var resp SettingsSectionQrCode + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionSearch(data json.RawMessage) (*SettingsSectionSearch, error) { + var resp SettingsSectionSearch + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSettingsSectionSendGift(data json.RawMessage) (*SettingsSectionSendGift, error) { + var resp SettingsSectionSendGift err := json.Unmarshal(data, &resp) @@ -14985,8 +22684,24 @@ func UnmarshalInternalLinkTypeBotStartInGroup(data json.RawMessage) (*InternalLi return &resp, err } -func UnmarshalInternalLinkTypeChangePhoneNumber(data json.RawMessage) (*InternalLinkTypeChangePhoneNumber, error) { - var resp InternalLinkTypeChangePhoneNumber +func UnmarshalInternalLinkTypeBusinessChat(data json.RawMessage) (*InternalLinkTypeBusinessChat, error) { + var resp InternalLinkTypeBusinessChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInternalLinkTypeCallsPage(data json.RawMessage) (*InternalLinkTypeCallsPage, error) { + var resp InternalLinkTypeCallsPage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInternalLinkTypeChatAffiliateProgram(data json.RawMessage) (*InternalLinkTypeChatAffiliateProgram, error) { + var resp InternalLinkTypeChatAffiliateProgram err := json.Unmarshal(data, &resp) @@ -15009,14 +22724,6 @@ func UnmarshalInternalLinkTypeChatFolderInvite(data json.RawMessage) (*InternalL return &resp, err } -func UnmarshalInternalLinkTypeChatFolderSettings(data json.RawMessage) (*InternalLinkTypeChatFolderSettings, error) { - var resp InternalLinkTypeChatFolderSettings - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalInternalLinkTypeChatInvite(data json.RawMessage) (*InternalLinkTypeChatInvite, error) { var resp InternalLinkTypeChatInvite @@ -15025,16 +22732,24 @@ func UnmarshalInternalLinkTypeChatInvite(data json.RawMessage) (*InternalLinkTyp return &resp, err } -func UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data json.RawMessage) (*InternalLinkTypeDefaultMessageAutoDeleteTimerSettings, error) { - var resp InternalLinkTypeDefaultMessageAutoDeleteTimerSettings +func UnmarshalInternalLinkTypeChatSelection(data json.RawMessage) (*InternalLinkTypeChatSelection, error) { + var resp InternalLinkTypeChatSelection err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalInternalLinkTypeEditProfileSettings(data json.RawMessage) (*InternalLinkTypeEditProfileSettings, error) { - var resp InternalLinkTypeEditProfileSettings +func UnmarshalInternalLinkTypeContactsPage(data json.RawMessage) (*InternalLinkTypeContactsPage, error) { + var resp InternalLinkTypeContactsPage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInternalLinkTypeDirectMessagesChat(data json.RawMessage) (*InternalLinkTypeDirectMessagesChat, error) { + var resp InternalLinkTypeDirectMessagesChat err := json.Unmarshal(data, &resp) @@ -15049,6 +22764,30 @@ func UnmarshalInternalLinkTypeGame(data json.RawMessage) (*InternalLinkTypeGame, return &resp, err } +func UnmarshalInternalLinkTypeGiftAuction(data json.RawMessage) (*InternalLinkTypeGiftAuction, error) { + var resp InternalLinkTypeGiftAuction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInternalLinkTypeGiftCollection(data json.RawMessage) (*InternalLinkTypeGiftCollection, error) { + var resp InternalLinkTypeGiftCollection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInternalLinkTypeGroupCall(data json.RawMessage) (*InternalLinkTypeGroupCall, error) { + var resp InternalLinkTypeGroupCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeInstantView(data json.RawMessage) (*InternalLinkTypeInstantView, error) { var resp InternalLinkTypeInstantView @@ -15073,8 +22812,16 @@ func UnmarshalInternalLinkTypeLanguagePack(data json.RawMessage) (*InternalLinkT return &resp, err } -func UnmarshalInternalLinkTypeLanguageSettings(data json.RawMessage) (*InternalLinkTypeLanguageSettings, error) { - var resp InternalLinkTypeLanguageSettings +func UnmarshalInternalLinkTypeLiveStory(data json.RawMessage) (*InternalLinkTypeLiveStory, error) { + var resp InternalLinkTypeLiveStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInternalLinkTypeMainWebApp(data json.RawMessage) (*InternalLinkTypeMainWebApp, error) { + var resp InternalLinkTypeMainWebApp err := json.Unmarshal(data, &resp) @@ -15097,6 +22844,46 @@ func UnmarshalInternalLinkTypeMessageDraft(data json.RawMessage) (*InternalLinkT return &resp, err } +func UnmarshalInternalLinkTypeMyProfilePage(data json.RawMessage) (*InternalLinkTypeMyProfilePage, error) { + var resp InternalLinkTypeMyProfilePage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInternalLinkTypeNewChannelChat(data json.RawMessage) (*InternalLinkTypeNewChannelChat, error) { + var resp InternalLinkTypeNewChannelChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInternalLinkTypeNewGroupChat(data json.RawMessage) (*InternalLinkTypeNewGroupChat, error) { + var resp InternalLinkTypeNewGroupChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInternalLinkTypeNewPrivateChat(data json.RawMessage) (*InternalLinkTypeNewPrivateChat, error) { + var resp InternalLinkTypeNewPrivateChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInternalLinkTypeNewStory(data json.RawMessage) (*InternalLinkTypeNewStory, error) { + var resp InternalLinkTypeNewStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypePassportDataRequest(data json.RawMessage) (*InternalLinkTypePassportDataRequest, error) { var resp InternalLinkTypePassportDataRequest @@ -15113,8 +22900,8 @@ func UnmarshalInternalLinkTypePhoneNumberConfirmation(data json.RawMessage) (*In return &resp, err } -func UnmarshalInternalLinkTypePremiumFeatures(data json.RawMessage) (*InternalLinkTypePremiumFeatures, error) { - var resp InternalLinkTypePremiumFeatures +func UnmarshalInternalLinkTypePremiumFeaturesPage(data json.RawMessage) (*InternalLinkTypePremiumFeaturesPage, error) { + var resp InternalLinkTypePremiumFeaturesPage err := json.Unmarshal(data, &resp) @@ -15129,8 +22916,8 @@ func UnmarshalInternalLinkTypePremiumGiftCode(data json.RawMessage) (*InternalLi return &resp, err } -func UnmarshalInternalLinkTypePrivacyAndSecuritySettings(data json.RawMessage) (*InternalLinkTypePrivacyAndSecuritySettings, error) { - var resp InternalLinkTypePrivacyAndSecuritySettings +func UnmarshalInternalLinkTypePremiumGiftPurchase(data json.RawMessage) (*InternalLinkTypePremiumGiftPurchase, error) { + var resp InternalLinkTypePremiumGiftPurchase err := json.Unmarshal(data, &resp) @@ -15169,6 +22956,22 @@ func UnmarshalInternalLinkTypeRestorePurchases(data json.RawMessage) (*InternalL return &resp, err } +func UnmarshalInternalLinkTypeSavedMessages(data json.RawMessage) (*InternalLinkTypeSavedMessages, error) { + var resp InternalLinkTypeSavedMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInternalLinkTypeSearch(data json.RawMessage) (*InternalLinkTypeSearch, error) { + var resp InternalLinkTypeSearch + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInternalLinkTypeSettings(data json.RawMessage) (*InternalLinkTypeSettings, error) { var resp InternalLinkTypeSettings @@ -15177,8 +22980,8 @@ func UnmarshalInternalLinkTypeSettings(data json.RawMessage) (*InternalLinkTypeS return &resp, err } -func UnmarshalInternalLinkTypeSideMenuBot(data json.RawMessage) (*InternalLinkTypeSideMenuBot, error) { - var resp InternalLinkTypeSideMenuBot +func UnmarshalInternalLinkTypeStarPurchase(data json.RawMessage) (*InternalLinkTypeStarPurchase, error) { + var resp InternalLinkTypeStarPurchase err := json.Unmarshal(data, &resp) @@ -15201,16 +23004,16 @@ func UnmarshalInternalLinkTypeStory(data json.RawMessage) (*InternalLinkTypeStor return &resp, err } -func UnmarshalInternalLinkTypeTheme(data json.RawMessage) (*InternalLinkTypeTheme, error) { - var resp InternalLinkTypeTheme +func UnmarshalInternalLinkTypeStoryAlbum(data json.RawMessage) (*InternalLinkTypeStoryAlbum, error) { + var resp InternalLinkTypeStoryAlbum err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalInternalLinkTypeThemeSettings(data json.RawMessage) (*InternalLinkTypeThemeSettings, error) { - var resp InternalLinkTypeThemeSettings +func UnmarshalInternalLinkTypeTheme(data json.RawMessage) (*InternalLinkTypeTheme, error) { + var resp InternalLinkTypeTheme err := json.Unmarshal(data, &resp) @@ -15225,8 +23028,8 @@ func UnmarshalInternalLinkTypeUnknownDeepLink(data json.RawMessage) (*InternalLi return &resp, err } -func UnmarshalInternalLinkTypeUnsupportedProxy(data json.RawMessage) (*InternalLinkTypeUnsupportedProxy, error) { - var resp InternalLinkTypeUnsupportedProxy +func UnmarshalInternalLinkTypeUpgradedGift(data json.RawMessage) (*InternalLinkTypeUpgradedGift, error) { + var resp InternalLinkTypeUpgradedGift err := json.Unmarshal(data, &resp) @@ -15313,14 +23116,6 @@ func UnmarshalBlockListStories(data json.RawMessage) (*BlockListStories, error) return &resp, err } -func UnmarshalFilePart(data json.RawMessage) (*FilePart, error) { - var resp FilePart - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalFileTypeNone(data json.RawMessage) (*FileTypeNone, error) { var resp FileTypeNone @@ -15409,6 +23204,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 @@ -15689,6 +23516,14 @@ func UnmarshalConnectionStateReady(data json.RawMessage) (*ConnectionStateReady, return &resp, err } +func UnmarshalAgeVerificationParameters(data json.RawMessage) (*AgeVerificationParameters, error) { + var resp AgeVerificationParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTopChatCategoryUsers(data json.RawMessage) (*TopChatCategoryUsers, error) { var resp TopChatCategoryUsers @@ -15729,6 +23564,14 @@ func UnmarshalTopChatCategoryInlineBots(data json.RawMessage) (*TopChatCategoryI return &resp, err } +func UnmarshalTopChatCategoryWebAppBots(data json.RawMessage) (*TopChatCategoryWebAppBots, error) { + var resp TopChatCategoryWebAppBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTopChatCategoryCalls(data json.RawMessage) (*TopChatCategoryCalls, error) { var resp TopChatCategoryCalls @@ -15881,6 +23724,70 @@ func UnmarshalSuggestedActionSubscribeToAnnualPremium(data json.RawMessage) (*Su return &resp, err } +func UnmarshalSuggestedActionGiftPremiumForChristmas(data json.RawMessage) (*SuggestedActionGiftPremiumForChristmas, error) { + var resp SuggestedActionGiftPremiumForChristmas + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedActionSetBirthdate(data json.RawMessage) (*SuggestedActionSetBirthdate, error) { + var resp SuggestedActionSetBirthdate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedActionSetProfilePhoto(data json.RawMessage) (*SuggestedActionSetProfilePhoto, error) { + var resp SuggestedActionSetProfilePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedActionExtendPremium(data json.RawMessage) (*SuggestedActionExtendPremium, error) { + var resp SuggestedActionExtendPremium + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedActionExtendStarSubscriptions(data json.RawMessage) (*SuggestedActionExtendStarSubscriptions, error) { + var resp SuggestedActionExtendStarSubscriptions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedActionCustom(data json.RawMessage) (*SuggestedActionCustom, error) { + var resp SuggestedActionCustom + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedActionSetLoginEmailAddress(data json.RawMessage) (*SuggestedActionSetLoginEmailAddress, error) { + var resp SuggestedActionSetLoginEmailAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalSuggestedActionAddLoginPasskey(data json.RawMessage) (*SuggestedActionAddLoginPasskey, error) { + var resp SuggestedActionAddLoginPasskey + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalCount(data json.RawMessage) (*Count, error) { var resp Count @@ -15897,6 +23804,14 @@ func UnmarshalText(data json.RawMessage) (*Text, error) { return &resp, err } +func UnmarshalData(data json.RawMessage) (*Data, error) { + var resp Data + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSeconds(data json.RawMessage) (*Seconds, error) { var resp Seconds @@ -15913,6 +23828,14 @@ func UnmarshalFileDownloadedPrefixSize(data json.RawMessage) (*FileDownloadedPre return &resp, err } +func UnmarshalStarCount(data json.RawMessage) (*StarCount, error) { + var resp StarCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDeepLinkInfo(data json.RawMessage) (*DeepLinkInfo, error) { var resp DeepLinkInfo @@ -15961,16 +23884,16 @@ func UnmarshalProxyTypeMtproto(data json.RawMessage) (*ProxyTypeMtproto, error) return &resp, err } -func UnmarshalProxy(data json.RawMessage) (*Proxy, error) { - var resp Proxy +func UnmarshalAddedProxy(data json.RawMessage) (*AddedProxy, error) { + var resp AddedProxy err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalProxies(data json.RawMessage) (*Proxies, error) { - var resp Proxies +func UnmarshalAddedProxies(data json.RawMessage) (*AddedProxies, error) { + var resp AddedProxies err := json.Unmarshal(data, &resp) @@ -16025,8 +23948,24 @@ func UnmarshalStatisticalGraphError(data json.RawMessage) (*StatisticalGraphErro return &resp, err } -func UnmarshalChatStatisticsMessageInteractionInfo(data json.RawMessage) (*ChatStatisticsMessageInteractionInfo, error) { - var resp ChatStatisticsMessageInteractionInfo +func UnmarshalChatStatisticsObjectTypeMessage(data json.RawMessage) (*ChatStatisticsObjectTypeMessage, error) { + var resp ChatStatisticsObjectTypeMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatStatisticsObjectTypeStory(data json.RawMessage) (*ChatStatisticsObjectTypeStory, error) { + var resp ChatStatisticsObjectTypeStory + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatStatisticsInteractionInfo(data json.RawMessage) (*ChatStatisticsInteractionInfo, error) { + var resp ChatStatisticsInteractionInfo err := json.Unmarshal(data, &resp) @@ -16073,6 +24012,22 @@ func UnmarshalChatStatisticsChannel(data json.RawMessage) (*ChatStatisticsChanne return &resp, err } +func UnmarshalChatRevenueAmount(data json.RawMessage) (*ChatRevenueAmount, error) { + var resp ChatRevenueAmount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueStatistics(data json.RawMessage) (*ChatRevenueStatistics, error) { + var resp ChatRevenueStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageStatistics(data json.RawMessage) (*MessageStatistics, error) { var resp MessageStatistics @@ -16081,6 +24036,126 @@ func UnmarshalMessageStatistics(data json.RawMessage) (*MessageStatistics, error return &resp, err } +func UnmarshalStoryStatistics(data json.RawMessage) (*StoryStatistics, error) { + var resp StoryStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRevenueWithdrawalStatePending(data json.RawMessage) (*RevenueWithdrawalStatePending, error) { + var resp RevenueWithdrawalStatePending + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRevenueWithdrawalStateSucceeded(data json.RawMessage) (*RevenueWithdrawalStateSucceeded, error) { + var resp RevenueWithdrawalStateSucceeded + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRevenueWithdrawalStateFailed(data json.RawMessage) (*RevenueWithdrawalStateFailed, error) { + var resp RevenueWithdrawalStateFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeUnsupported(data json.RawMessage) (*ChatRevenueTransactionTypeUnsupported, error) { + var resp ChatRevenueTransactionTypeUnsupported + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeSponsoredMessageEarnings, error) { + var resp ChatRevenueTransactionTypeSponsoredMessageEarnings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data json.RawMessage) (*ChatRevenueTransactionTypeSuggestedPostEarnings, error) { + var resp ChatRevenueTransactionTypeSuggestedPostEarnings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data json.RawMessage) (*ChatRevenueTransactionTypeFragmentWithdrawal, error) { + var resp ChatRevenueTransactionTypeFragmentWithdrawal + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactionTypeFragmentRefund(data json.RawMessage) (*ChatRevenueTransactionTypeFragmentRefund, error) { + var resp ChatRevenueTransactionTypeFragmentRefund + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransaction(data json.RawMessage) (*ChatRevenueTransaction, error) { + var resp ChatRevenueTransaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatRevenueTransactions(data json.RawMessage) (*ChatRevenueTransactions, error) { + var resp ChatRevenueTransactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarRevenueStatus(data json.RawMessage) (*StarRevenueStatus, error) { + var resp StarRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalStarRevenueStatistics(data json.RawMessage) (*StarRevenueStatistics, error) { + var resp StarRevenueStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonRevenueStatus(data json.RawMessage) (*TonRevenueStatus, error) { + var resp TonRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTonRevenueStatistics(data json.RawMessage) (*TonRevenueStatistics, error) { + var resp TonRevenueStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPoint(data json.RawMessage) (*Point, error) { var resp Point @@ -16161,6 +24236,30 @@ func UnmarshalBotCommandScopeChatMember(data json.RawMessage) (*BotCommandScopeC return &resp, err } +func UnmarshalPhoneNumberCodeTypeChange(data json.RawMessage) (*PhoneNumberCodeTypeChange, error) { + var resp PhoneNumberCodeTypeChange + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPhoneNumberCodeTypeVerify(data json.RawMessage) (*PhoneNumberCodeTypeVerify, error) { + var resp PhoneNumberCodeTypeVerify + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPhoneNumberCodeTypeConfirmOwnership(data json.RawMessage) (*PhoneNumberCodeTypeConfirmOwnership, error) { + var resp PhoneNumberCodeTypeConfirmOwnership + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateAuthorizationState(data json.RawMessage) (*UpdateAuthorizationState, error) { var resp UpdateAuthorizationState @@ -16257,6 +24356,22 @@ func UnmarshalUpdateMessageUnreadReactions(data json.RawMessage) (*UpdateMessage return &resp, err } +func UnmarshalUpdateMessageFactCheck(data json.RawMessage) (*UpdateMessageFactCheck, error) { + var resp UpdateMessageFactCheck + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageSuggestedPostInfo(data json.RawMessage) (*UpdateMessageSuggestedPostInfo, error) { + var resp UpdateMessageSuggestedPostInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateMessageLiveLocationViewed(data json.RawMessage) (*UpdateMessageLiveLocationViewed, error) { var resp UpdateMessageLiveLocationViewed @@ -16265,6 +24380,14 @@ func UnmarshalUpdateMessageLiveLocationViewed(data json.RawMessage) (*UpdateMess return &resp, err } +func UnmarshalUpdateVideoPublished(data json.RawMessage) (*UpdateVideoPublished, error) { + var resp UpdateVideoPublished + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewChat(data json.RawMessage) (*UpdateNewChat, error) { var resp UpdateNewChat @@ -16289,16 +24412,8 @@ func UnmarshalUpdateChatPhoto(data json.RawMessage) (*UpdateChatPhoto, error) { return &resp, err } -func UnmarshalUpdateChatAccentColor(data json.RawMessage) (*UpdateChatAccentColor, error) { - var resp UpdateChatAccentColor - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalUpdateChatBackgroundCustomEmoji(data json.RawMessage) (*UpdateChatBackgroundCustomEmoji, error) { - var resp UpdateChatBackgroundCustomEmoji +func UnmarshalUpdateChatAccentColors(data json.RawMessage) (*UpdateChatAccentColors, error) { + var resp UpdateChatAccentColors err := json.Unmarshal(data, &resp) @@ -16329,6 +24444,22 @@ func UnmarshalUpdateChatPosition(data json.RawMessage) (*UpdateChatPosition, err return &resp, err } +func UnmarshalUpdateChatAddedToList(data json.RawMessage) (*UpdateChatAddedToList, error) { + var resp UpdateChatAddedToList + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatRemovedFromList(data json.RawMessage) (*UpdateChatRemovedFromList, error) { + var resp UpdateChatRemovedFromList + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatReadInbox(data json.RawMessage) (*UpdateChatReadInbox, error) { var resp UpdateChatReadInbox @@ -16353,6 +24484,14 @@ func UnmarshalUpdateChatActionBar(data json.RawMessage) (*UpdateChatActionBar, e return &resp, err } +func UnmarshalUpdateChatBusinessBotManageBar(data json.RawMessage) (*UpdateChatBusinessBotManageBar, error) { + var resp UpdateChatBusinessBotManageBar + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatAvailableReactions(data json.RawMessage) (*UpdateChatAvailableReactions, error) { var resp UpdateChatAvailableReactions @@ -16369,6 +24508,14 @@ func UnmarshalUpdateChatDraftMessage(data json.RawMessage) (*UpdateChatDraftMess return &resp, err } +func UnmarshalUpdateChatEmojiStatus(data json.RawMessage) (*UpdateChatEmojiStatus, error) { + var resp UpdateChatEmojiStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatMessageSender(data json.RawMessage) (*UpdateChatMessageSender, error) { var resp UpdateChatMessageSender @@ -16481,6 +24628,14 @@ func UnmarshalUpdateChatIsMarkedAsUnread(data json.RawMessage) (*UpdateChatIsMar return &resp, err } +func UnmarshalUpdateChatViewAsTopics(data json.RawMessage) (*UpdateChatViewAsTopics, error) { + var resp UpdateChatViewAsTopics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatBlockList(data json.RawMessage) (*UpdateChatBlockList, error) { var resp UpdateChatBlockList @@ -16513,6 +24668,70 @@ func UnmarshalUpdateChatOnlineMemberCount(data json.RawMessage) (*UpdateChatOnli return &resp, err } +func UnmarshalUpdateSavedMessagesTopic(data json.RawMessage) (*UpdateSavedMessagesTopic, error) { + var resp UpdateSavedMessagesTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateSavedMessagesTopicCount(data json.RawMessage) (*UpdateSavedMessagesTopicCount, error) { + var resp UpdateSavedMessagesTopicCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateDirectMessagesChatTopic(data json.RawMessage) (*UpdateDirectMessagesChatTopic, error) { + var resp UpdateDirectMessagesChatTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateTopicMessageCount(data json.RawMessage) (*UpdateTopicMessageCount, error) { + var resp UpdateTopicMessageCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateQuickReplyShortcut(data json.RawMessage) (*UpdateQuickReplyShortcut, error) { + var resp UpdateQuickReplyShortcut + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateQuickReplyShortcutDeleted(data json.RawMessage) (*UpdateQuickReplyShortcutDeleted, error) { + var resp UpdateQuickReplyShortcutDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateQuickReplyShortcuts(data json.RawMessage) (*UpdateQuickReplyShortcuts, error) { + var resp UpdateQuickReplyShortcuts + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateQuickReplyShortcutMessages(data json.RawMessage) (*UpdateQuickReplyShortcutMessages, error) { + var resp UpdateQuickReplyShortcutMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateForumTopicInfo(data json.RawMessage) (*UpdateForumTopicInfo, error) { var resp UpdateForumTopicInfo @@ -16521,6 +24740,14 @@ func UnmarshalUpdateForumTopicInfo(data json.RawMessage) (*UpdateForumTopicInfo, return &resp, err } +func UnmarshalUpdateForumTopic(data json.RawMessage) (*UpdateForumTopic, error) { + var resp UpdateForumTopic + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateScopeNotificationSettings(data json.RawMessage) (*UpdateScopeNotificationSettings, error) { var resp UpdateScopeNotificationSettings @@ -16529,6 +24756,14 @@ func UnmarshalUpdateScopeNotificationSettings(data json.RawMessage) (*UpdateScop return &resp, err } +func UnmarshalUpdateReactionNotificationSettings(data json.RawMessage) (*UpdateReactionNotificationSettings, error) { + var resp UpdateReactionNotificationSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNotification(data json.RawMessage) (*UpdateNotification, error) { var resp UpdateNotification @@ -16577,6 +24812,14 @@ func UnmarshalUpdateChatAction(data json.RawMessage) (*UpdateChatAction, error) return &resp, err } +func UnmarshalUpdatePendingTextMessage(data json.RawMessage) (*UpdatePendingTextMessage, error) { + var resp UpdatePendingTextMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateUserStatus(data json.RawMessage) (*UpdateUserStatus, error) { var resp UpdateUserStatus @@ -16705,6 +24948,22 @@ func UnmarshalUpdateFileRemovedFromDownloads(data json.RawMessage) (*UpdateFileR return &resp, err } +func UnmarshalUpdateApplicationVerificationRequired(data json.RawMessage) (*UpdateApplicationVerificationRequired, error) { + var resp UpdateApplicationVerificationRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateApplicationRecaptchaVerificationRequired(data json.RawMessage) (*UpdateApplicationRecaptchaVerificationRequired, error) { + var resp UpdateApplicationRecaptchaVerificationRequired + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateCall(data json.RawMessage) (*UpdateCall, error) { var resp UpdateCall @@ -16729,6 +24988,62 @@ func UnmarshalUpdateGroupCallParticipant(data json.RawMessage) (*UpdateGroupCall return &resp, err } +func UnmarshalUpdateGroupCallParticipants(data json.RawMessage) (*UpdateGroupCallParticipants, error) { + var resp UpdateGroupCallParticipants + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateGroupCallVerificationState(data json.RawMessage) (*UpdateGroupCallVerificationState, error) { + var resp UpdateGroupCallVerificationState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewGroupCallMessage(data json.RawMessage) (*UpdateNewGroupCallMessage, error) { + var resp UpdateNewGroupCallMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewGroupCallPaidReaction(data json.RawMessage) (*UpdateNewGroupCallPaidReaction, error) { + var resp UpdateNewGroupCallPaidReaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateGroupCallMessageSendFailed(data json.RawMessage) (*UpdateGroupCallMessageSendFailed, error) { + var resp UpdateGroupCallMessageSendFailed + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateGroupCallMessagesDeleted(data json.RawMessage) (*UpdateGroupCallMessagesDeleted, error) { + var resp UpdateGroupCallMessagesDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateLiveStoryTopDonors(data json.RawMessage) (*UpdateLiveStoryTopDonors, error) { + var resp UpdateLiveStoryTopDonors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewCallSignalingData(data json.RawMessage) (*UpdateNewCallSignalingData, error) { var resp UpdateNewCallSignalingData @@ -16737,6 +25052,22 @@ func UnmarshalUpdateNewCallSignalingData(data json.RawMessage) (*UpdateNewCallSi return &resp, err } +func UnmarshalUpdateGiftAuctionState(data json.RawMessage) (*UpdateGiftAuctionState, error) { + var resp UpdateGiftAuctionState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateActiveGiftAuctions(data json.RawMessage) (*UpdateActiveGiftAuctions, error) { + var resp UpdateActiveGiftAuctions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateUserPrivacySettingRules(data json.RawMessage) (*UpdateUserPrivacySettingRules, error) { var resp UpdateUserPrivacySettingRules @@ -16777,16 +25108,16 @@ func UnmarshalUpdateStoryDeleted(data json.RawMessage) (*UpdateStoryDeleted, err return &resp, err } -func UnmarshalUpdateStorySendSucceeded(data json.RawMessage) (*UpdateStorySendSucceeded, error) { - var resp UpdateStorySendSucceeded +func UnmarshalUpdateStoryPostSucceeded(data json.RawMessage) (*UpdateStoryPostSucceeded, error) { + var resp UpdateStoryPostSucceeded err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUpdateStorySendFailed(data json.RawMessage) (*UpdateStorySendFailed, error) { - var resp UpdateStorySendFailed +func UnmarshalUpdateStoryPostFailed(data json.RawMessage) (*UpdateStoryPostFailed, error) { + var resp UpdateStoryPostFailed err := json.Unmarshal(data, &resp) @@ -16817,6 +25148,14 @@ func UnmarshalUpdateStoryStealthMode(data json.RawMessage) (*UpdateStoryStealthM return &resp, err } +func UnmarshalUpdateTrustedMiniAppBots(data json.RawMessage) (*UpdateTrustedMiniAppBots, error) { + var resp UpdateTrustedMiniAppBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateOption(data json.RawMessage) (*UpdateOption, error) { var resp UpdateOption @@ -16881,16 +25220,16 @@ func UnmarshalUpdateSavedNotificationSounds(data json.RawMessage) (*UpdateSavedN return &resp, err } -func UnmarshalUpdateSelectedBackground(data json.RawMessage) (*UpdateSelectedBackground, error) { - var resp UpdateSelectedBackground +func UnmarshalUpdateDefaultBackground(data json.RawMessage) (*UpdateDefaultBackground, error) { + var resp UpdateDefaultBackground err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUpdateChatThemes(data json.RawMessage) (*UpdateChatThemes, error) { - var resp UpdateChatThemes +func UnmarshalUpdateEmojiChatThemes(data json.RawMessage) (*UpdateEmojiChatThemes, error) { + var resp UpdateEmojiChatThemes err := json.Unmarshal(data, &resp) @@ -16905,6 +25244,14 @@ func UnmarshalUpdateAccentColors(data json.RawMessage) (*UpdateAccentColors, err return &resp, err } +func UnmarshalUpdateProfileAccentColors(data json.RawMessage) (*UpdateProfileAccentColors, error) { + var resp UpdateProfileAccentColors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateLanguagePackStrings(data json.RawMessage) (*UpdateLanguagePackStrings, error) { var resp UpdateLanguagePackStrings @@ -16921,16 +25268,24 @@ func UnmarshalUpdateConnectionState(data json.RawMessage) (*UpdateConnectionStat return &resp, err } -func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, error) { - var resp UpdateTermsOfService +func UnmarshalUpdateFreezeState(data json.RawMessage) (*UpdateFreezeState, error) { + var resp UpdateFreezeState err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalUpdateUsersNearby(data json.RawMessage) (*UpdateUsersNearby, error) { - var resp UpdateUsersNearby +func UnmarshalUpdateAgeVerificationParameters(data json.RawMessage) (*UpdateAgeVerificationParameters, error) { + var resp UpdateAgeVerificationParameters + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, error) { + var resp UpdateTermsOfService err := json.Unmarshal(data, &resp) @@ -16969,6 +25324,14 @@ func UnmarshalUpdateActiveEmojiReactions(data json.RawMessage) (*UpdateActiveEmo return &resp, err } +func UnmarshalUpdateAvailableMessageEffects(data json.RawMessage) (*UpdateAvailableMessageEffects, error) { + var resp UpdateAvailableMessageEffects + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateDefaultReactionType(data json.RawMessage) (*UpdateDefaultReactionType, error) { var resp UpdateDefaultReactionType @@ -16977,6 +25340,86 @@ func UnmarshalUpdateDefaultReactionType(data json.RawMessage) (*UpdateDefaultRea return &resp, err } +func UnmarshalUpdateDefaultPaidReactionType(data json.RawMessage) (*UpdateDefaultPaidReactionType, error) { + var resp UpdateDefaultPaidReactionType + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateSavedMessagesTags(data json.RawMessage) (*UpdateSavedMessagesTags, error) { + var resp UpdateSavedMessagesTags + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateActiveLiveLocationMessages(data json.RawMessage) (*UpdateActiveLiveLocationMessages, error) { + var resp UpdateActiveLiveLocationMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateOwnedStarCount(data json.RawMessage) (*UpdateOwnedStarCount, error) { + var resp UpdateOwnedStarCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateOwnedTonCount(data json.RawMessage) (*UpdateOwnedTonCount, error) { + var resp UpdateOwnedTonCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatRevenueAmount(data json.RawMessage) (*UpdateChatRevenueAmount, error) { + var resp UpdateChatRevenueAmount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateStarRevenueStatus(data json.RawMessage) (*UpdateStarRevenueStatus, error) { + var resp UpdateStarRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateTonRevenueStatus(data json.RawMessage) (*UpdateTonRevenueStatus, error) { + var resp UpdateTonRevenueStatus + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateSpeechRecognitionTrial(data json.RawMessage) (*UpdateSpeechRecognitionTrial, error) { + var resp UpdateSpeechRecognitionTrial + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateGroupCallMessageLevels(data json.RawMessage) (*UpdateGroupCallMessageLevels, error) { + var resp UpdateGroupCallMessageLevels + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateDiceEmojis(data json.RawMessage) (*UpdateDiceEmojis, error) { var resp UpdateDiceEmojis @@ -16985,6 +25428,14 @@ func UnmarshalUpdateDiceEmojis(data json.RawMessage) (*UpdateDiceEmojis, error) return &resp, err } +func UnmarshalUpdateStakeDiceState(data json.RawMessage) (*UpdateStakeDiceState, error) { + var resp UpdateStakeDiceState + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateAnimatedEmojiMessageClicked(data json.RawMessage) (*UpdateAnimatedEmojiMessageClicked, error) { var resp UpdateAnimatedEmojiMessageClicked @@ -17009,8 +25460,16 @@ func UnmarshalUpdateSuggestedActions(data json.RawMessage) (*UpdateSuggestedActi return &resp, err } -func UnmarshalUpdateAddChatMembersPrivacyForbidden(data json.RawMessage) (*UpdateAddChatMembersPrivacyForbidden, error) { - var resp UpdateAddChatMembersPrivacyForbidden +func UnmarshalUpdateSpeedLimitNotification(data json.RawMessage) (*UpdateSpeedLimitNotification, error) { + var resp UpdateSpeedLimitNotification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateContactCloseBirthdays(data json.RawMessage) (*UpdateContactCloseBirthdays, error) { + var resp UpdateContactCloseBirthdays err := json.Unmarshal(data, &resp) @@ -17025,6 +25484,38 @@ func UnmarshalUpdateAutosaveSettings(data json.RawMessage) (*UpdateAutosaveSetti return &resp, err } +func UnmarshalUpdateBusinessConnection(data json.RawMessage) (*UpdateBusinessConnection, error) { + var resp UpdateBusinessConnection + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNewBusinessMessage(data json.RawMessage) (*UpdateNewBusinessMessage, error) { + var resp UpdateNewBusinessMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateBusinessMessageEdited(data json.RawMessage) (*UpdateBusinessMessageEdited, error) { + var resp UpdateBusinessMessageEdited + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateBusinessMessagesDeleted(data json.RawMessage) (*UpdateBusinessMessagesDeleted, error) { + var resp UpdateBusinessMessagesDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewInlineQuery(data json.RawMessage) (*UpdateNewInlineQuery, error) { var resp UpdateNewInlineQuery @@ -17057,6 +25548,14 @@ func UnmarshalUpdateNewInlineCallbackQuery(data json.RawMessage) (*UpdateNewInli return &resp, err } +func UnmarshalUpdateNewBusinessCallbackQuery(data json.RawMessage) (*UpdateNewBusinessCallbackQuery, error) { + var resp UpdateNewBusinessCallbackQuery + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewShippingQuery(data json.RawMessage) (*UpdateNewShippingQuery, error) { var resp UpdateNewShippingQuery @@ -17129,6 +25628,30 @@ func UnmarshalUpdateChatBoost(data json.RawMessage) (*UpdateChatBoost, error) { return &resp, err } +func UnmarshalUpdateMessageReaction(data json.RawMessage) (*UpdateMessageReaction, error) { + var resp UpdateMessageReaction + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateMessageReactions(data json.RawMessage) (*UpdateMessageReactions, error) { + var resp UpdateMessageReactions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdatePaidMediaPurchased(data json.RawMessage) (*UpdatePaidMediaPurchased, error) { + var resp UpdatePaidMediaPurchased + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdates(data json.RawMessage) (*Updates, error) { var resp Updates @@ -17262,6 +25785,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAuthenticationCodeTypeSms: return UnmarshalAuthenticationCodeTypeSms(data) + case TypeAuthenticationCodeTypeSmsWord: + return UnmarshalAuthenticationCodeTypeSmsWord(data) + + case TypeAuthenticationCodeTypeSmsPhrase: + return UnmarshalAuthenticationCodeTypeSmsPhrase(data) + case TypeAuthenticationCodeTypeCall: return UnmarshalAuthenticationCodeTypeCall(data) @@ -17313,12 +25842,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTermsOfService: return UnmarshalTermsOfService(data) + case TypePasskey: + return UnmarshalPasskey(data) + + case TypePasskeys: + return UnmarshalPasskeys(data) + case TypeAuthorizationStateWaitTdlibParameters: return UnmarshalAuthorizationStateWaitTdlibParameters(data) case TypeAuthorizationStateWaitPhoneNumber: return UnmarshalAuthorizationStateWaitPhoneNumber(data) + case TypeAuthorizationStateWaitPremiumPurchase: + return UnmarshalAuthorizationStateWaitPremiumPurchase(data) + case TypeAuthorizationStateWaitEmailAddress: return UnmarshalAuthorizationStateWaitEmailAddress(data) @@ -17349,6 +25887,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAuthorizationStateClosed: return UnmarshalAuthorizationStateClosed(data) + case TypeFirebaseDeviceVerificationParametersSafetyNet: + return UnmarshalFirebaseDeviceVerificationParametersSafetyNet(data) + + case TypeFirebaseDeviceVerificationParametersPlayIntegrity: + return UnmarshalFirebaseDeviceVerificationParametersPlayIntegrity(data) + case TypePasswordState: return UnmarshalPasswordState(data) @@ -17454,6 +25998,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeClosedVectorPath: return UnmarshalClosedVectorPath(data) + case TypeOutline: + return UnmarshalOutline(data) + case TypePollOption: return UnmarshalPollOption(data) @@ -17463,12 +26010,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePollTypeQuiz: return UnmarshalPollTypeQuiz(data) + case TypeChecklistTask: + return UnmarshalChecklistTask(data) + + case TypeInputChecklistTask: + return UnmarshalInputChecklistTask(data) + + case TypeChecklist: + return UnmarshalChecklist(data) + + case TypeInputChecklist: + return UnmarshalInputChecklist(data) + case TypeAnimation: return UnmarshalAnimation(data) case TypeAudio: return UnmarshalAudio(data) + case TypeAudios: + return UnmarshalAudios(data) + case TypeDocument: return UnmarshalDocument(data) @@ -17502,12 +26064,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGame: return UnmarshalGame(data) + case TypeStakeDiceState: + return UnmarshalStakeDiceState(data) + case TypeWebApp: return UnmarshalWebApp(data) case TypePoll: return UnmarshalPoll(data) + case TypeAlternativeVideo: + return UnmarshalAlternativeVideo(data) + + case TypeVideoStoryboard: + return UnmarshalVideoStoryboard(data) + case TypeBackground: return UnmarshalBackground(data) @@ -17523,6 +26094,30 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatPhotoInfo: return UnmarshalChatPhotoInfo(data) + case TypeProfileTabPosts: + return UnmarshalProfileTabPosts(data) + + case TypeProfileTabGifts: + return UnmarshalProfileTabGifts(data) + + case TypeProfileTabMedia: + return UnmarshalProfileTabMedia(data) + + case TypeProfileTabFiles: + return UnmarshalProfileTabFiles(data) + + case TypeProfileTabLinks: + return UnmarshalProfileTabLinks(data) + + case TypeProfileTabMusic: + return UnmarshalProfileTabMusic(data) + + case TypeProfileTabVoice: + return UnmarshalProfileTabVoice(data) + + case TypeProfileTabGifs: + return UnmarshalProfileTabGifs(data) + case TypeUserTypeRegular: return UnmarshalUserTypeRegular(data) @@ -17544,9 +26139,78 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBotMenuButton: return UnmarshalBotMenuButton(data) + case TypeBotVerificationParameters: + return UnmarshalBotVerificationParameters(data) + + case TypeBotVerification: + return UnmarshalBotVerification(data) + + case TypeVerificationStatus: + return UnmarshalVerificationStatus(data) + case TypeChatLocation: return UnmarshalChatLocation(data) + case TypeBirthdate: + return UnmarshalBirthdate(data) + + case TypeCloseBirthdayUser: + return UnmarshalCloseBirthdayUser(data) + + case TypeBusinessAwayMessageScheduleAlways: + return UnmarshalBusinessAwayMessageScheduleAlways(data) + + case TypeBusinessAwayMessageScheduleOutsideOfOpeningHours: + return UnmarshalBusinessAwayMessageScheduleOutsideOfOpeningHours(data) + + case TypeBusinessAwayMessageScheduleCustom: + return UnmarshalBusinessAwayMessageScheduleCustom(data) + + case TypeBusinessLocation: + return UnmarshalBusinessLocation(data) + + case TypeBusinessRecipients: + return UnmarshalBusinessRecipients(data) + + case TypeBusinessAwayMessageSettings: + return UnmarshalBusinessAwayMessageSettings(data) + + case TypeBusinessGreetingMessageSettings: + return UnmarshalBusinessGreetingMessageSettings(data) + + case TypeBusinessBotRights: + return UnmarshalBusinessBotRights(data) + + case TypeBusinessConnectedBot: + return UnmarshalBusinessConnectedBot(data) + + case TypeBusinessStartPage: + return UnmarshalBusinessStartPage(data) + + case TypeInputBusinessStartPage: + return UnmarshalInputBusinessStartPage(data) + + case TypeBusinessOpeningHoursInterval: + return UnmarshalBusinessOpeningHoursInterval(data) + + case TypeBusinessOpeningHours: + return UnmarshalBusinessOpeningHours(data) + + case TypeBusinessInfo: + return UnmarshalBusinessInfo(data) + + case TypeBusinessChatLink: + return UnmarshalBusinessChatLink(data) + + case TypeBusinessChatLinks: + return UnmarshalBusinessChatLinks(data) + + case TypeInputBusinessChatLink: + return UnmarshalInputBusinessChatLink(data) + + case TypeBusinessChatLinkInfo: + return UnmarshalBusinessChatLinkInfo(data) + case TypeChatPhotoStickerTypeRegularOrMask: return UnmarshalChatPhotoStickerTypeRegularOrMask(data) @@ -17583,51 +26247,594 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAdministratorRights: return UnmarshalChatAdministratorRights(data) + case TypeGiftResalePriceStar: + return UnmarshalGiftResalePriceStar(data) + + case TypeGiftResalePriceTon: + return UnmarshalGiftResalePriceTon(data) + + case TypeGiftPurchaseOfferStatePending: + return UnmarshalGiftPurchaseOfferStatePending(data) + + case TypeGiftPurchaseOfferStateAccepted: + return UnmarshalGiftPurchaseOfferStateAccepted(data) + + case TypeGiftPurchaseOfferStateRejected: + return UnmarshalGiftPurchaseOfferStateRejected(data) + + case TypeSuggestedPostPriceStar: + return UnmarshalSuggestedPostPriceStar(data) + + case TypeSuggestedPostPriceTon: + return UnmarshalSuggestedPostPriceTon(data) + + case TypeSuggestedPostStatePending: + return UnmarshalSuggestedPostStatePending(data) + + case TypeSuggestedPostStateApproved: + return UnmarshalSuggestedPostStateApproved(data) + + case TypeSuggestedPostStateDeclined: + return UnmarshalSuggestedPostStateDeclined(data) + + case TypeSuggestedPostInfo: + return UnmarshalSuggestedPostInfo(data) + + case TypeInputSuggestedPostInfo: + return UnmarshalInputSuggestedPostInfo(data) + + case TypeSuggestedPostRefundReasonPostDeleted: + return UnmarshalSuggestedPostRefundReasonPostDeleted(data) + + case TypeSuggestedPostRefundReasonPaymentRefunded: + return UnmarshalSuggestedPostRefundReasonPaymentRefunded(data) + + case TypeStarAmount: + return UnmarshalStarAmount(data) + + case TypeStarSubscriptionTypeChannel: + return UnmarshalStarSubscriptionTypeChannel(data) + + case TypeStarSubscriptionTypeBot: + return UnmarshalStarSubscriptionTypeBot(data) + + case TypeStarSubscriptionPricing: + return UnmarshalStarSubscriptionPricing(data) + + case TypeStarSubscription: + return UnmarshalStarSubscription(data) + + case TypeStarSubscriptions: + return UnmarshalStarSubscriptions(data) + + case TypeAffiliateTypeCurrentUser: + return UnmarshalAffiliateTypeCurrentUser(data) + + case TypeAffiliateTypeBot: + return UnmarshalAffiliateTypeBot(data) + + case TypeAffiliateTypeChannel: + return UnmarshalAffiliateTypeChannel(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 TypeConnectedAffiliateProgram: + return UnmarshalConnectedAffiliateProgram(data) + + case TypeConnectedAffiliatePrograms: + return UnmarshalConnectedAffiliatePrograms(data) + + case TypeProductInfo: + return UnmarshalProductInfo(data) + case TypePremiumPaymentOption: return UnmarshalPremiumPaymentOption(data) case TypePremiumStatePaymentOption: return UnmarshalPremiumStatePaymentOption(data) - case TypePremiumGiftCodePaymentOption: - return UnmarshalPremiumGiftCodePaymentOption(data) + case TypePremiumGiftPaymentOption: + return UnmarshalPremiumGiftPaymentOption(data) - case TypePremiumGiftCodePaymentOptions: - return UnmarshalPremiumGiftCodePaymentOptions(data) + case TypePremiumGiftPaymentOptions: + return UnmarshalPremiumGiftPaymentOptions(data) + + case TypePremiumGiveawayPaymentOption: + return UnmarshalPremiumGiveawayPaymentOption(data) + + case TypePremiumGiveawayPaymentOptions: + return UnmarshalPremiumGiveawayPaymentOptions(data) case TypePremiumGiftCodeInfo: return UnmarshalPremiumGiftCodeInfo(data) - case TypePremiumGiveawayParticipantStatusEligible: - return UnmarshalPremiumGiveawayParticipantStatusEligible(data) + case TypeStarPaymentOption: + return UnmarshalStarPaymentOption(data) - case TypePremiumGiveawayParticipantStatusParticipating: - return UnmarshalPremiumGiveawayParticipantStatusParticipating(data) + case TypeStarPaymentOptions: + return UnmarshalStarPaymentOptions(data) - case TypePremiumGiveawayParticipantStatusAlreadyWasMember: - return UnmarshalPremiumGiveawayParticipantStatusAlreadyWasMember(data) + case TypeStarGiveawayWinnerOption: + return UnmarshalStarGiveawayWinnerOption(data) - case TypePremiumGiveawayParticipantStatusAdministrator: - return UnmarshalPremiumGiveawayParticipantStatusAdministrator(data) + case TypeStarGiveawayPaymentOption: + return UnmarshalStarGiveawayPaymentOption(data) - case TypePremiumGiveawayParticipantStatusDisallowedCountry: - return UnmarshalPremiumGiveawayParticipantStatusDisallowedCountry(data) + case TypeStarGiveawayPaymentOptions: + return UnmarshalStarGiveawayPaymentOptions(data) - case TypePremiumGiveawayInfoOngoing: - return UnmarshalPremiumGiveawayInfoOngoing(data) + case TypeAcceptedGiftTypes: + return UnmarshalAcceptedGiftTypes(data) - case TypePremiumGiveawayInfoCompleted: - return UnmarshalPremiumGiveawayInfoCompleted(data) + case TypeGiftSettings: + return UnmarshalGiftSettings(data) + + case TypeGiftAuction: + return UnmarshalGiftAuction(data) + + case TypeGiftBackground: + return UnmarshalGiftBackground(data) + + case TypeGiftPurchaseLimits: + return UnmarshalGiftPurchaseLimits(data) + + case TypeGiftResaleParameters: + return UnmarshalGiftResaleParameters(data) + + case TypeGiftCollection: + return UnmarshalGiftCollection(data) + + case TypeGiftCollections: + return UnmarshalGiftCollections(data) + + case TypeCanSendGiftResultOk: + return UnmarshalCanSendGiftResultOk(data) + + case TypeCanSendGiftResultFail: + return UnmarshalCanSendGiftResultFail(data) + + case TypeUpgradedGiftOriginUpgrade: + return UnmarshalUpgradedGiftOriginUpgrade(data) + + case TypeUpgradedGiftOriginTransfer: + return UnmarshalUpgradedGiftOriginTransfer(data) + + case TypeUpgradedGiftOriginResale: + return UnmarshalUpgradedGiftOriginResale(data) + + case TypeUpgradedGiftOriginBlockchain: + return UnmarshalUpgradedGiftOriginBlockchain(data) + + case TypeUpgradedGiftOriginPrepaidUpgrade: + return UnmarshalUpgradedGiftOriginPrepaidUpgrade(data) + + case TypeUpgradedGiftOriginOffer: + return UnmarshalUpgradedGiftOriginOffer(data) + + case TypeUpgradedGiftOriginCraft: + return UnmarshalUpgradedGiftOriginCraft(data) + + case TypeUpgradedGiftAttributeRarityPerMille: + return UnmarshalUpgradedGiftAttributeRarityPerMille(data) + + case TypeUpgradedGiftAttributeRarityUncommon: + return UnmarshalUpgradedGiftAttributeRarityUncommon(data) + + case TypeUpgradedGiftAttributeRarityRare: + return UnmarshalUpgradedGiftAttributeRarityRare(data) + + case TypeUpgradedGiftAttributeRarityEpic: + return UnmarshalUpgradedGiftAttributeRarityEpic(data) + + case TypeUpgradedGiftAttributeRarityLegendary: + return UnmarshalUpgradedGiftAttributeRarityLegendary(data) + + case TypeUpgradedGiftModel: + return UnmarshalUpgradedGiftModel(data) + + case TypeUpgradedGiftSymbol: + return UnmarshalUpgradedGiftSymbol(data) + + case TypeUpgradedGiftBackdropColors: + return UnmarshalUpgradedGiftBackdropColors(data) + + case TypeUpgradedGiftBackdrop: + return UnmarshalUpgradedGiftBackdrop(data) + + case TypeUpgradedGiftOriginalDetails: + return UnmarshalUpgradedGiftOriginalDetails(data) + + case TypeUpgradedGiftColors: + return UnmarshalUpgradedGiftColors(data) + + case TypeGift: + return UnmarshalGift(data) + + case TypeUpgradedGift: + return UnmarshalUpgradedGift(data) + + case TypeUpgradedGiftValueInfo: + return UnmarshalUpgradedGiftValueInfo(data) + + case TypeUpgradeGiftResult: + return UnmarshalUpgradeGiftResult(data) + + case TypeCraftGiftResultSuccess: + return UnmarshalCraftGiftResultSuccess(data) + + case TypeCraftGiftResultTooEarly: + return UnmarshalCraftGiftResultTooEarly(data) + + case TypeCraftGiftResultInvalidGift: + return UnmarshalCraftGiftResultInvalidGift(data) + + case TypeCraftGiftResultFail: + return UnmarshalCraftGiftResultFail(data) + + case TypeAvailableGift: + return UnmarshalAvailableGift(data) + + case TypeAvailableGifts: + return UnmarshalAvailableGifts(data) + + case TypeGiftUpgradePrice: + return UnmarshalGiftUpgradePrice(data) + + case TypeUpgradedGiftAttributeIdModel: + return UnmarshalUpgradedGiftAttributeIdModel(data) + + case TypeUpgradedGiftAttributeIdSymbol: + return UnmarshalUpgradedGiftAttributeIdSymbol(data) + + case TypeUpgradedGiftAttributeIdBackdrop: + return UnmarshalUpgradedGiftAttributeIdBackdrop(data) + + case TypeUpgradedGiftModelCount: + return UnmarshalUpgradedGiftModelCount(data) + + case TypeUpgradedGiftSymbolCount: + return UnmarshalUpgradedGiftSymbolCount(data) + + case TypeUpgradedGiftBackdropCount: + return UnmarshalUpgradedGiftBackdropCount(data) + + case TypeGiftForResaleOrderPrice: + return UnmarshalGiftForResaleOrderPrice(data) + + case TypeGiftForResaleOrderPriceChangeDate: + return UnmarshalGiftForResaleOrderPriceChangeDate(data) + + case TypeGiftForResaleOrderNumber: + return UnmarshalGiftForResaleOrderNumber(data) + + case TypeGiftForResale: + return UnmarshalGiftForResale(data) + + case TypeGiftsForResale: + return UnmarshalGiftsForResale(data) + + case TypeGiftResaleResultOk: + return UnmarshalGiftResaleResultOk(data) + + case TypeGiftResaleResultPriceIncreased: + return UnmarshalGiftResaleResultPriceIncreased(data) + + case TypeSentGiftRegular: + return UnmarshalSentGiftRegular(data) + + case TypeSentGiftUpgraded: + return UnmarshalSentGiftUpgraded(data) + + case TypeReceivedGift: + return UnmarshalReceivedGift(data) + + case TypeReceivedGifts: + return UnmarshalReceivedGifts(data) + + case TypeAttributeCraftPersistenceProbability: + return UnmarshalAttributeCraftPersistenceProbability(data) + + case TypeGiftsForCrafting: + return UnmarshalGiftsForCrafting(data) + + case TypeGiftUpgradePreview: + return UnmarshalGiftUpgradePreview(data) + + case TypeGiftUpgradeVariants: + return UnmarshalGiftUpgradeVariants(data) + + case TypeAuctionBid: + return UnmarshalAuctionBid(data) + + case TypeUserAuctionBid: + return UnmarshalUserAuctionBid(data) + + case TypeAuctionRound: + return UnmarshalAuctionRound(data) + + case TypeAuctionStateActive: + return UnmarshalAuctionStateActive(data) + + case TypeAuctionStateFinished: + return UnmarshalAuctionStateFinished(data) + + case TypeGiftAuctionState: + return UnmarshalGiftAuctionState(data) + + case TypeGiftAuctionAcquiredGift: + return UnmarshalGiftAuctionAcquiredGift(data) + + case TypeGiftAuctionAcquiredGifts: + return UnmarshalGiftAuctionAcquiredGifts(data) + + case TypeTransactionDirectionIncoming: + return UnmarshalTransactionDirectionIncoming(data) + + case TypeTransactionDirectionOutgoing: + return UnmarshalTransactionDirectionOutgoing(data) + + case TypeStarTransactionTypePremiumBotDeposit: + return UnmarshalStarTransactionTypePremiumBotDeposit(data) + + case TypeStarTransactionTypeAppStoreDeposit: + return UnmarshalStarTransactionTypeAppStoreDeposit(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 TypeStarTransactionTypeGiftAuctionBid: + return UnmarshalStarTransactionTypeGiftAuctionBid(data) + + case TypeStarTransactionTypeGiftPurchase: + return UnmarshalStarTransactionTypeGiftPurchase(data) + + case TypeStarTransactionTypeGiftPurchaseOffer: + return UnmarshalStarTransactionTypeGiftPurchaseOffer(data) + + case TypeStarTransactionTypeGiftTransfer: + return UnmarshalStarTransactionTypeGiftTransfer(data) + + case TypeStarTransactionTypeGiftOriginalDetailsDrop: + return UnmarshalStarTransactionTypeGiftOriginalDetailsDrop(data) + + case TypeStarTransactionTypeGiftSale: + return UnmarshalStarTransactionTypeGiftSale(data) + + case TypeStarTransactionTypeGiftUpgrade: + return UnmarshalStarTransactionTypeGiftUpgrade(data) + + case TypeStarTransactionTypeGiftUpgradePurchase: + return UnmarshalStarTransactionTypeGiftUpgradePurchase(data) + + case TypeStarTransactionTypeUpgradedGiftPurchase: + return UnmarshalStarTransactionTypeUpgradedGiftPurchase(data) + + case TypeStarTransactionTypeUpgradedGiftSale: + return UnmarshalStarTransactionTypeUpgradedGiftSale(data) + + case TypeStarTransactionTypeChannelPaidReactionSend: + return UnmarshalStarTransactionTypeChannelPaidReactionSend(data) + + case TypeStarTransactionTypeChannelPaidReactionReceive: + return UnmarshalStarTransactionTypeChannelPaidReactionReceive(data) + + case TypeStarTransactionTypeAffiliateProgramCommission: + return UnmarshalStarTransactionTypeAffiliateProgramCommission(data) + + case TypeStarTransactionTypePaidMessageSend: + return UnmarshalStarTransactionTypePaidMessageSend(data) + + case TypeStarTransactionTypePaidMessageReceive: + return UnmarshalStarTransactionTypePaidMessageReceive(data) + + case TypeStarTransactionTypePaidGroupCallMessageSend: + return UnmarshalStarTransactionTypePaidGroupCallMessageSend(data) + + case TypeStarTransactionTypePaidGroupCallMessageReceive: + return UnmarshalStarTransactionTypePaidGroupCallMessageReceive(data) + + case TypeStarTransactionTypePaidGroupCallReactionSend: + return UnmarshalStarTransactionTypePaidGroupCallReactionSend(data) + + case TypeStarTransactionTypePaidGroupCallReactionReceive: + return UnmarshalStarTransactionTypePaidGroupCallReactionReceive(data) + + case TypeStarTransactionTypeSuggestedPostPaymentSend: + return UnmarshalStarTransactionTypeSuggestedPostPaymentSend(data) + + case TypeStarTransactionTypeSuggestedPostPaymentReceive: + return UnmarshalStarTransactionTypeSuggestedPostPaymentReceive(data) + + case TypeStarTransactionTypePremiumPurchase: + return UnmarshalStarTransactionTypePremiumPurchase(data) + + case TypeStarTransactionTypeBusinessBotTransferSend: + return UnmarshalStarTransactionTypeBusinessBotTransferSend(data) + + case TypeStarTransactionTypeBusinessBotTransferReceive: + return UnmarshalStarTransactionTypeBusinessBotTransferReceive(data) + + case TypeStarTransactionTypePublicPostSearch: + return UnmarshalStarTransactionTypePublicPostSearch(data) + + case TypeStarTransactionTypeUnsupported: + return UnmarshalStarTransactionTypeUnsupported(data) + + case TypeStarTransaction: + return UnmarshalStarTransaction(data) + + case TypeStarTransactions: + return UnmarshalStarTransactions(data) + + case TypeTonTransactionTypeFragmentDeposit: + return UnmarshalTonTransactionTypeFragmentDeposit(data) + + case TypeTonTransactionTypeFragmentWithdrawal: + return UnmarshalTonTransactionTypeFragmentWithdrawal(data) + + case TypeTonTransactionTypeSuggestedPostPayment: + return UnmarshalTonTransactionTypeSuggestedPostPayment(data) + + case TypeTonTransactionTypeGiftPurchaseOffer: + return UnmarshalTonTransactionTypeGiftPurchaseOffer(data) + + case TypeTonTransactionTypeUpgradedGiftPurchase: + return UnmarshalTonTransactionTypeUpgradedGiftPurchase(data) + + case TypeTonTransactionTypeUpgradedGiftSale: + return UnmarshalTonTransactionTypeUpgradedGiftSale(data) + + case TypeTonTransactionTypeStakeDiceStake: + return UnmarshalTonTransactionTypeStakeDiceStake(data) + + case TypeTonTransactionTypeStakeDicePayout: + return UnmarshalTonTransactionTypeStakeDicePayout(data) + + case TypeTonTransactionTypeUnsupported: + return UnmarshalTonTransactionTypeUnsupported(data) + + case TypeTonTransaction: + return UnmarshalTonTransaction(data) + + case TypeTonTransactions: + return UnmarshalTonTransactions(data) + + case TypeActiveStoryStateLive: + return UnmarshalActiveStoryStateLive(data) + + case TypeActiveStoryStateUnread: + return UnmarshalActiveStoryStateUnread(data) + + case TypeActiveStoryStateRead: + return UnmarshalActiveStoryStateRead(data) + + case TypeGiveawayParticipantStatusEligible: + return UnmarshalGiveawayParticipantStatusEligible(data) + + case TypeGiveawayParticipantStatusParticipating: + return UnmarshalGiveawayParticipantStatusParticipating(data) + + case TypeGiveawayParticipantStatusAlreadyWasMember: + return UnmarshalGiveawayParticipantStatusAlreadyWasMember(data) + + case TypeGiveawayParticipantStatusAdministrator: + return UnmarshalGiveawayParticipantStatusAdministrator(data) + + case TypeGiveawayParticipantStatusDisallowedCountry: + return UnmarshalGiveawayParticipantStatusDisallowedCountry(data) + + case TypeGiveawayInfoOngoing: + return UnmarshalGiveawayInfoOngoing(data) + + case TypeGiveawayInfoCompleted: + return UnmarshalGiveawayInfoCompleted(data) + + case TypeGiveawayPrizePremium: + return UnmarshalGiveawayPrizePremium(data) + + case TypeGiveawayPrizeStars: + return UnmarshalGiveawayPrizeStars(data) case TypeAccentColor: return UnmarshalAccentColor(data) + case TypeProfileAccentColors: + return UnmarshalProfileAccentColors(data) + + case TypeProfileAccentColor: + return UnmarshalProfileAccentColor(data) + + case TypeUserRating: + return UnmarshalUserRating(data) + + case TypeRestrictionInfo: + return UnmarshalRestrictionInfo(data) + + case TypeEmojiStatusTypeCustomEmoji: + return UnmarshalEmojiStatusTypeCustomEmoji(data) + + case TypeEmojiStatusTypeUpgradedGift: + return UnmarshalEmojiStatusTypeUpgradedGift(data) + case TypeEmojiStatus: return UnmarshalEmojiStatus(data) case TypeEmojiStatuses: return UnmarshalEmojiStatuses(data) + case TypeEmojiStatusCustomEmojis: + return UnmarshalEmojiStatusCustomEmojis(data) + case TypeUsernames: return UnmarshalUsernames(data) @@ -17643,6 +26850,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUsers: return UnmarshalUsers(data) + case TypeFoundUsers: + return UnmarshalFoundUsers(data) + case TypeChatAdministrator: return UnmarshalChatAdministrator(data) @@ -17745,6 +26955,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInviteLinkChatTypeChannel: return UnmarshalInviteLinkChatTypeChannel(data) + case TypeChatInviteLinkSubscriptionInfo: + return UnmarshalChatInviteLinkSubscriptionInfo(data) + case TypeChatInviteLinkInfo: return UnmarshalChatInviteLinkInfo(data) @@ -17781,6 +26994,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSecretChat: return UnmarshalSecretChat(data) + case TypePublicPostSearchLimits: + return UnmarshalPublicPostSearchLimits(data) + case TypeMessageSenderUser: return UnmarshalMessageSenderUser(data) @@ -17796,6 +27012,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatMessageSenders: return UnmarshalChatMessageSenders(data) + case TypeMessageReadDateRead: + return UnmarshalMessageReadDateRead(data) + + case TypeMessageReadDateUnread: + return UnmarshalMessageReadDateUnread(data) + + case TypeMessageReadDateTooOld: + return UnmarshalMessageReadDateTooOld(data) + + case TypeMessageReadDateUserPrivacyRestricted: + return UnmarshalMessageReadDateUserPrivacyRestricted(data) + + case TypeMessageReadDateMyPrivacyRestricted: + return UnmarshalMessageReadDateMyPrivacyRestricted(data) + case TypeMessageViewer: return UnmarshalMessageViewer(data) @@ -17814,12 +27045,33 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageOriginChannel: return UnmarshalMessageOriginChannel(data) + case TypeForwardSource: + return UnmarshalForwardSource(data) + case TypeReactionTypeEmoji: return UnmarshalReactionTypeEmoji(data) case TypeReactionTypeCustomEmoji: return UnmarshalReactionTypeCustomEmoji(data) + case TypeReactionTypePaid: + return UnmarshalReactionTypePaid(data) + + case TypePaidReactionTypeRegular: + return UnmarshalPaidReactionTypeRegular(data) + + case TypePaidReactionTypeAnonymous: + return UnmarshalPaidReactionTypeAnonymous(data) + + case TypePaidReactionTypeChat: + return UnmarshalPaidReactionTypeChat(data) + + case TypePaidReactor: + return UnmarshalPaidReactor(data) + + case TypeLiveStoryDonors: + return UnmarshalLiveStoryDonors(data) + case TypeMessageForwardInfo: return UnmarshalMessageForwardInfo(data) @@ -17832,18 +27084,48 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageReaction: return UnmarshalMessageReaction(data) + case TypeMessageReactions: + return UnmarshalMessageReactions(data) + case TypeMessageInteractionInfo: return UnmarshalMessageInteractionInfo(data) case TypeUnreadReaction: return UnmarshalUnreadReaction(data) + case TypeMessageTopicThread: + return UnmarshalMessageTopicThread(data) + + case TypeMessageTopicForum: + return UnmarshalMessageTopicForum(data) + + case TypeMessageTopicDirectMessages: + return UnmarshalMessageTopicDirectMessages(data) + + case TypeMessageTopicSavedMessages: + return UnmarshalMessageTopicSavedMessages(data) + + case TypeMessageEffectTypeEmojiReaction: + return UnmarshalMessageEffectTypeEmojiReaction(data) + + case TypeMessageEffectTypePremiumSticker: + return UnmarshalMessageEffectTypePremiumSticker(data) + + case TypeMessageEffect: + return UnmarshalMessageEffect(data) + case TypeMessageSendingStatePending: return UnmarshalMessageSendingStatePending(data) case TypeMessageSendingStateFailed: return UnmarshalMessageSendingStateFailed(data) + case TypeTextQuote: + return UnmarshalTextQuote(data) + + case TypeInputTextQuote: + return UnmarshalInputTextQuote(data) + case TypeMessageReplyToMessage: return UnmarshalMessageReplyToMessage(data) @@ -17853,9 +27135,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputMessageReplyToMessage: return UnmarshalInputMessageReplyToMessage(data) + case TypeInputMessageReplyToExternalMessage: + return UnmarshalInputMessageReplyToExternalMessage(data) + case TypeInputMessageReplyToStory: return UnmarshalInputMessageReplyToStory(data) + case TypeFactCheck: + return UnmarshalFactCheck(data) + case TypeMessage: return UnmarshalMessage(data) @@ -17868,6 +27156,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFoundChatMessages: return UnmarshalFoundChatMessages(data) + case TypeFoundPublicPosts: + return UnmarshalFoundPublicPosts(data) + case TypeMessagePosition: return UnmarshalMessagePosition(data) @@ -17880,6 +27171,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageCalendar: return UnmarshalMessageCalendar(data) + case TypeBusinessMessage: + return UnmarshalBusinessMessage(data) + + case TypeBusinessMessages: + return UnmarshalBusinessMessages(data) + case TypeMessageSourceChatHistory: return UnmarshalMessageSourceChatHistory(data) @@ -17889,6 +27186,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSourceForumTopicHistory: return UnmarshalMessageSourceForumTopicHistory(data) + case TypeMessageSourceDirectMessagesChatTopicHistory: + return UnmarshalMessageSourceDirectMessagesChatTopicHistory(data) + case TypeMessageSourceHistoryPreview: return UnmarshalMessageSourceHistoryPreview(data) @@ -17910,20 +27210,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSourceOther: return UnmarshalMessageSourceOther(data) - case TypeMessageSponsorTypeBot: - return UnmarshalMessageSponsorTypeBot(data) - - case TypeMessageSponsorTypePublicChannel: - return UnmarshalMessageSponsorTypePublicChannel(data) - - case TypeMessageSponsorTypePrivateChannel: - return UnmarshalMessageSponsorTypePrivateChannel(data) - - case TypeMessageSponsorTypeWebsite: - return UnmarshalMessageSponsorTypeWebsite(data) - - case TypeMessageSponsor: - return UnmarshalMessageSponsor(data) + case TypeAdvertisementSponsor: + return UnmarshalAdvertisementSponsor(data) case TypeSponsoredMessage: return UnmarshalSponsoredMessage(data) @@ -17931,6 +27219,36 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSponsoredMessages: return UnmarshalSponsoredMessages(data) + case TypeSponsoredChat: + return UnmarshalSponsoredChat(data) + + case TypeSponsoredChats: + return UnmarshalSponsoredChats(data) + + case TypeVideoMessageAdvertisement: + return UnmarshalVideoMessageAdvertisement(data) + + case TypeVideoMessageAdvertisements: + return UnmarshalVideoMessageAdvertisements(data) + + case TypeReportOption: + return UnmarshalReportOption(data) + + case TypeReportSponsoredResultOk: + return UnmarshalReportSponsoredResultOk(data) + + case TypeReportSponsoredResultFailed: + return UnmarshalReportSponsoredResultFailed(data) + + case TypeReportSponsoredResultOptionRequired: + return UnmarshalReportSponsoredResultOptionRequired(data) + + case TypeReportSponsoredResultAdsHidden: + return UnmarshalReportSponsoredResultAdsHidden(data) + + case TypeReportSponsoredResultPremiumRequired: + return UnmarshalReportSponsoredResultPremiumRequired(data) + case TypeFileDownload: return UnmarshalFileDownload(data) @@ -17955,6 +27273,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeScopeNotificationSettings: return UnmarshalScopeNotificationSettings(data) + case TypeReactionNotificationSourceNone: + return UnmarshalReactionNotificationSourceNone(data) + + case TypeReactionNotificationSourceContacts: + return UnmarshalReactionNotificationSourceContacts(data) + + case TypeReactionNotificationSourceAll: + return UnmarshalReactionNotificationSourceAll(data) + + case TypeReactionNotificationSettings: + return UnmarshalReactionNotificationSettings(data) + case TypeDraftMessage: return UnmarshalDraftMessage(data) @@ -17973,6 +27303,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatFolderIcon: return UnmarshalChatFolderIcon(data) + case TypeChatFolderName: + return UnmarshalChatFolderName(data) + case TypeChatFolder: return UnmarshalChatFolder(data) @@ -18024,6 +27357,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatAvailableReactionsSome: return UnmarshalChatAvailableReactionsSome(data) + case TypeSavedMessagesTag: + return UnmarshalSavedMessagesTag(data) + + case TypeSavedMessagesTags: + return UnmarshalSavedMessagesTags(data) + + case TypeBusinessBotManageBar: + return UnmarshalBusinessBotManageBar(data) + case TypeVideoChat: return UnmarshalVideoChat(data) @@ -18033,11 +27375,14 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChats: return UnmarshalChats(data) - case TypeChatNearby: - return UnmarshalChatNearby(data) + case TypeFailedToAddMember: + return UnmarshalFailedToAddMember(data) - case TypeChatsNearby: - return UnmarshalChatsNearby(data) + case TypeFailedToAddMembers: + return UnmarshalFailedToAddMembers(data) + + case TypeCreatedBasicGroupChat: + return UnmarshalCreatedBasicGroupChat(data) case TypePublicChatTypeHasUsername: return UnmarshalPublicChatTypeHasUsername(data) @@ -18045,12 +27390,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePublicChatTypeIsLocationBased: return UnmarshalPublicChatTypeIsLocationBased(data) + case TypeAccountInfo: + return UnmarshalAccountInfo(data) + case TypeChatActionBarReportSpam: return UnmarshalChatActionBarReportSpam(data) - case TypeChatActionBarReportUnrelatedLocation: - return UnmarshalChatActionBarReportUnrelatedLocation(data) - case TypeChatActionBarInviteMembers: return UnmarshalChatActionBarInviteMembers(data) @@ -18066,6 +27411,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatActionBarJoinRequest: return UnmarshalChatActionBarJoinRequest(data) + case TypeButtonStyleDefault: + return UnmarshalButtonStyleDefault(data) + + case TypeButtonStylePrimary: + return UnmarshalButtonStylePrimary(data) + + case TypeButtonStyleDanger: + return UnmarshalButtonStyleDanger(data) + + case TypeButtonStyleSuccess: + return UnmarshalButtonStyleSuccess(data) + case TypeKeyboardButtonTypeText: return UnmarshalKeyboardButtonTypeText(data) @@ -18078,8 +27435,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeKeyboardButtonTypeRequestPoll: return UnmarshalKeyboardButtonTypeRequestPoll(data) - case TypeKeyboardButtonTypeRequestUser: - return UnmarshalKeyboardButtonTypeRequestUser(data) + case TypeKeyboardButtonTypeRequestUsers: + return UnmarshalKeyboardButtonTypeRequestUsers(data) case TypeKeyboardButtonTypeRequestChat: return UnmarshalKeyboardButtonTypeRequestChat(data) @@ -18117,6 +27474,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInlineKeyboardButtonTypeUser: return UnmarshalInlineKeyboardButtonTypeUser(data) + case TypeInlineKeyboardButtonTypeCopyText: + return UnmarshalInlineKeyboardButtonTypeCopyText(data) + case TypeInlineKeyboardButton: return UnmarshalInlineKeyboardButton(data) @@ -18138,15 +27498,48 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLoginUrlInfoRequestConfirmation: return UnmarshalLoginUrlInfoRequestConfirmation(data) + case TypeThemeParameters: + return UnmarshalThemeParameters(data) + + case TypeWebAppOpenModeCompact: + return UnmarshalWebAppOpenModeCompact(data) + + case TypeWebAppOpenModeFullSize: + return UnmarshalWebAppOpenModeFullSize(data) + + case TypeWebAppOpenModeFullScreen: + return UnmarshalWebAppOpenModeFullScreen(data) + case TypeFoundWebApp: return UnmarshalFoundWebApp(data) case TypeWebAppInfo: return UnmarshalWebAppInfo(data) + case TypeMainWebApp: + return UnmarshalMainWebApp(data) + + case TypeWebAppOpenParameters: + return UnmarshalWebAppOpenParameters(data) + case TypeMessageThreadInfo: return UnmarshalMessageThreadInfo(data) + case TypeSavedMessagesTopicTypeMyNotes: + return UnmarshalSavedMessagesTopicTypeMyNotes(data) + + case TypeSavedMessagesTopicTypeAuthorHidden: + return UnmarshalSavedMessagesTopicTypeAuthorHidden(data) + + case TypeSavedMessagesTopicTypeSavedFromChat: + return UnmarshalSavedMessagesTopicTypeSavedFromChat(data) + + case TypeSavedMessagesTopic: + return UnmarshalSavedMessagesTopic(data) + + case TypeDirectMessagesChatTopic: + return UnmarshalDirectMessagesChatTopic(data) + case TypeForumTopicIcon: return UnmarshalForumTopicIcon(data) @@ -18162,6 +27555,30 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLinkPreviewOptions: return UnmarshalLinkPreviewOptions(data) + case TypeSharedUser: + return UnmarshalSharedUser(data) + + case TypeSharedChat: + return UnmarshalSharedChat(data) + + case TypeBuiltInThemeClassic: + return UnmarshalBuiltInThemeClassic(data) + + case TypeBuiltInThemeDay: + return UnmarshalBuiltInThemeDay(data) + + case TypeBuiltInThemeNight: + return UnmarshalBuiltInThemeNight(data) + + case TypeBuiltInThemeTinted: + return UnmarshalBuiltInThemeTinted(data) + + case TypeBuiltInThemeArctic: + return UnmarshalBuiltInThemeArctic(data) + + case TypeThemeSettings: + return UnmarshalThemeSettings(data) + case TypeRichTextPlain: return UnmarshalRichTextPlain(data) @@ -18333,8 +27750,128 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeWebPageInstantView: return UnmarshalWebPageInstantView(data) - case TypeWebPage: - return UnmarshalWebPage(data) + case TypeLinkPreviewAlbumMediaPhoto: + return UnmarshalLinkPreviewAlbumMediaPhoto(data) + + case TypeLinkPreviewAlbumMediaVideo: + return UnmarshalLinkPreviewAlbumMediaVideo(data) + + case TypeLinkPreviewTypeAlbum: + return UnmarshalLinkPreviewTypeAlbum(data) + + case TypeLinkPreviewTypeAnimation: + return UnmarshalLinkPreviewTypeAnimation(data) + + case TypeLinkPreviewTypeApp: + return UnmarshalLinkPreviewTypeApp(data) + + case TypeLinkPreviewTypeArticle: + return UnmarshalLinkPreviewTypeArticle(data) + + case TypeLinkPreviewTypeAudio: + return UnmarshalLinkPreviewTypeAudio(data) + + case TypeLinkPreviewTypeBackground: + return UnmarshalLinkPreviewTypeBackground(data) + + case TypeLinkPreviewTypeChannelBoost: + return UnmarshalLinkPreviewTypeChannelBoost(data) + + case TypeLinkPreviewTypeChat: + return UnmarshalLinkPreviewTypeChat(data) + + case TypeLinkPreviewTypeDirectMessagesChat: + return UnmarshalLinkPreviewTypeDirectMessagesChat(data) + + case TypeLinkPreviewTypeDocument: + return UnmarshalLinkPreviewTypeDocument(data) + + case TypeLinkPreviewTypeEmbeddedAnimationPlayer: + return UnmarshalLinkPreviewTypeEmbeddedAnimationPlayer(data) + + case TypeLinkPreviewTypeEmbeddedAudioPlayer: + return UnmarshalLinkPreviewTypeEmbeddedAudioPlayer(data) + + case TypeLinkPreviewTypeEmbeddedVideoPlayer: + return UnmarshalLinkPreviewTypeEmbeddedVideoPlayer(data) + + case TypeLinkPreviewTypeExternalAudio: + return UnmarshalLinkPreviewTypeExternalAudio(data) + + case TypeLinkPreviewTypeExternalVideo: + return UnmarshalLinkPreviewTypeExternalVideo(data) + + case TypeLinkPreviewTypeGiftAuction: + return UnmarshalLinkPreviewTypeGiftAuction(data) + + case TypeLinkPreviewTypeGiftCollection: + return UnmarshalLinkPreviewTypeGiftCollection(data) + + case TypeLinkPreviewTypeGroupCall: + return UnmarshalLinkPreviewTypeGroupCall(data) + + case TypeLinkPreviewTypeInvoice: + return UnmarshalLinkPreviewTypeInvoice(data) + + case TypeLinkPreviewTypeLiveStory: + return UnmarshalLinkPreviewTypeLiveStory(data) + + case TypeLinkPreviewTypeMessage: + return UnmarshalLinkPreviewTypeMessage(data) + + case TypeLinkPreviewTypePhoto: + return UnmarshalLinkPreviewTypePhoto(data) + + case TypeLinkPreviewTypePremiumGiftCode: + return UnmarshalLinkPreviewTypePremiumGiftCode(data) + + case TypeLinkPreviewTypeShareableChatFolder: + return UnmarshalLinkPreviewTypeShareableChatFolder(data) + + case TypeLinkPreviewTypeSticker: + return UnmarshalLinkPreviewTypeSticker(data) + + case TypeLinkPreviewTypeStickerSet: + return UnmarshalLinkPreviewTypeStickerSet(data) + + case TypeLinkPreviewTypeStory: + return UnmarshalLinkPreviewTypeStory(data) + + case TypeLinkPreviewTypeStoryAlbum: + return UnmarshalLinkPreviewTypeStoryAlbum(data) + + case TypeLinkPreviewTypeSupergroupBoost: + return UnmarshalLinkPreviewTypeSupergroupBoost(data) + + case TypeLinkPreviewTypeTheme: + return UnmarshalLinkPreviewTypeTheme(data) + + case TypeLinkPreviewTypeUnsupported: + return UnmarshalLinkPreviewTypeUnsupported(data) + + case TypeLinkPreviewTypeUpgradedGift: + return UnmarshalLinkPreviewTypeUpgradedGift(data) + + case TypeLinkPreviewTypeUser: + return UnmarshalLinkPreviewTypeUser(data) + + case TypeLinkPreviewTypeVideo: + return UnmarshalLinkPreviewTypeVideo(data) + + case TypeLinkPreviewTypeVideoChat: + return UnmarshalLinkPreviewTypeVideoChat(data) + + case TypeLinkPreviewTypeVideoNote: + return UnmarshalLinkPreviewTypeVideoNote(data) + + case TypeLinkPreviewTypeVoiceNote: + return UnmarshalLinkPreviewTypeVoiceNote(data) + + case TypeLinkPreviewTypeWebApp: + return UnmarshalLinkPreviewTypeWebApp(data) + + case TypeLinkPreview: + return UnmarshalLinkPreview(data) case TypeCountryInfo: return UnmarshalCountryInfo(data) @@ -18345,6 +27882,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePhoneNumberInfo: return UnmarshalPhoneNumberInfo(data) + case TypeCollectibleItemTypeUsername: + return UnmarshalCollectibleItemTypeUsername(data) + + case TypeCollectibleItemTypePhoneNumber: + return UnmarshalCollectibleItemTypePhoneNumber(data) + + case TypeCollectibleItemInfo: + return UnmarshalCollectibleItemInfo(data) + case TypeBankCardActionOpenUrl: return UnmarshalBankCardActionOpenUrl(data) @@ -18354,8 +27900,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAddress: return UnmarshalAddress(data) - case TypeThemeParameters: - return UnmarshalThemeParameters(data) + case TypeLocationAddress: + return UnmarshalLocationAddress(data) case TypeLabeledPricePart: return UnmarshalLabeledPricePart(data) @@ -18396,6 +27942,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePaymentOption: return UnmarshalPaymentOption(data) + case TypePaymentFormTypeRegular: + return UnmarshalPaymentFormTypeRegular(data) + + case TypePaymentFormTypeStars: + return UnmarshalPaymentFormTypeStars(data) + + case TypePaymentFormTypeStarSubscription: + return UnmarshalPaymentFormTypeStarSubscription(data) + case TypePaymentForm: return UnmarshalPaymentForm(data) @@ -18405,6 +27960,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePaymentResult: return UnmarshalPaymentResult(data) + case TypePaymentReceiptTypeRegular: + return UnmarshalPaymentReceiptTypeRegular(data) + + case TypePaymentReceiptTypeStars: + return UnmarshalPaymentReceiptTypeStars(data) + case TypePaymentReceipt: return UnmarshalPaymentReceipt(data) @@ -18417,20 +27978,20 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputInvoiceTelegram: return UnmarshalInputInvoiceTelegram(data) - case TypeMessageExtendedMediaPreview: - return UnmarshalMessageExtendedMediaPreview(data) + case TypePaidMediaPreview: + return UnmarshalPaidMediaPreview(data) - case TypeMessageExtendedMediaPhoto: - return UnmarshalMessageExtendedMediaPhoto(data) + case TypePaidMediaPhoto: + return UnmarshalPaidMediaPhoto(data) - case TypeMessageExtendedMediaVideo: - return UnmarshalMessageExtendedMediaVideo(data) + case TypePaidMediaVideo: + return UnmarshalPaidMediaVideo(data) - case TypeMessageExtendedMediaUnsupported: - return UnmarshalMessageExtendedMediaUnsupported(data) + case TypePaidMediaUnsupported: + return UnmarshalPaidMediaUnsupported(data) - case TypePremiumGiveawayParameters: - return UnmarshalPremiumGiveawayParameters(data) + case TypeGiveawayParameters: + return UnmarshalGiveawayParameters(data) case TypeDatedFile: return UnmarshalDatedFile(data) @@ -18663,27 +28224,36 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageDocument: return UnmarshalMessageDocument(data) + case TypeMessagePaidMedia: + return UnmarshalMessagePaidMedia(data) + case TypeMessagePhoto: return UnmarshalMessagePhoto(data) - case TypeMessageExpiredPhoto: - return UnmarshalMessageExpiredPhoto(data) - case TypeMessageSticker: return UnmarshalMessageSticker(data) case TypeMessageVideo: return UnmarshalMessageVideo(data) - case TypeMessageExpiredVideo: - return UnmarshalMessageExpiredVideo(data) - case TypeMessageVideoNote: return UnmarshalMessageVideoNote(data) case TypeMessageVoiceNote: return UnmarshalMessageVoiceNote(data) + case TypeMessageExpiredPhoto: + return UnmarshalMessageExpiredPhoto(data) + + case TypeMessageExpiredVideo: + return UnmarshalMessageExpiredVideo(data) + + case TypeMessageExpiredVideoNote: + return UnmarshalMessageExpiredVideoNote(data) + + case TypeMessageExpiredVoiceNote: + return UnmarshalMessageExpiredVoiceNote(data) + case TypeMessageLocation: return UnmarshalMessageLocation(data) @@ -18705,15 +28275,24 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessagePoll: return UnmarshalMessagePoll(data) + case TypeMessageStakeDice: + return UnmarshalMessageStakeDice(data) + case TypeMessageStory: return UnmarshalMessageStory(data) + case TypeMessageChecklist: + return UnmarshalMessageChecklist(data) + case TypeMessageInvoice: return UnmarshalMessageInvoice(data) case TypeMessageCall: return UnmarshalMessageCall(data) + case TypeMessageGroupCall: + return UnmarshalMessageGroupCall(data) + case TypeMessageVideoChatScheduled: return UnmarshalMessageVideoChatScheduled(data) @@ -18741,6 +28320,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageChatDeletePhoto: return UnmarshalMessageChatDeletePhoto(data) + case TypeMessageChatOwnerLeft: + return UnmarshalMessageChatOwnerLeft(data) + + case TypeMessageChatOwnerChanged: + return UnmarshalMessageChatOwnerChanged(data) + case TypeMessageChatAddMembers: return UnmarshalMessageChatAddMembers(data) @@ -18774,6 +28359,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageChatSetMessageAutoDeleteTime: return UnmarshalMessageChatSetMessageAutoDeleteTime(data) + case TypeMessageChatBoost: + return UnmarshalMessageChatBoost(data) + case TypeMessageForumTopicCreated: return UnmarshalMessageForumTopicCreated(data) @@ -18789,6 +28377,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageSuggestProfilePhoto: return UnmarshalMessageSuggestProfilePhoto(data) + case TypeMessageSuggestBirthdate: + return UnmarshalMessageSuggestBirthdate(data) + case TypeMessageCustomServiceAction: return UnmarshalMessageCustomServiceAction(data) @@ -18801,23 +28392,86 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessagePaymentSuccessfulBot: return UnmarshalMessagePaymentSuccessfulBot(data) + case TypeMessagePaymentRefunded: + return UnmarshalMessagePaymentRefunded(data) + case TypeMessageGiftedPremium: return UnmarshalMessageGiftedPremium(data) case TypeMessagePremiumGiftCode: return UnmarshalMessagePremiumGiftCode(data) - case TypeMessagePremiumGiveawayCreated: - return UnmarshalMessagePremiumGiveawayCreated(data) + case TypeMessageGiveawayCreated: + return UnmarshalMessageGiveawayCreated(data) - case TypeMessagePremiumGiveaway: - return UnmarshalMessagePremiumGiveaway(data) + case TypeMessageGiveaway: + return UnmarshalMessageGiveaway(data) + + case TypeMessageGiveawayCompleted: + return UnmarshalMessageGiveawayCompleted(data) + + case TypeMessageGiveawayWinners: + return UnmarshalMessageGiveawayWinners(data) + + case TypeMessageGiftedStars: + return UnmarshalMessageGiftedStars(data) + + case TypeMessageGiftedTon: + return UnmarshalMessageGiftedTon(data) + + case TypeMessageGiveawayPrizeStars: + return UnmarshalMessageGiveawayPrizeStars(data) + + case TypeMessageGift: + return UnmarshalMessageGift(data) + + case TypeMessageUpgradedGift: + return UnmarshalMessageUpgradedGift(data) + + case TypeMessageRefundedUpgradedGift: + return UnmarshalMessageRefundedUpgradedGift(data) + + case TypeMessageUpgradedGiftPurchaseOffer: + return UnmarshalMessageUpgradedGiftPurchaseOffer(data) + + case TypeMessageUpgradedGiftPurchaseOfferRejected: + return UnmarshalMessageUpgradedGiftPurchaseOfferRejected(data) + + case TypeMessagePaidMessagesRefunded: + return UnmarshalMessagePaidMessagesRefunded(data) + + case TypeMessagePaidMessagePriceChanged: + return UnmarshalMessagePaidMessagePriceChanged(data) + + case TypeMessageDirectMessagePriceChanged: + return UnmarshalMessageDirectMessagePriceChanged(data) + + case TypeMessageChecklistTasksDone: + return UnmarshalMessageChecklistTasksDone(data) + + case TypeMessageChecklistTasksAdded: + return UnmarshalMessageChecklistTasksAdded(data) + + case TypeMessageSuggestedPostApprovalFailed: + return UnmarshalMessageSuggestedPostApprovalFailed(data) + + case TypeMessageSuggestedPostApproved: + return UnmarshalMessageSuggestedPostApproved(data) + + case TypeMessageSuggestedPostDeclined: + return UnmarshalMessageSuggestedPostDeclined(data) + + case TypeMessageSuggestedPostPaid: + return UnmarshalMessageSuggestedPostPaid(data) + + case TypeMessageSuggestedPostRefunded: + return UnmarshalMessageSuggestedPostRefunded(data) case TypeMessageContactRegistered: return UnmarshalMessageContactRegistered(data) - case TypeMessageUserShared: - return UnmarshalMessageUserShared(data) + case TypeMessageUsersShared: + return UnmarshalMessageUsersShared(data) case TypeMessageChatShared: return UnmarshalMessageChatShared(data) @@ -18894,6 +28548,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTextEntityTypeBlockQuote: return UnmarshalTextEntityTypeBlockQuote(data) + case TypeTextEntityTypeExpandableBlockQuote: + return UnmarshalTextEntityTypeExpandableBlockQuote(data) + case TypeTextEntityTypeTextUrl: return UnmarshalTextEntityTypeTextUrl(data) @@ -18909,12 +28566,24 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputThumbnail: return UnmarshalInputThumbnail(data) + case TypeInputPaidMediaTypePhoto: + return UnmarshalInputPaidMediaTypePhoto(data) + + case TypeInputPaidMediaTypeVideo: + return UnmarshalInputPaidMediaTypeVideo(data) + + case TypeInputPaidMedia: + return UnmarshalInputPaidMedia(data) + case TypeMessageSchedulingStateSendAtDate: return UnmarshalMessageSchedulingStateSendAtDate(data) case TypeMessageSchedulingStateSendWhenOnline: return UnmarshalMessageSchedulingStateSendWhenOnline(data) + case TypeMessageSchedulingStateSendWhenVideoProcessed: + return UnmarshalMessageSchedulingStateSendWhenVideoProcessed(data) + case TypeMessageSelfDestructTypeTimer: return UnmarshalMessageSelfDestructTypeTimer(data) @@ -18939,6 +28608,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputMessageDocument: return UnmarshalInputMessageDocument(data) + case TypeInputMessagePaidMedia: + return UnmarshalInputMessagePaidMedia(data) + case TypeInputMessagePhoto: return UnmarshalInputMessagePhoto(data) @@ -18975,12 +28647,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputMessagePoll: return UnmarshalInputMessagePoll(data) + case TypeInputMessageStakeDice: + return UnmarshalInputMessageStakeDice(data) + case TypeInputMessageStory: return UnmarshalInputMessageStory(data) + case TypeInputMessageChecklist: + return UnmarshalInputMessageChecklist(data) + case TypeInputMessageForwarded: return UnmarshalInputMessageForwarded(data) + case TypeMessageProperties: + return UnmarshalMessageProperties(data) + case TypeSearchMessagesFilterEmpty: return UnmarshalSearchMessagesFilterEmpty(data) @@ -19032,6 +28713,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSearchMessagesFilterPinned: return UnmarshalSearchMessagesFilterPinned(data) + case TypeSearchMessagesChatTypeFilterPrivate: + return UnmarshalSearchMessagesChatTypeFilterPrivate(data) + + case TypeSearchMessagesChatTypeFilterGroup: + return UnmarshalSearchMessagesChatTypeFilterGroup(data) + + case TypeSearchMessagesChatTypeFilterChannel: + return UnmarshalSearchMessagesChatTypeFilterChannel(data) + case TypeChatActionTyping: return UnmarshalChatActionTyping(data) @@ -19095,6 +28785,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserStatusLastMonth: return UnmarshalUserStatusLastMonth(data) + case TypeEmojiKeyword: + return UnmarshalEmojiKeyword(data) + + case TypeEmojiKeywords: + return UnmarshalEmojiKeywords(data) + case TypeStickers: return UnmarshalStickers(data) @@ -19113,6 +28809,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTrendingStickerSets: return UnmarshalTrendingStickerSets(data) + case TypeEmojiCategorySourceSearch: + return UnmarshalEmojiCategorySourceSearch(data) + + case TypeEmojiCategorySourcePremium: + return UnmarshalEmojiCategorySourcePremium(data) + case TypeEmojiCategory: return UnmarshalEmojiCategory(data) @@ -19122,17 +28824,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeEmojiCategoryTypeDefault: return UnmarshalEmojiCategoryTypeDefault(data) + case TypeEmojiCategoryTypeRegularStickers: + return UnmarshalEmojiCategoryTypeRegularStickers(data) + case TypeEmojiCategoryTypeEmojiStatus: return UnmarshalEmojiCategoryTypeEmojiStatus(data) case TypeEmojiCategoryTypeChatPhoto: return UnmarshalEmojiCategoryTypeChatPhoto(data) - case TypeStoryViewer: - return UnmarshalStoryViewer(data) - - case TypeStoryViewers: - return UnmarshalStoryViewers(data) + case TypeCurrentWeather: + return UnmarshalCurrentWeather(data) case TypeStoryAreaPosition: return UnmarshalStoryAreaPosition(data) @@ -19146,6 +28848,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryAreaTypeSuggestedReaction: return UnmarshalStoryAreaTypeSuggestedReaction(data) + case TypeStoryAreaTypeMessage: + return UnmarshalStoryAreaTypeMessage(data) + + case TypeStoryAreaTypeLink: + return UnmarshalStoryAreaTypeLink(data) + + case TypeStoryAreaTypeWeather: + return UnmarshalStoryAreaTypeWeather(data) + + case TypeStoryAreaTypeUpgradedGift: + return UnmarshalStoryAreaTypeUpgradedGift(data) + case TypeStoryArea: return UnmarshalStoryArea(data) @@ -19161,6 +28875,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputStoryAreaTypeSuggestedReaction: return UnmarshalInputStoryAreaTypeSuggestedReaction(data) + case TypeInputStoryAreaTypeMessage: + return UnmarshalInputStoryAreaTypeMessage(data) + + case TypeInputStoryAreaTypeLink: + return UnmarshalInputStoryAreaTypeLink(data) + + case TypeInputStoryAreaTypeWeather: + return UnmarshalInputStoryAreaTypeWeather(data) + + case TypeInputStoryAreaTypeUpgradedGift: + return UnmarshalInputStoryAreaTypeUpgradedGift(data) + case TypeInputStoryArea: return UnmarshalInputStoryArea(data) @@ -19170,12 +28896,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryVideo: return UnmarshalStoryVideo(data) + case TypeStoryContentTypePhoto: + return UnmarshalStoryContentTypePhoto(data) + + case TypeStoryContentTypeVideo: + return UnmarshalStoryContentTypeVideo(data) + + case TypeStoryContentTypeLive: + return UnmarshalStoryContentTypeLive(data) + + case TypeStoryContentTypeUnsupported: + return UnmarshalStoryContentTypeUnsupported(data) + case TypeStoryContentPhoto: return UnmarshalStoryContentPhoto(data) case TypeStoryContentVideo: return UnmarshalStoryContentVideo(data) + case TypeStoryContentLive: + return UnmarshalStoryContentLive(data) + case TypeStoryContentUnsupported: return UnmarshalStoryContentUnsupported(data) @@ -19191,6 +28932,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStoryListArchive: return UnmarshalStoryListArchive(data) + case TypeStoryOriginPublicStory: + return UnmarshalStoryOriginPublicStory(data) + + case TypeStoryOriginHiddenUser: + return UnmarshalStoryOriginHiddenUser(data) + + case TypeStoryRepostInfo: + return UnmarshalStoryRepostInfo(data) + case TypeStoryInteractionInfo: return UnmarshalStoryInteractionInfo(data) @@ -19200,12 +28950,72 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStories: return UnmarshalStories(data) + case TypeFoundStories: + return UnmarshalFoundStories(data) + + case TypeStoryAlbum: + return UnmarshalStoryAlbum(data) + + case TypeStoryAlbums: + return UnmarshalStoryAlbums(data) + + case TypeStoryFullId: + return UnmarshalStoryFullId(data) + case TypeStoryInfo: return UnmarshalStoryInfo(data) case TypeChatActiveStories: return UnmarshalChatActiveStories(data) + case TypeStoryInteractionTypeView: + return UnmarshalStoryInteractionTypeView(data) + + case TypeStoryInteractionTypeForward: + return UnmarshalStoryInteractionTypeForward(data) + + case TypeStoryInteractionTypeRepost: + return UnmarshalStoryInteractionTypeRepost(data) + + case TypeStoryInteraction: + return UnmarshalStoryInteraction(data) + + case TypeStoryInteractions: + return UnmarshalStoryInteractions(data) + + case TypeQuickReplyMessage: + return UnmarshalQuickReplyMessage(data) + + case TypeQuickReplyMessages: + return UnmarshalQuickReplyMessages(data) + + case TypeQuickReplyShortcut: + return UnmarshalQuickReplyShortcut(data) + + case TypePublicForwardMessage: + return UnmarshalPublicForwardMessage(data) + + case TypePublicForwardStory: + return UnmarshalPublicForwardStory(data) + + case TypePublicForwards: + return UnmarshalPublicForwards(data) + + case TypeBotMediaPreview: + return UnmarshalBotMediaPreview(data) + + case TypeBotMediaPreviews: + return UnmarshalBotMediaPreviews(data) + + case TypeBotMediaPreviewInfo: + return UnmarshalBotMediaPreviewInfo(data) + + case TypeChatBoostLevelFeatures: + return UnmarshalChatBoostLevelFeatures(data) + + case TypeChatBoostFeatures: + return UnmarshalChatBoostFeatures(data) + case TypeChatBoostSourceGiftCode: return UnmarshalChatBoostSourceGiftCode(data) @@ -19215,8 +29025,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatBoostSourcePremium: return UnmarshalChatBoostSourcePremium(data) - case TypePrepaidPremiumGiveaway: - return UnmarshalPrepaidPremiumGiveaway(data) + case TypePrepaidGiveaway: + return UnmarshalPrepaidGiveaway(data) case TypeChatBoostStatus: return UnmarshalChatBoostStatus(data) @@ -19233,6 +29043,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatBoostSlots: return UnmarshalChatBoostSlots(data) + case TypeResendCodeReasonUserRequest: + return UnmarshalResendCodeReasonUserRequest(data) + + case TypeResendCodeReasonVerificationFailed: + return UnmarshalResendCodeReasonVerificationFailed(data) + case TypeCallDiscardReasonEmpty: return UnmarshalCallDiscardReasonEmpty(data) @@ -19248,6 +29064,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCallDiscardReasonHungUp: return UnmarshalCallDiscardReasonHungUp(data) + case TypeCallDiscardReasonUpgradeToGroupCall: + return UnmarshalCallDiscardReasonUpgradeToGroupCall(data) + case TypeCallProtocol: return UnmarshalCallProtocol(data) @@ -19284,6 +29103,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCallStateError: return UnmarshalCallStateError(data) + case TypeGroupCallJoinParameters: + return UnmarshalGroupCallJoinParameters(data) + case TypeGroupCallVideoQualityThumbnail: return UnmarshalGroupCallVideoQualityThumbnail(data) @@ -19317,6 +29139,42 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGroupCallParticipant: return UnmarshalGroupCallParticipant(data) + case TypeGroupCallParticipants: + return UnmarshalGroupCallParticipants(data) + + case TypeGroupCallInfo: + return UnmarshalGroupCallInfo(data) + + case TypeGroupCallMessage: + return UnmarshalGroupCallMessage(data) + + case TypeGroupCallMessageLevel: + return UnmarshalGroupCallMessageLevel(data) + + case TypeInviteGroupCallParticipantResultUserPrivacyRestricted: + return UnmarshalInviteGroupCallParticipantResultUserPrivacyRestricted(data) + + case TypeInviteGroupCallParticipantResultUserAlreadyParticipant: + return UnmarshalInviteGroupCallParticipantResultUserAlreadyParticipant(data) + + case TypeInviteGroupCallParticipantResultUserWasBanned: + return UnmarshalInviteGroupCallParticipantResultUserWasBanned(data) + + case TypeInviteGroupCallParticipantResultSuccess: + return UnmarshalInviteGroupCallParticipantResultSuccess(data) + + case TypeGroupCallDataChannelMain: + return UnmarshalGroupCallDataChannelMain(data) + + case TypeGroupCallDataChannelScreenSharing: + return UnmarshalGroupCallDataChannelScreenSharing(data) + + case TypeInputGroupCallLink: + return UnmarshalInputGroupCallLink(data) + + case TypeInputGroupCallMessage: + return UnmarshalInputGroupCallMessage(data) + case TypeCallProblemEcho: return UnmarshalCallProblemEcho(data) @@ -19371,6 +29229,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeEmojiReaction: return UnmarshalEmojiReaction(data) + case TypeReactionUnavailabilityReasonAnonymousAdministrator: + return UnmarshalReactionUnavailabilityReasonAnonymousAdministrator(data) + + case TypeReactionUnavailabilityReasonGuest: + return UnmarshalReactionUnavailabilityReasonGuest(data) + case TypeAnimations: return UnmarshalAnimations(data) @@ -19380,6 +29244,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeDiceStickersSlotMachine: return UnmarshalDiceStickersSlotMachine(data) + case TypeImportedContact: + return UnmarshalImportedContact(data) + case TypeImportedContacts: return UnmarshalImportedContacts(data) @@ -19392,6 +29259,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSpeechRecognitionResultError: return UnmarshalSpeechRecognitionResultError(data) + case TypeBusinessConnection: + return UnmarshalBusinessConnection(data) + case TypeAttachmentMenuBotColor: return UnmarshalAttachmentMenuBotColor(data) @@ -19419,6 +29289,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserLink: return UnmarshalUserLink(data) + case TypeTargetChatTypes: + return UnmarshalTargetChatTypes(data) + + case TypeTargetChatCurrent: + return UnmarshalTargetChatCurrent(data) + + case TypeTargetChatChosen: + return UnmarshalTargetChatChosen(data) + + case TypeTargetChatInternalLink: + return UnmarshalTargetChatInternalLink(data) + case TypeInputInlineQueryResultAnimation: return UnmarshalInputInlineQueryResultAnimation(data) @@ -19503,6 +29385,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInlineQueryResults: return UnmarshalInlineQueryResults(data) + case TypePreparedInlineMessageId: + return UnmarshalPreparedInlineMessageId(data) + + case TypePreparedInlineMessage: + return UnmarshalPreparedInlineMessage(data) + case TypeCallbackQueryPayloadData: return UnmarshalCallbackQueryPayloadData(data) @@ -19560,12 +29448,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventMemberRestricted: return UnmarshalChatEventMemberRestricted(data) + case TypeChatEventMemberSubscriptionExtended: + return UnmarshalChatEventMemberSubscriptionExtended(data) + case TypeChatEventAvailableReactionsChanged: return UnmarshalChatEventAvailableReactionsChanged(data) + case TypeChatEventBackgroundChanged: + return UnmarshalChatEventBackgroundChanged(data) + case TypeChatEventDescriptionChanged: return UnmarshalChatEventDescriptionChanged(data) + case TypeChatEventEmojiStatusChanged: + return UnmarshalChatEventEmojiStatusChanged(data) + case TypeChatEventLinkedChatChanged: return UnmarshalChatEventLinkedChatChanged(data) @@ -19587,6 +29484,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventStickerSetChanged: return UnmarshalChatEventStickerSetChanged(data) + case TypeChatEventCustomEmojiStickerSetChanged: + return UnmarshalChatEventCustomEmojiStickerSetChanged(data) + case TypeChatEventTitleChanged: return UnmarshalChatEventTitleChanged(data) @@ -19599,8 +29499,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventAccentColorChanged: return UnmarshalChatEventAccentColorChanged(data) - case TypeChatEventBackgroundCustomEmojiChanged: - return UnmarshalChatEventBackgroundCustomEmojiChanged(data) + case TypeChatEventProfileAccentColorChanged: + return UnmarshalChatEventProfileAccentColorChanged(data) case TypeChatEventHasProtectedContentToggled: return UnmarshalChatEventHasProtectedContentToggled(data) @@ -19617,6 +29517,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventSignMessagesToggled: return UnmarshalChatEventSignMessagesToggled(data) + case TypeChatEventShowMessageSenderToggled: + return UnmarshalChatEventShowMessageSenderToggled(data) + + case TypeChatEventAutomaticTranslationToggled: + return UnmarshalChatEventAutomaticTranslationToggled(data) + case TypeChatEventInviteLinkEdited: return UnmarshalChatEventInviteLinkEdited(data) @@ -19716,6 +29622,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumLimitTypePinnedArchivedChatCount: return UnmarshalPremiumLimitTypePinnedArchivedChatCount(data) + case TypePremiumLimitTypePinnedSavedMessagesTopicCount: + return UnmarshalPremiumLimitTypePinnedSavedMessagesTopicCount(data) + case TypePremiumLimitTypeCaptionLength: return UnmarshalPremiumLimitTypeCaptionLength(data) @@ -19731,11 +29640,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumLimitTypeActiveStoryCount: return UnmarshalPremiumLimitTypeActiveStoryCount(data) - case TypePremiumLimitTypeWeeklySentStoryCount: - return UnmarshalPremiumLimitTypeWeeklySentStoryCount(data) + case TypePremiumLimitTypeWeeklyPostedStoryCount: + return UnmarshalPremiumLimitTypeWeeklyPostedStoryCount(data) - case TypePremiumLimitTypeMonthlySentStoryCount: - return UnmarshalPremiumLimitTypeMonthlySentStoryCount(data) + case TypePremiumLimitTypeMonthlyPostedStoryCount: + return UnmarshalPremiumLimitTypeMonthlyPostedStoryCount(data) case TypePremiumLimitTypeStoryCaptionLength: return UnmarshalPremiumLimitTypeStoryCaptionLength(data) @@ -19743,6 +29652,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumLimitTypeStorySuggestedReactionAreaCount: return UnmarshalPremiumLimitTypeStorySuggestedReactionAreaCount(data) + case TypePremiumLimitTypeSimilarChatCount: + return UnmarshalPremiumLimitTypeSimilarChatCount(data) + case TypePremiumFeatureIncreasedLimits: return UnmarshalPremiumFeatureIncreasedLimits(data) @@ -19797,6 +29709,63 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeatureAccentColor: return UnmarshalPremiumFeatureAccentColor(data) + case TypePremiumFeatureBackgroundForBoth: + return UnmarshalPremiumFeatureBackgroundForBoth(data) + + case TypePremiumFeatureSavedMessagesTags: + return UnmarshalPremiumFeatureSavedMessagesTags(data) + + case TypePremiumFeatureMessagePrivacy: + return UnmarshalPremiumFeatureMessagePrivacy(data) + + case TypePremiumFeatureLastSeenTimes: + return UnmarshalPremiumFeatureLastSeenTimes(data) + + case TypePremiumFeatureBusiness: + return UnmarshalPremiumFeatureBusiness(data) + + case TypePremiumFeatureMessageEffects: + return UnmarshalPremiumFeatureMessageEffects(data) + + case TypePremiumFeatureChecklists: + return UnmarshalPremiumFeatureChecklists(data) + + case TypePremiumFeaturePaidMessages: + return UnmarshalPremiumFeaturePaidMessages(data) + + case TypeBusinessFeatureLocation: + return UnmarshalBusinessFeatureLocation(data) + + case TypeBusinessFeatureOpeningHours: + return UnmarshalBusinessFeatureOpeningHours(data) + + case TypeBusinessFeatureQuickReplies: + return UnmarshalBusinessFeatureQuickReplies(data) + + case TypeBusinessFeatureGreetingMessage: + return UnmarshalBusinessFeatureGreetingMessage(data) + + case TypeBusinessFeatureAwayMessage: + return UnmarshalBusinessFeatureAwayMessage(data) + + case TypeBusinessFeatureAccountLinks: + return UnmarshalBusinessFeatureAccountLinks(data) + + case TypeBusinessFeatureStartPage: + return UnmarshalBusinessFeatureStartPage(data) + + case TypeBusinessFeatureBots: + return UnmarshalBusinessFeatureBots(data) + + case TypeBusinessFeatureEmojiStatus: + return UnmarshalBusinessFeatureEmojiStatus(data) + + case TypeBusinessFeatureChatFolderTags: + return UnmarshalBusinessFeatureChatFolderTags(data) + + case TypeBusinessFeatureUpgradedStories: + return UnmarshalBusinessFeatureUpgradedStories(data) + case TypePremiumStoryFeaturePriorityOrder: return UnmarshalPremiumStoryFeaturePriorityOrder(data) @@ -19815,18 +29784,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumStoryFeatureLinksAndFormatting: return UnmarshalPremiumStoryFeatureLinksAndFormatting(data) + case TypePremiumStoryFeatureVideoQuality: + return UnmarshalPremiumStoryFeatureVideoQuality(data) + case TypePremiumLimit: return UnmarshalPremiumLimit(data) case TypePremiumFeatures: return UnmarshalPremiumFeatures(data) + case TypeBusinessFeatures: + return UnmarshalBusinessFeatures(data) + case TypePremiumSourceLimitExceeded: return UnmarshalPremiumSourceLimitExceeded(data) case TypePremiumSourceFeature: return UnmarshalPremiumSourceFeature(data) + case TypePremiumSourceBusinessFeature: + return UnmarshalPremiumSourceBusinessFeature(data) + case TypePremiumSourceStoryFeature: return UnmarshalPremiumSourceStoryFeature(data) @@ -19839,14 +29817,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePremiumFeaturePromotionAnimation: return UnmarshalPremiumFeaturePromotionAnimation(data) + case TypeBusinessFeaturePromotionAnimation: + return UnmarshalBusinessFeaturePromotionAnimation(data) + case TypePremiumState: return UnmarshalPremiumState(data) case TypeStorePaymentPurposePremiumSubscription: return UnmarshalStorePaymentPurposePremiumSubscription(data) - case TypeStorePaymentPurposeGiftedPremium: - return UnmarshalStorePaymentPurposeGiftedPremium(data) + case TypeStorePaymentPurposePremiumGift: + return UnmarshalStorePaymentPurposePremiumGift(data) case TypeStorePaymentPurposePremiumGiftCodes: return UnmarshalStorePaymentPurposePremiumGiftCodes(data) @@ -19854,12 +29835,42 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorePaymentPurposePremiumGiveaway: return UnmarshalStorePaymentPurposePremiumGiveaway(data) + case TypeStorePaymentPurposeStarGiveaway: + return UnmarshalStorePaymentPurposeStarGiveaway(data) + + case TypeStorePaymentPurposeStars: + return UnmarshalStorePaymentPurposeStars(data) + + case TypeStorePaymentPurposeGiftedStars: + return UnmarshalStorePaymentPurposeGiftedStars(data) + + case TypeStoreTransactionAppStore: + return UnmarshalStoreTransactionAppStore(data) + + case TypeStoreTransactionGooglePlay: + return UnmarshalStoreTransactionGooglePlay(data) + + case TypeTelegramPaymentPurposePremiumGift: + return UnmarshalTelegramPaymentPurposePremiumGift(data) + case TypeTelegramPaymentPurposePremiumGiftCodes: return UnmarshalTelegramPaymentPurposePremiumGiftCodes(data) case TypeTelegramPaymentPurposePremiumGiveaway: return UnmarshalTelegramPaymentPurposePremiumGiveaway(data) + case TypeTelegramPaymentPurposeStars: + return UnmarshalTelegramPaymentPurposeStars(data) + + case TypeTelegramPaymentPurposeGiftedStars: + return UnmarshalTelegramPaymentPurposeGiftedStars(data) + + case TypeTelegramPaymentPurposeStarGiveaway: + return UnmarshalTelegramPaymentPurposeStarGiveaway(data) + + case TypeTelegramPaymentPurposeJoinChat: + return UnmarshalTelegramPaymentPurposeJoinChat(data) + case TypeDeviceTokenFirebaseCloudMessaging: return UnmarshalDeviceTokenFirebaseCloudMessaging(data) @@ -19917,6 +29928,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBackgroundTypeFill: return UnmarshalBackgroundTypeFill(data) + case TypeBackgroundTypeChatTheme: + return UnmarshalBackgroundTypeChatTheme(data) + case TypeInputBackgroundLocal: return UnmarshalInputBackgroundLocal(data) @@ -19926,32 +29940,62 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputBackgroundPrevious: return UnmarshalInputBackgroundPrevious(data) - case TypeThemeSettings: - return UnmarshalThemeSettings(data) + case TypeEmojiChatTheme: + return UnmarshalEmojiChatTheme(data) - case TypeChatTheme: - return UnmarshalChatTheme(data) + case TypeGiftChatTheme: + return UnmarshalGiftChatTheme(data) + + case TypeGiftChatThemes: + return UnmarshalGiftChatThemes(data) + + case TypeChatThemeEmoji: + return UnmarshalChatThemeEmoji(data) + + case TypeChatThemeGift: + return UnmarshalChatThemeGift(data) + + case TypeInputChatThemeEmoji: + return UnmarshalInputChatThemeEmoji(data) + + case TypeInputChatThemeGift: + return UnmarshalInputChatThemeGift(data) + + case TypeTimeZone: + return UnmarshalTimeZone(data) + + case TypeTimeZones: + return UnmarshalTimeZones(data) case TypeHashtags: return UnmarshalHashtags(data) - case TypeCanSendStoryResultOk: - return UnmarshalCanSendStoryResultOk(data) + case TypeCanPostStoryResultOk: + return UnmarshalCanPostStoryResultOk(data) - case TypeCanSendStoryResultPremiumNeeded: - return UnmarshalCanSendStoryResultPremiumNeeded(data) + case TypeCanPostStoryResultPremiumNeeded: + return UnmarshalCanPostStoryResultPremiumNeeded(data) - case TypeCanSendStoryResultBoostNeeded: - return UnmarshalCanSendStoryResultBoostNeeded(data) + case TypeCanPostStoryResultBoostNeeded: + return UnmarshalCanPostStoryResultBoostNeeded(data) - case TypeCanSendStoryResultActiveStoryLimitExceeded: - return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(data) + case TypeCanPostStoryResultActiveStoryLimitExceeded: + return UnmarshalCanPostStoryResultActiveStoryLimitExceeded(data) - case TypeCanSendStoryResultWeeklyLimitExceeded: - return UnmarshalCanSendStoryResultWeeklyLimitExceeded(data) + case TypeCanPostStoryResultWeeklyLimitExceeded: + return UnmarshalCanPostStoryResultWeeklyLimitExceeded(data) - case TypeCanSendStoryResultMonthlyLimitExceeded: - return UnmarshalCanSendStoryResultMonthlyLimitExceeded(data) + case TypeCanPostStoryResultMonthlyLimitExceeded: + return UnmarshalCanPostStoryResultMonthlyLimitExceeded(data) + + case TypeCanPostStoryResultLiveStoryIsActive: + return UnmarshalCanPostStoryResultLiveStoryIsActive(data) + + case TypeStartLiveStoryResultOk: + return UnmarshalStartLiveStoryResultOk(data) + + case TypeStartLiveStoryResultFail: + return UnmarshalStartLiveStoryResultFail(data) case TypeCanTransferOwnershipResultOk: return UnmarshalCanTransferOwnershipResultOk(data) @@ -20040,6 +30084,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentLocation: return UnmarshalPushMessageContentLocation(data) + case TypePushMessageContentPaidMedia: + return UnmarshalPushMessageContentPaidMedia(data) + case TypePushMessageContentPhoto: return UnmarshalPushMessageContentPhoto(data) @@ -20049,8 +30096,14 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentPremiumGiftCode: return UnmarshalPushMessageContentPremiumGiftCode(data) - case TypePushMessageContentPremiumGiveaway: - return UnmarshalPushMessageContentPremiumGiveaway(data) + case TypePushMessageContentGiveaway: + return UnmarshalPushMessageContentGiveaway(data) + + case TypePushMessageContentGift: + return UnmarshalPushMessageContentGift(data) + + case TypePushMessageContentUpgradedGift: + return UnmarshalPushMessageContentUpgradedGift(data) case TypePushMessageContentScreenshotTaken: return UnmarshalPushMessageContentScreenshotTaken(data) @@ -20064,6 +30117,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentText: return UnmarshalPushMessageContentText(data) + case TypePushMessageContentChecklist: + return UnmarshalPushMessageContentChecklist(data) + case TypePushMessageContentVideo: return UnmarshalPushMessageContentVideo(data) @@ -20076,6 +30132,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentBasicGroupChatCreate: return UnmarshalPushMessageContentBasicGroupChatCreate(data) + case TypePushMessageContentVideoChatStarted: + return UnmarshalPushMessageContentVideoChatStarted(data) + + case TypePushMessageContentVideoChatEnded: + return UnmarshalPushMessageContentVideoChatEnded(data) + + case TypePushMessageContentInviteVideoChatParticipants: + return UnmarshalPushMessageContentInviteVideoChatParticipants(data) + case TypePushMessageContentChatAddMembers: return UnmarshalPushMessageContentChatAddMembers(data) @@ -20106,6 +30171,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePushMessageContentSuggestProfilePhoto: return UnmarshalPushMessageContentSuggestProfilePhoto(data) + case TypePushMessageContentSuggestBirthdate: + return UnmarshalPushMessageContentSuggestBirthdate(data) + + case TypePushMessageContentProximityAlertTriggered: + return UnmarshalPushMessageContentProximityAlertTriggered(data) + + case TypePushMessageContentChecklistTasksAdded: + return UnmarshalPushMessageContentChecklistTasksAdded(data) + + case TypePushMessageContentChecklistTasksDone: + return UnmarshalPushMessageContentChecklistTasksDone(data) + case TypePushMessageContentMessageForwards: return UnmarshalPushMessageContentMessageForwards(data) @@ -20148,6 +30225,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeNotificationGroup: return UnmarshalNotificationGroup(data) + case TypeProxy: + return UnmarshalProxy(data) + case TypeOptionValueBoolean: return UnmarshalOptionValueBoolean(data) @@ -20199,6 +30279,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingRuleAllowContacts: return UnmarshalUserPrivacySettingRuleAllowContacts(data) + case TypeUserPrivacySettingRuleAllowBots: + return UnmarshalUserPrivacySettingRuleAllowBots(data) + + case TypeUserPrivacySettingRuleAllowPremiumUsers: + return UnmarshalUserPrivacySettingRuleAllowPremiumUsers(data) + case TypeUserPrivacySettingRuleAllowUsers: return UnmarshalUserPrivacySettingRuleAllowUsers(data) @@ -20211,6 +30297,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingRuleRestrictContacts: return UnmarshalUserPrivacySettingRuleRestrictContacts(data) + case TypeUserPrivacySettingRuleRestrictBots: + return UnmarshalUserPrivacySettingRuleRestrictBots(data) + case TypeUserPrivacySettingRuleRestrictUsers: return UnmarshalUserPrivacySettingRuleRestrictUsers(data) @@ -20235,6 +30324,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingShowBio: return UnmarshalUserPrivacySettingShowBio(data) + case TypeUserPrivacySettingShowBirthdate: + return UnmarshalUserPrivacySettingShowBirthdate(data) + + case TypeUserPrivacySettingShowProfileAudio: + return UnmarshalUserPrivacySettingShowProfileAudio(data) + case TypeUserPrivacySettingAllowChatInvites: return UnmarshalUserPrivacySettingAllowChatInvites(data) @@ -20250,6 +30345,30 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages: return UnmarshalUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages(data) + case TypeUserPrivacySettingAutosaveGifts: + return UnmarshalUserPrivacySettingAutosaveGifts(data) + + case TypeUserPrivacySettingAllowUnpaidMessages: + return UnmarshalUserPrivacySettingAllowUnpaidMessages(data) + + case TypeReadDatePrivacySettings: + return UnmarshalReadDatePrivacySettings(data) + + case TypeNewChatPrivacySettings: + return UnmarshalNewChatPrivacySettings(data) + + case TypeCanSendMessageToUserResultOk: + return UnmarshalCanSendMessageToUserResultOk(data) + + case TypeCanSendMessageToUserResultUserHasPaidMessages: + return UnmarshalCanSendMessageToUserResultUserHasPaidMessages(data) + + case TypeCanSendMessageToUserResultUserIsDeleted: + return UnmarshalCanSendMessageToUserResultUserIsDeleted(data) + + case TypeCanSendMessageToUserResultUserRestrictsNewChats: + return UnmarshalCanSendMessageToUserResultUserRestrictsNewChats(data) + case TypeAccountTtl: return UnmarshalAccountTtl(data) @@ -20352,17 +30471,89 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeReportReasonCustom: return UnmarshalReportReasonCustom(data) - case TypeTargetChatCurrent: - return UnmarshalTargetChatCurrent(data) + case TypeReportChatResultOk: + return UnmarshalReportChatResultOk(data) - case TypeTargetChatChosen: - return UnmarshalTargetChatChosen(data) + case TypeReportChatResultOptionRequired: + return UnmarshalReportChatResultOptionRequired(data) - case TypeTargetChatInternalLink: - return UnmarshalTargetChatInternalLink(data) + case TypeReportChatResultTextRequired: + return UnmarshalReportChatResultTextRequired(data) - case TypeInternalLinkTypeActiveSessions: - return UnmarshalInternalLinkTypeActiveSessions(data) + case TypeReportChatResultMessagesRequired: + return UnmarshalReportChatResultMessagesRequired(data) + + case TypeReportStoryResultOk: + return UnmarshalReportStoryResultOk(data) + + case TypeReportStoryResultOptionRequired: + return UnmarshalReportStoryResultOptionRequired(data) + + case TypeReportStoryResultTextRequired: + return UnmarshalReportStoryResultTextRequired(data) + + case TypeSettingsSectionAppearance: + return UnmarshalSettingsSectionAppearance(data) + + case TypeSettingsSectionAskQuestion: + return UnmarshalSettingsSectionAskQuestion(data) + + case TypeSettingsSectionBusiness: + return UnmarshalSettingsSectionBusiness(data) + + case TypeSettingsSectionChatFolders: + return UnmarshalSettingsSectionChatFolders(data) + + case TypeSettingsSectionDataAndStorage: + return UnmarshalSettingsSectionDataAndStorage(data) + + case TypeSettingsSectionDevices: + return UnmarshalSettingsSectionDevices(data) + + case TypeSettingsSectionEditProfile: + return UnmarshalSettingsSectionEditProfile(data) + + case TypeSettingsSectionFaq: + return UnmarshalSettingsSectionFaq(data) + + case TypeSettingsSectionFeatures: + return UnmarshalSettingsSectionFeatures(data) + + case TypeSettingsSectionInAppBrowser: + return UnmarshalSettingsSectionInAppBrowser(data) + + case TypeSettingsSectionLanguage: + return UnmarshalSettingsSectionLanguage(data) + + case TypeSettingsSectionMyStars: + return UnmarshalSettingsSectionMyStars(data) + + case TypeSettingsSectionMyToncoins: + return UnmarshalSettingsSectionMyToncoins(data) + + case TypeSettingsSectionNotifications: + return UnmarshalSettingsSectionNotifications(data) + + case TypeSettingsSectionPowerSaving: + return UnmarshalSettingsSectionPowerSaving(data) + + case TypeSettingsSectionPremium: + return UnmarshalSettingsSectionPremium(data) + + case TypeSettingsSectionPrivacyAndSecurity: + return UnmarshalSettingsSectionPrivacyAndSecurity(data) + + case TypeSettingsSectionPrivacyPolicy: + return UnmarshalSettingsSectionPrivacyPolicy(data) + + case TypeSettingsSectionQrCode: + return UnmarshalSettingsSectionQrCode(data) + + case TypeSettingsSectionSearch: + return UnmarshalSettingsSectionSearch(data) + + case TypeSettingsSectionSendGift: + return UnmarshalSettingsSectionSendGift(data) case TypeInternalLinkTypeAttachmentMenuBot: return UnmarshalInternalLinkTypeAttachmentMenuBot(data) @@ -20382,8 +30573,14 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(data) - case TypeInternalLinkTypeChangePhoneNumber: - return UnmarshalInternalLinkTypeChangePhoneNumber(data) + case TypeInternalLinkTypeBusinessChat: + return UnmarshalInternalLinkTypeBusinessChat(data) + + case TypeInternalLinkTypeCallsPage: + return UnmarshalInternalLinkTypeCallsPage(data) + + case TypeInternalLinkTypeChatAffiliateProgram: + return UnmarshalInternalLinkTypeChatAffiliateProgram(data) case TypeInternalLinkTypeChatBoost: return UnmarshalInternalLinkTypeChatBoost(data) @@ -20391,21 +30588,30 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeChatFolderInvite: return UnmarshalInternalLinkTypeChatFolderInvite(data) - case TypeInternalLinkTypeChatFolderSettings: - return UnmarshalInternalLinkTypeChatFolderSettings(data) - case TypeInternalLinkTypeChatInvite: return UnmarshalInternalLinkTypeChatInvite(data) - case TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings: - return UnmarshalInternalLinkTypeDefaultMessageAutoDeleteTimerSettings(data) + case TypeInternalLinkTypeChatSelection: + return UnmarshalInternalLinkTypeChatSelection(data) - case TypeInternalLinkTypeEditProfileSettings: - return UnmarshalInternalLinkTypeEditProfileSettings(data) + case TypeInternalLinkTypeContactsPage: + return UnmarshalInternalLinkTypeContactsPage(data) + + case TypeInternalLinkTypeDirectMessagesChat: + return UnmarshalInternalLinkTypeDirectMessagesChat(data) case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(data) + case TypeInternalLinkTypeGiftAuction: + return UnmarshalInternalLinkTypeGiftAuction(data) + + case TypeInternalLinkTypeGiftCollection: + return UnmarshalInternalLinkTypeGiftCollection(data) + + case TypeInternalLinkTypeGroupCall: + return UnmarshalInternalLinkTypeGroupCall(data) + case TypeInternalLinkTypeInstantView: return UnmarshalInternalLinkTypeInstantView(data) @@ -20415,8 +30621,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeLanguagePack: return UnmarshalInternalLinkTypeLanguagePack(data) - case TypeInternalLinkTypeLanguageSettings: - return UnmarshalInternalLinkTypeLanguageSettings(data) + case TypeInternalLinkTypeLiveStory: + return UnmarshalInternalLinkTypeLiveStory(data) + + case TypeInternalLinkTypeMainWebApp: + return UnmarshalInternalLinkTypeMainWebApp(data) case TypeInternalLinkTypeMessage: return UnmarshalInternalLinkTypeMessage(data) @@ -20424,20 +30633,35 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeMessageDraft: return UnmarshalInternalLinkTypeMessageDraft(data) + case TypeInternalLinkTypeMyProfilePage: + return UnmarshalInternalLinkTypeMyProfilePage(data) + + case TypeInternalLinkTypeNewChannelChat: + return UnmarshalInternalLinkTypeNewChannelChat(data) + + case TypeInternalLinkTypeNewGroupChat: + return UnmarshalInternalLinkTypeNewGroupChat(data) + + case TypeInternalLinkTypeNewPrivateChat: + return UnmarshalInternalLinkTypeNewPrivateChat(data) + + case TypeInternalLinkTypeNewStory: + return UnmarshalInternalLinkTypeNewStory(data) + case TypeInternalLinkTypePassportDataRequest: return UnmarshalInternalLinkTypePassportDataRequest(data) case TypeInternalLinkTypePhoneNumberConfirmation: return UnmarshalInternalLinkTypePhoneNumberConfirmation(data) - case TypeInternalLinkTypePremiumFeatures: - return UnmarshalInternalLinkTypePremiumFeatures(data) + case TypeInternalLinkTypePremiumFeaturesPage: + return UnmarshalInternalLinkTypePremiumFeaturesPage(data) case TypeInternalLinkTypePremiumGiftCode: return UnmarshalInternalLinkTypePremiumGiftCode(data) - case TypeInternalLinkTypePrivacyAndSecuritySettings: - return UnmarshalInternalLinkTypePrivacyAndSecuritySettings(data) + case TypeInternalLinkTypePremiumGiftPurchase: + return UnmarshalInternalLinkTypePremiumGiftPurchase(data) case TypeInternalLinkTypeProxy: return UnmarshalInternalLinkTypeProxy(data) @@ -20451,11 +30675,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeRestorePurchases: return UnmarshalInternalLinkTypeRestorePurchases(data) + case TypeInternalLinkTypeSavedMessages: + return UnmarshalInternalLinkTypeSavedMessages(data) + + case TypeInternalLinkTypeSearch: + return UnmarshalInternalLinkTypeSearch(data) + case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(data) - case TypeInternalLinkTypeSideMenuBot: - return UnmarshalInternalLinkTypeSideMenuBot(data) + case TypeInternalLinkTypeStarPurchase: + return UnmarshalInternalLinkTypeStarPurchase(data) case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(data) @@ -20463,17 +30693,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInternalLinkTypeStory: return UnmarshalInternalLinkTypeStory(data) + case TypeInternalLinkTypeStoryAlbum: + return UnmarshalInternalLinkTypeStoryAlbum(data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(data) - case TypeInternalLinkTypeThemeSettings: - return UnmarshalInternalLinkTypeThemeSettings(data) - case TypeInternalLinkTypeUnknownDeepLink: return UnmarshalInternalLinkTypeUnknownDeepLink(data) - case TypeInternalLinkTypeUnsupportedProxy: - return UnmarshalInternalLinkTypeUnsupportedProxy(data) + case TypeInternalLinkTypeUpgradedGift: + return UnmarshalInternalLinkTypeUpgradedGift(data) case TypeInternalLinkTypeUserPhoneNumber: return UnmarshalInternalLinkTypeUserPhoneNumber(data) @@ -20505,9 +30735,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBlockListStories: return UnmarshalBlockListStories(data) - case TypeFilePart: - return UnmarshalFilePart(data) - case TypeFileTypeNone: return UnmarshalFileTypeNone(data) @@ -20541,6 +30768,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) @@ -20646,6 +30885,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeConnectionStateReady: return UnmarshalConnectionStateReady(data) + case TypeAgeVerificationParameters: + return UnmarshalAgeVerificationParameters(data) + case TypeTopChatCategoryUsers: return UnmarshalTopChatCategoryUsers(data) @@ -20661,6 +30903,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeTopChatCategoryInlineBots: return UnmarshalTopChatCategoryInlineBots(data) + case TypeTopChatCategoryWebAppBots: + return UnmarshalTopChatCategoryWebAppBots(data) + case TypeTopChatCategoryCalls: return UnmarshalTopChatCategoryCalls(data) @@ -20718,18 +30963,48 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSuggestedActionSubscribeToAnnualPremium: return UnmarshalSuggestedActionSubscribeToAnnualPremium(data) + case TypeSuggestedActionGiftPremiumForChristmas: + return UnmarshalSuggestedActionGiftPremiumForChristmas(data) + + case TypeSuggestedActionSetBirthdate: + return UnmarshalSuggestedActionSetBirthdate(data) + + case TypeSuggestedActionSetProfilePhoto: + return UnmarshalSuggestedActionSetProfilePhoto(data) + + case TypeSuggestedActionExtendPremium: + return UnmarshalSuggestedActionExtendPremium(data) + + case TypeSuggestedActionExtendStarSubscriptions: + return UnmarshalSuggestedActionExtendStarSubscriptions(data) + + case TypeSuggestedActionCustom: + return UnmarshalSuggestedActionCustom(data) + + case TypeSuggestedActionSetLoginEmailAddress: + return UnmarshalSuggestedActionSetLoginEmailAddress(data) + + case TypeSuggestedActionAddLoginPasskey: + return UnmarshalSuggestedActionAddLoginPasskey(data) + case TypeCount: return UnmarshalCount(data) case TypeText: return UnmarshalText(data) + case TypeData: + return UnmarshalData(data) + case TypeSeconds: return UnmarshalSeconds(data) case TypeFileDownloadedPrefixSize: return UnmarshalFileDownloadedPrefixSize(data) + case TypeStarCount: + return UnmarshalStarCount(data) + case TypeDeepLinkInfo: return UnmarshalDeepLinkInfo(data) @@ -20748,11 +31023,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeProxyTypeMtproto: return UnmarshalProxyTypeMtproto(data) - case TypeProxy: - return UnmarshalProxy(data) + case TypeAddedProxy: + return UnmarshalAddedProxy(data) - case TypeProxies: - return UnmarshalProxies(data) + case TypeAddedProxies: + return UnmarshalAddedProxies(data) case TypeInputSticker: return UnmarshalInputSticker(data) @@ -20772,8 +31047,14 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStatisticalGraphError: return UnmarshalStatisticalGraphError(data) - case TypeChatStatisticsMessageInteractionInfo: - return UnmarshalChatStatisticsMessageInteractionInfo(data) + case TypeChatStatisticsObjectTypeMessage: + return UnmarshalChatStatisticsObjectTypeMessage(data) + + case TypeChatStatisticsObjectTypeStory: + return UnmarshalChatStatisticsObjectTypeStory(data) + + case TypeChatStatisticsInteractionInfo: + return UnmarshalChatStatisticsInteractionInfo(data) case TypeChatStatisticsMessageSenderInfo: return UnmarshalChatStatisticsMessageSenderInfo(data) @@ -20790,9 +31071,60 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatStatisticsChannel: return UnmarshalChatStatisticsChannel(data) + case TypeChatRevenueAmount: + return UnmarshalChatRevenueAmount(data) + + case TypeChatRevenueStatistics: + return UnmarshalChatRevenueStatistics(data) + case TypeMessageStatistics: return UnmarshalMessageStatistics(data) + case TypeStoryStatistics: + return UnmarshalStoryStatistics(data) + + case TypeRevenueWithdrawalStatePending: + return UnmarshalRevenueWithdrawalStatePending(data) + + case TypeRevenueWithdrawalStateSucceeded: + return UnmarshalRevenueWithdrawalStateSucceeded(data) + + case TypeRevenueWithdrawalStateFailed: + return UnmarshalRevenueWithdrawalStateFailed(data) + + case TypeChatRevenueTransactionTypeUnsupported: + return UnmarshalChatRevenueTransactionTypeUnsupported(data) + + case TypeChatRevenueTransactionTypeSponsoredMessageEarnings: + return UnmarshalChatRevenueTransactionTypeSponsoredMessageEarnings(data) + + case TypeChatRevenueTransactionTypeSuggestedPostEarnings: + return UnmarshalChatRevenueTransactionTypeSuggestedPostEarnings(data) + + case TypeChatRevenueTransactionTypeFragmentWithdrawal: + return UnmarshalChatRevenueTransactionTypeFragmentWithdrawal(data) + + case TypeChatRevenueTransactionTypeFragmentRefund: + return UnmarshalChatRevenueTransactionTypeFragmentRefund(data) + + case TypeChatRevenueTransaction: + return UnmarshalChatRevenueTransaction(data) + + case TypeChatRevenueTransactions: + return UnmarshalChatRevenueTransactions(data) + + case TypeStarRevenueStatus: + return UnmarshalStarRevenueStatus(data) + + case TypeStarRevenueStatistics: + return UnmarshalStarRevenueStatistics(data) + + case TypeTonRevenueStatus: + return UnmarshalTonRevenueStatus(data) + + case TypeTonRevenueStatistics: + return UnmarshalTonRevenueStatistics(data) + case TypePoint: return UnmarshalPoint(data) @@ -20823,6 +31155,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeBotCommandScopeChatMember: return UnmarshalBotCommandScopeChatMember(data) + case TypePhoneNumberCodeTypeChange: + return UnmarshalPhoneNumberCodeTypeChange(data) + + case TypePhoneNumberCodeTypeVerify: + return UnmarshalPhoneNumberCodeTypeVerify(data) + + case TypePhoneNumberCodeTypeConfirmOwnership: + return UnmarshalPhoneNumberCodeTypeConfirmOwnership(data) + case TypeUpdateAuthorizationState: return UnmarshalUpdateAuthorizationState(data) @@ -20859,9 +31200,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateMessageUnreadReactions: return UnmarshalUpdateMessageUnreadReactions(data) + case TypeUpdateMessageFactCheck: + return UnmarshalUpdateMessageFactCheck(data) + + case TypeUpdateMessageSuggestedPostInfo: + return UnmarshalUpdateMessageSuggestedPostInfo(data) + case TypeUpdateMessageLiveLocationViewed: return UnmarshalUpdateMessageLiveLocationViewed(data) + case TypeUpdateVideoPublished: + return UnmarshalUpdateVideoPublished(data) + case TypeUpdateNewChat: return UnmarshalUpdateNewChat(data) @@ -20871,11 +31221,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(data) - case TypeUpdateChatAccentColor: - return UnmarshalUpdateChatAccentColor(data) - - case TypeUpdateChatBackgroundCustomEmoji: - return UnmarshalUpdateChatBackgroundCustomEmoji(data) + case TypeUpdateChatAccentColors: + return UnmarshalUpdateChatAccentColors(data) case TypeUpdateChatPermissions: return UnmarshalUpdateChatPermissions(data) @@ -20886,6 +31233,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatPosition: return UnmarshalUpdateChatPosition(data) + case TypeUpdateChatAddedToList: + return UnmarshalUpdateChatAddedToList(data) + + case TypeUpdateChatRemovedFromList: + return UnmarshalUpdateChatRemovedFromList(data) + case TypeUpdateChatReadInbox: return UnmarshalUpdateChatReadInbox(data) @@ -20895,12 +31248,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatActionBar: return UnmarshalUpdateChatActionBar(data) + case TypeUpdateChatBusinessBotManageBar: + return UnmarshalUpdateChatBusinessBotManageBar(data) + case TypeUpdateChatAvailableReactions: return UnmarshalUpdateChatAvailableReactions(data) case TypeUpdateChatDraftMessage: return UnmarshalUpdateChatDraftMessage(data) + case TypeUpdateChatEmojiStatus: + return UnmarshalUpdateChatEmojiStatus(data) + case TypeUpdateChatMessageSender: return UnmarshalUpdateChatMessageSender(data) @@ -20943,6 +31302,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatIsMarkedAsUnread: return UnmarshalUpdateChatIsMarkedAsUnread(data) + case TypeUpdateChatViewAsTopics: + return UnmarshalUpdateChatViewAsTopics(data) + case TypeUpdateChatBlockList: return UnmarshalUpdateChatBlockList(data) @@ -20955,12 +31317,42 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(data) + case TypeUpdateSavedMessagesTopic: + return UnmarshalUpdateSavedMessagesTopic(data) + + case TypeUpdateSavedMessagesTopicCount: + return UnmarshalUpdateSavedMessagesTopicCount(data) + + case TypeUpdateDirectMessagesChatTopic: + return UnmarshalUpdateDirectMessagesChatTopic(data) + + case TypeUpdateTopicMessageCount: + return UnmarshalUpdateTopicMessageCount(data) + + case TypeUpdateQuickReplyShortcut: + return UnmarshalUpdateQuickReplyShortcut(data) + + case TypeUpdateQuickReplyShortcutDeleted: + return UnmarshalUpdateQuickReplyShortcutDeleted(data) + + case TypeUpdateQuickReplyShortcuts: + return UnmarshalUpdateQuickReplyShortcuts(data) + + case TypeUpdateQuickReplyShortcutMessages: + return UnmarshalUpdateQuickReplyShortcutMessages(data) + case TypeUpdateForumTopicInfo: return UnmarshalUpdateForumTopicInfo(data) + case TypeUpdateForumTopic: + return UnmarshalUpdateForumTopic(data) + case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) + case TypeUpdateReactionNotificationSettings: + return UnmarshalUpdateReactionNotificationSettings(data) + case TypeUpdateNotification: return UnmarshalUpdateNotification(data) @@ -20979,6 +31371,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatAction: return UnmarshalUpdateChatAction(data) + case TypeUpdatePendingTextMessage: + return UnmarshalUpdatePendingTextMessage(data) + case TypeUpdateUserStatus: return UnmarshalUpdateUserStatus(data) @@ -21027,6 +31422,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateFileRemovedFromDownloads: return UnmarshalUpdateFileRemovedFromDownloads(data) + case TypeUpdateApplicationVerificationRequired: + return UnmarshalUpdateApplicationVerificationRequired(data) + + case TypeUpdateApplicationRecaptchaVerificationRequired: + return UnmarshalUpdateApplicationRecaptchaVerificationRequired(data) + case TypeUpdateCall: return UnmarshalUpdateCall(data) @@ -21036,9 +31437,36 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateGroupCallParticipant: return UnmarshalUpdateGroupCallParticipant(data) + case TypeUpdateGroupCallParticipants: + return UnmarshalUpdateGroupCallParticipants(data) + + case TypeUpdateGroupCallVerificationState: + return UnmarshalUpdateGroupCallVerificationState(data) + + case TypeUpdateNewGroupCallMessage: + return UnmarshalUpdateNewGroupCallMessage(data) + + case TypeUpdateNewGroupCallPaidReaction: + return UnmarshalUpdateNewGroupCallPaidReaction(data) + + case TypeUpdateGroupCallMessageSendFailed: + return UnmarshalUpdateGroupCallMessageSendFailed(data) + + case TypeUpdateGroupCallMessagesDeleted: + return UnmarshalUpdateGroupCallMessagesDeleted(data) + + case TypeUpdateLiveStoryTopDonors: + return UnmarshalUpdateLiveStoryTopDonors(data) + case TypeUpdateNewCallSignalingData: return UnmarshalUpdateNewCallSignalingData(data) + case TypeUpdateGiftAuctionState: + return UnmarshalUpdateGiftAuctionState(data) + + case TypeUpdateActiveGiftAuctions: + return UnmarshalUpdateActiveGiftAuctions(data) + case TypeUpdateUserPrivacySettingRules: return UnmarshalUpdateUserPrivacySettingRules(data) @@ -21054,11 +31482,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateStoryDeleted: return UnmarshalUpdateStoryDeleted(data) - case TypeUpdateStorySendSucceeded: - return UnmarshalUpdateStorySendSucceeded(data) + case TypeUpdateStoryPostSucceeded: + return UnmarshalUpdateStoryPostSucceeded(data) - case TypeUpdateStorySendFailed: - return UnmarshalUpdateStorySendFailed(data) + case TypeUpdateStoryPostFailed: + return UnmarshalUpdateStoryPostFailed(data) case TypeUpdateChatActiveStories: return UnmarshalUpdateChatActiveStories(data) @@ -21069,6 +31497,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateStoryStealthMode: return UnmarshalUpdateStoryStealthMode(data) + case TypeUpdateTrustedMiniAppBots: + return UnmarshalUpdateTrustedMiniAppBots(data) + case TypeUpdateOption: return UnmarshalUpdateOption(data) @@ -21093,27 +31524,33 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSavedNotificationSounds: return UnmarshalUpdateSavedNotificationSounds(data) - case TypeUpdateSelectedBackground: - return UnmarshalUpdateSelectedBackground(data) + case TypeUpdateDefaultBackground: + return UnmarshalUpdateDefaultBackground(data) - case TypeUpdateChatThemes: - return UnmarshalUpdateChatThemes(data) + case TypeUpdateEmojiChatThemes: + return UnmarshalUpdateEmojiChatThemes(data) case TypeUpdateAccentColors: return UnmarshalUpdateAccentColors(data) + case TypeUpdateProfileAccentColors: + return UnmarshalUpdateProfileAccentColors(data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(data) case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(data) + case TypeUpdateFreezeState: + return UnmarshalUpdateFreezeState(data) + + case TypeUpdateAgeVerificationParameters: + return UnmarshalUpdateAgeVerificationParameters(data) + case TypeUpdateTermsOfService: return UnmarshalUpdateTermsOfService(data) - case TypeUpdateUsersNearby: - return UnmarshalUpdateUsersNearby(data) - case TypeUpdateUnconfirmedSession: return UnmarshalUpdateUnconfirmedSession(data) @@ -21126,12 +31563,48 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateActiveEmojiReactions: return UnmarshalUpdateActiveEmojiReactions(data) + case TypeUpdateAvailableMessageEffects: + return UnmarshalUpdateAvailableMessageEffects(data) + case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(data) + case TypeUpdateDefaultPaidReactionType: + return UnmarshalUpdateDefaultPaidReactionType(data) + + case TypeUpdateSavedMessagesTags: + return UnmarshalUpdateSavedMessagesTags(data) + + case TypeUpdateActiveLiveLocationMessages: + return UnmarshalUpdateActiveLiveLocationMessages(data) + + case TypeUpdateOwnedStarCount: + return UnmarshalUpdateOwnedStarCount(data) + + case TypeUpdateOwnedTonCount: + return UnmarshalUpdateOwnedTonCount(data) + + case TypeUpdateChatRevenueAmount: + return UnmarshalUpdateChatRevenueAmount(data) + + case TypeUpdateStarRevenueStatus: + return UnmarshalUpdateStarRevenueStatus(data) + + case TypeUpdateTonRevenueStatus: + return UnmarshalUpdateTonRevenueStatus(data) + + case TypeUpdateSpeechRecognitionTrial: + return UnmarshalUpdateSpeechRecognitionTrial(data) + + case TypeUpdateGroupCallMessageLevels: + return UnmarshalUpdateGroupCallMessageLevels(data) + case TypeUpdateDiceEmojis: return UnmarshalUpdateDiceEmojis(data) + case TypeUpdateStakeDiceState: + return UnmarshalUpdateStakeDiceState(data) + case TypeUpdateAnimatedEmojiMessageClicked: return UnmarshalUpdateAnimatedEmojiMessageClicked(data) @@ -21141,12 +31614,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(data) - case TypeUpdateAddChatMembersPrivacyForbidden: - return UnmarshalUpdateAddChatMembersPrivacyForbidden(data) + case TypeUpdateSpeedLimitNotification: + return UnmarshalUpdateSpeedLimitNotification(data) + + case TypeUpdateContactCloseBirthdays: + return UnmarshalUpdateContactCloseBirthdays(data) case TypeUpdateAutosaveSettings: return UnmarshalUpdateAutosaveSettings(data) + case TypeUpdateBusinessConnection: + return UnmarshalUpdateBusinessConnection(data) + + case TypeUpdateNewBusinessMessage: + return UnmarshalUpdateNewBusinessMessage(data) + + case TypeUpdateBusinessMessageEdited: + return UnmarshalUpdateBusinessMessageEdited(data) + + case TypeUpdateBusinessMessagesDeleted: + return UnmarshalUpdateBusinessMessagesDeleted(data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(data) @@ -21159,6 +31647,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateNewInlineCallbackQuery: return UnmarshalUpdateNewInlineCallbackQuery(data) + case TypeUpdateNewBusinessCallbackQuery: + return UnmarshalUpdateNewBusinessCallbackQuery(data) + case TypeUpdateNewShippingQuery: return UnmarshalUpdateNewShippingQuery(data) @@ -21186,6 +31677,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatBoost: return UnmarshalUpdateChatBoost(data) + case TypeUpdateMessageReaction: + return UnmarshalUpdateMessageReaction(data) + + case TypeUpdateMessageReactions: + return UnmarshalUpdateMessageReactions(data) + + case TypeUpdatePaidMediaPurchased: + return UnmarshalUpdatePaidMediaPurchased(data) + case TypeUpdates: return UnmarshalUpdates(data) diff --git a/data/td_api.tl b/data/td_api.tl index b14df9a..1423dab 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -24,15 +24,23 @@ ok = Ok; //@class AuthenticationCodeType @description Provides information about the method by which an authentication code is delivered to the user -//@description An authentication code is delivered via a private Telegram message, which can be viewed from another active session +//@description A digit-only authentication code is delivered via a private Telegram message, which can be viewed from another active session //@length Length of the code authenticationCodeTypeTelegramMessage length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via an SMS message to the specified phone number; applications may not receive this type of code +//@description A digit-only authentication code is delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code //@length Length of the code authenticationCodeTypeSms length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via a phone call to the specified phone number +//@description An authentication code is a word delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code +//@first_letter The first letters of the word if known +authenticationCodeTypeSmsWord first_letter:string = AuthenticationCodeType; + +//@description An authentication code is a phrase from multiple words delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code +//@first_word The first word of the phrase if known +authenticationCodeTypeSmsPhrase first_word:string = AuthenticationCodeType; + +//@description A digit-only authentication code is delivered via a phone call to the specified phone number //@length Length of the code authenticationCodeTypeCall length:int32 = AuthenticationCodeType; @@ -45,19 +53,19 @@ authenticationCodeTypeFlashCall pattern:string = AuthenticationCodeType; //@length Number of digits in the code, excluding the prefix authenticationCodeTypeMissedCall phone_number_prefix:string length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT +//@description A digit-only authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT //@url URL to open to receive the code //@length Length of the code authenticationCodeTypeFragment url:string length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via Firebase Authentication to the official Android application -//@nonce Nonce to pass to the SafetyNet Attestation API +//@description A digit-only authentication code is delivered via Firebase Authentication to the official Android application +//@device_verification_parameters Parameters to be used for device verification //@length Length of the code -authenticationCodeTypeFirebaseAndroid nonce:bytes length:int32 = AuthenticationCodeType; +authenticationCodeTypeFirebaseAndroid device_verification_parameters:FirebaseDeviceVerificationParameters length:int32 = AuthenticationCodeType; -//@description An authentication code is delivered via Firebase Authentication to the official iOS application +//@description A digit-only authentication code is delivered via Firebase Authentication to the official iOS application //@receipt Receipt of successful application token validation to compare with receipt from push notification -//@push_timeout Time after the next authentication method is supposed to be used if verification push notification isn't received, in seconds +//@push_timeout Time after the next authentication method is expected to be used if verification push notification isn't received, in seconds //@length Length of the code authenticationCodeTypeFirebaseIos receipt:string push_timeout:int32 length:int32 = AuthenticationCodeType; @@ -75,7 +83,7 @@ authenticationCodeInfo phone_number:string type:AuthenticationCodeType next_type emailAddressAuthenticationCodeInfo email_address_pattern:string length:int32 = EmailAddressAuthenticationCodeInfo; -//@class EmailAddressAuthentication @description Contains authentication data for a email address +//@class EmailAddressAuthentication @description Contains authentication data for an email address //@description An authentication code delivered to a user's email address @code The code emailAddressAuthenticationCode code:string = EmailAddressAuthentication; @@ -87,7 +95,7 @@ emailAddressAuthenticationAppleId token:string = EmailAddressAuthentication; emailAddressAuthenticationGoogleId token:string = EmailAddressAuthentication; -//@class EmailAddressResetState @description Describes reset state of a email address +//@class EmailAddressResetState @description Describes reset state of an email address //@description Email address can be reset after the given period. Call resetAuthenticationEmailAddress to reset it and allow the user to authorize with a code sent to the user's phone number //@wait_period Time required to wait before the email address can be reset; 0 if the user is subscribed to Telegram Premium @@ -112,15 +120,33 @@ formattedText text:string entities:vector = FormattedText; //@description Contains Telegram terms of service @text Text of the terms of service @min_user_age The minimum age of a user to be able to accept the terms; 0 if age isn't restricted @show_popup True, if a blocking popup with terms of service must be shown to the user termsOfService text:formattedText min_user_age:int32 show_popup:Bool = TermsOfService; +//@description Describes a passkey +//@id Unique identifier of the passkey +//@name Name of the passkey +//@addition_date Point in time (Unix timestamp) when the passkey was added +//@last_usage_date Point in time (Unix timestamp) when the passkey was used last time; 0 if never +//@software_icon_custom_emoji_id Identifier of the custom emoji that is used as the icon of the software, which created the passkey; 0 if unknown +passkey id:string name:string addition_date:int32 last_usage_date:int32 software_icon_custom_emoji_id:int64 = Passkey; + +//@description Contains a list of passkeys @passkeys List of passkeys +passkeys passkeys:vector = Passkeys; + //@class AuthorizationState @description Represents the current authorization state of the TDLib client //@description Initialization parameters are needed. Call setTdlibParameters to provide them authorizationStateWaitTdlibParameters = AuthorizationState; -//@description TDLib needs the user's phone number to authorize. Call setAuthenticationPhoneNumber to provide the phone number, or use requestQrCodeAuthentication or checkAuthenticationBotToken for other authentication options +//@description TDLib needs the user's phone number to authorize. Call setAuthenticationPhoneNumber to provide the phone number, +//-or use requestQrCodeAuthentication, getAuthenticationPasskeyParameters, or checkAuthenticationBotToken for other authentication options authorizationStateWaitPhoneNumber = AuthorizationState; +//@description The user must buy Telegram Premium as an in-store purchase to log in. Call checkAuthenticationPremiumPurchase and then setAuthenticationPremiumPurchaseTransaction +//@store_product_id Identifier of the store product that must be bought +//@support_email_address Email address to use for support if the user has issues with Telegram Premium purchase +//@support_email_subject Subject for the email sent to the support email address +authorizationStateWaitPremiumPurchase store_product_id:string support_email_address:string support_email_subject:string = AuthorizationState; + //@description TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed //@allow_apple_id True, if authorization through Apple ID is allowed //@allow_google_id True, if authorization through Google ID is allowed @@ -164,6 +190,17 @@ authorizationStateClosing = AuthorizationState; authorizationStateClosed = AuthorizationState; +//@class FirebaseDeviceVerificationParameters @description Describes parameters to be used for device verification + +//@description Device verification must be performed with the SafetyNet Attestation API @nonce Nonce to pass to the SafetyNet Attestation API +firebaseDeviceVerificationParametersSafetyNet nonce:bytes = FirebaseDeviceVerificationParameters; + +//@description Device verification must be performed with the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic) +//@nonce Base64url-encoded nonce to pass to the Play Integrity API +//@cloud_project_number Cloud project number to pass to the Play Integrity API +firebaseDeviceVerificationParametersPlayIntegrity nonce:string cloud_project_number:int64 = FirebaseDeviceVerificationParameters; + + //@description Represents the current state of 2-step verification //@has_password True, if a 2-step verification password is set //@password_hint Hint for the password; may be empty @@ -227,10 +264,10 @@ inputFileRemote id:string = InputFile; //@description A file defined by a local path @path Local path to the file inputFileLocal path:string = InputFile; -//@description A file generated by the application -//@original_path Local path to a file from which the file is generated; may be empty if there is no such file +//@description A file generated by the application. The application must handle updates updateFileGenerationStart and updateFileGenerationStop to generate the file when asked by TDLib +//@original_path Local path to a file from which the file is generated. The path doesn't have to be a valid path and is used by TDLib only to detect name and MIME type of the generated file //@conversion String specifying the conversion applied to the original file; must be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage -//@expected_size Expected size of the generated file, in bytes; 0 if unknown +//@expected_size Expected size of the generated file, in bytes; pass 0 if unknown inputFileGenerated original_path:string conversion:string expected_size:int53 = InputFile; @@ -260,13 +297,13 @@ thumbnailFormatMpeg4 = ThumbnailFormat; //@description The thumbnail is in PNG format. It will be used only for background patterns thumbnailFormatPng = ThumbnailFormat; -//@description The thumbnail is in TGS format. It will be used only for TGS sticker sets +//@description The thumbnail is in TGS format. It will be used only for sticker sets thumbnailFormatTgs = ThumbnailFormat; -//@description The thumbnail is in WEBM format. It will be used only for WEBM sticker sets +//@description The thumbnail is in WEBM format. It will be used only for sticker sets thumbnailFormatWebm = ThumbnailFormat; -//@description The thumbnail is in WEBP format. It will be used only for some stickers +//@description The thumbnail is in WEBP format. It will be used only for some stickers and sticker sets thumbnailFormatWebp = ThumbnailFormat; @@ -312,7 +349,7 @@ stickerFormatTgs = StickerFormat; stickerFormatWebm = StickerFormat; -//@class StickerType @description Describes type of a sticker +//@class StickerType @description Describes type of sticker //@description The sticker is a regular sticker stickerTypeRegular = StickerType; @@ -338,20 +375,23 @@ stickerFullTypeMask mask_position:maskPosition = StickerFullType; stickerFullTypeCustomEmoji custom_emoji_id:int64 needs_repainting:Bool = StickerFullType; -//@description Represents a closed vector path. The path begins at the end point of the last command @commands List of vector path commands +//@description Represents a closed vector path. The path begins at the end point of the last command. The coordinate system origin is in the upper-left corner @commands List of vector path commands closedVectorPath commands:vector = ClosedVectorPath; +//@description Represents outline of an image @paths The list of closed vector paths +outline paths:vector = Outline; + //@description Describes one answer option of a poll -//@text Option text; 1-100 characters +//@text Option text; 1-100 characters. Only custom emoji entities are allowed //@voter_count Number of voters for this option, available only for closed or voted polls //@vote_percentage The percentage of votes for this option; 0-100 //@is_chosen True, if the option was chosen by the user //@is_being_chosen True, if the option is being chosen by a pending setPollAnswer request -pollOption text:string voter_count:int32 vote_percentage:int32 is_chosen:Bool is_being_chosen:Bool = PollOption; +pollOption text:formattedText voter_count:int32 vote_percentage:int32 is_chosen:Bool is_being_chosen:Bool = PollOption; -//@class PollType @description Describes the type of a poll +//@class PollType @description Describes the type of poll //@description A regular poll @allow_multiple_answers True, if multiple answer options can be chosen simultaneously pollTypeRegular allow_multiple_answers:Bool = PollType; @@ -362,6 +402,35 @@ pollTypeRegular allow_multiple_answers:Bool = PollType; pollTypeQuiz correct_option_id:int32 explanation:formattedText = PollType; +//@description Describes a task in a checklist +//@id Unique identifier of the task +//@text Text of the task; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Url, EmailAddress, Mention, Hashtag, Cashtag and PhoneNumber entities +//@completed_by Identifier of the user or chat that completed the task; may be null if the task isn't completed yet +//@completion_date Point in time (Unix timestamp) when the task was completed; 0 if the task isn't completed +checklistTask id:int32 text:formattedText completed_by:MessageSender completion_date:int32 = ChecklistTask; + +//@description Describes a task in a checklist to be sent +//@id Unique identifier of the task; must be positive +//@text Text of the task; 1-getOption("checklist_task_text_length_max") characters without line feeds. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +inputChecklistTask id:int32 text:formattedText = InputChecklistTask; + +//@description Describes a checklist +//@title Title of the checklist; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +//@tasks List of tasks in the checklist +//@others_can_add_tasks True, if users other than creator of the list can add tasks to the list +//@can_add_tasks True, if the current user can add tasks to the list if they have Telegram Premium subscription +//@others_can_mark_tasks_as_done True, if users other than creator of the list can mark tasks as done or not done. If true, then the checklist is called "group checklist" +//@can_mark_tasks_as_done True, if the current user can mark tasks as done or not done if they have Telegram Premium subscription +checklist title:formattedText tasks:vector others_can_add_tasks:Bool can_add_tasks:Bool others_can_mark_tasks_as_done:Bool can_mark_tasks_as_done:Bool = Checklist; + +//@description Describes a checklist to be sent +//@title Title of the checklist; 1-getOption("checklist_title_length_max") characters. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, and CustomEmoji entities +//@tasks List of tasks in the checklist; 1-getOption("checklist_task_count_max") tasks +//@others_can_add_tasks True, if other users can add tasks to the list +//@others_can_mark_tasks_as_done True, if other users can mark tasks as done or not done +inputChecklist title:formattedText tasks:vector others_can_add_tasks:Bool others_can_mark_tasks_as_done:Bool = InputChecklist; + + //@description Describes an animation file. The animation must be encoded in GIF or MPEG4 format //@duration Duration of the animation, in seconds; as defined by the sender //@width Width of the animation @@ -381,11 +450,14 @@ animation duration:int32 width:int32 height:int32 file_name:string mime_type:str //@file_name Original name of the file; as defined by the sender //@mime_type The MIME type of the file; as defined by the sender //@album_cover_minithumbnail The minithumbnail of the album cover; may be null -//@album_cover_thumbnail The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is supposed to be extracted from the downloaded audio file; may be null +//@album_cover_thumbnail The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is expected to be extracted from the downloaded audio file; may be null //@external_album_covers Album cover variants to use if the downloaded audio file contains no album cover. Provided thumbnail dimensions are approximate //@audio File containing the audio audio duration:int32 title:string performer:string file_name:string mime_type:string album_cover_minithumbnail:minithumbnail album_cover_thumbnail:thumbnail external_album_covers:vector audio:file = Audio; +//@description Contains a list of audio files @total_count Approximate total number of audio files found @audios List of audio files +audios total_count:int32 audios:vector