From dc00c91b86658ccc4592a50f4870133bfa157cc7 Mon Sep 17 00:00:00 2001 From: astra Date: Sun, 6 Oct 2024 18:09:53 +0100 Subject: [PATCH] update tdlib --- Makefile | 2 +- client/function.go | 5652 +++- client/type.go | 71163 +++++++++++++++++++++++----------------- client/unmarshaler.go | 30576 ++++++++++------- cmd/generate-json.go | 18 +- data/td_api.json | 10937 +++++- 6 files changed, 74564 insertions(+), 43784 deletions(-) diff --git a/Makefile b/Makefile index d8ac66a..b7b8938 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -TAG := 93c42f6d7c1209937431469f80427d48907f1b8d +TAG := d7203eb719304866a7eb7033ef03d421459335b8 schema-update: curl https://raw.githubusercontent.com/tdlib/td/${TAG}/td/generate/scheme/td_api.tl 2>/dev/null > ./data/td_api.tl diff --git a/client/function.go b/client/function.go index 0e9b236..0aeb7a0 100755 --- a/client/function.go +++ b/client/function.go @@ -71,7 +71,7 @@ type SetTdlibParametersRequest struct { DatabaseDirectory string `json:"database_directory"` // The path to the directory for storing files; if empty, database_directory will be used FilesDirectory string `json:"files_directory"` - // Encryption key for the database + // Encryption key for the database. If the encryption key is invalid, then an error with code 401 will be returned DatabaseEncryptionKey []byte `json:"database_encryption_key"` // Pass true to keep information about downloaded and uploaded files between application restarts UseFileDatabase bool `json:"use_file_database"` @@ -93,10 +93,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 @@ -106,22 +102,20 @@ func (client *Client) SetTdlibParameters(req *SetTdlibParametersRequest) (*Ok, e Type: "setTdlibParameters", }, Data: map[string]interface{}{ - "use_test_dc": req.UseTestDc, - "database_directory": req.DatabaseDirectory, - "files_directory": req.FilesDirectory, - "database_encryption_key": req.DatabaseEncryptionKey, - "use_file_database": req.UseFileDatabase, - "use_chat_info_database": req.UseChatInfoDatabase, - "use_message_database": req.UseMessageDatabase, - "use_secret_chats": req.UseSecretChats, - "api_id": req.ApiId, - "api_hash": req.ApiHash, - "system_language_code": req.SystemLanguageCode, - "device_model": req.DeviceModel, - "system_version": req.SystemVersion, - "application_version": req.ApplicationVersion, - "enable_storage_optimizer": req.EnableStorageOptimizer, - "ignore_file_names": req.IgnoreFileNames, + "use_test_dc": req.UseTestDc, + "database_directory": req.DatabaseDirectory, + "files_directory": req.FilesDirectory, + "database_encryption_key": req.DatabaseEncryptionKey, + "use_file_database": req.UseFileDatabase, + "use_chat_info_database": req.UseChatInfoDatabase, + "use_message_database": req.UseMessageDatabase, + "use_secret_chats": req.UseSecretChats, + "api_id": req.ApiId, + "api_hash": req.ApiHash, + "system_language_code": req.SystemLanguageCode, + "device_model": req.DeviceModel, + "system_version": req.SystemVersion, + "application_version": req.ApplicationVersion, }, }) if err != nil { @@ -142,7 +136,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 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 authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword func (client *Client) SetAuthenticationPhoneNumber(req *SetAuthenticationPhoneNumberRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -266,7 +260,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 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 authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword func (client *Client) RequestQrCodeAuthentication(req *RequestQrCodeAuthenticationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -292,6 +286,8 @@ type RegisterUserRequest struct { 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 @@ -301,8 +297,9 @@ func (client *Client) RegisterUser(req *RegisterUserRequest) (*Ok, error) { Type: "registerUser", }, Data: map[string]interface{}{ - "first_name": req.FirstName, - "last_name": req.LastName, + "first_name": req.FirstName, + "last_name": req.LastName, + "disable_notification": req.DisableNotification, }, }) if err != nil { @@ -316,6 +313,25 @@ func (client *Client) RegisterUser(req *RegisterUserRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +// Resets the login email address. May return an error with a message "TASK_ALREADY_EXISTS" if reset is still pending. Works only when the current authorization state is authorizationStateWaitEmailCode and authorization_state.can_reset_email_address == true +func (client *Client) ResetAuthenticationEmailAddress() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resetAuthenticationEmailAddress", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type CheckAuthenticationPasswordRequest struct { // The 2-step verification password to check Password string `json:"password"` @@ -419,6 +435,32 @@ func (client *Client) RecoverAuthenticationPassword(req *RecoverAuthenticationPa return UnmarshalOk(result.Data) } +type SendAuthenticationFirebaseSmsRequest struct { + // 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 phone number of the user. Works only when the current authorization state is authorizationStateWaitCode and the server returned code of the type authenticationCodeTypeFirebaseAndroid or authenticationCodeTypeFirebaseIos +func (client *Client) SendAuthenticationFirebaseSms(req *SendAuthenticationFirebaseSmsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendAuthenticationFirebaseSms", + }, + 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 CheckAuthenticationBotTokenRequest struct { // The bot token Token string `json:"token"` @@ -635,7 +677,7 @@ type SetLoginEmailAddressRequest struct { NewLoginEmailAddress string `json:"new_login_email_address"` } -// Changes the login email address of the user. 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. 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 func (client *Client) SetLoginEmailAddress(req *SetLoginEmailAddressRequest) (*EmailAddressAuthenticationCodeInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -801,6 +843,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{ @@ -1182,7 +1243,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 request if the current user is not a bot func (client *Client) GetChat(req *GetChatRequest) (*Chat, error) { result, err := client.Send(Request{ meta: meta{ @@ -1268,7 +1329,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, 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, the game message, the invoice message, the message with a previously set same background, the giveaway message, and the topic creation message for messages of the types messagePinMessage, messageGameScore, messagePaymentSuccessful, messageChatSetBackground, messagePremiumGiveawayCompleted and topic messages without non-bundled replied message respectively func (client *Client) GetRepliedMessage(req *GetRepliedMessageRequest) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1406,6 +1467,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 message.can_get_read_date == true and the message is read +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"` @@ -1414,7 +1522,7 @@ type GetMessageViewersRequest struct { } // 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 -func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*Users, error) { +func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*MessageViewers, error) { result, err := client.Send(Request{ meta: meta{ Type: "getMessageViewers", @@ -1432,7 +1540,7 @@ func (client *Client) GetMessageViewers(req *GetMessageViewersRequest) (*Users, return nil, buildResponseError(result.Data) } - return UnmarshalUsers(result.Data) + return UnmarshalMessageViewers(result.Data) } type GetFileRequest struct { @@ -1468,7 +1576,7 @@ type GetRemoteFileRequest struct { FileType FileType `json:"file_type"` } -// Returns information about a file by its remote ID; 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 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 func (client *Client) GetRemoteFile(req *GetRemoteFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -1553,7 +1661,7 @@ type SearchPublicChatRequest struct { Username string `json:"username"` } -// Searches a public chat by its username. Currently, only private chats, supergroups and channels can be public. Returns the chat if found; otherwise an error is returned +// Searches a public chat by its username. Currently, only private chats, supergroups and channels can be public. Returns the chat if found; otherwise, an error is returned func (client *Client) SearchPublicChat(req *SearchPublicChatRequest) (*Chat, error) { result, err := client.Send(Request{ meta: meta{ @@ -1607,7 +1715,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 request. 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{ @@ -1684,6 +1792,90 @@ func (client *Client) SearchChatsNearby(req *SearchChatsNearbyRequest) (*ChatsNe return UnmarshalChatsNearby(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{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(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 from 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 GetTopChatsRequest struct { // Category of chats to be returned Category TopChatCategory `json:"category"` @@ -1691,7 +1883,7 @@ type GetTopChatsRequest struct { Limit int32 `json:"limit"` } -// Returns a list of frequently used chats. Supported only if the chat info database is enabled +// Returns a list of frequently used chats func (client *Client) GetTopChats(req *GetTopChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -1742,6 +1934,35 @@ func (client *Client) RemoveTopChat(req *RemoveTopChatRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SearchRecentlyFoundChatsRequest struct { + // Query to search for + Query string `json:"query"` + // The maximum number of chats to be returned + 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 +func (client *Client) SearchRecentlyFoundChats(req *SearchRecentlyFoundChatsRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchRecentlyFoundChats", + }, + Data: map[string]interface{}{ + "query": req.Query, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + type AddRecentlyFoundChatRequest struct { // Identifier of the chat to add ChatId int64 `json:"chat_id"` @@ -1818,7 +2039,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 request. Returns chats in the order of last opening func (client *Client) GetRecentlyOpenedChats(req *GetRecentlyOpenedChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -1840,7 +2061,7 @@ func (client *Client) GetRecentlyOpenedChats(req *GetRecentlyOpenedChatsRequest) } type CheckChatUsernameRequest struct { - // Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if the chat is being created + // Chat identifier; must be identifier of a supergroup chat, or a channel chat, or a private chat with self, or 0 if the chat is being created ChatId int64 `json:"chat_id"` // Username to be checked Username string `json:"username"` @@ -1979,6 +2200,228 @@ 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 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 offset up to 99 to get additionally 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 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 a 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"` @@ -2016,7 +2459,7 @@ 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 offset up to 99 to get additionally 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 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"` @@ -2056,7 +2499,7 @@ 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 offset up to 99 to get additionally 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 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"` @@ -2154,7 +2597,7 @@ type SearchChatMessagesRequest struct { 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 offset 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 Limit int32 `json:"limit"` @@ -2162,6 +2605,8 @@ type SearchChatMessagesRequest struct { Filter SearchMessagesFilter `json:"filter"` // If not 0, only messages in the specified thread will be returned; supergroups only MessageThreadId int64 `json:"message_thread_id"` + // If not 0, only messages in the specified Saved Messages topic will be returned; pass 0 to return all messages, or for chats other than Saved Messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_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 @@ -2171,14 +2616,15 @@ func (client *Client) SearchChatMessages(req *SearchChatMessagesRequest) (*Found Type: "searchChatMessages", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, - "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, + "chat_id": req.ChatId, + "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, + "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -2274,6 +2720,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 offset 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 + 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"` @@ -2447,6 +2934,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 @@ -2456,10 +2945,11 @@ func (client *Client) GetChatSparseMessagePositions(req *GetChatSparseMessagePos Type: "getChatSparseMessagePositions", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, - "filter": req.Filter, - "from_message_id": req.FromMessageId, - "limit": req.Limit, + "chat_id": req.ChatId, + "filter": req.Filter, + "from_message_id": req.FromMessageId, + "limit": req.Limit, + "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -2480,6 +2970,8 @@ type GetChatMessageCalendarRequest struct { Filter SearchMessagesFilter `json:"filter"` // The message identifier from which to return information about messages; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` + // If not0, 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 information about the next messages of the specified type in the chat split by days. Returns the results in reverse chronological order. Can return partial result for the last returned day. Behavior of this method depends on the value of the option "utc_time_offset" @@ -2489,9 +2981,10 @@ func (client *Client) GetChatMessageCalendar(req *GetChatMessageCalendarRequest) Type: "getChatMessageCalendar", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, - "filter": req.Filter, - "from_message_id": req.FromMessageId, + "chat_id": req.ChatId, + "filter": req.Filter, + "from_message_id": req.FromMessageId, + "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -2510,6 +3003,8 @@ type GetChatMessageCountRequest struct { ChatId int64 `json:"chat_id"` // Filter for message content; searchMessagesFilterEmpty is unsupported in this function Filter SearchMessagesFilter `json:"filter"` + // If not 0, only messages in the specified Saved Messages topic will be counted; pass 0 to count all messages, or for chats other than Saved Messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_id"` // 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"` } @@ -2521,9 +3016,10 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou Type: "getChatMessageCount", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, - "filter": req.Filter, - "return_local": req.ReturnLocal, + "chat_id": req.ChatId, + "filter": req.Filter, + "saved_messages_topic_id": req.SavedMessagesTopicId, + "return_local": req.ReturnLocal, }, }) if err != nil { @@ -2546,6 +3042,8 @@ type GetChatMessagePositionRequest struct { Filter SearchMessagesFilter `json:"filter"` // If not 0, only messages in the specified thread will be considered; supergroups only MessageThreadId int64 `json:"message_thread_id"` + // If not 0, only messages in the specified Saved Messages topic will be considered; pass 0 to consider all relevant messages, or for chats other than Saved Messages + SavedMessagesTopicId int64 `json:"saved_messages_topic_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 @@ -2555,10 +3053,11 @@ func (client *Client) GetChatMessagePosition(req *GetChatMessagePositionRequest) Type: "getChatMessagePosition", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, - "message_id": req.MessageId, - "filter": req.Filter, - "message_thread_id": req.MessageThreadId, + "chat_id": req.ChatId, + "message_id": req.MessageId, + "filter": req.Filter, + "message_thread_id": req.MessageThreadId, + "saved_messages_topic_id": req.SavedMessagesTopicId, }, }) if err != nil { @@ -2598,41 +3097,6 @@ func (client *Client) GetChatScheduledMessages(req *GetChatScheduledMessagesRequ return UnmarshalMessages(result.Data) } -type GetMessagePublicForwardsRequest struct { - // Chat identifier of the message - ChatId int64 `json:"chat_id"` - // Message identifier - 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 - Limit int32 `json:"limit"` -} - -// Returns forwarded copies of a channel message to different public channels. For optimal performance, the number of returned messages is chosen by TDLib -func (client *Client) GetMessagePublicForwards(req *GetMessagePublicForwardsRequest) (*FoundMessages, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getMessagePublicForwards", - }, - Data: map[string]interface{}{ - "chat_id": req.ChatId, - "message_id": req.MessageId, - "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 GetChatSponsoredMessagesRequest struct { // Identifier of the chat ChatId int64 `json:"chat_id"` @@ -2659,6 +3123,85 @@ func (client *Client) GetChatSponsoredMessages(req *GetChatSponsoredMessagesRequ return UnmarshalSponsoredMessages(result.Data) } +type ClickChatSponsoredMessageRequest struct { + // Chat identifier of the sponsored message + ChatId int64 `json:"chat_id"` + // Identifier of the sponsored message + MessageId int64 `json:"message_id"` +} + +// Informs TDLib that the user opened the sponsored chat via the button, the name, the photo, or a mention 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, + }, + }) + 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) (ReportChatSponsoredMessageResult, 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 TypeReportChatSponsoredMessageResultOk: + return UnmarshalReportChatSponsoredMessageResultOk(result.Data) + + case TypeReportChatSponsoredMessageResultFailed: + return UnmarshalReportChatSponsoredMessageResultFailed(result.Data) + + case TypeReportChatSponsoredMessageResultOptionRequired: + return UnmarshalReportChatSponsoredMessageResultOptionRequired(result.Data) + + case TypeReportChatSponsoredMessageResultAdsHidden: + return UnmarshalReportChatSponsoredMessageResultAdsHidden(result.Data) + + case TypeReportChatSponsoredMessageResultPremiumRequired: + return UnmarshalReportChatSponsoredMessageResultPremiumRequired(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"` @@ -2722,7 +3265,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 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 web page preview MediaTimestamp int32 `json:"media_timestamp"` // Pass true to create a link for the whole media album ForAlbum bool `json:"for_album"` @@ -2815,23 +3358,20 @@ func (client *Client) GetMessageLinkInfo(req *GetMessageLinkInfoRequest) (*Messa type TranslateTextRequest struct { // Text to translate - Text string `json:"text"` - // A two-letter ISO 639-1 language code of the language from which the message is translated. If empty, the language will be detected automatically - FromLanguageCode string `json:"from_language_code"` - // A two-letter ISO 639-1 language code of the language to which the message is translated + Text *FormattedText `json:"text"` + // 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" ToLanguageCode string `json:"to_language_code"` } -// Translates a text to the given language. Returns a 404 error if the translation can't be performed -func (client *Client) TranslateText(req *TranslateTextRequest) (*Text, error) { +// Translates a text to the given language. If the current user is a Telegram Premium user, then text formatting is preserved +func (client *Client) TranslateText(req *TranslateTextRequest) (*FormattedText, error) { result, err := client.Send(Request{ meta: meta{ Type: "translateText", }, Data: map[string]interface{}{ - "text": req.Text, - "from_language_code": req.FromLanguageCode, - "to_language_code": req.ToLanguageCode, + "text": req.Text, + "to_language_code": req.ToLanguageCode, }, }) if err != nil { @@ -2842,7 +3382,39 @@ func (client *Client) TranslateText(req *TranslateTextRequest) (*Text, error) { return nil, buildResponseError(result.Data) } - return UnmarshalText(result.Data) + return UnmarshalFormattedText(result.Data) +} + +type TranslateMessageTextRequest struct { + // Identifier of the chat to which the message belongs + 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" + ToLanguageCode string `json:"to_language_code"` +} + +// Extracts text or caption of the given message and translates it to the given language. If the current user is a Telegram Premium user, then text formatting is preserved +func (client *Client) TranslateMessageText(req *TranslateMessageTextRequest) (*FormattedText, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "translateMessageText", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "to_language_code": req.ToLanguageCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFormattedText(result.Data) } type RecognizeSpeechRequest struct { @@ -2852,7 +3424,7 @@ type RecognizeSpeechRequest struct { MessageId int64 `json:"message_id"` } -// 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 +// Recognizes speech in a video note or a voice note message. The message must be successfully sent, must not be scheduled, and must be from a non-secret chat func (client *Client) RecognizeSpeech(req *RecognizeSpeechRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -2964,10 +3536,10 @@ 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 + // If not 0, the message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` - // Identifier of the replied message; 0 if none - ReplyToMessageId int64 `json:"reply_to_message_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 Options *MessageSendOptions `json:"options"` // Markup for replying to the message; pass null if none; for bots only @@ -2985,7 +3557,7 @@ func (client *Client) SendMessage(req *SendMessageRequest) (*Message, error) { Data: map[string]interface{}{ "chat_id": req.ChatId, "message_thread_id": req.MessageThreadId, - "reply_to_message_id": req.ReplyToMessageId, + "reply_to": req.ReplyTo, "options": req.Options, "reply_markup": req.ReplyMarkup, "input_message_content": req.InputMessageContent, @@ -3005,16 +3577,14 @@ 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 + // If not 0, the message thread identifier in which the messages will be sent MessageThreadId int64 `json:"message_thread_id"` - // Identifier of a replied message; 0 if none - ReplyToMessageId int64 `json:"reply_to_message_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 InputMessageContents []InputMessageContent `json:"input_message_contents"` - // Pass true to get fake messages instead of actually sending them - OnlyPreview bool `json:"only_preview"` } // Sends 2-10 messages grouped together into an album. 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 @@ -3026,10 +3596,9 @@ func (client *Client) SendMessageAlbum(req *SendMessageAlbumRequest) (*Messages, Data: map[string]interface{}{ "chat_id": req.ChatId, "message_thread_id": req.MessageThreadId, - "reply_to_message_id": req.ReplyToMessageId, + "reply_to": req.ReplyTo, "options": req.Options, "input_message_contents": req.InputMessageContents, - "only_preview": req.OnlyPreview, }, }) if err != nil { @@ -3052,7 +3621,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{ @@ -3078,15 +3647,15 @@ 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 + // If not 0, the message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` - // Identifier of a replied message; 0 if none - ReplyToMessageId int64 `json:"reply_to_message_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 Options *MessageSendOptions `json:"options"` // Identifier of the inline query QueryId JsonInt64 `json:"query_id"` - // Identifier of the inline result + // 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"` @@ -3099,13 +3668,13 @@ func (client *Client) SendInlineQueryResultMessage(req *SendInlineQueryResultMes Type: "sendInlineQueryResultMessage", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, - "reply_to_message_id": req.ReplyToMessageId, - "options": req.Options, - "query_id": req.QueryId, - "result_id": req.ResultId, - "hide_via_bot": req.HideViaBot, + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + "reply_to": req.ReplyTo, + "options": req.Options, + "query_id": req.QueryId, + "result_id": req.ResultId, + "hide_via_bot": req.HideViaBot, }, }) if err != nil { @@ -3122,11 +3691,11 @@ 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 + // If not 0, the message thread identifier in which the message will be sent; for forum threads only MessageThreadId int64 `json:"message_thread_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 + // 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 MessageIds []int64 `json:"message_ids"` // Options to be used to send the messages; pass null to use default options Options *MessageSendOptions `json:"options"` @@ -3134,8 +3703,6 @@ type ForwardMessagesRequest struct { 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"` - // Pass true to get fake messages instead of actually forwarding them - OnlyPreview bool `json:"only_preview"` } // Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message @@ -3152,7 +3719,38 @@ func (client *Client) ForwardMessages(req *ForwardMessagesRequest) (*Messages, e "options": req.Options, "send_copy": req.SendCopy, "remove_caption": req.RemoveCaption, - "only_preview": req.OnlyPreview, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + 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 +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 { @@ -3171,6 +3769,8 @@ type ResendMessagesRequest struct { 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 *InputTextQuote `json:"quote"` } // 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 @@ -3182,6 +3782,7 @@ func (client *Client) ResendMessages(req *ResendMessagesRequest) (*Messages, err Data: map[string]interface{}{ "chat_id": req.ChatId, "message_ids": req.MessageIds, + "quote": req.Quote, }, }) if err != nil { @@ -3195,39 +3796,13 @@ func (client *Client) ResendMessages(req *ResendMessagesRequest) (*Messages, err return UnmarshalMessages(result.Data) } -type SendChatScreenshotTakenNotificationRequest struct { - // Chat identifier - ChatId int64 `json:"chat_id"` -} - -// Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats -func (client *Client) SendChatScreenshotTakenNotification(req *SendChatScreenshotTakenNotificationRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "sendChatScreenshotTakenNotification", - }, - 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 AddLocalMessageRequest struct { // Target chat ChatId int64 `json:"chat_id"` // Identifier of the sender of the message SenderId MessageSender `json:"sender_id"` - // Identifier of the replied message; 0 if none - ReplyToMessageId int64 `json:"reply_to_message_id"` + // Information about the message or story 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"` // The content of the message to be added @@ -3243,7 +3818,7 @@ func (client *Client) AddLocalMessage(req *AddLocalMessageRequest) (*Message, er Data: map[string]interface{}{ "chat_id": req.ChatId, "sender_id": req.SenderId, - "reply_to_message_id": req.ReplyToMessageId, + "reply_to": req.ReplyTo, "disable_notification": req.DisableNotification, "input_message_content": req.InputMessageContent, }, @@ -3728,6 +4303,272 @@ func (client *Client) EditMessageSchedulingState(req *EditMessageSchedulingState 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"` + // 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, + "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"` + // Contents of messages to be sent. At most 10 messages can be added to an album + 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, + "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 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 (client *Client) CheckQuickReplyShortcutName(req *CheckQuickReplyShortcutNameRequest) (*Ok, error) { + result, err := client.jsonClient.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) +} + +// Loads quick reply shortcuts created by the current user. The loaded topics will be sent through 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) +} + // Returns list of custom emojis, which can be used as forum topic icon by all users func (client *Client) GetForumTopicDefaultIcons() (*Stickers, error) { result, err := client.Send(Request{ @@ -3756,7 +4597,7 @@ type CreateForumTopicRequest struct { 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; 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{ @@ -3792,7 +4633,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; requires can_manage_topics right in the supergroup unless the user is creator of the topic func (client *Client) EditForumTopic(req *EditForumTopicRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3957,7 +4798,7 @@ type ToggleForumTopicIsClosedRequest struct { IsClosed bool `json:"is_closed"` } -// Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup unless the user is creator of the topic +// Toggles whether a topic is closed in a forum supergroup chat; requires can_manage_topics right in the supergroup unless the user is creator of the topic func (client *Client) ToggleForumTopicIsClosed(req *ToggleForumTopicIsClosedRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3987,7 +4828,7 @@ type ToggleGeneralForumTopicIsHiddenRequest struct { IsHidden bool `json:"is_hidden"` } -// Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics administrator right in the supergroup +// Toggles whether a General topic is hidden in a forum supergroup chat; requires can_manage_topics right in the supergroup func (client *Client) ToggleGeneralForumTopicIsHidden(req *ToggleGeneralForumTopicIsHiddenRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4018,7 +4859,7 @@ type ToggleForumTopicIsPinnedRequest struct { 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 forum topic; requires can_manage_topics 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{ @@ -4048,7 +4889,7 @@ type SetPinnedForumTopicsRequest struct { MessageThreadIds []int64 `json:"message_thread_ids"` } -// Changes the order of pinned forum topics +// Changes the order of pinned forum topics; requires can_manage_topics right in the supergroup func (client *Client) SetPinnedForumTopics(req *SetPinnedForumTopicsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4104,7 +4945,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{ @@ -4204,11 +5045,11 @@ type AddMessageReactionRequest struct { 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{ @@ -4265,6 +5106,41 @@ func (client *Client) RemoveMessageReaction(req *RemoveMessageReactionRequest) ( 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 + 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"` @@ -4329,8 +5205,95 @@ 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 SearchQuoteRequest struct { + // Text in which to search for the quote + Text *FormattedText `json:"text"` + // Quote to search for + Quote *FormattedText `json:"quote"` + // Approximate quote position in UTF-16 code units + QuotePosition int32 `json:"quote_position"` +} + +// Searches for a given quote in a text. Returns found quote start position in UTF-16 code units. Returns a 404 error if the quote is not found. Can be called synchronously +func (client *Client) SearchQuote(req *SearchQuoteRequest) (*FoundPosition, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "searchQuote", + }, + Data: map[string]interface{}{ + "text": req.Text, + "quote": req.Quote, + "quote_position": req.QuotePosition, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundPosition(result.Data) +} + type GetTextEntitiesRequest struct { - // The text in which to look for entites + // The text in which to look for entities Text string `json:"text"` } @@ -4362,7 +5325,7 @@ type ParseTextEntitiesRequest struct { ParseMode TextParseMode `json:"parse_mode"` } -// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously +// Parses Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, BlockQuote, Code, Pre, PreCode, TextUrl and MentionName entities from a marked-up text. Can be called synchronously func (client *Client) ParseTextEntities(req *ParseTextEntitiesRequest) (*FormattedText, error) { result, err := client.jsonClient.Execute(Request{ meta: meta{ @@ -4436,6 +5399,32 @@ func (client *Client) GetMarkdownText(req *GetMarkdownTextRequest) (*FormattedTe return UnmarshalFormattedText(result.Data) } +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 (client *Client) GetCountryFlagEmoji(req *GetCountryFlagEmojiRequest) (*Text, error) { + result, err := client.jsonClient.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) +} + type GetFileMimeTypeRequest struct { // The name of the file or path to the file FileName string `json:"file_name"` @@ -4699,14 +5688,14 @@ type GetPollVotersRequest struct { MessageId int64 `json:"message_id"` // 0-based identifier of the answer option OptionId int32 `json:"option_id"` - // Number of users to skip in the result; must be non-negative + // Number of voters to skip in the result; must be non-negative Offset int32 `json:"offset"` - // The maximum number of users to be returned; must be positive and can't be greater than 50. For optimal performance, the number of returned users is chosen by TDLib and can be smaller than the specified limit, even if the end of the voter list has not been reached + // The maximum number of voters to be returned; must be positive and can't be greater than 50. For optimal performance, the number of returned voters is chosen by TDLib and can be smaller than the specified limit, even if the end of the voter list has not been reached Limit int32 `json:"limit"` } -// Returns users voted for the specified option in a non-anonymous polls. For optimal performance, the number of returned users is chosen by TDLib -func (client *Client) GetPollVoters(req *GetPollVotersRequest) (*Users, error) { +// Returns message senders voted for the specified option in a non-anonymous polls. For optimal performance, the number of returned users is chosen by TDLib +func (client *Client) GetPollVoters(req *GetPollVotersRequest) (*MessageSenders, error) { result, err := client.Send(Request{ meta: meta{ Type: "getPollVoters", @@ -4727,7 +5716,7 @@ func (client *Client) GetPollVoters(req *GetPollVotersRequest) (*Users, error) { return nil, buildResponseError(result.Data) } - return UnmarshalUsers(result.Data) + return UnmarshalMessageSenders(result.Data) } type StopPollRequest struct { @@ -4739,7 +5728,7 @@ type StopPollRequest struct { ReplyMarkup ReplyMarkup `json:"reply_markup"` } -// Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set +// Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag is set func (client *Client) StopPoll(req *StopPollRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4788,6 +5777,32 @@ func (client *Client) HideSuggestedAction(req *HideSuggestedActionRequest) (*Ok, 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"` @@ -4864,8 +5879,84 @@ func (client *Client) GetLoginUrl(req *GetLoginUrlRequest) (*HttpUrl, error) { return UnmarshalHttpUrl(result.Data) } +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"` + // 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 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: "shareUsersWithBot", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "button_id": req.ButtonId, + "shared_user_ids": req.SharedUserIds, + "only_check": req.OnlyCheck, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ShareChatWithBotRequest 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 chat + SharedChatId int64 `json:"shared_chat_id"` + // Pass true to check that the chat can be shared by the button instead of actually sharing it. Doesn't check bot_is_member and bot_administrator_rights restrictions. If the bot must be a member, then all chats from getGroupsInCommon and all chats, where the user can add the bot, are suitable. In the latter case the bot will be automatically added to the chat. If the bot must be an administrator, then all chats, where the bot already has requested rights or can be added to administrators by the user, are suitable. In the latter case the bot will be automatically granted requested rights + OnlyCheck bool `json:"only_check"` +} + +// Shares a chat after pressing a keyboardButtonTypeRequestChat button with the bot +func (client *Client) ShareChatWithBot(req *ShareChatWithBotRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "shareChatWithBot", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "button_id": req.ButtonId, + "shared_chat_id": req.SharedChatId, + "only_check": req.OnlyCheck, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetInlineQueryResultsRequest struct { - // The identifier of the target bot + // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` // Identifier of the chat where the query was sent ChatId int64 `json:"chat_id"` @@ -4873,7 +5964,7 @@ type GetInlineQueryResultsRequest struct { UserLocation *Location `json:"user_location"` // Text of the query Query string `json:"query"` - // Offset of the first entry to return + // Offset of the first entry to return; use empty string to get the first chunk of results Offset string `json:"offset"` } @@ -4907,16 +5998,14 @@ type AnswerInlineQueryRequest struct { 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 IsPersonal bool `json:"is_personal"` + // Button to be shown above inline query results; pass null if none + Button *InlineQueryResultsButton `json:"button"` // The results of the query Results []InputInlineQueryResult `json:"results"` // Allowed time to cache the results of the query, in seconds CacheTime int32 `json:"cache_time"` // Offset for the next inline query; pass an empty string if there are no more results NextOffset string `json:"next_offset"` - // If non-empty, this text must be shown on the button that opens a private chat with the bot and sends a start message to the bot with the parameter switch_pm_parameter - SwitchPmText string `json:"switch_pm_text"` - // The parameter for the bot start message - SwitchPmParameter string `json:"switch_pm_parameter"` } // Sets the result of an inline query; for bots only @@ -4926,13 +6015,12 @@ func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, err Type: "answerInlineQuery", }, Data: map[string]interface{}{ - "inline_query_id": req.InlineQueryId, - "is_personal": req.IsPersonal, - "results": req.Results, - "cache_time": req.CacheTime, - "next_offset": req.NextOffset, - "switch_pm_text": req.SwitchPmText, - "switch_pm_parameter": req.SwitchPmParameter, + "inline_query_id": req.InlineQueryId, + "is_personal": req.IsPersonal, + "button": req.Button, + "results": req.Results, + "cache_time": req.CacheTime, + "next_offset": req.NextOffset, }, }) if err != nil { @@ -4946,10 +6034,83 @@ func (client *Client) AnswerInlineQuery(req *AnswerInlineQueryRequest) (*Ok, err return UnmarshalOk(result.Data) } +type SearchWebAppRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // Short name of the Web App + WebAppShortName string `json:"web_app_short_name"` +} + +// Returns information about a Web App by its short name. Returns a 404 error if the Web App is not found +func (client *Client) SearchWebApp(req *SearchWebAppRequest) (*FoundWebApp, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "searchWebApp", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "web_app_short_name": req.WebAppShortName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundWebApp(result.Data) +} + +type GetWebAppLinkUrlRequest struct { + // Identifier of the chat in which the link was clicked; pass 0 if none + ChatId int64 `json:"chat_id"` + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // Short name of the Web App + 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"` +} + +// Returns an HTTPS URL of a Web App to open after a link of the type internalLinkTypeWebApp is clicked +func (client *Client) GetWebAppLinkUrl(req *GetWebAppLinkUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getWebAppLinkUrl", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "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, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type GetWebAppUrlRequest struct { // Identifier of the target bot BotUserId int64 `json:"bot_user_id"` - // The URL from the keyboardButtonTypeWebApp button + // 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"` @@ -4957,7 +6118,7 @@ type GetWebAppUrlRequest struct { ApplicationName string `json:"application_name"` } -// Returns an HTTPS URL of a Web App to open after keyboardButtonTypeWebApp button is pressed +// Returns an HTTPS URL of a Web App to open from the side menu, a keyboardButtonTypeWebApp button, an inlineQueryResultsButtonTypeWebApp button, or an internalLinkTypeSideMenuBot link func (client *Client) GetWebAppUrl(req *GetWebAppUrlRequest) (*HttpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -4986,7 +6147,7 @@ type SendWebAppDataRequest struct { BotUserId int64 `json:"bot_user_id"` // Text of the keyboardButtonTypeWebApp button, which opened the Web App ButtonText string `json:"button_text"` - // Received data + // The data Data string `json:"data"` } @@ -5014,36 +6175,36 @@ func (client *Client) SendWebAppData(req *SendWebAppDataRequest) (*Ok, error) { } type OpenWebAppRequest struct { - // Identifier of the chat in which the Web App is opened + // 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 BotUserId int64 `json:"bot_user_id"` - // The URL from an inlineKeyboardButtonTypeWebApp button, a botMenuButton button, or an internalLinkTypeAttachmentMenuBot link, or an empty string otherwise + // 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 + // If not 0, the message thread identifier in which the message will be sent MessageThreadId int64 `json:"message_thread_id"` - // Identifier of the replied message for the message sent by the Web App; 0 if none - ReplyToMessageId int64 `json:"reply_to_message_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"` } -// Informs TDLib that a Web App is being opened from 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 +// 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 func (client *Client) OpenWebApp(req *OpenWebAppRequest) (*WebAppInfo, error) { result, err := client.Send(Request{ meta: meta{ Type: "openWebApp", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, - "bot_user_id": req.BotUserId, - "url": req.Url, - "theme": req.Theme, - "application_name": req.ApplicationName, - "message_thread_id": req.MessageThreadId, - "reply_to_message_id": req.ReplyToMessageId, + "chat_id": req.ChatId, + "bot_user_id": req.BotUserId, + "url": req.Url, + "theme": req.Theme, + "application_name": req.ApplicationName, + "message_thread_id": req.MessageThreadId, + "reply_to": req.ReplyTo, }, }) if err != nil { @@ -5415,8 +6576,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 + // If not 0, the message thread identifier in which the action was performed MessageThreadId int64 `json:"message_thread_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"` } @@ -5428,9 +6591,10 @@ func (client *Client) SendChatAction(req *SendChatActionRequest) (*Ok, error) { Type: "sendChatAction", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, - "action": req.Action, + "chat_id": req.ChatId, + "message_thread_id": req.MessageThreadId, + "business_connection_id": req.BusinessConnectionId, + "action": req.Action, }, }) if err != nil { @@ -5499,10 +6663,10 @@ func (client *Client) CloseChat(req *CloseChatRequest) (*Ok, error) { type ViewMessagesRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // If not 0, a message thread identifier in which the messages are being viewed - MessageThreadId int64 `json:"message_thread_id"` // The identifiers of the messages being viewed 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 ForceRead bool `json:"force_read"` } @@ -5514,10 +6678,10 @@ func (client *Client) ViewMessages(req *ViewMessagesRequest) (*Ok, error) { Type: "viewMessages", }, Data: map[string]interface{}{ - "chat_id": req.ChatId, - "message_thread_id": req.MessageThreadId, - "message_ids": req.MessageIds, - "force_read": req.ForceRead, + "chat_id": req.ChatId, + "message_ids": req.MessageIds, + "source": req.Source, + "force_read": req.ForceRead, }, }) if err != nil { @@ -5589,6 +6753,35 @@ func (client *Client) ClickAnimatedEmojiMessage(req *ClickAnimatedEmojiMessageRe return UnmarshalSticker(result.Data) } +type GetInternalLinkRequest struct { + // Expected type of the link + Type InternalLinkType `json:"type"` + // Pass true to create an HTTPS link (only available for some link types); pass false to create a tg: link + IsHttp bool `json:"is_http"` +} + +// Returns an HTTPS or a tg: link with the given type. Can be called before authorization +func (client *Client) GetInternalLink(req *GetInternalLinkRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getInternalLink", + }, + Data: map[string]interface{}{ + "type": req.Type, + "is_http": req.IsHttp, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type GetInternalLinkTypeRequest struct { // The link Link string `json:"link"` @@ -5625,18 +6818,27 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeBackground: return UnmarshalInternalLinkTypeBackground(result.Data) + case TypeInternalLinkTypeBotAddToChannel: + return UnmarshalInternalLinkTypeBotAddToChannel(result.Data) + case TypeInternalLinkTypeBotStart: return UnmarshalInternalLinkTypeBotStart(result.Data) case TypeInternalLinkTypeBotStartInGroup: return UnmarshalInternalLinkTypeBotStartInGroup(result.Data) - case TypeInternalLinkTypeBotAddToChannel: - return UnmarshalInternalLinkTypeBotAddToChannel(result.Data) - case TypeInternalLinkTypeChangePhoneNumber: return UnmarshalInternalLinkTypeChangePhoneNumber(result.Data) + case TypeInternalLinkTypeChatBoost: + return UnmarshalInternalLinkTypeChatBoost(result.Data) + + case TypeInternalLinkTypeChatFolderInvite: + return UnmarshalInternalLinkTypeChatFolderInvite(result.Data) + + case TypeInternalLinkTypeChatFolderSettings: + return UnmarshalInternalLinkTypeChatFolderSettings(result.Data) + case TypeInternalLinkTypeChatInvite: return UnmarshalInternalLinkTypeChatInvite(result.Data) @@ -5646,9 +6848,6 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeEditProfileSettings: return UnmarshalInternalLinkTypeEditProfileSettings(result.Data) - case TypeInternalLinkTypeFilterSettings: - return UnmarshalInternalLinkTypeFilterSettings(result.Data) - case TypeInternalLinkTypeGame: return UnmarshalInternalLinkTypeGame(result.Data) @@ -5679,6 +6878,12 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypePremiumFeatures: return UnmarshalInternalLinkTypePremiumFeatures(result.Data) + case TypeInternalLinkTypePremiumGift: + return UnmarshalInternalLinkTypePremiumGift(result.Data) + + case TypeInternalLinkTypePremiumGiftCode: + return UnmarshalInternalLinkTypePremiumGiftCode(result.Data) + case TypeInternalLinkTypePrivacyAndSecuritySettings: return UnmarshalInternalLinkTypePrivacyAndSecuritySettings(result.Data) @@ -5697,9 +6902,15 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeSettings: return UnmarshalInternalLinkTypeSettings(result.Data) + case TypeInternalLinkTypeSideMenuBot: + return UnmarshalInternalLinkTypeSideMenuBot(result.Data) + case TypeInternalLinkTypeStickerSet: return UnmarshalInternalLinkTypeStickerSet(result.Data) + case TypeInternalLinkTypeStory: + return UnmarshalInternalLinkTypeStory(result.Data) + case TypeInternalLinkTypeTheme: return UnmarshalInternalLinkTypeTheme(result.Data) @@ -5721,6 +6932,9 @@ func (client *Client) GetInternalLinkType(req *GetInternalLinkTypeRequest) (Inte case TypeInternalLinkTypeVideoChat: return UnmarshalInternalLinkTypeVideoChat(result.Data) + case TypeInternalLinkTypeWebApp: + return UnmarshalInternalLinkTypeWebApp(result.Data) + default: return nil, errors.New("invalid type") } @@ -6014,7 +7228,7 @@ func (client *Client) CreateSecretChat(req *CreateSecretChatRequest) (*Chat, err } type CreateNewBasicGroupChatRequest struct { - // Identifiers of users to be added to the basic group + // Identifiers of users to be added to the basic group; may be empty to create a basic group without other members UserIds []int64 `json:"user_ids"` // Title of the new basic group; 1-128 characters Title string `json:"title"` @@ -6048,7 +7262,9 @@ func (client *Client) CreateNewBasicGroupChat(req *CreateNewBasicGroupChatReques type CreateNewSupergroupChatRequest struct { // Title of the new chat; 1-128 characters Title string `json:"title"` - // Pass true to create a channel chat + // Pass true to create a forum supergroup chat + IsForum bool `json:"is_forum"` + // Pass true to create a channel chat; ignored if a forum is created IsChannel bool `json:"is_channel"` // Chat description; 0-255 characters Description string `json:"description"` @@ -6056,7 +7272,7 @@ type CreateNewSupergroupChatRequest struct { Location *ChatLocation `json:"location"` // Message auto-delete time value, in seconds; must be from 0 up to 365 * 86400 and be divisible by 86400. If 0, then messages aren't deleted automatically MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` - // Pass true to create a supergroup for importing messages using importMessage + // Pass true to create a supergroup for importing messages using importMessages ForImport bool `json:"for_import"` } @@ -6068,6 +7284,7 @@ func (client *Client) CreateNewSupergroupChat(req *CreateNewSupergroupChatReques }, Data: map[string]interface{}{ "title": req.Title, + "is_forum": req.IsForum, "is_channel": req.IsChannel, "description": req.Description, "location": req.Location, @@ -6117,7 +7334,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{ @@ -6193,19 +7410,19 @@ func (client *Client) AddChatToList(req *AddChatToListRequest) (*Ok, error) { return UnmarshalOk(result.Data) } -type GetChatFilterRequest struct { - // Chat filter identifier - ChatFilterId int32 `json:"chat_filter_id"` +type GetChatFolderRequest struct { + // Chat folder identifier + ChatFolderId int32 `json:"chat_folder_id"` } -// Returns information about a chat filter by its identifier -func (client *Client) GetChatFilter(req *GetChatFilterRequest) (*ChatFilter, error) { +// Returns information about a chat folder by its identifier +func (client *Client) GetChatFolder(req *GetChatFolderRequest) (*ChatFolder, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getChatFilter", + Type: "getChatFolder", }, Data: map[string]interface{}{ - "chat_filter_id": req.ChatFilterId, + "chat_folder_id": req.ChatFolderId, }, }) if err != nil { @@ -6216,22 +7433,22 @@ func (client *Client) GetChatFilter(req *GetChatFilterRequest) (*ChatFilter, err return nil, buildResponseError(result.Data) } - return UnmarshalChatFilter(result.Data) + return UnmarshalChatFolder(result.Data) } -type CreateChatFilterRequest struct { - // Chat filter - Filter *ChatFilter `json:"filter"` +type CreateChatFolderRequest struct { + // The new chat folder + Folder *ChatFolder `json:"folder"` } -// Creates new chat filter. Returns information about the created chat filter. There can be up to getOption("chat_filter_count_max") chat filters, but the limit can be increased with Telegram Premium -func (client *Client) CreateChatFilter(req *CreateChatFilterRequest) (*ChatFilterInfo, error) { +// Creates new chat folder. Returns information about the created chat folder. There can be up to getOption("chat_folder_count_max") chat folders, but the limit can be increased with Telegram Premium +func (client *Client) CreateChatFolder(req *CreateChatFolderRequest) (*ChatFolderInfo, error) { result, err := client.Send(Request{ meta: meta{ - Type: "createChatFilter", + Type: "createChatFolder", }, Data: map[string]interface{}{ - "filter": req.Filter, + "folder": req.Folder, }, }) if err != nil { @@ -6242,25 +7459,25 @@ func (client *Client) CreateChatFilter(req *CreateChatFilterRequest) (*ChatFilte return nil, buildResponseError(result.Data) } - return UnmarshalChatFilterInfo(result.Data) + return UnmarshalChatFolderInfo(result.Data) } -type EditChatFilterRequest struct { - // Chat filter identifier - ChatFilterId int32 `json:"chat_filter_id"` - // The edited chat filter - Filter *ChatFilter `json:"filter"` +type EditChatFolderRequest struct { + // Chat folder identifier + ChatFolderId int32 `json:"chat_folder_id"` + // The edited chat folder + Folder *ChatFolder `json:"folder"` } -// Edits existing chat filter. Returns information about the edited chat filter -func (client *Client) EditChatFilter(req *EditChatFilterRequest) (*ChatFilterInfo, error) { +// Edits existing chat folder. Returns information about the edited chat folder +func (client *Client) EditChatFolder(req *EditChatFolderRequest) (*ChatFolderInfo, error) { result, err := client.Send(Request{ meta: meta{ - Type: "editChatFilter", + Type: "editChatFolder", }, Data: map[string]interface{}{ - "chat_filter_id": req.ChatFilterId, - "filter": req.Filter, + "chat_folder_id": req.ChatFolderId, + "folder": req.Folder, }, }) if err != nil { @@ -6271,22 +7488,25 @@ func (client *Client) EditChatFilter(req *EditChatFilterRequest) (*ChatFilterInf return nil, buildResponseError(result.Data) } - return UnmarshalChatFilterInfo(result.Data) + return UnmarshalChatFolderInfo(result.Data) } -type DeleteChatFilterRequest struct { - // Chat filter identifier - ChatFilterId int32 `json:"chat_filter_id"` +type DeleteChatFolderRequest struct { + // Chat folder identifier + ChatFolderId int32 `json:"chat_folder_id"` + // Identifiers of the chats to leave. The chats must be pinned or always included in the folder + LeaveChatIds []int64 `json:"leave_chat_ids"` } -// Deletes existing chat filter -func (client *Client) DeleteChatFilter(req *DeleteChatFilterRequest) (*Ok, error) { +// Deletes existing chat folder +func (client *Client) DeleteChatFolder(req *DeleteChatFolderRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "deleteChatFilter", + Type: "deleteChatFolder", }, Data: map[string]interface{}{ - "chat_filter_id": req.ChatFilterId, + "chat_folder_id": req.ChatFolderId, + "leave_chat_ids": req.LeaveChatIds, }, }) if err != nil { @@ -6300,21 +7520,73 @@ func (client *Client) DeleteChatFilter(req *DeleteChatFilterRequest) (*Ok, error return UnmarshalOk(result.Data) } -type ReorderChatFiltersRequest struct { - // Identifiers of chat filters in the new correct order - ChatFilterIds []int32 `json:"chat_filter_ids"` - // Position of the main chat list among chat filters, 0-based. Can be non-zero only for Premium users +type GetChatFolderChatsToLeaveRequest struct { + // Chat folder identifier + ChatFolderId int32 `json:"chat_folder_id"` +} + +// Returns identifiers of pinned or always included chats from a chat folder, which are suggested to be left when the chat folder is deleted +func (client *Client) GetChatFolderChatsToLeave(req *GetChatFolderChatsToLeaveRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatFolderChatsToLeave", + }, + Data: map[string]interface{}{ + "chat_folder_id": req.ChatFolderId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type GetChatFolderChatCountRequest struct { + // The new chat folder + Folder *ChatFolder `json:"folder"` +} + +// Returns approximate number of chats in a being created chat folder. Main and archive chat lists must be fully preloaded for this function to work correctly +func (client *Client) GetChatFolderChatCount(req *GetChatFolderChatCountRequest) (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatFolderChatCount", + }, + Data: map[string]interface{}{ + "folder": req.Folder, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + +type ReorderChatFoldersRequest struct { + // Identifiers of chat folders in the new correct order + ChatFolderIds []int32 `json:"chat_folder_ids"` + // Position of the main chat list among chat folders, 0-based. Can be non-zero only for Premium users MainChatListPosition int32 `json:"main_chat_list_position"` } -// Changes the order of chat filters -func (client *Client) ReorderChatFilters(req *ReorderChatFiltersRequest) (*Ok, error) { +// Changes the order of chat folders +func (client *Client) ReorderChatFolders(req *ReorderChatFoldersRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "reorderChatFilters", + Type: "reorderChatFolders", }, Data: map[string]interface{}{ - "chat_filter_ids": req.ChatFilterIds, + "chat_folder_ids": req.ChatFolderIds, "main_chat_list_position": req.MainChatListPosition, }, }) @@ -6329,11 +7601,37 @@ func (client *Client) ReorderChatFilters(req *ReorderChatFiltersRequest) (*Ok, e return UnmarshalOk(result.Data) } -// Returns recommended chat filters for the current user -func (client *Client) GetRecommendedChatFilters() (*RecommendedChatFilters, error) { +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: "getRecommendedChatFilters", + 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{ + meta: meta{ + Type: "getRecommendedChatFolders", }, Data: map[string]interface{}{}, }) @@ -6345,22 +7643,22 @@ func (client *Client) GetRecommendedChatFilters() (*RecommendedChatFilters, erro return nil, buildResponseError(result.Data) } - return UnmarshalRecommendedChatFilters(result.Data) + return UnmarshalRecommendedChatFolders(result.Data) } -type GetChatFilterDefaultIconNameRequest struct { - // Chat filter - Filter *ChatFilter `json:"filter"` +type GetChatFolderDefaultIconNameRequest struct { + // Chat folder + Folder *ChatFolder `json:"folder"` } -// Returns default icon name for a filter. Can be called synchronously -func (client *Client) GetChatFilterDefaultIconName(req *GetChatFilterDefaultIconNameRequest) (*Text, error) { +// Returns default icon name for a folder. Can be called synchronously +func (client *Client) GetChatFolderDefaultIconName(req *GetChatFolderDefaultIconNameRequest) (*ChatFolderIcon, error) { result, err := client.jsonClient.Execute(Request{ meta: meta{ - Type: "getChatFilterDefaultIconName", + Type: "getChatFolderDefaultIconName", }, Data: map[string]interface{}{ - "filter": req.Filter, + "folder": req.Folder, }, }) if err != nil { @@ -6371,7 +7669,310 @@ func (client *Client) GetChatFilterDefaultIconName(req *GetChatFilterDefaultIcon return nil, buildResponseError(result.Data) } - return UnmarshalText(result.Data) + return UnmarshalChatFolderIcon(result.Data) +} + +type GetChatsForChatFolderInviteLinkRequest struct { + // Chat folder identifier + ChatFolderId int32 `json:"chat_folder_id"` +} + +// Returns identifiers of chats from a chat folder, suitable for adding to a chat folder invite link +func (client *Client) GetChatsForChatFolderInviteLink(req *GetChatsForChatFolderInviteLinkRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatsForChatFolderInviteLink", + }, + Data: map[string]interface{}{ + "chat_folder_id": req.ChatFolderId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type CreateChatFolderInviteLinkRequest struct { + // Chat folder identifier + ChatFolderId int32 `json:"chat_folder_id"` + // Name of the link; 0-32 characters + Name string `json:"name"` + // Identifiers of chats to be accessible by the invite link. Use getChatsForChatFolderInviteLink to get suitable chats. Basic groups will be automatically converted to supergroups before link creation + ChatIds []int64 `json:"chat_ids"` +} + +// Creates a new invite link for a chat folder. A link can be created for a chat folder if it has only pinned and included chats +func (client *Client) CreateChatFolderInviteLink(req *CreateChatFolderInviteLinkRequest) (*ChatFolderInviteLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "createChatFolderInviteLink", + }, + Data: map[string]interface{}{ + "chat_folder_id": req.ChatFolderId, + "name": req.Name, + "chat_ids": req.ChatIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatFolderInviteLink(result.Data) +} + +type GetChatFolderInviteLinksRequest struct { + // Chat folder identifier + ChatFolderId int32 `json:"chat_folder_id"` +} + +// Returns invite links created by the current user for a shareable chat folder +func (client *Client) GetChatFolderInviteLinks(req *GetChatFolderInviteLinksRequest) (*ChatFolderInviteLinks, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatFolderInviteLinks", + }, + Data: map[string]interface{}{ + "chat_folder_id": req.ChatFolderId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatFolderInviteLinks(result.Data) +} + +type EditChatFolderInviteLinkRequest struct { + // Chat folder identifier + ChatFolderId int32 `json:"chat_folder_id"` + // Invite link to be edited + InviteLink string `json:"invite_link"` + // New name of the link; 0-32 characters + Name string `json:"name"` + // New identifiers of chats to be accessible by the invite link. Use getChatsForChatFolderInviteLink to get suitable chats. Basic groups will be automatically converted to supergroups before link editing + ChatIds []int64 `json:"chat_ids"` +} + +// Edits an invite link for a chat folder +func (client *Client) EditChatFolderInviteLink(req *EditChatFolderInviteLinkRequest) (*ChatFolderInviteLink, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editChatFolderInviteLink", + }, + Data: map[string]interface{}{ + "chat_folder_id": req.ChatFolderId, + "invite_link": req.InviteLink, + "name": req.Name, + "chat_ids": req.ChatIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatFolderInviteLink(result.Data) +} + +type DeleteChatFolderInviteLinkRequest struct { + // Chat folder identifier + ChatFolderId int32 `json:"chat_folder_id"` + // Invite link to be deleted + InviteLink string `json:"invite_link"` +} + +// Deletes an invite link for a chat folder +func (client *Client) DeleteChatFolderInviteLink(req *DeleteChatFolderInviteLinkRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteChatFolderInviteLink", + }, + Data: map[string]interface{}{ + "chat_folder_id": req.ChatFolderId, + "invite_link": req.InviteLink, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CheckChatFolderInviteLinkRequest struct { + // Invite link to be checked + InviteLink string `json:"invite_link"` +} + +// Checks the validity of an invite link for a chat folder and returns information about the corresponding chat folder +func (client *Client) CheckChatFolderInviteLink(req *CheckChatFolderInviteLinkRequest) (*ChatFolderInviteLinkInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkChatFolderInviteLink", + }, + Data: map[string]interface{}{ + "invite_link": req.InviteLink, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatFolderInviteLinkInfo(result.Data) +} + +type AddChatFolderByInviteLinkRequest struct { + // Invite link for the chat folder + InviteLink string `json:"invite_link"` + // Identifiers of the chats added to the chat folder. The chats are automatically joined if they aren't joined yet + ChatIds []int64 `json:"chat_ids"` +} + +// Adds a chat folder by an invite link +func (client *Client) AddChatFolderByInviteLink(req *AddChatFolderByInviteLinkRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addChatFolderByInviteLink", + }, + Data: map[string]interface{}{ + "invite_link": req.InviteLink, + "chat_ids": req.ChatIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetChatFolderNewChatsRequest struct { + // Chat folder identifier + ChatFolderId int32 `json:"chat_folder_id"` +} + +// Returns new chats added to a shareable chat folder by its owner. The method must be called at most once in getOption("chat_folder_new_chats_update_period") for the given chat folder +func (client *Client) GetChatFolderNewChats(req *GetChatFolderNewChatsRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatFolderNewChats", + }, + Data: map[string]interface{}{ + "chat_folder_id": req.ChatFolderId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type ProcessChatFolderNewChatsRequest struct { + // Chat folder identifier + ChatFolderId int32 `json:"chat_folder_id"` + // Identifiers of the new chats, which are added to the chat folder. The chats are automatically joined if they aren't joined yet + AddedChatIds []int64 `json:"added_chat_ids"` +} + +// Process new chats added to a shareable chat folder by its owner +func (client *Client) ProcessChatFolderNewChats(req *ProcessChatFolderNewChatsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "processChatFolderNewChats", + }, + Data: map[string]interface{}{ + "chat_folder_id": req.ChatFolderId, + "added_chat_ids": req.AddedChatIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns settings for automatic moving of chats to and from the Archive chat lists +func (client *Client) GetArchiveChatListSettings() (*ArchiveChatListSettings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getArchiveChatListSettings", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalArchiveChatListSettings(result.Data) +} + +type SetArchiveChatListSettingsRequest struct { + // New settings + Settings *ArchiveChatListSettings `json:"settings"` +} + +// Changes settings for automatic moving of chats to and from the Archive chat lists +func (client *Client) SetArchiveChatListSettings(req *SetArchiveChatListSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setArchiveChatListSettings", + }, + 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) } type SetChatTitleRequest struct { @@ -6381,7 +7982,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{ @@ -6410,7 +8011,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{ @@ -6432,6 +8033,70 @@ func (client *Client) SetChatPhoto(req *SetChatPhotoRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type SetChatAccentColorRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // 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 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 channel chat. Requires can_change_info administrator right +func (client *Client) SetChatAccentColor(req *SetChatAccentColorRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatAccentColor", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "accent_color_id": req.AccentColorId, + "background_custom_emoji_id": req.BackgroundCustomEmojiId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + 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"` @@ -6461,6 +8126,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"` @@ -6490,6 +8184,73 @@ func (client *Client) SetChatPermissions(req *SetChatPermissionsRequest) (*Ok, e return UnmarshalOk(result.Data) } +type SetChatBackgroundRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // 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 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. 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"` +} + +// 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{ + Type: "setChatBackground", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "background": req.Background, + "type": req.Type, + "dark_theme_dimming": req.DarkThemeDimming, + "only_for_self": req.OnlyForSelf, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + 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 SetChatThemeRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -6522,9 +8283,9 @@ 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 + // If not 0, the message thread identifier in which the draft was changed MessageThreadId int64 `json:"message_thread_id"` - // New draft message; pass null to remove the draft + // 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"` } @@ -6609,6 +8370,64 @@ 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"` + // New value of is_translatable + IsTranslatable bool `json:"is_translatable"` +} + +// Changes the translatable state of a chat +func (client *Client) ToggleChatIsTranslatable(req *ToggleChatIsTranslatableRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatIsTranslatable", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "is_translatable": req.IsTranslatable, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleChatIsMarkedAsUnreadRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -6670,11 +8489,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{ @@ -6732,7 +8551,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{ @@ -6755,7 +8574,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"` @@ -6819,7 +8638,7 @@ type SetChatSlowModeDelayRequest struct { 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 right func (client *Client) SetChatSlowModeDelay(req *SetChatSlowModeDelayRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6852,7 +8671,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; 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) PinChatMessage(req *PinChatMessageRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6883,7 +8702,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{ @@ -6910,7 +8729,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{ @@ -6938,7 +8757,7 @@ type UnpinAllMessageThreadMessagesRequest struct { MessageThreadId int64 `json:"message_thread_id"` } -// Removes all pinned messages from a forum topic; requires can_pin_messages rights in the supergroup +// Removes all pinned messages from a forum topic; requires can_pin_messages member right in the supergroup func (client *Client) UnpinAllMessageThreadMessages(req *UnpinAllMessageThreadMessagesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7021,7 +8840,7 @@ 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 +// Adds a new member to a chat; requires can_invite_users member right. Members can't be added to private or secret chats func (client *Client) AddChatMember(req *AddChatMemberRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7051,7 +8870,7 @@ 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 +// 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 func (client *Client) AddChatMembers(req *AddChatMembersRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7082,7 +8901,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{ @@ -7116,7 +8935,7 @@ type BanChatMemberRequest struct { 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{ @@ -7183,7 +9002,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{ @@ -7246,7 +9065,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{ @@ -7426,7 +9245,7 @@ type GetChatNotificationSettingsExceptionsRequest struct { CompareSound bool `json:"compare_sound"` } -// Returns list of chats with non-default notification settings +// Returns 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{ @@ -7583,12 +9402,1016 @@ func (client *Client) SetPinnedChats(req *SetPinnedChatsRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type ReadChatListRequest struct { + // Chat list in which to mark all chats as read + ChatList ChatList `json:"chat_list"` +} + +// Traverse 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{ + Type: "readChatList", + }, + Data: map[string]interface{}{ + "chat_list": req.ChatList, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetStoryRequest struct { + // Identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_chat_id"` + // Story identifier + StoryId int32 `json:"story_id"` + // Pass true to get only locally available information without sending network requests + OnlyLocal bool `json:"only_local"` +} + +// Returns a story +func (client *Client) GetStory(req *GetStoryRequest) (*Story, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStory", + }, + Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, + "story_id": req.StoryId, + "only_local": req.OnlyLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStory(result.Data) +} + +// Returns supergroup and 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) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatsToSendStories", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type CanSendStoryRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Checks whether the current user can send a story on behalf of a chat; requires can_post_stories right for supergroup and channel chats +func (client *Client) CanSendStory(req *CanSendStoryRequest) (CanSendStoryResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "canSendStory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeCanSendStoryResultOk: + return UnmarshalCanSendStoryResultOk(result.Data) + + case TypeCanSendStoryResultPremiumNeeded: + return UnmarshalCanSendStoryResultPremiumNeeded(result.Data) + + case TypeCanSendStoryResultBoostNeeded: + return UnmarshalCanSendStoryResultBoostNeeded(result.Data) + + case TypeCanSendStoryResultActiveStoryLimitExceeded: + return UnmarshalCanSendStoryResultActiveStoryLimitExceeded(result.Data) + + case TypeCanSendStoryResultWeeklyLimitExceeded: + return UnmarshalCanSendStoryResultWeeklyLimitExceeded(result.Data) + + case TypeCanSendStoryResultMonthlyLimitExceeded: + return UnmarshalCanSendStoryResultMonthlyLimitExceeded(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type SendStoryRequest struct { + // Identifier of the chat that will post the story + 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; can have entities only if getOption("can_use_text_entities_in_story_caption") + Caption *FormattedText `json:"caption"` + // The privacy settings for the story; ignored for stories sent to supergroup and channel chats + PrivacySettings StoryPrivacySettings `json:"privacy_settings"` + // 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 + FromStoryFullId *StoryFullId `json:"from_story_full_id"` + // Pass true to keep the story accessible after expiration + IsPinned bool `json:"is_pinned"` + // 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 right for supergroup and channel chats. Returns a temporary story +func (client *Client) SendStory(req *SendStoryRequest) (*Story, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendStory", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "content": req.Content, + "areas": req.Areas, + "caption": req.Caption, + "privacy_settings": req.PrivacySettings, + "active_period": req.ActivePeriod, + "from_story_full_id": req.FromStoryFullId, + "is_pinned": req.IsPinned, + "protect_content": req.ProtectContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStory(result.Data) +} + +type EditStoryRequest struct { + // Identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_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 + Content InputStoryContent `json:"content"` + // New clickable rectangle areas to be shown on the story media; pass null to keep the current areas. Areas can't be edited if story content isn't changed + Areas *InputStoryAreas `json:"areas"` + // New story caption; pass null to keep the current caption + Caption *FormattedText `json:"caption"` +} + +// Changes content and caption of a story. Can be called only if story.can_be_edited == true +func (client *Client) EditStory(req *EditStoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editStory", + }, + Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, + "story_id": req.StoryId, + "content": req.Content, + "areas": req.Areas, + "caption": req.Caption, + }, + }) + 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 + PrivacySettings StoryPrivacySettings `json:"privacy_settings"` +} + +// Changes privacy settings of a story. The method can be called only for stories posted on behalf of the current user and if story.can_be_edited == true +func (client *Client) SetStoryPrivacySettings(req *SetStoryPrivacySettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStoryPrivacySettings", + }, + Data: map[string]interface{}{ + "story_id": req.StoryId, + "privacy_settings": req.PrivacySettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleStoryIsPinnedRequest struct { + // Identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_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"` +} + +// 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) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleStoryIsPinned", + }, + Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, + "story_id": req.StoryId, + "is_pinned": req.IsPinned, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteStoryRequest struct { + // Identifier of the chat that posted the story + StorySenderChatId int64 `json:"story_sender_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 +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_id": req.StoryId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns list of chats with non-default notification settings for stories +func (client *Client) GetStoryNotificationSettingsExceptions() (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStoryNotificationSettingsExceptions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + +type LoadActiveStoriesRequest struct { + // The story list in which to load active stories + 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 +func (client *Client) LoadActiveStories(req *LoadActiveStoriesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "loadActiveStories", + }, + Data: map[string]interface{}{ + "story_list": req.StoryList, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetChatActiveStoriesListRequest struct { + // Identifier of the chat that posted stories + ChatId int64 `json:"chat_id"` + // New list for active stories posted by the chat + StoryList StoryList `json:"story_list"` +} + +// Changes story list in which stories from the chat are shown +func (client *Client) SetChatActiveStoriesList(req *SetChatActiveStoriesListRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatActiveStoriesList", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "story_list": req.StoryList, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetChatActiveStoriesRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` +} + +// Returns the list of active stories posted by the given chat +func (client *Client) GetChatActiveStories(req *GetChatActiveStoriesRequest) (*ChatActiveStories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatActiveStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatActiveStories(result.Data) +} + +type GetChatPinnedStoriesRequest 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 + 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 + 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) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatPinnedStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "from_story_id": req.FromStoryId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStories(result.Data) +} + +type GetChatArchivedStoriesRequest 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 + 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 + Limit int32 `json:"limit"` +} + +// Returns the list of all stories posted by the given chat; requires can_edit_stories right in the 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) GetChatArchivedStories(req *GetChatArchivedStoriesRequest) (*Stories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatArchivedStories", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "from_story_id": req.FromStoryId, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStories(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 story + StoryId int32 `json:"story_id"` +} + +// Informs TDLib that a story is opened and is being viewed by the user +func (client *Client) OpenStory(req *OpenStoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "openStory", + }, + Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, + "story_id": req.StoryId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type CloseStoryRequest struct { + // The identifier of the sender of the story to close + StorySenderChatId int64 `json:"story_sender_chat_id"` + // The identifier of the story + StoryId int32 `json:"story_id"` +} + +// Informs TDLib that a story is closed by the user +func (client *Client) CloseStory(req *CloseStoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "closeStory", + }, + Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, + "story_id": req.StoryId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetStoryAvailableReactionsRequest struct { + // Number of reaction per row, 5-25 + RowSize int32 `json:"row_size"` +} + +// Returns reactions, which can be chosen for a story +func (client *Client) GetStoryAvailableReactions(req *GetStoryAvailableReactionsRequest) (*AvailableReactions, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getStoryAvailableReactions", + }, + Data: map[string]interface{}{ + "row_size": req.RowSize, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAvailableReactions(result.Data) +} + +type SetStoryReactionRequest struct { + // The identifier of the sender of the story + StorySenderChatId int64 `json:"story_sender_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 + 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 that has already been sent +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_id": req.StoryId, + "reaction_type": req.ReactionType, + "update_recent_reactions": req.UpdateRecentReactions, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetStoryInteractionsRequest struct { + // Story identifier + StoryId int32 `json:"story_id"` + // 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 interactions by contacts; pass false to get all relevant interactions + OnlyContacts bool `json:"only_contacts"` + // 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 interactions to return + Limit int32 `json:"limit"` +} + +// 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: "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, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStoryInteractions(result.Data) +} + +type GetChatStoryInteractionsRequest struct { + // The identifier of the sender of the story + StorySenderChatId int64 `json:"story_sender_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 + 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_sender_chat_id": req.StorySenderChatId, + "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 story to report + StoryId int32 `json:"story_id"` + // The reason for reporting the story + Reason ReportReason `json:"reason"` + // Additional report details; 0-1024 characters + Text string `json:"text"` +} + +// Reports a story to the Telegram moderators +func (client *Client) ReportStory(req *ReportStoryRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reportStory", + }, + Data: map[string]interface{}{ + "story_sender_chat_id": req.StorySenderChatId, + "story_id": req.StoryId, + "reason": req.Reason, + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// 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 +func (client *Client) ActivateStoryStealthMode() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "activateStoryStealthMode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetStoryPublicForwardsRequest struct { + // The identifier of the sender of the story + StorySenderChatId int64 `json:"story_sender_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_sender_chat_id": req.StorySenderChatId, + "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 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 list of features available on the specific chat boost level; this is an offline request +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 list of features available on the first 10 chat boost levels; this is an offline request +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{ + meta: meta{ + Type: "getAvailableChatBoostSlots", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostSlots(result.Data) +} + +type GetChatBoostStatusRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` +} + +// 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{ + Type: "getChatBoostStatus", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostStatus(result.Data) +} + +type BoostChatRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Identifiers of boost slots of the current user from which to apply boosts to the chat + SlotIds []int32 `json:"slot_ids"` +} + +// Boosts a chat and returns the list of available chat boost slots for the current user after the boost +func (client *Client) BoostChat(req *BoostChatRequest) (*ChatBoostSlots, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "boostChat", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "slot_ids": req.SlotIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostSlots(result.Data) +} + +type GetChatBoostLinkRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` +} + +// 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{ + Type: "getChatBoostLink", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostLink(result.Data) +} + +type GetChatBoostLinkInfoRequest struct { + // The link to boost a chat + Url string `json:"url"` +} + +// Returns information about a link to boost a chat. Can be called for any internal link of the type internalLinkTypeChatBoost +func (client *Client) GetChatBoostLinkInfo(req *GetChatBoostLinkInfoRequest) (*ChatBoostLinkInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatBoostLinkInfo", + }, + Data: map[string]interface{}{ + "url": req.Url, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChatBoostLinkInfo(result.Data) +} + +type GetChatBoostsRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Pass true to receive only boosts received from gift codes and giveaways created by the chat + OnlyGiftCodes bool `json:"only_gift_codes"` + // 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 boosts to be returned; up to 100. For optimal performance, the number of returned boosts can be smaller than the specified limit + Limit int32 `json:"limit"` +} + +// Returns 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{ + Type: "getChatBoosts", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "only_gift_codes": req.OnlyGiftCodes, + "offset": req.Offset, + "limit": req.Limit, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundChatBoosts(result.Data) +} + +type GetUserChatBoostsRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Identifier of the user + UserId int64 `json:"user_id"` +} + +// Returns 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{ + Type: "getUserChatBoosts", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "user_id": req.UserId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundChatBoosts(result.Data) +} + type GetAttachmentMenuBotRequest struct { // Bot's user identifier BotUserId int64 `json:"bot_user_id"` } -// Returns information about a bot that can be added to attachment menu +// Returns information about a bot that can be added to attachment or side menu func (client *Client) GetAttachmentMenuBot(req *GetAttachmentMenuBotRequest) (*AttachmentMenuBot, error) { result, err := client.Send(Request{ meta: meta{ @@ -7618,7 +10441,7 @@ type ToggleBotIsAddedToAttachmentMenuRequest struct { AllowWriteAccess bool `json:"allow_write_access"` } -// Adds or removes a bot to attachment menu. Bot can be added to attachment menu, only if userTypeBot.can_be_added_to_attachment_menu == true +// Adds or removes a bot to attachment and side menu. Bot can be added to the menu, only if userTypeBot.can_be_added_to_attachment_menu == true func (client *Client) ToggleBotIsAddedToAttachmentMenu(req *ToggleBotIsAddedToAttachmentMenuRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7641,7 +10464,7 @@ 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 +// 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() (*EmojiStatuses, error) { result, err := client.Send(Request{ meta: meta{ @@ -7660,7 +10483,7 @@ func (client *Client) GetThemedEmojiStatuses() (*EmojiStatuses, error) { return UnmarshalEmojiStatuses(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{ @@ -7679,7 +10502,7 @@ func (client *Client) GetRecentEmojiStatuses() (*EmojiStatuses, error) { return UnmarshalEmojiStatuses(result.Data) } -// Returns default emoji statuses +// Returns default emoji statuses for self status func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatuses, error) { result, err := client.Send(Request{ meta: meta{ @@ -7698,7 +10521,7 @@ func (client *Client) GetDefaultEmojiStatuses() (*EmojiStatuses, error) { return UnmarshalEmojiStatuses(result.Data) } -// Clears the list of recently used emoji statuses +// Clears the list of recently used emoji statuses for self status func (client *Client) ClearRecentEmojiStatuses() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -7717,6 +10540,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() (*EmojiStatuses, 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 UnmarshalEmojiStatuses(result.Data) +} + +// Returns default emoji statuses for chats +func (client *Client) GetDefaultChatEmojiStatuses() (*EmojiStatuses, 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 UnmarshalEmojiStatuses(result.Data) +} + +// Returns the list of emoji statuses, which can't be used as chat emoji status, even they are from a sticker set with is_allowed_as_chat_emoji_status == true +func (client *Client) GetDisallowedChatEmojiStatuses() (*EmojiStatuses, 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 UnmarshalEmojiStatuses(result.Data) +} + type DownloadFileRequest struct { // Identifier of the file to download FileId int32 `json:"file_id"` @@ -7851,7 +10731,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 +// 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 is sent in a message func (client *Client) PreliminaryUploadFile(req *PreliminaryUploadFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ @@ -8279,7 +11159,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"` } @@ -8305,7 +11185,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"` @@ -9096,11 +11976,11 @@ type CreateVideoChatRequest struct { 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 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; requires owner privileges 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{ @@ -9129,7 +12009,7 @@ type GetVideoChatRtmpUrlRequest struct { ChatId int64 `json:"chat_id"` } -// Returns RTMP URL for streaming to the chat; requires creator privileges +// Returns RTMP URL for streaming to the chat; requires owner privileges func (client *Client) GetVideoChatRtmpUrl(req *GetVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -9155,7 +12035,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 chat; requires owner privileges func (client *Client) ReplaceVideoChatRtmpUrl(req *ReplaceVideoChatRtmpUrlRequest) (*RtmpUrl, error) { result, err := client.Send(Request{ meta: meta{ @@ -9235,7 +12115,7 @@ type ToggleGroupCallEnabledStartNotificationRequest struct { 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 +// Toggles whether the current user will receive a notification when the group call starts; scheduled group calls only func (client *Client) ToggleGroupCallEnabledStartNotification(req *ToggleGroupCallEnabledStartNotificationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -9453,7 +12333,7 @@ type InviteGroupCallParticipantsRequest struct { UserIds []int64 `json:"user_ids"` } -// Invites users to an active group call. Sends a service message of type messageInviteToGroupCall for video chats +// 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) { result, err := client.Send(Request{ meta: meta{ @@ -9686,7 +12566,7 @@ type ToggleGroupCallParticipantIsMutedRequest struct { GroupCallId int32 `json:"group_call_id"` // Participant identifier ParticipantId MessageSender `json:"participant_id"` - // Pass true to mute the user; pass false to unmute the them + // Pass true to mute the user; pass false to unmute them IsMuted bool `json:"is_muted"` } @@ -9922,22 +12802,22 @@ func (client *Client) GetGroupCallStreamSegment(req *GetGroupCallStreamSegmentRe return UnmarshalFilePart(result.Data) } -type ToggleMessageSenderIsBlockedRequest struct { +type SetMessageSenderBlockListRequest struct { // Identifier of a message sender to block/unblock SenderId MessageSender `json:"sender_id"` - // New value of is_blocked - IsBlocked bool `json:"is_blocked"` + // New block list for the message sender; pass null to unblock the message sender + BlockList BlockList `json:"block_list"` } -// Changes the block state of a message sender. Currently, only users and supergroup chats can be blocked -func (client *Client) ToggleMessageSenderIsBlocked(req *ToggleMessageSenderIsBlockedRequest) (*Ok, error) { +// Changes the block list of a message sender. Currently, only users and supergroup chats can be blocked +func (client *Client) SetMessageSenderBlockList(req *SetMessageSenderBlockListRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "toggleMessageSenderIsBlocked", + Type: "setMessageSenderBlockList", }, Data: map[string]interface{}{ "sender_id": req.SenderId, - "is_blocked": req.IsBlocked, + "block_list": req.BlockList, }, }) if err != nil { @@ -9987,6 +12867,8 @@ func (client *Client) BlockMessageSenderFromReplies(req *BlockMessageSenderFromR } type GetBlockedMessageSendersRequest struct { + // Block list from which to return users + BlockList BlockList `json:"block_list"` // Number of users and chats to skip in the result; must be non-negative Offset int32 `json:"offset"` // The maximum number of users and chats to return; up to 100 @@ -10000,8 +12882,9 @@ func (client *Client) GetBlockedMessageSenders(req *GetBlockedMessageSendersRequ Type: "getBlockedMessageSenders", }, Data: map[string]interface{}{ - "offset": req.Offset, - "limit": req.Limit, + "block_list": req.BlockList, + "offset": req.Offset, + "limit": req.Limit, }, }) if err != nil { @@ -10070,7 +12953,7 @@ func (client *Client) ImportContacts(req *ImportContactsRequest) (*ImportedConta return UnmarshalImportedContacts(result.Data) } -// Returns all user contacts +// Returns all contacts of the user func (client *Client) GetContacts() (*Users, error) { result, err := client.Send(Request{ meta: meta{ @@ -10208,6 +13091,51 @@ func (client *Client) ClearImportedContacts() (*Ok, error) { return UnmarshalOk(result.Data) } +type SetCloseFriendsRequest struct { + // User identifiers of close friends; the users must be contacts of the current user + UserIds []int64 `json:"user_ids"` +} + +// Changes the list of close friends of the current user +func (client *Client) SetCloseFriends(req *SetCloseFriendsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setCloseFriends", + }, + Data: map[string]interface{}{ + "user_ids": req.UserIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns all close friends of the current user +func (client *Client) GetCloseFriends() (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCloseFriends", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + type SetUserPersonalProfilePhotoRequest struct { // User identifier UserId int64 `json:"user_id"` @@ -10353,7 +13281,7 @@ func (client *Client) GetUserProfilePhotos(req *GetUserProfilePhotosRequest) (*C type GetStickersRequest struct { // Type of the stickers to return StickerType StickerType `json:"sticker_type"` - // Search query; an emoji or a keyword prefix. If empty, returns all known installed stickers + // Search query; a space-separated list of emoji 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"` @@ -10361,7 +13289,7 @@ type GetStickersRequest struct { ChatId int64 `json:"chat_id"` } -// Returns stickers from the installed sticker sets that correspond to a given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned +// Returns stickers from the installed sticker sets that correspond to any of the given emoji or can be found by sticker-specific keywords. If the query is non-empty, then favorite, recently used or trending stickers may also be returned func (client *Client) GetStickers(req *GetStickersRequest) (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ @@ -10385,22 +13313,60 @@ func (client *Client) GetStickers(req *GetStickersRequest) (*Stickers, error) { return UnmarshalStickers(result.Data) } +type GetAllStickerEmojisRequest struct { + // Type of the stickers to search for + StickerType StickerType `json:"sticker_type"` + // Search query + Query string `json:"query"` + // Chat identifier for which to find stickers + ChatId int64 `json:"chat_id"` + // Pass true if only main emoji for each found sticker must be included in the result + ReturnOnlyMainEmoji bool `json:"return_only_main_emoji"` +} + +// Returns unique emoji that correspond to stickers to be found by the getStickers(sticker_type, query, 1000000, chat_id) +func (client *Client) GetAllStickerEmojis(req *GetAllStickerEmojisRequest) (*Emojis, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAllStickerEmojis", + }, + Data: map[string]interface{}{ + "sticker_type": req.StickerType, + "query": req.Query, + "chat_id": req.ChatId, + "return_only_main_emoji": req.ReturnOnlyMainEmoji, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojis(result.Data) +} + type SearchStickersRequest struct { - // String representation of emoji; must be non-empty - Emoji string `json:"emoji"` + // Type of the stickers to return + StickerType StickerType `json:"sticker_type"` + // Space-separated list of emoji to search for; must be non-empty + Emojis string `json:"emojis"` // The maximum number of stickers to be returned; 0-100 Limit int32 `json:"limit"` } -// Searches for stickers from public sticker sets that correspond to a given emoji +// Searches for stickers from public sticker sets that correspond to any of the given emoji func (client *Client) SearchStickers(req *SearchStickersRequest) (*Stickers, error) { result, err := client.Send(Request{ meta: meta{ Type: "searchStickers", }, Data: map[string]interface{}{ - "emoji": req.Emoji, - "limit": req.Limit, + "sticker_type": req.StickerType, + "emojis": req.Emojis, + "limit": req.Limit, }, }) if err != nil { @@ -10469,7 +13435,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"` @@ -10641,18 +13607,21 @@ 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{}{ - "query": req.Query, + "sticker_type": req.StickerType, + "query": req.Query, }, }) if err != nil { @@ -10786,7 +13755,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{ @@ -10887,7 +13856,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{ @@ -10963,21 +13932,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"` +} + +// Return 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, }, }) @@ -10992,6 +13987,32 @@ func (client *Client) SearchEmojis(req *SearchEmojisRequest) (*Emojis, error) { return UnmarshalEmojis(result.Data) } +type GetEmojiCategoriesRequest struct { + // Type of emoji categories to return; pass null to get default emoji categories + Type EmojiCategoryType `json:"type"` +} + +// Returns available emojis categories +func (client *Client) GetEmojiCategories(req *GetEmojiCategoriesRequest) (*EmojiCategories, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getEmojiCategories", + }, + Data: map[string]interface{}{ + "type": req.Type, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmojiCategories(result.Data) +} + type GetAnimatedEmojiRequest struct { // The emoji Emoji string `json:"emoji"` @@ -11070,6 +14091,63 @@ func (client *Client) GetCustomEmojiStickers(req *GetCustomEmojiStickersRequest) return UnmarshalStickers(result.Data) } +// Returns default list of custom emoji stickers for placing on a chat photo +func (client *Client) GetDefaultChatPhotoCustomEmojiStickers() (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDefaultChatPhotoCustomEmojiStickers", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + +// Returns default list of custom emoji stickers for placing on a profile photo +func (client *Client) GetDefaultProfilePhotoCustomEmojiStickers() (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDefaultProfilePhotoCustomEmojiStickers", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + +// Returns default list of custom emoji stickers for reply background +func (client *Client) GetDefaultBackgroundCustomEmojiStickers() (*Stickers, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDefaultBackgroundCustomEmojiStickers", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalStickers(result.Data) +} + // Returns saved animations func (client *Client) GetSavedAnimations() (*Animations, error) { result, err := client.Send(Request{ @@ -11218,16 +14296,19 @@ func (client *Client) RemoveRecentHashtag(req *RemoveRecentHashtagRequest) (*Ok, type GetWebPagePreviewRequest 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 + LinkPreviewOptions *LinkPreviewOptions `json:"link_preview_options"` } -// Returns a web page preview by the text of the message. Do not call this function too often. Returns a 404 error if the web page has no preview +// 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) { result, err := client.Send(Request{ meta: meta{ Type: "getWebPagePreview", }, Data: map[string]interface{}{ - "text": req.Text, + "text": req.Text, + "link_preview_options": req.LinkPreviewOptions, }, }) if err != nil { @@ -11325,6 +14406,64 @@ func (client *Client) DeleteProfilePhoto(req *DeleteProfilePhotoRequest) (*Ok, e return UnmarshalOk(result.Data) } +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 and link preview background; 0 if none + BackgroundCustomEmojiId JsonInt64 `json:"background_custom_emoji_id"` +} + +// Changes accent color and background custom emoji for the current user; for Telegram Premium users only +func (client *Client) SetAccentColor(req *SetAccentColorRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAccentColor", + }, + Data: map[string]interface{}{ + "accent_color_id": req.AccentColorId, + "background_custom_emoji_id": req.BackgroundCustomEmojiId, + }, + }) + 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"` @@ -11461,11 +14600,61 @@ 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 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"` - // Duration of the status, in seconds; pass 0 to keep the status active until it will be changed manually - Duration int32 `json:"duration"` } // Changes the emoji status of the current user; for Telegram Premium users only @@ -11476,7 +14665,6 @@ func (client *Client) SetEmojiStatus(req *SetEmojiStatusRequest) (*Ok, error) { }, Data: map[string]interface{}{ "emoji_status": req.EmojiStatus, - "duration": req.Duration, }, }) if err != nil { @@ -11495,7 +14683,7 @@ type SetLocationRequest struct { Location *Location `json:"location"` } -// 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 +// 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. Must not be called if the user has a business location func (client *Client) SetLocation(req *SetLocationRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -11516,6 +14704,136 @@ func (client *Client) SetLocation(req *SetLocationRequest) (*Ok, error) { 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, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +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 SetBusinessIntroRequest struct { + // The new intro of the business; pass null to remove the intro + Intro *InputBusinessIntro `json:"intro"` +} + +// Changes the business intro of the current user. Requires Telegram Business subscription +func (client *Client) SetBusinessIntro(req *SetBusinessIntroRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBusinessIntro", + }, + Data: map[string]interface{}{ + "intro": req.Intro, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ChangePhoneNumberRequest struct { // The new phone number of the user in international format PhoneNumber string `json:"phone_number"` @@ -11523,7 +14841,7 @@ type ChangePhoneNumberRequest struct { Settings *PhoneNumberAuthenticationSettings `json:"settings"` } -// Changes the phone number of the user and sends an authentication code to the user's new phone number. On success, returns information about the sent code +// 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) { result, err := client.Send(Request{ meta: meta{ @@ -11590,6 +14908,77 @@ 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) +} + // 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{ @@ -11703,7 +15092,7 @@ type GetCommandsRequest struct { LanguageCode string `json:"language_code"` } -// Returns the list of commands supported by the bot for the given user scope and language; for bots only +// Returns 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{ @@ -11781,7 +15170,7 @@ func (client *Client) GetMenuButton(req *GetMenuButtonRequest) (*BotMenuButton, } type SetDefaultGroupAdministratorRightsRequest struct { - // Default administrator rights for adding the bot to basic group and supergroup chats; may be null + // Default administrator rights for adding the bot to basic group and supergroup chats; pass null to remove default rights DefaultGroupAdministratorRights *ChatAdministratorRights `json:"default_group_administrator_rights"` } @@ -11807,7 +15196,7 @@ func (client *Client) SetDefaultGroupAdministratorRights(req *SetDefaultGroupAdm } type SetDefaultChannelAdministratorRightsRequest struct { - // Default administrator rights for adding the bot to channels; may be null + // Default administrator rights for adding the bot to channels; pass null to remove default rights DefaultChannelAdministratorRights *ChatAdministratorRights `json:"default_channel_administrator_rights"` } @@ -11832,6 +15221,363 @@ func (client *Client) SetDefaultChannelAdministratorRights(req *SetDefaultChanne return UnmarshalOk(result.Data) } +type CanBotSendMessagesRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Checks whether the specified bot can send messages to the user. Returns a 404 error if can't and the access can be granted by call to allowBotToSendMessages +func (client *Client) CanBotSendMessages(req *CanBotSendMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "canBotSendMessages", + }, + 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 AllowBotToSendMessagesRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` +} + +// Allows the specified bot to send messages to the user +func (client *Client) AllowBotToSendMessages(req *AllowBotToSendMessagesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "allowBotToSendMessages", + }, + 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 SendWebAppCustomRequestRequest struct { + // Identifier of the bot + BotUserId int64 `json:"bot_user_id"` + // The method name + Method string `json:"method"` + // JSON-serialized method parameters + Parameters string `json:"parameters"` +} + +// Sends a custom request from a Web App +func (client *Client) SendWebAppCustomRequest(req *SendWebAppCustomRequestRequest) (*CustomRequestResult, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendWebAppCustomRequest", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "method": req.Method, + "parameters": req.Parameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCustomRequestResult(result.Data) +} + +type SetBotNameRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose languages there is no dedicated name + LanguageCode string `json:"language_code"` + // New bot's name on the specified language; 0-64 characters; must be non-empty if language code is empty + Name string `json:"name"` +} + +// Sets the name of a bot. Can be called only if userTypeBot.can_be_edited == true +func (client *Client) SetBotName(req *SetBotNameRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBotName", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + "name": req.Name, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBotNameRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // A two-letter ISO 639-1 language code or an empty string + LanguageCode string `json:"language_code"` +} + +// Returns the name of a bot in the given language. Can be called only if userTypeBot.can_be_edited == true +func (client *Client) GetBotName(req *GetBotNameRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotName", + }, + 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 UnmarshalText(result.Data) +} + +type SetBotProfilePhotoRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // Profile photo to set; pass null to delete the chat photo + Photo InputChatPhoto `json:"photo"` +} + +// Changes a profile photo for a bot +func (client *Client) SetBotProfilePhoto(req *SetBotProfilePhotoRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBotProfilePhoto", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "photo": req.Photo, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ToggleBotUsernameIsActiveRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // The username to change + Username string `json:"username"` + // Pass true to activate the username; pass false to disable it + 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 +func (client *Client) ToggleBotUsernameIsActive(req *ToggleBotUsernameIsActiveRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleBotUsernameIsActive", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "username": req.Username, + "is_active": req.IsActive, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type ReorderBotActiveUsernamesRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // The new order of active usernames. All currently active usernames must be specified + Usernames []string `json:"usernames"` +} + +// Changes order of active usernames of a bot. Can be called only if userTypeBot.can_be_edited == true +func (client *Client) ReorderBotActiveUsernames(req *ReorderBotActiveUsernamesRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "reorderBotActiveUsernames", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "usernames": req.Usernames, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetBotInfoDescriptionRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // A two-letter ISO 639-1 language code. If empty, the description will be shown to all users for whose languages there is no dedicated description + LanguageCode string `json:"language_code"` + // New bot's description on the specified language + Description string `json:"description"` +} + +// Sets the text shown in the chat with a bot if the chat is empty. Can be called only if userTypeBot.can_be_edited == true +func (client *Client) SetBotInfoDescription(req *SetBotInfoDescriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBotInfoDescription", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + "description": req.Description, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBotInfoDescriptionRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // A two-letter ISO 639-1 language code or an empty string + LanguageCode string `json:"language_code"` +} + +// Returns the text shown in the chat with a bot if the chat is empty in the given language. Can be called only if userTypeBot.can_be_edited == true +func (client *Client) GetBotInfoDescription(req *GetBotInfoDescriptionRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotInfoDescription", + }, + 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 UnmarshalText(result.Data) +} + +type SetBotInfoShortDescriptionRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // A two-letter ISO 639-1 language code. If empty, the short description will be shown to all users for whose languages there is no dedicated description + LanguageCode string `json:"language_code"` + // New bot's short description on the specified language + ShortDescription string `json:"short_description"` +} + +// Sets the text shown on a bot's profile page and sent together with the link when users share the bot. Can be called only if userTypeBot.can_be_edited == true +func (client *Client) SetBotInfoShortDescription(req *SetBotInfoShortDescriptionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setBotInfoShortDescription", + }, + Data: map[string]interface{}{ + "bot_user_id": req.BotUserId, + "language_code": req.LanguageCode, + "short_description": req.ShortDescription, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetBotInfoShortDescriptionRequest struct { + // Identifier of the target bot + BotUserId int64 `json:"bot_user_id"` + // A two-letter ISO 639-1 language code or an empty string + LanguageCode string `json:"language_code"` +} + +// Returns the text shown on a bot's profile page and sent together with the link when users share the bot in the given language. Can be called only if userTypeBot.can_be_edited == true +func (client *Client) GetBotInfoShortDescription(req *GetBotInfoShortDescriptionRequest) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getBotInfoShortDescription", + }, + 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 UnmarshalText(result.Data) +} + // Returns all active sessions of the current user func (client *Client) GetActiveSessions() (*Sessions, error) { result, err := client.Send(Request{ @@ -11896,6 +15642,32 @@ func (client *Client) TerminateAllOtherSessions() (*Ok, error) { return UnmarshalOk(result.Data) } +type ConfirmSessionRequest struct { + // Session identifier + SessionId JsonInt64 `json:"session_id"` +} + +// Confirms an unconfirmed session of the current user from another device +func (client *Client) ConfirmSession(req *ConfirmSessionRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "confirmSession", + }, + Data: map[string]interface{}{ + "session_id": req.SessionId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type ToggleSessionCanAcceptCallsRequest struct { // Session identifier SessionId JsonInt64 `json:"session_id"` @@ -11928,7 +15700,7 @@ func (client *Client) ToggleSessionCanAcceptCalls(req *ToggleSessionCanAcceptCal type ToggleSessionCanAcceptSecretChatsRequest struct { // Session identifier SessionId JsonInt64 `json:"session_id"` - // Pass true to allow accepring secret chats by the session; pass false otherwise + // Pass true to allow accepting secret chats by the session; pass false otherwise CanAcceptSecretChats bool `json:"can_accept_secret_chats"` } @@ -12189,6 +15961,64 @@ 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 ToggleSupergroupSignMessagesRequest struct { // Identifier of the channel SupergroupId int64 `json:"supergroup_id"` @@ -12196,7 +16026,7 @@ type ToggleSupergroupSignMessagesRequest struct { SignMessages bool `json:"sign_messages"` } -// Toggles whether sender signature is added to sent messages in a channel; requires can_change_info administrator right +// Toggles whether sender signature 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{ @@ -12283,7 +16113,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{ @@ -12366,11 +16196,11 @@ func (client *Client) ToggleSupergroupHasAggressiveAntiSpamEnabled(req *ToggleSu type ToggleSupergroupIsForumRequest struct { // Identifier of the supergroup SupergroupId int64 `json:"supergroup_id"` - // New value of is_forum. A supergroup can be converted to a forum, only if it has at least getOption("forum_member_count_min") members + // New value of is_forum IsForum bool `json:"is_forum"` } -// Toggles whether the supergroup is a forum; requires owner privileges in the supergroup +// Toggles whether the supergroup is a forum; requires owner privileges in the supergroup. Discussion supergroups can't be converted to forums func (client *Client) ToggleSupergroupIsForum(req *ToggleSupergroupIsForumRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -12578,6 +16408,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"` @@ -12585,7 +16434,7 @@ type GetPaymentFormRequest struct { Theme *ThemeParameters `json:"theme"` } -// Returns an invoice payment form. This method must be called when the user presses inlineKeyboardButtonBuy +// Returns an invoice payment form. This method must be called when the user presses inline button of the type inlineKeyboardButtonTypeBuy func (client *Client) GetPaymentForm(req *GetPaymentFormRequest) (*PaymentForm, error) { result, err := client.Send(Request{ meta: meta{ @@ -12811,36 +16660,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"` } @@ -12892,20 +16715,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 backgrounds 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, @@ -12924,16 +16747,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, @@ -12951,10 +16826,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{}{}, }) @@ -13077,7 +16952,7 @@ func (client *Client) SynchronizeLanguagePack(req *SynchronizeLanguagePackReques } type AddCustomServerLanguagePackRequest struct { - // Identifier of a language pack to be added; may be different from a name that is used in an "https://t.me/setlanguage/" link + // Identifier of a language pack to be added LanguagePackId string `json:"language_pack_id"` } @@ -13103,7 +16978,7 @@ func (client *Client) AddCustomServerLanguagePack(req *AddCustomServerLanguagePa } type SetCustomLanguagePackRequest struct { - // Information about the language pack. Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization + // Information about the language pack. Language pack identifier must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization Info *LanguagePackInfo `json:"info"` // Strings of the new language pack Strings []*LanguagePackString `json:"strings"` @@ -13374,6 +17249,137 @@ 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 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"` +} + +// Check 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 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"` @@ -13595,7 +17601,7 @@ type ReportChatRequest struct { // Identifiers of reported messages; may be empty to report the whole chat MessageIds []int64 `json:"message_ids"` // The reason for reporting the chat - Reason ChatReportReason `json:"reason"` + Reason ReportReason `json:"reason"` // Additional report details; 0-1024 characters Text string `json:"text"` } @@ -13630,7 +17636,7 @@ type ReportChatPhotoRequest struct { // Identifier of the photo to report. Only full photos from chatPhoto can be reported FileId int32 `json:"file_id"` // The reason for reporting the chat photo - Reason ChatReportReason `json:"reason"` + Reason ReportReason `json:"reason"` // Additional report details; 0-1024 characters Text string `json:"text"` } @@ -13761,6 +17767,73 @@ func (client *Client) GetMessageStatistics(req *GetMessageStatisticsRequest) (*M return UnmarshalMessageStatistics(result.Data) } +type GetMessagePublicForwardsRequest struct { + // Chat identifier of the message + ChatId int64 `json:"chat_id"` + // Message identifier + 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 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 and public reposts as a story. Can be used only if message.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", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "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 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 { // Chat identifier ChatId int64 `json:"chat_id"` @@ -14064,6 +18137,73 @@ func (client *Client) SetAutoDownloadSettings(req *SetAutoDownloadSettingsReques return UnmarshalOk(result.Data) } +// Returns autosave settings for the current user +func (client *Client) GetAutosaveSettings() (*AutosaveSettings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAutosaveSettings", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAutosaveSettings(result.Data) +} + +type SetAutosaveSettingsRequest struct { + // Autosave settings scope + Scope AutosaveSettingsScope `json:"scope"` + // New autosave settings for the scope; pass null to set autosave settings to default + Settings *ScopeAutosaveSettings `json:"settings"` +} + +// Sets autosave settings for the given scope. The method is guaranteed to work only after at least one call to getAutosaveSettings +func (client *Client) SetAutosaveSettings(req *SetAutosaveSettingsRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setAutosaveSettings", + }, + Data: map[string]interface{}{ + "scope": req.Scope, + "settings": req.Settings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Clears the list of all autosave settings exceptions. The method is guaranteed to work only after at least one call to getAutosaveSettings +func (client *Client) ClearAutosaveSettingsExceptions() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clearAutosaveSettingsExceptions", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetBankCardInfoRequest struct { // The bank card number BankCardNumber string `json:"bank_card_number"` @@ -14686,8 +18826,10 @@ func (client *Client) SetBotUpdatesStatus(req *SetBotUpdatesStatusRequest) (*Ok, type UploadStickerFileRequest struct { // Sticker file owner; ignored for regular users UserId int64 `json:"user_id"` - // Sticker file to upload - Sticker *InputSticker `json:"sticker"` + // Sticker format + StickerFormat StickerFormat `json:"sticker_format"` + // File file to upload; 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"` } // Uploads a file with a sticker; returns the uploaded file @@ -14697,8 +18839,9 @@ func (client *Client) UploadStickerFile(req *UploadStickerFileRequest) (*File, e Type: "uploadStickerFile", }, Data: map[string]interface{}{ - "user_id": req.UserId, - "sticker": req.Sticker, + "user_id": req.UserId, + "sticker_format": req.StickerFormat, + "sticker": req.Sticker, }, }) if err != nil { @@ -14781,11 +18924,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"` // Type of the stickers in the set StickerType StickerType `json:"sticker_type"` - // 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 + // 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; 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"` @@ -14798,12 +18943,13 @@ func (client *Client) CreateNewStickerSet(req *CreateNewStickerSetRequest) (*Sti Type: "createNewStickerSet", }, Data: map[string]interface{}{ - "user_id": req.UserId, - "title": req.Title, - "name": req.Name, - "sticker_type": req.StickerType, - "stickers": req.Stickers, - "source": req.Source, + "user_id": req.UserId, + "title": req.Title, + "name": req.Name, + "sticker_type": req.StickerType, + "needs_repainting": req.NeedsRepainting, + "stickers": req.Stickers, + "source": req.Source, }, }) if err != nil { @@ -14818,16 +18964,16 @@ 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. Returns the sticker set -func (client *Client) AddStickerToSet(req *AddStickerToSetRequest) (*StickerSet, error) { +// Adds a new sticker to a set +func (client *Client) AddStickerToSet(req *AddStickerToSetRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ Type: "addStickerToSet", @@ -14846,28 +18992,31 @@ func (client *Client) AddStickerToSet(req *AddStickerToSetRequest) (*StickerSet, return nil, buildResponseError(result.Data) } - return UnmarshalStickerSet(result.Data) + 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. Returns the sticker set -func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) (*StickerSet, error) { +// 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: "setStickerSetThumbnail", + Type: "replaceStickerInSet", }, Data: map[string]interface{}{ - "user_id": req.UserId, - "name": req.Name, - "thumbnail": req.Thumbnail, + "user_id": req.UserId, + "name": req.Name, + "old_sticker": req.OldSticker, + "new_sticker": req.NewSticker, }, }) if err != nil { @@ -14878,7 +19027,126 @@ func (client *Client) SetStickerSetThumbnail(req *SetStickerSetThumbnailRequest) return nil, buildResponseError(result.Data) } - return UnmarshalStickerSet(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{ + Type: "setStickerSetThumbnail", + }, + Data: map[string]interface{}{ + "user_id": req.UserId, + "name": req.Name, + "thumbnail": req.Thumbnail, + "format": req.Format, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetCustomEmojiStickerSetThumbnailRequest struct { + // 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 +func (client *Client) SetCustomEmojiStickerSetThumbnail(req *SetCustomEmojiStickerSetThumbnailRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setCustomEmojiStickerSetThumbnail", + }, + Data: map[string]interface{}{ + "name": req.Name, + "custom_emoji_id": req.CustomEmojiId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStickerSetTitleRequest struct { + // 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 +func (client *Client) SetStickerSetTitle(req *SetStickerSetTitleRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setStickerSetTitle", + }, + Data: map[string]interface{}{ + "name": req.Name, + "title": req.Title, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type DeleteStickerSetRequest struct { + // Sticker set name. The sticker set must be owned by the current user + Name string `json:"name"` +} + +// Completely deletes a sticker set +func (client *Client) DeleteStickerSet(req *DeleteStickerSetRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteStickerSet", + }, + 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) } type SetStickerPositionInSetRequest struct { @@ -14888,7 +19156,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{ @@ -14911,11 +19179,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{ @@ -14936,6 +19204,122 @@ func (client *Client) RemoveStickerFromSet(req *RemoveStickerFromSetRequest) (*O return UnmarshalOk(result.Data) } +type SetStickerEmojisRequest struct { + // Sticker + Sticker InputFile `json:"sticker"` + // New string with 1-20 emoji corresponding to the sticker + Emojis string `json:"emojis"` +} + +// Changes the list of emoji 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{ + Type: "setStickerEmojis", + }, + Data: map[string]interface{}{ + "sticker": req.Sticker, + "emojis": req.Emojis, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStickerKeywordsRequest struct { + // Sticker + Sticker InputFile `json:"sticker"` + // List of up to 20 keywords with total length up to 64 characters, which can be used to find the sticker + Keywords []string `json:"keywords"` +} + +// 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{ + Type: "setStickerKeywords", + }, + Data: map[string]interface{}{ + "sticker": req.Sticker, + "keywords": req.Keywords, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type SetStickerMaskPositionRequest struct { + // Sticker + Sticker InputFile `json:"sticker"` + // Position where the mask is placed; pass null to remove mask position + MaskPosition *MaskPosition `json:"mask_position"` +} + +// 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{ + Type: "setStickerMaskPosition", + }, + Data: map[string]interface{}{ + "sticker": req.Sticker, + "mask_position": req.MaskPosition, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + 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"` @@ -15112,6 +19496,151 @@ func (client *Client) GetPremiumState() (*PremiumState, error) { return UnmarshalPremiumState(result.Data) } +type GetPremiumGiftCodePaymentOptionsRequest 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; 0 if none + 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) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPremiumGiftCodePaymentOptions", + }, + Data: map[string]interface{}{ + "boosted_chat_id": req.BoostedChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPremiumGiftCodePaymentOptions(result.Data) +} + +type CheckPremiumGiftCodeRequest struct { + // The code to check + Code string `json:"code"` +} + +// Return information about a Telegram Premium gift code +func (client *Client) CheckPremiumGiftCode(req *CheckPremiumGiftCodeRequest) (*PremiumGiftCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkPremiumGiftCode", + }, + Data: map[string]interface{}{ + "code": req.Code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPremiumGiftCodeInfo(result.Data) +} + +type ApplyPremiumGiftCodeRequest struct { + // The code to apply + Code string `json:"code"` +} + +// Applies a Telegram Premium gift code +func (client *Client) ApplyPremiumGiftCode(req *ApplyPremiumGiftCodeRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "applyPremiumGiftCode", + }, + 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 LaunchPrepaidPremiumGiveawayRequest struct { + // Unique identifier of the prepaid giveaway + GiveawayId JsonInt64 `json:"giveaway_id"` + // Giveaway parameters + Parameters *PremiumGiveawayParameters `json:"parameters"` +} + +// Launches a prepaid Telegram Premium giveaway +func (client *Client) LaunchPrepaidPremiumGiveaway(req *LaunchPrepaidPremiumGiveawayRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "launchPrepaidPremiumGiveaway", + }, + Data: map[string]interface{}{ + "giveaway_id": req.GiveawayId, + "parameters": req.Parameters, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetPremiumGiveawayInfoRequest struct { + // Identifier of the channel chat which started the giveaway + ChatId int64 `json:"chat_id"` + // 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) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPremiumGiveawayInfo", + }, + 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 TypePremiumGiveawayInfoOngoing: + return UnmarshalPremiumGiveawayInfoOngoing(result.Data) + + case TypePremiumGiveawayInfoCompleted: + return UnmarshalPremiumGiveawayInfoCompleted(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + type CanPurchasePremiumRequest struct { // Transaction purpose Purpose StorePaymentPurpose `json:"purpose"` @@ -15202,6 +19731,32 @@ func (client *Client) AssignGooglePlayTransaction(req *AssignGooglePlayTransacti return UnmarshalOk(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"` @@ -15228,6 +19783,41 @@ func (client *Client) AcceptTermsOfService(req *AcceptTermsOfServiceRequest) (*O return UnmarshalOk(result.Data) } +type SearchStringsByPrefixRequest struct { + // The strings to search in for the query + Strings []string `json:"strings"` + // Query to search for + Query string `json:"query"` + // The maximum number of objects to return + Limit int32 `json:"limit"` + // Pass true to receive no results for an empty query + ReturnNoneForEmptyQuery bool `json:"return_none_for_empty_query"` +} + +// Searches specified query by word prefixes in the provided strings. Returns 0-based positions of strings that matched. Can be called synchronously +func (client *Client) SearchStringsByPrefix(req *SearchStringsByPrefixRequest) (*FoundPositions, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "searchStringsByPrefix", + }, + Data: map[string]interface{}{ + "strings": req.Strings, + "query": req.Query, + "limit": req.Limit, + "return_none_for_empty_query": req.ReturnNoneForEmptyQuery, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFoundPositions(result.Data) +} + type SendCustomRequestRequest struct { // The method name Method string `json:"method"` @@ -15405,13 +19995,20 @@ func (client *Client) GetPhoneNumberInfoSync(req *GetPhoneNumberInfoSyncRequest) return UnmarshalPhoneNumberInfo(result.Data) } -// Returns the link for downloading official Telegram application to be used when the current user invites friends to Telegram -func (client *Client) GetApplicationDownloadLink() (*HttpUrl, error) { +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: "getApplicationDownloadLink", + Type: "getCollectibleItemInfo", + }, + Data: map[string]interface{}{ + "type": req.Type, }, - Data: map[string]interface{}{}, }) if err != nil { return nil, err @@ -15421,7 +20018,7 @@ func (client *Client) GetApplicationDownloadLink() (*HttpUrl, error) { return nil, buildResponseError(result.Data) } - return UnmarshalHttpUrl(result.Data) + return UnmarshalCollectibleItemInfo(result.Data) } type GetDeepLinkInfoRequest struct { @@ -15522,8 +20119,27 @@ func (client *Client) SaveApplicationLogEvent(req *SaveApplicationLogEventReques return UnmarshalOk(result.Data) } +// Returns the link for downloading official Telegram application to be used when the current user invites friends to Telegram +func (client *Client) GetApplicationDownloadLink() (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getApplicationDownloadLink", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type AddProxyRequest struct { - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -15560,7 +20176,7 @@ func (client *Client) AddProxy(req *AddProxyRequest) (*Proxy, error) { type EditProxyRequest struct { // Proxy identifier ProxyId int32 `json:"proxy_id"` - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -15997,6 +20613,25 @@ func (client *Client) SetUserSupportInfo(req *SetUserSupportInfoRequest) (*UserS return UnmarshalUserSupportInfo(result.Data) } +// Returns localized name of the Telegram support user; for Telegram support only +func (client *Client) GetSupportName() (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getSupportName", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + // Does nothing; for testing only. This is an offline method. Can be called before authorization func (client *Client) TestCallEmpty() (*Ok, error) { result, err := client.Send(Request{ @@ -16218,7 +20853,7 @@ func (client *Client) TestNetwork() (*Ok, error) { } type TestProxyRequest struct { - // Proxy server IP address + // Proxy server domain or IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` @@ -16339,6 +20974,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatPhoto: return UnmarshalUpdateChatPhoto(result.Data) + case TypeUpdateChatAccentColors: + return UnmarshalUpdateChatAccentColors(result.Data) + case TypeUpdateChatPermissions: return UnmarshalUpdateChatPermissions(result.Data) @@ -16348,6 +20986,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) @@ -16363,6 +21007,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatDraftMessage: return UnmarshalUpdateChatDraftMessage(result.Data) + case TypeUpdateChatEmojiStatus: + return UnmarshalUpdateChatEmojiStatus(result.Data) + case TypeUpdateChatMessageSender: return UnmarshalUpdateChatMessageSender(result.Data) @@ -16378,6 +21025,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatReplyMarkup: return UnmarshalUpdateChatReplyMarkup(result.Data) + case TypeUpdateChatBackground: + return UnmarshalUpdateChatBackground(result.Data) + case TypeUpdateChatTheme: return UnmarshalUpdateChatTheme(result.Data) @@ -16396,21 +21046,45 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatHasProtectedContent: return UnmarshalUpdateChatHasProtectedContent(result.Data) - case TypeUpdateChatHasScheduledMessages: - return UnmarshalUpdateChatHasScheduledMessages(result.Data) - - case TypeUpdateChatIsBlocked: - return UnmarshalUpdateChatIsBlocked(result.Data) + case TypeUpdateChatIsTranslatable: + return UnmarshalUpdateChatIsTranslatable(result.Data) case TypeUpdateChatIsMarkedAsUnread: return UnmarshalUpdateChatIsMarkedAsUnread(result.Data) - case TypeUpdateChatFilters: - return UnmarshalUpdateChatFilters(result.Data) + case TypeUpdateChatViewAsTopics: + return UnmarshalUpdateChatViewAsTopics(result.Data) + + case TypeUpdateChatBlockList: + return UnmarshalUpdateChatBlockList(result.Data) + + case TypeUpdateChatHasScheduledMessages: + return UnmarshalUpdateChatHasScheduledMessages(result.Data) + + case TypeUpdateChatFolders: + return UnmarshalUpdateChatFolders(result.Data) case TypeUpdateChatOnlineMemberCount: return UnmarshalUpdateChatOnlineMemberCount(result.Data) + case TypeUpdateSavedMessagesTopic: + return UnmarshalUpdateSavedMessagesTopic(result.Data) + + case TypeUpdateSavedMessagesTopicCount: + return UnmarshalUpdateSavedMessagesTopicCount(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) @@ -16504,6 +21178,27 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateUnreadChatCount: return UnmarshalUpdateUnreadChatCount(result.Data) + case TypeUpdateStory: + return UnmarshalUpdateStory(result.Data) + + case TypeUpdateStoryDeleted: + return UnmarshalUpdateStoryDeleted(result.Data) + + case TypeUpdateStorySendSucceeded: + return UnmarshalUpdateStorySendSucceeded(result.Data) + + case TypeUpdateStorySendFailed: + return UnmarshalUpdateStorySendFailed(result.Data) + + case TypeUpdateChatActiveStories: + return UnmarshalUpdateChatActiveStories(result.Data) + + case TypeUpdateStoryListChatCount: + return UnmarshalUpdateStoryListChatCount(result.Data) + + case TypeUpdateStoryStealthMode: + return UnmarshalUpdateStoryStealthMode(result.Data) + case TypeUpdateOption: return UnmarshalUpdateOption(result.Data) @@ -16528,12 +21223,18 @@ 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 TypeUpdateAccentColors: + return UnmarshalUpdateAccentColors(result.Data) + + case TypeUpdateProfileAccentColors: + return UnmarshalUpdateProfileAccentColors(result.Data) + case TypeUpdateLanguagePackStrings: return UnmarshalUpdateLanguagePackStrings(result.Data) @@ -16546,6 +21247,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateUsersNearby: return UnmarshalUpdateUsersNearby(result.Data) + case TypeUpdateUnconfirmedSession: + return UnmarshalUpdateUnconfirmedSession(result.Data) + case TypeUpdateAttachmentMenuBots: return UnmarshalUpdateAttachmentMenuBots(result.Data) @@ -16558,6 +21262,12 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateDefaultReactionType: return UnmarshalUpdateDefaultReactionType(result.Data) + case TypeUpdateSavedMessagesTags: + return UnmarshalUpdateSavedMessagesTags(result.Data) + + case TypeUpdateSpeechRecognitionTrial: + return UnmarshalUpdateSpeechRecognitionTrial(result.Data) + case TypeUpdateDiceEmojis: return UnmarshalUpdateDiceEmojis(result.Data) @@ -16570,6 +21280,27 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSuggestedActions: return UnmarshalUpdateSuggestedActions(result.Data) + case TypeUpdateContactCloseBirthdays: + return UnmarshalUpdateContactCloseBirthdays(result.Data) + + case TypeUpdateAddChatMembersPrivacyForbidden: + return UnmarshalUpdateAddChatMembersPrivacyForbidden(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) @@ -16606,6 +21337,15 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateNewChatJoinRequest: return UnmarshalUpdateNewChatJoinRequest(result.Data) + case TypeUpdateChatBoost: + return UnmarshalUpdateChatBoost(result.Data) + + case TypeUpdateMessageReaction: + return UnmarshalUpdateMessageReaction(result.Data) + + case TypeUpdateMessageReactions: + return UnmarshalUpdateMessageReactions(result.Data) + default: return nil, errors.New("invalid type") } diff --git a/client/type.go b/client/type.go index 7e11c16..2a2326e 100755 --- a/client/type.go +++ b/client/type.go @@ -3,38432 +3,49857 @@ package client import ( - "encoding/json" + "encoding/json" ) const ( - ClassAuthenticationCodeType = "AuthenticationCodeType" - ClassEmailAddressAuthentication = "EmailAddressAuthentication" - ClassAuthorizationState = "AuthorizationState" - ClassInputFile = "InputFile" - ClassThumbnailFormat = "ThumbnailFormat" - ClassMaskPoint = "MaskPoint" - ClassStickerFormat = "StickerFormat" - ClassStickerType = "StickerType" - ClassStickerFullType = "StickerFullType" - ClassPollType = "PollType" - ClassUserType = "UserType" - ClassInputChatPhoto = "InputChatPhoto" - ClassChatMemberStatus = "ChatMemberStatus" - ClassChatMembersFilter = "ChatMembersFilter" - ClassSupergroupMembersFilter = "SupergroupMembersFilter" - ClassSecretChatState = "SecretChatState" - ClassMessageSender = "MessageSender" - ClassMessageForwardOrigin = "MessageForwardOrigin" - ClassReactionType = "ReactionType" - ClassMessageSendingState = "MessageSendingState" - ClassNotificationSettingsScope = "NotificationSettingsScope" - ClassChatType = "ChatType" - ClassChatList = "ChatList" - ClassChatSource = "ChatSource" - ClassChatAvailableReactions = "ChatAvailableReactions" - ClassPublicChatType = "PublicChatType" - ClassChatActionBar = "ChatActionBar" - ClassKeyboardButtonType = "KeyboardButtonType" - ClassInlineKeyboardButtonType = "InlineKeyboardButtonType" - ClassReplyMarkup = "ReplyMarkup" - ClassLoginUrlInfo = "LoginUrlInfo" - ClassRichText = "RichText" - ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" - ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" - ClassPageBlock = "PageBlock" - ClassInputCredentials = "InputCredentials" - ClassPaymentProvider = "PaymentProvider" - ClassInputInvoice = "InputInvoice" - ClassMessageExtendedMedia = "MessageExtendedMedia" - ClassPassportElementType = "PassportElementType" - ClassPassportElement = "PassportElement" - ClassInputPassportElement = "InputPassportElement" - ClassPassportElementErrorSource = "PassportElementErrorSource" - ClassInputPassportElementErrorSource = "InputPassportElementErrorSource" - ClassMessageContent = "MessageContent" - ClassTextEntityType = "TextEntityType" - ClassMessageSchedulingState = "MessageSchedulingState" - ClassInputMessageContent = "InputMessageContent" - ClassSearchMessagesFilter = "SearchMessagesFilter" - ClassChatAction = "ChatAction" - ClassUserStatus = "UserStatus" - ClassCallDiscardReason = "CallDiscardReason" - ClassCallServerType = "CallServerType" - ClassCallState = "CallState" - ClassGroupCallVideoQuality = "GroupCallVideoQuality" - ClassCallProblem = "CallProblem" - ClassDiceStickers = "DiceStickers" - ClassSpeechRecognitionResult = "SpeechRecognitionResult" - ClassInputInlineQueryResult = "InputInlineQueryResult" - ClassInlineQueryResult = "InlineQueryResult" - ClassCallbackQueryPayload = "CallbackQueryPayload" - ClassChatEventAction = "ChatEventAction" - ClassLanguagePackStringValue = "LanguagePackStringValue" - ClassPremiumLimitType = "PremiumLimitType" - ClassPremiumFeature = "PremiumFeature" - ClassPremiumSource = "PremiumSource" - ClassStorePaymentPurpose = "StorePaymentPurpose" - ClassDeviceToken = "DeviceToken" - ClassBackgroundFill = "BackgroundFill" - ClassBackgroundType = "BackgroundType" - ClassInputBackground = "InputBackground" - ClassCanTransferOwnershipResult = "CanTransferOwnershipResult" - ClassCheckChatUsernameResult = "CheckChatUsernameResult" - ClassCheckStickerSetNameResult = "CheckStickerSetNameResult" - ClassResetPasswordResult = "ResetPasswordResult" - ClassMessageFileType = "MessageFileType" - ClassPushMessageContent = "PushMessageContent" - ClassNotificationType = "NotificationType" - ClassNotificationGroupType = "NotificationGroupType" - ClassOptionValue = "OptionValue" - ClassJsonValue = "JsonValue" - ClassUserPrivacySettingRule = "UserPrivacySettingRule" - ClassUserPrivacySetting = "UserPrivacySetting" - ClassSessionType = "SessionType" - ClassChatReportReason = "ChatReportReason" - ClassTargetChat = "TargetChat" - ClassInternalLinkType = "InternalLinkType" - ClassFileType = "FileType" - ClassNetworkType = "NetworkType" - ClassNetworkStatisticsEntry = "NetworkStatisticsEntry" - ClassConnectionState = "ConnectionState" - ClassTopChatCategory = "TopChatCategory" - ClassTMeUrlType = "TMeUrlType" - ClassSuggestedAction = "SuggestedAction" - ClassTextParseMode = "TextParseMode" - ClassProxyType = "ProxyType" - ClassStatisticalGraph = "StatisticalGraph" - ClassChatStatistics = "ChatStatistics" - ClassVectorPathCommand = "VectorPathCommand" - ClassBotCommandScope = "BotCommandScope" - ClassUpdate = "Update" - ClassLogStream = "LogStream" - ClassError = "Error" - ClassOk = "Ok" - ClassAuthenticationCodeInfo = "AuthenticationCodeInfo" - ClassEmailAddressAuthenticationCodeInfo = "EmailAddressAuthenticationCodeInfo" - ClassTextEntity = "TextEntity" - ClassTextEntities = "TextEntities" - ClassFormattedText = "FormattedText" - ClassTermsOfService = "TermsOfService" - ClassPasswordState = "PasswordState" - ClassRecoveryEmailAddress = "RecoveryEmailAddress" - ClassTemporaryPasswordState = "TemporaryPasswordState" - ClassLocalFile = "LocalFile" - ClassRemoteFile = "RemoteFile" - ClassFile = "File" - ClassPhotoSize = "PhotoSize" - ClassMinithumbnail = "Minithumbnail" - ClassThumbnail = "Thumbnail" - ClassMaskPosition = "MaskPosition" - ClassClosedVectorPath = "ClosedVectorPath" - ClassPollOption = "PollOption" - ClassAnimation = "Animation" - ClassAudio = "Audio" - ClassDocument = "Document" - ClassPhoto = "Photo" - ClassSticker = "Sticker" - ClassVideo = "Video" - ClassVideoNote = "VideoNote" - ClassVoiceNote = "VoiceNote" - ClassAnimatedEmoji = "AnimatedEmoji" - ClassContact = "Contact" - ClassLocation = "Location" - ClassVenue = "Venue" - ClassGame = "Game" - ClassPoll = "Poll" - ClassProfilePhoto = "ProfilePhoto" - ClassChatPhotoInfo = "ChatPhotoInfo" - ClassBotCommand = "BotCommand" - ClassBotCommands = "BotCommands" - ClassBotMenuButton = "BotMenuButton" - ClassChatLocation = "ChatLocation" - ClassAnimatedChatPhoto = "AnimatedChatPhoto" - ClassChatPhoto = "ChatPhoto" - ClassChatPhotos = "ChatPhotos" - ClassChatPermissions = "ChatPermissions" - ClassChatAdministratorRights = "ChatAdministratorRights" - ClassPremiumPaymentOption = "PremiumPaymentOption" - ClassEmojiStatus = "EmojiStatus" - ClassEmojiStatuses = "EmojiStatuses" - ClassUsernames = "Usernames" - ClassUser = "User" - ClassBotInfo = "BotInfo" - ClassUserFullInfo = "UserFullInfo" - ClassUsers = "Users" - ClassChatAdministrator = "ChatAdministrator" - ClassChatAdministrators = "ChatAdministrators" - ClassChatMember = "ChatMember" - ClassChatMembers = "ChatMembers" - ClassChatInviteLink = "ChatInviteLink" - ClassChatInviteLinks = "ChatInviteLinks" - ClassChatInviteLinkCount = "ChatInviteLinkCount" - ClassChatInviteLinkCounts = "ChatInviteLinkCounts" - ClassChatInviteLinkMember = "ChatInviteLinkMember" - ClassChatInviteLinkMembers = "ChatInviteLinkMembers" - ClassChatInviteLinkInfo = "ChatInviteLinkInfo" - ClassChatJoinRequest = "ChatJoinRequest" - ClassChatJoinRequests = "ChatJoinRequests" - ClassChatJoinRequestsInfo = "ChatJoinRequestsInfo" - ClassBasicGroup = "BasicGroup" - ClassBasicGroupFullInfo = "BasicGroupFullInfo" - ClassSupergroup = "Supergroup" - ClassSupergroupFullInfo = "SupergroupFullInfo" - ClassSecretChat = "SecretChat" - ClassMessageSenders = "MessageSenders" - ClassChatMessageSender = "ChatMessageSender" - ClassChatMessageSenders = "ChatMessageSenders" - ClassMessageForwardInfo = "MessageForwardInfo" - ClassMessageReplyInfo = "MessageReplyInfo" - ClassMessageReaction = "MessageReaction" - ClassMessageInteractionInfo = "MessageInteractionInfo" - ClassUnreadReaction = "UnreadReaction" - ClassMessage = "Message" - ClassMessages = "Messages" - ClassFoundMessages = "FoundMessages" - ClassFoundChatMessages = "FoundChatMessages" - ClassMessagePosition = "MessagePosition" - ClassMessagePositions = "MessagePositions" - ClassMessageCalendarDay = "MessageCalendarDay" - ClassMessageCalendar = "MessageCalendar" - ClassSponsoredMessage = "SponsoredMessage" - ClassSponsoredMessages = "SponsoredMessages" - ClassFileDownload = "FileDownload" - ClassDownloadedFileCounts = "DownloadedFileCounts" - ClassFoundFileDownloads = "FoundFileDownloads" - ClassChatNotificationSettings = "ChatNotificationSettings" - ClassScopeNotificationSettings = "ScopeNotificationSettings" - ClassDraftMessage = "DraftMessage" - ClassChatFilter = "ChatFilter" - ClassChatFilterInfo = "ChatFilterInfo" - ClassRecommendedChatFilter = "RecommendedChatFilter" - ClassRecommendedChatFilters = "RecommendedChatFilters" - ClassChatLists = "ChatLists" - ClassChatPosition = "ChatPosition" - ClassVideoChat = "VideoChat" - ClassChat = "Chat" - ClassChats = "Chats" - ClassChatNearby = "ChatNearby" - ClassChatsNearby = "ChatsNearby" - ClassKeyboardButton = "KeyboardButton" - ClassInlineKeyboardButton = "InlineKeyboardButton" - ClassWebAppInfo = "WebAppInfo" - ClassMessageThreadInfo = "MessageThreadInfo" - ClassForumTopicIcon = "ForumTopicIcon" - ClassForumTopicInfo = "ForumTopicInfo" - ClassForumTopic = "ForumTopic" - ClassForumTopics = "ForumTopics" - ClassPageBlockCaption = "PageBlockCaption" - ClassPageBlockListItem = "PageBlockListItem" - ClassPageBlockTableCell = "PageBlockTableCell" - ClassPageBlockRelatedArticle = "PageBlockRelatedArticle" - ClassWebPageInstantView = "WebPageInstantView" - ClassWebPage = "WebPage" - ClassCountryInfo = "CountryInfo" - ClassCountries = "Countries" - ClassPhoneNumberInfo = "PhoneNumberInfo" - ClassBankCardActionOpenUrl = "BankCardActionOpenUrl" - ClassBankCardInfo = "BankCardInfo" - ClassAddress = "Address" - ClassThemeParameters = "ThemeParameters" - ClassLabeledPricePart = "LabeledPricePart" - ClassInvoice = "Invoice" - ClassOrderInfo = "OrderInfo" - ClassShippingOption = "ShippingOption" - ClassSavedCredentials = "SavedCredentials" - ClassPaymentOption = "PaymentOption" - ClassPaymentForm = "PaymentForm" - ClassValidatedOrderInfo = "ValidatedOrderInfo" - ClassPaymentResult = "PaymentResult" - ClassPaymentReceipt = "PaymentReceipt" - ClassDatedFile = "DatedFile" - ClassDate = "Date" - ClassPersonalDetails = "PersonalDetails" - ClassIdentityDocument = "IdentityDocument" - ClassInputIdentityDocument = "InputIdentityDocument" - ClassPersonalDocument = "PersonalDocument" - ClassInputPersonalDocument = "InputPersonalDocument" - ClassPassportElements = "PassportElements" - ClassPassportElementError = "PassportElementError" - ClassPassportSuitableElement = "PassportSuitableElement" - ClassPassportRequiredElement = "PassportRequiredElement" - ClassPassportAuthorizationForm = "PassportAuthorizationForm" - ClassPassportElementsWithErrors = "PassportElementsWithErrors" - ClassEncryptedCredentials = "EncryptedCredentials" - ClassEncryptedPassportElement = "EncryptedPassportElement" - ClassInputPassportElementError = "InputPassportElementError" - ClassInputThumbnail = "InputThumbnail" - ClassMessageSendOptions = "MessageSendOptions" - ClassMessageCopyOptions = "MessageCopyOptions" - ClassStickers = "Stickers" - ClassEmojis = "Emojis" - ClassStickerSet = "StickerSet" - ClassStickerSetInfo = "StickerSetInfo" - ClassStickerSets = "StickerSets" - ClassTrendingStickerSets = "TrendingStickerSets" - ClassCallProtocol = "CallProtocol" - ClassCallServer = "CallServer" - ClassCallId = "CallId" - ClassGroupCallId = "GroupCallId" - ClassGroupCallStream = "GroupCallStream" - ClassGroupCallStreams = "GroupCallStreams" - ClassRtmpUrl = "RtmpUrl" - ClassGroupCallRecentSpeaker = "GroupCallRecentSpeaker" - ClassGroupCall = "GroupCall" - ClassGroupCallVideoSourceGroup = "GroupCallVideoSourceGroup" - ClassGroupCallParticipantVideoInfo = "GroupCallParticipantVideoInfo" - ClassGroupCallParticipant = "GroupCallParticipant" - ClassCall = "Call" - ClassPhoneNumberAuthenticationSettings = "PhoneNumberAuthenticationSettings" - ClassAddedReaction = "AddedReaction" - ClassAddedReactions = "AddedReactions" - ClassAvailableReaction = "AvailableReaction" - ClassAvailableReactions = "AvailableReactions" - ClassEmojiReaction = "EmojiReaction" - ClassAnimations = "Animations" - ClassImportedContacts = "ImportedContacts" - ClassAttachmentMenuBotColor = "AttachmentMenuBotColor" - ClassAttachmentMenuBot = "AttachmentMenuBot" - ClassSentWebAppMessage = "SentWebAppMessage" - ClassHttpUrl = "HttpUrl" - ClassUserLink = "UserLink" - ClassInlineQueryResults = "InlineQueryResults" - ClassCallbackQueryAnswer = "CallbackQueryAnswer" - ClassCustomRequestResult = "CustomRequestResult" - ClassGameHighScore = "GameHighScore" - ClassGameHighScores = "GameHighScores" - ClassChatEvent = "ChatEvent" - ClassChatEvents = "ChatEvents" - ClassChatEventLogFilters = "ChatEventLogFilters" - ClassLanguagePackString = "LanguagePackString" - ClassLanguagePackStrings = "LanguagePackStrings" - ClassLanguagePackInfo = "LanguagePackInfo" - ClassLocalizationTargetInfo = "LocalizationTargetInfo" - ClassPremiumLimit = "PremiumLimit" - ClassPremiumFeatures = "PremiumFeatures" - ClassPremiumFeaturePromotionAnimation = "PremiumFeaturePromotionAnimation" - ClassPremiumState = "PremiumState" - ClassPushReceiverId = "PushReceiverId" - ClassBackground = "Background" - ClassBackgrounds = "Backgrounds" - ClassThemeSettings = "ThemeSettings" - ClassChatTheme = "ChatTheme" - ClassHashtags = "Hashtags" - ClassNotificationSound = "NotificationSound" - ClassNotificationSounds = "NotificationSounds" - ClassNotification = "Notification" - ClassNotificationGroup = "NotificationGroup" - ClassJsonObjectMember = "JsonObjectMember" - ClassUserPrivacySettingRules = "UserPrivacySettingRules" - ClassAccountTtl = "AccountTtl" - ClassMessageAutoDeleteTime = "MessageAutoDeleteTime" - ClassSession = "Session" - ClassSessions = "Sessions" - ClassConnectedWebsite = "ConnectedWebsite" - ClassConnectedWebsites = "ConnectedWebsites" - ClassMessageLink = "MessageLink" - ClassMessageLinkInfo = "MessageLinkInfo" - ClassFilePart = "FilePart" - ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" - ClassStorageStatisticsByChat = "StorageStatisticsByChat" - ClassStorageStatistics = "StorageStatistics" - ClassStorageStatisticsFast = "StorageStatisticsFast" - ClassDatabaseStatistics = "DatabaseStatistics" - ClassNetworkStatistics = "NetworkStatistics" - ClassAutoDownloadSettings = "AutoDownloadSettings" - ClassAutoDownloadSettingsPresets = "AutoDownloadSettingsPresets" - ClassTMeUrl = "TMeUrl" - ClassTMeUrls = "TMeUrls" - ClassCount = "Count" - ClassText = "Text" - ClassSeconds = "Seconds" - ClassFileDownloadedPrefixSize = "FileDownloadedPrefixSize" - ClassDeepLinkInfo = "DeepLinkInfo" - ClassProxy = "Proxy" - ClassProxies = "Proxies" - ClassInputSticker = "InputSticker" - ClassDateRange = "DateRange" - ClassStatisticalValue = "StatisticalValue" - ClassChatStatisticsMessageInteractionInfo = "ChatStatisticsMessageInteractionInfo" - ClassChatStatisticsMessageSenderInfo = "ChatStatisticsMessageSenderInfo" - ClassChatStatisticsAdministratorActionsInfo = "ChatStatisticsAdministratorActionsInfo" - ClassChatStatisticsInviterInfo = "ChatStatisticsInviterInfo" - ClassMessageStatistics = "MessageStatistics" - ClassPoint = "Point" - ClassUpdates = "Updates" - ClassLogVerbosityLevel = "LogVerbosityLevel" - ClassLogTags = "LogTags" - ClassUserSupportInfo = "UserSupportInfo" - ClassTestInt = "TestInt" - ClassTestString = "TestString" - ClassTestBytes = "TestBytes" - ClassTestVectorInt = "TestVectorInt" - ClassTestVectorIntObject = "TestVectorIntObject" - ClassTestVectorString = "TestVectorString" - ClassTestVectorStringObject = "TestVectorStringObject" + ClassAuthenticationCodeType = "AuthenticationCodeType" + ClassEmailAddressAuthentication = "EmailAddressAuthentication" + ClassEmailAddressResetState = "EmailAddressResetState" + ClassAuthorizationState = "AuthorizationState" + ClassInputFile = "InputFile" + ClassThumbnailFormat = "ThumbnailFormat" + ClassMaskPoint = "MaskPoint" + ClassStickerFormat = "StickerFormat" + ClassStickerType = "StickerType" + ClassStickerFullType = "StickerFullType" + ClassPollType = "PollType" + ClassUserType = "UserType" + ClassBusinessAwayMessageSchedule = "BusinessAwayMessageSchedule" + ClassChatPhotoStickerType = "ChatPhotoStickerType" + ClassInputChatPhoto = "InputChatPhoto" + ClassPremiumGiveawayParticipantStatus = "PremiumGiveawayParticipantStatus" + ClassPremiumGiveawayInfo = "PremiumGiveawayInfo" + ClassChatMemberStatus = "ChatMemberStatus" + ClassChatMembersFilter = "ChatMembersFilter" + ClassSupergroupMembersFilter = "SupergroupMembersFilter" + ClassInviteLinkChatType = "InviteLinkChatType" + ClassSecretChatState = "SecretChatState" + ClassMessageSender = "MessageSender" + ClassMessageReadDate = "MessageReadDate" + ClassMessageOrigin = "MessageOrigin" + ClassReactionType = "ReactionType" + ClassMessageSendingState = "MessageSendingState" + ClassMessageReplyTo = "MessageReplyTo" + ClassInputMessageReplyTo = "InputMessageReplyTo" + ClassMessageSource = "MessageSource" + ClassMessageSponsorType = "MessageSponsorType" + ClassReportChatSponsoredMessageResult = "ReportChatSponsoredMessageResult" + ClassNotificationSettingsScope = "NotificationSettingsScope" + ClassChatType = "ChatType" + ClassChatList = "ChatList" + ClassChatSource = "ChatSource" + ClassChatAvailableReactions = "ChatAvailableReactions" + ClassPublicChatType = "PublicChatType" + ClassChatActionBar = "ChatActionBar" + ClassKeyboardButtonType = "KeyboardButtonType" + ClassInlineKeyboardButtonType = "InlineKeyboardButtonType" + ClassReplyMarkup = "ReplyMarkup" + ClassLoginUrlInfo = "LoginUrlInfo" + ClassSavedMessagesTopicType = "SavedMessagesTopicType" + ClassRichText = "RichText" + ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" + ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" + ClassPageBlock = "PageBlock" + ClassCollectibleItemType = "CollectibleItemType" + ClassInputCredentials = "InputCredentials" + ClassPaymentProvider = "PaymentProvider" + ClassInputInvoice = "InputInvoice" + ClassMessageExtendedMedia = "MessageExtendedMedia" + ClassPassportElementType = "PassportElementType" + ClassPassportElement = "PassportElement" + ClassInputPassportElement = "InputPassportElement" + ClassPassportElementErrorSource = "PassportElementErrorSource" + ClassInputPassportElementErrorSource = "InputPassportElementErrorSource" + ClassMessageContent = "MessageContent" + ClassTextEntityType = "TextEntityType" + ClassMessageSchedulingState = "MessageSchedulingState" + ClassMessageSelfDestructType = "MessageSelfDestructType" + ClassInputMessageContent = "InputMessageContent" + ClassSearchMessagesFilter = "SearchMessagesFilter" + ClassChatAction = "ChatAction" + ClassUserStatus = "UserStatus" + ClassEmojiCategoryType = "EmojiCategoryType" + ClassStoryAreaType = "StoryAreaType" + ClassInputStoryAreaType = "InputStoryAreaType" + ClassStoryContent = "StoryContent" + ClassInputStoryContent = "InputStoryContent" + ClassStoryList = "StoryList" + ClassStoryOrigin = "StoryOrigin" + ClassStoryInteractionType = "StoryInteractionType" + ClassPublicForward = "PublicForward" + ClassChatBoostSource = "ChatBoostSource" + ClassCallDiscardReason = "CallDiscardReason" + ClassCallServerType = "CallServerType" + ClassCallState = "CallState" + ClassGroupCallVideoQuality = "GroupCallVideoQuality" + ClassCallProblem = "CallProblem" + ClassFirebaseAuthenticationSettings = "FirebaseAuthenticationSettings" + ClassReactionUnavailabilityReason = "ReactionUnavailabilityReason" + ClassDiceStickers = "DiceStickers" + ClassSpeechRecognitionResult = "SpeechRecognitionResult" + ClassBotWriteAccessAllowReason = "BotWriteAccessAllowReason" + ClassInputInlineQueryResult = "InputInlineQueryResult" + ClassInlineQueryResult = "InlineQueryResult" + ClassInlineQueryResultsButtonType = "InlineQueryResultsButtonType" + ClassCallbackQueryPayload = "CallbackQueryPayload" + ClassChatEventAction = "ChatEventAction" + ClassLanguagePackStringValue = "LanguagePackStringValue" + ClassPremiumLimitType = "PremiumLimitType" + ClassPremiumFeature = "PremiumFeature" + ClassBusinessFeature = "BusinessFeature" + ClassPremiumStoryFeature = "PremiumStoryFeature" + ClassPremiumSource = "PremiumSource" + ClassStorePaymentPurpose = "StorePaymentPurpose" + ClassTelegramPaymentPurpose = "TelegramPaymentPurpose" + ClassDeviceToken = "DeviceToken" + ClassBackgroundFill = "BackgroundFill" + ClassBackgroundType = "BackgroundType" + ClassInputBackground = "InputBackground" + ClassCanSendStoryResult = "CanSendStoryResult" + ClassCanTransferOwnershipResult = "CanTransferOwnershipResult" + ClassCheckChatUsernameResult = "CheckChatUsernameResult" + ClassCheckStickerSetNameResult = "CheckStickerSetNameResult" + ClassResetPasswordResult = "ResetPasswordResult" + ClassMessageFileType = "MessageFileType" + ClassPushMessageContent = "PushMessageContent" + ClassNotificationType = "NotificationType" + ClassNotificationGroupType = "NotificationGroupType" + ClassOptionValue = "OptionValue" + ClassJsonValue = "JsonValue" + ClassStoryPrivacySettings = "StoryPrivacySettings" + ClassUserPrivacySettingRule = "UserPrivacySettingRule" + ClassUserPrivacySetting = "UserPrivacySetting" + ClassCanSendMessageToUserResult = "CanSendMessageToUserResult" + ClassSessionType = "SessionType" + ClassReportReason = "ReportReason" + ClassTargetChat = "TargetChat" + ClassInternalLinkType = "InternalLinkType" + ClassBlockList = "BlockList" + ClassFileType = "FileType" + ClassNetworkType = "NetworkType" + ClassNetworkStatisticsEntry = "NetworkStatisticsEntry" + ClassAutosaveSettingsScope = "AutosaveSettingsScope" + ClassConnectionState = "ConnectionState" + ClassTopChatCategory = "TopChatCategory" + ClassTMeUrlType = "TMeUrlType" + ClassSuggestedAction = "SuggestedAction" + ClassTextParseMode = "TextParseMode" + ClassProxyType = "ProxyType" + ClassStatisticalGraph = "StatisticalGraph" + ClassChatStatisticsObjectType = "ChatStatisticsObjectType" + ClassChatStatistics = "ChatStatistics" + ClassVectorPathCommand = "VectorPathCommand" + ClassBotCommandScope = "BotCommandScope" + ClassUpdate = "Update" + ClassLogStream = "LogStream" + ClassError = "Error" + ClassOk = "Ok" + ClassAuthenticationCodeInfo = "AuthenticationCodeInfo" + ClassEmailAddressAuthenticationCodeInfo = "EmailAddressAuthenticationCodeInfo" + ClassTextEntity = "TextEntity" + ClassTextEntities = "TextEntities" + ClassFormattedText = "FormattedText" + ClassTermsOfService = "TermsOfService" + ClassPasswordState = "PasswordState" + ClassRecoveryEmailAddress = "RecoveryEmailAddress" + ClassTemporaryPasswordState = "TemporaryPasswordState" + ClassLocalFile = "LocalFile" + ClassRemoteFile = "RemoteFile" + ClassFile = "File" + ClassPhotoSize = "PhotoSize" + ClassMinithumbnail = "Minithumbnail" + ClassThumbnail = "Thumbnail" + ClassMaskPosition = "MaskPosition" + ClassClosedVectorPath = "ClosedVectorPath" + ClassPollOption = "PollOption" + ClassAnimation = "Animation" + ClassAudio = "Audio" + ClassDocument = "Document" + ClassPhoto = "Photo" + ClassSticker = "Sticker" + ClassVideo = "Video" + ClassVideoNote = "VideoNote" + ClassVoiceNote = "VoiceNote" + ClassAnimatedEmoji = "AnimatedEmoji" + ClassContact = "Contact" + ClassLocation = "Location" + ClassVenue = "Venue" + ClassGame = "Game" + ClassWebApp = "WebApp" + ClassPoll = "Poll" + ClassBackground = "Background" + ClassBackgrounds = "Backgrounds" + ClassChatBackground = "ChatBackground" + ClassProfilePhoto = "ProfilePhoto" + ClassChatPhotoInfo = "ChatPhotoInfo" + ClassBotCommand = "BotCommand" + ClassBotCommands = "BotCommands" + ClassBotMenuButton = "BotMenuButton" + ClassChatLocation = "ChatLocation" + ClassBirthdate = "Birthdate" + ClassCloseBirthdayUser = "CloseBirthdayUser" + ClassBusinessLocation = "BusinessLocation" + ClassBusinessRecipients = "BusinessRecipients" + ClassBusinessAwayMessageSettings = "BusinessAwayMessageSettings" + ClassBusinessGreetingMessageSettings = "BusinessGreetingMessageSettings" + ClassBusinessConnectedBot = "BusinessConnectedBot" + ClassBusinessIntro = "BusinessIntro" + ClassInputBusinessIntro = "InputBusinessIntro" + ClassBusinessOpeningHoursInterval = "BusinessOpeningHoursInterval" + ClassBusinessOpeningHours = "BusinessOpeningHours" + ClassBusinessInfo = "BusinessInfo" + ClassChatPhotoSticker = "ChatPhotoSticker" + ClassAnimatedChatPhoto = "AnimatedChatPhoto" + ClassChatPhoto = "ChatPhoto" + ClassChatPhotos = "ChatPhotos" + ClassChatPermissions = "ChatPermissions" + ClassChatAdministratorRights = "ChatAdministratorRights" + ClassPremiumPaymentOption = "PremiumPaymentOption" + ClassPremiumStatePaymentOption = "PremiumStatePaymentOption" + ClassPremiumGiftCodePaymentOption = "PremiumGiftCodePaymentOption" + ClassPremiumGiftCodePaymentOptions = "PremiumGiftCodePaymentOptions" + ClassPremiumGiftCodeInfo = "PremiumGiftCodeInfo" + ClassAccentColor = "AccentColor" + ClassProfileAccentColors = "ProfileAccentColors" + ClassProfileAccentColor = "ProfileAccentColor" + ClassEmojiStatus = "EmojiStatus" + ClassEmojiStatuses = "EmojiStatuses" + ClassUsernames = "Usernames" + ClassUser = "User" + ClassBotInfo = "BotInfo" + ClassUserFullInfo = "UserFullInfo" + ClassUsers = "Users" + ClassChatAdministrator = "ChatAdministrator" + ClassChatAdministrators = "ChatAdministrators" + ClassChatMember = "ChatMember" + ClassChatMembers = "ChatMembers" + ClassChatInviteLink = "ChatInviteLink" + ClassChatInviteLinks = "ChatInviteLinks" + ClassChatInviteLinkCount = "ChatInviteLinkCount" + ClassChatInviteLinkCounts = "ChatInviteLinkCounts" + ClassChatInviteLinkMember = "ChatInviteLinkMember" + ClassChatInviteLinkMembers = "ChatInviteLinkMembers" + ClassChatInviteLinkInfo = "ChatInviteLinkInfo" + ClassChatJoinRequest = "ChatJoinRequest" + ClassChatJoinRequests = "ChatJoinRequests" + ClassChatJoinRequestsInfo = "ChatJoinRequestsInfo" + ClassBasicGroup = "BasicGroup" + ClassBasicGroupFullInfo = "BasicGroupFullInfo" + ClassSupergroup = "Supergroup" + ClassSupergroupFullInfo = "SupergroupFullInfo" + ClassSecretChat = "SecretChat" + ClassMessageSenders = "MessageSenders" + ClassChatMessageSender = "ChatMessageSender" + ClassChatMessageSenders = "ChatMessageSenders" + ClassMessageViewer = "MessageViewer" + ClassMessageViewers = "MessageViewers" + ClassForwardSource = "ForwardSource" + ClassMessageForwardInfo = "MessageForwardInfo" + ClassMessageImportInfo = "MessageImportInfo" + ClassMessageReplyInfo = "MessageReplyInfo" + ClassMessageReaction = "MessageReaction" + ClassMessageReactions = "MessageReactions" + ClassMessageInteractionInfo = "MessageInteractionInfo" + ClassUnreadReaction = "UnreadReaction" + ClassTextQuote = "TextQuote" + ClassInputTextQuote = "InputTextQuote" + ClassMessage = "Message" + ClassMessages = "Messages" + ClassFoundMessages = "FoundMessages" + ClassFoundChatMessages = "FoundChatMessages" + ClassMessagePosition = "MessagePosition" + ClassMessagePositions = "MessagePositions" + ClassMessageCalendarDay = "MessageCalendarDay" + ClassMessageCalendar = "MessageCalendar" + ClassBusinessMessage = "BusinessMessage" + ClassBusinessMessages = "BusinessMessages" + ClassMessageSponsor = "MessageSponsor" + ClassSponsoredMessage = "SponsoredMessage" + ClassSponsoredMessages = "SponsoredMessages" + ClassReportChatSponsoredMessageOption = "ReportChatSponsoredMessageOption" + ClassFileDownload = "FileDownload" + ClassDownloadedFileCounts = "DownloadedFileCounts" + ClassFoundFileDownloads = "FoundFileDownloads" + ClassChatNotificationSettings = "ChatNotificationSettings" + ClassScopeNotificationSettings = "ScopeNotificationSettings" + ClassDraftMessage = "DraftMessage" + ClassChatFolderIcon = "ChatFolderIcon" + ClassChatFolder = "ChatFolder" + ClassChatFolderInfo = "ChatFolderInfo" + ClassChatFolderInviteLink = "ChatFolderInviteLink" + ClassChatFolderInviteLinks = "ChatFolderInviteLinks" + ClassChatFolderInviteLinkInfo = "ChatFolderInviteLinkInfo" + ClassRecommendedChatFolder = "RecommendedChatFolder" + ClassRecommendedChatFolders = "RecommendedChatFolders" + ClassArchiveChatListSettings = "ArchiveChatListSettings" + ClassChatLists = "ChatLists" + ClassChatPosition = "ChatPosition" + ClassSavedMessagesTag = "SavedMessagesTag" + ClassSavedMessagesTags = "SavedMessagesTags" + ClassVideoChat = "VideoChat" + ClassChat = "Chat" + ClassChats = "Chats" + ClassChatNearby = "ChatNearby" + ClassChatsNearby = "ChatsNearby" + ClassKeyboardButton = "KeyboardButton" + ClassInlineKeyboardButton = "InlineKeyboardButton" + ClassFoundWebApp = "FoundWebApp" + ClassWebAppInfo = "WebAppInfo" + ClassMessageThreadInfo = "MessageThreadInfo" + ClassSavedMessagesTopic = "SavedMessagesTopic" + ClassForumTopicIcon = "ForumTopicIcon" + ClassForumTopicInfo = "ForumTopicInfo" + ClassForumTopic = "ForumTopic" + ClassForumTopics = "ForumTopics" + ClassLinkPreviewOptions = "LinkPreviewOptions" + ClassSharedUser = "SharedUser" + ClassSharedChat = "SharedChat" + ClassPageBlockCaption = "PageBlockCaption" + ClassPageBlockListItem = "PageBlockListItem" + ClassPageBlockTableCell = "PageBlockTableCell" + ClassPageBlockRelatedArticle = "PageBlockRelatedArticle" + ClassWebPageInstantView = "WebPageInstantView" + ClassWebPage = "WebPage" + ClassCountryInfo = "CountryInfo" + ClassCountries = "Countries" + ClassPhoneNumberInfo = "PhoneNumberInfo" + ClassCollectibleItemInfo = "CollectibleItemInfo" + ClassBankCardActionOpenUrl = "BankCardActionOpenUrl" + ClassBankCardInfo = "BankCardInfo" + ClassAddress = "Address" + ClassThemeParameters = "ThemeParameters" + ClassLabeledPricePart = "LabeledPricePart" + ClassInvoice = "Invoice" + ClassOrderInfo = "OrderInfo" + ClassShippingOption = "ShippingOption" + ClassSavedCredentials = "SavedCredentials" + ClassPaymentOption = "PaymentOption" + ClassPaymentForm = "PaymentForm" + ClassValidatedOrderInfo = "ValidatedOrderInfo" + ClassPaymentResult = "PaymentResult" + ClassPaymentReceipt = "PaymentReceipt" + ClassPremiumGiveawayParameters = "PremiumGiveawayParameters" + ClassDatedFile = "DatedFile" + ClassDate = "Date" + ClassPersonalDetails = "PersonalDetails" + ClassIdentityDocument = "IdentityDocument" + ClassInputIdentityDocument = "InputIdentityDocument" + ClassPersonalDocument = "PersonalDocument" + ClassInputPersonalDocument = "InputPersonalDocument" + ClassPassportElements = "PassportElements" + ClassPassportElementError = "PassportElementError" + ClassPassportSuitableElement = "PassportSuitableElement" + ClassPassportRequiredElement = "PassportRequiredElement" + ClassPassportAuthorizationForm = "PassportAuthorizationForm" + ClassPassportElementsWithErrors = "PassportElementsWithErrors" + ClassEncryptedCredentials = "EncryptedCredentials" + ClassEncryptedPassportElement = "EncryptedPassportElement" + ClassInputPassportElementError = "InputPassportElementError" + ClassInputThumbnail = "InputThumbnail" + ClassMessageSendOptions = "MessageSendOptions" + ClassMessageCopyOptions = "MessageCopyOptions" + ClassEmojiKeyword = "EmojiKeyword" + ClassEmojiKeywords = "EmojiKeywords" + ClassStickers = "Stickers" + ClassEmojis = "Emojis" + ClassStickerSet = "StickerSet" + ClassStickerSetInfo = "StickerSetInfo" + ClassStickerSets = "StickerSets" + ClassTrendingStickerSets = "TrendingStickerSets" + ClassEmojiCategory = "EmojiCategory" + ClassEmojiCategories = "EmojiCategories" + ClassStoryAreaPosition = "StoryAreaPosition" + ClassStoryArea = "StoryArea" + ClassInputStoryArea = "InputStoryArea" + ClassInputStoryAreas = "InputStoryAreas" + ClassStoryVideo = "StoryVideo" + ClassStoryRepostInfo = "StoryRepostInfo" + ClassStoryInteractionInfo = "StoryInteractionInfo" + ClassStory = "Story" + ClassStories = "Stories" + ClassStoryFullId = "StoryFullId" + ClassStoryInfo = "StoryInfo" + ClassChatActiveStories = "ChatActiveStories" + ClassStoryInteraction = "StoryInteraction" + ClassStoryInteractions = "StoryInteractions" + ClassQuickReplyMessage = "QuickReplyMessage" + ClassQuickReplyShortcut = "QuickReplyShortcut" + ClassPublicForwards = "PublicForwards" + ClassChatBoostLevelFeatures = "ChatBoostLevelFeatures" + ClassChatBoostFeatures = "ChatBoostFeatures" + ClassPrepaidPremiumGiveaway = "PrepaidPremiumGiveaway" + ClassChatBoostStatus = "ChatBoostStatus" + ClassChatBoost = "ChatBoost" + ClassFoundChatBoosts = "FoundChatBoosts" + ClassChatBoostSlot = "ChatBoostSlot" + ClassChatBoostSlots = "ChatBoostSlots" + ClassCallProtocol = "CallProtocol" + ClassCallServer = "CallServer" + ClassCallId = "CallId" + ClassGroupCallId = "GroupCallId" + ClassGroupCallStream = "GroupCallStream" + ClassGroupCallStreams = "GroupCallStreams" + ClassRtmpUrl = "RtmpUrl" + ClassGroupCallRecentSpeaker = "GroupCallRecentSpeaker" + ClassGroupCall = "GroupCall" + ClassGroupCallVideoSourceGroup = "GroupCallVideoSourceGroup" + ClassGroupCallParticipantVideoInfo = "GroupCallParticipantVideoInfo" + ClassGroupCallParticipant = "GroupCallParticipant" + ClassCall = "Call" + ClassPhoneNumberAuthenticationSettings = "PhoneNumberAuthenticationSettings" + ClassAddedReaction = "AddedReaction" + ClassAddedReactions = "AddedReactions" + ClassAvailableReaction = "AvailableReaction" + ClassAvailableReactions = "AvailableReactions" + ClassEmojiReaction = "EmojiReaction" + ClassAnimations = "Animations" + ClassImportedContacts = "ImportedContacts" + ClassBusinessConnection = "BusinessConnection" + ClassAttachmentMenuBotColor = "AttachmentMenuBotColor" + ClassAttachmentMenuBot = "AttachmentMenuBot" + ClassSentWebAppMessage = "SentWebAppMessage" + ClassHttpUrl = "HttpUrl" + ClassUserLink = "UserLink" + ClassInlineQueryResultsButton = "InlineQueryResultsButton" + ClassInlineQueryResults = "InlineQueryResults" + ClassCallbackQueryAnswer = "CallbackQueryAnswer" + ClassCustomRequestResult = "CustomRequestResult" + ClassGameHighScore = "GameHighScore" + ClassGameHighScores = "GameHighScores" + ClassChatEvent = "ChatEvent" + ClassChatEvents = "ChatEvents" + ClassChatEventLogFilters = "ChatEventLogFilters" + ClassLanguagePackString = "LanguagePackString" + ClassLanguagePackStrings = "LanguagePackStrings" + ClassLanguagePackInfo = "LanguagePackInfo" + ClassLocalizationTargetInfo = "LocalizationTargetInfo" + ClassPremiumLimit = "PremiumLimit" + ClassPremiumFeatures = "PremiumFeatures" + ClassBusinessFeatures = "BusinessFeatures" + ClassPremiumFeaturePromotionAnimation = "PremiumFeaturePromotionAnimation" + ClassBusinessFeaturePromotionAnimation = "BusinessFeaturePromotionAnimation" + ClassPremiumState = "PremiumState" + Class//-To = "https://my.telegram.org" + ClassPushReceiverId = "PushReceiverId" + ClassThemeSettings = "ThemeSettings" + ClassChatTheme = "ChatTheme" + ClassTimeZone = "TimeZone" + ClassTimeZones = "TimeZones" + ClassHashtags = "Hashtags" + ClassNotificationSound = "NotificationSound" + ClassNotificationSounds = "NotificationSounds" + ClassNotification = "Notification" + ClassNotificationGroup = "NotificationGroup" + ClassJsonObjectMember = "JsonObjectMember" + ClassUserPrivacySettingRules = "UserPrivacySettingRules" + ClassReadDatePrivacySettings = "ReadDatePrivacySettings" + ClassNewChatPrivacySettings = "NewChatPrivacySettings" + ClassAccountTtl = "AccountTtl" + ClassMessageAutoDeleteTime = "MessageAutoDeleteTime" + ClassSession = "Session" + ClassSessions = "Sessions" + ClassUnconfirmedSession = "UnconfirmedSession" + ClassConnectedWebsite = "ConnectedWebsite" + ClassConnectedWebsites = "ConnectedWebsites" + ClassMessageLink = "MessageLink" + ClassMessageLinkInfo = "MessageLinkInfo" + ClassChatBoostLink = "ChatBoostLink" + ClassChatBoostLinkInfo = "ChatBoostLinkInfo" + ClassFilePart = "FilePart" + ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" + ClassStorageStatisticsByChat = "StorageStatisticsByChat" + ClassStorageStatistics = "StorageStatistics" + ClassStorageStatisticsFast = "StorageStatisticsFast" + ClassDatabaseStatistics = "DatabaseStatistics" + ClassNetworkStatistics = "NetworkStatistics" + ClassAutoDownloadSettings = "AutoDownloadSettings" + ClassAutoDownloadSettingsPresets = "AutoDownloadSettingsPresets" + ClassScopeAutosaveSettings = "ScopeAutosaveSettings" + ClassAutosaveSettingsException = "AutosaveSettingsException" + ClassAutosaveSettings = "AutosaveSettings" + ClassFoundPosition = "FoundPosition" + ClassFoundPositions = "FoundPositions" + ClassTMeUrl = "TMeUrl" + ClassTMeUrls = "TMeUrls" + ClassCount = "Count" + ClassText = "Text" + ClassSeconds = "Seconds" + ClassFileDownloadedPrefixSize = "FileDownloadedPrefixSize" + ClassDeepLinkInfo = "DeepLinkInfo" + ClassProxy = "Proxy" + ClassProxies = "Proxies" + ClassInputSticker = "InputSticker" + ClassDateRange = "DateRange" + ClassStatisticalValue = "StatisticalValue" + ClassChatStatisticsInteractionInfo = "ChatStatisticsInteractionInfo" + ClassChatStatisticsMessageSenderInfo = "ChatStatisticsMessageSenderInfo" + ClassChatStatisticsAdministratorActionsInfo = "ChatStatisticsAdministratorActionsInfo" + ClassChatStatisticsInviterInfo = "ChatStatisticsInviterInfo" + ClassMessageStatistics = "MessageStatistics" + ClassStoryStatistics = "StoryStatistics" + ClassPoint = "Point" + ClassUpdates = "Updates" + ClassLogVerbosityLevel = "LogVerbosityLevel" + ClassLogTags = "LogTags" + ClassUserSupportInfo = "UserSupportInfo" + ClassTestInt = "TestInt" + ClassTestString = "TestString" + ClassTestBytes = "TestBytes" + ClassTestVectorInt = "TestVectorInt" + ClassTestVectorIntObject = "TestVectorIntObject" + ClassTestVectorString = "TestVectorString" + ClassTestVectorStringObject = "TestVectorStringObject" ) const ( - TypeError = "error" - TypeOk = "ok" - TypeAuthenticationCodeTypeTelegramMessage = "authenticationCodeTypeTelegramMessage" - TypeAuthenticationCodeTypeSms = "authenticationCodeTypeSms" - TypeAuthenticationCodeTypeCall = "authenticationCodeTypeCall" - TypeAuthenticationCodeTypeFlashCall = "authenticationCodeTypeFlashCall" - TypeAuthenticationCodeTypeMissedCall = "authenticationCodeTypeMissedCall" - TypeAuthenticationCodeTypeFragment = "authenticationCodeTypeFragment" - TypeAuthenticationCodeInfo = "authenticationCodeInfo" - TypeEmailAddressAuthenticationCodeInfo = "emailAddressAuthenticationCodeInfo" - TypeEmailAddressAuthenticationCode = "emailAddressAuthenticationCode" - TypeEmailAddressAuthenticationAppleId = "emailAddressAuthenticationAppleId" - TypeEmailAddressAuthenticationGoogleId = "emailAddressAuthenticationGoogleId" - TypeTextEntity = "textEntity" - TypeTextEntities = "textEntities" - TypeFormattedText = "formattedText" - TypeTermsOfService = "termsOfService" - TypeAuthorizationStateWaitTdlibParameters = "authorizationStateWaitTdlibParameters" - TypeAuthorizationStateWaitPhoneNumber = "authorizationStateWaitPhoneNumber" - TypeAuthorizationStateWaitEmailAddress = "authorizationStateWaitEmailAddress" - TypeAuthorizationStateWaitEmailCode = "authorizationStateWaitEmailCode" - TypeAuthorizationStateWaitCode = "authorizationStateWaitCode" - TypeAuthorizationStateWaitOtherDeviceConfirmation = "authorizationStateWaitOtherDeviceConfirmation" - TypeAuthorizationStateWaitRegistration = "authorizationStateWaitRegistration" - TypeAuthorizationStateWaitPassword = "authorizationStateWaitPassword" - TypeAuthorizationStateReady = "authorizationStateReady" - TypeAuthorizationStateLoggingOut = "authorizationStateLoggingOut" - TypeAuthorizationStateClosing = "authorizationStateClosing" - TypeAuthorizationStateClosed = "authorizationStateClosed" - TypePasswordState = "passwordState" - TypeRecoveryEmailAddress = "recoveryEmailAddress" - TypeTemporaryPasswordState = "temporaryPasswordState" - TypeLocalFile = "localFile" - TypeRemoteFile = "remoteFile" - TypeFile = "file" - TypeInputFileId = "inputFileId" - TypeInputFileRemote = "inputFileRemote" - TypeInputFileLocal = "inputFileLocal" - TypeInputFileGenerated = "inputFileGenerated" - TypePhotoSize = "photoSize" - TypeMinithumbnail = "minithumbnail" - TypeThumbnailFormatJpeg = "thumbnailFormatJpeg" - TypeThumbnailFormatGif = "thumbnailFormatGif" - TypeThumbnailFormatMpeg4 = "thumbnailFormatMpeg4" - TypeThumbnailFormatPng = "thumbnailFormatPng" - TypeThumbnailFormatTgs = "thumbnailFormatTgs" - TypeThumbnailFormatWebm = "thumbnailFormatWebm" - TypeThumbnailFormatWebp = "thumbnailFormatWebp" - TypeThumbnail = "thumbnail" - TypeMaskPointForehead = "maskPointForehead" - TypeMaskPointEyes = "maskPointEyes" - TypeMaskPointMouth = "maskPointMouth" - TypeMaskPointChin = "maskPointChin" - TypeMaskPosition = "maskPosition" - TypeStickerFormatWebp = "stickerFormatWebp" - TypeStickerFormatTgs = "stickerFormatTgs" - TypeStickerFormatWebm = "stickerFormatWebm" - TypeStickerTypeRegular = "stickerTypeRegular" - TypeStickerTypeMask = "stickerTypeMask" - TypeStickerTypeCustomEmoji = "stickerTypeCustomEmoji" - TypeStickerFullTypeRegular = "stickerFullTypeRegular" - TypeStickerFullTypeMask = "stickerFullTypeMask" - TypeStickerFullTypeCustomEmoji = "stickerFullTypeCustomEmoji" - TypeClosedVectorPath = "closedVectorPath" - TypePollOption = "pollOption" - TypePollTypeRegular = "pollTypeRegular" - TypePollTypeQuiz = "pollTypeQuiz" - TypeAnimation = "animation" - TypeAudio = "audio" - TypeDocument = "document" - TypePhoto = "photo" - TypeSticker = "sticker" - TypeVideo = "video" - TypeVideoNote = "videoNote" - TypeVoiceNote = "voiceNote" - TypeAnimatedEmoji = "animatedEmoji" - TypeContact = "contact" - TypeLocation = "location" - TypeVenue = "venue" - TypeGame = "game" - TypePoll = "poll" - TypeProfilePhoto = "profilePhoto" - TypeChatPhotoInfo = "chatPhotoInfo" - TypeUserTypeRegular = "userTypeRegular" - TypeUserTypeDeleted = "userTypeDeleted" - TypeUserTypeBot = "userTypeBot" - TypeUserTypeUnknown = "userTypeUnknown" - TypeBotCommand = "botCommand" - TypeBotCommands = "botCommands" - TypeBotMenuButton = "botMenuButton" - TypeChatLocation = "chatLocation" - TypeAnimatedChatPhoto = "animatedChatPhoto" - TypeChatPhoto = "chatPhoto" - TypeChatPhotos = "chatPhotos" - TypeInputChatPhotoPrevious = "inputChatPhotoPrevious" - TypeInputChatPhotoStatic = "inputChatPhotoStatic" - TypeInputChatPhotoAnimation = "inputChatPhotoAnimation" - TypeChatPermissions = "chatPermissions" - TypeChatAdministratorRights = "chatAdministratorRights" - TypePremiumPaymentOption = "premiumPaymentOption" - TypeEmojiStatus = "emojiStatus" - TypeEmojiStatuses = "emojiStatuses" - TypeUsernames = "usernames" - TypeUser = "user" - TypeBotInfo = "botInfo" - TypeUserFullInfo = "userFullInfo" - TypeUsers = "users" - TypeChatAdministrator = "chatAdministrator" - TypeChatAdministrators = "chatAdministrators" - TypeChatMemberStatusCreator = "chatMemberStatusCreator" - TypeChatMemberStatusAdministrator = "chatMemberStatusAdministrator" - TypeChatMemberStatusMember = "chatMemberStatusMember" - TypeChatMemberStatusRestricted = "chatMemberStatusRestricted" - TypeChatMemberStatusLeft = "chatMemberStatusLeft" - TypeChatMemberStatusBanned = "chatMemberStatusBanned" - TypeChatMember = "chatMember" - TypeChatMembers = "chatMembers" - TypeChatMembersFilterContacts = "chatMembersFilterContacts" - TypeChatMembersFilterAdministrators = "chatMembersFilterAdministrators" - TypeChatMembersFilterMembers = "chatMembersFilterMembers" - TypeChatMembersFilterMention = "chatMembersFilterMention" - TypeChatMembersFilterRestricted = "chatMembersFilterRestricted" - TypeChatMembersFilterBanned = "chatMembersFilterBanned" - TypeChatMembersFilterBots = "chatMembersFilterBots" - TypeSupergroupMembersFilterRecent = "supergroupMembersFilterRecent" - TypeSupergroupMembersFilterContacts = "supergroupMembersFilterContacts" - TypeSupergroupMembersFilterAdministrators = "supergroupMembersFilterAdministrators" - TypeSupergroupMembersFilterSearch = "supergroupMembersFilterSearch" - TypeSupergroupMembersFilterRestricted = "supergroupMembersFilterRestricted" - TypeSupergroupMembersFilterBanned = "supergroupMembersFilterBanned" - TypeSupergroupMembersFilterMention = "supergroupMembersFilterMention" - TypeSupergroupMembersFilterBots = "supergroupMembersFilterBots" - TypeChatInviteLink = "chatInviteLink" - TypeChatInviteLinks = "chatInviteLinks" - TypeChatInviteLinkCount = "chatInviteLinkCount" - TypeChatInviteLinkCounts = "chatInviteLinkCounts" - TypeChatInviteLinkMember = "chatInviteLinkMember" - TypeChatInviteLinkMembers = "chatInviteLinkMembers" - TypeChatInviteLinkInfo = "chatInviteLinkInfo" - TypeChatJoinRequest = "chatJoinRequest" - TypeChatJoinRequests = "chatJoinRequests" - TypeChatJoinRequestsInfo = "chatJoinRequestsInfo" - TypeBasicGroup = "basicGroup" - TypeBasicGroupFullInfo = "basicGroupFullInfo" - TypeSupergroup = "supergroup" - TypeSupergroupFullInfo = "supergroupFullInfo" - TypeSecretChatStatePending = "secretChatStatePending" - TypeSecretChatStateReady = "secretChatStateReady" - TypeSecretChatStateClosed = "secretChatStateClosed" - TypeSecretChat = "secretChat" - TypeMessageSenderUser = "messageSenderUser" - TypeMessageSenderChat = "messageSenderChat" - TypeMessageSenders = "messageSenders" - TypeChatMessageSender = "chatMessageSender" - TypeChatMessageSenders = "chatMessageSenders" - TypeMessageForwardOriginUser = "messageForwardOriginUser" - TypeMessageForwardOriginChat = "messageForwardOriginChat" - TypeMessageForwardOriginHiddenUser = "messageForwardOriginHiddenUser" - TypeMessageForwardOriginChannel = "messageForwardOriginChannel" - TypeMessageForwardOriginMessageImport = "messageForwardOriginMessageImport" - TypeReactionTypeEmoji = "reactionTypeEmoji" - TypeReactionTypeCustomEmoji = "reactionTypeCustomEmoji" - TypeMessageForwardInfo = "messageForwardInfo" - TypeMessageReplyInfo = "messageReplyInfo" - TypeMessageReaction = "messageReaction" - TypeMessageInteractionInfo = "messageInteractionInfo" - TypeUnreadReaction = "unreadReaction" - TypeMessageSendingStatePending = "messageSendingStatePending" - TypeMessageSendingStateFailed = "messageSendingStateFailed" - TypeMessage = "message" - TypeMessages = "messages" - TypeFoundMessages = "foundMessages" - TypeFoundChatMessages = "foundChatMessages" - TypeMessagePosition = "messagePosition" - TypeMessagePositions = "messagePositions" - TypeMessageCalendarDay = "messageCalendarDay" - TypeMessageCalendar = "messageCalendar" - TypeSponsoredMessage = "sponsoredMessage" - TypeSponsoredMessages = "sponsoredMessages" - TypeFileDownload = "fileDownload" - TypeDownloadedFileCounts = "downloadedFileCounts" - TypeFoundFileDownloads = "foundFileDownloads" - TypeNotificationSettingsScopePrivateChats = "notificationSettingsScopePrivateChats" - TypeNotificationSettingsScopeGroupChats = "notificationSettingsScopeGroupChats" - TypeNotificationSettingsScopeChannelChats = "notificationSettingsScopeChannelChats" - TypeChatNotificationSettings = "chatNotificationSettings" - TypeScopeNotificationSettings = "scopeNotificationSettings" - TypeDraftMessage = "draftMessage" - TypeChatTypePrivate = "chatTypePrivate" - TypeChatTypeBasicGroup = "chatTypeBasicGroup" - TypeChatTypeSupergroup = "chatTypeSupergroup" - TypeChatTypeSecret = "chatTypeSecret" - TypeChatFilter = "chatFilter" - TypeChatFilterInfo = "chatFilterInfo" - TypeRecommendedChatFilter = "recommendedChatFilter" - TypeRecommendedChatFilters = "recommendedChatFilters" - TypeChatListMain = "chatListMain" - TypeChatListArchive = "chatListArchive" - TypeChatListFilter = "chatListFilter" - TypeChatLists = "chatLists" - TypeChatSourceMtprotoProxy = "chatSourceMtprotoProxy" - TypeChatSourcePublicServiceAnnouncement = "chatSourcePublicServiceAnnouncement" - TypeChatPosition = "chatPosition" - TypeChatAvailableReactionsAll = "chatAvailableReactionsAll" - TypeChatAvailableReactionsSome = "chatAvailableReactionsSome" - TypeVideoChat = "videoChat" - TypeChat = "chat" - TypeChats = "chats" - TypeChatNearby = "chatNearby" - TypeChatsNearby = "chatsNearby" - TypePublicChatTypeHasUsername = "publicChatTypeHasUsername" - TypePublicChatTypeIsLocationBased = "publicChatTypeIsLocationBased" - TypeChatActionBarReportSpam = "chatActionBarReportSpam" - TypeChatActionBarReportUnrelatedLocation = "chatActionBarReportUnrelatedLocation" - TypeChatActionBarInviteMembers = "chatActionBarInviteMembers" - TypeChatActionBarReportAddBlock = "chatActionBarReportAddBlock" - TypeChatActionBarAddContact = "chatActionBarAddContact" - TypeChatActionBarSharePhoneNumber = "chatActionBarSharePhoneNumber" - TypeChatActionBarJoinRequest = "chatActionBarJoinRequest" - TypeKeyboardButtonTypeText = "keyboardButtonTypeText" - TypeKeyboardButtonTypeRequestPhoneNumber = "keyboardButtonTypeRequestPhoneNumber" - TypeKeyboardButtonTypeRequestLocation = "keyboardButtonTypeRequestLocation" - TypeKeyboardButtonTypeRequestPoll = "keyboardButtonTypeRequestPoll" - TypeKeyboardButtonTypeWebApp = "keyboardButtonTypeWebApp" - TypeKeyboardButton = "keyboardButton" - TypeInlineKeyboardButtonTypeUrl = "inlineKeyboardButtonTypeUrl" - TypeInlineKeyboardButtonTypeLoginUrl = "inlineKeyboardButtonTypeLoginUrl" - TypeInlineKeyboardButtonTypeWebApp = "inlineKeyboardButtonTypeWebApp" - TypeInlineKeyboardButtonTypeCallback = "inlineKeyboardButtonTypeCallback" - TypeInlineKeyboardButtonTypeCallbackWithPassword = "inlineKeyboardButtonTypeCallbackWithPassword" - TypeInlineKeyboardButtonTypeCallbackGame = "inlineKeyboardButtonTypeCallbackGame" - TypeInlineKeyboardButtonTypeSwitchInline = "inlineKeyboardButtonTypeSwitchInline" - TypeInlineKeyboardButtonTypeBuy = "inlineKeyboardButtonTypeBuy" - TypeInlineKeyboardButtonTypeUser = "inlineKeyboardButtonTypeUser" - TypeInlineKeyboardButton = "inlineKeyboardButton" - TypeReplyMarkupRemoveKeyboard = "replyMarkupRemoveKeyboard" - TypeReplyMarkupForceReply = "replyMarkupForceReply" - TypeReplyMarkupShowKeyboard = "replyMarkupShowKeyboard" - TypeReplyMarkupInlineKeyboard = "replyMarkupInlineKeyboard" - TypeLoginUrlInfoOpen = "loginUrlInfoOpen" - TypeLoginUrlInfoRequestConfirmation = "loginUrlInfoRequestConfirmation" - TypeWebAppInfo = "webAppInfo" - TypeMessageThreadInfo = "messageThreadInfo" - TypeForumTopicIcon = "forumTopicIcon" - TypeForumTopicInfo = "forumTopicInfo" - TypeForumTopic = "forumTopic" - TypeForumTopics = "forumTopics" - TypeRichTextPlain = "richTextPlain" - TypeRichTextBold = "richTextBold" - TypeRichTextItalic = "richTextItalic" - TypeRichTextUnderline = "richTextUnderline" - TypeRichTextStrikethrough = "richTextStrikethrough" - TypeRichTextFixed = "richTextFixed" - TypeRichTextUrl = "richTextUrl" - TypeRichTextEmailAddress = "richTextEmailAddress" - TypeRichTextSubscript = "richTextSubscript" - TypeRichTextSuperscript = "richTextSuperscript" - TypeRichTextMarked = "richTextMarked" - TypeRichTextPhoneNumber = "richTextPhoneNumber" - TypeRichTextIcon = "richTextIcon" - TypeRichTextReference = "richTextReference" - TypeRichTextAnchor = "richTextAnchor" - TypeRichTextAnchorLink = "richTextAnchorLink" - TypeRichTexts = "richTexts" - TypePageBlockCaption = "pageBlockCaption" - TypePageBlockListItem = "pageBlockListItem" - TypePageBlockHorizontalAlignmentLeft = "pageBlockHorizontalAlignmentLeft" - TypePageBlockHorizontalAlignmentCenter = "pageBlockHorizontalAlignmentCenter" - TypePageBlockHorizontalAlignmentRight = "pageBlockHorizontalAlignmentRight" - TypePageBlockVerticalAlignmentTop = "pageBlockVerticalAlignmentTop" - TypePageBlockVerticalAlignmentMiddle = "pageBlockVerticalAlignmentMiddle" - TypePageBlockVerticalAlignmentBottom = "pageBlockVerticalAlignmentBottom" - TypePageBlockTableCell = "pageBlockTableCell" - TypePageBlockRelatedArticle = "pageBlockRelatedArticle" - TypePageBlockTitle = "pageBlockTitle" - TypePageBlockSubtitle = "pageBlockSubtitle" - TypePageBlockAuthorDate = "pageBlockAuthorDate" - TypePageBlockHeader = "pageBlockHeader" - TypePageBlockSubheader = "pageBlockSubheader" - TypePageBlockKicker = "pageBlockKicker" - TypePageBlockParagraph = "pageBlockParagraph" - TypePageBlockPreformatted = "pageBlockPreformatted" - TypePageBlockFooter = "pageBlockFooter" - TypePageBlockDivider = "pageBlockDivider" - TypePageBlockAnchor = "pageBlockAnchor" - TypePageBlockList = "pageBlockList" - TypePageBlockBlockQuote = "pageBlockBlockQuote" - TypePageBlockPullQuote = "pageBlockPullQuote" - TypePageBlockAnimation = "pageBlockAnimation" - TypePageBlockAudio = "pageBlockAudio" - TypePageBlockPhoto = "pageBlockPhoto" - TypePageBlockVideo = "pageBlockVideo" - TypePageBlockVoiceNote = "pageBlockVoiceNote" - TypePageBlockCover = "pageBlockCover" - TypePageBlockEmbedded = "pageBlockEmbedded" - TypePageBlockEmbeddedPost = "pageBlockEmbeddedPost" - TypePageBlockCollage = "pageBlockCollage" - TypePageBlockSlideshow = "pageBlockSlideshow" - TypePageBlockChatLink = "pageBlockChatLink" - TypePageBlockTable = "pageBlockTable" - TypePageBlockDetails = "pageBlockDetails" - TypePageBlockRelatedArticles = "pageBlockRelatedArticles" - TypePageBlockMap = "pageBlockMap" - TypeWebPageInstantView = "webPageInstantView" - TypeWebPage = "webPage" - TypeCountryInfo = "countryInfo" - TypeCountries = "countries" - TypePhoneNumberInfo = "phoneNumberInfo" - TypeBankCardActionOpenUrl = "bankCardActionOpenUrl" - TypeBankCardInfo = "bankCardInfo" - TypeAddress = "address" - TypeThemeParameters = "themeParameters" - TypeLabeledPricePart = "labeledPricePart" - TypeInvoice = "invoice" - TypeOrderInfo = "orderInfo" - TypeShippingOption = "shippingOption" - TypeSavedCredentials = "savedCredentials" - TypeInputCredentialsSaved = "inputCredentialsSaved" - TypeInputCredentialsNew = "inputCredentialsNew" - TypeInputCredentialsApplePay = "inputCredentialsApplePay" - TypeInputCredentialsGooglePay = "inputCredentialsGooglePay" - TypePaymentProviderSmartGlocal = "paymentProviderSmartGlocal" - TypePaymentProviderStripe = "paymentProviderStripe" - TypePaymentProviderOther = "paymentProviderOther" - TypePaymentOption = "paymentOption" - TypePaymentForm = "paymentForm" - TypeValidatedOrderInfo = "validatedOrderInfo" - TypePaymentResult = "paymentResult" - TypePaymentReceipt = "paymentReceipt" - TypeInputInvoiceMessage = "inputInvoiceMessage" - TypeInputInvoiceName = "inputInvoiceName" - TypeMessageExtendedMediaPreview = "messageExtendedMediaPreview" - TypeMessageExtendedMediaPhoto = "messageExtendedMediaPhoto" - TypeMessageExtendedMediaVideo = "messageExtendedMediaVideo" - TypeMessageExtendedMediaUnsupported = "messageExtendedMediaUnsupported" - TypeDatedFile = "datedFile" - TypePassportElementTypePersonalDetails = "passportElementTypePersonalDetails" - TypePassportElementTypePassport = "passportElementTypePassport" - TypePassportElementTypeDriverLicense = "passportElementTypeDriverLicense" - TypePassportElementTypeIdentityCard = "passportElementTypeIdentityCard" - TypePassportElementTypeInternalPassport = "passportElementTypeInternalPassport" - TypePassportElementTypeAddress = "passportElementTypeAddress" - TypePassportElementTypeUtilityBill = "passportElementTypeUtilityBill" - TypePassportElementTypeBankStatement = "passportElementTypeBankStatement" - TypePassportElementTypeRentalAgreement = "passportElementTypeRentalAgreement" - TypePassportElementTypePassportRegistration = "passportElementTypePassportRegistration" - TypePassportElementTypeTemporaryRegistration = "passportElementTypeTemporaryRegistration" - TypePassportElementTypePhoneNumber = "passportElementTypePhoneNumber" - TypePassportElementTypeEmailAddress = "passportElementTypeEmailAddress" - TypeDate = "date" - TypePersonalDetails = "personalDetails" - TypeIdentityDocument = "identityDocument" - TypeInputIdentityDocument = "inputIdentityDocument" - TypePersonalDocument = "personalDocument" - TypeInputPersonalDocument = "inputPersonalDocument" - TypePassportElementPersonalDetails = "passportElementPersonalDetails" - TypePassportElementPassport = "passportElementPassport" - TypePassportElementDriverLicense = "passportElementDriverLicense" - TypePassportElementIdentityCard = "passportElementIdentityCard" - TypePassportElementInternalPassport = "passportElementInternalPassport" - TypePassportElementAddress = "passportElementAddress" - TypePassportElementUtilityBill = "passportElementUtilityBill" - TypePassportElementBankStatement = "passportElementBankStatement" - TypePassportElementRentalAgreement = "passportElementRentalAgreement" - TypePassportElementPassportRegistration = "passportElementPassportRegistration" - TypePassportElementTemporaryRegistration = "passportElementTemporaryRegistration" - TypePassportElementPhoneNumber = "passportElementPhoneNumber" - TypePassportElementEmailAddress = "passportElementEmailAddress" - TypeInputPassportElementPersonalDetails = "inputPassportElementPersonalDetails" - TypeInputPassportElementPassport = "inputPassportElementPassport" - TypeInputPassportElementDriverLicense = "inputPassportElementDriverLicense" - TypeInputPassportElementIdentityCard = "inputPassportElementIdentityCard" - TypeInputPassportElementInternalPassport = "inputPassportElementInternalPassport" - TypeInputPassportElementAddress = "inputPassportElementAddress" - TypeInputPassportElementUtilityBill = "inputPassportElementUtilityBill" - TypeInputPassportElementBankStatement = "inputPassportElementBankStatement" - TypeInputPassportElementRentalAgreement = "inputPassportElementRentalAgreement" - TypeInputPassportElementPassportRegistration = "inputPassportElementPassportRegistration" - TypeInputPassportElementTemporaryRegistration = "inputPassportElementTemporaryRegistration" - TypeInputPassportElementPhoneNumber = "inputPassportElementPhoneNumber" - TypeInputPassportElementEmailAddress = "inputPassportElementEmailAddress" - TypePassportElements = "passportElements" - TypePassportElementErrorSourceUnspecified = "passportElementErrorSourceUnspecified" - TypePassportElementErrorSourceDataField = "passportElementErrorSourceDataField" - TypePassportElementErrorSourceFrontSide = "passportElementErrorSourceFrontSide" - TypePassportElementErrorSourceReverseSide = "passportElementErrorSourceReverseSide" - TypePassportElementErrorSourceSelfie = "passportElementErrorSourceSelfie" - TypePassportElementErrorSourceTranslationFile = "passportElementErrorSourceTranslationFile" - TypePassportElementErrorSourceTranslationFiles = "passportElementErrorSourceTranslationFiles" - TypePassportElementErrorSourceFile = "passportElementErrorSourceFile" - TypePassportElementErrorSourceFiles = "passportElementErrorSourceFiles" - TypePassportElementError = "passportElementError" - TypePassportSuitableElement = "passportSuitableElement" - TypePassportRequiredElement = "passportRequiredElement" - TypePassportAuthorizationForm = "passportAuthorizationForm" - TypePassportElementsWithErrors = "passportElementsWithErrors" - TypeEncryptedCredentials = "encryptedCredentials" - TypeEncryptedPassportElement = "encryptedPassportElement" - TypeInputPassportElementErrorSourceUnspecified = "inputPassportElementErrorSourceUnspecified" - TypeInputPassportElementErrorSourceDataField = "inputPassportElementErrorSourceDataField" - TypeInputPassportElementErrorSourceFrontSide = "inputPassportElementErrorSourceFrontSide" - TypeInputPassportElementErrorSourceReverseSide = "inputPassportElementErrorSourceReverseSide" - TypeInputPassportElementErrorSourceSelfie = "inputPassportElementErrorSourceSelfie" - TypeInputPassportElementErrorSourceTranslationFile = "inputPassportElementErrorSourceTranslationFile" - TypeInputPassportElementErrorSourceTranslationFiles = "inputPassportElementErrorSourceTranslationFiles" - TypeInputPassportElementErrorSourceFile = "inputPassportElementErrorSourceFile" - TypeInputPassportElementErrorSourceFiles = "inputPassportElementErrorSourceFiles" - TypeInputPassportElementError = "inputPassportElementError" - TypeMessageText = "messageText" - TypeMessageAnimation = "messageAnimation" - TypeMessageAudio = "messageAudio" - TypeMessageDocument = "messageDocument" - TypeMessagePhoto = "messagePhoto" - TypeMessageExpiredPhoto = "messageExpiredPhoto" - TypeMessageSticker = "messageSticker" - TypeMessageVideo = "messageVideo" - TypeMessageExpiredVideo = "messageExpiredVideo" - TypeMessageVideoNote = "messageVideoNote" - TypeMessageVoiceNote = "messageVoiceNote" - TypeMessageLocation = "messageLocation" - TypeMessageVenue = "messageVenue" - TypeMessageContact = "messageContact" - TypeMessageAnimatedEmoji = "messageAnimatedEmoji" - TypeMessageDice = "messageDice" - TypeMessageGame = "messageGame" - TypeMessagePoll = "messagePoll" - TypeMessageInvoice = "messageInvoice" - TypeMessageCall = "messageCall" - TypeMessageVideoChatScheduled = "messageVideoChatScheduled" - TypeMessageVideoChatStarted = "messageVideoChatStarted" - TypeMessageVideoChatEnded = "messageVideoChatEnded" - TypeMessageInviteVideoChatParticipants = "messageInviteVideoChatParticipants" - TypeMessageBasicGroupChatCreate = "messageBasicGroupChatCreate" - TypeMessageSupergroupChatCreate = "messageSupergroupChatCreate" - TypeMessageChatChangeTitle = "messageChatChangeTitle" - TypeMessageChatChangePhoto = "messageChatChangePhoto" - TypeMessageChatDeletePhoto = "messageChatDeletePhoto" - TypeMessageChatAddMembers = "messageChatAddMembers" - TypeMessageChatJoinByLink = "messageChatJoinByLink" - TypeMessageChatJoinByRequest = "messageChatJoinByRequest" - TypeMessageChatDeleteMember = "messageChatDeleteMember" - TypeMessageChatUpgradeTo = "messageChatUpgradeTo" - TypeMessageChatUpgradeFrom = "messageChatUpgradeFrom" - TypeMessagePinMessage = "messagePinMessage" - TypeMessageScreenshotTaken = "messageScreenshotTaken" - TypeMessageChatSetTheme = "messageChatSetTheme" - TypeMessageChatSetMessageAutoDeleteTime = "messageChatSetMessageAutoDeleteTime" - TypeMessageForumTopicCreated = "messageForumTopicCreated" - TypeMessageForumTopicEdited = "messageForumTopicEdited" - TypeMessageForumTopicIsClosedToggled = "messageForumTopicIsClosedToggled" - TypeMessageForumTopicIsHiddenToggled = "messageForumTopicIsHiddenToggled" - TypeMessageSuggestProfilePhoto = "messageSuggestProfilePhoto" - TypeMessageCustomServiceAction = "messageCustomServiceAction" - TypeMessageGameScore = "messageGameScore" - TypeMessagePaymentSuccessful = "messagePaymentSuccessful" - TypeMessagePaymentSuccessfulBot = "messagePaymentSuccessfulBot" - TypeMessageGiftedPremium = "messageGiftedPremium" - TypeMessageContactRegistered = "messageContactRegistered" - TypeMessageWebsiteConnected = "messageWebsiteConnected" - TypeMessageBotWriteAccessAllowed = "messageBotWriteAccessAllowed" - TypeMessageWebAppDataSent = "messageWebAppDataSent" - TypeMessageWebAppDataReceived = "messageWebAppDataReceived" - TypeMessagePassportDataSent = "messagePassportDataSent" - TypeMessagePassportDataReceived = "messagePassportDataReceived" - TypeMessageProximityAlertTriggered = "messageProximityAlertTriggered" - TypeMessageUnsupported = "messageUnsupported" - TypeTextEntityTypeMention = "textEntityTypeMention" - TypeTextEntityTypeHashtag = "textEntityTypeHashtag" - TypeTextEntityTypeCashtag = "textEntityTypeCashtag" - TypeTextEntityTypeBotCommand = "textEntityTypeBotCommand" - TypeTextEntityTypeUrl = "textEntityTypeUrl" - TypeTextEntityTypeEmailAddress = "textEntityTypeEmailAddress" - TypeTextEntityTypePhoneNumber = "textEntityTypePhoneNumber" - TypeTextEntityTypeBankCardNumber = "textEntityTypeBankCardNumber" - TypeTextEntityTypeBold = "textEntityTypeBold" - TypeTextEntityTypeItalic = "textEntityTypeItalic" - TypeTextEntityTypeUnderline = "textEntityTypeUnderline" - TypeTextEntityTypeStrikethrough = "textEntityTypeStrikethrough" - TypeTextEntityTypeSpoiler = "textEntityTypeSpoiler" - TypeTextEntityTypeCode = "textEntityTypeCode" - TypeTextEntityTypePre = "textEntityTypePre" - TypeTextEntityTypePreCode = "textEntityTypePreCode" - TypeTextEntityTypeTextUrl = "textEntityTypeTextUrl" - TypeTextEntityTypeMentionName = "textEntityTypeMentionName" - TypeTextEntityTypeCustomEmoji = "textEntityTypeCustomEmoji" - TypeTextEntityTypeMediaTimestamp = "textEntityTypeMediaTimestamp" - TypeInputThumbnail = "inputThumbnail" - TypeMessageSchedulingStateSendAtDate = "messageSchedulingStateSendAtDate" - TypeMessageSchedulingStateSendWhenOnline = "messageSchedulingStateSendWhenOnline" - TypeMessageSendOptions = "messageSendOptions" - TypeMessageCopyOptions = "messageCopyOptions" - TypeInputMessageText = "inputMessageText" - TypeInputMessageAnimation = "inputMessageAnimation" - TypeInputMessageAudio = "inputMessageAudio" - TypeInputMessageDocument = "inputMessageDocument" - TypeInputMessagePhoto = "inputMessagePhoto" - TypeInputMessageSticker = "inputMessageSticker" - TypeInputMessageVideo = "inputMessageVideo" - TypeInputMessageVideoNote = "inputMessageVideoNote" - TypeInputMessageVoiceNote = "inputMessageVoiceNote" - TypeInputMessageLocation = "inputMessageLocation" - TypeInputMessageVenue = "inputMessageVenue" - TypeInputMessageContact = "inputMessageContact" - TypeInputMessageDice = "inputMessageDice" - TypeInputMessageGame = "inputMessageGame" - TypeInputMessageInvoice = "inputMessageInvoice" - TypeInputMessagePoll = "inputMessagePoll" - TypeInputMessageForwarded = "inputMessageForwarded" - TypeSearchMessagesFilterEmpty = "searchMessagesFilterEmpty" - TypeSearchMessagesFilterAnimation = "searchMessagesFilterAnimation" - TypeSearchMessagesFilterAudio = "searchMessagesFilterAudio" - TypeSearchMessagesFilterDocument = "searchMessagesFilterDocument" - TypeSearchMessagesFilterPhoto = "searchMessagesFilterPhoto" - TypeSearchMessagesFilterVideo = "searchMessagesFilterVideo" - TypeSearchMessagesFilterVoiceNote = "searchMessagesFilterVoiceNote" - TypeSearchMessagesFilterPhotoAndVideo = "searchMessagesFilterPhotoAndVideo" - TypeSearchMessagesFilterUrl = "searchMessagesFilterUrl" - TypeSearchMessagesFilterChatPhoto = "searchMessagesFilterChatPhoto" - TypeSearchMessagesFilterVideoNote = "searchMessagesFilterVideoNote" - TypeSearchMessagesFilterVoiceAndVideoNote = "searchMessagesFilterVoiceAndVideoNote" - TypeSearchMessagesFilterMention = "searchMessagesFilterMention" - TypeSearchMessagesFilterUnreadMention = "searchMessagesFilterUnreadMention" - TypeSearchMessagesFilterUnreadReaction = "searchMessagesFilterUnreadReaction" - TypeSearchMessagesFilterFailedToSend = "searchMessagesFilterFailedToSend" - TypeSearchMessagesFilterPinned = "searchMessagesFilterPinned" - TypeChatActionTyping = "chatActionTyping" - TypeChatActionRecordingVideo = "chatActionRecordingVideo" - TypeChatActionUploadingVideo = "chatActionUploadingVideo" - TypeChatActionRecordingVoiceNote = "chatActionRecordingVoiceNote" - TypeChatActionUploadingVoiceNote = "chatActionUploadingVoiceNote" - TypeChatActionUploadingPhoto = "chatActionUploadingPhoto" - TypeChatActionUploadingDocument = "chatActionUploadingDocument" - TypeChatActionChoosingSticker = "chatActionChoosingSticker" - TypeChatActionChoosingLocation = "chatActionChoosingLocation" - TypeChatActionChoosingContact = "chatActionChoosingContact" - TypeChatActionStartPlayingGame = "chatActionStartPlayingGame" - TypeChatActionRecordingVideoNote = "chatActionRecordingVideoNote" - TypeChatActionUploadingVideoNote = "chatActionUploadingVideoNote" - TypeChatActionWatchingAnimations = "chatActionWatchingAnimations" - TypeChatActionCancel = "chatActionCancel" - TypeUserStatusEmpty = "userStatusEmpty" - TypeUserStatusOnline = "userStatusOnline" - TypeUserStatusOffline = "userStatusOffline" - TypeUserStatusRecently = "userStatusRecently" - TypeUserStatusLastWeek = "userStatusLastWeek" - TypeUserStatusLastMonth = "userStatusLastMonth" - TypeStickers = "stickers" - TypeEmojis = "emojis" - TypeStickerSet = "stickerSet" - TypeStickerSetInfo = "stickerSetInfo" - TypeStickerSets = "stickerSets" - TypeTrendingStickerSets = "trendingStickerSets" - TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty" - TypeCallDiscardReasonMissed = "callDiscardReasonMissed" - TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" - TypeCallDiscardReasonDisconnected = "callDiscardReasonDisconnected" - TypeCallDiscardReasonHungUp = "callDiscardReasonHungUp" - TypeCallProtocol = "callProtocol" - TypeCallServerTypeTelegramReflector = "callServerTypeTelegramReflector" - TypeCallServerTypeWebrtc = "callServerTypeWebrtc" - TypeCallServer = "callServer" - TypeCallId = "callId" - TypeGroupCallId = "groupCallId" - TypeCallStatePending = "callStatePending" - TypeCallStateExchangingKeys = "callStateExchangingKeys" - TypeCallStateReady = "callStateReady" - TypeCallStateHangingUp = "callStateHangingUp" - TypeCallStateDiscarded = "callStateDiscarded" - TypeCallStateError = "callStateError" - TypeGroupCallVideoQualityThumbnail = "groupCallVideoQualityThumbnail" - TypeGroupCallVideoQualityMedium = "groupCallVideoQualityMedium" - TypeGroupCallVideoQualityFull = "groupCallVideoQualityFull" - TypeGroupCallStream = "groupCallStream" - TypeGroupCallStreams = "groupCallStreams" - TypeRtmpUrl = "rtmpUrl" - TypeGroupCallRecentSpeaker = "groupCallRecentSpeaker" - TypeGroupCall = "groupCall" - TypeGroupCallVideoSourceGroup = "groupCallVideoSourceGroup" - TypeGroupCallParticipantVideoInfo = "groupCallParticipantVideoInfo" - TypeGroupCallParticipant = "groupCallParticipant" - TypeCallProblemEcho = "callProblemEcho" - TypeCallProblemNoise = "callProblemNoise" - TypeCallProblemInterruptions = "callProblemInterruptions" - TypeCallProblemDistortedSpeech = "callProblemDistortedSpeech" - TypeCallProblemSilentLocal = "callProblemSilentLocal" - TypeCallProblemSilentRemote = "callProblemSilentRemote" - TypeCallProblemDropped = "callProblemDropped" - TypeCallProblemDistortedVideo = "callProblemDistortedVideo" - TypeCallProblemPixelatedVideo = "callProblemPixelatedVideo" - TypeCall = "call" - TypePhoneNumberAuthenticationSettings = "phoneNumberAuthenticationSettings" - TypeAddedReaction = "addedReaction" - TypeAddedReactions = "addedReactions" - TypeAvailableReaction = "availableReaction" - TypeAvailableReactions = "availableReactions" - TypeEmojiReaction = "emojiReaction" - TypeAnimations = "animations" - TypeDiceStickersRegular = "diceStickersRegular" - TypeDiceStickersSlotMachine = "diceStickersSlotMachine" - TypeImportedContacts = "importedContacts" - TypeSpeechRecognitionResultPending = "speechRecognitionResultPending" - TypeSpeechRecognitionResultText = "speechRecognitionResultText" - TypeSpeechRecognitionResultError = "speechRecognitionResultError" - TypeAttachmentMenuBotColor = "attachmentMenuBotColor" - TypeAttachmentMenuBot = "attachmentMenuBot" - TypeSentWebAppMessage = "sentWebAppMessage" - TypeHttpUrl = "httpUrl" - TypeUserLink = "userLink" - TypeInputInlineQueryResultAnimation = "inputInlineQueryResultAnimation" - TypeInputInlineQueryResultArticle = "inputInlineQueryResultArticle" - TypeInputInlineQueryResultAudio = "inputInlineQueryResultAudio" - TypeInputInlineQueryResultContact = "inputInlineQueryResultContact" - TypeInputInlineQueryResultDocument = "inputInlineQueryResultDocument" - TypeInputInlineQueryResultGame = "inputInlineQueryResultGame" - TypeInputInlineQueryResultLocation = "inputInlineQueryResultLocation" - TypeInputInlineQueryResultPhoto = "inputInlineQueryResultPhoto" - TypeInputInlineQueryResultSticker = "inputInlineQueryResultSticker" - TypeInputInlineQueryResultVenue = "inputInlineQueryResultVenue" - TypeInputInlineQueryResultVideo = "inputInlineQueryResultVideo" - TypeInputInlineQueryResultVoiceNote = "inputInlineQueryResultVoiceNote" - TypeInlineQueryResultArticle = "inlineQueryResultArticle" - TypeInlineQueryResultContact = "inlineQueryResultContact" - TypeInlineQueryResultLocation = "inlineQueryResultLocation" - TypeInlineQueryResultVenue = "inlineQueryResultVenue" - TypeInlineQueryResultGame = "inlineQueryResultGame" - TypeInlineQueryResultAnimation = "inlineQueryResultAnimation" - TypeInlineQueryResultAudio = "inlineQueryResultAudio" - TypeInlineQueryResultDocument = "inlineQueryResultDocument" - TypeInlineQueryResultPhoto = "inlineQueryResultPhoto" - TypeInlineQueryResultSticker = "inlineQueryResultSticker" - TypeInlineQueryResultVideo = "inlineQueryResultVideo" - TypeInlineQueryResultVoiceNote = "inlineQueryResultVoiceNote" - TypeInlineQueryResults = "inlineQueryResults" - TypeCallbackQueryPayloadData = "callbackQueryPayloadData" - TypeCallbackQueryPayloadDataWithPassword = "callbackQueryPayloadDataWithPassword" - TypeCallbackQueryPayloadGame = "callbackQueryPayloadGame" - TypeCallbackQueryAnswer = "callbackQueryAnswer" - TypeCustomRequestResult = "customRequestResult" - TypeGameHighScore = "gameHighScore" - TypeGameHighScores = "gameHighScores" - TypeChatEventMessageEdited = "chatEventMessageEdited" - TypeChatEventMessageDeleted = "chatEventMessageDeleted" - TypeChatEventMessagePinned = "chatEventMessagePinned" - TypeChatEventMessageUnpinned = "chatEventMessageUnpinned" - TypeChatEventPollStopped = "chatEventPollStopped" - TypeChatEventMemberJoined = "chatEventMemberJoined" - TypeChatEventMemberJoinedByInviteLink = "chatEventMemberJoinedByInviteLink" - TypeChatEventMemberJoinedByRequest = "chatEventMemberJoinedByRequest" - TypeChatEventMemberInvited = "chatEventMemberInvited" - TypeChatEventMemberLeft = "chatEventMemberLeft" - TypeChatEventMemberPromoted = "chatEventMemberPromoted" - TypeChatEventMemberRestricted = "chatEventMemberRestricted" - TypeChatEventAvailableReactionsChanged = "chatEventAvailableReactionsChanged" - TypeChatEventDescriptionChanged = "chatEventDescriptionChanged" - TypeChatEventLinkedChatChanged = "chatEventLinkedChatChanged" - TypeChatEventLocationChanged = "chatEventLocationChanged" - TypeChatEventMessageAutoDeleteTimeChanged = "chatEventMessageAutoDeleteTimeChanged" - TypeChatEventPermissionsChanged = "chatEventPermissionsChanged" - TypeChatEventPhotoChanged = "chatEventPhotoChanged" - TypeChatEventSlowModeDelayChanged = "chatEventSlowModeDelayChanged" - TypeChatEventStickerSetChanged = "chatEventStickerSetChanged" - TypeChatEventTitleChanged = "chatEventTitleChanged" - TypeChatEventUsernameChanged = "chatEventUsernameChanged" - TypeChatEventActiveUsernamesChanged = "chatEventActiveUsernamesChanged" - TypeChatEventHasProtectedContentToggled = "chatEventHasProtectedContentToggled" - TypeChatEventInvitesToggled = "chatEventInvitesToggled" - TypeChatEventIsAllHistoryAvailableToggled = "chatEventIsAllHistoryAvailableToggled" - TypeChatEventHasAggressiveAntiSpamEnabledToggled = "chatEventHasAggressiveAntiSpamEnabledToggled" - TypeChatEventSignMessagesToggled = "chatEventSignMessagesToggled" - TypeChatEventInviteLinkEdited = "chatEventInviteLinkEdited" - TypeChatEventInviteLinkRevoked = "chatEventInviteLinkRevoked" - TypeChatEventInviteLinkDeleted = "chatEventInviteLinkDeleted" - TypeChatEventVideoChatCreated = "chatEventVideoChatCreated" - TypeChatEventVideoChatEnded = "chatEventVideoChatEnded" - TypeChatEventVideoChatMuteNewParticipantsToggled = "chatEventVideoChatMuteNewParticipantsToggled" - TypeChatEventVideoChatParticipantIsMutedToggled = "chatEventVideoChatParticipantIsMutedToggled" - TypeChatEventVideoChatParticipantVolumeLevelChanged = "chatEventVideoChatParticipantVolumeLevelChanged" - TypeChatEventIsForumToggled = "chatEventIsForumToggled" - TypeChatEventForumTopicCreated = "chatEventForumTopicCreated" - TypeChatEventForumTopicEdited = "chatEventForumTopicEdited" - TypeChatEventForumTopicToggleIsClosed = "chatEventForumTopicToggleIsClosed" - TypeChatEventForumTopicToggleIsHidden = "chatEventForumTopicToggleIsHidden" - TypeChatEventForumTopicDeleted = "chatEventForumTopicDeleted" - TypeChatEventForumTopicPinned = "chatEventForumTopicPinned" - TypeChatEvent = "chatEvent" - TypeChatEvents = "chatEvents" - TypeChatEventLogFilters = "chatEventLogFilters" - TypeLanguagePackStringValueOrdinary = "languagePackStringValueOrdinary" - TypeLanguagePackStringValuePluralized = "languagePackStringValuePluralized" - TypeLanguagePackStringValueDeleted = "languagePackStringValueDeleted" - TypeLanguagePackString = "languagePackString" - TypeLanguagePackStrings = "languagePackStrings" - TypeLanguagePackInfo = "languagePackInfo" - TypeLocalizationTargetInfo = "localizationTargetInfo" - TypePremiumLimitTypeSupergroupCount = "premiumLimitTypeSupergroupCount" - TypePremiumLimitTypePinnedChatCount = "premiumLimitTypePinnedChatCount" - TypePremiumLimitTypeCreatedPublicChatCount = "premiumLimitTypeCreatedPublicChatCount" - TypePremiumLimitTypeSavedAnimationCount = "premiumLimitTypeSavedAnimationCount" - TypePremiumLimitTypeFavoriteStickerCount = "premiumLimitTypeFavoriteStickerCount" - TypePremiumLimitTypeChatFilterCount = "premiumLimitTypeChatFilterCount" - TypePremiumLimitTypeChatFilterChosenChatCount = "premiumLimitTypeChatFilterChosenChatCount" - TypePremiumLimitTypePinnedArchivedChatCount = "premiumLimitTypePinnedArchivedChatCount" - TypePremiumLimitTypeCaptionLength = "premiumLimitTypeCaptionLength" - TypePremiumLimitTypeBioLength = "premiumLimitTypeBioLength" - TypePremiumFeatureIncreasedLimits = "premiumFeatureIncreasedLimits" - TypePremiumFeatureIncreasedUploadFileSize = "premiumFeatureIncreasedUploadFileSize" - TypePremiumFeatureImprovedDownloadSpeed = "premiumFeatureImprovedDownloadSpeed" - TypePremiumFeatureVoiceRecognition = "premiumFeatureVoiceRecognition" - TypePremiumFeatureDisabledAds = "premiumFeatureDisabledAds" - TypePremiumFeatureUniqueReactions = "premiumFeatureUniqueReactions" - TypePremiumFeatureUniqueStickers = "premiumFeatureUniqueStickers" - TypePremiumFeatureCustomEmoji = "premiumFeatureCustomEmoji" - TypePremiumFeatureAdvancedChatManagement = "premiumFeatureAdvancedChatManagement" - TypePremiumFeatureProfileBadge = "premiumFeatureProfileBadge" - TypePremiumFeatureEmojiStatus = "premiumFeatureEmojiStatus" - TypePremiumFeatureAnimatedProfilePhoto = "premiumFeatureAnimatedProfilePhoto" - TypePremiumFeatureForumTopicIcon = "premiumFeatureForumTopicIcon" - TypePremiumFeatureAppIcons = "premiumFeatureAppIcons" - TypePremiumLimit = "premiumLimit" - TypePremiumFeatures = "premiumFeatures" - TypePremiumSourceLimitExceeded = "premiumSourceLimitExceeded" - TypePremiumSourceFeature = "premiumSourceFeature" - TypePremiumSourceLink = "premiumSourceLink" - TypePremiumSourceSettings = "premiumSourceSettings" - TypePremiumFeaturePromotionAnimation = "premiumFeaturePromotionAnimation" - TypePremiumState = "premiumState" - TypeStorePaymentPurposePremiumSubscription = "storePaymentPurposePremiumSubscription" - TypeStorePaymentPurposeGiftedPremium = "storePaymentPurposeGiftedPremium" - TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging" - TypeDeviceTokenApplePush = "deviceTokenApplePush" - TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" - TypeDeviceTokenWindowsPush = "deviceTokenWindowsPush" - TypeDeviceTokenMicrosoftPush = "deviceTokenMicrosoftPush" - TypeDeviceTokenMicrosoftPushVoIP = "deviceTokenMicrosoftPushVoIP" - TypeDeviceTokenWebPush = "deviceTokenWebPush" - TypeDeviceTokenSimplePush = "deviceTokenSimplePush" - TypeDeviceTokenUbuntuPush = "deviceTokenUbuntuPush" - TypeDeviceTokenBlackBerryPush = "deviceTokenBlackBerryPush" - TypeDeviceTokenTizenPush = "deviceTokenTizenPush" - TypePushReceiverId = "pushReceiverId" - TypeBackgroundFillSolid = "backgroundFillSolid" - TypeBackgroundFillGradient = "backgroundFillGradient" - TypeBackgroundFillFreeformGradient = "backgroundFillFreeformGradient" - TypeBackgroundTypeWallpaper = "backgroundTypeWallpaper" - TypeBackgroundTypePattern = "backgroundTypePattern" - TypeBackgroundTypeFill = "backgroundTypeFill" - TypeBackground = "background" - TypeBackgrounds = "backgrounds" - TypeInputBackgroundLocal = "inputBackgroundLocal" - TypeInputBackgroundRemote = "inputBackgroundRemote" - TypeThemeSettings = "themeSettings" - TypeChatTheme = "chatTheme" - TypeHashtags = "hashtags" - TypeCanTransferOwnershipResultOk = "canTransferOwnershipResultOk" - TypeCanTransferOwnershipResultPasswordNeeded = "canTransferOwnershipResultPasswordNeeded" - TypeCanTransferOwnershipResultPasswordTooFresh = "canTransferOwnershipResultPasswordTooFresh" - TypeCanTransferOwnershipResultSessionTooFresh = "canTransferOwnershipResultSessionTooFresh" - TypeCheckChatUsernameResultOk = "checkChatUsernameResultOk" - TypeCheckChatUsernameResultUsernameInvalid = "checkChatUsernameResultUsernameInvalid" - TypeCheckChatUsernameResultUsernameOccupied = "checkChatUsernameResultUsernameOccupied" - TypeCheckChatUsernameResultUsernamePurchasable = "checkChatUsernameResultUsernamePurchasable" - TypeCheckChatUsernameResultPublicChatsTooMany = "checkChatUsernameResultPublicChatsTooMany" - TypeCheckChatUsernameResultPublicGroupsUnavailable = "checkChatUsernameResultPublicGroupsUnavailable" - TypeCheckStickerSetNameResultOk = "checkStickerSetNameResultOk" - TypeCheckStickerSetNameResultNameInvalid = "checkStickerSetNameResultNameInvalid" - TypeCheckStickerSetNameResultNameOccupied = "checkStickerSetNameResultNameOccupied" - TypeResetPasswordResultOk = "resetPasswordResultOk" - TypeResetPasswordResultPending = "resetPasswordResultPending" - TypeResetPasswordResultDeclined = "resetPasswordResultDeclined" - TypeMessageFileTypePrivate = "messageFileTypePrivate" - TypeMessageFileTypeGroup = "messageFileTypeGroup" - TypeMessageFileTypeUnknown = "messageFileTypeUnknown" - TypePushMessageContentHidden = "pushMessageContentHidden" - TypePushMessageContentAnimation = "pushMessageContentAnimation" - TypePushMessageContentAudio = "pushMessageContentAudio" - TypePushMessageContentContact = "pushMessageContentContact" - TypePushMessageContentContactRegistered = "pushMessageContentContactRegistered" - TypePushMessageContentDocument = "pushMessageContentDocument" - TypePushMessageContentGame = "pushMessageContentGame" - TypePushMessageContentGameScore = "pushMessageContentGameScore" - TypePushMessageContentInvoice = "pushMessageContentInvoice" - TypePushMessageContentLocation = "pushMessageContentLocation" - TypePushMessageContentPhoto = "pushMessageContentPhoto" - TypePushMessageContentPoll = "pushMessageContentPoll" - TypePushMessageContentScreenshotTaken = "pushMessageContentScreenshotTaken" - TypePushMessageContentSticker = "pushMessageContentSticker" - TypePushMessageContentText = "pushMessageContentText" - TypePushMessageContentVideo = "pushMessageContentVideo" - TypePushMessageContentVideoNote = "pushMessageContentVideoNote" - TypePushMessageContentVoiceNote = "pushMessageContentVoiceNote" - TypePushMessageContentBasicGroupChatCreate = "pushMessageContentBasicGroupChatCreate" - TypePushMessageContentChatAddMembers = "pushMessageContentChatAddMembers" - TypePushMessageContentChatChangePhoto = "pushMessageContentChatChangePhoto" - TypePushMessageContentChatChangeTitle = "pushMessageContentChatChangeTitle" - TypePushMessageContentChatSetTheme = "pushMessageContentChatSetTheme" - TypePushMessageContentChatDeleteMember = "pushMessageContentChatDeleteMember" - TypePushMessageContentChatJoinByLink = "pushMessageContentChatJoinByLink" - TypePushMessageContentChatJoinByRequest = "pushMessageContentChatJoinByRequest" - TypePushMessageContentRecurringPayment = "pushMessageContentRecurringPayment" - TypePushMessageContentSuggestProfilePhoto = "pushMessageContentSuggestProfilePhoto" - TypePushMessageContentMessageForwards = "pushMessageContentMessageForwards" - TypePushMessageContentMediaAlbum = "pushMessageContentMediaAlbum" - TypeNotificationTypeNewMessage = "notificationTypeNewMessage" - TypeNotificationTypeNewSecretChat = "notificationTypeNewSecretChat" - TypeNotificationTypeNewCall = "notificationTypeNewCall" - TypeNotificationTypeNewPushMessage = "notificationTypeNewPushMessage" - TypeNotificationGroupTypeMessages = "notificationGroupTypeMessages" - TypeNotificationGroupTypeMentions = "notificationGroupTypeMentions" - TypeNotificationGroupTypeSecretChat = "notificationGroupTypeSecretChat" - TypeNotificationGroupTypeCalls = "notificationGroupTypeCalls" - TypeNotificationSound = "notificationSound" - TypeNotificationSounds = "notificationSounds" - TypeNotification = "notification" - TypeNotificationGroup = "notificationGroup" - TypeOptionValueBoolean = "optionValueBoolean" - TypeOptionValueEmpty = "optionValueEmpty" - TypeOptionValueInteger = "optionValueInteger" - TypeOptionValueString = "optionValueString" - TypeJsonObjectMember = "jsonObjectMember" - TypeJsonValueNull = "jsonValueNull" - TypeJsonValueBoolean = "jsonValueBoolean" - TypeJsonValueNumber = "jsonValueNumber" - TypeJsonValueString = "jsonValueString" - TypeJsonValueArray = "jsonValueArray" - TypeJsonValueObject = "jsonValueObject" - TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" - TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" - TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" - TypeUserPrivacySettingRuleAllowChatMembers = "userPrivacySettingRuleAllowChatMembers" - TypeUserPrivacySettingRuleRestrictAll = "userPrivacySettingRuleRestrictAll" - TypeUserPrivacySettingRuleRestrictContacts = "userPrivacySettingRuleRestrictContacts" - TypeUserPrivacySettingRuleRestrictUsers = "userPrivacySettingRuleRestrictUsers" - TypeUserPrivacySettingRuleRestrictChatMembers = "userPrivacySettingRuleRestrictChatMembers" - TypeUserPrivacySettingRules = "userPrivacySettingRules" - TypeUserPrivacySettingShowStatus = "userPrivacySettingShowStatus" - TypeUserPrivacySettingShowProfilePhoto = "userPrivacySettingShowProfilePhoto" - TypeUserPrivacySettingShowLinkInForwardedMessages = "userPrivacySettingShowLinkInForwardedMessages" - TypeUserPrivacySettingShowPhoneNumber = "userPrivacySettingShowPhoneNumber" - TypeUserPrivacySettingAllowChatInvites = "userPrivacySettingAllowChatInvites" - TypeUserPrivacySettingAllowCalls = "userPrivacySettingAllowCalls" - TypeUserPrivacySettingAllowPeerToPeerCalls = "userPrivacySettingAllowPeerToPeerCalls" - TypeUserPrivacySettingAllowFindingByPhoneNumber = "userPrivacySettingAllowFindingByPhoneNumber" - TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" - TypeAccountTtl = "accountTtl" - TypeMessageAutoDeleteTime = "messageAutoDeleteTime" - TypeSessionTypeAndroid = "sessionTypeAndroid" - TypeSessionTypeApple = "sessionTypeApple" - TypeSessionTypeBrave = "sessionTypeBrave" - TypeSessionTypeChrome = "sessionTypeChrome" - TypeSessionTypeEdge = "sessionTypeEdge" - TypeSessionTypeFirefox = "sessionTypeFirefox" - TypeSessionTypeIpad = "sessionTypeIpad" - TypeSessionTypeIphone = "sessionTypeIphone" - TypeSessionTypeLinux = "sessionTypeLinux" - TypeSessionTypeMac = "sessionTypeMac" - TypeSessionTypeOpera = "sessionTypeOpera" - TypeSessionTypeSafari = "sessionTypeSafari" - TypeSessionTypeUbuntu = "sessionTypeUbuntu" - TypeSessionTypeUnknown = "sessionTypeUnknown" - TypeSessionTypeVivaldi = "sessionTypeVivaldi" - TypeSessionTypeWindows = "sessionTypeWindows" - TypeSessionTypeXbox = "sessionTypeXbox" - TypeSession = "session" - TypeSessions = "sessions" - TypeConnectedWebsite = "connectedWebsite" - TypeConnectedWebsites = "connectedWebsites" - TypeChatReportReasonSpam = "chatReportReasonSpam" - TypeChatReportReasonViolence = "chatReportReasonViolence" - TypeChatReportReasonPornography = "chatReportReasonPornography" - TypeChatReportReasonChildAbuse = "chatReportReasonChildAbuse" - TypeChatReportReasonCopyright = "chatReportReasonCopyright" - TypeChatReportReasonUnrelatedLocation = "chatReportReasonUnrelatedLocation" - TypeChatReportReasonFake = "chatReportReasonFake" - TypeChatReportReasonIllegalDrugs = "chatReportReasonIllegalDrugs" - TypeChatReportReasonPersonalDetails = "chatReportReasonPersonalDetails" - TypeChatReportReasonCustom = "chatReportReasonCustom" - TypeTargetChatCurrent = "targetChatCurrent" - TypeTargetChatChosen = "targetChatChosen" - TypeTargetChatInternalLink = "targetChatInternalLink" - TypeInternalLinkTypeActiveSessions = "internalLinkTypeActiveSessions" - TypeInternalLinkTypeAttachmentMenuBot = "internalLinkTypeAttachmentMenuBot" - TypeInternalLinkTypeAuthenticationCode = "internalLinkTypeAuthenticationCode" - TypeInternalLinkTypeBackground = "internalLinkTypeBackground" - TypeInternalLinkTypeBotStart = "internalLinkTypeBotStart" - TypeInternalLinkTypeBotStartInGroup = "internalLinkTypeBotStartInGroup" - TypeInternalLinkTypeBotAddToChannel = "internalLinkTypeBotAddToChannel" - TypeInternalLinkTypeChangePhoneNumber = "internalLinkTypeChangePhoneNumber" - TypeInternalLinkTypeChatInvite = "internalLinkTypeChatInvite" - TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings = "internalLinkTypeDefaultMessageAutoDeleteTimerSettings" - TypeInternalLinkTypeEditProfileSettings = "internalLinkTypeEditProfileSettings" - TypeInternalLinkTypeFilterSettings = "internalLinkTypeFilterSettings" - TypeInternalLinkTypeGame = "internalLinkTypeGame" - TypeInternalLinkTypeInstantView = "internalLinkTypeInstantView" - TypeInternalLinkTypeInvoice = "internalLinkTypeInvoice" - TypeInternalLinkTypeLanguagePack = "internalLinkTypeLanguagePack" - TypeInternalLinkTypeLanguageSettings = "internalLinkTypeLanguageSettings" - TypeInternalLinkTypeMessage = "internalLinkTypeMessage" - TypeInternalLinkTypeMessageDraft = "internalLinkTypeMessageDraft" - TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" - TypeInternalLinkTypePhoneNumberConfirmation = "internalLinkTypePhoneNumberConfirmation" - TypeInternalLinkTypePremiumFeatures = "internalLinkTypePremiumFeatures" - TypeInternalLinkTypePrivacyAndSecuritySettings = "internalLinkTypePrivacyAndSecuritySettings" - TypeInternalLinkTypeProxy = "internalLinkTypeProxy" - TypeInternalLinkTypePublicChat = "internalLinkTypePublicChat" - TypeInternalLinkTypeQrCodeAuthentication = "internalLinkTypeQrCodeAuthentication" - TypeInternalLinkTypeRestorePurchases = "internalLinkTypeRestorePurchases" - TypeInternalLinkTypeSettings = "internalLinkTypeSettings" - TypeInternalLinkTypeStickerSet = "internalLinkTypeStickerSet" - TypeInternalLinkTypeTheme = "internalLinkTypeTheme" - TypeInternalLinkTypeThemeSettings = "internalLinkTypeThemeSettings" - TypeInternalLinkTypeUnknownDeepLink = "internalLinkTypeUnknownDeepLink" - TypeInternalLinkTypeUnsupportedProxy = "internalLinkTypeUnsupportedProxy" - TypeInternalLinkTypeUserPhoneNumber = "internalLinkTypeUserPhoneNumber" - TypeInternalLinkTypeUserToken = "internalLinkTypeUserToken" - TypeInternalLinkTypeVideoChat = "internalLinkTypeVideoChat" - TypeMessageLink = "messageLink" - TypeMessageLinkInfo = "messageLinkInfo" - TypeFilePart = "filePart" - TypeFileTypeNone = "fileTypeNone" - TypeFileTypeAnimation = "fileTypeAnimation" - TypeFileTypeAudio = "fileTypeAudio" - TypeFileTypeDocument = "fileTypeDocument" - TypeFileTypeNotificationSound = "fileTypeNotificationSound" - TypeFileTypePhoto = "fileTypePhoto" - TypeFileTypeProfilePhoto = "fileTypeProfilePhoto" - TypeFileTypeSecret = "fileTypeSecret" - TypeFileTypeSecretThumbnail = "fileTypeSecretThumbnail" - TypeFileTypeSecure = "fileTypeSecure" - TypeFileTypeSticker = "fileTypeSticker" - TypeFileTypeThumbnail = "fileTypeThumbnail" - TypeFileTypeUnknown = "fileTypeUnknown" - TypeFileTypeVideo = "fileTypeVideo" - TypeFileTypeVideoNote = "fileTypeVideoNote" - TypeFileTypeVoiceNote = "fileTypeVoiceNote" - TypeFileTypeWallpaper = "fileTypeWallpaper" - TypeStorageStatisticsByFileType = "storageStatisticsByFileType" - TypeStorageStatisticsByChat = "storageStatisticsByChat" - TypeStorageStatistics = "storageStatistics" - TypeStorageStatisticsFast = "storageStatisticsFast" - TypeDatabaseStatistics = "databaseStatistics" - TypeNetworkTypeNone = "networkTypeNone" - TypeNetworkTypeMobile = "networkTypeMobile" - TypeNetworkTypeMobileRoaming = "networkTypeMobileRoaming" - TypeNetworkTypeWiFi = "networkTypeWiFi" - TypeNetworkTypeOther = "networkTypeOther" - TypeNetworkStatisticsEntryFile = "networkStatisticsEntryFile" - TypeNetworkStatisticsEntryCall = "networkStatisticsEntryCall" - TypeNetworkStatistics = "networkStatistics" - TypeAutoDownloadSettings = "autoDownloadSettings" - TypeAutoDownloadSettingsPresets = "autoDownloadSettingsPresets" - TypeConnectionStateWaitingForNetwork = "connectionStateWaitingForNetwork" - TypeConnectionStateConnectingToProxy = "connectionStateConnectingToProxy" - TypeConnectionStateConnecting = "connectionStateConnecting" - TypeConnectionStateUpdating = "connectionStateUpdating" - TypeConnectionStateReady = "connectionStateReady" - TypeTopChatCategoryUsers = "topChatCategoryUsers" - TypeTopChatCategoryBots = "topChatCategoryBots" - TypeTopChatCategoryGroups = "topChatCategoryGroups" - TypeTopChatCategoryChannels = "topChatCategoryChannels" - TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots" - TypeTopChatCategoryCalls = "topChatCategoryCalls" - TypeTopChatCategoryForwardChats = "topChatCategoryForwardChats" - TypeTMeUrlTypeUser = "tMeUrlTypeUser" - TypeTMeUrlTypeSupergroup = "tMeUrlTypeSupergroup" - TypeTMeUrlTypeChatInvite = "tMeUrlTypeChatInvite" - TypeTMeUrlTypeStickerSet = "tMeUrlTypeStickerSet" - TypeTMeUrl = "tMeUrl" - TypeTMeUrls = "tMeUrls" - TypeSuggestedActionEnableArchiveAndMuteNewChats = "suggestedActionEnableArchiveAndMuteNewChats" - TypeSuggestedActionCheckPassword = "suggestedActionCheckPassword" - TypeSuggestedActionCheckPhoneNumber = "suggestedActionCheckPhoneNumber" - TypeSuggestedActionViewChecksHint = "suggestedActionViewChecksHint" - TypeSuggestedActionConvertToBroadcastGroup = "suggestedActionConvertToBroadcastGroup" - TypeSuggestedActionSetPassword = "suggestedActionSetPassword" - TypeCount = "count" - TypeText = "text" - TypeSeconds = "seconds" - TypeFileDownloadedPrefixSize = "fileDownloadedPrefixSize" - TypeDeepLinkInfo = "deepLinkInfo" - TypeTextParseModeMarkdown = "textParseModeMarkdown" - TypeTextParseModeHTML = "textParseModeHTML" - TypeProxyTypeSocks5 = "proxyTypeSocks5" - TypeProxyTypeHttp = "proxyTypeHttp" - TypeProxyTypeMtproto = "proxyTypeMtproto" - TypeProxy = "proxy" - TypeProxies = "proxies" - TypeInputSticker = "inputSticker" - TypeDateRange = "dateRange" - TypeStatisticalValue = "statisticalValue" - TypeStatisticalGraphData = "statisticalGraphData" - TypeStatisticalGraphAsync = "statisticalGraphAsync" - TypeStatisticalGraphError = "statisticalGraphError" - TypeChatStatisticsMessageInteractionInfo = "chatStatisticsMessageInteractionInfo" - TypeChatStatisticsMessageSenderInfo = "chatStatisticsMessageSenderInfo" - TypeChatStatisticsAdministratorActionsInfo = "chatStatisticsAdministratorActionsInfo" - TypeChatStatisticsInviterInfo = "chatStatisticsInviterInfo" - TypeChatStatisticsSupergroup = "chatStatisticsSupergroup" - TypeChatStatisticsChannel = "chatStatisticsChannel" - TypeMessageStatistics = "messageStatistics" - TypePoint = "point" - TypeVectorPathCommandLine = "vectorPathCommandLine" - TypeVectorPathCommandCubicBezierCurve = "vectorPathCommandCubicBezierCurve" - TypeBotCommandScopeDefault = "botCommandScopeDefault" - TypeBotCommandScopeAllPrivateChats = "botCommandScopeAllPrivateChats" - TypeBotCommandScopeAllGroupChats = "botCommandScopeAllGroupChats" - TypeBotCommandScopeAllChatAdministrators = "botCommandScopeAllChatAdministrators" - TypeBotCommandScopeChat = "botCommandScopeChat" - TypeBotCommandScopeChatAdministrators = "botCommandScopeChatAdministrators" - TypeBotCommandScopeChatMember = "botCommandScopeChatMember" - TypeUpdateAuthorizationState = "updateAuthorizationState" - TypeUpdateNewMessage = "updateNewMessage" - TypeUpdateMessageSendAcknowledged = "updateMessageSendAcknowledged" - TypeUpdateMessageSendSucceeded = "updateMessageSendSucceeded" - TypeUpdateMessageSendFailed = "updateMessageSendFailed" - TypeUpdateMessageContent = "updateMessageContent" - TypeUpdateMessageEdited = "updateMessageEdited" - TypeUpdateMessageIsPinned = "updateMessageIsPinned" - TypeUpdateMessageInteractionInfo = "updateMessageInteractionInfo" - TypeUpdateMessageContentOpened = "updateMessageContentOpened" - TypeUpdateMessageMentionRead = "updateMessageMentionRead" - TypeUpdateMessageUnreadReactions = "updateMessageUnreadReactions" - TypeUpdateMessageLiveLocationViewed = "updateMessageLiveLocationViewed" - TypeUpdateNewChat = "updateNewChat" - TypeUpdateChatTitle = "updateChatTitle" - TypeUpdateChatPhoto = "updateChatPhoto" - TypeUpdateChatPermissions = "updateChatPermissions" - TypeUpdateChatLastMessage = "updateChatLastMessage" - TypeUpdateChatPosition = "updateChatPosition" - TypeUpdateChatReadInbox = "updateChatReadInbox" - TypeUpdateChatReadOutbox = "updateChatReadOutbox" - TypeUpdateChatActionBar = "updateChatActionBar" - TypeUpdateChatAvailableReactions = "updateChatAvailableReactions" - TypeUpdateChatDraftMessage = "updateChatDraftMessage" - TypeUpdateChatMessageSender = "updateChatMessageSender" - TypeUpdateChatMessageAutoDeleteTime = "updateChatMessageAutoDeleteTime" - TypeUpdateChatNotificationSettings = "updateChatNotificationSettings" - TypeUpdateChatPendingJoinRequests = "updateChatPendingJoinRequests" - TypeUpdateChatReplyMarkup = "updateChatReplyMarkup" - TypeUpdateChatTheme = "updateChatTheme" - TypeUpdateChatUnreadMentionCount = "updateChatUnreadMentionCount" - TypeUpdateChatUnreadReactionCount = "updateChatUnreadReactionCount" - TypeUpdateChatVideoChat = "updateChatVideoChat" - TypeUpdateChatDefaultDisableNotification = "updateChatDefaultDisableNotification" - TypeUpdateChatHasProtectedContent = "updateChatHasProtectedContent" - TypeUpdateChatHasScheduledMessages = "updateChatHasScheduledMessages" - TypeUpdateChatIsBlocked = "updateChatIsBlocked" - TypeUpdateChatIsMarkedAsUnread = "updateChatIsMarkedAsUnread" - TypeUpdateChatFilters = "updateChatFilters" - TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" - TypeUpdateForumTopicInfo = "updateForumTopicInfo" - TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" - TypeUpdateNotification = "updateNotification" - TypeUpdateNotificationGroup = "updateNotificationGroup" - TypeUpdateActiveNotifications = "updateActiveNotifications" - TypeUpdateHavePendingNotifications = "updateHavePendingNotifications" - TypeUpdateDeleteMessages = "updateDeleteMessages" - TypeUpdateChatAction = "updateChatAction" - TypeUpdateUserStatus = "updateUserStatus" - TypeUpdateUser = "updateUser" - TypeUpdateBasicGroup = "updateBasicGroup" - TypeUpdateSupergroup = "updateSupergroup" - TypeUpdateSecretChat = "updateSecretChat" - TypeUpdateUserFullInfo = "updateUserFullInfo" - TypeUpdateBasicGroupFullInfo = "updateBasicGroupFullInfo" - TypeUpdateSupergroupFullInfo = "updateSupergroupFullInfo" - TypeUpdateServiceNotification = "updateServiceNotification" - TypeUpdateFile = "updateFile" - TypeUpdateFileGenerationStart = "updateFileGenerationStart" - TypeUpdateFileGenerationStop = "updateFileGenerationStop" - TypeUpdateFileDownloads = "updateFileDownloads" - TypeUpdateFileAddedToDownloads = "updateFileAddedToDownloads" - TypeUpdateFileDownload = "updateFileDownload" - TypeUpdateFileRemovedFromDownloads = "updateFileRemovedFromDownloads" - TypeUpdateCall = "updateCall" - TypeUpdateGroupCall = "updateGroupCall" - TypeUpdateGroupCallParticipant = "updateGroupCallParticipant" - TypeUpdateNewCallSignalingData = "updateNewCallSignalingData" - TypeUpdateUserPrivacySettingRules = "updateUserPrivacySettingRules" - TypeUpdateUnreadMessageCount = "updateUnreadMessageCount" - TypeUpdateUnreadChatCount = "updateUnreadChatCount" - TypeUpdateOption = "updateOption" - TypeUpdateStickerSet = "updateStickerSet" - TypeUpdateInstalledStickerSets = "updateInstalledStickerSets" - TypeUpdateTrendingStickerSets = "updateTrendingStickerSets" - TypeUpdateRecentStickers = "updateRecentStickers" - TypeUpdateFavoriteStickers = "updateFavoriteStickers" - TypeUpdateSavedAnimations = "updateSavedAnimations" - TypeUpdateSavedNotificationSounds = "updateSavedNotificationSounds" - TypeUpdateSelectedBackground = "updateSelectedBackground" - TypeUpdateChatThemes = "updateChatThemes" - TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" - TypeUpdateConnectionState = "updateConnectionState" - TypeUpdateTermsOfService = "updateTermsOfService" - TypeUpdateUsersNearby = "updateUsersNearby" - TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" - TypeUpdateWebAppMessageSent = "updateWebAppMessageSent" - TypeUpdateActiveEmojiReactions = "updateActiveEmojiReactions" - TypeUpdateDefaultReactionType = "updateDefaultReactionType" - TypeUpdateDiceEmojis = "updateDiceEmojis" - TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" - TypeUpdateAnimationSearchParameters = "updateAnimationSearchParameters" - TypeUpdateSuggestedActions = "updateSuggestedActions" - TypeUpdateNewInlineQuery = "updateNewInlineQuery" - TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" - TypeUpdateNewCallbackQuery = "updateNewCallbackQuery" - TypeUpdateNewInlineCallbackQuery = "updateNewInlineCallbackQuery" - TypeUpdateNewShippingQuery = "updateNewShippingQuery" - TypeUpdateNewPreCheckoutQuery = "updateNewPreCheckoutQuery" - TypeUpdateNewCustomEvent = "updateNewCustomEvent" - TypeUpdateNewCustomQuery = "updateNewCustomQuery" - TypeUpdatePoll = "updatePoll" - TypeUpdatePollAnswer = "updatePollAnswer" - TypeUpdateChatMember = "updateChatMember" - TypeUpdateNewChatJoinRequest = "updateNewChatJoinRequest" - TypeUpdates = "updates" - TypeLogStreamDefault = "logStreamDefault" - TypeLogStreamFile = "logStreamFile" - TypeLogStreamEmpty = "logStreamEmpty" - TypeLogVerbosityLevel = "logVerbosityLevel" - TypeLogTags = "logTags" - TypeUserSupportInfo = "userSupportInfo" - TypeTestInt = "testInt" - TypeTestString = "testString" - TypeTestBytes = "testBytes" - TypeTestVectorInt = "testVectorInt" - TypeTestVectorIntObject = "testVectorIntObject" - TypeTestVectorString = "testVectorString" - TypeTestVectorStringObject = "testVectorStringObject" + TypeError = "error" + TypeOk = "ok" + TypeAuthenticationCodeTypeTelegramMessage = "authenticationCodeTypeTelegramMessage" + TypeAuthenticationCodeTypeSms = "authenticationCodeTypeSms" + TypeAuthenticationCodeTypeCall = "authenticationCodeTypeCall" + TypeAuthenticationCodeTypeFlashCall = "authenticationCodeTypeFlashCall" + TypeAuthenticationCodeTypeMissedCall = "authenticationCodeTypeMissedCall" + TypeAuthenticationCodeTypeFragment = "authenticationCodeTypeFragment" + TypeAuthenticationCodeTypeFirebaseAndroid = "authenticationCodeTypeFirebaseAndroid" + TypeAuthenticationCodeTypeFirebaseIos = "authenticationCodeTypeFirebaseIos" + TypeAuthenticationCodeInfo = "authenticationCodeInfo" + TypeEmailAddressAuthenticationCodeInfo = "emailAddressAuthenticationCodeInfo" + TypeEmailAddressAuthenticationCode = "emailAddressAuthenticationCode" + TypeEmailAddressAuthenticationAppleId = "emailAddressAuthenticationAppleId" + TypeEmailAddressAuthenticationGoogleId = "emailAddressAuthenticationGoogleId" + TypeEmailAddressResetStateAvailable = "emailAddressResetStateAvailable" + TypeEmailAddressResetStatePending = "emailAddressResetStatePending" + TypeTextEntity = "textEntity" + TypeTextEntities = "textEntities" + TypeFormattedText = "formattedText" + TypeTermsOfService = "termsOfService" + TypeAuthorizationStateWaitTdlibParameters = "authorizationStateWaitTdlibParameters" + TypeAuthorizationStateWaitPhoneNumber = "authorizationStateWaitPhoneNumber" + TypeAuthorizationStateWaitEmailAddress = "authorizationStateWaitEmailAddress" + TypeAuthorizationStateWaitEmailCode = "authorizationStateWaitEmailCode" + TypeAuthorizationStateWaitCode = "authorizationStateWaitCode" + TypeAuthorizationStateWaitOtherDeviceConfirmation = "authorizationStateWaitOtherDeviceConfirmation" + TypeAuthorizationStateWaitRegistration = "authorizationStateWaitRegistration" + TypeAuthorizationStateWaitPassword = "authorizationStateWaitPassword" + TypeAuthorizationStateReady = "authorizationStateReady" + TypeAuthorizationStateLoggingOut = "authorizationStateLoggingOut" + TypeAuthorizationStateClosing = "authorizationStateClosing" + TypeAuthorizationStateClosed = "authorizationStateClosed" + TypePasswordState = "passwordState" + TypeRecoveryEmailAddress = "recoveryEmailAddress" + TypeTemporaryPasswordState = "temporaryPasswordState" + TypeLocalFile = "localFile" + TypeRemoteFile = "remoteFile" + TypeFile = "file" + TypeInputFileId = "inputFileId" + TypeInputFileRemote = "inputFileRemote" + TypeInputFileLocal = "inputFileLocal" + TypeInputFileGenerated = "inputFileGenerated" + TypePhotoSize = "photoSize" + TypeMinithumbnail = "minithumbnail" + TypeThumbnailFormatJpeg = "thumbnailFormatJpeg" + TypeThumbnailFormatGif = "thumbnailFormatGif" + TypeThumbnailFormatMpeg4 = "thumbnailFormatMpeg4" + TypeThumbnailFormatPng = "thumbnailFormatPng" + TypeThumbnailFormatTgs = "thumbnailFormatTgs" + TypeThumbnailFormatWebm = "thumbnailFormatWebm" + TypeThumbnailFormatWebp = "thumbnailFormatWebp" + TypeThumbnail = "thumbnail" + TypeMaskPointForehead = "maskPointForehead" + TypeMaskPointEyes = "maskPointEyes" + TypeMaskPointMouth = "maskPointMouth" + TypeMaskPointChin = "maskPointChin" + TypeMaskPosition = "maskPosition" + TypeStickerFormatWebp = "stickerFormatWebp" + TypeStickerFormatTgs = "stickerFormatTgs" + TypeStickerFormatWebm = "stickerFormatWebm" + TypeStickerTypeRegular = "stickerTypeRegular" + TypeStickerTypeMask = "stickerTypeMask" + TypeStickerTypeCustomEmoji = "stickerTypeCustomEmoji" + TypeStickerFullTypeRegular = "stickerFullTypeRegular" + TypeStickerFullTypeMask = "stickerFullTypeMask" + TypeStickerFullTypeCustomEmoji = "stickerFullTypeCustomEmoji" + TypeClosedVectorPath = "closedVectorPath" + TypePollOption = "pollOption" + TypePollTypeRegular = "pollTypeRegular" + TypePollTypeQuiz = "pollTypeQuiz" + TypeAnimation = "animation" + TypeAudio = "audio" + TypeDocument = "document" + TypePhoto = "photo" + TypeSticker = "sticker" + TypeVideo = "video" + TypeVideoNote = "videoNote" + TypeVoiceNote = "voiceNote" + TypeAnimatedEmoji = "animatedEmoji" + TypeContact = "contact" + TypeLocation = "location" + TypeVenue = "venue" + TypeGame = "game" + TypeWebApp = "webApp" + TypePoll = "poll" + TypeBackground = "background" + TypeBackgrounds = "backgrounds" + TypeChatBackground = "chatBackground" + TypeProfilePhoto = "profilePhoto" + TypeChatPhotoInfo = "chatPhotoInfo" + TypeUserTypeRegular = "userTypeRegular" + TypeUserTypeDeleted = "userTypeDeleted" + TypeUserTypeBot = "userTypeBot" + TypeUserTypeUnknown = "userTypeUnknown" + TypeBotCommand = "botCommand" + TypeBotCommands = "botCommands" + TypeBotMenuButton = "botMenuButton" + TypeChatLocation = "chatLocation" + TypeBirthdate = "birthdate" + TypeCloseBirthdayUser = "closeBirthdayUser" + TypeBusinessAwayMessageScheduleAlways = "businessAwayMessageScheduleAlways" + TypeBusinessAwayMessageScheduleOutsideOfOpeningHours = "businessAwayMessageScheduleOutsideOfOpeningHours" + TypeBusinessAwayMessageScheduleCustom = "businessAwayMessageScheduleCustom" + TypeBusinessLocation = "businessLocation" + TypeBusinessRecipients = "businessRecipients" + TypeBusinessAwayMessageSettings = "businessAwayMessageSettings" + TypeBusinessGreetingMessageSettings = "businessGreetingMessageSettings" + TypeBusinessConnectedBot = "businessConnectedBot" + TypeBusinessIntro = "businessIntro" + TypeInputBusinessIntro = "inputBusinessIntro" + TypeBusinessOpeningHoursInterval = "businessOpeningHoursInterval" + TypeBusinessOpeningHours = "businessOpeningHours" + TypeBusinessInfo = "businessInfo" + TypeChatPhotoStickerTypeRegularOrMask = "chatPhotoStickerTypeRegularOrMask" + TypeChatPhotoStickerTypeCustomEmoji = "chatPhotoStickerTypeCustomEmoji" + TypeChatPhotoSticker = "chatPhotoSticker" + TypeAnimatedChatPhoto = "animatedChatPhoto" + TypeChatPhoto = "chatPhoto" + TypeChatPhotos = "chatPhotos" + TypeInputChatPhotoPrevious = "inputChatPhotoPrevious" + TypeInputChatPhotoStatic = "inputChatPhotoStatic" + TypeInputChatPhotoAnimation = "inputChatPhotoAnimation" + TypeInputChatPhotoSticker = "inputChatPhotoSticker" + TypeChatPermissions = "chatPermissions" + TypeChatAdministratorRights = "chatAdministratorRights" + TypePremiumPaymentOption = "premiumPaymentOption" + TypePremiumStatePaymentOption = "premiumStatePaymentOption" + TypePremiumGiftCodePaymentOption = "premiumGiftCodePaymentOption" + TypePremiumGiftCodePaymentOptions = "premiumGiftCodePaymentOptions" + TypePremiumGiftCodeInfo = "premiumGiftCodeInfo" + TypePremiumGiveawayParticipantStatusEligible = "premiumGiveawayParticipantStatusEligible" + TypePremiumGiveawayParticipantStatusParticipating = "premiumGiveawayParticipantStatusParticipating" + TypePremiumGiveawayParticipantStatusAlreadyWasMember = "premiumGiveawayParticipantStatusAlreadyWasMember" + TypePremiumGiveawayParticipantStatusAdministrator = "premiumGiveawayParticipantStatusAdministrator" + TypePremiumGiveawayParticipantStatusDisallowedCountry = "premiumGiveawayParticipantStatusDisallowedCountry" + TypePremiumGiveawayInfoOngoing = "premiumGiveawayInfoOngoing" + TypePremiumGiveawayInfoCompleted = "premiumGiveawayInfoCompleted" + TypeAccentColor = "accentColor" + TypeProfileAccentColors = "profileAccentColors" + TypeProfileAccentColor = "profileAccentColor" + TypeEmojiStatus = "emojiStatus" + TypeEmojiStatuses = "emojiStatuses" + TypeUsernames = "usernames" + TypeUser = "user" + TypeBotInfo = "botInfo" + TypeUserFullInfo = "userFullInfo" + TypeUsers = "users" + TypeChatAdministrator = "chatAdministrator" + TypeChatAdministrators = "chatAdministrators" + TypeChatMemberStatusCreator = "chatMemberStatusCreator" + TypeChatMemberStatusAdministrator = "chatMemberStatusAdministrator" + TypeChatMemberStatusMember = "chatMemberStatusMember" + TypeChatMemberStatusRestricted = "chatMemberStatusRestricted" + TypeChatMemberStatusLeft = "chatMemberStatusLeft" + TypeChatMemberStatusBanned = "chatMemberStatusBanned" + TypeChatMember = "chatMember" + TypeChatMembers = "chatMembers" + TypeChatMembersFilterContacts = "chatMembersFilterContacts" + TypeChatMembersFilterAdministrators = "chatMembersFilterAdministrators" + TypeChatMembersFilterMembers = "chatMembersFilterMembers" + TypeChatMembersFilterMention = "chatMembersFilterMention" + TypeChatMembersFilterRestricted = "chatMembersFilterRestricted" + TypeChatMembersFilterBanned = "chatMembersFilterBanned" + TypeChatMembersFilterBots = "chatMembersFilterBots" + TypeSupergroupMembersFilterRecent = "supergroupMembersFilterRecent" + TypeSupergroupMembersFilterContacts = "supergroupMembersFilterContacts" + TypeSupergroupMembersFilterAdministrators = "supergroupMembersFilterAdministrators" + TypeSupergroupMembersFilterSearch = "supergroupMembersFilterSearch" + TypeSupergroupMembersFilterRestricted = "supergroupMembersFilterRestricted" + TypeSupergroupMembersFilterBanned = "supergroupMembersFilterBanned" + TypeSupergroupMembersFilterMention = "supergroupMembersFilterMention" + TypeSupergroupMembersFilterBots = "supergroupMembersFilterBots" + TypeChatInviteLink = "chatInviteLink" + TypeChatInviteLinks = "chatInviteLinks" + TypeChatInviteLinkCount = "chatInviteLinkCount" + TypeChatInviteLinkCounts = "chatInviteLinkCounts" + TypeChatInviteLinkMember = "chatInviteLinkMember" + TypeChatInviteLinkMembers = "chatInviteLinkMembers" + TypeInviteLinkChatTypeBasicGroup = "inviteLinkChatTypeBasicGroup" + TypeInviteLinkChatTypeSupergroup = "inviteLinkChatTypeSupergroup" + TypeInviteLinkChatTypeChannel = "inviteLinkChatTypeChannel" + TypeChatInviteLinkInfo = "chatInviteLinkInfo" + TypeChatJoinRequest = "chatJoinRequest" + TypeChatJoinRequests = "chatJoinRequests" + TypeChatJoinRequestsInfo = "chatJoinRequestsInfo" + TypeBasicGroup = "basicGroup" + TypeBasicGroupFullInfo = "basicGroupFullInfo" + TypeSupergroup = "supergroup" + TypeSupergroupFullInfo = "supergroupFullInfo" + TypeSecretChatStatePending = "secretChatStatePending" + TypeSecretChatStateReady = "secretChatStateReady" + TypeSecretChatStateClosed = "secretChatStateClosed" + TypeSecretChat = "secretChat" + 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" + TypeMessageForwardInfo = "messageForwardInfo" + TypeMessageImportInfo = "messageImportInfo" + TypeMessageReplyInfo = "messageReplyInfo" + TypeMessageReaction = "messageReaction" + TypeMessageReactions = "messageReactions" + TypeMessageInteractionInfo = "messageInteractionInfo" + TypeUnreadReaction = "unreadReaction" + TypeMessageSendingStatePending = "messageSendingStatePending" + TypeMessageSendingStateFailed = "messageSendingStateFailed" + TypeTextQuote = "textQuote" + TypeInputTextQuote = "inputTextQuote" + TypeMessageReplyToMessage = "messageReplyToMessage" + TypeMessageReplyToStory = "messageReplyToStory" + TypeInputMessageReplyToMessage = "inputMessageReplyToMessage" + TypeInputMessageReplyToStory = "inputMessageReplyToStory" + TypeMessage = "message" + TypeMessages = "messages" + TypeFoundMessages = "foundMessages" + TypeFoundChatMessages = "foundChatMessages" + TypeMessagePosition = "messagePosition" + TypeMessagePositions = "messagePositions" + TypeMessageCalendarDay = "messageCalendarDay" + TypeMessageCalendar = "messageCalendar" + TypeBusinessMessage = "businessMessage" + TypeBusinessMessages = "businessMessages" + TypeMessageSourceChatHistory = "messageSourceChatHistory" + TypeMessageSourceMessageThreadHistory = "messageSourceMessageThreadHistory" + TypeMessageSourceForumTopicHistory = "messageSourceForumTopicHistory" + TypeMessageSourceHistoryPreview = "messageSourceHistoryPreview" + TypeMessageSourceChatList = "messageSourceChatList" + TypeMessageSourceSearch = "messageSourceSearch" + TypeMessageSourceChatEventLog = "messageSourceChatEventLog" + TypeMessageSourceNotification = "messageSourceNotification" + TypeMessageSourceScreenshot = "messageSourceScreenshot" + TypeMessageSourceOther = "messageSourceOther" + TypeMessageSponsorTypeBot = "messageSponsorTypeBot" + TypeMessageSponsorTypeWebApp = "messageSponsorTypeWebApp" + TypeMessageSponsorTypePublicChannel = "messageSponsorTypePublicChannel" + TypeMessageSponsorTypePrivateChannel = "messageSponsorTypePrivateChannel" + TypeMessageSponsorTypeWebsite = "messageSponsorTypeWebsite" + TypeMessageSponsor = "messageSponsor" + TypeSponsoredMessage = "sponsoredMessage" + TypeSponsoredMessages = "sponsoredMessages" + TypeReportChatSponsoredMessageOption = "reportChatSponsoredMessageOption" + TypeReportChatSponsoredMessageResultOk = "reportChatSponsoredMessageResultOk" + TypeReportChatSponsoredMessageResultFailed = "reportChatSponsoredMessageResultFailed" + TypeReportChatSponsoredMessageResultOptionRequired = "reportChatSponsoredMessageResultOptionRequired" + TypeReportChatSponsoredMessageResultAdsHidden = "reportChatSponsoredMessageResultAdsHidden" + TypeReportChatSponsoredMessageResultPremiumRequired = "reportChatSponsoredMessageResultPremiumRequired" + TypeFileDownload = "fileDownload" + TypeDownloadedFileCounts = "downloadedFileCounts" + TypeFoundFileDownloads = "foundFileDownloads" + TypeNotificationSettingsScopePrivateChats = "notificationSettingsScopePrivateChats" + TypeNotificationSettingsScopeGroupChats = "notificationSettingsScopeGroupChats" + TypeNotificationSettingsScopeChannelChats = "notificationSettingsScopeChannelChats" + TypeChatNotificationSettings = "chatNotificationSettings" + TypeScopeNotificationSettings = "scopeNotificationSettings" + TypeDraftMessage = "draftMessage" + TypeChatTypePrivate = "chatTypePrivate" + TypeChatTypeBasicGroup = "chatTypeBasicGroup" + TypeChatTypeSupergroup = "chatTypeSupergroup" + TypeChatTypeSecret = "chatTypeSecret" + TypeChatFolderIcon = "chatFolderIcon" + TypeChatFolder = "chatFolder" + TypeChatFolderInfo = "chatFolderInfo" + TypeChatFolderInviteLink = "chatFolderInviteLink" + TypeChatFolderInviteLinks = "chatFolderInviteLinks" + TypeChatFolderInviteLinkInfo = "chatFolderInviteLinkInfo" + TypeRecommendedChatFolder = "recommendedChatFolder" + TypeRecommendedChatFolders = "recommendedChatFolders" + TypeArchiveChatListSettings = "archiveChatListSettings" + TypeChatListMain = "chatListMain" + TypeChatListArchive = "chatListArchive" + TypeChatListFolder = "chatListFolder" + TypeChatLists = "chatLists" + TypeChatSourceMtprotoProxy = "chatSourceMtprotoProxy" + TypeChatSourcePublicServiceAnnouncement = "chatSourcePublicServiceAnnouncement" + TypeChatPosition = "chatPosition" + TypeChatAvailableReactionsAll = "chatAvailableReactionsAll" + TypeChatAvailableReactionsSome = "chatAvailableReactionsSome" + TypeSavedMessagesTag = "savedMessagesTag" + TypeSavedMessagesTags = "savedMessagesTags" + TypeVideoChat = "videoChat" + TypeChat = "chat" + TypeChats = "chats" + TypeChatNearby = "chatNearby" + TypeChatsNearby = "chatsNearby" + TypePublicChatTypeHasUsername = "publicChatTypeHasUsername" + TypePublicChatTypeIsLocationBased = "publicChatTypeIsLocationBased" + TypeChatActionBarReportSpam = "chatActionBarReportSpam" + TypeChatActionBarReportUnrelatedLocation = "chatActionBarReportUnrelatedLocation" + TypeChatActionBarInviteMembers = "chatActionBarInviteMembers" + TypeChatActionBarReportAddBlock = "chatActionBarReportAddBlock" + TypeChatActionBarAddContact = "chatActionBarAddContact" + TypeChatActionBarSharePhoneNumber = "chatActionBarSharePhoneNumber" + TypeChatActionBarJoinRequest = "chatActionBarJoinRequest" + TypeKeyboardButtonTypeText = "keyboardButtonTypeText" + TypeKeyboardButtonTypeRequestPhoneNumber = "keyboardButtonTypeRequestPhoneNumber" + TypeKeyboardButtonTypeRequestLocation = "keyboardButtonTypeRequestLocation" + TypeKeyboardButtonTypeRequestPoll = "keyboardButtonTypeRequestPoll" + TypeKeyboardButtonTypeRequestUsers = "keyboardButtonTypeRequestUsers" + TypeKeyboardButtonTypeRequestChat = "keyboardButtonTypeRequestChat" + TypeKeyboardButtonTypeWebApp = "keyboardButtonTypeWebApp" + TypeKeyboardButton = "keyboardButton" + TypeInlineKeyboardButtonTypeUrl = "inlineKeyboardButtonTypeUrl" + TypeInlineKeyboardButtonTypeLoginUrl = "inlineKeyboardButtonTypeLoginUrl" + TypeInlineKeyboardButtonTypeWebApp = "inlineKeyboardButtonTypeWebApp" + TypeInlineKeyboardButtonTypeCallback = "inlineKeyboardButtonTypeCallback" + TypeInlineKeyboardButtonTypeCallbackWithPassword = "inlineKeyboardButtonTypeCallbackWithPassword" + TypeInlineKeyboardButtonTypeCallbackGame = "inlineKeyboardButtonTypeCallbackGame" + TypeInlineKeyboardButtonTypeSwitchInline = "inlineKeyboardButtonTypeSwitchInline" + TypeInlineKeyboardButtonTypeBuy = "inlineKeyboardButtonTypeBuy" + TypeInlineKeyboardButtonTypeUser = "inlineKeyboardButtonTypeUser" + TypeInlineKeyboardButton = "inlineKeyboardButton" + TypeReplyMarkupRemoveKeyboard = "replyMarkupRemoveKeyboard" + TypeReplyMarkupForceReply = "replyMarkupForceReply" + TypeReplyMarkupShowKeyboard = "replyMarkupShowKeyboard" + TypeReplyMarkupInlineKeyboard = "replyMarkupInlineKeyboard" + TypeLoginUrlInfoOpen = "loginUrlInfoOpen" + TypeLoginUrlInfoRequestConfirmation = "loginUrlInfoRequestConfirmation" + TypeFoundWebApp = "foundWebApp" + TypeWebAppInfo = "webAppInfo" + TypeMessageThreadInfo = "messageThreadInfo" + TypeSavedMessagesTopicTypeMyNotes = "savedMessagesTopicTypeMyNotes" + TypeSavedMessagesTopicTypeAuthorHidden = "savedMessagesTopicTypeAuthorHidden" + TypeSavedMessagesTopicTypeSavedFromChat = "savedMessagesTopicTypeSavedFromChat" + TypeSavedMessagesTopic = "savedMessagesTopic" + TypeForumTopicIcon = "forumTopicIcon" + TypeForumTopicInfo = "forumTopicInfo" + TypeForumTopic = "forumTopic" + TypeForumTopics = "forumTopics" + TypeLinkPreviewOptions = "linkPreviewOptions" + TypeSharedUser = "sharedUser" + TypeSharedChat = "sharedChat" + TypeRichTextPlain = "richTextPlain" + TypeRichTextBold = "richTextBold" + TypeRichTextItalic = "richTextItalic" + TypeRichTextUnderline = "richTextUnderline" + TypeRichTextStrikethrough = "richTextStrikethrough" + TypeRichTextFixed = "richTextFixed" + TypeRichTextUrl = "richTextUrl" + TypeRichTextEmailAddress = "richTextEmailAddress" + TypeRichTextSubscript = "richTextSubscript" + TypeRichTextSuperscript = "richTextSuperscript" + TypeRichTextMarked = "richTextMarked" + TypeRichTextPhoneNumber = "richTextPhoneNumber" + TypeRichTextIcon = "richTextIcon" + TypeRichTextReference = "richTextReference" + TypeRichTextAnchor = "richTextAnchor" + TypeRichTextAnchorLink = "richTextAnchorLink" + TypeRichTexts = "richTexts" + TypePageBlockCaption = "pageBlockCaption" + TypePageBlockListItem = "pageBlockListItem" + TypePageBlockHorizontalAlignmentLeft = "pageBlockHorizontalAlignmentLeft" + TypePageBlockHorizontalAlignmentCenter = "pageBlockHorizontalAlignmentCenter" + TypePageBlockHorizontalAlignmentRight = "pageBlockHorizontalAlignmentRight" + TypePageBlockVerticalAlignmentTop = "pageBlockVerticalAlignmentTop" + TypePageBlockVerticalAlignmentMiddle = "pageBlockVerticalAlignmentMiddle" + TypePageBlockVerticalAlignmentBottom = "pageBlockVerticalAlignmentBottom" + TypePageBlockTableCell = "pageBlockTableCell" + TypePageBlockRelatedArticle = "pageBlockRelatedArticle" + TypePageBlockTitle = "pageBlockTitle" + TypePageBlockSubtitle = "pageBlockSubtitle" + TypePageBlockAuthorDate = "pageBlockAuthorDate" + TypePageBlockHeader = "pageBlockHeader" + TypePageBlockSubheader = "pageBlockSubheader" + TypePageBlockKicker = "pageBlockKicker" + TypePageBlockParagraph = "pageBlockParagraph" + TypePageBlockPreformatted = "pageBlockPreformatted" + TypePageBlockFooter = "pageBlockFooter" + TypePageBlockDivider = "pageBlockDivider" + TypePageBlockAnchor = "pageBlockAnchor" + TypePageBlockList = "pageBlockList" + TypePageBlockBlockQuote = "pageBlockBlockQuote" + TypePageBlockPullQuote = "pageBlockPullQuote" + TypePageBlockAnimation = "pageBlockAnimation" + TypePageBlockAudio = "pageBlockAudio" + TypePageBlockPhoto = "pageBlockPhoto" + TypePageBlockVideo = "pageBlockVideo" + TypePageBlockVoiceNote = "pageBlockVoiceNote" + TypePageBlockCover = "pageBlockCover" + TypePageBlockEmbedded = "pageBlockEmbedded" + TypePageBlockEmbeddedPost = "pageBlockEmbeddedPost" + TypePageBlockCollage = "pageBlockCollage" + TypePageBlockSlideshow = "pageBlockSlideshow" + TypePageBlockChatLink = "pageBlockChatLink" + TypePageBlockTable = "pageBlockTable" + TypePageBlockDetails = "pageBlockDetails" + TypePageBlockRelatedArticles = "pageBlockRelatedArticles" + TypePageBlockMap = "pageBlockMap" + TypeWebPageInstantView = "webPageInstantView" + TypeWebPage = "webPage" + TypeCountryInfo = "countryInfo" + TypeCountries = "countries" + TypePhoneNumberInfo = "phoneNumberInfo" + TypeCollectibleItemTypeUsername = "collectibleItemTypeUsername" + TypeCollectibleItemTypePhoneNumber = "collectibleItemTypePhoneNumber" + TypeCollectibleItemInfo = "collectibleItemInfo" + TypeBankCardActionOpenUrl = "bankCardActionOpenUrl" + TypeBankCardInfo = "bankCardInfo" + TypeAddress = "address" + TypeThemeParameters = "themeParameters" + TypeLabeledPricePart = "labeledPricePart" + TypeInvoice = "invoice" + TypeOrderInfo = "orderInfo" + TypeShippingOption = "shippingOption" + TypeSavedCredentials = "savedCredentials" + TypeInputCredentialsSaved = "inputCredentialsSaved" + TypeInputCredentialsNew = "inputCredentialsNew" + TypeInputCredentialsApplePay = "inputCredentialsApplePay" + TypeInputCredentialsGooglePay = "inputCredentialsGooglePay" + TypePaymentProviderSmartGlocal = "paymentProviderSmartGlocal" + TypePaymentProviderStripe = "paymentProviderStripe" + TypePaymentProviderOther = "paymentProviderOther" + TypePaymentOption = "paymentOption" + TypePaymentForm = "paymentForm" + TypeValidatedOrderInfo = "validatedOrderInfo" + TypePaymentResult = "paymentResult" + TypePaymentReceipt = "paymentReceipt" + TypeInputInvoiceMessage = "inputInvoiceMessage" + TypeInputInvoiceName = "inputInvoiceName" + TypeInputInvoiceTelegram = "inputInvoiceTelegram" + TypeMessageExtendedMediaPreview = "messageExtendedMediaPreview" + TypeMessageExtendedMediaPhoto = "messageExtendedMediaPhoto" + TypeMessageExtendedMediaVideo = "messageExtendedMediaVideo" + TypeMessageExtendedMediaUnsupported = "messageExtendedMediaUnsupported" + TypePremiumGiveawayParameters = "premiumGiveawayParameters" + TypeDatedFile = "datedFile" + TypePassportElementTypePersonalDetails = "passportElementTypePersonalDetails" + TypePassportElementTypePassport = "passportElementTypePassport" + TypePassportElementTypeDriverLicense = "passportElementTypeDriverLicense" + TypePassportElementTypeIdentityCard = "passportElementTypeIdentityCard" + TypePassportElementTypeInternalPassport = "passportElementTypeInternalPassport" + TypePassportElementTypeAddress = "passportElementTypeAddress" + TypePassportElementTypeUtilityBill = "passportElementTypeUtilityBill" + TypePassportElementTypeBankStatement = "passportElementTypeBankStatement" + TypePassportElementTypeRentalAgreement = "passportElementTypeRentalAgreement" + TypePassportElementTypePassportRegistration = "passportElementTypePassportRegistration" + TypePassportElementTypeTemporaryRegistration = "passportElementTypeTemporaryRegistration" + TypePassportElementTypePhoneNumber = "passportElementTypePhoneNumber" + TypePassportElementTypeEmailAddress = "passportElementTypeEmailAddress" + TypeDate = "date" + TypePersonalDetails = "personalDetails" + TypeIdentityDocument = "identityDocument" + TypeInputIdentityDocument = "inputIdentityDocument" + TypePersonalDocument = "personalDocument" + TypeInputPersonalDocument = "inputPersonalDocument" + TypePassportElementPersonalDetails = "passportElementPersonalDetails" + TypePassportElementPassport = "passportElementPassport" + TypePassportElementDriverLicense = "passportElementDriverLicense" + TypePassportElementIdentityCard = "passportElementIdentityCard" + TypePassportElementInternalPassport = "passportElementInternalPassport" + TypePassportElementAddress = "passportElementAddress" + TypePassportElementUtilityBill = "passportElementUtilityBill" + TypePassportElementBankStatement = "passportElementBankStatement" + TypePassportElementRentalAgreement = "passportElementRentalAgreement" + TypePassportElementPassportRegistration = "passportElementPassportRegistration" + TypePassportElementTemporaryRegistration = "passportElementTemporaryRegistration" + TypePassportElementPhoneNumber = "passportElementPhoneNumber" + TypePassportElementEmailAddress = "passportElementEmailAddress" + TypeInputPassportElementPersonalDetails = "inputPassportElementPersonalDetails" + TypeInputPassportElementPassport = "inputPassportElementPassport" + TypeInputPassportElementDriverLicense = "inputPassportElementDriverLicense" + TypeInputPassportElementIdentityCard = "inputPassportElementIdentityCard" + TypeInputPassportElementInternalPassport = "inputPassportElementInternalPassport" + TypeInputPassportElementAddress = "inputPassportElementAddress" + TypeInputPassportElementUtilityBill = "inputPassportElementUtilityBill" + TypeInputPassportElementBankStatement = "inputPassportElementBankStatement" + TypeInputPassportElementRentalAgreement = "inputPassportElementRentalAgreement" + TypeInputPassportElementPassportRegistration = "inputPassportElementPassportRegistration" + TypeInputPassportElementTemporaryRegistration = "inputPassportElementTemporaryRegistration" + TypeInputPassportElementPhoneNumber = "inputPassportElementPhoneNumber" + TypeInputPassportElementEmailAddress = "inputPassportElementEmailAddress" + TypePassportElements = "passportElements" + TypePassportElementErrorSourceUnspecified = "passportElementErrorSourceUnspecified" + TypePassportElementErrorSourceDataField = "passportElementErrorSourceDataField" + TypePassportElementErrorSourceFrontSide = "passportElementErrorSourceFrontSide" + TypePassportElementErrorSourceReverseSide = "passportElementErrorSourceReverseSide" + TypePassportElementErrorSourceSelfie = "passportElementErrorSourceSelfie" + TypePassportElementErrorSourceTranslationFile = "passportElementErrorSourceTranslationFile" + TypePassportElementErrorSourceTranslationFiles = "passportElementErrorSourceTranslationFiles" + TypePassportElementErrorSourceFile = "passportElementErrorSourceFile" + TypePassportElementErrorSourceFiles = "passportElementErrorSourceFiles" + TypePassportElementError = "passportElementError" + TypePassportSuitableElement = "passportSuitableElement" + TypePassportRequiredElement = "passportRequiredElement" + TypePassportAuthorizationForm = "passportAuthorizationForm" + TypePassportElementsWithErrors = "passportElementsWithErrors" + TypeEncryptedCredentials = "encryptedCredentials" + TypeEncryptedPassportElement = "encryptedPassportElement" + TypeInputPassportElementErrorSourceUnspecified = "inputPassportElementErrorSourceUnspecified" + TypeInputPassportElementErrorSourceDataField = "inputPassportElementErrorSourceDataField" + TypeInputPassportElementErrorSourceFrontSide = "inputPassportElementErrorSourceFrontSide" + TypeInputPassportElementErrorSourceReverseSide = "inputPassportElementErrorSourceReverseSide" + TypeInputPassportElementErrorSourceSelfie = "inputPassportElementErrorSourceSelfie" + TypeInputPassportElementErrorSourceTranslationFile = "inputPassportElementErrorSourceTranslationFile" + TypeInputPassportElementErrorSourceTranslationFiles = "inputPassportElementErrorSourceTranslationFiles" + TypeInputPassportElementErrorSourceFile = "inputPassportElementErrorSourceFile" + TypeInputPassportElementErrorSourceFiles = "inputPassportElementErrorSourceFiles" + TypeInputPassportElementError = "inputPassportElementError" + TypeMessageText = "messageText" + TypeMessageAnimation = "messageAnimation" + TypeMessageAudio = "messageAudio" + TypeMessageDocument = "messageDocument" + TypeMessagePhoto = "messagePhoto" + TypeMessageSticker = "messageSticker" + TypeMessageVideo = "messageVideo" + TypeMessageVideoNote = "messageVideoNote" + TypeMessageVoiceNote = "messageVoiceNote" + TypeMessageExpiredPhoto = "messageExpiredPhoto" + TypeMessageExpiredVideo = "messageExpiredVideo" + TypeMessageExpiredVideoNote = "messageExpiredVideoNote" + TypeMessageExpiredVoiceNote = "messageExpiredVoiceNote" + TypeMessageLocation = "messageLocation" + TypeMessageVenue = "messageVenue" + TypeMessageContact = "messageContact" + TypeMessageAnimatedEmoji = "messageAnimatedEmoji" + TypeMessageDice = "messageDice" + TypeMessageGame = "messageGame" + TypeMessagePoll = "messagePoll" + TypeMessageStory = "messageStory" + TypeMessageInvoice = "messageInvoice" + TypeMessageCall = "messageCall" + TypeMessageVideoChatScheduled = "messageVideoChatScheduled" + TypeMessageVideoChatStarted = "messageVideoChatStarted" + TypeMessageVideoChatEnded = "messageVideoChatEnded" + TypeMessageInviteVideoChatParticipants = "messageInviteVideoChatParticipants" + TypeMessageBasicGroupChatCreate = "messageBasicGroupChatCreate" + TypeMessageSupergroupChatCreate = "messageSupergroupChatCreate" + TypeMessageChatChangeTitle = "messageChatChangeTitle" + TypeMessageChatChangePhoto = "messageChatChangePhoto" + TypeMessageChatDeletePhoto = "messageChatDeletePhoto" + TypeMessageChatAddMembers = "messageChatAddMembers" + TypeMessageChatJoinByLink = "messageChatJoinByLink" + TypeMessageChatJoinByRequest = "messageChatJoinByRequest" + TypeMessageChatDeleteMember = "messageChatDeleteMember" + TypeMessageChatUpgradeTo = "messageChatUpgradeTo" + TypeMessageChatUpgradeFrom = "messageChatUpgradeFrom" + TypeMessagePinMessage = "messagePinMessage" + TypeMessageScreenshotTaken = "messageScreenshotTaken" + TypeMessageChatSetBackground = "messageChatSetBackground" + TypeMessageChatSetTheme = "messageChatSetTheme" + TypeMessageChatSetMessageAutoDeleteTime = "messageChatSetMessageAutoDeleteTime" + TypeMessageChatBoost = "messageChatBoost" + TypeMessageForumTopicCreated = "messageForumTopicCreated" + TypeMessageForumTopicEdited = "messageForumTopicEdited" + TypeMessageForumTopicIsClosedToggled = "messageForumTopicIsClosedToggled" + TypeMessageForumTopicIsHiddenToggled = "messageForumTopicIsHiddenToggled" + TypeMessageSuggestProfilePhoto = "messageSuggestProfilePhoto" + TypeMessageCustomServiceAction = "messageCustomServiceAction" + TypeMessageGameScore = "messageGameScore" + TypeMessagePaymentSuccessful = "messagePaymentSuccessful" + TypeMessagePaymentSuccessfulBot = "messagePaymentSuccessfulBot" + TypeMessageGiftedPremium = "messageGiftedPremium" + TypeMessagePremiumGiftCode = "messagePremiumGiftCode" + TypeMessagePremiumGiveawayCreated = "messagePremiumGiveawayCreated" + TypeMessagePremiumGiveaway = "messagePremiumGiveaway" + TypeMessagePremiumGiveawayCompleted = "messagePremiumGiveawayCompleted" + TypeMessagePremiumGiveawayWinners = "messagePremiumGiveawayWinners" + TypeMessageContactRegistered = "messageContactRegistered" + TypeMessageUsersShared = "messageUsersShared" + TypeMessageChatShared = "messageChatShared" + TypeMessageBotWriteAccessAllowed = "messageBotWriteAccessAllowed" + TypeMessageWebAppDataSent = "messageWebAppDataSent" + TypeMessageWebAppDataReceived = "messageWebAppDataReceived" + TypeMessagePassportDataSent = "messagePassportDataSent" + TypeMessagePassportDataReceived = "messagePassportDataReceived" + TypeMessageProximityAlertTriggered = "messageProximityAlertTriggered" + TypeMessageUnsupported = "messageUnsupported" + TypeTextEntityTypeMention = "textEntityTypeMention" + TypeTextEntityTypeHashtag = "textEntityTypeHashtag" + TypeTextEntityTypeCashtag = "textEntityTypeCashtag" + TypeTextEntityTypeBotCommand = "textEntityTypeBotCommand" + TypeTextEntityTypeUrl = "textEntityTypeUrl" + TypeTextEntityTypeEmailAddress = "textEntityTypeEmailAddress" + TypeTextEntityTypePhoneNumber = "textEntityTypePhoneNumber" + TypeTextEntityTypeBankCardNumber = "textEntityTypeBankCardNumber" + TypeTextEntityTypeBold = "textEntityTypeBold" + TypeTextEntityTypeItalic = "textEntityTypeItalic" + TypeTextEntityTypeUnderline = "textEntityTypeUnderline" + TypeTextEntityTypeStrikethrough = "textEntityTypeStrikethrough" + TypeTextEntityTypeSpoiler = "textEntityTypeSpoiler" + TypeTextEntityTypeCode = "textEntityTypeCode" + TypeTextEntityTypePre = "textEntityTypePre" + TypeTextEntityTypePreCode = "textEntityTypePreCode" + TypeTextEntityTypeBlockQuote = "textEntityTypeBlockQuote" + TypeTextEntityTypeTextUrl = "textEntityTypeTextUrl" + TypeTextEntityTypeMentionName = "textEntityTypeMentionName" + TypeTextEntityTypeCustomEmoji = "textEntityTypeCustomEmoji" + TypeTextEntityTypeMediaTimestamp = "textEntityTypeMediaTimestamp" + TypeInputThumbnail = "inputThumbnail" + TypeMessageSchedulingStateSendAtDate = "messageSchedulingStateSendAtDate" + TypeMessageSchedulingStateSendWhenOnline = "messageSchedulingStateSendWhenOnline" + TypeMessageSelfDestructTypeTimer = "messageSelfDestructTypeTimer" + TypeMessageSelfDestructTypeImmediately = "messageSelfDestructTypeImmediately" + TypeMessageSendOptions = "messageSendOptions" + TypeMessageCopyOptions = "messageCopyOptions" + TypeInputMessageText = "inputMessageText" + TypeInputMessageAnimation = "inputMessageAnimation" + TypeInputMessageAudio = "inputMessageAudio" + TypeInputMessageDocument = "inputMessageDocument" + TypeInputMessagePhoto = "inputMessagePhoto" + TypeInputMessageSticker = "inputMessageSticker" + TypeInputMessageVideo = "inputMessageVideo" + TypeInputMessageVideoNote = "inputMessageVideoNote" + TypeInputMessageVoiceNote = "inputMessageVoiceNote" + TypeInputMessageLocation = "inputMessageLocation" + TypeInputMessageVenue = "inputMessageVenue" + TypeInputMessageContact = "inputMessageContact" + TypeInputMessageDice = "inputMessageDice" + TypeInputMessageGame = "inputMessageGame" + TypeInputMessageInvoice = "inputMessageInvoice" + TypeInputMessagePoll = "inputMessagePoll" + TypeInputMessageStory = "inputMessageStory" + TypeInputMessageForwarded = "inputMessageForwarded" + TypeSearchMessagesFilterEmpty = "searchMessagesFilterEmpty" + TypeSearchMessagesFilterAnimation = "searchMessagesFilterAnimation" + TypeSearchMessagesFilterAudio = "searchMessagesFilterAudio" + TypeSearchMessagesFilterDocument = "searchMessagesFilterDocument" + TypeSearchMessagesFilterPhoto = "searchMessagesFilterPhoto" + TypeSearchMessagesFilterVideo = "searchMessagesFilterVideo" + TypeSearchMessagesFilterVoiceNote = "searchMessagesFilterVoiceNote" + TypeSearchMessagesFilterPhotoAndVideo = "searchMessagesFilterPhotoAndVideo" + TypeSearchMessagesFilterUrl = "searchMessagesFilterUrl" + TypeSearchMessagesFilterChatPhoto = "searchMessagesFilterChatPhoto" + TypeSearchMessagesFilterVideoNote = "searchMessagesFilterVideoNote" + TypeSearchMessagesFilterVoiceAndVideoNote = "searchMessagesFilterVoiceAndVideoNote" + TypeSearchMessagesFilterMention = "searchMessagesFilterMention" + TypeSearchMessagesFilterUnreadMention = "searchMessagesFilterUnreadMention" + TypeSearchMessagesFilterUnreadReaction = "searchMessagesFilterUnreadReaction" + TypeSearchMessagesFilterFailedToSend = "searchMessagesFilterFailedToSend" + TypeSearchMessagesFilterPinned = "searchMessagesFilterPinned" + TypeChatActionTyping = "chatActionTyping" + TypeChatActionRecordingVideo = "chatActionRecordingVideo" + TypeChatActionUploadingVideo = "chatActionUploadingVideo" + TypeChatActionRecordingVoiceNote = "chatActionRecordingVoiceNote" + TypeChatActionUploadingVoiceNote = "chatActionUploadingVoiceNote" + TypeChatActionUploadingPhoto = "chatActionUploadingPhoto" + TypeChatActionUploadingDocument = "chatActionUploadingDocument" + TypeChatActionChoosingSticker = "chatActionChoosingSticker" + TypeChatActionChoosingLocation = "chatActionChoosingLocation" + TypeChatActionChoosingContact = "chatActionChoosingContact" + TypeChatActionStartPlayingGame = "chatActionStartPlayingGame" + TypeChatActionRecordingVideoNote = "chatActionRecordingVideoNote" + TypeChatActionUploadingVideoNote = "chatActionUploadingVideoNote" + TypeChatActionWatchingAnimations = "chatActionWatchingAnimations" + TypeChatActionCancel = "chatActionCancel" + TypeUserStatusEmpty = "userStatusEmpty" + TypeUserStatusOnline = "userStatusOnline" + TypeUserStatusOffline = "userStatusOffline" + TypeUserStatusRecently = "userStatusRecently" + TypeUserStatusLastWeek = "userStatusLastWeek" + TypeUserStatusLastMonth = "userStatusLastMonth" + TypeEmojiKeyword = "emojiKeyword" + TypeEmojiKeywords = "emojiKeywords" + TypeStickers = "stickers" + TypeEmojis = "emojis" + TypeStickerSet = "stickerSet" + TypeStickerSetInfo = "stickerSetInfo" + TypeStickerSets = "stickerSets" + TypeTrendingStickerSets = "trendingStickerSets" + TypeEmojiCategory = "emojiCategory" + TypeEmojiCategories = "emojiCategories" + TypeEmojiCategoryTypeDefault = "emojiCategoryTypeDefault" + TypeEmojiCategoryTypeEmojiStatus = "emojiCategoryTypeEmojiStatus" + TypeEmojiCategoryTypeChatPhoto = "emojiCategoryTypeChatPhoto" + TypeStoryAreaPosition = "storyAreaPosition" + TypeStoryAreaTypeLocation = "storyAreaTypeLocation" + TypeStoryAreaTypeVenue = "storyAreaTypeVenue" + TypeStoryAreaTypeSuggestedReaction = "storyAreaTypeSuggestedReaction" + TypeStoryAreaTypeMessage = "storyAreaTypeMessage" + TypeStoryArea = "storyArea" + TypeInputStoryAreaTypeLocation = "inputStoryAreaTypeLocation" + TypeInputStoryAreaTypeFoundVenue = "inputStoryAreaTypeFoundVenue" + TypeInputStoryAreaTypePreviousVenue = "inputStoryAreaTypePreviousVenue" + TypeInputStoryAreaTypeSuggestedReaction = "inputStoryAreaTypeSuggestedReaction" + TypeInputStoryAreaTypeMessage = "inputStoryAreaTypeMessage" + TypeInputStoryArea = "inputStoryArea" + TypeInputStoryAreas = "inputStoryAreas" + TypeStoryVideo = "storyVideo" + TypeStoryContentPhoto = "storyContentPhoto" + TypeStoryContentVideo = "storyContentVideo" + TypeStoryContentUnsupported = "storyContentUnsupported" + TypeInputStoryContentPhoto = "inputStoryContentPhoto" + TypeInputStoryContentVideo = "inputStoryContentVideo" + TypeStoryListMain = "storyListMain" + TypeStoryListArchive = "storyListArchive" + TypeStoryOriginPublicStory = "storyOriginPublicStory" + TypeStoryOriginHiddenUser = "storyOriginHiddenUser" + TypeStoryRepostInfo = "storyRepostInfo" + TypeStoryInteractionInfo = "storyInteractionInfo" + TypeStory = "story" + TypeStories = "stories" + TypeStoryFullId = "storyFullId" + TypeStoryInfo = "storyInfo" + TypeChatActiveStories = "chatActiveStories" + TypeStoryInteractionTypeView = "storyInteractionTypeView" + TypeStoryInteractionTypeForward = "storyInteractionTypeForward" + TypeStoryInteractionTypeRepost = "storyInteractionTypeRepost" + TypeStoryInteraction = "storyInteraction" + TypeStoryInteractions = "storyInteractions" + TypeQuickReplyMessage = "quickReplyMessage" + TypeQuickReplyShortcut = "quickReplyShortcut" + TypePublicForwardMessage = "publicForwardMessage" + TypePublicForwardStory = "publicForwardStory" + TypePublicForwards = "publicForwards" + TypeChatBoostLevelFeatures = "chatBoostLevelFeatures" + TypeChatBoostFeatures = "chatBoostFeatures" + TypeChatBoostSourceGiftCode = "chatBoostSourceGiftCode" + TypeChatBoostSourceGiveaway = "chatBoostSourceGiveaway" + TypeChatBoostSourcePremium = "chatBoostSourcePremium" + TypePrepaidPremiumGiveaway = "prepaidPremiumGiveaway" + TypeChatBoostStatus = "chatBoostStatus" + TypeChatBoost = "chatBoost" + TypeFoundChatBoosts = "foundChatBoosts" + TypeChatBoostSlot = "chatBoostSlot" + TypeChatBoostSlots = "chatBoostSlots" + TypeCallDiscardReasonEmpty = "callDiscardReasonEmpty" + TypeCallDiscardReasonMissed = "callDiscardReasonMissed" + TypeCallDiscardReasonDeclined = "callDiscardReasonDeclined" + TypeCallDiscardReasonDisconnected = "callDiscardReasonDisconnected" + TypeCallDiscardReasonHungUp = "callDiscardReasonHungUp" + TypeCallProtocol = "callProtocol" + TypeCallServerTypeTelegramReflector = "callServerTypeTelegramReflector" + TypeCallServerTypeWebrtc = "callServerTypeWebrtc" + TypeCallServer = "callServer" + TypeCallId = "callId" + TypeGroupCallId = "groupCallId" + TypeCallStatePending = "callStatePending" + TypeCallStateExchangingKeys = "callStateExchangingKeys" + TypeCallStateReady = "callStateReady" + TypeCallStateHangingUp = "callStateHangingUp" + TypeCallStateDiscarded = "callStateDiscarded" + TypeCallStateError = "callStateError" + TypeGroupCallVideoQualityThumbnail = "groupCallVideoQualityThumbnail" + TypeGroupCallVideoQualityMedium = "groupCallVideoQualityMedium" + TypeGroupCallVideoQualityFull = "groupCallVideoQualityFull" + TypeGroupCallStream = "groupCallStream" + TypeGroupCallStreams = "groupCallStreams" + TypeRtmpUrl = "rtmpUrl" + TypeGroupCallRecentSpeaker = "groupCallRecentSpeaker" + TypeGroupCall = "groupCall" + TypeGroupCallVideoSourceGroup = "groupCallVideoSourceGroup" + TypeGroupCallParticipantVideoInfo = "groupCallParticipantVideoInfo" + TypeGroupCallParticipant = "groupCallParticipant" + TypeCallProblemEcho = "callProblemEcho" + TypeCallProblemNoise = "callProblemNoise" + TypeCallProblemInterruptions = "callProblemInterruptions" + TypeCallProblemDistortedSpeech = "callProblemDistortedSpeech" + TypeCallProblemSilentLocal = "callProblemSilentLocal" + TypeCallProblemSilentRemote = "callProblemSilentRemote" + TypeCallProblemDropped = "callProblemDropped" + TypeCallProblemDistortedVideo = "callProblemDistortedVideo" + TypeCallProblemPixelatedVideo = "callProblemPixelatedVideo" + TypeCall = "call" + TypeFirebaseAuthenticationSettingsAndroid = "firebaseAuthenticationSettingsAndroid" + TypeFirebaseAuthenticationSettingsIos = "firebaseAuthenticationSettingsIos" + TypePhoneNumberAuthenticationSettings = "phoneNumberAuthenticationSettings" + TypeAddedReaction = "addedReaction" + TypeAddedReactions = "addedReactions" + TypeAvailableReaction = "availableReaction" + TypeAvailableReactions = "availableReactions" + TypeEmojiReaction = "emojiReaction" + TypeReactionUnavailabilityReasonAnonymousAdministrator = "reactionUnavailabilityReasonAnonymousAdministrator" + TypeReactionUnavailabilityReasonGuest = "reactionUnavailabilityReasonGuest" + TypeAnimations = "animations" + TypeDiceStickersRegular = "diceStickersRegular" + TypeDiceStickersSlotMachine = "diceStickersSlotMachine" + TypeImportedContacts = "importedContacts" + TypeSpeechRecognitionResultPending = "speechRecognitionResultPending" + TypeSpeechRecognitionResultText = "speechRecognitionResultText" + TypeSpeechRecognitionResultError = "speechRecognitionResultError" + TypeBusinessConnection = "businessConnection" + TypeAttachmentMenuBotColor = "attachmentMenuBotColor" + TypeAttachmentMenuBot = "attachmentMenuBot" + TypeSentWebAppMessage = "sentWebAppMessage" + TypeBotWriteAccessAllowReasonConnectedWebsite = "botWriteAccessAllowReasonConnectedWebsite" + TypeBotWriteAccessAllowReasonAddedToAttachmentMenu = "botWriteAccessAllowReasonAddedToAttachmentMenu" + TypeBotWriteAccessAllowReasonLaunchedWebApp = "botWriteAccessAllowReasonLaunchedWebApp" + TypeBotWriteAccessAllowReasonAcceptedRequest = "botWriteAccessAllowReasonAcceptedRequest" + TypeHttpUrl = "httpUrl" + TypeUserLink = "userLink" + TypeInputInlineQueryResultAnimation = "inputInlineQueryResultAnimation" + TypeInputInlineQueryResultArticle = "inputInlineQueryResultArticle" + TypeInputInlineQueryResultAudio = "inputInlineQueryResultAudio" + TypeInputInlineQueryResultContact = "inputInlineQueryResultContact" + TypeInputInlineQueryResultDocument = "inputInlineQueryResultDocument" + TypeInputInlineQueryResultGame = "inputInlineQueryResultGame" + TypeInputInlineQueryResultLocation = "inputInlineQueryResultLocation" + TypeInputInlineQueryResultPhoto = "inputInlineQueryResultPhoto" + TypeInputInlineQueryResultSticker = "inputInlineQueryResultSticker" + TypeInputInlineQueryResultVenue = "inputInlineQueryResultVenue" + TypeInputInlineQueryResultVideo = "inputInlineQueryResultVideo" + TypeInputInlineQueryResultVoiceNote = "inputInlineQueryResultVoiceNote" + TypeInlineQueryResultArticle = "inlineQueryResultArticle" + TypeInlineQueryResultContact = "inlineQueryResultContact" + TypeInlineQueryResultLocation = "inlineQueryResultLocation" + TypeInlineQueryResultVenue = "inlineQueryResultVenue" + TypeInlineQueryResultGame = "inlineQueryResultGame" + TypeInlineQueryResultAnimation = "inlineQueryResultAnimation" + TypeInlineQueryResultAudio = "inlineQueryResultAudio" + TypeInlineQueryResultDocument = "inlineQueryResultDocument" + TypeInlineQueryResultPhoto = "inlineQueryResultPhoto" + TypeInlineQueryResultSticker = "inlineQueryResultSticker" + TypeInlineQueryResultVideo = "inlineQueryResultVideo" + TypeInlineQueryResultVoiceNote = "inlineQueryResultVoiceNote" + TypeInlineQueryResultsButtonTypeStartBot = "inlineQueryResultsButtonTypeStartBot" + TypeInlineQueryResultsButtonTypeWebApp = "inlineQueryResultsButtonTypeWebApp" + TypeInlineQueryResultsButton = "inlineQueryResultsButton" + TypeInlineQueryResults = "inlineQueryResults" + TypeCallbackQueryPayloadData = "callbackQueryPayloadData" + TypeCallbackQueryPayloadDataWithPassword = "callbackQueryPayloadDataWithPassword" + TypeCallbackQueryPayloadGame = "callbackQueryPayloadGame" + TypeCallbackQueryAnswer = "callbackQueryAnswer" + TypeCustomRequestResult = "customRequestResult" + TypeGameHighScore = "gameHighScore" + TypeGameHighScores = "gameHighScores" + TypeChatEventMessageEdited = "chatEventMessageEdited" + TypeChatEventMessageDeleted = "chatEventMessageDeleted" + TypeChatEventMessagePinned = "chatEventMessagePinned" + TypeChatEventMessageUnpinned = "chatEventMessageUnpinned" + TypeChatEventPollStopped = "chatEventPollStopped" + TypeChatEventMemberJoined = "chatEventMemberJoined" + TypeChatEventMemberJoinedByInviteLink = "chatEventMemberJoinedByInviteLink" + TypeChatEventMemberJoinedByRequest = "chatEventMemberJoinedByRequest" + TypeChatEventMemberInvited = "chatEventMemberInvited" + TypeChatEventMemberLeft = "chatEventMemberLeft" + TypeChatEventMemberPromoted = "chatEventMemberPromoted" + TypeChatEventMemberRestricted = "chatEventMemberRestricted" + TypeChatEventAvailableReactionsChanged = "chatEventAvailableReactionsChanged" + TypeChatEventBackgroundChanged = "chatEventBackgroundChanged" + TypeChatEventDescriptionChanged = "chatEventDescriptionChanged" + TypeChatEventEmojiStatusChanged = "chatEventEmojiStatusChanged" + TypeChatEventLinkedChatChanged = "chatEventLinkedChatChanged" + TypeChatEventLocationChanged = "chatEventLocationChanged" + TypeChatEventMessageAutoDeleteTimeChanged = "chatEventMessageAutoDeleteTimeChanged" + TypeChatEventPermissionsChanged = "chatEventPermissionsChanged" + TypeChatEventPhotoChanged = "chatEventPhotoChanged" + TypeChatEventSlowModeDelayChanged = "chatEventSlowModeDelayChanged" + TypeChatEventStickerSetChanged = "chatEventStickerSetChanged" + TypeChatEventCustomEmojiStickerSetChanged = "chatEventCustomEmojiStickerSetChanged" + TypeChatEventTitleChanged = "chatEventTitleChanged" + TypeChatEventUsernameChanged = "chatEventUsernameChanged" + TypeChatEventActiveUsernamesChanged = "chatEventActiveUsernamesChanged" + TypeChatEventAccentColorChanged = "chatEventAccentColorChanged" + TypeChatEventProfileAccentColorChanged = "chatEventProfileAccentColorChanged" + TypeChatEventHasProtectedContentToggled = "chatEventHasProtectedContentToggled" + TypeChatEventInvitesToggled = "chatEventInvitesToggled" + TypeChatEventIsAllHistoryAvailableToggled = "chatEventIsAllHistoryAvailableToggled" + TypeChatEventHasAggressiveAntiSpamEnabledToggled = "chatEventHasAggressiveAntiSpamEnabledToggled" + TypeChatEventSignMessagesToggled = "chatEventSignMessagesToggled" + TypeChatEventInviteLinkEdited = "chatEventInviteLinkEdited" + TypeChatEventInviteLinkRevoked = "chatEventInviteLinkRevoked" + TypeChatEventInviteLinkDeleted = "chatEventInviteLinkDeleted" + TypeChatEventVideoChatCreated = "chatEventVideoChatCreated" + TypeChatEventVideoChatEnded = "chatEventVideoChatEnded" + TypeChatEventVideoChatMuteNewParticipantsToggled = "chatEventVideoChatMuteNewParticipantsToggled" + TypeChatEventVideoChatParticipantIsMutedToggled = "chatEventVideoChatParticipantIsMutedToggled" + TypeChatEventVideoChatParticipantVolumeLevelChanged = "chatEventVideoChatParticipantVolumeLevelChanged" + TypeChatEventIsForumToggled = "chatEventIsForumToggled" + TypeChatEventForumTopicCreated = "chatEventForumTopicCreated" + TypeChatEventForumTopicEdited = "chatEventForumTopicEdited" + TypeChatEventForumTopicToggleIsClosed = "chatEventForumTopicToggleIsClosed" + TypeChatEventForumTopicToggleIsHidden = "chatEventForumTopicToggleIsHidden" + TypeChatEventForumTopicDeleted = "chatEventForumTopicDeleted" + TypeChatEventForumTopicPinned = "chatEventForumTopicPinned" + TypeChatEvent = "chatEvent" + TypeChatEvents = "chatEvents" + TypeChatEventLogFilters = "chatEventLogFilters" + TypeLanguagePackStringValueOrdinary = "languagePackStringValueOrdinary" + TypeLanguagePackStringValuePluralized = "languagePackStringValuePluralized" + TypeLanguagePackStringValueDeleted = "languagePackStringValueDeleted" + TypeLanguagePackString = "languagePackString" + TypeLanguagePackStrings = "languagePackStrings" + TypeLanguagePackInfo = "languagePackInfo" + TypeLocalizationTargetInfo = "localizationTargetInfo" + TypePremiumLimitTypeSupergroupCount = "premiumLimitTypeSupergroupCount" + TypePremiumLimitTypePinnedChatCount = "premiumLimitTypePinnedChatCount" + TypePremiumLimitTypeCreatedPublicChatCount = "premiumLimitTypeCreatedPublicChatCount" + TypePremiumLimitTypeSavedAnimationCount = "premiumLimitTypeSavedAnimationCount" + TypePremiumLimitTypeFavoriteStickerCount = "premiumLimitTypeFavoriteStickerCount" + TypePremiumLimitTypeChatFolderCount = "premiumLimitTypeChatFolderCount" + TypePremiumLimitTypeChatFolderChosenChatCount = "premiumLimitTypeChatFolderChosenChatCount" + TypePremiumLimitTypePinnedArchivedChatCount = "premiumLimitTypePinnedArchivedChatCount" + TypePremiumLimitTypePinnedSavedMessagesTopicCount = "premiumLimitTypePinnedSavedMessagesTopicCount" + TypePremiumLimitTypeCaptionLength = "premiumLimitTypeCaptionLength" + TypePremiumLimitTypeBioLength = "premiumLimitTypeBioLength" + TypePremiumLimitTypeChatFolderInviteLinkCount = "premiumLimitTypeChatFolderInviteLinkCount" + TypePremiumLimitTypeShareableChatFolderCount = "premiumLimitTypeShareableChatFolderCount" + TypePremiumLimitTypeActiveStoryCount = "premiumLimitTypeActiveStoryCount" + TypePremiumLimitTypeWeeklySentStoryCount = "premiumLimitTypeWeeklySentStoryCount" + TypePremiumLimitTypeMonthlySentStoryCount = "premiumLimitTypeMonthlySentStoryCount" + TypePremiumLimitTypeStoryCaptionLength = "premiumLimitTypeStoryCaptionLength" + TypePremiumLimitTypeStorySuggestedReactionAreaCount = "premiumLimitTypeStorySuggestedReactionAreaCount" + TypePremiumLimitTypeSimilarChatCount = "premiumLimitTypeSimilarChatCount" + TypePremiumFeatureIncreasedLimits = "premiumFeatureIncreasedLimits" + TypePremiumFeatureIncreasedUploadFileSize = "premiumFeatureIncreasedUploadFileSize" + TypePremiumFeatureImprovedDownloadSpeed = "premiumFeatureImprovedDownloadSpeed" + TypePremiumFeatureVoiceRecognition = "premiumFeatureVoiceRecognition" + TypePremiumFeatureDisabledAds = "premiumFeatureDisabledAds" + TypePremiumFeatureUniqueReactions = "premiumFeatureUniqueReactions" + TypePremiumFeatureUniqueStickers = "premiumFeatureUniqueStickers" + TypePremiumFeatureCustomEmoji = "premiumFeatureCustomEmoji" + TypePremiumFeatureAdvancedChatManagement = "premiumFeatureAdvancedChatManagement" + TypePremiumFeatureProfileBadge = "premiumFeatureProfileBadge" + TypePremiumFeatureEmojiStatus = "premiumFeatureEmojiStatus" + TypePremiumFeatureAnimatedProfilePhoto = "premiumFeatureAnimatedProfilePhoto" + TypePremiumFeatureForumTopicIcon = "premiumFeatureForumTopicIcon" + TypePremiumFeatureAppIcons = "premiumFeatureAppIcons" + TypePremiumFeatureRealTimeChatTranslation = "premiumFeatureRealTimeChatTranslation" + TypePremiumFeatureUpgradedStories = "premiumFeatureUpgradedStories" + TypePremiumFeatureChatBoost = "premiumFeatureChatBoost" + TypePremiumFeatureAccentColor = "premiumFeatureAccentColor" + TypePremiumFeatureBackgroundForBoth = "premiumFeatureBackgroundForBoth" + TypePremiumFeatureSavedMessagesTags = "premiumFeatureSavedMessagesTags" + TypePremiumFeatureMessagePrivacy = "premiumFeatureMessagePrivacy" + TypePremiumFeatureLastSeenTimes = "premiumFeatureLastSeenTimes" + TypePremiumFeatureBusiness = "premiumFeatureBusiness" + TypeBusinessFeatureLocation = "businessFeatureLocation" + TypeBusinessFeatureOpeningHours = "businessFeatureOpeningHours" + TypeBusinessFeatureQuickReplies = "businessFeatureQuickReplies" + TypeBusinessFeatureGreetingMessage = "businessFeatureGreetingMessage" + TypeBusinessFeatureAwayMessage = "businessFeatureAwayMessage" + TypeBusinessFeatureAccountLinks = "businessFeatureAccountLinks" + TypeBusinessFeatureIntro = "businessFeatureIntro" + 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" + TypeStorePaymentPurposePremiumGiftCodes = "storePaymentPurposePremiumGiftCodes" + TypeStorePaymentPurposePremiumGiveaway = "storePaymentPurposePremiumGiveaway" + TypeTelegramPaymentPurposePremiumGiftCodes = "telegramPaymentPurposePremiumGiftCodes" + TypeTelegramPaymentPurposePremiumGiveaway = "telegramPaymentPurposePremiumGiveaway" + Type//-To = "//-To" + TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging" + TypeDeviceTokenApplePush = "deviceTokenApplePush" + TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" + TypeDeviceTokenWindowsPush = "deviceTokenWindowsPush" + TypeDeviceTokenMicrosoftPush = "deviceTokenMicrosoftPush" + TypeDeviceTokenMicrosoftPushVoIP = "deviceTokenMicrosoftPushVoIP" + TypeDeviceTokenWebPush = "deviceTokenWebPush" + TypeDeviceTokenSimplePush = "deviceTokenSimplePush" + TypeDeviceTokenUbuntuPush = "deviceTokenUbuntuPush" + TypeDeviceTokenBlackBerryPush = "deviceTokenBlackBerryPush" + TypeDeviceTokenTizenPush = "deviceTokenTizenPush" + TypeDeviceTokenHuaweiPush = "deviceTokenHuaweiPush" + TypePushReceiverId = "pushReceiverId" + TypeBackgroundFillSolid = "backgroundFillSolid" + TypeBackgroundFillGradient = "backgroundFillGradient" + TypeBackgroundFillFreeformGradient = "backgroundFillFreeformGradient" + TypeBackgroundTypeWallpaper = "backgroundTypeWallpaper" + TypeBackgroundTypePattern = "backgroundTypePattern" + TypeBackgroundTypeFill = "backgroundTypeFill" + TypeBackgroundTypeChatTheme = "backgroundTypeChatTheme" + TypeInputBackgroundLocal = "inputBackgroundLocal" + TypeInputBackgroundRemote = "inputBackgroundRemote" + TypeInputBackgroundPrevious = "inputBackgroundPrevious" + TypeThemeSettings = "themeSettings" + TypeChatTheme = "chatTheme" + TypeTimeZone = "timeZone" + TypeTimeZones = "timeZones" + TypeHashtags = "hashtags" + TypeCanSendStoryResultOk = "canSendStoryResultOk" + TypeCanSendStoryResultPremiumNeeded = "canSendStoryResultPremiumNeeded" + TypeCanSendStoryResultBoostNeeded = "canSendStoryResultBoostNeeded" + TypeCanSendStoryResultActiveStoryLimitExceeded = "canSendStoryResultActiveStoryLimitExceeded" + TypeCanSendStoryResultWeeklyLimitExceeded = "canSendStoryResultWeeklyLimitExceeded" + TypeCanSendStoryResultMonthlyLimitExceeded = "canSendStoryResultMonthlyLimitExceeded" + TypeCanTransferOwnershipResultOk = "canTransferOwnershipResultOk" + TypeCanTransferOwnershipResultPasswordNeeded = "canTransferOwnershipResultPasswordNeeded" + TypeCanTransferOwnershipResultPasswordTooFresh = "canTransferOwnershipResultPasswordTooFresh" + TypeCanTransferOwnershipResultSessionTooFresh = "canTransferOwnershipResultSessionTooFresh" + TypeCheckChatUsernameResultOk = "checkChatUsernameResultOk" + TypeCheckChatUsernameResultUsernameInvalid = "checkChatUsernameResultUsernameInvalid" + TypeCheckChatUsernameResultUsernameOccupied = "checkChatUsernameResultUsernameOccupied" + TypeCheckChatUsernameResultUsernamePurchasable = "checkChatUsernameResultUsernamePurchasable" + TypeCheckChatUsernameResultPublicChatsTooMany = "checkChatUsernameResultPublicChatsTooMany" + TypeCheckChatUsernameResultPublicGroupsUnavailable = "checkChatUsernameResultPublicGroupsUnavailable" + TypeCheckStickerSetNameResultOk = "checkStickerSetNameResultOk" + TypeCheckStickerSetNameResultNameInvalid = "checkStickerSetNameResultNameInvalid" + TypeCheckStickerSetNameResultNameOccupied = "checkStickerSetNameResultNameOccupied" + TypeResetPasswordResultOk = "resetPasswordResultOk" + TypeResetPasswordResultPending = "resetPasswordResultPending" + TypeResetPasswordResultDeclined = "resetPasswordResultDeclined" + TypeMessageFileTypePrivate = "messageFileTypePrivate" + TypeMessageFileTypeGroup = "messageFileTypeGroup" + TypeMessageFileTypeUnknown = "messageFileTypeUnknown" + TypePushMessageContentHidden = "pushMessageContentHidden" + TypePushMessageContentAnimation = "pushMessageContentAnimation" + TypePushMessageContentAudio = "pushMessageContentAudio" + TypePushMessageContentContact = "pushMessageContentContact" + TypePushMessageContentContactRegistered = "pushMessageContentContactRegistered" + TypePushMessageContentDocument = "pushMessageContentDocument" + TypePushMessageContentGame = "pushMessageContentGame" + TypePushMessageContentGameScore = "pushMessageContentGameScore" + TypePushMessageContentInvoice = "pushMessageContentInvoice" + TypePushMessageContentLocation = "pushMessageContentLocation" + TypePushMessageContentPhoto = "pushMessageContentPhoto" + TypePushMessageContentPoll = "pushMessageContentPoll" + TypePushMessageContentPremiumGiftCode = "pushMessageContentPremiumGiftCode" + TypePushMessageContentPremiumGiveaway = "pushMessageContentPremiumGiveaway" + TypePushMessageContentScreenshotTaken = "pushMessageContentScreenshotTaken" + TypePushMessageContentSticker = "pushMessageContentSticker" + TypePushMessageContentStory = "pushMessageContentStory" + TypePushMessageContentText = "pushMessageContentText" + TypePushMessageContentVideo = "pushMessageContentVideo" + TypePushMessageContentVideoNote = "pushMessageContentVideoNote" + TypePushMessageContentVoiceNote = "pushMessageContentVoiceNote" + TypePushMessageContentBasicGroupChatCreate = "pushMessageContentBasicGroupChatCreate" + TypePushMessageContentChatAddMembers = "pushMessageContentChatAddMembers" + TypePushMessageContentChatChangePhoto = "pushMessageContentChatChangePhoto" + TypePushMessageContentChatChangeTitle = "pushMessageContentChatChangeTitle" + TypePushMessageContentChatSetBackground = "pushMessageContentChatSetBackground" + TypePushMessageContentChatSetTheme = "pushMessageContentChatSetTheme" + TypePushMessageContentChatDeleteMember = "pushMessageContentChatDeleteMember" + TypePushMessageContentChatJoinByLink = "pushMessageContentChatJoinByLink" + TypePushMessageContentChatJoinByRequest = "pushMessageContentChatJoinByRequest" + TypePushMessageContentRecurringPayment = "pushMessageContentRecurringPayment" + TypePushMessageContentSuggestProfilePhoto = "pushMessageContentSuggestProfilePhoto" + TypePushMessageContentMessageForwards = "pushMessageContentMessageForwards" + TypePushMessageContentMediaAlbum = "pushMessageContentMediaAlbum" + TypeNotificationTypeNewMessage = "notificationTypeNewMessage" + TypeNotificationTypeNewSecretChat = "notificationTypeNewSecretChat" + TypeNotificationTypeNewCall = "notificationTypeNewCall" + TypeNotificationTypeNewPushMessage = "notificationTypeNewPushMessage" + TypeNotificationGroupTypeMessages = "notificationGroupTypeMessages" + TypeNotificationGroupTypeMentions = "notificationGroupTypeMentions" + TypeNotificationGroupTypeSecretChat = "notificationGroupTypeSecretChat" + TypeNotificationGroupTypeCalls = "notificationGroupTypeCalls" + TypeNotificationSound = "notificationSound" + TypeNotificationSounds = "notificationSounds" + TypeNotification = "notification" + TypeNotificationGroup = "notificationGroup" + TypeOptionValueBoolean = "optionValueBoolean" + TypeOptionValueEmpty = "optionValueEmpty" + TypeOptionValueInteger = "optionValueInteger" + TypeOptionValueString = "optionValueString" + TypeJsonObjectMember = "jsonObjectMember" + TypeJsonValueNull = "jsonValueNull" + TypeJsonValueBoolean = "jsonValueBoolean" + TypeJsonValueNumber = "jsonValueNumber" + TypeJsonValueString = "jsonValueString" + TypeJsonValueArray = "jsonValueArray" + TypeJsonValueObject = "jsonValueObject" + TypeStoryPrivacySettingsEveryone = "storyPrivacySettingsEveryone" + TypeStoryPrivacySettingsContacts = "storyPrivacySettingsContacts" + TypeStoryPrivacySettingsCloseFriends = "storyPrivacySettingsCloseFriends" + TypeStoryPrivacySettingsSelectedUsers = "storyPrivacySettingsSelectedUsers" + TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" + TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" + TypeUserPrivacySettingRuleAllowPremiumUsers = "userPrivacySettingRuleAllowPremiumUsers" + TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" + TypeUserPrivacySettingRuleAllowChatMembers = "userPrivacySettingRuleAllowChatMembers" + TypeUserPrivacySettingRuleRestrictAll = "userPrivacySettingRuleRestrictAll" + TypeUserPrivacySettingRuleRestrictContacts = "userPrivacySettingRuleRestrictContacts" + TypeUserPrivacySettingRuleRestrictUsers = "userPrivacySettingRuleRestrictUsers" + TypeUserPrivacySettingRuleRestrictChatMembers = "userPrivacySettingRuleRestrictChatMembers" + TypeUserPrivacySettingRules = "userPrivacySettingRules" + TypeUserPrivacySettingShowStatus = "userPrivacySettingShowStatus" + TypeUserPrivacySettingShowProfilePhoto = "userPrivacySettingShowProfilePhoto" + TypeUserPrivacySettingShowLinkInForwardedMessages = "userPrivacySettingShowLinkInForwardedMessages" + TypeUserPrivacySettingShowPhoneNumber = "userPrivacySettingShowPhoneNumber" + TypeUserPrivacySettingShowBio = "userPrivacySettingShowBio" + TypeUserPrivacySettingShowBirthdate = "userPrivacySettingShowBirthdate" + TypeUserPrivacySettingAllowChatInvites = "userPrivacySettingAllowChatInvites" + TypeUserPrivacySettingAllowCalls = "userPrivacySettingAllowCalls" + TypeUserPrivacySettingAllowPeerToPeerCalls = "userPrivacySettingAllowPeerToPeerCalls" + TypeUserPrivacySettingAllowFindingByPhoneNumber = "userPrivacySettingAllowFindingByPhoneNumber" + TypeUserPrivacySettingAllowPrivateVoiceAndVideoNoteMessages = "userPrivacySettingAllowPrivateVoiceAndVideoNoteMessages" + TypeReadDatePrivacySettings = "readDatePrivacySettings" + TypeNewChatPrivacySettings = "newChatPrivacySettings" + TypeCanSendMessageToUserResultOk = "canSendMessageToUserResultOk" + TypeCanSendMessageToUserResultUserIsDeleted = "canSendMessageToUserResultUserIsDeleted" + TypeCanSendMessageToUserResultUserRestrictsNewChats = "canSendMessageToUserResultUserRestrictsNewChats" + TypeAccountTtl = "accountTtl" + TypeMessageAutoDeleteTime = "messageAutoDeleteTime" + TypeSessionTypeAndroid = "sessionTypeAndroid" + TypeSessionTypeApple = "sessionTypeApple" + TypeSessionTypeBrave = "sessionTypeBrave" + TypeSessionTypeChrome = "sessionTypeChrome" + TypeSessionTypeEdge = "sessionTypeEdge" + TypeSessionTypeFirefox = "sessionTypeFirefox" + TypeSessionTypeIpad = "sessionTypeIpad" + TypeSessionTypeIphone = "sessionTypeIphone" + TypeSessionTypeLinux = "sessionTypeLinux" + TypeSessionTypeMac = "sessionTypeMac" + TypeSessionTypeOpera = "sessionTypeOpera" + TypeSessionTypeSafari = "sessionTypeSafari" + TypeSessionTypeUbuntu = "sessionTypeUbuntu" + TypeSessionTypeUnknown = "sessionTypeUnknown" + TypeSessionTypeVivaldi = "sessionTypeVivaldi" + TypeSessionTypeWindows = "sessionTypeWindows" + TypeSessionTypeXbox = "sessionTypeXbox" + TypeSession = "session" + TypeSessions = "sessions" + TypeUnconfirmedSession = "unconfirmedSession" + TypeConnectedWebsite = "connectedWebsite" + TypeConnectedWebsites = "connectedWebsites" + TypeReportReasonSpam = "reportReasonSpam" + TypeReportReasonViolence = "reportReasonViolence" + TypeReportReasonPornography = "reportReasonPornography" + TypeReportReasonChildAbuse = "reportReasonChildAbuse" + TypeReportReasonCopyright = "reportReasonCopyright" + TypeReportReasonUnrelatedLocation = "reportReasonUnrelatedLocation" + TypeReportReasonFake = "reportReasonFake" + TypeReportReasonIllegalDrugs = "reportReasonIllegalDrugs" + TypeReportReasonPersonalDetails = "reportReasonPersonalDetails" + TypeReportReasonCustom = "reportReasonCustom" + TypeTargetChatCurrent = "targetChatCurrent" + TypeTargetChatChosen = "targetChatChosen" + TypeTargetChatInternalLink = "targetChatInternalLink" + TypeInternalLinkTypeActiveSessions = "internalLinkTypeActiveSessions" + TypeInternalLinkTypeAttachmentMenuBot = "internalLinkTypeAttachmentMenuBot" + TypeInternalLinkTypeAuthenticationCode = "internalLinkTypeAuthenticationCode" + TypeInternalLinkTypeBackground = "internalLinkTypeBackground" + TypeInternalLinkTypeBotAddToChannel = "internalLinkTypeBotAddToChannel" + TypeInternalLinkTypeBotStart = "internalLinkTypeBotStart" + TypeInternalLinkTypeBotStartInGroup = "internalLinkTypeBotStartInGroup" + TypeInternalLinkTypeChangePhoneNumber = "internalLinkTypeChangePhoneNumber" + TypeInternalLinkTypeChatBoost = "internalLinkTypeChatBoost" + TypeInternalLinkTypeChatFolderInvite = "internalLinkTypeChatFolderInvite" + TypeInternalLinkTypeChatFolderSettings = "internalLinkTypeChatFolderSettings" + TypeInternalLinkTypeChatInvite = "internalLinkTypeChatInvite" + TypeInternalLinkTypeDefaultMessageAutoDeleteTimerSettings = "internalLinkTypeDefaultMessageAutoDeleteTimerSettings" + TypeInternalLinkTypeEditProfileSettings = "internalLinkTypeEditProfileSettings" + TypeInternalLinkTypeGame = "internalLinkTypeGame" + TypeInternalLinkTypeInstantView = "internalLinkTypeInstantView" + TypeInternalLinkTypeInvoice = "internalLinkTypeInvoice" + TypeInternalLinkTypeLanguagePack = "internalLinkTypeLanguagePack" + TypeInternalLinkTypeLanguageSettings = "internalLinkTypeLanguageSettings" + TypeInternalLinkTypeMessage = "internalLinkTypeMessage" + TypeInternalLinkTypeMessageDraft = "internalLinkTypeMessageDraft" + TypeInternalLinkTypePassportDataRequest = "internalLinkTypePassportDataRequest" + TypeInternalLinkTypePhoneNumberConfirmation = "internalLinkTypePhoneNumberConfirmation" + TypeInternalLinkTypePremiumFeatures = "internalLinkTypePremiumFeatures" + TypeInternalLinkTypePremiumGift = "internalLinkTypePremiumGift" + TypeInternalLinkTypePremiumGiftCode = "internalLinkTypePremiumGiftCode" + TypeInternalLinkTypePrivacyAndSecuritySettings = "internalLinkTypePrivacyAndSecuritySettings" + TypeInternalLinkTypeProxy = "internalLinkTypeProxy" + TypeInternalLinkTypePublicChat = "internalLinkTypePublicChat" + TypeInternalLinkTypeQrCodeAuthentication = "internalLinkTypeQrCodeAuthentication" + TypeInternalLinkTypeRestorePurchases = "internalLinkTypeRestorePurchases" + TypeInternalLinkTypeSettings = "internalLinkTypeSettings" + TypeInternalLinkTypeSideMenuBot = "internalLinkTypeSideMenuBot" + TypeInternalLinkTypeStickerSet = "internalLinkTypeStickerSet" + TypeInternalLinkTypeStory = "internalLinkTypeStory" + TypeInternalLinkTypeTheme = "internalLinkTypeTheme" + TypeInternalLinkTypeThemeSettings = "internalLinkTypeThemeSettings" + TypeInternalLinkTypeUnknownDeepLink = "internalLinkTypeUnknownDeepLink" + TypeInternalLinkTypeUnsupportedProxy = "internalLinkTypeUnsupportedProxy" + TypeInternalLinkTypeUserPhoneNumber = "internalLinkTypeUserPhoneNumber" + TypeInternalLinkTypeUserToken = "internalLinkTypeUserToken" + TypeInternalLinkTypeVideoChat = "internalLinkTypeVideoChat" + TypeInternalLinkTypeWebApp = "internalLinkTypeWebApp" + TypeMessageLink = "messageLink" + TypeMessageLinkInfo = "messageLinkInfo" + TypeChatBoostLink = "chatBoostLink" + TypeChatBoostLinkInfo = "chatBoostLinkInfo" + TypeBlockListMain = "blockListMain" + TypeBlockListStories = "blockListStories" + TypeFilePart = "filePart" + TypeFileTypeNone = "fileTypeNone" + TypeFileTypeAnimation = "fileTypeAnimation" + TypeFileTypeAudio = "fileTypeAudio" + TypeFileTypeDocument = "fileTypeDocument" + TypeFileTypeNotificationSound = "fileTypeNotificationSound" + TypeFileTypePhoto = "fileTypePhoto" + TypeFileTypePhotoStory = "fileTypePhotoStory" + TypeFileTypeProfilePhoto = "fileTypeProfilePhoto" + TypeFileTypeSecret = "fileTypeSecret" + TypeFileTypeSecretThumbnail = "fileTypeSecretThumbnail" + TypeFileTypeSecure = "fileTypeSecure" + TypeFileTypeSticker = "fileTypeSticker" + TypeFileTypeThumbnail = "fileTypeThumbnail" + TypeFileTypeUnknown = "fileTypeUnknown" + TypeFileTypeVideo = "fileTypeVideo" + TypeFileTypeVideoNote = "fileTypeVideoNote" + TypeFileTypeVideoStory = "fileTypeVideoStory" + TypeFileTypeVoiceNote = "fileTypeVoiceNote" + TypeFileTypeWallpaper = "fileTypeWallpaper" + TypeStorageStatisticsByFileType = "storageStatisticsByFileType" + TypeStorageStatisticsByChat = "storageStatisticsByChat" + TypeStorageStatistics = "storageStatistics" + TypeStorageStatisticsFast = "storageStatisticsFast" + TypeDatabaseStatistics = "databaseStatistics" + TypeNetworkTypeNone = "networkTypeNone" + TypeNetworkTypeMobile = "networkTypeMobile" + TypeNetworkTypeMobileRoaming = "networkTypeMobileRoaming" + TypeNetworkTypeWiFi = "networkTypeWiFi" + TypeNetworkTypeOther = "networkTypeOther" + TypeNetworkStatisticsEntryFile = "networkStatisticsEntryFile" + TypeNetworkStatisticsEntryCall = "networkStatisticsEntryCall" + TypeNetworkStatistics = "networkStatistics" + TypeAutoDownloadSettings = "autoDownloadSettings" + TypeAutoDownloadSettingsPresets = "autoDownloadSettingsPresets" + TypeAutosaveSettingsScopePrivateChats = "autosaveSettingsScopePrivateChats" + TypeAutosaveSettingsScopeGroupChats = "autosaveSettingsScopeGroupChats" + TypeAutosaveSettingsScopeChannelChats = "autosaveSettingsScopeChannelChats" + TypeAutosaveSettingsScopeChat = "autosaveSettingsScopeChat" + TypeScopeAutosaveSettings = "scopeAutosaveSettings" + TypeAutosaveSettingsException = "autosaveSettingsException" + TypeAutosaveSettings = "autosaveSettings" + TypeConnectionStateWaitingForNetwork = "connectionStateWaitingForNetwork" + TypeConnectionStateConnectingToProxy = "connectionStateConnectingToProxy" + TypeConnectionStateConnecting = "connectionStateConnecting" + TypeConnectionStateUpdating = "connectionStateUpdating" + TypeConnectionStateReady = "connectionStateReady" + TypeTopChatCategoryUsers = "topChatCategoryUsers" + TypeTopChatCategoryBots = "topChatCategoryBots" + TypeTopChatCategoryGroups = "topChatCategoryGroups" + TypeTopChatCategoryChannels = "topChatCategoryChannels" + TypeTopChatCategoryInlineBots = "topChatCategoryInlineBots" + TypeTopChatCategoryCalls = "topChatCategoryCalls" + TypeTopChatCategoryForwardChats = "topChatCategoryForwardChats" + TypeFoundPosition = "foundPosition" + TypeFoundPositions = "foundPositions" + TypeTMeUrlTypeUser = "tMeUrlTypeUser" + TypeTMeUrlTypeSupergroup = "tMeUrlTypeSupergroup" + TypeTMeUrlTypeChatInvite = "tMeUrlTypeChatInvite" + TypeTMeUrlTypeStickerSet = "tMeUrlTypeStickerSet" + TypeTMeUrl = "tMeUrl" + TypeTMeUrls = "tMeUrls" + TypeSuggestedActionEnableArchiveAndMuteNewChats = "suggestedActionEnableArchiveAndMuteNewChats" + TypeSuggestedActionCheckPassword = "suggestedActionCheckPassword" + TypeSuggestedActionCheckPhoneNumber = "suggestedActionCheckPhoneNumber" + TypeSuggestedActionViewChecksHint = "suggestedActionViewChecksHint" + TypeSuggestedActionConvertToBroadcastGroup = "suggestedActionConvertToBroadcastGroup" + TypeSuggestedActionSetPassword = "suggestedActionSetPassword" + TypeSuggestedActionUpgradePremium = "suggestedActionUpgradePremium" + TypeSuggestedActionRestorePremium = "suggestedActionRestorePremium" + TypeSuggestedActionSubscribeToAnnualPremium = "suggestedActionSubscribeToAnnualPremium" + TypeSuggestedActionGiftPremiumForChristmas = "suggestedActionGiftPremiumForChristmas" + TypeSuggestedActionSetBirthdate = "suggestedActionSetBirthdate" + TypeCount = "count" + TypeText = "text" + TypeSeconds = "seconds" + TypeFileDownloadedPrefixSize = "fileDownloadedPrefixSize" + TypeDeepLinkInfo = "deepLinkInfo" + TypeTextParseModeMarkdown = "textParseModeMarkdown" + TypeTextParseModeHTML = "textParseModeHTML" + TypeProxyTypeSocks5 = "proxyTypeSocks5" + TypeProxyTypeHttp = "proxyTypeHttp" + TypeProxyTypeMtproto = "proxyTypeMtproto" + TypeProxy = "proxy" + TypeProxies = "proxies" + TypeInputSticker = "inputSticker" + TypeDateRange = "dateRange" + TypeStatisticalValue = "statisticalValue" + TypeStatisticalGraphData = "statisticalGraphData" + TypeStatisticalGraphAsync = "statisticalGraphAsync" + TypeStatisticalGraphError = "statisticalGraphError" + TypeChatStatisticsObjectTypeMessage = "chatStatisticsObjectTypeMessage" + TypeChatStatisticsObjectTypeStory = "chatStatisticsObjectTypeStory" + TypeChatStatisticsInteractionInfo = "chatStatisticsInteractionInfo" + TypeChatStatisticsMessageSenderInfo = "chatStatisticsMessageSenderInfo" + TypeChatStatisticsAdministratorActionsInfo = "chatStatisticsAdministratorActionsInfo" + TypeChatStatisticsInviterInfo = "chatStatisticsInviterInfo" + TypeChatStatisticsSupergroup = "chatStatisticsSupergroup" + TypeChatStatisticsChannel = "chatStatisticsChannel" + TypeMessageStatistics = "messageStatistics" + TypeStoryStatistics = "storyStatistics" + TypePoint = "point" + TypeVectorPathCommandLine = "vectorPathCommandLine" + TypeVectorPathCommandCubicBezierCurve = "vectorPathCommandCubicBezierCurve" + TypeBotCommandScopeDefault = "botCommandScopeDefault" + TypeBotCommandScopeAllPrivateChats = "botCommandScopeAllPrivateChats" + TypeBotCommandScopeAllGroupChats = "botCommandScopeAllGroupChats" + TypeBotCommandScopeAllChatAdministrators = "botCommandScopeAllChatAdministrators" + TypeBotCommandScopeChat = "botCommandScopeChat" + TypeBotCommandScopeChatAdministrators = "botCommandScopeChatAdministrators" + TypeBotCommandScopeChatMember = "botCommandScopeChatMember" + TypeUpdateAuthorizationState = "updateAuthorizationState" + TypeUpdateNewMessage = "updateNewMessage" + TypeUpdateMessageSendAcknowledged = "updateMessageSendAcknowledged" + TypeUpdateMessageSendSucceeded = "updateMessageSendSucceeded" + TypeUpdateMessageSendFailed = "updateMessageSendFailed" + TypeUpdateMessageContent = "updateMessageContent" + TypeUpdateMessageEdited = "updateMessageEdited" + TypeUpdateMessageIsPinned = "updateMessageIsPinned" + TypeUpdateMessageInteractionInfo = "updateMessageInteractionInfo" + TypeUpdateMessageContentOpened = "updateMessageContentOpened" + TypeUpdateMessageMentionRead = "updateMessageMentionRead" + TypeUpdateMessageUnreadReactions = "updateMessageUnreadReactions" + TypeUpdateMessageLiveLocationViewed = "updateMessageLiveLocationViewed" + TypeUpdateNewChat = "updateNewChat" + TypeUpdateChatTitle = "updateChatTitle" + TypeUpdateChatPhoto = "updateChatPhoto" + TypeUpdateChatAccentColors = "updateChatAccentColors" + TypeUpdateChatPermissions = "updateChatPermissions" + TypeUpdateChatLastMessage = "updateChatLastMessage" + TypeUpdateChatPosition = "updateChatPosition" + TypeUpdateChatAddedToList = "updateChatAddedToList" + TypeUpdateChatRemovedFromList = "updateChatRemovedFromList" + TypeUpdateChatReadInbox = "updateChatReadInbox" + TypeUpdateChatReadOutbox = "updateChatReadOutbox" + TypeUpdateChatActionBar = "updateChatActionBar" + TypeUpdateChatAvailableReactions = "updateChatAvailableReactions" + TypeUpdateChatDraftMessage = "updateChatDraftMessage" + TypeUpdateChatEmojiStatus = "updateChatEmojiStatus" + TypeUpdateChatMessageSender = "updateChatMessageSender" + TypeUpdateChatMessageAutoDeleteTime = "updateChatMessageAutoDeleteTime" + TypeUpdateChatNotificationSettings = "updateChatNotificationSettings" + TypeUpdateChatPendingJoinRequests = "updateChatPendingJoinRequests" + TypeUpdateChatReplyMarkup = "updateChatReplyMarkup" + TypeUpdateChatBackground = "updateChatBackground" + TypeUpdateChatTheme = "updateChatTheme" + TypeUpdateChatUnreadMentionCount = "updateChatUnreadMentionCount" + TypeUpdateChatUnreadReactionCount = "updateChatUnreadReactionCount" + TypeUpdateChatVideoChat = "updateChatVideoChat" + TypeUpdateChatDefaultDisableNotification = "updateChatDefaultDisableNotification" + TypeUpdateChatHasProtectedContent = "updateChatHasProtectedContent" + TypeUpdateChatIsTranslatable = "updateChatIsTranslatable" + TypeUpdateChatIsMarkedAsUnread = "updateChatIsMarkedAsUnread" + TypeUpdateChatViewAsTopics = "updateChatViewAsTopics" + TypeUpdateChatBlockList = "updateChatBlockList" + TypeUpdateChatHasScheduledMessages = "updateChatHasScheduledMessages" + TypeUpdateChatFolders = "updateChatFolders" + TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" + TypeUpdateSavedMessagesTopic = "updateSavedMessagesTopic" + TypeUpdateSavedMessagesTopicCount = "updateSavedMessagesTopicCount" + TypeUpdateQuickReplyShortcut = "updateQuickReplyShortcut" + TypeUpdateQuickReplyShortcutDeleted = "updateQuickReplyShortcutDeleted" + TypeUpdateQuickReplyShortcuts = "updateQuickReplyShortcuts" + TypeUpdateQuickReplyShortcutMessages = "updateQuickReplyShortcutMessages" + TypeUpdateForumTopicInfo = "updateForumTopicInfo" + TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" + TypeUpdateNotification = "updateNotification" + TypeUpdateNotificationGroup = "updateNotificationGroup" + TypeUpdateActiveNotifications = "updateActiveNotifications" + TypeUpdateHavePendingNotifications = "updateHavePendingNotifications" + TypeUpdateDeleteMessages = "updateDeleteMessages" + TypeUpdateChatAction = "updateChatAction" + TypeUpdateUserStatus = "updateUserStatus" + TypeUpdateUser = "updateUser" + TypeUpdateBasicGroup = "updateBasicGroup" + TypeUpdateSupergroup = "updateSupergroup" + TypeUpdateSecretChat = "updateSecretChat" + TypeUpdateUserFullInfo = "updateUserFullInfo" + TypeUpdateBasicGroupFullInfo = "updateBasicGroupFullInfo" + TypeUpdateSupergroupFullInfo = "updateSupergroupFullInfo" + TypeUpdateServiceNotification = "updateServiceNotification" + TypeUpdateFile = "updateFile" + TypeUpdateFileGenerationStart = "updateFileGenerationStart" + TypeUpdateFileGenerationStop = "updateFileGenerationStop" + TypeUpdateFileDownloads = "updateFileDownloads" + TypeUpdateFileAddedToDownloads = "updateFileAddedToDownloads" + TypeUpdateFileDownload = "updateFileDownload" + TypeUpdateFileRemovedFromDownloads = "updateFileRemovedFromDownloads" + TypeUpdateCall = "updateCall" + TypeUpdateGroupCall = "updateGroupCall" + TypeUpdateGroupCallParticipant = "updateGroupCallParticipant" + TypeUpdateNewCallSignalingData = "updateNewCallSignalingData" + TypeUpdateUserPrivacySettingRules = "updateUserPrivacySettingRules" + TypeUpdateUnreadMessageCount = "updateUnreadMessageCount" + TypeUpdateUnreadChatCount = "updateUnreadChatCount" + TypeUpdateStory = "updateStory" + TypeUpdateStoryDeleted = "updateStoryDeleted" + TypeUpdateStorySendSucceeded = "updateStorySendSucceeded" + TypeUpdateStorySendFailed = "updateStorySendFailed" + TypeUpdateChatActiveStories = "updateChatActiveStories" + TypeUpdateStoryListChatCount = "updateStoryListChatCount" + TypeUpdateStoryStealthMode = "updateStoryStealthMode" + TypeUpdateOption = "updateOption" + TypeUpdateStickerSet = "updateStickerSet" + TypeUpdateInstalledStickerSets = "updateInstalledStickerSets" + TypeUpdateTrendingStickerSets = "updateTrendingStickerSets" + TypeUpdateRecentStickers = "updateRecentStickers" + TypeUpdateFavoriteStickers = "updateFavoriteStickers" + TypeUpdateSavedAnimations = "updateSavedAnimations" + TypeUpdateSavedNotificationSounds = "updateSavedNotificationSounds" + TypeUpdateDefaultBackground = "updateDefaultBackground" + TypeUpdateChatThemes = "updateChatThemes" + TypeUpdateAccentColors = "updateAccentColors" + TypeUpdateProfileAccentColors = "updateProfileAccentColors" + TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" + TypeUpdateConnectionState = "updateConnectionState" + TypeUpdateTermsOfService = "updateTermsOfService" + TypeUpdateUsersNearby = "updateUsersNearby" + TypeUpdateUnconfirmedSession = "updateUnconfirmedSession" + TypeUpdateAttachmentMenuBots = "updateAttachmentMenuBots" + TypeUpdateWebAppMessageSent = "updateWebAppMessageSent" + TypeUpdateActiveEmojiReactions = "updateActiveEmojiReactions" + TypeUpdateDefaultReactionType = "updateDefaultReactionType" + TypeUpdateSavedMessagesTags = "updateSavedMessagesTags" + TypeUpdateSpeechRecognitionTrial = "updateSpeechRecognitionTrial" + TypeUpdateDiceEmojis = "updateDiceEmojis" + TypeUpdateAnimatedEmojiMessageClicked = "updateAnimatedEmojiMessageClicked" + TypeUpdateAnimationSearchParameters = "updateAnimationSearchParameters" + TypeUpdateSuggestedActions = "updateSuggestedActions" + TypeUpdateContactCloseBirthdays = "updateContactCloseBirthdays" + TypeUpdateAddChatMembersPrivacyForbidden = "updateAddChatMembersPrivacyForbidden" + TypeUpdateAutosaveSettings = "updateAutosaveSettings" + TypeUpdateBusinessConnection = "updateBusinessConnection" + TypeUpdateNewBusinessMessage = "updateNewBusinessMessage" + TypeUpdateBusinessMessageEdited = "updateBusinessMessageEdited" + TypeUpdateBusinessMessagesDeleted = "updateBusinessMessagesDeleted" + TypeUpdateNewInlineQuery = "updateNewInlineQuery" + TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" + TypeUpdateNewCallbackQuery = "updateNewCallbackQuery" + TypeUpdateNewInlineCallbackQuery = "updateNewInlineCallbackQuery" + TypeUpdateNewShippingQuery = "updateNewShippingQuery" + TypeUpdateNewPreCheckoutQuery = "updateNewPreCheckoutQuery" + TypeUpdateNewCustomEvent = "updateNewCustomEvent" + TypeUpdateNewCustomQuery = "updateNewCustomQuery" + TypeUpdatePoll = "updatePoll" + TypeUpdatePollAnswer = "updatePollAnswer" + TypeUpdateChatMember = "updateChatMember" + TypeUpdateNewChatJoinRequest = "updateNewChatJoinRequest" + TypeUpdateChatBoost = "updateChatBoost" + TypeUpdateMessageReaction = "updateMessageReaction" + TypeUpdateMessageReactions = "updateMessageReactions" + TypeUpdates = "updates" + TypeLogStreamDefault = "logStreamDefault" + TypeLogStreamFile = "logStreamFile" + TypeLogStreamEmpty = "logStreamEmpty" + TypeLogVerbosityLevel = "logVerbosityLevel" + TypeLogTags = "logTags" + TypeUserSupportInfo = "userSupportInfo" + TypeTestInt = "testInt" + TypeTestString = "testString" + TypeTestBytes = "testBytes" + TypeTestVectorInt = "testVectorInt" + TypeTestVectorIntObject = "testVectorIntObject" + TypeTestVectorString = "testVectorString" + TypeTestVectorStringObject = "testVectorStringObject" ) // Provides information about the method by which an authentication code is delivered to the user type AuthenticationCodeType interface { - AuthenticationCodeTypeType() string + AuthenticationCodeTypeType() string } // Contains authentication data for a email address type EmailAddressAuthentication interface { - EmailAddressAuthenticationType() string + EmailAddressAuthenticationType() string +} + +// Describes reset state of a email address +type EmailAddressResetState interface { + EmailAddressResetStateType() string } // Represents the current authorization state of the TDLib client type AuthorizationState interface { - AuthorizationStateType() string + AuthorizationStateType() string } // Points to a file type InputFile interface { - InputFileType() string + InputFileType() string } // Describes format of a thumbnail type ThumbnailFormat interface { - ThumbnailFormatType() string + ThumbnailFormatType() string } // Part of the face, relative to which a mask is placed type MaskPoint interface { - MaskPointType() string + MaskPointType() string } // Describes format of a sticker type StickerFormat interface { - StickerFormatType() string + StickerFormatType() string } // Describes type of a sticker type StickerType interface { - StickerTypeType() string + StickerTypeType() string } // Contains full information about sticker type type StickerFullType interface { - StickerFullTypeType() string + StickerFullTypeType() string } // Describes the type of a poll type PollType interface { - PollTypeType() string + PollTypeType() string } // Represents the type of a user. The following types are possible: regular users, deleted users and bots type UserType interface { - UserTypeType() string + UserTypeType() string +} + +// Describes conditions for sending of away messages by a Telegram Business account +type BusinessAwayMessageSchedule interface { + BusinessAwayMessageScheduleType() string +} + +// Describes type of a sticker, which was used to create a chat photo +type ChatPhotoStickerType interface { + ChatPhotoStickerTypeType() string } // Describes a photo to be set as a user profile or chat photo type InputChatPhoto interface { - InputChatPhotoType() string + InputChatPhotoType() string +} + +// Contains information about status of a user in a Telegram Premium giveaway +type PremiumGiveawayParticipantStatus interface { + PremiumGiveawayParticipantStatusType() string +} + +// Contains information about Telegram Premium giveaway +type PremiumGiveawayInfo interface { + PremiumGiveawayInfoType() string } // Provides information about the status of a member in a chat type ChatMemberStatus interface { - ChatMemberStatusType() string + ChatMemberStatusType() string } // Specifies the kind of chat members to return in searchChatMembers type ChatMembersFilter interface { - ChatMembersFilterType() string + ChatMembersFilterType() string } // Specifies the kind of chat members to return in getSupergroupMembers type SupergroupMembersFilter interface { - SupergroupMembersFilterType() string + SupergroupMembersFilterType() string +} + +// Describes the type of a chat to which points an invite link +type InviteLinkChatType interface { + InviteLinkChatTypeType() string } // Describes the current secret chat state type SecretChatState interface { - SecretChatStateType() string + SecretChatStateType() string } // Contains information about the sender of a message type MessageSender interface { - MessageSenderType() string + MessageSenderType() string } -// Contains information about the origin of a forwarded message -type MessageForwardOrigin interface { - MessageForwardOriginType() 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 } // Describes type of message reaction type ReactionType interface { - ReactionTypeType() string + ReactionTypeType() string } // Contains information about the sending state of the message type MessageSendingState interface { - MessageSendingStateType() string + MessageSendingStateType() string +} + +// Contains information about the message or the story a message is replying to +type MessageReplyTo interface { + MessageReplyToType() string +} + +// Contains information about the message or the story to be replied +type InputMessageReplyTo interface { + InputMessageReplyToType() string +} + +// Describes source of a message +type MessageSource interface { + MessageSourceType() string +} + +// Describes type of a message sponsor +type MessageSponsorType interface { + MessageSponsorTypeType() string +} + +// Describes result of sponsored message report +type ReportChatSponsoredMessageResult interface { + ReportChatSponsoredMessageResultType() string } // Describes the types of chats to which notification settings are relevant type NotificationSettingsScope interface { - NotificationSettingsScopeType() string + NotificationSettingsScopeType() string } // Describes the type of a chat type ChatType interface { - ChatTypeType() string + ChatTypeType() string } // Describes a list of chats type ChatList interface { - ChatListType() string + ChatListType() string } // Describes a reason why an external chat is shown in a chat list type ChatSource interface { - ChatSourceType() string + ChatSourceType() string } // Describes reactions available in the chat type ChatAvailableReactions interface { - ChatAvailableReactionsType() string + ChatAvailableReactionsType() string } // Describes a type of public chats type PublicChatType interface { - PublicChatTypeType() string + PublicChatTypeType() string } // Describes actions which must be possible to do through a chat action bar type ChatActionBar interface { - ChatActionBarType() string + ChatActionBarType() string } // Describes a keyboard button type type KeyboardButtonType interface { - KeyboardButtonTypeType() string + KeyboardButtonTypeType() string } // Describes the type of an inline keyboard button type InlineKeyboardButtonType interface { - InlineKeyboardButtonTypeType() string + InlineKeyboardButtonTypeType() string } // Contains a description of a custom keyboard and actions that can be done with it to quickly reply to bots type ReplyMarkup interface { - ReplyMarkupType() string + ReplyMarkupType() string } // Contains information about an inline button of type inlineKeyboardButtonTypeLoginUrl type LoginUrlInfo interface { - LoginUrlInfoType() string + LoginUrlInfoType() string +} + +// Describes type of a Saved Messages topic +type SavedMessagesTopicType interface { + SavedMessagesTopicTypeType() string } // Describes a text object inside an instant-view web page type RichText interface { - RichTextType() string + RichTextType() string } // Describes a horizontal alignment of a table cell content type PageBlockHorizontalAlignment interface { - PageBlockHorizontalAlignmentType() string + PageBlockHorizontalAlignmentType() string } // Describes a Vertical alignment of a table cell content type PageBlockVerticalAlignment interface { - PageBlockVerticalAlignmentType() string + PageBlockVerticalAlignmentType() string } // Describes a block of an instant view web page type PageBlock interface { - PageBlockType() string + PageBlockType() 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 + InputCredentialsType() string } // Contains information about a payment provider type PaymentProvider interface { - PaymentProviderType() string + PaymentProviderType() string } // Describes an invoice to process type InputInvoice interface { - InputInvoiceType() string + InputInvoiceType() string } // Describes a media, which is attached to an invoice type MessageExtendedMedia interface { - MessageExtendedMediaType() string + MessageExtendedMediaType() string } // Contains the type of a Telegram Passport element type PassportElementType interface { - PassportElementTypeType() string + PassportElementTypeType() string } // Contains information about a Telegram Passport element type PassportElement interface { - PassportElementType() string + PassportElementType() string } // Contains information about a Telegram Passport element to be saved type InputPassportElement interface { - InputPassportElementType() string + InputPassportElementType() string } // Contains the description of an error in a Telegram Passport element type PassportElementErrorSource interface { - PassportElementErrorSourceType() string + PassportElementErrorSourceType() string } // Contains the description of an error in a Telegram Passport element; for bots only type InputPassportElementErrorSource interface { - InputPassportElementErrorSourceType() string + InputPassportElementErrorSourceType() string } // Contains the content of a message type MessageContent interface { - MessageContentType() string + MessageContentType() string } // Represents a part of the text which must be formatted differently type TextEntityType interface { - TextEntityTypeType() string + TextEntityTypeType() string } // Contains information about the time when a scheduled message will be sent type MessageSchedulingState interface { - MessageSchedulingStateType() string + MessageSchedulingStateType() string +} + +// Describes when a message will be self-destructed +type MessageSelfDestructType interface { + MessageSelfDestructTypeType() string } // The content of a message to send type InputMessageContent interface { - InputMessageContentType() string + InputMessageContentType() string } // Represents a filter for message search results type SearchMessagesFilter interface { - SearchMessagesFilterType() string + SearchMessagesFilterType() string } // Describes the different types of activity in a chat type ChatAction interface { - ChatActionType() string + ChatActionType() string } // Describes the last time the user was online type UserStatus interface { - UserStatusType() string + UserStatusType() string +} + +// Describes type of an emoji category +type EmojiCategoryType interface { + EmojiCategoryTypeType() string +} + +// Describes type of a clickable rectangle area on a story media +type StoryAreaType interface { + StoryAreaTypeType() string +} + +// Describes type of a clickable rectangle area on a story media to be added +type InputStoryAreaType interface { + InputStoryAreaTypeType() string +} + +// Contains the content of a story +type StoryContent interface { + StoryContentType() string +} + +// The content of a story to send +type InputStoryContent interface { + InputStoryContentType() string +} + +// Describes a list of stories +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 call was discarded type CallDiscardReason interface { - CallDiscardReasonType() string + CallDiscardReasonType() string } // Describes the type of a call server type CallServerType interface { - CallServerTypeType() string + CallServerTypeType() string } // Describes the current call state type CallState interface { - CallStateType() string + CallStateType() string } // Describes the quality of a group call video type GroupCallVideoQuality interface { - GroupCallVideoQualityType() string + GroupCallVideoQualityType() string } // Describes the exact type of a problem with a call type CallProblem interface { - CallProblemType() string + CallProblemType() string +} + +// Contains settings for Firebase Authentication in the official applications +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 + DiceStickersType() string } // Describes result of speech recognition in a voice note type SpeechRecognitionResult interface { - SpeechRecognitionResultType() string + SpeechRecognitionResultType() string +} + +// Describes a reason why a bot was allowed to write messages to the current user +type BotWriteAccessAllowReason interface { + BotWriteAccessAllowReasonType() string } // Represents a single result of an inline query; for bots only type InputInlineQueryResult interface { - InputInlineQueryResultType() string + InputInlineQueryResultType() string } // Represents a single result of an inline query type InlineQueryResult interface { - InlineQueryResultType() string + InlineQueryResultType() string +} + +// Represents a type of a button in results of inline query +type InlineQueryResultsButtonType interface { + InlineQueryResultsButtonTypeType() string } // Represents a payload of a callback query type CallbackQueryPayload interface { - CallbackQueryPayloadType() string + CallbackQueryPayloadType() string } // Represents a chat event type ChatEventAction interface { - ChatEventActionType() string + ChatEventActionType() string } // Represents the value of a string in a language pack type LanguagePackStringValue interface { - LanguagePackStringValueType() string + LanguagePackStringValueType() string } // Describes type of a limit, increased for Premium users type PremiumLimitType interface { - PremiumLimitTypeType() string + PremiumLimitTypeType() string } // Describes a feature available to Premium users type PremiumFeature interface { - PremiumFeatureType() string + 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 } // Describes a source from which the Premium features screen is opened type PremiumSource interface { - PremiumSourceType() string + PremiumSourceType() string } // Describes a purpose of an in-store payment type StorePaymentPurpose interface { - StorePaymentPurposeType() string + StorePaymentPurposeType() string } -// Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, the correct application platform must be specified and a valid server authentication data must be uploaded at https://my.telegram.org +// Describes a purpose of a payment toward Telegram +type TelegramPaymentPurpose interface { + TelegramPaymentPurposeType() string +} + +// Represents a data needed to subscribe for push notifications through registerDevice method. type DeviceToken interface { - DeviceTokenType() string + DeviceTokenType() string } // Describes a fill of a background type BackgroundFill interface { - BackgroundFillType() string + BackgroundFillType() string } // Describes the type of a background type BackgroundType interface { - BackgroundTypeType() string + BackgroundTypeType() string } // Contains information about background to set type InputBackground interface { - InputBackgroundType() string + InputBackgroundType() string +} + +// Represents result of checking whether the current user can send a story in the specific chat +type CanSendStoryResult interface { + CanSendStoryResultType() string } // Represents result of checking whether the current session can be used to transfer a chat ownership to another user type CanTransferOwnershipResult interface { - CanTransferOwnershipResultType() string + CanTransferOwnershipResultType() string } // Represents result of checking whether a username can be set for a chat type CheckChatUsernameResult interface { - CheckChatUsernameResultType() string + CheckChatUsernameResultType() string } // Represents result of checking whether a name can be used for a new sticker set type CheckStickerSetNameResult interface { - CheckStickerSetNameResultType() string + CheckStickerSetNameResultType() string } // Represents result of 2-step verification password reset type ResetPasswordResult interface { - ResetPasswordResultType() string + ResetPasswordResultType() string } // Contains information about a file with messages exported from another app type MessageFileType interface { - MessageFileTypeType() string + MessageFileTypeType() string } // Contains content of a push message notification type PushMessageContent interface { - PushMessageContentType() string + PushMessageContentType() string } // Contains detailed information about a notification type NotificationType interface { - NotificationTypeType() string + NotificationTypeType() string } // Describes the type of notifications in a notification group type NotificationGroupType interface { - NotificationGroupTypeType() string + NotificationGroupTypeType() string } // Represents the value of an option type OptionValue interface { - OptionValueType() string + OptionValueType() string } // Represents a JSON value type JsonValue interface { - JsonValueType() string + JsonValueType() string } -// Represents a single rule for managing privacy settings +// Describes privacy settings of a story +type StoryPrivacySettings interface { + StoryPrivacySettingsType() string +} + +// Represents a single rule for managing user privacy settings type UserPrivacySettingRule interface { - UserPrivacySettingRuleType() string + UserPrivacySettingRuleType() string } // Describes available user privacy settings type UserPrivacySetting interface { - UserPrivacySettingType() string + UserPrivacySettingType() string +} + +// Describes result of canSendMessageToUser +type CanSendMessageToUserResult interface { + CanSendMessageToUserResultType() string } // Represents the type of a session type SessionType interface { - SessionTypeType() string + SessionTypeType() string } // Describes the reason why a chat is reported -type ChatReportReason interface { - ChatReportReasonType() string +type ReportReason interface { + ReportReasonType() string } // Describes the target chat to be opened type TargetChat interface { - TargetChatType() string + TargetChatType() string } // Describes an internal https://t.me or tg: link, which must be processed by the application in a special way type InternalLinkType interface { - InternalLinkTypeType() string + InternalLinkTypeType() string +} + +// Describes a type of a block list +type BlockList interface { + BlockListType() string } // Represents the type of a file type FileType interface { - FileTypeType() string + FileTypeType() string } // Represents the type of a network type NetworkType interface { - NetworkTypeType() string + NetworkTypeType() string } // Contains statistics about network usage type NetworkStatisticsEntry interface { - NetworkStatisticsEntryType() string + NetworkStatisticsEntryType() string +} + +// Describes scope of autosave settings +type AutosaveSettingsScope interface { + AutosaveSettingsScopeType() string } // Describes the current state of the connection to Telegram servers type ConnectionState interface { - ConnectionStateType() string + ConnectionStateType() string } // Represents the categories of chats for which a list of frequently used chats can be retrieved type TopChatCategory interface { - TopChatCategoryType() string + TopChatCategoryType() string } // Describes the type of a URL linking to an internal Telegram entity type TMeUrlType interface { - TMeUrlTypeType() string + TMeUrlTypeType() string } // Describes an action suggested to the current user type SuggestedAction interface { - SuggestedActionType() string + SuggestedActionType() string } // Describes the way the text needs to be parsed for text entities type TextParseMode interface { - TextParseModeType() string + TextParseModeType() string } // Describes the type of a proxy server type ProxyType interface { - ProxyTypeType() string + ProxyTypeType() string } // Describes a statistical graph type StatisticalGraph interface { - StatisticalGraphType() string + StatisticalGraphType() string +} + +// Describes type of an object, for which statistics are provided +type ChatStatisticsObjectType interface { + ChatStatisticsObjectTypeType() string } // Contains a detailed statistics about a chat type ChatStatistics interface { - ChatStatisticsType() string + ChatStatisticsType() string } // Represents a vector path command type VectorPathCommand interface { - VectorPathCommandType() string + VectorPathCommandType() string } // Represents the scope to which bot commands are relevant type BotCommandScope interface { - BotCommandScopeType() string + BotCommandScopeType() string } // Contains notifications about data changes type Update interface { - UpdateType() string + UpdateType() string } // Describes a stream to which TDLib internal log is written type LogStream interface { - LogStreamType() string + LogStreamType() string } // An object of this type can be returned on every function call, in case of an error type Error struct { - meta - // Error code; subject to future changes. If the error code is 406, the error message must not be processed in any way and must not be displayed to the user - Code int32 `json:"code"` - // Error message; subject to future changes - Message string `json:"message"` + meta + // Error code; subject to future changes. If the error code is 406, the error message must not be processed in any way and must not be displayed to the user + Code int32 `json:"code"` + // Error message; subject to future changes + Message string `json:"message"` } func (entity *Error) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Error + type stub Error - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Error) GetClass() string { - return ClassError + return ClassError } func (*Error) GetType() string { - return TypeError + return TypeError } // An object of this type is returned on a successful function call for certain functions -type Ok struct { - meta +type Ok struct{ + meta } func (entity *Ok) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Ok + type stub Ok - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Ok) GetClass() string { - return ClassOk + return ClassOk } func (*Ok) GetType() string { - return TypeOk + return TypeOk } // An 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 - Length int32 `json:"length"` + meta + // Length of the code + Length int32 `json:"length"` } func (entity *AuthenticationCodeTypeTelegramMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeTypeTelegramMessage + type stub AuthenticationCodeTypeTelegramMessage - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeTypeTelegramMessage) GetClass() string { - return ClassAuthenticationCodeType + return ClassAuthenticationCodeType } func (*AuthenticationCodeTypeTelegramMessage) GetType() string { - return TypeAuthenticationCodeTypeTelegramMessage + return TypeAuthenticationCodeTypeTelegramMessage } func (*AuthenticationCodeTypeTelegramMessage) AuthenticationCodeTypeType() string { - return TypeAuthenticationCodeTypeTelegramMessage + return TypeAuthenticationCodeTypeTelegramMessage } -// An authentication code is delivered via an SMS message to the specified phone number +// An authentication code is delivered via an SMS message to the specified phone number; applications may not receive this type of code type AuthenticationCodeTypeSms struct { - meta - // Length of the code - Length int32 `json:"length"` + meta + // Length of the code + Length int32 `json:"length"` } func (entity *AuthenticationCodeTypeSms) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeTypeSms + type stub AuthenticationCodeTypeSms - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeTypeSms) GetClass() string { - return ClassAuthenticationCodeType + return ClassAuthenticationCodeType } func (*AuthenticationCodeTypeSms) GetType() string { - return TypeAuthenticationCodeTypeSms + return TypeAuthenticationCodeTypeSms } func (*AuthenticationCodeTypeSms) AuthenticationCodeTypeType() string { - return TypeAuthenticationCodeTypeSms + return TypeAuthenticationCodeTypeSms } // An authentication code is delivered via a phone call to the specified phone number type AuthenticationCodeTypeCall struct { - meta - // Length of the code - Length int32 `json:"length"` + meta + // Length of the code + Length int32 `json:"length"` } func (entity *AuthenticationCodeTypeCall) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeTypeCall + type stub AuthenticationCodeTypeCall - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeTypeCall) GetClass() string { - return ClassAuthenticationCodeType + return ClassAuthenticationCodeType } func (*AuthenticationCodeTypeCall) GetType() string { - return TypeAuthenticationCodeTypeCall + return TypeAuthenticationCodeTypeCall } func (*AuthenticationCodeTypeCall) AuthenticationCodeTypeType() string { - return TypeAuthenticationCodeTypeCall + return TypeAuthenticationCodeTypeCall } // An authentication code is delivered by an immediately canceled call to the specified phone number. The phone number that calls is the code that must be entered automatically type AuthenticationCodeTypeFlashCall struct { - meta - // Pattern of the phone number from which the call will be made - Pattern string `json:"pattern"` + meta + // Pattern of the phone number from which the call will be made + Pattern string `json:"pattern"` } func (entity *AuthenticationCodeTypeFlashCall) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeTypeFlashCall + type stub AuthenticationCodeTypeFlashCall - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeTypeFlashCall) GetClass() string { - return ClassAuthenticationCodeType + return ClassAuthenticationCodeType } func (*AuthenticationCodeTypeFlashCall) GetType() string { - return TypeAuthenticationCodeTypeFlashCall + return TypeAuthenticationCodeTypeFlashCall } func (*AuthenticationCodeTypeFlashCall) AuthenticationCodeTypeType() string { - return TypeAuthenticationCodeTypeFlashCall + return TypeAuthenticationCodeTypeFlashCall } // An authentication code is delivered by an immediately canceled call to the specified phone number. The last digits of the phone number that calls are the code that must be entered manually by the user type AuthenticationCodeTypeMissedCall struct { - meta - // Prefix of the phone number from which the call will be made - PhoneNumberPrefix string `json:"phone_number_prefix"` - // Number of digits in the code, excluding the prefix - Length int32 `json:"length"` + meta + // Prefix of the phone number from which the call will be made + PhoneNumberPrefix string `json:"phone_number_prefix"` + // Number of digits in the code, excluding the prefix + Length int32 `json:"length"` } func (entity *AuthenticationCodeTypeMissedCall) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeTypeMissedCall + type stub AuthenticationCodeTypeMissedCall - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeTypeMissedCall) GetClass() string { - return ClassAuthenticationCodeType + return ClassAuthenticationCodeType } func (*AuthenticationCodeTypeMissedCall) GetType() string { - return TypeAuthenticationCodeTypeMissedCall + return TypeAuthenticationCodeTypeMissedCall } func (*AuthenticationCodeTypeMissedCall) AuthenticationCodeTypeType() string { - return TypeAuthenticationCodeTypeMissedCall + 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 type AuthenticationCodeTypeFragment struct { - meta - // URL to open to receive the code - Url string `json:"url"` - // Length of the code - Length int32 `json:"length"` + meta + // URL to open to receive the code + Url string `json:"url"` + // Length of the code + Length int32 `json:"length"` } func (entity *AuthenticationCodeTypeFragment) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeTypeFragment + type stub AuthenticationCodeTypeFragment - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeTypeFragment) GetClass() string { - return ClassAuthenticationCodeType + return ClassAuthenticationCodeType } func (*AuthenticationCodeTypeFragment) GetType() string { - return TypeAuthenticationCodeTypeFragment + return TypeAuthenticationCodeTypeFragment } func (*AuthenticationCodeTypeFragment) AuthenticationCodeTypeType() string { - return TypeAuthenticationCodeTypeFragment + return TypeAuthenticationCodeTypeFragment +} + +// An 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"` + // Length of the code + Length int32 `json:"length"` +} + +func (entity *AuthenticationCodeTypeFirebaseAndroid) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeFirebaseAndroid + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeFirebaseAndroid) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeFirebaseAndroid) GetType() string { + return TypeAuthenticationCodeTypeFirebaseAndroid +} + +func (*AuthenticationCodeTypeFirebaseAndroid) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeFirebaseAndroid +} + +// An 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 + PushTimeout int32 `json:"push_timeout"` + // Length of the code + Length int32 `json:"length"` +} + +func (entity *AuthenticationCodeTypeFirebaseIos) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub AuthenticationCodeTypeFirebaseIos + + return json.Marshal((*stub)(entity)) +} + +func (*AuthenticationCodeTypeFirebaseIos) GetClass() string { + return ClassAuthenticationCodeType +} + +func (*AuthenticationCodeTypeFirebaseIos) GetType() string { + return TypeAuthenticationCodeTypeFirebaseIos +} + +func (*AuthenticationCodeTypeFirebaseIos) AuthenticationCodeTypeType() string { + return TypeAuthenticationCodeTypeFirebaseIos } // Information about the authentication code that was sent type AuthenticationCodeInfo struct { - meta - // A phone number that is being authenticated - PhoneNumber string `json:"phone_number"` - // The way the code was sent to the user - Type AuthenticationCodeType `json:"type"` - // The way the next code will be sent to the user; may be null - NextType AuthenticationCodeType `json:"next_type"` - // Timeout before the code can be re-sent, in seconds - Timeout int32 `json:"timeout"` + meta + // A phone number that is being authenticated + PhoneNumber string `json:"phone_number"` + // The way the code was sent to the user + Type AuthenticationCodeType `json:"type"` + // The way the next code will be sent to the user; may be null + NextType AuthenticationCodeType `json:"next_type"` + // Timeout before the code can be re-sent, in seconds + Timeout int32 `json:"timeout"` } func (entity *AuthenticationCodeInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthenticationCodeInfo + type stub AuthenticationCodeInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthenticationCodeInfo) GetClass() string { - return ClassAuthenticationCodeInfo + return ClassAuthenticationCodeInfo } func (*AuthenticationCodeInfo) GetType() string { - return TypeAuthenticationCodeInfo + return TypeAuthenticationCodeInfo } func (authenticationCodeInfo *AuthenticationCodeInfo) UnmarshalJSON(data []byte) error { - var tmp struct { - PhoneNumber string `json:"phone_number"` - Type json.RawMessage `json:"type"` - NextType json.RawMessage `json:"next_type"` - Timeout int32 `json:"timeout"` - } + var tmp struct { + PhoneNumber string `json:"phone_number"` + Type json.RawMessage `json:"type"` + NextType json.RawMessage `json:"next_type"` + Timeout int32 `json:"timeout"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - authenticationCodeInfo.PhoneNumber = tmp.PhoneNumber - authenticationCodeInfo.Timeout = tmp.Timeout + authenticationCodeInfo.PhoneNumber = tmp.PhoneNumber + authenticationCodeInfo.Timeout = tmp.Timeout - fieldType, _ := UnmarshalAuthenticationCodeType(tmp.Type) - authenticationCodeInfo.Type = fieldType + fieldType, _ := UnmarshalAuthenticationCodeType(tmp.Type) + authenticationCodeInfo.Type = fieldType - fieldNextType, _ := UnmarshalAuthenticationCodeType(tmp.NextType) - authenticationCodeInfo.NextType = fieldNextType + fieldNextType, _ := UnmarshalAuthenticationCodeType(tmp.NextType) + authenticationCodeInfo.NextType = fieldNextType - return nil + return nil } // Information about the email address authentication code that was sent type EmailAddressAuthenticationCodeInfo struct { - meta - // Pattern of the email address to which an authentication code was sent - EmailAddressPattern string `json:"email_address_pattern"` - // Length of the code; 0 if unknown - Length int32 `json:"length"` + meta + // Pattern of the email address to which an authentication code was sent + EmailAddressPattern string `json:"email_address_pattern"` + // Length of the code; 0 if unknown + Length int32 `json:"length"` } func (entity *EmailAddressAuthenticationCodeInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub EmailAddressAuthenticationCodeInfo + type stub EmailAddressAuthenticationCodeInfo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*EmailAddressAuthenticationCodeInfo) GetClass() string { - return ClassEmailAddressAuthenticationCodeInfo + return ClassEmailAddressAuthenticationCodeInfo } func (*EmailAddressAuthenticationCodeInfo) GetType() string { - return TypeEmailAddressAuthenticationCodeInfo + return TypeEmailAddressAuthenticationCodeInfo } // An authentication code delivered to a user's email address type EmailAddressAuthenticationCode struct { - meta - // The code - Code string `json:"code"` + meta + // The code + Code string `json:"code"` } func (entity *EmailAddressAuthenticationCode) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub EmailAddressAuthenticationCode + type stub EmailAddressAuthenticationCode - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*EmailAddressAuthenticationCode) GetClass() string { - return ClassEmailAddressAuthentication + return ClassEmailAddressAuthentication } func (*EmailAddressAuthenticationCode) GetType() string { - return TypeEmailAddressAuthenticationCode + return TypeEmailAddressAuthenticationCode } func (*EmailAddressAuthenticationCode) EmailAddressAuthenticationType() string { - return TypeEmailAddressAuthenticationCode + return TypeEmailAddressAuthenticationCode } // An authentication token received through Apple ID type EmailAddressAuthenticationAppleId struct { - meta - // The token - Token string `json:"token"` + meta + // The token + Token string `json:"token"` } func (entity *EmailAddressAuthenticationAppleId) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub EmailAddressAuthenticationAppleId + type stub EmailAddressAuthenticationAppleId - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*EmailAddressAuthenticationAppleId) GetClass() string { - return ClassEmailAddressAuthentication + return ClassEmailAddressAuthentication } func (*EmailAddressAuthenticationAppleId) GetType() string { - return TypeEmailAddressAuthenticationAppleId + return TypeEmailAddressAuthenticationAppleId } func (*EmailAddressAuthenticationAppleId) EmailAddressAuthenticationType() string { - return TypeEmailAddressAuthenticationAppleId + return TypeEmailAddressAuthenticationAppleId } // An authentication token received through Google ID type EmailAddressAuthenticationGoogleId struct { - meta - // The token - Token string `json:"token"` + meta + // The token + Token string `json:"token"` } func (entity *EmailAddressAuthenticationGoogleId) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub EmailAddressAuthenticationGoogleId + type stub EmailAddressAuthenticationGoogleId - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*EmailAddressAuthenticationGoogleId) GetClass() string { - return ClassEmailAddressAuthentication + return ClassEmailAddressAuthentication } func (*EmailAddressAuthenticationGoogleId) GetType() string { - return TypeEmailAddressAuthenticationGoogleId + return TypeEmailAddressAuthenticationGoogleId } func (*EmailAddressAuthenticationGoogleId) EmailAddressAuthenticationType() string { - return TypeEmailAddressAuthenticationGoogleId + return TypeEmailAddressAuthenticationGoogleId +} + +// 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 +type EmailAddressResetStateAvailable struct { + meta + // Time required to wait before the email address can be reset; 0 if the user is subscribed to Telegram Premium + WaitPeriod int32 `json:"wait_period"` +} + +func (entity *EmailAddressResetStateAvailable) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmailAddressResetStateAvailable + + return json.Marshal((*stub)(entity)) +} + +func (*EmailAddressResetStateAvailable) GetClass() string { + return ClassEmailAddressResetState +} + +func (*EmailAddressResetStateAvailable) GetType() string { + return TypeEmailAddressResetStateAvailable +} + +func (*EmailAddressResetStateAvailable) EmailAddressResetStateType() string { + return TypeEmailAddressResetStateAvailable +} + +// Email address reset has already been requested. Call resetAuthenticationEmailAddress to check whether immediate reset is possible +type EmailAddressResetStatePending struct { + meta + // Left time before the email address will be reset, in seconds. updateAuthorizationState is not sent when this field changes + ResetIn int32 `json:"reset_in"` +} + +func (entity *EmailAddressResetStatePending) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmailAddressResetStatePending + + return json.Marshal((*stub)(entity)) +} + +func (*EmailAddressResetStatePending) GetClass() string { + return ClassEmailAddressResetState +} + +func (*EmailAddressResetStatePending) GetType() string { + return TypeEmailAddressResetStatePending +} + +func (*EmailAddressResetStatePending) EmailAddressResetStateType() string { + return TypeEmailAddressResetStatePending } // Represents a part of the text that needs to be formatted in some unusual way type TextEntity struct { - meta - // Offset of the entity, in UTF-16 code units - Offset int32 `json:"offset"` - // Length of the entity, in UTF-16 code units - Length int32 `json:"length"` - // Type of the entity - Type TextEntityType `json:"type"` + meta + // Offset of the entity, in UTF-16 code units + Offset int32 `json:"offset"` + // Length of the entity, in UTF-16 code units + Length int32 `json:"length"` + // Type of the entity + Type TextEntityType `json:"type"` } func (entity *TextEntity) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntity + type stub TextEntity - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntity) GetClass() string { - return ClassTextEntity + return ClassTextEntity } func (*TextEntity) GetType() string { - return TypeTextEntity + return TypeTextEntity } func (textEntity *TextEntity) UnmarshalJSON(data []byte) error { - var tmp struct { - Offset int32 `json:"offset"` - Length int32 `json:"length"` - Type json.RawMessage `json:"type"` - } + var tmp struct { + Offset int32 `json:"offset"` + Length int32 `json:"length"` + Type json.RawMessage `json:"type"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - textEntity.Offset = tmp.Offset - textEntity.Length = tmp.Length + textEntity.Offset = tmp.Offset + textEntity.Length = tmp.Length - fieldType, _ := UnmarshalTextEntityType(tmp.Type) - textEntity.Type = fieldType + fieldType, _ := UnmarshalTextEntityType(tmp.Type) + textEntity.Type = fieldType - return nil + return nil } // Contains a list of text entities type TextEntities struct { - meta - // List of text entities - Entities []*TextEntity `json:"entities"` + meta + // List of text entities + Entities []*TextEntity `json:"entities"` } func (entity *TextEntities) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TextEntities + type stub TextEntities - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TextEntities) GetClass() string { - return ClassTextEntities + return ClassTextEntities } func (*TextEntities) GetType() string { - return TypeTextEntities + return TypeTextEntities } // A text with some entities type FormattedText struct { - meta - // The text - Text string `json:"text"` - // Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and can be part of any other entities. All other entities can't contain each other - Entities []*TextEntity `json:"entities"` + meta + // The text + Text string `json:"text"` + // Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. Pre, Code and PreCode entities can't contain other entities. BlockQuote entities can't contain other BlockQuote entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and can be part of any other entities. All other entities can't contain each other + Entities []*TextEntity `json:"entities"` } func (entity *FormattedText) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub FormattedText + type stub FormattedText - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*FormattedText) GetClass() string { - return ClassFormattedText + return ClassFormattedText } func (*FormattedText) GetType() string { - return TypeFormattedText + return TypeFormattedText } // Contains Telegram terms of service type TermsOfService struct { - meta - // Text of the terms of service - Text *FormattedText `json:"text"` - // The minimum age of a user to be able to accept the terms; 0 if age isn't restricted - MinUserAge int32 `json:"min_user_age"` - // True, if a blocking popup with terms of service must be shown to the user - ShowPopup bool `json:"show_popup"` + meta + // Text of the terms of service + Text *FormattedText `json:"text"` + // The minimum age of a user to be able to accept the terms; 0 if age isn't restricted + MinUserAge int32 `json:"min_user_age"` + // True, if a blocking popup with terms of service must be shown to the user + ShowPopup bool `json:"show_popup"` } func (entity *TermsOfService) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TermsOfService + type stub TermsOfService - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TermsOfService) GetClass() string { - return ClassTermsOfService + return ClassTermsOfService } func (*TermsOfService) GetType() string { - return TypeTermsOfService + return TypeTermsOfService } -// Initializetion parameters are needed. Call setTdlibParameters to provide them -type AuthorizationStateWaitTdlibParameters struct { - meta +// Initialization parameters are needed. Call setTdlibParameters to provide them +type AuthorizationStateWaitTdlibParameters struct{ + meta } func (entity *AuthorizationStateWaitTdlibParameters) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitTdlibParameters + type stub AuthorizationStateWaitTdlibParameters - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitTdlibParameters) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitTdlibParameters) GetType() string { - return TypeAuthorizationStateWaitTdlibParameters + return TypeAuthorizationStateWaitTdlibParameters } func (*AuthorizationStateWaitTdlibParameters) AuthorizationStateType() string { - return TypeAuthorizationStateWaitTdlibParameters + 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 -type AuthorizationStateWaitPhoneNumber struct { - meta +type AuthorizationStateWaitPhoneNumber struct{ + meta } func (entity *AuthorizationStateWaitPhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitPhoneNumber + type stub AuthorizationStateWaitPhoneNumber - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitPhoneNumber) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitPhoneNumber) GetType() string { - return TypeAuthorizationStateWaitPhoneNumber + return TypeAuthorizationStateWaitPhoneNumber } func (*AuthorizationStateWaitPhoneNumber) AuthorizationStateType() string { - return TypeAuthorizationStateWaitPhoneNumber + return TypeAuthorizationStateWaitPhoneNumber } // 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 - // True, if authorization through Apple ID is allowed - AllowAppleId bool `json:"allow_apple_id"` - // True, if authorization through Google ID is allowed - AllowGoogleId bool `json:"allow_google_id"` + meta + // True, if authorization through Apple ID is allowed + AllowAppleId bool `json:"allow_apple_id"` + // True, if authorization through Google ID is allowed + AllowGoogleId bool `json:"allow_google_id"` } func (entity *AuthorizationStateWaitEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitEmailAddress + type stub AuthorizationStateWaitEmailAddress - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitEmailAddress) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitEmailAddress) GetType() string { - return TypeAuthorizationStateWaitEmailAddress + return TypeAuthorizationStateWaitEmailAddress } func (*AuthorizationStateWaitEmailAddress) AuthorizationStateType() string { - return TypeAuthorizationStateWaitEmailAddress + return TypeAuthorizationStateWaitEmailAddress } // TDLib needs the user's authentication code sent to an email address to authorize. Call checkAuthenticationEmailCode to provide the code type AuthorizationStateWaitEmailCode struct { - meta - // True, if authorization through Apple ID is allowed - AllowAppleId bool `json:"allow_apple_id"` - // True, if authorization through Google ID is allowed - AllowGoogleId bool `json:"allow_google_id"` - // Information about the sent authentication code - CodeInfo *EmailAddressAuthenticationCodeInfo `json:"code_info"` - // Point in time (Unix timestamp) when the user will be able to authorize with a code sent to the user's phone number; 0 if unknown - NextPhoneNumberAuthorizationDate int32 `json:"next_phone_number_authorization_date"` + meta + // True, if authorization through Apple ID is allowed + AllowAppleId bool `json:"allow_apple_id"` + // True, if authorization through Google ID is allowed + AllowGoogleId bool `json:"allow_google_id"` + // Information about the sent authentication code + CodeInfo *EmailAddressAuthenticationCodeInfo `json:"code_info"` + // Reset state of the email address; may be null if the email address can't be reset + EmailAddressResetState EmailAddressResetState `json:"email_address_reset_state"` } func (entity *AuthorizationStateWaitEmailCode) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitEmailCode + type stub AuthorizationStateWaitEmailCode - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitEmailCode) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitEmailCode) GetType() string { - return TypeAuthorizationStateWaitEmailCode + return TypeAuthorizationStateWaitEmailCode } func (*AuthorizationStateWaitEmailCode) AuthorizationStateType() string { - return TypeAuthorizationStateWaitEmailCode + return TypeAuthorizationStateWaitEmailCode +} + +func (authorizationStateWaitEmailCode *AuthorizationStateWaitEmailCode) UnmarshalJSON(data []byte) error { + var tmp struct { + AllowAppleId bool `json:"allow_apple_id"` + AllowGoogleId bool `json:"allow_google_id"` + CodeInfo *EmailAddressAuthenticationCodeInfo `json:"code_info"` + EmailAddressResetState json.RawMessage `json:"email_address_reset_state"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + authorizationStateWaitEmailCode.AllowAppleId = tmp.AllowAppleId + authorizationStateWaitEmailCode.AllowGoogleId = tmp.AllowGoogleId + authorizationStateWaitEmailCode.CodeInfo = tmp.CodeInfo + + fieldEmailAddressResetState, _ := UnmarshalEmailAddressResetState(tmp.EmailAddressResetState) + authorizationStateWaitEmailCode.EmailAddressResetState = fieldEmailAddressResetState + + return nil } // TDLib needs the user's authentication code to authorize. Call checkAuthenticationCode to check the code type AuthorizationStateWaitCode struct { - meta - // Information about the authorization code that was sent - CodeInfo *AuthenticationCodeInfo `json:"code_info"` + meta + // Information about the authorization code that was sent + CodeInfo *AuthenticationCodeInfo `json:"code_info"` } func (entity *AuthorizationStateWaitCode) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitCode + type stub AuthorizationStateWaitCode - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitCode) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitCode) GetType() string { - return TypeAuthorizationStateWaitCode + return TypeAuthorizationStateWaitCode } func (*AuthorizationStateWaitCode) AuthorizationStateType() string { - return TypeAuthorizationStateWaitCode + return TypeAuthorizationStateWaitCode } // The user needs to confirm authorization on another logged in device by scanning a QR code with the provided link type AuthorizationStateWaitOtherDeviceConfirmation struct { - meta - // A tg:// URL for the QR code. The link will be updated frequently - Link string `json:"link"` + meta + // A tg:// URL for the QR code. The link will be updated frequently + Link string `json:"link"` } func (entity *AuthorizationStateWaitOtherDeviceConfirmation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitOtherDeviceConfirmation + type stub AuthorizationStateWaitOtherDeviceConfirmation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitOtherDeviceConfirmation) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitOtherDeviceConfirmation) GetType() string { - return TypeAuthorizationStateWaitOtherDeviceConfirmation + return TypeAuthorizationStateWaitOtherDeviceConfirmation } func (*AuthorizationStateWaitOtherDeviceConfirmation) AuthorizationStateType() string { - return TypeAuthorizationStateWaitOtherDeviceConfirmation + return TypeAuthorizationStateWaitOtherDeviceConfirmation } // The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration. Call registerUser to accept the terms of service and provide the data type AuthorizationStateWaitRegistration struct { - meta - // Telegram terms of service - TermsOfService *TermsOfService `json:"terms_of_service"` + meta + // Telegram terms of service + TermsOfService *TermsOfService `json:"terms_of_service"` } func (entity *AuthorizationStateWaitRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitRegistration + type stub AuthorizationStateWaitRegistration - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitRegistration) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitRegistration) GetType() string { - return TypeAuthorizationStateWaitRegistration + return TypeAuthorizationStateWaitRegistration } func (*AuthorizationStateWaitRegistration) AuthorizationStateType() string { - return TypeAuthorizationStateWaitRegistration + return TypeAuthorizationStateWaitRegistration } // The user has been authorized, but needs to enter a 2-step verification password to start using the application. Call checkAuthenticationPassword to provide the password, or requestAuthenticationPasswordRecovery to recover the password, or deleteAccount to delete the account after a week type AuthorizationStateWaitPassword struct { - meta - // Hint for the password; may be empty - PasswordHint string `json:"password_hint"` - // True, if a recovery email address has been set up - HasRecoveryEmailAddress bool `json:"has_recovery_email_address"` - // Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent - RecoveryEmailAddressPattern string `json:"recovery_email_address_pattern"` + meta + // Hint for the password; may be empty + PasswordHint string `json:"password_hint"` + // True, if a recovery email address has been set up + HasRecoveryEmailAddress bool `json:"has_recovery_email_address"` + // True, if some Telegram Passport elements were saved + HasPassportData bool `json:"has_passport_data"` + // Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent + RecoveryEmailAddressPattern string `json:"recovery_email_address_pattern"` } func (entity *AuthorizationStateWaitPassword) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateWaitPassword + type stub AuthorizationStateWaitPassword - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateWaitPassword) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateWaitPassword) GetType() string { - return TypeAuthorizationStateWaitPassword + return TypeAuthorizationStateWaitPassword } func (*AuthorizationStateWaitPassword) AuthorizationStateType() string { - return TypeAuthorizationStateWaitPassword + return TypeAuthorizationStateWaitPassword } // The user has been successfully authorized. TDLib is now ready to answer general requests -type AuthorizationStateReady struct { - meta +type AuthorizationStateReady struct{ + meta } func (entity *AuthorizationStateReady) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateReady + type stub AuthorizationStateReady - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateReady) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateReady) GetType() string { - return TypeAuthorizationStateReady + return TypeAuthorizationStateReady } func (*AuthorizationStateReady) AuthorizationStateType() string { - return TypeAuthorizationStateReady + return TypeAuthorizationStateReady } // The user is currently logging out -type AuthorizationStateLoggingOut struct { - meta +type AuthorizationStateLoggingOut struct{ + meta } func (entity *AuthorizationStateLoggingOut) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateLoggingOut + type stub AuthorizationStateLoggingOut - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateLoggingOut) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateLoggingOut) GetType() string { - return TypeAuthorizationStateLoggingOut + return TypeAuthorizationStateLoggingOut } func (*AuthorizationStateLoggingOut) AuthorizationStateType() string { - return TypeAuthorizationStateLoggingOut + return TypeAuthorizationStateLoggingOut } // TDLib is closing, all subsequent queries will be answered with the error 500. Note that closing TDLib can take a while. All resources will be freed only after authorizationStateClosed has been received -type AuthorizationStateClosing struct { - meta +type AuthorizationStateClosing struct{ + meta } func (entity *AuthorizationStateClosing) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateClosing + type stub AuthorizationStateClosing - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateClosing) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateClosing) GetType() string { - return TypeAuthorizationStateClosing + return TypeAuthorizationStateClosing } func (*AuthorizationStateClosing) AuthorizationStateType() string { - return TypeAuthorizationStateClosing + return TypeAuthorizationStateClosing } // TDLib client is in its final state. All databases are closed and all resources are released. No other updates will be received after this. All queries will be responded to with error code 500. To continue working, one must create a new instance of the TDLib client -type AuthorizationStateClosed struct { - meta +type AuthorizationStateClosed struct{ + meta } func (entity *AuthorizationStateClosed) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AuthorizationStateClosed + type stub AuthorizationStateClosed - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AuthorizationStateClosed) GetClass() string { - return ClassAuthorizationState + return ClassAuthorizationState } func (*AuthorizationStateClosed) GetType() string { - return TypeAuthorizationStateClosed + return TypeAuthorizationStateClosed } func (*AuthorizationStateClosed) AuthorizationStateType() string { - return TypeAuthorizationStateClosed + return TypeAuthorizationStateClosed } // Represents the current state of 2-step verification type PasswordState struct { - meta - // True, if a 2-step verification password is set - HasPassword bool `json:"has_password"` - // Hint for the password; may be empty - PasswordHint string `json:"password_hint"` - // True, if a recovery email is set - HasRecoveryEmailAddress bool `json:"has_recovery_email_address"` - // True, if some Telegram Passport elements were saved - HasPassportData bool `json:"has_passport_data"` - // Information about the recovery email address to which the confirmation email was sent; may be null - RecoveryEmailAddressCodeInfo *EmailAddressAuthenticationCodeInfo `json:"recovery_email_address_code_info"` - // Pattern of the email address set up for logging in - LoginEmailAddressPattern string `json:"login_email_address_pattern"` - // If not 0, point in time (Unix timestamp) after which the 2-step verification password can be reset immediately using resetPassword - PendingResetDate int32 `json:"pending_reset_date"` + meta + // True, if a 2-step verification password is set + HasPassword bool `json:"has_password"` + // Hint for the password; may be empty + PasswordHint string `json:"password_hint"` + // True, if a recovery email is set + HasRecoveryEmailAddress bool `json:"has_recovery_email_address"` + // True, if some Telegram Passport elements were saved + HasPassportData bool `json:"has_passport_data"` + // Information about the recovery email address to which the confirmation email was sent; may be null + RecoveryEmailAddressCodeInfo *EmailAddressAuthenticationCodeInfo `json:"recovery_email_address_code_info"` + // Pattern of the email address set up for logging in + LoginEmailAddressPattern string `json:"login_email_address_pattern"` + // If not 0, point in time (Unix timestamp) after which the 2-step verification password can be reset immediately using resetPassword + PendingResetDate int32 `json:"pending_reset_date"` } func (entity *PasswordState) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PasswordState + type stub PasswordState - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PasswordState) GetClass() string { - return ClassPasswordState + return ClassPasswordState } func (*PasswordState) GetType() string { - return TypePasswordState + return TypePasswordState } // Contains information about the current recovery email address type RecoveryEmailAddress struct { - meta - // Recovery email address - RecoveryEmailAddress string `json:"recovery_email_address"` + meta + // Recovery email address + RecoveryEmailAddress string `json:"recovery_email_address"` } func (entity *RecoveryEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RecoveryEmailAddress + type stub RecoveryEmailAddress - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RecoveryEmailAddress) GetClass() string { - return ClassRecoveryEmailAddress + return ClassRecoveryEmailAddress } func (*RecoveryEmailAddress) GetType() string { - return TypeRecoveryEmailAddress + return TypeRecoveryEmailAddress } // Returns information about the availability of a temporary password, which can be used for payments type TemporaryPasswordState struct { - meta - // True, if a temporary password is available - HasPassword bool `json:"has_password"` - // Time left before the temporary password expires, in seconds - ValidFor int32 `json:"valid_for"` + meta + // True, if a temporary password is available + HasPassword bool `json:"has_password"` + // Time left before the temporary password expires, in seconds + ValidFor int32 `json:"valid_for"` } func (entity *TemporaryPasswordState) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub TemporaryPasswordState + type stub TemporaryPasswordState - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*TemporaryPasswordState) GetClass() string { - return ClassTemporaryPasswordState + return ClassTemporaryPasswordState } func (*TemporaryPasswordState) GetType() string { - return TypeTemporaryPasswordState + return TypeTemporaryPasswordState } // Represents a local file type LocalFile struct { - meta - // Local path to the locally available file part; may be empty - Path string `json:"path"` - // True, if it is possible to download or generate the file - CanBeDownloaded bool `json:"can_be_downloaded"` - // True, if the file can be deleted - CanBeDeleted bool `json:"can_be_deleted"` - // True, if the file is currently being downloaded (or a local copy is being generated by some other means) - IsDownloadingActive bool `json:"is_downloading_active"` - // True, if the local copy is fully available - IsDownloadingCompleted bool `json:"is_downloading_completed"` - // Download will be started from this offset. downloaded_prefix_size is calculated from this offset - DownloadOffset int64 `json:"download_offset"` - // If is_downloading_completed is false, then only some prefix of the file starting from download_offset is ready to be read. downloaded_prefix_size is the size of that prefix in bytes - DownloadedPrefixSize int64 `json:"downloaded_prefix_size"` - // Total downloaded file size, in bytes. Can be used only for calculating download progress. The actual file size may be bigger, and some parts of it may contain garbage - DownloadedSize int64 `json:"downloaded_size"` + meta + // Local path to the locally available file part; may be empty + Path string `json:"path"` + // True, if it is possible to download or generate the file + CanBeDownloaded bool `json:"can_be_downloaded"` + // True, if the file can be deleted + CanBeDeleted bool `json:"can_be_deleted"` + // True, if the file is currently being downloaded (or a local copy is being generated by some other means) + IsDownloadingActive bool `json:"is_downloading_active"` + // True, if the local copy is fully available + IsDownloadingCompleted bool `json:"is_downloading_completed"` + // Download will be started from this offset. downloaded_prefix_size is calculated from this offset + DownloadOffset int64 `json:"download_offset"` + // If is_downloading_completed is false, then only some prefix of the file starting from download_offset is ready to be read. downloaded_prefix_size is the size of that prefix in bytes + DownloadedPrefixSize int64 `json:"downloaded_prefix_size"` + // Total downloaded file size, in bytes. Can be used only for calculating download progress. The actual file size may be bigger, and some parts of it may contain garbage + DownloadedSize int64 `json:"downloaded_size"` } func (entity *LocalFile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub LocalFile + type stub LocalFile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*LocalFile) GetClass() string { - return ClassLocalFile + return ClassLocalFile } func (*LocalFile) GetType() string { - return TypeLocalFile + return TypeLocalFile } // Represents a remote file type RemoteFile struct { - meta - // Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. If the ID starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. If downloadFile/addFileToDownloads is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the application with the HTTP URL in the original_path and "#url#" as the conversion string. Application must generate the file by downloading it to the specified location - Id string `json:"id"` - // Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time - UniqueId string `json:"unique_id"` - // True, if the file is currently being uploaded (or a remote copy is being generated by some other means) - IsUploadingActive bool `json:"is_uploading_active"` - // True, if a remote copy is fully available - IsUploadingCompleted bool `json:"is_uploading_completed"` - // Size of the remote available part of the file, in bytes; 0 if unknown - UploadedSize int64 `json:"uploaded_size"` + meta + // Remote file identifier; may be empty. Can be used by the current user across application restarts or even from other devices. Uniquely identifies a file, but a file can have a lot of different valid identifiers. If the identifier starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known. If downloadFile/addFileToDownloads is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the application with the HTTP URL in the original_path and "#url#" as the conversion string. Application must generate the file by downloading it to the specified location + Id string `json:"id"` + // Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time + UniqueId string `json:"unique_id"` + // True, if the file is currently being uploaded (or a remote copy is being generated by some other means) + IsUploadingActive bool `json:"is_uploading_active"` + // True, if a remote copy is fully available + IsUploadingCompleted bool `json:"is_uploading_completed"` + // Size of the remote available part of the file, in bytes; 0 if unknown + UploadedSize int64 `json:"uploaded_size"` } func (entity *RemoteFile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub RemoteFile + type stub RemoteFile - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*RemoteFile) GetClass() string { - return ClassRemoteFile + return ClassRemoteFile } func (*RemoteFile) GetType() string { - return TypeRemoteFile + return TypeRemoteFile } // Represents a file type File struct { - meta - // Unique file identifier - Id int32 `json:"id"` - // File size, in bytes; 0 if unknown - Size int64 `json:"size"` - // Approximate file size in bytes in case the exact file size is unknown. Can be used to show download/upload progress - ExpectedSize int64 `json:"expected_size"` - // Information about the local copy of the file - Local *LocalFile `json:"local"` - // Information about the remote copy of the file - Remote *RemoteFile `json:"remote"` + meta + // Unique file identifier + Id int32 `json:"id"` + // File size, in bytes; 0 if unknown + Size int64 `json:"size"` + // Approximate file size in bytes in case the exact file size is unknown. Can be used to show download/upload progress + ExpectedSize int64 `json:"expected_size"` + // Information about the local copy of the file + Local *LocalFile `json:"local"` + // Information about the remote copy of the file + Remote *RemoteFile `json:"remote"` } func (entity *File) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub File + type stub File - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*File) GetClass() string { - return ClassFile + return ClassFile } func (*File) GetType() string { - return TypeFile + return TypeFile } -// A file defined by its unique ID +// A file defined by its unique identifier type InputFileId struct { - meta - // Unique file identifier - Id int32 `json:"id"` + meta + // Unique file identifier + Id int32 `json:"id"` } func (entity *InputFileId) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputFileId + type stub InputFileId - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputFileId) GetClass() string { - return ClassInputFile + return ClassInputFile } func (*InputFileId) GetType() string { - return TypeInputFileId + return TypeInputFileId } func (*InputFileId) InputFileType() string { - return TypeInputFileId + return TypeInputFileId } -// A file defined by its remote ID. The remote ID is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. 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 +// A file defined by its remote identifier. The remote identifier is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. 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 type InputFileRemote struct { - meta - // Remote file identifier - Id string `json:"id"` + meta + // Remote file identifier + Id string `json:"id"` } func (entity *InputFileRemote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputFileRemote + type stub InputFileRemote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputFileRemote) GetClass() string { - return ClassInputFile + return ClassInputFile } func (*InputFileRemote) GetType() string { - return TypeInputFileRemote + return TypeInputFileRemote } func (*InputFileRemote) InputFileType() string { - return TypeInputFileRemote + return TypeInputFileRemote } // A file defined by a local path type InputFileLocal struct { - meta - // Local path to the file - Path string `json:"path"` + meta + // Local path to the file + Path string `json:"path"` } func (entity *InputFileLocal) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputFileLocal + type stub InputFileLocal - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputFileLocal) GetClass() string { - return ClassInputFile + return ClassInputFile } func (*InputFileLocal) GetType() string { - return TypeInputFileLocal + return TypeInputFileLocal } func (*InputFileLocal) InputFileType() string { - return TypeInputFileLocal + return TypeInputFileLocal } // A file generated by the application type InputFileGenerated struct { - meta - // Local path to a file from which the file is generated; may be empty if there is no such 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 - ExpectedSize int64 `json:"expected_size"` + meta + // Local path to a file from which the file is generated; may be empty if there is no such 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 + ExpectedSize int64 `json:"expected_size"` } func (entity *InputFileGenerated) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub InputFileGenerated + type stub InputFileGenerated - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*InputFileGenerated) GetClass() string { - return ClassInputFile + return ClassInputFile } func (*InputFileGenerated) GetType() string { - return TypeInputFileGenerated + return TypeInputFileGenerated } func (*InputFileGenerated) InputFileType() string { - return TypeInputFileGenerated + return TypeInputFileGenerated } // Describes an image in JPEG format type PhotoSize struct { - meta - // Image type (see https://core.telegram.org/constructor/photoSize) - Type string `json:"type"` - // Information about the image file - Photo *File `json:"photo"` - // Image width - Width int32 `json:"width"` - // Image height - Height int32 `json:"height"` - // Sizes of progressive JPEG file prefixes, which can be used to preliminarily show the image; in bytes - ProgressiveSizes []int32 `json:"progressive_sizes"` + meta + // Image type (see https://core.telegram.org/constructor/photoSize) + Type string `json:"type"` + // Information about the image file + Photo *File `json:"photo"` + // Image width + Width int32 `json:"width"` + // Image height + Height int32 `json:"height"` + // Sizes of progressive JPEG file prefixes, which can be used to preliminarily show the image; in bytes + ProgressiveSizes []int32 `json:"progressive_sizes"` } func (entity *PhotoSize) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PhotoSize + type stub PhotoSize - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PhotoSize) GetClass() string { - return ClassPhotoSize + return ClassPhotoSize } func (*PhotoSize) GetType() string { - return TypePhotoSize + return TypePhotoSize } // Thumbnail image of a very poor quality and low resolution type Minithumbnail struct { - meta - // Thumbnail width, usually doesn't exceed 40 - Width int32 `json:"width"` - // Thumbnail height, usually doesn't exceed 40 - Height int32 `json:"height"` - // The thumbnail in JPEG format - Data []byte `json:"data"` + meta + // Thumbnail width, usually doesn't exceed 40 + Width int32 `json:"width"` + // Thumbnail height, usually doesn't exceed 40 + Height int32 `json:"height"` + // The thumbnail in JPEG format + Data []byte `json:"data"` } func (entity *Minithumbnail) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Minithumbnail + type stub Minithumbnail - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Minithumbnail) GetClass() string { - return ClassMinithumbnail + return ClassMinithumbnail } func (*Minithumbnail) GetType() string { - return TypeMinithumbnail + return TypeMinithumbnail } // The thumbnail is in JPEG format -type ThumbnailFormatJpeg struct { - meta +type ThumbnailFormatJpeg struct{ + meta } func (entity *ThumbnailFormatJpeg) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ThumbnailFormatJpeg + type stub ThumbnailFormatJpeg - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ThumbnailFormatJpeg) GetClass() string { - return ClassThumbnailFormat + return ClassThumbnailFormat } func (*ThumbnailFormatJpeg) GetType() string { - return TypeThumbnailFormatJpeg + return TypeThumbnailFormatJpeg } func (*ThumbnailFormatJpeg) ThumbnailFormatType() string { - return TypeThumbnailFormatJpeg + return TypeThumbnailFormatJpeg } -// The thumbnail is in static GIF format. It will be used only for some bot inline results -type ThumbnailFormatGif struct { - meta +// The thumbnail is in static GIF format. It will be used only for some bot inline query results +type ThumbnailFormatGif struct{ + meta } func (entity *ThumbnailFormatGif) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ThumbnailFormatGif + type stub ThumbnailFormatGif - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ThumbnailFormatGif) GetClass() string { - return ClassThumbnailFormat + return ClassThumbnailFormat } func (*ThumbnailFormatGif) GetType() string { - return TypeThumbnailFormatGif + return TypeThumbnailFormatGif } func (*ThumbnailFormatGif) ThumbnailFormatType() string { - return TypeThumbnailFormatGif + return TypeThumbnailFormatGif } // The thumbnail is in MPEG4 format. It will be used only for some animations and videos -type ThumbnailFormatMpeg4 struct { - meta +type ThumbnailFormatMpeg4 struct{ + meta } func (entity *ThumbnailFormatMpeg4) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ThumbnailFormatMpeg4 + type stub ThumbnailFormatMpeg4 - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ThumbnailFormatMpeg4) GetClass() string { - return ClassThumbnailFormat + return ClassThumbnailFormat } func (*ThumbnailFormatMpeg4) GetType() string { - return TypeThumbnailFormatMpeg4 + return TypeThumbnailFormatMpeg4 } func (*ThumbnailFormatMpeg4) ThumbnailFormatType() string { - return TypeThumbnailFormatMpeg4 + return TypeThumbnailFormatMpeg4 } // The thumbnail is in PNG format. It will be used only for background patterns -type ThumbnailFormatPng struct { - meta +type ThumbnailFormatPng struct{ + meta } func (entity *ThumbnailFormatPng) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ThumbnailFormatPng + type stub ThumbnailFormatPng - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ThumbnailFormatPng) GetClass() string { - return ClassThumbnailFormat + return ClassThumbnailFormat } func (*ThumbnailFormatPng) GetType() string { - return TypeThumbnailFormatPng + return TypeThumbnailFormatPng } func (*ThumbnailFormatPng) ThumbnailFormatType() string { - return TypeThumbnailFormatPng + return TypeThumbnailFormatPng } -// The thumbnail is in TGS format. It will be used only for TGS sticker sets -type ThumbnailFormatTgs struct { - meta +// The thumbnail is in TGS format. It will be used only for sticker sets +type ThumbnailFormatTgs struct{ + meta } func (entity *ThumbnailFormatTgs) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ThumbnailFormatTgs + type stub ThumbnailFormatTgs - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ThumbnailFormatTgs) GetClass() string { - return ClassThumbnailFormat + return ClassThumbnailFormat } func (*ThumbnailFormatTgs) GetType() string { - return TypeThumbnailFormatTgs + return TypeThumbnailFormatTgs } func (*ThumbnailFormatTgs) ThumbnailFormatType() string { - return TypeThumbnailFormatTgs + return TypeThumbnailFormatTgs } -// The thumbnail is in WEBM format. It will be used only for WEBM sticker sets -type ThumbnailFormatWebm struct { - meta +// The thumbnail is in WEBM format. It will be used only for sticker sets +type ThumbnailFormatWebm struct{ + meta } func (entity *ThumbnailFormatWebm) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ThumbnailFormatWebm + type stub ThumbnailFormatWebm - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ThumbnailFormatWebm) GetClass() string { - return ClassThumbnailFormat + return ClassThumbnailFormat } func (*ThumbnailFormatWebm) GetType() string { - return TypeThumbnailFormatWebm + return TypeThumbnailFormatWebm } func (*ThumbnailFormatWebm) ThumbnailFormatType() string { - return TypeThumbnailFormatWebm + return TypeThumbnailFormatWebm } -// The thumbnail is in WEBP format. It will be used only for some stickers -type ThumbnailFormatWebp struct { - meta +// The thumbnail is in WEBP format. It will be used only for some stickers and sticker sets +type ThumbnailFormatWebp struct{ + meta } func (entity *ThumbnailFormatWebp) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ThumbnailFormatWebp + type stub ThumbnailFormatWebp - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ThumbnailFormatWebp) GetClass() string { - return ClassThumbnailFormat + return ClassThumbnailFormat } func (*ThumbnailFormatWebp) GetType() string { - return TypeThumbnailFormatWebp + return TypeThumbnailFormatWebp } func (*ThumbnailFormatWebp) ThumbnailFormatType() string { - return TypeThumbnailFormatWebp + return TypeThumbnailFormatWebp } // Represents a thumbnail type Thumbnail struct { - meta - // Thumbnail format - Format ThumbnailFormat `json:"format"` - // Thumbnail width - Width int32 `json:"width"` - // Thumbnail height - Height int32 `json:"height"` - // The thumbnail - File *File `json:"file"` + meta + // Thumbnail format + Format ThumbnailFormat `json:"format"` + // Thumbnail width + Width int32 `json:"width"` + // Thumbnail height + Height int32 `json:"height"` + // The thumbnail + File *File `json:"file"` } func (entity *Thumbnail) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Thumbnail + type stub Thumbnail - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Thumbnail) GetClass() string { - return ClassThumbnail + return ClassThumbnail } func (*Thumbnail) GetType() string { - return TypeThumbnail + return TypeThumbnail } func (thumbnail *Thumbnail) UnmarshalJSON(data []byte) error { - var tmp struct { - Format json.RawMessage `json:"format"` - Width int32 `json:"width"` - Height int32 `json:"height"` - File *File `json:"file"` - } + var tmp struct { + Format json.RawMessage `json:"format"` + Width int32 `json:"width"` + Height int32 `json:"height"` + File *File `json:"file"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - thumbnail.Width = tmp.Width - thumbnail.Height = tmp.Height - thumbnail.File = tmp.File + thumbnail.Width = tmp.Width + thumbnail.Height = tmp.Height + thumbnail.File = tmp.File - fieldFormat, _ := UnmarshalThumbnailFormat(tmp.Format) - thumbnail.Format = fieldFormat + fieldFormat, _ := UnmarshalThumbnailFormat(tmp.Format) + thumbnail.Format = fieldFormat - return nil + return nil } // The mask is placed relatively to the forehead -type MaskPointForehead struct { - meta +type MaskPointForehead struct{ + meta } func (entity *MaskPointForehead) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MaskPointForehead + type stub MaskPointForehead - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MaskPointForehead) GetClass() string { - return ClassMaskPoint + return ClassMaskPoint } func (*MaskPointForehead) GetType() string { - return TypeMaskPointForehead + return TypeMaskPointForehead } func (*MaskPointForehead) MaskPointType() string { - return TypeMaskPointForehead + return TypeMaskPointForehead } // The mask is placed relatively to the eyes -type MaskPointEyes struct { - meta +type MaskPointEyes struct{ + meta } func (entity *MaskPointEyes) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MaskPointEyes + type stub MaskPointEyes - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MaskPointEyes) GetClass() string { - return ClassMaskPoint + return ClassMaskPoint } func (*MaskPointEyes) GetType() string { - return TypeMaskPointEyes + return TypeMaskPointEyes } func (*MaskPointEyes) MaskPointType() string { - return TypeMaskPointEyes + return TypeMaskPointEyes } // The mask is placed relatively to the mouth -type MaskPointMouth struct { - meta +type MaskPointMouth struct{ + meta } func (entity *MaskPointMouth) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MaskPointMouth + type stub MaskPointMouth - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MaskPointMouth) GetClass() string { - return ClassMaskPoint + return ClassMaskPoint } func (*MaskPointMouth) GetType() string { - return TypeMaskPointMouth + return TypeMaskPointMouth } func (*MaskPointMouth) MaskPointType() string { - return TypeMaskPointMouth + return TypeMaskPointMouth } // The mask is placed relatively to the chin -type MaskPointChin struct { - meta +type MaskPointChin struct{ + meta } func (entity *MaskPointChin) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MaskPointChin + type stub MaskPointChin - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MaskPointChin) GetClass() string { - return ClassMaskPoint + return ClassMaskPoint } func (*MaskPointChin) GetType() string { - return TypeMaskPointChin + return TypeMaskPointChin } func (*MaskPointChin) MaskPointType() string { - return TypeMaskPointChin + return TypeMaskPointChin } // Position on a photo where a mask is placed type MaskPosition struct { - meta - // Part of the face, relative to which the mask is placed - Point MaskPoint `json:"point"` - // Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position) - XShift float64 `json:"x_shift"` - // Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. (For example, 1.0 will place the mask just below the default mask position) - YShift float64 `json:"y_shift"` - // Mask scaling coefficient. (For example, 2.0 means a doubled size) - Scale float64 `json:"scale"` + meta + // Part of the face, relative to which the mask is placed + Point MaskPoint `json:"point"` + // Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position) + XShift float64 `json:"x_shift"` + // Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. (For example, 1.0 will place the mask just below the default mask position) + YShift float64 `json:"y_shift"` + // Mask scaling coefficient. (For example, 2.0 means a doubled size) + Scale float64 `json:"scale"` } func (entity *MaskPosition) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub MaskPosition + type stub MaskPosition - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*MaskPosition) GetClass() string { - return ClassMaskPosition + return ClassMaskPosition } func (*MaskPosition) GetType() string { - return TypeMaskPosition + return TypeMaskPosition } func (maskPosition *MaskPosition) UnmarshalJSON(data []byte) error { - var tmp struct { - Point json.RawMessage `json:"point"` - XShift float64 `json:"x_shift"` - YShift float64 `json:"y_shift"` - Scale float64 `json:"scale"` - } + var tmp struct { + Point json.RawMessage `json:"point"` + XShift float64 `json:"x_shift"` + YShift float64 `json:"y_shift"` + Scale float64 `json:"scale"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - maskPosition.XShift = tmp.XShift - maskPosition.YShift = tmp.YShift - maskPosition.Scale = tmp.Scale + maskPosition.XShift = tmp.XShift + maskPosition.YShift = tmp.YShift + maskPosition.Scale = tmp.Scale - fieldPoint, _ := UnmarshalMaskPoint(tmp.Point) - maskPosition.Point = fieldPoint + fieldPoint, _ := UnmarshalMaskPoint(tmp.Point) + maskPosition.Point = fieldPoint - return nil + return nil } // The sticker is an image in WEBP format -type StickerFormatWebp struct { - meta +type StickerFormatWebp struct{ + meta } func (entity *StickerFormatWebp) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerFormatWebp + type stub StickerFormatWebp - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerFormatWebp) GetClass() string { - return ClassStickerFormat + return ClassStickerFormat } func (*StickerFormatWebp) GetType() string { - return TypeStickerFormatWebp + return TypeStickerFormatWebp } func (*StickerFormatWebp) StickerFormatType() string { - return TypeStickerFormatWebp + return TypeStickerFormatWebp } // The sticker is an animation in TGS format -type StickerFormatTgs struct { - meta +type StickerFormatTgs struct{ + meta } func (entity *StickerFormatTgs) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerFormatTgs + type stub StickerFormatTgs - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerFormatTgs) GetClass() string { - return ClassStickerFormat + return ClassStickerFormat } func (*StickerFormatTgs) GetType() string { - return TypeStickerFormatTgs + return TypeStickerFormatTgs } func (*StickerFormatTgs) StickerFormatType() string { - return TypeStickerFormatTgs + return TypeStickerFormatTgs } // The sticker is a video in WEBM format -type StickerFormatWebm struct { - meta +type StickerFormatWebm struct{ + meta } func (entity *StickerFormatWebm) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerFormatWebm + type stub StickerFormatWebm - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerFormatWebm) GetClass() string { - return ClassStickerFormat + return ClassStickerFormat } func (*StickerFormatWebm) GetType() string { - return TypeStickerFormatWebm + return TypeStickerFormatWebm } func (*StickerFormatWebm) StickerFormatType() string { - return TypeStickerFormatWebm + return TypeStickerFormatWebm } // The sticker is a regular sticker -type StickerTypeRegular struct { - meta +type StickerTypeRegular struct{ + meta } func (entity *StickerTypeRegular) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerTypeRegular + type stub StickerTypeRegular - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerTypeRegular) GetClass() string { - return ClassStickerType + return ClassStickerType } func (*StickerTypeRegular) GetType() string { - return TypeStickerTypeRegular + return TypeStickerTypeRegular } func (*StickerTypeRegular) StickerTypeType() string { - return TypeStickerTypeRegular + return TypeStickerTypeRegular } // The sticker is a mask in WEBP format to be placed on photos or videos -type StickerTypeMask struct { - meta +type StickerTypeMask struct{ + meta } func (entity *StickerTypeMask) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerTypeMask + type stub StickerTypeMask - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerTypeMask) GetClass() string { - return ClassStickerType + return ClassStickerType } func (*StickerTypeMask) GetType() string { - return TypeStickerTypeMask + return TypeStickerTypeMask } func (*StickerTypeMask) StickerTypeType() string { - return TypeStickerTypeMask + return TypeStickerTypeMask } // The sticker is a custom emoji to be used inside message text and caption -type StickerTypeCustomEmoji struct { - meta +type StickerTypeCustomEmoji struct{ + meta } func (entity *StickerTypeCustomEmoji) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerTypeCustomEmoji + type stub StickerTypeCustomEmoji - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerTypeCustomEmoji) GetClass() string { - return ClassStickerType + return ClassStickerType } func (*StickerTypeCustomEmoji) GetType() string { - return TypeStickerTypeCustomEmoji + return TypeStickerTypeCustomEmoji } func (*StickerTypeCustomEmoji) StickerTypeType() string { - return TypeStickerTypeCustomEmoji + return TypeStickerTypeCustomEmoji } // The sticker is a regular sticker type StickerFullTypeRegular struct { - meta - // Premium animation of the sticker; may be null. If present, only Telegram Premium users can use the sticker - PremiumAnimation *File `json:"premium_animation"` + meta + // Premium animation of the sticker; may be null. If present, only Telegram Premium users can use the sticker + PremiumAnimation *File `json:"premium_animation"` } func (entity *StickerFullTypeRegular) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerFullTypeRegular + type stub StickerFullTypeRegular - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerFullTypeRegular) GetClass() string { - return ClassStickerFullType + return ClassStickerFullType } func (*StickerFullTypeRegular) GetType() string { - return TypeStickerFullTypeRegular + return TypeStickerFullTypeRegular } func (*StickerFullTypeRegular) StickerFullTypeType() string { - return TypeStickerFullTypeRegular + return TypeStickerFullTypeRegular } // The sticker is a mask in WEBP format to be placed on photos or videos type StickerFullTypeMask struct { - meta - // Position where the mask is placed; may be null - MaskPosition *MaskPosition `json:"mask_position"` + meta + // Position where the mask is placed; may be null + MaskPosition *MaskPosition `json:"mask_position"` } func (entity *StickerFullTypeMask) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerFullTypeMask + type stub StickerFullTypeMask - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerFullTypeMask) GetClass() string { - return ClassStickerFullType + return ClassStickerFullType } func (*StickerFullTypeMask) GetType() string { - return TypeStickerFullTypeMask + return TypeStickerFullTypeMask } func (*StickerFullTypeMask) StickerFullTypeType() string { - return TypeStickerFullTypeMask + return TypeStickerFullTypeMask } // The sticker is a custom emoji to be used inside message text and caption. Currently, only Telegram Premium users can use custom emoji type StickerFullTypeCustomEmoji struct { - meta - // Identifier of the custom emoji - CustomEmojiId JsonInt64 `json:"custom_emoji_id"` - // True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, or another appropriate color in other places - NeedsRepainting bool `json:"needs_repainting"` + meta + // Identifier of the custom emoji + CustomEmojiId JsonInt64 `json:"custom_emoji_id"` + // True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places + NeedsRepainting bool `json:"needs_repainting"` } func (entity *StickerFullTypeCustomEmoji) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub StickerFullTypeCustomEmoji + type stub StickerFullTypeCustomEmoji - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*StickerFullTypeCustomEmoji) GetClass() string { - return ClassStickerFullType + return ClassStickerFullType } func (*StickerFullTypeCustomEmoji) GetType() string { - return TypeStickerFullTypeCustomEmoji + return TypeStickerFullTypeCustomEmoji } func (*StickerFullTypeCustomEmoji) StickerFullTypeType() string { - return TypeStickerFullTypeCustomEmoji + return TypeStickerFullTypeCustomEmoji } // Represents a closed vector path. The path begins at the end point of the last command type ClosedVectorPath struct { - meta - // List of vector path commands - Commands []VectorPathCommand `json:"commands"` + meta + // List of vector path commands + Commands []VectorPathCommand `json:"commands"` } func (entity *ClosedVectorPath) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub ClosedVectorPath + type stub ClosedVectorPath - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*ClosedVectorPath) GetClass() string { - return ClassClosedVectorPath + return ClassClosedVectorPath } func (*ClosedVectorPath) GetType() string { - return TypeClosedVectorPath + return TypeClosedVectorPath } func (closedVectorPath *ClosedVectorPath) UnmarshalJSON(data []byte) error { - var tmp struct { - Commands []json.RawMessage `json:"commands"` - } + var tmp struct { + Commands []json.RawMessage `json:"commands"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - fieldCommands, _ := UnmarshalListOfVectorPathCommand(tmp.Commands) - closedVectorPath.Commands = fieldCommands + fieldCommands, _ := UnmarshalListOfVectorPathCommand(tmp.Commands) + closedVectorPath.Commands = fieldCommands - return nil + return nil } // Describes one answer option of a poll type PollOption struct { - meta - // Option text; 1-100 characters - Text string `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 - VotePercentage int32 `json:"vote_percentage"` - // True, if the option was chosen by the user - IsChosen bool `json:"is_chosen"` - // True, if the option is being chosen by a pending setPollAnswer request - IsBeingChosen bool `json:"is_being_chosen"` + meta + // Option text; 1-100 characters + Text string `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 + VotePercentage int32 `json:"vote_percentage"` + // True, if the option was chosen by the user + IsChosen bool `json:"is_chosen"` + // True, if the option is being chosen by a pending setPollAnswer request + IsBeingChosen bool `json:"is_being_chosen"` } func (entity *PollOption) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PollOption + type stub PollOption - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PollOption) GetClass() string { - return ClassPollOption + return ClassPollOption } func (*PollOption) GetType() string { - return TypePollOption + return TypePollOption } // A regular poll type PollTypeRegular struct { - meta - // True, if multiple answer options can be chosen simultaneously - AllowMultipleAnswers bool `json:"allow_multiple_answers"` + meta + // True, if multiple answer options can be chosen simultaneously + AllowMultipleAnswers bool `json:"allow_multiple_answers"` } func (entity *PollTypeRegular) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PollTypeRegular + type stub PollTypeRegular - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PollTypeRegular) GetClass() string { - return ClassPollType + return ClassPollType } func (*PollTypeRegular) GetType() string { - return TypePollTypeRegular + return TypePollTypeRegular } func (*PollTypeRegular) PollTypeType() string { - return TypePollTypeRegular + return TypePollTypeRegular } // A poll in quiz mode, which has exactly one correct answer option and can be answered only once type PollTypeQuiz struct { - meta - // 0-based identifier of the correct answer option; -1 for a yet unanswered poll - CorrectOptionId int32 `json:"correct_option_id"` - // Text that is shown when the user chooses an incorrect answer or taps on the lamp icon; 0-200 characters with at most 2 line feeds; empty for a yet unanswered poll - Explanation *FormattedText `json:"explanation"` + meta + // 0-based identifier of the correct answer option; -1 for a yet unanswered poll + CorrectOptionId int32 `json:"correct_option_id"` + // Text that is shown when the user chooses an incorrect answer or taps on the lamp icon; 0-200 characters with at most 2 line feeds; empty for a yet unanswered poll + Explanation *FormattedText `json:"explanation"` } func (entity *PollTypeQuiz) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub PollTypeQuiz + type stub PollTypeQuiz - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*PollTypeQuiz) GetClass() string { - return ClassPollType + return ClassPollType } func (*PollTypeQuiz) GetType() string { - return TypePollTypeQuiz + return TypePollTypeQuiz } func (*PollTypeQuiz) PollTypeType() string { - return TypePollTypeQuiz + return TypePollTypeQuiz } // Describes an animation file. The animation must be encoded in GIF or MPEG4 format type Animation struct { - meta - // Duration of the animation, in seconds; as defined by the sender - Duration int32 `json:"duration"` - // Width of the animation - Width int32 `json:"width"` - // Height of the animation - Height int32 `json:"height"` - // Original name of the file; as defined by the sender - FileName string `json:"file_name"` - // MIME type of the file, usually "image/gif" or "video/mp4" - MimeType string `json:"mime_type"` - // True, if stickers were added to the animation. The list of corresponding sticker set can be received using getAttachedStickerSets - HasStickers bool `json:"has_stickers"` - // Animation minithumbnail; may be null - Minithumbnail *Minithumbnail `json:"minithumbnail"` - // Animation thumbnail in JPEG or MPEG4 format; may be null - Thumbnail *Thumbnail `json:"thumbnail"` - // File containing the animation - Animation *File `json:"animation"` + meta + // Duration of the animation, in seconds; as defined by the sender + Duration int32 `json:"duration"` + // Width of the animation + Width int32 `json:"width"` + // Height of the animation + Height int32 `json:"height"` + // Original name of the file; as defined by the sender + FileName string `json:"file_name"` + // MIME type of the file, usually "image/gif" or "video/mp4" + MimeType string `json:"mime_type"` + // True, if stickers were added to the animation. The list of corresponding sticker set can be received using getAttachedStickerSets + HasStickers bool `json:"has_stickers"` + // Animation minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Animation thumbnail in JPEG or MPEG4 format; may be null + Thumbnail *Thumbnail `json:"thumbnail"` + // File containing the animation + Animation *File `json:"animation"` } func (entity *Animation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Animation + type stub Animation - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Animation) GetClass() string { - return ClassAnimation + return ClassAnimation } func (*Animation) GetType() string { - return TypeAnimation + return TypeAnimation } // Describes an audio file. Audio is usually in MP3 or M4A format type Audio struct { - meta - // Duration of the audio, in seconds; as defined by the sender - Duration int32 `json:"duration"` - // Title of the audio; as defined by the sender - Title string `json:"title"` - // Performer of the audio; as defined by the sender - Performer string `json:"performer"` - // Original name of the file; as defined by the sender - FileName string `json:"file_name"` - // The MIME type of the file; as defined by the sender - 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 - 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"` - // File containing the audio - Audio *File `json:"audio"` + meta + // Duration of the audio, in seconds; as defined by the sender + Duration int32 `json:"duration"` + // Title of the audio; as defined by the sender + Title string `json:"title"` + // Performer of the audio; as defined by the sender + Performer string `json:"performer"` + // Original name of the file; as defined by the sender + FileName string `json:"file_name"` + // The MIME type of the file; as defined by the sender + 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 + 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"` + // File containing the audio + Audio *File `json:"audio"` } func (entity *Audio) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Audio + type stub Audio - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Audio) GetClass() string { - return ClassAudio + return ClassAudio } func (*Audio) GetType() string { - return TypeAudio + return TypeAudio } // Describes a document of any type type Document struct { - meta - // Original name of the file; as defined by the sender - FileName string `json:"file_name"` - // MIME type of the file; as defined by the sender - MimeType string `json:"mime_type"` - // Document minithumbnail; may be null - Minithumbnail *Minithumbnail `json:"minithumbnail"` - // Document thumbnail in JPEG or PNG format (PNG will be used only for background patterns); as defined by the sender; may be null - Thumbnail *Thumbnail `json:"thumbnail"` - // File containing the document - Document *File `json:"document"` + meta + // Original name of the file; as defined by the sender + FileName string `json:"file_name"` + // MIME type of the file; as defined by the sender + MimeType string `json:"mime_type"` + // Document minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Document thumbnail in JPEG or PNG format (PNG will be used only for background patterns); as defined by the sender; may be null + Thumbnail *Thumbnail `json:"thumbnail"` + // File containing the document + Document *File `json:"document"` } func (entity *Document) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Document + type stub Document - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Document) GetClass() string { - return ClassDocument + return ClassDocument } func (*Document) GetType() string { - return TypeDocument + return TypeDocument } // Describes a photo type Photo struct { - meta - // True, if stickers were added to the photo. The list of corresponding sticker sets can be received using getAttachedStickerSets - HasStickers bool `json:"has_stickers"` - // Photo minithumbnail; may be null - Minithumbnail *Minithumbnail `json:"minithumbnail"` - // Available variants of the photo, in different sizes - Sizes []*PhotoSize `json:"sizes"` + meta + // True, if stickers were added to the photo. The list of corresponding sticker sets can be received using getAttachedStickerSets + HasStickers bool `json:"has_stickers"` + // Photo minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Available variants of the photo, in different sizes + Sizes []*PhotoSize `json:"sizes"` } func (entity *Photo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Photo + type stub Photo - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Photo) GetClass() string { - return ClassPhoto + return ClassPhoto } func (*Photo) GetType() string { - return TypePhoto + return TypePhoto } // Describes a sticker type Sticker struct { - meta - // The identifier of the sticker set to which the sticker belongs; 0 if none - SetId JsonInt64 `json:"set_id"` - // Sticker width; as defined by the sender - Width int32 `json:"width"` - // Sticker height; as defined by the sender - Height int32 `json:"height"` - // Emoji corresponding to the sticker - 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 - Sticker *File `json:"sticker"` + meta + // Unique sticker identifier within the set; 0 if none + Id JsonInt64 `json:"id"` + // Identifier of the sticker set to which the sticker belongs; 0 if none + SetId JsonInt64 `json:"set_id"` + // Sticker width; as defined by the sender + Width int32 `json:"width"` + // Sticker height; as defined by the sender + Height int32 `json:"height"` + // Emoji corresponding to the sticker + 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 + Sticker *File `json:"sticker"` } func (entity *Sticker) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Sticker + type stub Sticker - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Sticker) GetClass() string { - return ClassSticker + return ClassSticker } func (*Sticker) GetType() string { - return TypeSticker + return TypeSticker } func (sticker *Sticker) UnmarshalJSON(data []byte) error { - var tmp struct { - SetId JsonInt64 `json:"set_id"` - Width int32 `json:"width"` - Height int32 `json:"height"` - 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"` - } + var tmp struct { + Id JsonInt64 `json:"id"` + SetId JsonInt64 `json:"set_id"` + Width int32 `json:"width"` + Height int32 `json:"height"` + 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"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - sticker.SetId = tmp.SetId - sticker.Width = tmp.Width - sticker.Height = tmp.Height - sticker.Emoji = tmp.Emoji - sticker.Outline = tmp.Outline - sticker.Thumbnail = tmp.Thumbnail - sticker.Sticker = tmp.Sticker + sticker.Id = tmp.Id + sticker.SetId = tmp.SetId + sticker.Width = tmp.Width + sticker.Height = tmp.Height + sticker.Emoji = tmp.Emoji + sticker.Outline = tmp.Outline + sticker.Thumbnail = tmp.Thumbnail + sticker.Sticker = tmp.Sticker - fieldFormat, _ := UnmarshalStickerFormat(tmp.Format) - sticker.Format = fieldFormat + fieldFormat, _ := UnmarshalStickerFormat(tmp.Format) + sticker.Format = fieldFormat - fieldFullType, _ := UnmarshalStickerFullType(tmp.FullType) - sticker.FullType = fieldFullType + fieldFullType, _ := UnmarshalStickerFullType(tmp.FullType) + sticker.FullType = fieldFullType - return nil + return nil } // Describes a video file type Video struct { - meta - // Duration of the video, in seconds; as defined by the sender - Duration int32 `json:"duration"` - // Video width; as defined by the sender - Width int32 `json:"width"` - // Video height; as defined by the sender - Height int32 `json:"height"` - // Original name of the file; as defined by the sender - FileName string `json:"file_name"` - // MIME type of the file; as defined by the sender - 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 - SupportsStreaming bool `json:"supports_streaming"` - // Video minithumbnail; may be null - Minithumbnail *Minithumbnail `json:"minithumbnail"` - // Video thumbnail in JPEG or MPEG4 format; as defined by the sender; may be null - Thumbnail *Thumbnail `json:"thumbnail"` - // File containing the video - Video *File `json:"video"` + meta + // Duration of the video, in seconds; as defined by the sender + Duration int32 `json:"duration"` + // Video width; as defined by the sender + Width int32 `json:"width"` + // Video height; as defined by the sender + Height int32 `json:"height"` + // Original name of the file; as defined by the sender + FileName string `json:"file_name"` + // MIME type of the file; as defined by the sender + 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 + SupportsStreaming bool `json:"supports_streaming"` + // Video minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Video thumbnail in JPEG or MPEG4 format; as defined by the sender; may be null + Thumbnail *Thumbnail `json:"thumbnail"` + // File containing the video + Video *File `json:"video"` } func (entity *Video) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Video + type stub Video - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Video) GetClass() string { - return ClassVideo + return ClassVideo } func (*Video) GetType() string { - return TypeVideo + return TypeVideo } // Describes a video note. The video must be equal in width and height, cropped to a circle, and stored in MPEG4 format type VideoNote struct { - meta - // Duration of the video, in seconds; as defined by the sender - Duration int32 `json:"duration"` - // A waveform representation of the video note's audio in 5-bit format; may be empty if unknown - Waveform []byte `json:"waveform"` - // Video width and height; as defined by the sender - Length int32 `json:"length"` - // Video minithumbnail; may be null - Minithumbnail *Minithumbnail `json:"minithumbnail"` - // Video thumbnail in JPEG format; as defined by the sender; may be null - Thumbnail *Thumbnail `json:"thumbnail"` - // Result of speech recognition in the video note; may be null - SpeechRecognitionResult SpeechRecognitionResult `json:"speech_recognition_result"` - // File containing the video - Video *File `json:"video"` + meta + // Duration of the video, in seconds; as defined by the sender + Duration int32 `json:"duration"` + // A waveform representation of the video note's audio in 5-bit format; may be empty if unknown + Waveform []byte `json:"waveform"` + // Video width and height; as defined by the sender + Length int32 `json:"length"` + // Video minithumbnail; may be null + Minithumbnail *Minithumbnail `json:"minithumbnail"` + // Video thumbnail in JPEG format; as defined by the sender; may be null + Thumbnail *Thumbnail `json:"thumbnail"` + // Result of speech recognition in the video note; may be null + SpeechRecognitionResult SpeechRecognitionResult `json:"speech_recognition_result"` + // File containing the video + Video *File `json:"video"` } func (entity *VideoNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub VideoNote + type stub VideoNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*VideoNote) GetClass() string { - return ClassVideoNote + return ClassVideoNote } func (*VideoNote) GetType() string { - return TypeVideoNote + return TypeVideoNote } func (videoNote *VideoNote) UnmarshalJSON(data []byte) error { - var tmp struct { - Duration int32 `json:"duration"` - Waveform []byte `json:"waveform"` - Length int32 `json:"length"` - Minithumbnail *Minithumbnail `json:"minithumbnail"` - Thumbnail *Thumbnail `json:"thumbnail"` - SpeechRecognitionResult json.RawMessage `json:"speech_recognition_result"` - Video *File `json:"video"` - } + var tmp struct { + Duration int32 `json:"duration"` + Waveform []byte `json:"waveform"` + Length int32 `json:"length"` + Minithumbnail *Minithumbnail `json:"minithumbnail"` + Thumbnail *Thumbnail `json:"thumbnail"` + SpeechRecognitionResult json.RawMessage `json:"speech_recognition_result"` + Video *File `json:"video"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - videoNote.Duration = tmp.Duration - videoNote.Waveform = tmp.Waveform - videoNote.Length = tmp.Length - videoNote.Minithumbnail = tmp.Minithumbnail - videoNote.Thumbnail = tmp.Thumbnail - videoNote.Video = tmp.Video + videoNote.Duration = tmp.Duration + videoNote.Waveform = tmp.Waveform + videoNote.Length = tmp.Length + videoNote.Minithumbnail = tmp.Minithumbnail + videoNote.Thumbnail = tmp.Thumbnail + videoNote.Video = tmp.Video - fieldSpeechRecognitionResult, _ := UnmarshalSpeechRecognitionResult(tmp.SpeechRecognitionResult) - videoNote.SpeechRecognitionResult = fieldSpeechRecognitionResult + fieldSpeechRecognitionResult, _ := UnmarshalSpeechRecognitionResult(tmp.SpeechRecognitionResult) + videoNote.SpeechRecognitionResult = fieldSpeechRecognitionResult - return nil + 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 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 - MimeType string `json:"mime_type"` - // Result of speech recognition in the voice note; may be null - SpeechRecognitionResult SpeechRecognitionResult `json:"speech_recognition_result"` - // File containing the voice note - Voice *File `json:"voice"` + 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 + MimeType string `json:"mime_type"` + // Result of speech recognition in the voice note; may be null + SpeechRecognitionResult SpeechRecognitionResult `json:"speech_recognition_result"` + // File containing the voice note + Voice *File `json:"voice"` } func (entity *VoiceNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub VoiceNote + type stub VoiceNote - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*VoiceNote) GetClass() string { - return ClassVoiceNote + return ClassVoiceNote } func (*VoiceNote) GetType() string { - return TypeVoiceNote + return TypeVoiceNote } func (voiceNote *VoiceNote) UnmarshalJSON(data []byte) error { - var tmp struct { - Duration int32 `json:"duration"` - Waveform []byte `json:"waveform"` - MimeType string `json:"mime_type"` - SpeechRecognitionResult json.RawMessage `json:"speech_recognition_result"` - Voice *File `json:"voice"` - } + var tmp struct { + Duration int32 `json:"duration"` + Waveform []byte `json:"waveform"` + MimeType string `json:"mime_type"` + SpeechRecognitionResult json.RawMessage `json:"speech_recognition_result"` + Voice *File `json:"voice"` + } - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } - voiceNote.Duration = tmp.Duration - voiceNote.Waveform = tmp.Waveform - voiceNote.MimeType = tmp.MimeType - voiceNote.Voice = tmp.Voice + voiceNote.Duration = tmp.Duration + voiceNote.Waveform = tmp.Waveform + voiceNote.MimeType = tmp.MimeType + voiceNote.Voice = tmp.Voice - fieldSpeechRecognitionResult, _ := UnmarshalSpeechRecognitionResult(tmp.SpeechRecognitionResult) - voiceNote.SpeechRecognitionResult = fieldSpeechRecognitionResult + fieldSpeechRecognitionResult, _ := UnmarshalSpeechRecognitionResult(tmp.SpeechRecognitionResult) + voiceNote.SpeechRecognitionResult = fieldSpeechRecognitionResult - return nil + return nil } // 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 *Sticker `json:"sticker"` - // Expected width of the sticker, which can be used if the sticker is null - StickerWidth int32 `json:"sticker_width"` - // Expected height of the sticker, which can be used if the sticker is null - StickerHeight int32 `json:"sticker_height"` - // Emoji modifier fitzpatrick type; 0-6; 0 if none - FitzpatrickType int32 `json:"fitzpatrick_type"` - // File containing the sound to be played when the sticker is clicked; may be null. The sound is encoded with the Opus codec, and stored inside an OGG container - Sound *File `json:"sound"` + meta + // 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"` + // Expected height of the sticker, which can be used if the sticker is null + StickerHeight int32 `json:"sticker_height"` + // Emoji modifier fitzpatrick type; 0-6; 0 if none + FitzpatrickType int32 `json:"fitzpatrick_type"` + // File containing the sound to be played when the sticker is clicked; may be null. The sound is encoded with the Opus codec, and stored inside an OGG container + Sound *File `json:"sound"` } func (entity *AnimatedEmoji) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub AnimatedEmoji + type stub AnimatedEmoji - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*AnimatedEmoji) GetClass() string { - return ClassAnimatedEmoji + return ClassAnimatedEmoji } func (*AnimatedEmoji) GetType() string { - return TypeAnimatedEmoji + return TypeAnimatedEmoji } // Describes a user contact type Contact struct { - meta - // Phone number of the user - PhoneNumber string `json:"phone_number"` - // First name of the user; 1-255 characters in length - FirstName string `json:"first_name"` - // Last name of the user - LastName string `json:"last_name"` - // Additional data about the user in a form of vCard; 0-2048 bytes in length - Vcard string `json:"vcard"` - // Identifier of the user, if known; otherwise 0 - UserId int64 `json:"user_id"` + meta + // Phone number of the user + PhoneNumber string `json:"phone_number"` + // First name of the user; 1-255 characters in length + FirstName string `json:"first_name"` + // Last name of the user + LastName string `json:"last_name"` + // Additional data about the user in a form of vCard; 0-2048 bytes in length + Vcard string `json:"vcard"` + // Identifier of the user, if known; 0 otherwise + UserId int64 `json:"user_id"` } func (entity *Contact) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Contact + type stub Contact - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Contact) GetClass() string { - return ClassContact + return ClassContact } func (*Contact) GetType() string { - return TypeContact + return TypeContact } // Describes a location on planet Earth type Location struct { - meta - // Latitude of the location in degrees; as defined by the sender - Latitude float64 `json:"latitude"` - // Longitude of the location, in degrees; as defined by the sender - Longitude float64 `json:"longitude"` - // The estimated horizontal accuracy of the location, in meters; as defined by the sender. 0 if unknown - HorizontalAccuracy float64 `json:"horizontal_accuracy"` + meta + // Latitude of the location in degrees; as defined by the sender + Latitude float64 `json:"latitude"` + // Longitude of the location, in degrees; as defined by the sender + Longitude float64 `json:"longitude"` + // The estimated horizontal accuracy of the location, in meters; as defined by the sender. 0 if unknown + HorizontalAccuracy float64 `json:"horizontal_accuracy"` } func (entity *Location) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Location + type stub Location - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Location) GetClass() string { - return ClassLocation + return ClassLocation } func (*Location) GetType() string { - return TypeLocation + return TypeLocation } // Describes a venue type Venue struct { - meta - // Venue location; as defined by the sender - Location *Location `json:"location"` - // Venue name; as defined by the sender - Title string `json:"title"` - // Venue address; as defined by the sender - Address string `json:"address"` - // Provider of the venue database; as defined by the sender. Currently, only "foursquare" and "gplaces" (Google Places) need to be supported - Provider string `json:"provider"` - // Identifier of the venue in the provider database; as defined by the sender - Id string `json:"id"` - // Type of the venue in the provider database; as defined by the sender - Type string `json:"type"` + meta + // Venue location; as defined by the sender + Location *Location `json:"location"` + // Venue name; as defined by the sender + Title string `json:"title"` + // Venue address; as defined by the sender + Address string `json:"address"` + // Provider of the venue database; as defined by the sender. Currently, only "foursquare" and "gplaces" (Google Places) need to be supported + Provider string `json:"provider"` + // Identifier of the venue in the provider database; as defined by the sender + Id string `json:"id"` + // Type of the venue in the provider database; as defined by the sender + Type string `json:"type"` } func (entity *Venue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Venue + type stub Venue - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Venue) GetClass() string { - return ClassVenue + return ClassVenue } func (*Venue) GetType() string { - return TypeVenue + return TypeVenue } -// Describes a game +// Describes a game. Use getInternalLink with internalLinkTypeGame to share the game type Game struct { - meta - // Unique game identifier - Id JsonInt64 `json:"id"` - // Game short name. To share a game use the URL https://t.me/{bot_username}?game={game_short_name} - ShortName string `json:"short_name"` - // Game title - Title string `json:"title"` - // Game text, usually containing scoreboards for a game - Text *FormattedText `json:"text"` - // Game description - Description string `json:"description"` - // Game photo - Photo *Photo `json:"photo"` - // Game animation; may be null - Animation *Animation `json:"animation"` + meta + // Unique game identifier + Id JsonInt64 `json:"id"` + // Game short name + ShortName string `json:"short_name"` + // Game title + Title string `json:"title"` + // Game text, usually containing scoreboards for a game + Text *FormattedText `json:"text"` + // Game description + Description string `json:"description"` + // Game photo + Photo *Photo `json:"photo"` + // Game animation; may be null + Animation *Animation `json:"animation"` } func (entity *Game) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Game + type stub Game - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Game) GetClass() string { - return ClassGame + return ClassGame } func (*Game) GetType() string { - return TypeGame + return TypeGame +} + +// Describes a Web App. Use getInternalLink with internalLinkTypeWebApp to share the Web App +type WebApp struct { + meta + // Web App short name + ShortName string `json:"short_name"` + // Web App title + Title string `json:"title"` + // Web App description + Description string `json:"description"` + // Web App photo + Photo *Photo `json:"photo"` + // Web App animation; may be null + Animation *Animation `json:"animation"` +} + +func (entity *WebApp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub WebApp + + return json.Marshal((*stub)(entity)) +} + +func (*WebApp) GetClass() string { + return ClassWebApp +} + +func (*WebApp) GetType() string { + return TypeWebApp } // Describes a poll type Poll struct { - meta - // Unique poll identifier - Id JsonInt64 `json:"id"` - // Poll question; 1-300 characters - Question string `json:"question"` - // List of poll answer options - Options []*PollOption `json:"options"` - // Total number of voters, participating in the poll - TotalVoterCount int32 `json:"total_voter_count"` - // User identifiers of recent voters, if the poll is non-anonymous - RecentVoterUserIds []int64 `json:"recent_voter_user_ids"` - // True, if the poll is anonymous - IsAnonymous bool `json:"is_anonymous"` - // Type of the poll - Type PollType `json:"type"` - // Amount of time the poll will be active after creation, in seconds - OpenPeriod int32 `json:"open_period"` - // Point in time (Unix timestamp) when the poll will automatically be closed - CloseDate int32 `json:"close_date"` - // True, if the poll is closed - IsClosed bool `json:"is_closed"` + meta + // Unique poll identifier + Id JsonInt64 `json:"id"` + // Poll question; 1-300 characters + Question string `json:"question"` + // List of poll answer options + Options []*PollOption `json:"options"` + // Total number of voters, participating in the poll + TotalVoterCount int32 `json:"total_voter_count"` + // Identifiers of recent voters, if the poll is non-anonymous + RecentVoterIds []MessageSender `json:"recent_voter_ids"` + // True, if the poll is anonymous + IsAnonymous bool `json:"is_anonymous"` + // Type of the poll + Type PollType `json:"type"` + // Amount of time the poll will be active after creation, in seconds + OpenPeriod int32 `json:"open_period"` + // Point in time (Unix timestamp) when the poll will automatically be closed + CloseDate int32 `json:"close_date"` + // True, if the poll is closed + IsClosed bool `json:"is_closed"` } func (entity *Poll) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() + entity.meta.Type = entity.GetType() - type stub Poll + type stub Poll - return json.Marshal((*stub)(entity)) + return json.Marshal((*stub)(entity)) } func (*Poll) GetClass() string { - return ClassPoll + return ClassPoll } func (*Poll) GetType() string { - return TypePoll + return TypePoll } func (poll *Poll) UnmarshalJSON(data []byte) error { - var tmp struct { - Id JsonInt64 `json:"id"` - Question string `json:"question"` - Options []*PollOption `json:"options"` - TotalVoterCount int32 `json:"total_voter_count"` - RecentVoterUserIds []int64 `json:"recent_voter_user_ids"` - IsAnonymous bool `json:"is_anonymous"` - Type json.RawMessage `json:"type"` - OpenPeriod int32 `json:"open_period"` - CloseDate int32 `json:"close_date"` - IsClosed bool `json:"is_closed"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - poll.Id = tmp.Id - poll.Question = tmp.Question - poll.Options = tmp.Options - poll.TotalVoterCount = tmp.TotalVoterCount - poll.RecentVoterUserIds = tmp.RecentVoterUserIds - poll.IsAnonymous = tmp.IsAnonymous - poll.OpenPeriod = tmp.OpenPeriod - poll.CloseDate = tmp.CloseDate - poll.IsClosed = tmp.IsClosed - - fieldType, _ := UnmarshalPollType(tmp.Type) - poll.Type = fieldType - - return nil -} - -// Describes a user profile photo -type ProfilePhoto struct { - meta - // Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of user profile photos - Id JsonInt64 `json:"id"` - // A small (160x160) user profile photo. The file can be downloaded only before the photo is changed - Small *File `json:"small"` - // A big (640x640) user profile photo. The file can be downloaded only before the photo is changed - Big *File `json:"big"` - // User profile photo minithumbnail; may be null - Minithumbnail *Minithumbnail `json:"minithumbnail"` - // True, if the photo has animated variant - HasAnimation bool `json:"has_animation"` - // True, if the photo is visible only for the current user - IsPersonal bool `json:"is_personal"` -} - -func (entity *ProfilePhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ProfilePhoto - - return json.Marshal((*stub)(entity)) -} - -func (*ProfilePhoto) GetClass() string { - return ClassProfilePhoto -} - -func (*ProfilePhoto) GetType() string { - return TypeProfilePhoto -} - -// Contains basic information about the photo of a chat -type ChatPhotoInfo struct { - meta - // A small (160x160) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed - Small *File `json:"small"` - // A big (640x640) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed - Big *File `json:"big"` - // Chat photo minithumbnail; may be null - Minithumbnail *Minithumbnail `json:"minithumbnail"` - // True, if the photo has animated variant - HasAnimation bool `json:"has_animation"` - // True, if the photo is visible only for the current user - IsPersonal bool `json:"is_personal"` -} - -func (entity *ChatPhotoInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatPhotoInfo - - return json.Marshal((*stub)(entity)) -} - -func (*ChatPhotoInfo) GetClass() string { - return ClassChatPhotoInfo -} - -func (*ChatPhotoInfo) GetType() string { - return TypeChatPhotoInfo -} - -// A regular user -type UserTypeRegular struct { - meta -} - -func (entity *UserTypeRegular) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UserTypeRegular - - return json.Marshal((*stub)(entity)) -} - -func (*UserTypeRegular) GetClass() string { - return ClassUserType -} - -func (*UserTypeRegular) GetType() string { - return TypeUserTypeRegular -} - -func (*UserTypeRegular) UserTypeType() string { - return TypeUserTypeRegular -} - -// A deleted user or deleted bot. No information on the user besides the user identifier is available. It is not possible to perform any active actions on this type of user -type UserTypeDeleted struct { - meta -} - -func (entity *UserTypeDeleted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UserTypeDeleted - - return json.Marshal((*stub)(entity)) -} - -func (*UserTypeDeleted) GetClass() string { - return ClassUserType -} - -func (*UserTypeDeleted) GetType() string { - return TypeUserTypeDeleted -} - -func (*UserTypeDeleted) UserTypeType() string { - return TypeUserTypeDeleted -} - -// A bot (see https://core.telegram.org/bots) -type UserTypeBot struct { - meta - // True, if the bot can be invited to basic group and supergroup chats - 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 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 can be added to attachment menu - CanBeAddedToAttachmentMenu bool `json:"can_be_added_to_attachment_menu"` -} - -func (entity *UserTypeBot) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UserTypeBot - - return json.Marshal((*stub)(entity)) -} - -func (*UserTypeBot) GetClass() string { - return ClassUserType -} - -func (*UserTypeBot) GetType() string { - return TypeUserTypeBot -} - -func (*UserTypeBot) UserTypeType() string { - return TypeUserTypeBot -} - -// No information on the user besides the user identifier is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type -type UserTypeUnknown struct { - meta -} - -func (entity *UserTypeUnknown) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UserTypeUnknown - - return json.Marshal((*stub)(entity)) -} - -func (*UserTypeUnknown) GetClass() string { - return ClassUserType -} - -func (*UserTypeUnknown) GetType() string { - return TypeUserTypeUnknown -} - -func (*UserTypeUnknown) UserTypeType() string { - return TypeUserTypeUnknown -} - -// Represents a command supported by a bot -type BotCommand struct { - meta - // Text of the bot command - Command string `json:"command"` - // Description of the bot command - Description string `json:"description"` -} - -func (entity *BotCommand) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub BotCommand - - return json.Marshal((*stub)(entity)) -} - -func (*BotCommand) GetClass() string { - return ClassBotCommand -} - -func (*BotCommand) GetType() string { - return TypeBotCommand -} - -// Contains a list of bot commands -type BotCommands struct { - meta - // Bot's user identifier - BotUserId int64 `json:"bot_user_id"` - // List of bot commands - Commands []*BotCommand `json:"commands"` -} - -func (entity *BotCommands) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub BotCommands - - return json.Marshal((*stub)(entity)) -} - -func (*BotCommands) GetClass() string { - return ClassBotCommands -} - -func (*BotCommands) GetType() string { - return TypeBotCommands -} - -// Describes a button to be shown instead of bot commands menu button -type BotMenuButton struct { - meta - // Text of the button - Text string `json:"text"` - // URL to be passed to openWebApp - Url string `json:"url"` -} - -func (entity *BotMenuButton) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub BotMenuButton - - return json.Marshal((*stub)(entity)) -} - -func (*BotMenuButton) GetClass() string { - return ClassBotMenuButton -} - -func (*BotMenuButton) GetType() string { - return TypeBotMenuButton -} - -// Represents a location to which a chat is connected -type ChatLocation struct { - meta - // The location - Location *Location `json:"location"` - // Location address; 1-64 characters, as defined by the chat owner - Address string `json:"address"` -} - -func (entity *ChatLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatLocation - - return json.Marshal((*stub)(entity)) -} - -func (*ChatLocation) GetClass() string { - return ClassChatLocation -} - -func (*ChatLocation) GetType() string { - return TypeChatLocation -} - -// Animated variant of a chat photo in MPEG4 format -type AnimatedChatPhoto struct { - meta - // Animation width and height - Length int32 `json:"length"` - // Information about the animation file - File *File `json:"file"` - // Timestamp of the frame, used as a static chat photo - MainFrameTimestamp float64 `json:"main_frame_timestamp"` -} - -func (entity *AnimatedChatPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub AnimatedChatPhoto - - return json.Marshal((*stub)(entity)) -} - -func (*AnimatedChatPhoto) GetClass() string { - return ClassAnimatedChatPhoto -} - -func (*AnimatedChatPhoto) GetType() string { - return TypeAnimatedChatPhoto -} - -// Describes a chat or user profile photo -type ChatPhoto struct { - meta - // Unique photo identifier - Id JsonInt64 `json:"id"` - // Point in time (Unix timestamp) when the photo has been added - AddedDate int32 `json:"added_date"` - // Photo minithumbnail; may be null - Minithumbnail *Minithumbnail `json:"minithumbnail"` - // Available variants of the photo in JPEG format, in different size - Sizes []*PhotoSize `json:"sizes"` - // A big (640x640) 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 - SmallAnimation *AnimatedChatPhoto `json:"small_animation"` -} - -func (entity *ChatPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatPhoto - - return json.Marshal((*stub)(entity)) -} - -func (*ChatPhoto) GetClass() string { - return ClassChatPhoto -} - -func (*ChatPhoto) GetType() string { - return TypeChatPhoto -} - -// Contains a list of chat or user profile photos -type ChatPhotos struct { - meta - // Total number of photos - TotalCount int32 `json:"total_count"` - // List of photos - Photos []*ChatPhoto `json:"photos"` -} - -func (entity *ChatPhotos) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatPhotos - - return json.Marshal((*stub)(entity)) -} - -func (*ChatPhotos) GetClass() string { - return ClassChatPhotos -} - -func (*ChatPhotos) GetType() string { - return TypeChatPhotos -} - -// A previously used profile photo of the current user -type InputChatPhotoPrevious struct { - meta - // Identifier of the current user's profile photo to reuse - ChatPhotoId JsonInt64 `json:"chat_photo_id"` -} - -func (entity *InputChatPhotoPrevious) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputChatPhotoPrevious - - return json.Marshal((*stub)(entity)) -} - -func (*InputChatPhotoPrevious) GetClass() string { - return ClassInputChatPhoto -} - -func (*InputChatPhotoPrevious) GetType() string { - return TypeInputChatPhotoPrevious -} - -func (*InputChatPhotoPrevious) InputChatPhotoType() string { - return TypeInputChatPhotoPrevious -} - -// A static photo in JPEG format -type InputChatPhotoStatic struct { - meta - // Photo to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed - Photo InputFile `json:"photo"` -} - -func (entity *InputChatPhotoStatic) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputChatPhotoStatic - - return json.Marshal((*stub)(entity)) -} - -func (*InputChatPhotoStatic) GetClass() string { - return ClassInputChatPhoto -} - -func (*InputChatPhotoStatic) GetType() string { - return TypeInputChatPhotoStatic -} - -func (*InputChatPhotoStatic) InputChatPhotoType() string { - return TypeInputChatPhotoStatic -} - -func (inputChatPhotoStatic *InputChatPhotoStatic) UnmarshalJSON(data []byte) error { - var tmp struct { - Photo json.RawMessage `json:"photo"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldPhoto, _ := UnmarshalInputFile(tmp.Photo) - inputChatPhotoStatic.Photo = fieldPhoto - - return nil -} - -// An animation in MPEG4 format; must be square, at most 10 seconds long, have width between 160 and 800 and be at most 2MB in size -type InputChatPhotoAnimation struct { - meta - // Animation to be set as profile photo. Only inputFileLocal and inputFileGenerated are allowed - Animation InputFile `json:"animation"` - // Timestamp of the frame, which will be used as static chat photo - MainFrameTimestamp float64 `json:"main_frame_timestamp"` -} - -func (entity *InputChatPhotoAnimation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputChatPhotoAnimation - - return json.Marshal((*stub)(entity)) -} - -func (*InputChatPhotoAnimation) GetClass() string { - return ClassInputChatPhoto -} - -func (*InputChatPhotoAnimation) GetType() string { - return TypeInputChatPhotoAnimation -} - -func (*InputChatPhotoAnimation) InputChatPhotoType() string { - return TypeInputChatPhotoAnimation -} - -func (inputChatPhotoAnimation *InputChatPhotoAnimation) UnmarshalJSON(data []byte) error { - var tmp struct { - Animation json.RawMessage `json:"animation"` - MainFrameTimestamp float64 `json:"main_frame_timestamp"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inputChatPhotoAnimation.MainFrameTimestamp = tmp.MainFrameTimestamp - - fieldAnimation, _ := UnmarshalInputFile(tmp.Animation) - inputChatPhotoAnimation.Animation = fieldAnimation - - return nil -} - -// 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, locations, and venues - CanSendMessages bool `json:"can_send_messages"` - // True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions - CanSendMediaMessages bool `json:"can_send_media_messages"` - // True, if the user can send polls. Implies can_send_messages permissions - CanSendPolls bool `json:"can_send_polls"` - // True, if the user can send animations, games, stickers, and dice and use inline bots. Implies can_send_messages permissions - CanSendOtherMessages bool `json:"can_send_other_messages"` - // True, if the user may add a web page preview to their messages. Implies can_send_messages permissions - CanAddWebPagePreviews bool `json:"can_add_web_page_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"` -} - -func (entity *ChatPermissions) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatPermissions - - return json.Marshal((*stub)(entity)) -} - -func (*ChatPermissions) GetClass() string { - return ClassChatPermissions -} - -func (*ChatPermissions) GetType() string { - return TypeChatPermissions -} - -// Describes rights of the administrator -type ChatAdministratorRights struct { - meta - // True, if the administrator can get chat event log, get chat statistics, get message statistics in channels, get channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other privilege; applicable to supergroups and channels only - 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; 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"` - // True, if the administrator can delete messages of other users - 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; always true for channels - 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 - 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 isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only - IsAnonymous bool `json:"is_anonymous"` -} - -func (entity *ChatAdministratorRights) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatAdministratorRights - - return json.Marshal((*stub)(entity)) -} - -func (*ChatAdministratorRights) GetClass() string { - return ClassChatAdministratorRights -} - -func (*ChatAdministratorRights) GetType() string { - return TypeChatAdministratorRights -} - -// Describes an option for buying Telegram Premium to a user -type PremiumPaymentOption struct { - meta - // ISO 4217 currency code for Telegram Premium subscription payment - Currency string `json:"currency"` - // The amount to pay, in the smallest units of the currency - 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 - MonthCount int32 `json:"month_count"` - // Identifier of the store product associated with the option - StoreProductId string `json:"store_product_id"` - // An internal link to be opened for buying Telegram Premium to the user if store payment isn't possible; may be null if direct payment isn't available - PaymentLink InternalLinkType `json:"payment_link"` -} - -func (entity *PremiumPaymentOption) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PremiumPaymentOption - - return json.Marshal((*stub)(entity)) -} - -func (*PremiumPaymentOption) GetClass() string { - return ClassPremiumPaymentOption -} - -func (*PremiumPaymentOption) GetType() string { - return TypePremiumPaymentOption -} - -func (premiumPaymentOption *PremiumPaymentOption) UnmarshalJSON(data []byte) error { - var tmp struct { - Currency string `json:"currency"` - Amount int64 `json:"amount"` - DiscountPercentage int32 `json:"discount_percentage"` - MonthCount int32 `json:"month_count"` - StoreProductId string `json:"store_product_id"` - PaymentLink json.RawMessage `json:"payment_link"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - premiumPaymentOption.Currency = tmp.Currency - premiumPaymentOption.Amount = tmp.Amount - premiumPaymentOption.DiscountPercentage = tmp.DiscountPercentage - premiumPaymentOption.MonthCount = tmp.MonthCount - premiumPaymentOption.StoreProductId = tmp.StoreProductId - - fieldPaymentLink, _ := UnmarshalInternalLinkType(tmp.PaymentLink) - premiumPaymentOption.PaymentLink = fieldPaymentLink - - return nil -} - -// Describes a custom emoji to be shown instead of the Telegram Premium badge -type EmojiStatus struct { - meta - // Identifier of the custom emoji in stickerFormatTgs format - CustomEmojiId JsonInt64 `json:"custom_emoji_id"` -} - -func (entity *EmojiStatus) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub EmojiStatus - - return json.Marshal((*stub)(entity)) -} - -func (*EmojiStatus) GetClass() string { - return ClassEmojiStatus -} - -func (*EmojiStatus) GetType() string { - return TypeEmojiStatus -} - -// Contains a list of emoji statuses -type EmojiStatuses struct { - meta - // The list of emoji statuses - EmojiStatuses []*EmojiStatus `json:"emoji_statuses"` -} - -func (entity *EmojiStatuses) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub EmojiStatuses - - return json.Marshal((*stub)(entity)) -} - -func (*EmojiStatuses) GetClass() string { - return ClassEmojiStatuses -} - -func (*EmojiStatuses) GetType() string { - return TypeEmojiStatuses -} - -// Describes usernames assigned to a user, a supergroup, or a channel -type Usernames struct { - meta - // List of active usernames; the first one must be shown as the primary username. The order of active usernames can be changed with reorderActiveUsernames or reorderSupergroupActiveUsernames - ActiveUsernames []string `json:"active_usernames"` - // List of currently disabled usernames; the username can be activated with toggleUsernameIsActive/toggleSupergroupUsernameIsActive - DisabledUsernames []string `json:"disabled_usernames"` - // The active username, which can be changed with setUsername/setSupergroupUsername - EditableUsername string `json:"editable_username"` -} - -func (entity *Usernames) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Usernames - - return json.Marshal((*stub)(entity)) -} - -func (*Usernames) GetClass() string { - return ClassUsernames -} - -func (*Usernames) GetType() string { - return TypeUsernames -} - -// Represents a user -type User struct { - meta - // User identifier - Id int64 `json:"id"` - // First name of the user - FirstName string `json:"first_name"` - // Last name of the user - LastName string `json:"last_name"` - // Usernames of the user; may be null - Usernames *Usernames `json:"usernames"` - // Phone number of the user - PhoneNumber string `json:"phone_number"` - // Current online status of the user - Status UserStatus `json:"status"` - // Profile photo of the user; may be null - ProfilePhoto *ProfilePhoto `json:"profile_photo"` - // Emoji status to be shown instead of the default Telegram Premium badge; may be null. For Telegram Premium users only - EmojiStatus *EmojiStatus `json:"emoji_status"` - // The user is a contact of the current user - IsContact bool `json:"is_contact"` - // The user is a contact of the current user and the current user is a contact of the user - IsMutualContact bool `json:"is_mutual_contact"` - // True, if the user is verified - IsVerified bool `json:"is_verified"` - // 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"` - // 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 - Type UserType `json:"type"` - // IETF language tag of the user's language; only available to bots - LanguageCode string `json:"language_code"` - // True, if the user added the current bot to attachment menu; only available to bots - AddedToAttachmentMenu bool `json:"added_to_attachment_menu"` -} - -func (entity *User) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub User - - return json.Marshal((*stub)(entity)) -} - -func (*User) GetClass() string { - return ClassUser -} - -func (*User) GetType() string { - return TypeUser -} - -func (user *User) UnmarshalJSON(data []byte) error { - var tmp struct { - Id int64 `json:"id"` - FirstName string `json:"first_name"` - LastName string `json:"last_name"` - Usernames *Usernames `json:"usernames"` - PhoneNumber string `json:"phone_number"` - Status json.RawMessage `json:"status"` - ProfilePhoto *ProfilePhoto `json:"profile_photo"` - EmojiStatus *EmojiStatus `json:"emoji_status"` - IsContact bool `json:"is_contact"` - IsMutualContact bool `json:"is_mutual_contact"` - IsVerified bool `json:"is_verified"` - 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"` - HaveAccess bool `json:"have_access"` - Type json.RawMessage `json:"type"` - LanguageCode string `json:"language_code"` - AddedToAttachmentMenu bool `json:"added_to_attachment_menu"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - user.Id = tmp.Id - user.FirstName = tmp.FirstName - user.LastName = tmp.LastName - user.Usernames = tmp.Usernames - user.PhoneNumber = tmp.PhoneNumber - user.ProfilePhoto = tmp.ProfilePhoto - user.EmojiStatus = tmp.EmojiStatus - user.IsContact = tmp.IsContact - user.IsMutualContact = tmp.IsMutualContact - user.IsVerified = tmp.IsVerified - user.IsPremium = tmp.IsPremium - user.IsSupport = tmp.IsSupport - user.RestrictionReason = tmp.RestrictionReason - user.IsScam = tmp.IsScam - user.IsFake = tmp.IsFake - user.HaveAccess = tmp.HaveAccess - user.LanguageCode = tmp.LanguageCode - user.AddedToAttachmentMenu = tmp.AddedToAttachmentMenu - - fieldStatus, _ := UnmarshalUserStatus(tmp.Status) - user.Status = fieldStatus - - fieldType, _ := UnmarshalUserType(tmp.Type) - user.Type = fieldType - - return nil -} - -// Contains information about a bot -type BotInfo struct { - meta - // The text that is shown on the bot's profile page and is sent together with the link when users share the bot - ShareText string `json:"share_text"` - // The text shown in the chat with the bot if the chat is empty - Description string `json:"description"` - // Photo shown in the chat with the bot if the chat is empty; may be null - Photo *Photo `json:"photo"` - // Animation shown in the chat with the bot if the chat is empty; may be null - Animation *Animation `json:"animation"` - // Information about a button to show instead of the bot commands menu button; may be null if ordinary bot commands menu must be shown - MenuButton *BotMenuButton `json:"menu_button"` - // List of the bot commands - Commands []*BotCommand `json:"commands"` - // 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"` -} - -func (entity *BotInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub BotInfo - - return json.Marshal((*stub)(entity)) -} - -func (*BotInfo) GetClass() string { - return ClassBotInfo -} - -func (*BotInfo) GetType() string { - return TypeBotInfo -} - -// Contains full information about a user -type UserFullInfo struct { - meta - // User profile photo set by the current user for the contact; may be null. If null and user.profile_photo is null, then the photo is empty, otherwise unknown. If non-null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos - PersonalPhoto *ChatPhoto `json:"personal_photo"` - // User profile photo; may be null. If null and user.profile_photo is null, then the photo is empty, otherwise unknown. If non-null and personal_photo is null, then it is the same photo as in user.profile_photo and chat.photo - Photo *ChatPhoto `json:"photo"` - // User profile photo visible if the main photo is hidden by privacy settings; may be null. If null and user.profile_photo is null, then the photo is empty, otherwise unknown. If non-null and both photo and personal_photo are null, then it is the same photo as in user.profile_photo and chat.photo. This photo isn't returned in the list of user photos - PublicPhoto *ChatPhoto `json:"public_photo"` - // True, if the user is blocked by the current user - IsBlocked bool `json:"is_blocked"` - // True, if the user can be called - CanBeCalled bool `json:"can_be_called"` - // True, if a video call can be created with the user - SupportsVideoCalls bool `json:"supports_video_calls"` - // True, if the user can't be called due to their privacy settings - HasPrivateCalls bool `json:"has_private_calls"` - // True, if the user can't be linked in forwarded messages due to their privacy settings - 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 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"` - // 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"` - // 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"` - // For bots, information about the bot; may be null - BotInfo *BotInfo `json:"bot_info"` -} - -func (entity *UserFullInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UserFullInfo - - return json.Marshal((*stub)(entity)) -} - -func (*UserFullInfo) GetClass() string { - return ClassUserFullInfo -} - -func (*UserFullInfo) GetType() string { - return TypeUserFullInfo -} - -// Represents a list of users -type Users struct { - meta - // Approximate total number of users found - TotalCount int32 `json:"total_count"` - // A list of user identifiers - UserIds []int64 `json:"user_ids"` -} - -func (entity *Users) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Users - - return json.Marshal((*stub)(entity)) -} - -func (*Users) GetClass() string { - return ClassUsers -} - -func (*Users) GetType() string { - return TypeUsers -} - -// Contains information about a chat administrator -type ChatAdministrator struct { - meta - // User identifier of the administrator - UserId int64 `json:"user_id"` - // Custom title of the administrator - CustomTitle string `json:"custom_title"` - // True, if the user is the owner of the chat - IsOwner bool `json:"is_owner"` -} - -func (entity *ChatAdministrator) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatAdministrator - - return json.Marshal((*stub)(entity)) -} - -func (*ChatAdministrator) GetClass() string { - return ClassChatAdministrator -} - -func (*ChatAdministrator) GetType() string { - return TypeChatAdministrator -} - -// Represents a list of chat administrators -type ChatAdministrators struct { - meta - // A list of chat administrators - Administrators []*ChatAdministrator `json:"administrators"` -} - -func (entity *ChatAdministrators) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatAdministrators - - return json.Marshal((*stub)(entity)) -} - -func (*ChatAdministrators) GetClass() string { - return ClassChatAdministrators -} - -func (*ChatAdministrators) GetType() string { - return TypeChatAdministrators -} - -// 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 - 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"` - // True, if the user is a member of the chat - IsMember bool `json:"is_member"` -} - -func (entity *ChatMemberStatusCreator) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMemberStatusCreator - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMemberStatusCreator) GetClass() string { - return ClassChatMemberStatus -} - -func (*ChatMemberStatusCreator) GetType() string { - return TypeChatMemberStatusCreator -} - -func (*ChatMemberStatusCreator) ChatMemberStatusType() string { - return TypeChatMemberStatusCreator -} - -// 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 - 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"` - // Rights of the administrator - Rights *ChatAdministratorRights `json:"rights"` -} - -func (entity *ChatMemberStatusAdministrator) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMemberStatusAdministrator - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMemberStatusAdministrator) GetClass() string { - return ClassChatMemberStatus -} - -func (*ChatMemberStatusAdministrator) GetType() string { - return TypeChatMemberStatusAdministrator -} - -func (*ChatMemberStatusAdministrator) ChatMemberStatusType() string { - return TypeChatMemberStatusAdministrator -} - -// The user is a member of the chat, without any additional privileges or restrictions -type ChatMemberStatusMember struct { - meta -} - -func (entity *ChatMemberStatusMember) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMemberStatusMember - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMemberStatusMember) GetClass() string { - return ClassChatMemberStatus -} - -func (*ChatMemberStatusMember) GetType() string { - return TypeChatMemberStatusMember -} - -func (*ChatMemberStatusMember) ChatMemberStatusType() string { - return TypeChatMemberStatusMember -} - -// The user is under certain restrictions in the chat. Not supported in basic groups and channels -type ChatMemberStatusRestricted struct { - meta - // True, if the user is a member of the chat - IsMember bool `json:"is_member"` - // Point in time (Unix timestamp) when restrictions will be lifted from the user; 0 if never. If the user is restricted for more than 366 days or for less than 30 seconds from the current time, the user is considered to be restricted forever - RestrictedUntilDate int32 `json:"restricted_until_date"` - // User permissions in the chat - Permissions *ChatPermissions `json:"permissions"` -} - -func (entity *ChatMemberStatusRestricted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMemberStatusRestricted - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMemberStatusRestricted) GetClass() string { - return ClassChatMemberStatus -} - -func (*ChatMemberStatusRestricted) GetType() string { - return TypeChatMemberStatusRestricted -} - -func (*ChatMemberStatusRestricted) ChatMemberStatusType() string { - return TypeChatMemberStatusRestricted -} - -// The user or the chat is not a chat member -type ChatMemberStatusLeft struct { - meta -} - -func (entity *ChatMemberStatusLeft) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMemberStatusLeft - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMemberStatusLeft) GetClass() string { - return ClassChatMemberStatus -} - -func (*ChatMemberStatusLeft) GetType() string { - return TypeChatMemberStatusLeft -} - -func (*ChatMemberStatusLeft) ChatMemberStatusType() string { - return TypeChatMemberStatusLeft -} - -// The user or the chat was banned (and hence is not a member of the chat). Implies the user can't return to the chat, view messages, or be used as a participant identifier to join a video chat of the chat -type ChatMemberStatusBanned struct { - meta - // 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. Always 0 in basic groups - BannedUntilDate int32 `json:"banned_until_date"` -} - -func (entity *ChatMemberStatusBanned) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMemberStatusBanned - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMemberStatusBanned) GetClass() string { - return ClassChatMemberStatus -} - -func (*ChatMemberStatusBanned) GetType() string { - return TypeChatMemberStatusBanned -} - -func (*ChatMemberStatusBanned) ChatMemberStatusType() string { - return TypeChatMemberStatusBanned -} - -// Describes a user or a chat as a member of another chat -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 - 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"` - // Status of the member in the chat - Status ChatMemberStatus `json:"status"` -} - -func (entity *ChatMember) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMember - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMember) GetClass() string { - return ClassChatMember -} - -func (*ChatMember) GetType() string { - return TypeChatMember -} - -func (chatMember *ChatMember) UnmarshalJSON(data []byte) error { - var tmp struct { - MemberId json.RawMessage `json:"member_id"` - InviterUserId int64 `json:"inviter_user_id"` - JoinedChatDate int32 `json:"joined_chat_date"` - Status json.RawMessage `json:"status"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - chatMember.InviterUserId = tmp.InviterUserId - chatMember.JoinedChatDate = tmp.JoinedChatDate - - fieldMemberId, _ := UnmarshalMessageSender(tmp.MemberId) - chatMember.MemberId = fieldMemberId - - fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) - chatMember.Status = fieldStatus - - return nil -} - -// Contains a list of chat members -type ChatMembers struct { - meta - // Approximate total number of chat members found - TotalCount int32 `json:"total_count"` - // A list of chat members - Members []*ChatMember `json:"members"` -} - -func (entity *ChatMembers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMembers - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMembers) GetClass() string { - return ClassChatMembers -} - -func (*ChatMembers) GetType() string { - return TypeChatMembers -} - -// Returns contacts of the user -type ChatMembersFilterContacts struct { - meta -} - -func (entity *ChatMembersFilterContacts) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMembersFilterContacts - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMembersFilterContacts) GetClass() string { - return ClassChatMembersFilter -} - -func (*ChatMembersFilterContacts) GetType() string { - return TypeChatMembersFilterContacts -} - -func (*ChatMembersFilterContacts) ChatMembersFilterType() string { - return TypeChatMembersFilterContacts -} - -// Returns the owner and administrators -type ChatMembersFilterAdministrators struct { - meta -} - -func (entity *ChatMembersFilterAdministrators) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMembersFilterAdministrators - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMembersFilterAdministrators) GetClass() string { - return ClassChatMembersFilter -} - -func (*ChatMembersFilterAdministrators) GetType() string { - return TypeChatMembersFilterAdministrators -} - -func (*ChatMembersFilterAdministrators) ChatMembersFilterType() string { - return TypeChatMembersFilterAdministrators -} - -// Returns all chat members, including restricted chat members -type ChatMembersFilterMembers struct { - meta -} - -func (entity *ChatMembersFilterMembers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMembersFilterMembers - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMembersFilterMembers) GetClass() string { - return ClassChatMembersFilter -} - -func (*ChatMembersFilterMembers) GetType() string { - return TypeChatMembersFilterMembers -} - -func (*ChatMembersFilterMembers) ChatMembersFilterType() string { - return TypeChatMembersFilterMembers -} - -// 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"` -} - -func (entity *ChatMembersFilterMention) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMembersFilterMention - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMembersFilterMention) GetClass() string { - return ClassChatMembersFilter -} - -func (*ChatMembersFilterMention) GetType() string { - return TypeChatMembersFilterMention -} - -func (*ChatMembersFilterMention) ChatMembersFilterType() string { - return TypeChatMembersFilterMention -} - -// Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup -type ChatMembersFilterRestricted struct { - meta -} - -func (entity *ChatMembersFilterRestricted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMembersFilterRestricted - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMembersFilterRestricted) GetClass() string { - return ClassChatMembersFilter -} - -func (*ChatMembersFilterRestricted) GetType() string { - return TypeChatMembersFilterRestricted -} - -func (*ChatMembersFilterRestricted) ChatMembersFilterType() string { - return TypeChatMembersFilterRestricted -} - -// Returns users banned from the chat; can be used only by administrators in a supergroup or in a channel -type ChatMembersFilterBanned struct { - meta -} - -func (entity *ChatMembersFilterBanned) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMembersFilterBanned - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMembersFilterBanned) GetClass() string { - return ClassChatMembersFilter -} - -func (*ChatMembersFilterBanned) GetType() string { - return TypeChatMembersFilterBanned -} - -func (*ChatMembersFilterBanned) ChatMembersFilterType() string { - return TypeChatMembersFilterBanned -} - -// Returns bot members of the chat -type ChatMembersFilterBots struct { - meta -} - -func (entity *ChatMembersFilterBots) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMembersFilterBots - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMembersFilterBots) GetClass() string { - return ClassChatMembersFilter -} - -func (*ChatMembersFilterBots) GetType() string { - return TypeChatMembersFilterBots -} - -func (*ChatMembersFilterBots) ChatMembersFilterType() string { - return TypeChatMembersFilterBots -} - -// Returns recently active users in reverse chronological order -type SupergroupMembersFilterRecent struct { - meta -} - -func (entity *SupergroupMembersFilterRecent) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SupergroupMembersFilterRecent - - return json.Marshal((*stub)(entity)) -} - -func (*SupergroupMembersFilterRecent) GetClass() string { - return ClassSupergroupMembersFilter -} - -func (*SupergroupMembersFilterRecent) GetType() string { - return TypeSupergroupMembersFilterRecent -} - -func (*SupergroupMembersFilterRecent) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterRecent -} - -// Returns contacts of the user, which are members of the supergroup or channel -type SupergroupMembersFilterContacts struct { - meta - // Query to search for - Query string `json:"query"` -} - -func (entity *SupergroupMembersFilterContacts) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SupergroupMembersFilterContacts - - return json.Marshal((*stub)(entity)) -} - -func (*SupergroupMembersFilterContacts) GetClass() string { - return ClassSupergroupMembersFilter -} - -func (*SupergroupMembersFilterContacts) GetType() string { - return TypeSupergroupMembersFilterContacts -} - -func (*SupergroupMembersFilterContacts) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterContacts -} - -// Returns the owner and administrators -type SupergroupMembersFilterAdministrators struct { - meta -} - -func (entity *SupergroupMembersFilterAdministrators) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SupergroupMembersFilterAdministrators - - return json.Marshal((*stub)(entity)) -} - -func (*SupergroupMembersFilterAdministrators) GetClass() string { - return ClassSupergroupMembersFilter -} - -func (*SupergroupMembersFilterAdministrators) GetType() string { - return TypeSupergroupMembersFilterAdministrators -} - -func (*SupergroupMembersFilterAdministrators) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterAdministrators -} - -// Used to search for supergroup or channel members via a (string) query -type SupergroupMembersFilterSearch struct { - meta - // Query to search for - Query string `json:"query"` -} - -func (entity *SupergroupMembersFilterSearch) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SupergroupMembersFilterSearch - - return json.Marshal((*stub)(entity)) -} - -func (*SupergroupMembersFilterSearch) GetClass() string { - return ClassSupergroupMembersFilter -} - -func (*SupergroupMembersFilterSearch) GetType() string { - return TypeSupergroupMembersFilterSearch -} - -func (*SupergroupMembersFilterSearch) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterSearch -} - -// Returns restricted supergroup members; can be used only by administrators -type SupergroupMembersFilterRestricted struct { - meta - // Query to search for - Query string `json:"query"` -} - -func (entity *SupergroupMembersFilterRestricted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SupergroupMembersFilterRestricted - - return json.Marshal((*stub)(entity)) -} - -func (*SupergroupMembersFilterRestricted) GetClass() string { - return ClassSupergroupMembersFilter -} - -func (*SupergroupMembersFilterRestricted) GetType() string { - return TypeSupergroupMembersFilterRestricted -} - -func (*SupergroupMembersFilterRestricted) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterRestricted -} - -// Returns users banned from the supergroup or channel; can be used only by administrators -type SupergroupMembersFilterBanned struct { - meta - // Query to search for - Query string `json:"query"` -} - -func (entity *SupergroupMembersFilterBanned) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SupergroupMembersFilterBanned - - return json.Marshal((*stub)(entity)) -} - -func (*SupergroupMembersFilterBanned) GetClass() string { - return ClassSupergroupMembersFilter -} - -func (*SupergroupMembersFilterBanned) GetType() string { - return TypeSupergroupMembersFilterBanned -} - -func (*SupergroupMembersFilterBanned) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterBanned -} - -// Returns users which can be mentioned in the supergroup -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"` -} - -func (entity *SupergroupMembersFilterMention) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SupergroupMembersFilterMention - - return json.Marshal((*stub)(entity)) -} - -func (*SupergroupMembersFilterMention) GetClass() string { - return ClassSupergroupMembersFilter -} - -func (*SupergroupMembersFilterMention) GetType() string { - return TypeSupergroupMembersFilterMention -} - -func (*SupergroupMembersFilterMention) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterMention -} - -// Returns bot members of the supergroup or channel -type SupergroupMembersFilterBots struct { - meta -} - -func (entity *SupergroupMembersFilterBots) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SupergroupMembersFilterBots - - return json.Marshal((*stub)(entity)) -} - -func (*SupergroupMembersFilterBots) GetClass() string { - return ClassSupergroupMembersFilter -} - -func (*SupergroupMembersFilterBots) GetType() string { - return TypeSupergroupMembersFilterBots -} - -func (*SupergroupMembersFilterBots) SupergroupMembersFilterType() string { - return TypeSupergroupMembersFilterBots -} - -// Contains a chat invite link -type ChatInviteLink struct { - meta - // Chat invite link - InviteLink string `json:"invite_link"` - // Name of the link - Name string `json:"name"` - // User identifier of an administrator created the link - CreatorUserId int64 `json:"creator_user_id"` - // Point in time (Unix timestamp) when the link was created - Date int32 `json:"date"` - // Point in time (Unix timestamp) when the link was last edited; 0 if never or unknown - EditDate int32 `json:"edit_date"` - // Point in time (Unix timestamp) when the link will expire; 0 if never - ExpirationDate int32 `json:"expiration_date"` - // 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 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 - CreatesJoinRequest bool `json:"creates_join_request"` - // True, if the link is primary. Primary invite link can't have name, expiration date, or usage limit. There is exactly one primary invite link for each administrator with can_invite_users right at a given time - IsPrimary bool `json:"is_primary"` - // True, if the link was revoked - IsRevoked bool `json:"is_revoked"` -} - -func (entity *ChatInviteLink) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatInviteLink - - return json.Marshal((*stub)(entity)) -} - -func (*ChatInviteLink) GetClass() string { - return ClassChatInviteLink -} - -func (*ChatInviteLink) GetType() string { - return TypeChatInviteLink -} - -// Contains a list of chat invite links -type ChatInviteLinks struct { - meta - // Approximate total number of chat invite links found - TotalCount int32 `json:"total_count"` - // List of invite links - InviteLinks []*ChatInviteLink `json:"invite_links"` -} - -func (entity *ChatInviteLinks) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatInviteLinks - - return json.Marshal((*stub)(entity)) -} - -func (*ChatInviteLinks) GetClass() string { - return ClassChatInviteLinks -} - -func (*ChatInviteLinks) GetType() string { - return TypeChatInviteLinks -} - -// Describes a chat administrator with a number of active and revoked chat invite links -type ChatInviteLinkCount struct { - meta - // Administrator's user identifier - UserId int64 `json:"user_id"` - // Number of active invite links - InviteLinkCount int32 `json:"invite_link_count"` - // Number of revoked invite links - RevokedInviteLinkCount int32 `json:"revoked_invite_link_count"` -} - -func (entity *ChatInviteLinkCount) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatInviteLinkCount - - return json.Marshal((*stub)(entity)) -} - -func (*ChatInviteLinkCount) GetClass() string { - return ClassChatInviteLinkCount -} - -func (*ChatInviteLinkCount) GetType() string { - return TypeChatInviteLinkCount -} - -// Contains a list of chat invite link counts -type ChatInviteLinkCounts struct { - meta - // List of invite link counts - InviteLinkCounts []*ChatInviteLinkCount `json:"invite_link_counts"` -} - -func (entity *ChatInviteLinkCounts) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatInviteLinkCounts - - return json.Marshal((*stub)(entity)) -} - -func (*ChatInviteLinkCounts) GetClass() string { - return ClassChatInviteLinkCounts -} - -func (*ChatInviteLinkCounts) GetType() string { - return TypeChatInviteLinkCounts -} - -// Describes a chat member joined a chat via an invite link -type ChatInviteLinkMember struct { - meta - // User identifier - UserId int64 `json:"user_id"` - // Point in time (Unix timestamp) when the user joined the chat - JoinedChatDate int32 `json:"joined_chat_date"` - // User identifier of the chat administrator, approved user join request - ApproverUserId int64 `json:"approver_user_id"` -} - -func (entity *ChatInviteLinkMember) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatInviteLinkMember - - return json.Marshal((*stub)(entity)) -} - -func (*ChatInviteLinkMember) GetClass() string { - return ClassChatInviteLinkMember -} - -func (*ChatInviteLinkMember) GetType() string { - return TypeChatInviteLinkMember -} - -// Contains a list of chat members joined a chat via an invite link -type ChatInviteLinkMembers struct { - meta - // Approximate total number of chat members found - TotalCount int32 `json:"total_count"` - // List of chat members, joined a chat via an invite link - Members []*ChatInviteLinkMember `json:"members"` -} - -func (entity *ChatInviteLinkMembers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatInviteLinkMembers - - return json.Marshal((*stub)(entity)) -} - -func (*ChatInviteLinkMembers) GetClass() string { - return ClassChatInviteLinkMembers -} - -func (*ChatInviteLinkMembers) GetType() string { - return TypeChatInviteLinkMembers -} - -// Contains information about a chat invite link -type ChatInviteLinkInfo struct { - meta - // Chat identifier of the invite link; 0 if the user has no access to the chat before joining - ChatId int64 `json:"chat_id"` - // If non-zero, the amount of time for which read access to the chat will remain available, in seconds - AccessibleFor int32 `json:"accessible_for"` - // Type of the chat - Type ChatType `json:"type"` - // Title of the chat - Title string `json:"title"` - // Chat photo; may be null - Photo *ChatPhotoInfo `json:"photo"` - // Chat description - Description string `json:"description"` - // Number of members in the chat - 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"` - // 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"` -} - -func (entity *ChatInviteLinkInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatInviteLinkInfo - - return json.Marshal((*stub)(entity)) -} - -func (*ChatInviteLinkInfo) GetClass() string { - return ClassChatInviteLinkInfo -} - -func (*ChatInviteLinkInfo) GetType() string { - return TypeChatInviteLinkInfo -} - -func (chatInviteLinkInfo *ChatInviteLinkInfo) UnmarshalJSON(data []byte) error { - var tmp struct { - ChatId int64 `json:"chat_id"` - AccessibleFor int32 `json:"accessible_for"` - Type json.RawMessage `json:"type"` - Title string `json:"title"` - Photo *ChatPhotoInfo `json:"photo"` - Description string `json:"description"` - MemberCount int32 `json:"member_count"` - MemberUserIds []int64 `json:"member_user_ids"` - CreatesJoinRequest bool `json:"creates_join_request"` - IsPublic bool `json:"is_public"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - chatInviteLinkInfo.ChatId = tmp.ChatId - chatInviteLinkInfo.AccessibleFor = tmp.AccessibleFor - chatInviteLinkInfo.Title = tmp.Title - chatInviteLinkInfo.Photo = tmp.Photo - chatInviteLinkInfo.Description = tmp.Description - chatInviteLinkInfo.MemberCount = tmp.MemberCount - chatInviteLinkInfo.MemberUserIds = tmp.MemberUserIds - chatInviteLinkInfo.CreatesJoinRequest = tmp.CreatesJoinRequest - chatInviteLinkInfo.IsPublic = tmp.IsPublic - - fieldType, _ := UnmarshalChatType(tmp.Type) - chatInviteLinkInfo.Type = fieldType - - return nil -} - -// Describes a user that sent a join request and waits for administrator approval -type ChatJoinRequest struct { - meta - // User identifier - UserId int64 `json:"user_id"` - // Point in time (Unix timestamp) when the user sent the join request - Date int32 `json:"date"` - // A short bio of the user - Bio string `json:"bio"` -} - -func (entity *ChatJoinRequest) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatJoinRequest - - return json.Marshal((*stub)(entity)) -} - -func (*ChatJoinRequest) GetClass() string { - return ClassChatJoinRequest -} - -func (*ChatJoinRequest) GetType() string { - return TypeChatJoinRequest -} - -// Contains a list of requests to join a chat -type ChatJoinRequests struct { - meta - // Approximate total number of requests found - TotalCount int32 `json:"total_count"` - // List of the requests - Requests []*ChatJoinRequest `json:"requests"` -} - -func (entity *ChatJoinRequests) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatJoinRequests - - return json.Marshal((*stub)(entity)) -} - -func (*ChatJoinRequests) GetClass() string { - return ClassChatJoinRequests -} - -func (*ChatJoinRequests) GetType() string { - return TypeChatJoinRequests -} - -// Contains information about pending join requests for a chat -type ChatJoinRequestsInfo struct { - meta - // Total number of pending join requests - TotalCount int32 `json:"total_count"` - // Identifiers of at most 3 users sent the newest pending join requests - UserIds []int64 `json:"user_ids"` -} - -func (entity *ChatJoinRequestsInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatJoinRequestsInfo - - return json.Marshal((*stub)(entity)) -} - -func (*ChatJoinRequestsInfo) GetClass() string { - return ClassChatJoinRequestsInfo -} - -func (*ChatJoinRequestsInfo) GetType() string { - return TypeChatJoinRequestsInfo -} - -// Represents a basic group of 0-200 users (must be upgraded to a supergroup to accommodate more than 200 users) -type BasicGroup struct { - meta - // Group identifier - Id int64 `json:"id"` - // Number of members in the group - MemberCount int32 `json:"member_count"` - // Status of the current user in the group - Status ChatMemberStatus `json:"status"` - // True, if the group is active - IsActive bool `json:"is_active"` - // Identifier of the supergroup to which this group was upgraded; 0 if none - UpgradedToSupergroupId int64 `json:"upgraded_to_supergroup_id"` -} - -func (entity *BasicGroup) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub BasicGroup - - return json.Marshal((*stub)(entity)) -} - -func (*BasicGroup) GetClass() string { - return ClassBasicGroup -} - -func (*BasicGroup) GetType() string { - return TypeBasicGroup -} - -func (basicGroup *BasicGroup) UnmarshalJSON(data []byte) error { - var tmp struct { - Id int64 `json:"id"` - MemberCount int32 `json:"member_count"` - Status json.RawMessage `json:"status"` - IsActive bool `json:"is_active"` - UpgradedToSupergroupId int64 `json:"upgraded_to_supergroup_id"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - basicGroup.Id = tmp.Id - basicGroup.MemberCount = tmp.MemberCount - basicGroup.IsActive = tmp.IsActive - basicGroup.UpgradedToSupergroupId = tmp.UpgradedToSupergroupId - - fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) - basicGroup.Status = fieldStatus - - return nil -} - -// Contains full information about a basic group -type BasicGroupFullInfo struct { - meta - // Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo - Photo *ChatPhoto `json:"photo"` - // Group description. Updated only after the basic group is opened - Description string `json:"description"` - // User identifier of the creator of the group; 0 if unknown - CreatorUserId int64 `json:"creator_user_id"` - // Group members - Members []*ChatMember `json:"members"` - // True, if non-administrators and non-bots can be hidden in responses to getSupergroupMembers and searchChatMembers for non-administrators after upgrading the basic group to a supergroup - CanHideMembers bool `json:"can_hide_members"` - // True, if aggressive anti-spam checks can be enabled or disabled in the supergroup after upgrading the basic group to a supergroup - CanToggleAggressiveAntiSpam bool `json:"can_toggle_aggressive_anti_spam"` - // Primary invite link for this group; may be null. For chat administrators with can_invite_users right only. Updated only after the basic group is opened - InviteLink *ChatInviteLink `json:"invite_link"` - // List of commands of bots in the group - BotCommands []*BotCommands `json:"bot_commands"` -} - -func (entity *BasicGroupFullInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub BasicGroupFullInfo - - return json.Marshal((*stub)(entity)) -} - -func (*BasicGroupFullInfo) GetClass() string { - return ClassBasicGroupFullInfo -} - -func (*BasicGroupFullInfo) GetType() string { - return TypeBasicGroupFullInfo -} - -// Represents a supergroup or channel with zero or more members (subscribers in the case of channels). From the point of view of the system, a channel is a special kind of a supergroup: only administrators can post and see the list of members, and posts from all administrators use the name and photo of the channel instead of individual names and profile photos. Unlike supergroups, channels can have an unlimited number of subscribers -type Supergroup struct { - meta - // Supergroup or channel identifier - Id int64 `json:"id"` - // Usernames of the supergroup or channel; may be null - Usernames *Usernames `json:"usernames"` - // Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member - 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, or getUserPrivacySettingRules - MemberCount int32 `json:"member_count"` - // 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 - 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 - 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 - JoinByRequest bool `json:"join_by_request"` - // True, if the slow mode is enabled in the supergroup - IsSlowModeEnabled bool `json:"is_slow_mode_enabled"` - // True, if the supergroup is a channel - 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 - 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"` -} - -func (entity *Supergroup) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Supergroup - - return json.Marshal((*stub)(entity)) -} - -func (*Supergroup) GetClass() string { - return ClassSupergroup -} - -func (*Supergroup) GetType() string { - return TypeSupergroup -} - -func (supergroup *Supergroup) UnmarshalJSON(data []byte) error { - var tmp struct { - Id int64 `json:"id"` - Usernames *Usernames `json:"usernames"` - Date int32 `json:"date"` - Status json.RawMessage `json:"status"` - MemberCount int32 `json:"member_count"` - HasLinkedChat bool `json:"has_linked_chat"` - HasLocation bool `json:"has_location"` - SignMessages bool `json:"sign_messages"` - 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"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - supergroup.Id = tmp.Id - supergroup.Usernames = tmp.Usernames - supergroup.Date = tmp.Date - supergroup.MemberCount = tmp.MemberCount - supergroup.HasLinkedChat = tmp.HasLinkedChat - supergroup.HasLocation = tmp.HasLocation - supergroup.SignMessages = tmp.SignMessages - 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 - - fieldStatus, _ := UnmarshalChatMemberStatus(tmp.Status) - supergroup.Status = fieldStatus - - return nil -} - -// Contains full information about a supergroup or channel -type SupergroupFullInfo struct { - meta - // Chat photo; may be null if empty or unknown. If non-null, then it is the same photo as in chat.photo - Photo *ChatPhoto `json:"photo"` - // Supergroup or channel description - Description string `json:"description"` - // Number of members in the supergroup or channel; 0 if unknown - MemberCount int32 `json:"member_count"` - // Number of privileged users in the supergroup or channel; 0 if unknown - AdministratorCount int32 `json:"administrator_count"` - // Number of restricted users in the supergroup; 0 if unknown - RestrictedCount int32 `json:"restricted_count"` - // Number of users banned from chat; 0 if unknown - 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"` - // 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 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 - HasHiddenMembers bool `json:"has_hidden_members"` - // True, if non-administrators and non-bots can be hidden in responses to getSupergroupMembers and searchChatMembers for non-administrators - CanHideMembers bool `json:"can_hide_members"` - // True, if the chat username can be changed - CanSetUsername bool `json:"can_set_username"` - // True, if the supergroup sticker set can be changed - CanSetStickerSet bool `json:"can_set_sticker_set"` - // True, if the supergroup location can be changed - CanSetLocation bool `json:"can_set_location"` - // True, if the supergroup or channel statistics are available - CanGetStatistics bool `json:"can_get_statistics"` - // 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 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"` - // Identifier of the supergroup sticker set; 0 if none - StickerSetId JsonInt64 `json:"sticker_set_id"` - // Location to which the supergroup is connected; may be null - 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"` - // 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 - UpgradedFromMaxMessageId int64 `json:"upgraded_from_max_message_id"` -} - -func (entity *SupergroupFullInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SupergroupFullInfo - - return json.Marshal((*stub)(entity)) -} - -func (*SupergroupFullInfo) GetClass() string { - return ClassSupergroupFullInfo -} - -func (*SupergroupFullInfo) GetType() string { - return TypeSupergroupFullInfo -} - -// The secret chat is not yet created; waiting for the other user to get online -type SecretChatStatePending struct { - meta -} - -func (entity *SecretChatStatePending) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SecretChatStatePending - - return json.Marshal((*stub)(entity)) -} - -func (*SecretChatStatePending) GetClass() string { - return ClassSecretChatState -} - -func (*SecretChatStatePending) GetType() string { - return TypeSecretChatStatePending -} - -func (*SecretChatStatePending) SecretChatStateType() string { - return TypeSecretChatStatePending -} - -// The secret chat is ready to use -type SecretChatStateReady struct { - meta -} - -func (entity *SecretChatStateReady) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SecretChatStateReady - - return json.Marshal((*stub)(entity)) -} - -func (*SecretChatStateReady) GetClass() string { - return ClassSecretChatState -} - -func (*SecretChatStateReady) GetType() string { - return TypeSecretChatStateReady -} - -func (*SecretChatStateReady) SecretChatStateType() string { - return TypeSecretChatStateReady -} - -// The secret chat is closed -type SecretChatStateClosed struct { - meta -} - -func (entity *SecretChatStateClosed) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SecretChatStateClosed - - return json.Marshal((*stub)(entity)) -} - -func (*SecretChatStateClosed) GetClass() string { - return ClassSecretChatState -} - -func (*SecretChatStateClosed) GetType() string { - return TypeSecretChatStateClosed -} - -func (*SecretChatStateClosed) SecretChatStateType() string { - return TypeSecretChatStateClosed -} - -// Represents a secret chat -type SecretChat struct { - meta - // Secret chat identifier - Id int32 `json:"id"` - // Identifier of the chat partner - UserId int64 `json:"user_id"` - // State of the secret chat - State SecretChatState `json:"state"` - // True, if the chat was created by the current user; otherwise false - IsOutbound bool `json:"is_outbound"` - // Hash of the currently used key for comparison with the hash of the chat partner's key. This is a string of 36 little-endian bytes, which must be split into groups of 2 bits, each denoting a pixel of one of 4 colors FFFFFF, D5E6F3, 2D5775, and 2F99C9. The pixels must be used to make a 12x12 square image filled from left to right, top to bottom. Alternatively, the first 32 bytes of the hash can be converted to the hexadecimal format and printed as 32 2-digit hex numbers - KeyHash []byte `json:"key_hash"` - // Secret chat layer; determines features supported by the chat partner's application. Nested text entities and underline and strikethrough entities are supported if the layer >= 101, files bigger than 2000MB are supported if the layer >= 143, spoiler and custom emoji text entities are supported if the layer >= 144 - Layer int32 `json:"layer"` -} - -func (entity *SecretChat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SecretChat - - return json.Marshal((*stub)(entity)) -} - -func (*SecretChat) GetClass() string { - return ClassSecretChat -} - -func (*SecretChat) GetType() string { - return TypeSecretChat -} - -func (secretChat *SecretChat) UnmarshalJSON(data []byte) error { - var tmp struct { - Id int32 `json:"id"` - UserId int64 `json:"user_id"` - State json.RawMessage `json:"state"` - IsOutbound bool `json:"is_outbound"` - KeyHash []byte `json:"key_hash"` - Layer int32 `json:"layer"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - secretChat.Id = tmp.Id - secretChat.UserId = tmp.UserId - secretChat.IsOutbound = tmp.IsOutbound - secretChat.KeyHash = tmp.KeyHash - secretChat.Layer = tmp.Layer - - fieldState, _ := UnmarshalSecretChatState(tmp.State) - secretChat.State = fieldState - - return nil -} - -// The message was sent by a known user -type MessageSenderUser struct { - meta - // Identifier of the user that sent the message - UserId int64 `json:"user_id"` -} - -func (entity *MessageSenderUser) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSenderUser - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSenderUser) GetClass() string { - return ClassMessageSender -} - -func (*MessageSenderUser) GetType() string { - return TypeMessageSenderUser -} - -func (*MessageSenderUser) MessageSenderType() string { - return TypeMessageSenderUser -} - -// The message was sent on behalf of a chat -type MessageSenderChat struct { - meta - // Identifier of the chat that sent the message - ChatId int64 `json:"chat_id"` -} - -func (entity *MessageSenderChat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSenderChat - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSenderChat) GetClass() string { - return ClassMessageSender -} - -func (*MessageSenderChat) GetType() string { - return TypeMessageSenderChat -} - -func (*MessageSenderChat) MessageSenderType() string { - return TypeMessageSenderChat -} - -// Represents a list of message senders -type MessageSenders struct { - meta - // Approximate total number of messages senders found - TotalCount int32 `json:"total_count"` - // List of message senders - Senders []MessageSender `json:"senders"` -} - -func (entity *MessageSenders) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSenders - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSenders) GetClass() string { - return ClassMessageSenders -} - -func (*MessageSenders) GetType() string { - return TypeMessageSenders -} - -func (messageSenders *MessageSenders) UnmarshalJSON(data []byte) error { - var tmp struct { - TotalCount int32 `json:"total_count"` - Senders []json.RawMessage `json:"senders"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageSenders.TotalCount = tmp.TotalCount - - fieldSenders, _ := UnmarshalListOfMessageSender(tmp.Senders) - messageSenders.Senders = fieldSenders - - return nil -} - -// Represents a message sender, which can be used to send messages in a chat -type ChatMessageSender struct { - meta - // Available message senders - Sender MessageSender `json:"sender"` - // True, if Telegram Premium is needed to use the message sender - NeedsPremium bool `json:"needs_premium"` -} - -func (entity *ChatMessageSender) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMessageSender - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMessageSender) GetClass() string { - return ClassChatMessageSender -} - -func (*ChatMessageSender) GetType() string { - return TypeChatMessageSender -} - -func (chatMessageSender *ChatMessageSender) UnmarshalJSON(data []byte) error { - var tmp struct { - Sender json.RawMessage `json:"sender"` - NeedsPremium bool `json:"needs_premium"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - chatMessageSender.NeedsPremium = tmp.NeedsPremium - - fieldSender, _ := UnmarshalMessageSender(tmp.Sender) - chatMessageSender.Sender = fieldSender - - return nil -} - -// Represents a list of message senders, which can be used to send messages in a chat -type ChatMessageSenders struct { - meta - // List of available message senders - Senders []*ChatMessageSender `json:"senders"` -} - -func (entity *ChatMessageSenders) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatMessageSenders - - return json.Marshal((*stub)(entity)) -} - -func (*ChatMessageSenders) GetClass() string { - return ClassChatMessageSenders -} - -func (*ChatMessageSenders) GetType() string { - return TypeChatMessageSenders -} - -// The message was originally sent by a known user -type MessageForwardOriginUser struct { - meta - // Identifier of the user that originally sent the message - SenderUserId int64 `json:"sender_user_id"` -} - -func (entity *MessageForwardOriginUser) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageForwardOriginUser - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForwardOriginUser) GetClass() string { - return ClassMessageForwardOrigin -} - -func (*MessageForwardOriginUser) GetType() string { - return TypeMessageForwardOriginUser -} - -func (*MessageForwardOriginUser) MessageForwardOriginType() string { - return TypeMessageForwardOriginUser -} - -// The message was originally sent on behalf of a chat -type MessageForwardOriginChat struct { - meta - // Identifier of the chat that originally sent the message - SenderChatId int64 `json:"sender_chat_id"` - // For messages originally sent by an anonymous chat administrator, original message author signature - AuthorSignature string `json:"author_signature"` -} - -func (entity *MessageForwardOriginChat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageForwardOriginChat - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForwardOriginChat) GetClass() string { - return ClassMessageForwardOrigin -} - -func (*MessageForwardOriginChat) GetType() string { - return TypeMessageForwardOriginChat -} - -func (*MessageForwardOriginChat) MessageForwardOriginType() string { - return TypeMessageForwardOriginChat -} - -// The message was originally sent by a user, which is hidden by their privacy settings -type MessageForwardOriginHiddenUser struct { - meta - // Name of the sender - SenderName string `json:"sender_name"` -} - -func (entity *MessageForwardOriginHiddenUser) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageForwardOriginHiddenUser - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForwardOriginHiddenUser) GetClass() string { - return ClassMessageForwardOrigin -} - -func (*MessageForwardOriginHiddenUser) GetType() string { - return TypeMessageForwardOriginHiddenUser -} - -func (*MessageForwardOriginHiddenUser) MessageForwardOriginType() string { - return TypeMessageForwardOriginHiddenUser -} - -// The message was originally a post in a channel -type MessageForwardOriginChannel struct { - meta - // Identifier of the chat from which the message was originally forwarded - ChatId int64 `json:"chat_id"` - // Message identifier of the original message - MessageId int64 `json:"message_id"` - // Original post author signature - AuthorSignature string `json:"author_signature"` -} - -func (entity *MessageForwardOriginChannel) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageForwardOriginChannel - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForwardOriginChannel) GetClass() string { - return ClassMessageForwardOrigin -} - -func (*MessageForwardOriginChannel) GetType() string { - return TypeMessageForwardOriginChannel -} - -func (*MessageForwardOriginChannel) MessageForwardOriginType() string { - return TypeMessageForwardOriginChannel -} - -// The message was imported from an exported message history -type MessageForwardOriginMessageImport struct { - meta - // Name of the sender - SenderName string `json:"sender_name"` -} - -func (entity *MessageForwardOriginMessageImport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageForwardOriginMessageImport - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForwardOriginMessageImport) GetClass() string { - return ClassMessageForwardOrigin -} - -func (*MessageForwardOriginMessageImport) GetType() string { - return TypeMessageForwardOriginMessageImport -} - -func (*MessageForwardOriginMessageImport) MessageForwardOriginType() string { - return TypeMessageForwardOriginMessageImport -} - -// A reaction with an emoji -type ReactionTypeEmoji struct { - meta - // Text representation of the reaction - Emoji string `json:"emoji"` -} - -func (entity *ReactionTypeEmoji) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ReactionTypeEmoji - - return json.Marshal((*stub)(entity)) -} - -func (*ReactionTypeEmoji) GetClass() string { - return ClassReactionType -} - -func (*ReactionTypeEmoji) GetType() string { - return TypeReactionTypeEmoji -} - -func (*ReactionTypeEmoji) ReactionTypeType() string { - return TypeReactionTypeEmoji -} - -// A reaction with a custom emoji -type ReactionTypeCustomEmoji struct { - meta - // Unique identifier of the custom emoji - CustomEmojiId JsonInt64 `json:"custom_emoji_id"` -} - -func (entity *ReactionTypeCustomEmoji) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ReactionTypeCustomEmoji - - return json.Marshal((*stub)(entity)) -} - -func (*ReactionTypeCustomEmoji) GetClass() string { - return ClassReactionType -} - -func (*ReactionTypeCustomEmoji) GetType() string { - return TypeReactionTypeCustomEmoji -} - -func (*ReactionTypeCustomEmoji) ReactionTypeType() string { - return TypeReactionTypeCustomEmoji -} - -// Contains information about a forwarded message -type MessageForwardInfo struct { - meta - // Origin of a forwarded message - Origin MessageForwardOrigin `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 - 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) { - entity.meta.Type = entity.GetType() - - type stub MessageForwardInfo - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForwardInfo) GetClass() string { - return ClassMessageForwardInfo -} - -func (*MessageForwardInfo) GetType() string { - return TypeMessageForwardInfo -} - -func (messageForwardInfo *MessageForwardInfo) UnmarshalJSON(data []byte) error { - var tmp struct { - Origin json.RawMessage `json:"origin"` - Date int32 `json:"date"` - PublicServiceAnnouncementType string `json:"public_service_announcement_type"` - FromChatId int64 `json:"from_chat_id"` - FromMessageId int64 `json:"from_message_id"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageForwardInfo.Date = tmp.Date - messageForwardInfo.PublicServiceAnnouncementType = tmp.PublicServiceAnnouncementType - messageForwardInfo.FromChatId = tmp.FromChatId - messageForwardInfo.FromMessageId = tmp.FromMessageId - - fieldOrigin, _ := UnmarshalMessageForwardOrigin(tmp.Origin) - messageForwardInfo.Origin = fieldOrigin - - return nil -} - -// Contains information about replies to a message -type MessageReplyInfo struct { - meta - // Number of times the message was directly or indirectly replied - ReplyCount int32 `json:"reply_count"` - // Identifiers of at most 3 recent repliers to the message; available in channels with a discussion supergroup. The users and chats are expected to be inaccessible: only their photo and name will be available - RecentReplierIds []MessageSender `json:"recent_replier_ids"` - // Identifier of the last read incoming reply to the message - LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` - // Identifier of the last read outgoing reply to the message - LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` - // Identifier of the last reply to the message - LastMessageId int64 `json:"last_message_id"` -} - -func (entity *MessageReplyInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageReplyInfo - - return json.Marshal((*stub)(entity)) -} - -func (*MessageReplyInfo) GetClass() string { - return ClassMessageReplyInfo -} - -func (*MessageReplyInfo) GetType() string { - return TypeMessageReplyInfo -} - -func (messageReplyInfo *MessageReplyInfo) UnmarshalJSON(data []byte) error { - var tmp struct { - ReplyCount int32 `json:"reply_count"` - RecentReplierIds []json.RawMessage `json:"recent_replier_ids"` - LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` - LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` - LastMessageId int64 `json:"last_message_id"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageReplyInfo.ReplyCount = tmp.ReplyCount - messageReplyInfo.LastReadInboxMessageId = tmp.LastReadInboxMessageId - messageReplyInfo.LastReadOutboxMessageId = tmp.LastReadOutboxMessageId - messageReplyInfo.LastMessageId = tmp.LastMessageId - - fieldRecentReplierIds, _ := UnmarshalListOfMessageSender(tmp.RecentReplierIds) - messageReplyInfo.RecentReplierIds = fieldRecentReplierIds - - return nil -} - -// Contains information about a reaction to a message -type MessageReaction struct { - meta - // Type of the reaction - Type ReactionType `json:"type"` - // Number of times the reaction was added - TotalCount int32 `json:"total_count"` - // True, if the reaction is chosen by the current user - IsChosen bool `json:"is_chosen"` - // 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"` -} - -func (entity *MessageReaction) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageReaction - - return json.Marshal((*stub)(entity)) -} - -func (*MessageReaction) GetClass() string { - return ClassMessageReaction -} - -func (*MessageReaction) GetType() string { - return TypeMessageReaction -} - -func (messageReaction *MessageReaction) UnmarshalJSON(data []byte) error { - var tmp struct { - Type json.RawMessage `json:"type"` - TotalCount int32 `json:"total_count"` - IsChosen bool `json:"is_chosen"` - RecentSenderIds []json.RawMessage `json:"recent_sender_ids"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageReaction.TotalCount = tmp.TotalCount - messageReaction.IsChosen = tmp.IsChosen - - fieldType, _ := UnmarshalReactionType(tmp.Type) - messageReaction.Type = fieldType - - fieldRecentSenderIds, _ := UnmarshalListOfMessageSender(tmp.RecentSenderIds) - messageReaction.RecentSenderIds = fieldRecentSenderIds - - return nil -} - -// Contains information about interactions with a message -type MessageInteractionInfo struct { - meta - // Number of times the message was viewed - ViewCount int32 `json:"view_count"` - // Number of times the message was forwarded - 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"` -} - -func (entity *MessageInteractionInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageInteractionInfo - - return json.Marshal((*stub)(entity)) -} - -func (*MessageInteractionInfo) GetClass() string { - return ClassMessageInteractionInfo -} - -func (*MessageInteractionInfo) GetType() string { - return TypeMessageInteractionInfo -} - -// Contains information about an unread reaction to a message -type UnreadReaction struct { - meta - // Type of the reaction - Type ReactionType `json:"type"` - // Identifier of the sender, added the reaction - SenderId MessageSender `json:"sender_id"` - // True, if the reaction was added with a big animation - IsBig bool `json:"is_big"` -} - -func (entity *UnreadReaction) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub UnreadReaction - - return json.Marshal((*stub)(entity)) -} - -func (*UnreadReaction) GetClass() string { - return ClassUnreadReaction -} - -func (*UnreadReaction) GetType() string { - return TypeUnreadReaction -} - -func (unreadReaction *UnreadReaction) UnmarshalJSON(data []byte) error { - var tmp struct { - Type json.RawMessage `json:"type"` - SenderId json.RawMessage `json:"sender_id"` - IsBig bool `json:"is_big"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - unreadReaction.IsBig = tmp.IsBig - - fieldType, _ := UnmarshalReactionType(tmp.Type) - unreadReaction.Type = fieldType - - fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) - unreadReaction.SenderId = fieldSenderId - - return nil -} - -// The message is being sent now, but has not yet been delivered to the server -type MessageSendingStatePending struct { - meta -} - -func (entity *MessageSendingStatePending) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSendingStatePending - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSendingStatePending) GetClass() string { - return ClassMessageSendingState -} - -func (*MessageSendingStatePending) GetType() string { - return TypeMessageSendingStatePending -} - -func (*MessageSendingStatePending) MessageSendingStateType() string { - return TypeMessageSendingStatePending -} - -// The message failed to be sent -type MessageSendingStateFailed struct { - meta - // An error code; 0 if unknown - ErrorCode int32 `json:"error_code"` - // Error message - ErrorMessage string `json:"error_message"` - // True, if the message can be re-sent - 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"` - // Time left before the message can be re-sent, in seconds. No update is sent when this field changes - RetryAfter float64 `json:"retry_after"` -} - -func (entity *MessageSendingStateFailed) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSendingStateFailed - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSendingStateFailed) GetClass() string { - return ClassMessageSendingState -} - -func (*MessageSendingStateFailed) GetType() string { - return TypeMessageSendingStateFailed -} - -func (*MessageSendingStateFailed) MessageSendingStateType() string { - return TypeMessageSendingStateFailed -} - -// Describes a message -type Message struct { - meta - // Message identifier; unique for the chat to which the message belongs - Id int64 `json:"id"` - // Identifier of the sender of the message - SenderId MessageSender `json:"sender_id"` - // Chat identifier - ChatId int64 `json:"chat_id"` - // The sending state of the message; may be null - SendingState MessageSendingState `json:"sending_state"` - // The scheduling state of the message; may be null - SchedulingState MessageSchedulingState `json:"scheduling_state"` - // True, if the message is outgoing - 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 content of the message can be saved locally or copied - 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 contains an unread mention for the current user - ContainsUnreadMention bool `json:"contains_unread_mention"` - // Point in time (Unix timestamp) when the message was sent - Date int32 `json:"date"` - // Point in time (Unix timestamp) when the message was last edited - EditDate int32 `json:"edit_date"` - // Information about the initial message sender; may be null - ForwardInfo *MessageForwardInfo `json:"forward_info"` - // Information about interactions with the message; may be null - InteractionInfo *MessageInteractionInfo `json:"interaction_info"` - // Information about unread reactions added to the message - UnreadReactions []*UnreadReaction `json:"unread_reactions"` - // If non-zero, the identifier of the chat to which the replied message belongs; Currently, only messages in the Replies chat can have different reply_in_chat_id and chat_id - ReplyInChatId int64 `json:"reply_in_chat_id"` - // If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message - ReplyToMessageId int64 `json:"reply_to_message_id"` - // 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"` - // The message's self-destruct time, in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the time expires - SelfDestructTime int32 `json:"self_destruct_time"` - // Time left before the message self-destruct timer expires, in seconds. If the self-destruct timer isn't started yet, equals to the value of the self_destruct_time field - 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. TDLib will send updateDeleteMessages or updateMessageContent once the time expires - AutoDeleteIn float64 `json:"auto_delete_in"` - // If non-zero, the user identifier of the bot through which this message was sent - ViaBotUserId int64 `json:"via_bot_user_id"` - // 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 - 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"` - // Content of the message - Content MessageContent `json:"content"` - // Reply markup for the message; may be null - ReplyMarkup ReplyMarkup `json:"reply_markup"` -} - -func (entity *Message) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Message - - return json.Marshal((*stub)(entity)) -} - -func (*Message) GetClass() string { - return ClassMessage -} - -func (*Message) GetType() string { - return TypeMessage -} - -func (message *Message) UnmarshalJSON(data []byte) error { - var tmp struct { - Id int64 `json:"id"` - SenderId json.RawMessage `json:"sender_id"` - ChatId int64 `json:"chat_id"` - SendingState json.RawMessage `json:"sending_state"` - 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"` - 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"` - ContainsUnreadMention bool `json:"contains_unread_mention"` - Date int32 `json:"date"` - EditDate int32 `json:"edit_date"` - ForwardInfo *MessageForwardInfo `json:"forward_info"` - InteractionInfo *MessageInteractionInfo `json:"interaction_info"` - UnreadReactions []*UnreadReaction `json:"unread_reactions"` - ReplyInChatId int64 `json:"reply_in_chat_id"` - ReplyToMessageId int64 `json:"reply_to_message_id"` - MessageThreadId int64 `json:"message_thread_id"` - SelfDestructTime int32 `json:"self_destruct_time"` - SelfDestructIn float64 `json:"self_destruct_in"` - AutoDeleteIn float64 `json:"auto_delete_in"` - ViaBotUserId int64 `json:"via_bot_user_id"` - AuthorSignature string `json:"author_signature"` - MediaAlbumId JsonInt64 `json:"media_album_id"` - RestrictionReason string `json:"restriction_reason"` - Content json.RawMessage `json:"content"` - ReplyMarkup json.RawMessage `json:"reply_markup"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - message.Id = tmp.Id - message.ChatId = tmp.ChatId - message.IsOutgoing = tmp.IsOutgoing - message.IsPinned = tmp.IsPinned - message.CanBeEdited = tmp.CanBeEdited - message.CanBeForwarded = tmp.CanBeForwarded - 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.ContainsUnreadMention = tmp.ContainsUnreadMention - message.Date = tmp.Date - message.EditDate = tmp.EditDate - message.ForwardInfo = tmp.ForwardInfo - message.InteractionInfo = tmp.InteractionInfo - message.UnreadReactions = tmp.UnreadReactions - message.ReplyInChatId = tmp.ReplyInChatId - message.ReplyToMessageId = tmp.ReplyToMessageId - message.MessageThreadId = tmp.MessageThreadId - message.SelfDestructTime = tmp.SelfDestructTime - message.SelfDestructIn = tmp.SelfDestructIn - message.AutoDeleteIn = tmp.AutoDeleteIn - message.ViaBotUserId = tmp.ViaBotUserId - message.AuthorSignature = tmp.AuthorSignature - message.MediaAlbumId = tmp.MediaAlbumId - message.RestrictionReason = tmp.RestrictionReason - - fieldSenderId, _ := UnmarshalMessageSender(tmp.SenderId) - message.SenderId = fieldSenderId - - fieldSendingState, _ := UnmarshalMessageSendingState(tmp.SendingState) - message.SendingState = fieldSendingState - - fieldSchedulingState, _ := UnmarshalMessageSchedulingState(tmp.SchedulingState) - message.SchedulingState = fieldSchedulingState - - fieldContent, _ := UnmarshalMessageContent(tmp.Content) - message.Content = fieldContent - - fieldReplyMarkup, _ := UnmarshalReplyMarkup(tmp.ReplyMarkup) - message.ReplyMarkup = fieldReplyMarkup - - return nil -} - -// Contains a list of messages -type Messages struct { - meta - // Approximate total number of messages found - TotalCount int32 `json:"total_count"` - // List of messages; messages may be null - Messages []*Message `json:"messages"` -} - -func (entity *Messages) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Messages - - return json.Marshal((*stub)(entity)) -} - -func (*Messages) GetClass() string { - return ClassMessages -} - -func (*Messages) GetType() string { - return TypeMessages -} - -// Contains a list of messages found by a search -type FoundMessages struct { - meta - // Approximate total number of messages found; -1 if unknown - 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 - NextOffset string `json:"next_offset"` -} - -func (entity *FoundMessages) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub FoundMessages - - return json.Marshal((*stub)(entity)) -} - -func (*FoundMessages) GetClass() string { - return ClassFoundMessages -} - -func (*FoundMessages) GetType() string { - return TypeFoundMessages -} - -// Contains a list of messages found by a search in a given chat -type FoundChatMessages struct { - meta - // Approximate total number of messages found; -1 if unknown - TotalCount int32 `json:"total_count"` - // List of messages - Messages []*Message `json:"messages"` - // The offset for the next request. If 0, there are no more results - NextFromMessageId int64 `json:"next_from_message_id"` -} - -func (entity *FoundChatMessages) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub FoundChatMessages - - return json.Marshal((*stub)(entity)) -} - -func (*FoundChatMessages) GetClass() string { - return ClassFoundChatMessages -} - -func (*FoundChatMessages) GetType() string { - return TypeFoundChatMessages -} - -// Contains information about a message in a specific position -type MessagePosition struct { - meta - // 0-based message position in the full list of suitable messages - Position int32 `json:"position"` - // Message identifier - MessageId int64 `json:"message_id"` - // Point in time (Unix timestamp) when the message was sent - Date int32 `json:"date"` -} - -func (entity *MessagePosition) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessagePosition - - return json.Marshal((*stub)(entity)) -} - -func (*MessagePosition) GetClass() string { - return ClassMessagePosition -} - -func (*MessagePosition) GetType() string { - return TypeMessagePosition -} - -// Contains a list of message positions -type MessagePositions struct { - meta - // Total number of messages found - TotalCount int32 `json:"total_count"` - // List of message positions - Positions []*MessagePosition `json:"positions"` -} - -func (entity *MessagePositions) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessagePositions - - return json.Marshal((*stub)(entity)) -} - -func (*MessagePositions) GetClass() string { - return ClassMessagePositions -} - -func (*MessagePositions) GetType() string { - return TypeMessagePositions -} - -// Contains information about found messages sent on a specific day -type MessageCalendarDay struct { - meta - // Total number of found messages sent on the day - TotalCount int32 `json:"total_count"` - // First message sent on the day - Message *Message `json:"message"` -} - -func (entity *MessageCalendarDay) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageCalendarDay - - return json.Marshal((*stub)(entity)) -} - -func (*MessageCalendarDay) GetClass() string { - return ClassMessageCalendarDay -} - -func (*MessageCalendarDay) GetType() string { - return TypeMessageCalendarDay -} - -// Contains information about found messages, split by days according to the option "utc_time_offset" -type MessageCalendar struct { - meta - // Total number of found messages - TotalCount int32 `json:"total_count"` - // Information about messages sent - Days []*MessageCalendarDay `json:"days"` -} - -func (entity *MessageCalendar) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageCalendar - - return json.Marshal((*stub)(entity)) -} - -func (*MessageCalendar) GetClass() string { - return ClassMessageCalendar -} - -func (*MessageCalendar) GetType() string { - return TypeMessageCalendar -} - -// Describes a sponsored message -type SponsoredMessage struct { - meta - // Message identifier; unique for the chat to which the sponsored message belongs among both ordinary and sponsored messages - MessageId int64 `json:"message_id"` - // True, if the message needs to be labeled as "recommended" instead of "sponsored" - IsRecommended bool `json:"is_recommended"` - // Sponsor chat identifier; 0 if the sponsor chat is accessible through an invite link - SponsorChatId int64 `json:"sponsor_chat_id"` - // Information about the sponsor chat; may be null unless sponsor_chat_id == 0 - SponsorChatInfo *ChatInviteLinkInfo `json:"sponsor_chat_info"` - // True, if the sponsor's chat photo must be shown - ShowChatPhoto bool `json:"show_chat_photo"` - // 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"` - // Content of the message. Currently, can be only of the type messageText - Content MessageContent `json:"content"` -} - -func (entity *SponsoredMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SponsoredMessage - - return json.Marshal((*stub)(entity)) -} - -func (*SponsoredMessage) GetClass() string { - return ClassSponsoredMessage -} - -func (*SponsoredMessage) GetType() string { - return TypeSponsoredMessage -} - -func (sponsoredMessage *SponsoredMessage) UnmarshalJSON(data []byte) error { - var tmp struct { - MessageId int64 `json:"message_id"` - IsRecommended bool `json:"is_recommended"` - SponsorChatId int64 `json:"sponsor_chat_id"` - SponsorChatInfo *ChatInviteLinkInfo `json:"sponsor_chat_info"` - ShowChatPhoto bool `json:"show_chat_photo"` - Link json.RawMessage `json:"link"` - Content json.RawMessage `json:"content"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - sponsoredMessage.MessageId = tmp.MessageId - sponsoredMessage.IsRecommended = tmp.IsRecommended - sponsoredMessage.SponsorChatId = tmp.SponsorChatId - sponsoredMessage.SponsorChatInfo = tmp.SponsorChatInfo - sponsoredMessage.ShowChatPhoto = tmp.ShowChatPhoto - - fieldLink, _ := UnmarshalInternalLinkType(tmp.Link) - sponsoredMessage.Link = fieldLink - - fieldContent, _ := UnmarshalMessageContent(tmp.Content) - sponsoredMessage.Content = fieldContent - - return nil -} - -// Contains a list of sponsored messages -type SponsoredMessages struct { - meta - // List of sponsored messages - Messages []*SponsoredMessage `json:"messages"` - // The minimum number of messages between shown sponsored messages, or 0 if only one sponsored message must be shown after all ordinary messages - MessagesBetween int32 `json:"messages_between"` -} - -func (entity *SponsoredMessages) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SponsoredMessages - - return json.Marshal((*stub)(entity)) -} - -func (*SponsoredMessages) GetClass() string { - return ClassSponsoredMessages -} - -func (*SponsoredMessages) GetType() string { - return TypeSponsoredMessages -} - -// Describes a file added to file download list -type FileDownload struct { - meta - // File identifier - FileId int32 `json:"file_id"` - // The message with the file - Message *Message `json:"message"` - // Point in time (Unix timestamp) when the file was added to the download list - AddDate int32 `json:"add_date"` - // Point in time (Unix timestamp) when the file downloading was completed; 0 if the file downloading isn't completed - CompleteDate int32 `json:"complete_date"` - // True, if downloading of the file is paused - IsPaused bool `json:"is_paused"` -} - -func (entity *FileDownload) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub FileDownload - - return json.Marshal((*stub)(entity)) -} - -func (*FileDownload) GetClass() string { - return ClassFileDownload -} - -func (*FileDownload) GetType() string { - return TypeFileDownload -} - -// Contains number of being downloaded and recently downloaded files found -type DownloadedFileCounts struct { - meta - // Number of active file downloads found, including paused - ActiveCount int32 `json:"active_count"` - // Number of paused file downloads found - PausedCount int32 `json:"paused_count"` - // Number of completed file downloads found - CompletedCount int32 `json:"completed_count"` -} - -func (entity *DownloadedFileCounts) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub DownloadedFileCounts - - return json.Marshal((*stub)(entity)) -} - -func (*DownloadedFileCounts) GetClass() string { - return ClassDownloadedFileCounts -} - -func (*DownloadedFileCounts) GetType() string { - return TypeDownloadedFileCounts -} - -// Contains a list of downloaded files, found by a search -type FoundFileDownloads struct { - meta - // Total number of suitable files, ignoring offset - 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 - NextOffset string `json:"next_offset"` -} - -func (entity *FoundFileDownloads) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub FoundFileDownloads - - return json.Marshal((*stub)(entity)) -} - -func (*FoundFileDownloads) GetClass() string { - return ClassFoundFileDownloads -} - -func (*FoundFileDownloads) GetType() string { - return TypeFoundFileDownloads -} - -// Notification settings applied to all private and secret chats when the corresponding chat setting has a default value -type NotificationSettingsScopePrivateChats struct { - meta -} - -func (entity *NotificationSettingsScopePrivateChats) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub NotificationSettingsScopePrivateChats - - return json.Marshal((*stub)(entity)) -} - -func (*NotificationSettingsScopePrivateChats) GetClass() string { - return ClassNotificationSettingsScope -} - -func (*NotificationSettingsScopePrivateChats) GetType() string { - return TypeNotificationSettingsScopePrivateChats -} - -func (*NotificationSettingsScopePrivateChats) NotificationSettingsScopeType() string { - return TypeNotificationSettingsScopePrivateChats -} - -// Notification settings applied to all basic group and supergroup chats when the corresponding chat setting has a default value -type NotificationSettingsScopeGroupChats struct { - meta -} - -func (entity *NotificationSettingsScopeGroupChats) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub NotificationSettingsScopeGroupChats - - return json.Marshal((*stub)(entity)) -} - -func (*NotificationSettingsScopeGroupChats) GetClass() string { - return ClassNotificationSettingsScope -} - -func (*NotificationSettingsScopeGroupChats) GetType() string { - return TypeNotificationSettingsScopeGroupChats -} - -func (*NotificationSettingsScopeGroupChats) NotificationSettingsScopeType() string { - return TypeNotificationSettingsScopeGroupChats -} - -// Notification settings applied to all channel chats when the corresponding chat setting has a default value -type NotificationSettingsScopeChannelChats struct { - meta -} - -func (entity *NotificationSettingsScopeChannelChats) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub NotificationSettingsScopeChannelChats - - return json.Marshal((*stub)(entity)) -} - -func (*NotificationSettingsScopeChannelChats) GetClass() string { - return ClassNotificationSettingsScope -} - -func (*NotificationSettingsScopeChannelChats) GetType() string { - return TypeNotificationSettingsScopeChannelChats -} - -func (*NotificationSettingsScopeChannelChats) NotificationSettingsScopeType() string { - return TypeNotificationSettingsScopeChannelChats -} - -// Contains information about notification settings for a chat or a froum 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 - UseDefaultMuteFor bool `json:"use_default_mute_for"` - // Time left before notifications will be unmuted, in seconds - MuteFor int32 `json:"mute_for"` - // If true, the value for the relevant type of chat or the forum chat is used instead of sound_id - UseDefaultSound bool `json:"use_default_sound"` - // Identifier of the notification sound to be played; 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 - UseDefaultShowPreview bool `json:"use_default_show_preview"` - // True, if message content must be displayed in notifications - ShowPreview bool `json:"show_preview"` - // If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat or the forum chat is used instead - 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 - 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"` -} - -func (entity *ChatNotificationSettings) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatNotificationSettings - - return json.Marshal((*stub)(entity)) -} - -func (*ChatNotificationSettings) GetClass() string { - return ClassChatNotificationSettings -} - -func (*ChatNotificationSettings) GetType() string { - return TypeChatNotificationSettings -} - -// Contains information about notification settings for several chats -type ScopeNotificationSettings struct { - meta - // Time left before notifications will be unmuted, in seconds - MuteFor int32 `json:"mute_for"` - // Identifier of the notification sound to be played; 0 if sound is disabled - SoundId JsonInt64 `json:"sound_id"` - // True, if message content must be displayed in notifications - ShowPreview bool `json:"show_preview"` - // 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 - DisableMentionNotifications bool `json:"disable_mention_notifications"` -} - -func (entity *ScopeNotificationSettings) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ScopeNotificationSettings - - return json.Marshal((*stub)(entity)) -} - -func (*ScopeNotificationSettings) GetClass() string { - return ClassScopeNotificationSettings -} - -func (*ScopeNotificationSettings) GetType() string { - return TypeScopeNotificationSettings -} - -// Contains information about a message draft -type DraftMessage struct { - meta - // Identifier of the replied message; 0 if none - ReplyToMessageId int64 `json:"reply_to_message_id"` - // 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 - InputMessageText InputMessageContent `json:"input_message_text"` -} - -func (entity *DraftMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub DraftMessage - - return json.Marshal((*stub)(entity)) -} - -func (*DraftMessage) GetClass() string { - return ClassDraftMessage -} - -func (*DraftMessage) GetType() string { - return TypeDraftMessage -} - -func (draftMessage *DraftMessage) UnmarshalJSON(data []byte) error { - var tmp struct { - ReplyToMessageId int64 `json:"reply_to_message_id"` - Date int32 `json:"date"` - InputMessageText json.RawMessage `json:"input_message_text"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - draftMessage.ReplyToMessageId = tmp.ReplyToMessageId - draftMessage.Date = tmp.Date - - fieldInputMessageText, _ := UnmarshalInputMessageContent(tmp.InputMessageText) - draftMessage.InputMessageText = fieldInputMessageText - - return nil -} - -// An ordinary chat with a user -type ChatTypePrivate struct { - meta - // User identifier - UserId int64 `json:"user_id"` -} - -func (entity *ChatTypePrivate) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTypePrivate - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTypePrivate) GetClass() string { - return ClassChatType -} - -func (*ChatTypePrivate) GetType() string { - return TypeChatTypePrivate -} - -func (*ChatTypePrivate) ChatTypeType() string { - return TypeChatTypePrivate -} - -// A basic group (a chat with 0-200 other users) -type ChatTypeBasicGroup struct { - meta - // Basic group identifier - BasicGroupId int64 `json:"basic_group_id"` -} - -func (entity *ChatTypeBasicGroup) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTypeBasicGroup - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTypeBasicGroup) GetClass() string { - return ClassChatType -} - -func (*ChatTypeBasicGroup) GetType() string { - return TypeChatTypeBasicGroup -} - -func (*ChatTypeBasicGroup) ChatTypeType() string { - return TypeChatTypeBasicGroup -} - -// A supergroup or channel (with unlimited members) -type ChatTypeSupergroup struct { - meta - // Supergroup or channel identifier - SupergroupId int64 `json:"supergroup_id"` - // True, if the supergroup is a channel - IsChannel bool `json:"is_channel"` -} - -func (entity *ChatTypeSupergroup) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTypeSupergroup - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTypeSupergroup) GetClass() string { - return ClassChatType -} - -func (*ChatTypeSupergroup) GetType() string { - return TypeChatTypeSupergroup -} - -func (*ChatTypeSupergroup) ChatTypeType() string { - return TypeChatTypeSupergroup -} - -// A secret chat with a user -type ChatTypeSecret struct { - meta - // Secret chat identifier - SecretChatId int32 `json:"secret_chat_id"` - // User identifier of the secret chat peer - UserId int64 `json:"user_id"` -} - -func (entity *ChatTypeSecret) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatTypeSecret - - return json.Marshal((*stub)(entity)) -} - -func (*ChatTypeSecret) GetClass() string { - return ClassChatType -} - -func (*ChatTypeSecret) GetType() string { - return TypeChatTypeSecret -} - -func (*ChatTypeSecret) ChatTypeType() string { - return TypeChatTypeSecret -} - -// Represents a filter of user chats -type ChatFilter struct { - meta - // The title of the filter; 1-12 characters without line feeds - Title string `json:"title"` - // The chosen icon name for short filter representation. If non-empty, must be one of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work", "Airplane", "Book", "Light", "Like", "Money", "Note", "Palette". If empty, use getChatFilterDefaultIconName to get default icon name for the filter - IconName string `json:"icon_name"` - // The chat identifiers of pinned chats in the filtered chat list. There can be up to getOption("chat_filter_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 - PinnedChatIds []int64 `json:"pinned_chat_ids"` - // The chat identifiers of always included chats in the filtered chat list. There can be up to getOption("chat_filter_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 - IncludedChatIds []int64 `json:"included_chat_ids"` - // The chat identifiers of always excluded chats in the filtered chat list. There can be up to getOption("chat_filter_chosen_chat_count_max") always excluded non-secret chats and the same number of secret chats, but the limit can be increased with Telegram Premium - ExcludedChatIds []int64 `json:"excluded_chat_ids"` - // True, if muted chats need to be excluded - ExcludeMuted bool `json:"exclude_muted"` - // True, if read chats need to be excluded - ExcludeRead bool `json:"exclude_read"` - // True, if archived chats need to be excluded - ExcludeArchived bool `json:"exclude_archived"` - // True, if contacts need to be included - IncludeContacts bool `json:"include_contacts"` - // True, if non-contact users need to be included - IncludeNonContacts bool `json:"include_non_contacts"` - // True, if bots need to be included - IncludeBots bool `json:"include_bots"` - // True, if basic groups and supergroups need to be included - IncludeGroups bool `json:"include_groups"` - // True, if channels need to be included - IncludeChannels bool `json:"include_channels"` -} - -func (entity *ChatFilter) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatFilter - - return json.Marshal((*stub)(entity)) -} - -func (*ChatFilter) GetClass() string { - return ClassChatFilter -} - -func (*ChatFilter) GetType() string { - return TypeChatFilter -} - -// Contains basic information about a chat filter -type ChatFilterInfo struct { - meta - // Unique chat filter identifier - Id int32 `json:"id"` - // The title of the filter; 1-12 characters without line feeds - Title string `json:"title"` - // The chosen or default icon name for short filter representation. One of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work", "Airplane", "Book", "Light", "Like", "Money", "Note", "Palette" - IconName string `json:"icon_name"` -} - -func (entity *ChatFilterInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatFilterInfo - - return json.Marshal((*stub)(entity)) -} - -func (*ChatFilterInfo) GetClass() string { - return ClassChatFilterInfo -} - -func (*ChatFilterInfo) GetType() string { - return TypeChatFilterInfo -} - -// Describes a recommended chat filter -type RecommendedChatFilter struct { - meta - // The chat filter - Filter *ChatFilter `json:"filter"` - // Chat filter description - Description string `json:"description"` -} - -func (entity *RecommendedChatFilter) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RecommendedChatFilter - - return json.Marshal((*stub)(entity)) -} - -func (*RecommendedChatFilter) GetClass() string { - return ClassRecommendedChatFilter -} - -func (*RecommendedChatFilter) GetType() string { - return TypeRecommendedChatFilter -} - -// Contains a list of recommended chat filters -type RecommendedChatFilters struct { - meta - // List of recommended chat filters - ChatFilters []*RecommendedChatFilter `json:"chat_filters"` -} - -func (entity *RecommendedChatFilters) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RecommendedChatFilters - - return json.Marshal((*stub)(entity)) -} - -func (*RecommendedChatFilters) GetClass() string { - return ClassRecommendedChatFilters -} - -func (*RecommendedChatFilters) GetType() string { - return TypeRecommendedChatFilters -} - -// A main list of chats -type ChatListMain struct { - meta -} - -func (entity *ChatListMain) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatListMain - - return json.Marshal((*stub)(entity)) -} - -func (*ChatListMain) GetClass() string { - return ClassChatList -} - -func (*ChatListMain) GetType() string { - return TypeChatListMain -} - -func (*ChatListMain) ChatListType() string { - return TypeChatListMain -} - -// A list of chats usually located at the top of the main chat list. Unmuted chats are automatically moved from the Archive to the Main chat list when a new message arrives -type ChatListArchive struct { - meta -} - -func (entity *ChatListArchive) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatListArchive - - return json.Marshal((*stub)(entity)) -} - -func (*ChatListArchive) GetClass() string { - return ClassChatList -} - -func (*ChatListArchive) GetType() string { - return TypeChatListArchive -} - -func (*ChatListArchive) ChatListType() string { - return TypeChatListArchive -} - -// A list of chats belonging to a chat filter -type ChatListFilter struct { - meta - // Chat filter identifier - ChatFilterId int32 `json:"chat_filter_id"` -} - -func (entity *ChatListFilter) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatListFilter - - return json.Marshal((*stub)(entity)) -} - -func (*ChatListFilter) GetClass() string { - return ClassChatList -} - -func (*ChatListFilter) GetType() string { - return TypeChatListFilter -} - -func (*ChatListFilter) ChatListType() string { - return TypeChatListFilter -} - -// Contains a list of chat lists -type ChatLists struct { - meta - // List of chat lists - ChatLists []ChatList `json:"chat_lists"` -} - -func (entity *ChatLists) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatLists - - return json.Marshal((*stub)(entity)) -} - -func (*ChatLists) GetClass() string { - return ClassChatLists -} - -func (*ChatLists) GetType() string { - return TypeChatLists -} - -func (chatLists *ChatLists) UnmarshalJSON(data []byte) error { - var tmp struct { - ChatLists []json.RawMessage `json:"chat_lists"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldChatLists, _ := UnmarshalListOfChatList(tmp.ChatLists) - chatLists.ChatLists = fieldChatLists - - return nil -} - -// The chat is sponsored by the user's MTProxy server -type ChatSourceMtprotoProxy struct { - meta -} - -func (entity *ChatSourceMtprotoProxy) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatSourceMtprotoProxy - - return json.Marshal((*stub)(entity)) -} - -func (*ChatSourceMtprotoProxy) GetClass() string { - return ClassChatSource -} - -func (*ChatSourceMtprotoProxy) GetType() string { - return TypeChatSourceMtprotoProxy -} - -func (*ChatSourceMtprotoProxy) ChatSourceType() string { - return TypeChatSourceMtprotoProxy -} - -// The chat contains a public service announcement -type ChatSourcePublicServiceAnnouncement struct { - meta - // The type of the announcement - Type string `json:"type"` - // The text of the announcement - Text string `json:"text"` -} - -func (entity *ChatSourcePublicServiceAnnouncement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatSourcePublicServiceAnnouncement - - return json.Marshal((*stub)(entity)) -} - -func (*ChatSourcePublicServiceAnnouncement) GetClass() string { - return ClassChatSource -} - -func (*ChatSourcePublicServiceAnnouncement) GetType() string { - return TypeChatSourcePublicServiceAnnouncement -} - -func (*ChatSourcePublicServiceAnnouncement) ChatSourceType() string { - return TypeChatSourcePublicServiceAnnouncement -} - -// Describes a position of a chat in a chat list -type ChatPosition struct { - meta - // The chat list - List ChatList `json:"list"` - // A parameter used to determine order of the chat in the chat list. Chats must be sorted by the pair (order, chat.id) in descending order - Order JsonInt64 `json:"order"` - // True, if the chat is pinned in the chat list - IsPinned bool `json:"is_pinned"` - // Source of the chat in the chat list; may be null - Source ChatSource `json:"source"` -} - -func (entity *ChatPosition) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatPosition - - return json.Marshal((*stub)(entity)) -} - -func (*ChatPosition) GetClass() string { - return ClassChatPosition -} - -func (*ChatPosition) GetType() string { - return TypeChatPosition -} - -func (chatPosition *ChatPosition) UnmarshalJSON(data []byte) error { - var tmp struct { - List json.RawMessage `json:"list"` - Order JsonInt64 `json:"order"` - IsPinned bool `json:"is_pinned"` - Source json.RawMessage `json:"source"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - chatPosition.Order = tmp.Order - chatPosition.IsPinned = tmp.IsPinned - - fieldList, _ := UnmarshalChatList(tmp.List) - chatPosition.List = fieldList - - fieldSource, _ := UnmarshalChatSource(tmp.Source) - chatPosition.Source = fieldSource - - return nil -} - -// All reactions are available in the chat -type ChatAvailableReactionsAll struct { - meta -} - -func (entity *ChatAvailableReactionsAll) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatAvailableReactionsAll - - return json.Marshal((*stub)(entity)) -} - -func (*ChatAvailableReactionsAll) GetClass() string { - return ClassChatAvailableReactions -} - -func (*ChatAvailableReactionsAll) GetType() string { - return TypeChatAvailableReactionsAll -} - -func (*ChatAvailableReactionsAll) ChatAvailableReactionsType() string { - return TypeChatAvailableReactionsAll -} - -// Only specific reactions are available in the chat -type ChatAvailableReactionsSome struct { - meta - // The list of reactions - Reactions []ReactionType `json:"reactions"` -} - -func (entity *ChatAvailableReactionsSome) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatAvailableReactionsSome - - return json.Marshal((*stub)(entity)) -} - -func (*ChatAvailableReactionsSome) GetClass() string { - return ClassChatAvailableReactions -} - -func (*ChatAvailableReactionsSome) GetType() string { - return TypeChatAvailableReactionsSome -} - -func (*ChatAvailableReactionsSome) ChatAvailableReactionsType() string { - return TypeChatAvailableReactionsSome -} - -func (chatAvailableReactionsSome *ChatAvailableReactionsSome) UnmarshalJSON(data []byte) error { - var tmp struct { - Reactions []json.RawMessage `json:"reactions"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldReactions, _ := UnmarshalListOfReactionType(tmp.Reactions) - chatAvailableReactionsSome.Reactions = fieldReactions - - return nil -} - -// Describes a video 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 - GroupCallId int32 `json:"group_call_id"` - // True, if the video chat has participants - HasParticipants bool `json:"has_participants"` - // Default group call participant identifier to join the video chat; may be null - DefaultParticipantId MessageSender `json:"default_participant_id"` -} - -func (entity *VideoChat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub VideoChat - - return json.Marshal((*stub)(entity)) -} - -func (*VideoChat) GetClass() string { - return ClassVideoChat -} - -func (*VideoChat) GetType() string { - return TypeVideoChat -} - -func (videoChat *VideoChat) UnmarshalJSON(data []byte) error { - var tmp struct { - GroupCallId int32 `json:"group_call_id"` - HasParticipants bool `json:"has_participants"` - DefaultParticipantId json.RawMessage `json:"default_participant_id"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - videoChat.GroupCallId = tmp.GroupCallId - videoChat.HasParticipants = tmp.HasParticipants - - fieldDefaultParticipantId, _ := UnmarshalMessageSender(tmp.DefaultParticipantId) - videoChat.DefaultParticipantId = fieldDefaultParticipantId - - return nil -} - -// A chat. (Can be a private chat, basic group, supergroup, or secret chat) -type Chat struct { - meta - // Chat unique identifier - Id int64 `json:"id"` - // Type of the chat - Type ChatType `json:"type"` - // Chat title - Title string `json:"title"` - // Chat photo; may be null - Photo *ChatPhotoInfo `json:"photo"` - // 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 - LastMessage *Message `json:"last_message"` - // Positions of the chat in chat lists - Positions []*ChatPosition `json:"positions"` - // 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"` - // True, if chat content can't be saved locally, forwarded, or copied - HasProtectedContent bool `json:"has_protected_content"` - // True, if the chat is marked as unread - IsMarkedAsUnread bool `json:"is_marked_as_unread"` - // True, if the chat is blocked by the current user and private messages from the chat can't be received - IsBlocked bool `json:"is_blocked"` - // 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 - CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` - // True, if the chat messages can be deleted for all users - CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - // True, if the chat can be reported to Telegram moderators through reportChat or reportChatPhoto - CanBeReported bool `json:"can_be_reported"` - // Default value of the disable_notification parameter, used when a message is sent to the chat - DefaultDisableNotification bool `json:"default_disable_notification"` - // Number of unread messages in the chat - UnreadCount int32 `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 unread messages with a mention/reply in the chat - UnreadMentionCount int32 `json:"unread_mention_count"` - // Number of messages with unread reactions in the chat - UnreadReactionCount int32 `json:"unread_reaction_count"` - // Notification settings for the chat - NotificationSettings *ChatNotificationSettings `json:"notification_settings"` - // Types of reaction, available in the chat - 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"` - // If non-empty, name of a theme, set for the chat - ThemeName string `json:"theme_name"` - // Information about actions which must be possible to do through the chat action bar; may be null - ActionBar ChatActionBar `json:"action_bar"` - // Information about video chat of the chat - VideoChat *VideoChat `json:"video_chat"` - // Information about pending join requests; may be null - PendingJoinRequests *ChatJoinRequestsInfo `json:"pending_join_requests"` - // Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat - ReplyMarkupMessageId int64 `json:"reply_markup_message_id"` - // A draft of a message in the chat; may be null - DraftMessage *DraftMessage `json:"draft_message"` - // Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used - ClientData string `json:"client_data"` -} - -func (entity *Chat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Chat - - return json.Marshal((*stub)(entity)) -} - -func (*Chat) GetClass() string { - return ClassChat -} - -func (*Chat) GetType() string { - return TypeChat -} - -func (chat *Chat) UnmarshalJSON(data []byte) error { - var tmp struct { - Id int64 `json:"id"` - Type json.RawMessage `json:"type"` - Title string `json:"title"` - Photo *ChatPhotoInfo `json:"photo"` - Permissions *ChatPermissions `json:"permissions"` - LastMessage *Message `json:"last_message"` - Positions []*ChatPosition `json:"positions"` - MessageSenderId json.RawMessage `json:"message_sender_id"` - HasProtectedContent bool `json:"has_protected_content"` - IsMarkedAsUnread bool `json:"is_marked_as_unread"` - IsBlocked bool `json:"is_blocked"` - HasScheduledMessages bool `json:"has_scheduled_messages"` - CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` - CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - CanBeReported bool `json:"can_be_reported"` - DefaultDisableNotification bool `json:"default_disable_notification"` - UnreadCount int32 `json:"unread_count"` - LastReadInboxMessageId int64 `json:"last_read_inbox_message_id"` - LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` - UnreadMentionCount int32 `json:"unread_mention_count"` - UnreadReactionCount int32 `json:"unread_reaction_count"` - NotificationSettings *ChatNotificationSettings `json:"notification_settings"` - AvailableReactions json.RawMessage `json:"available_reactions"` - MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` - ThemeName string `json:"theme_name"` - ActionBar json.RawMessage `json:"action_bar"` - VideoChat *VideoChat `json:"video_chat"` - PendingJoinRequests *ChatJoinRequestsInfo `json:"pending_join_requests"` - ReplyMarkupMessageId int64 `json:"reply_markup_message_id"` - DraftMessage *DraftMessage `json:"draft_message"` - ClientData string `json:"client_data"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - chat.Id = tmp.Id - chat.Title = tmp.Title - chat.Photo = tmp.Photo - chat.Permissions = tmp.Permissions - chat.LastMessage = tmp.LastMessage - chat.Positions = tmp.Positions - chat.HasProtectedContent = tmp.HasProtectedContent - chat.IsMarkedAsUnread = tmp.IsMarkedAsUnread - chat.IsBlocked = tmp.IsBlocked - chat.HasScheduledMessages = tmp.HasScheduledMessages - chat.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf - chat.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers - chat.CanBeReported = tmp.CanBeReported - chat.DefaultDisableNotification = tmp.DefaultDisableNotification - chat.UnreadCount = tmp.UnreadCount - chat.LastReadInboxMessageId = tmp.LastReadInboxMessageId - chat.LastReadOutboxMessageId = tmp.LastReadOutboxMessageId - chat.UnreadMentionCount = tmp.UnreadMentionCount - chat.UnreadReactionCount = tmp.UnreadReactionCount - chat.NotificationSettings = tmp.NotificationSettings - chat.MessageAutoDeleteTime = tmp.MessageAutoDeleteTime - chat.ThemeName = tmp.ThemeName - chat.VideoChat = tmp.VideoChat - chat.PendingJoinRequests = tmp.PendingJoinRequests - chat.ReplyMarkupMessageId = tmp.ReplyMarkupMessageId - chat.DraftMessage = tmp.DraftMessage - chat.ClientData = tmp.ClientData - - fieldType, _ := UnmarshalChatType(tmp.Type) - chat.Type = fieldType - - fieldMessageSenderId, _ := UnmarshalMessageSender(tmp.MessageSenderId) - chat.MessageSenderId = fieldMessageSenderId - - fieldAvailableReactions, _ := UnmarshalChatAvailableReactions(tmp.AvailableReactions) - chat.AvailableReactions = fieldAvailableReactions - - fieldActionBar, _ := UnmarshalChatActionBar(tmp.ActionBar) - chat.ActionBar = fieldActionBar - - return nil -} - -// Represents a list of chats -type Chats struct { - meta - // Approximate total number of chats found - TotalCount int32 `json:"total_count"` - // List of chat identifiers - ChatIds []int64 `json:"chat_ids"` -} - -func (entity *Chats) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Chats - - return json.Marshal((*stub)(entity)) -} - -func (*Chats) GetClass() string { - return ClassChats -} - -func (*Chats) GetType() string { - return TypeChats -} - -// Describes a chat located nearby -type ChatNearby struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` - // Distance to the chat location, in meters - Distance int32 `json:"distance"` -} - -func (entity *ChatNearby) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatNearby - - return json.Marshal((*stub)(entity)) -} - -func (*ChatNearby) GetClass() string { - return ClassChatNearby -} - -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 -} - -// The chat is public, because it has an active username -type PublicChatTypeHasUsername struct { - meta -} - -func (entity *PublicChatTypeHasUsername) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PublicChatTypeHasUsername - - return json.Marshal((*stub)(entity)) -} - -func (*PublicChatTypeHasUsername) GetClass() string { - return ClassPublicChatType -} - -func (*PublicChatTypeHasUsername) GetType() string { - return TypePublicChatTypeHasUsername -} - -func (*PublicChatTypeHasUsername) PublicChatTypeType() string { - return TypePublicChatTypeHasUsername -} - -// The chat is public, because it is a location-based supergroup -type PublicChatTypeIsLocationBased struct { - meta -} - -func (entity *PublicChatTypeIsLocationBased) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PublicChatTypeIsLocationBased - - return json.Marshal((*stub)(entity)) -} - -func (*PublicChatTypeIsLocationBased) GetClass() string { - return ClassPublicChatType -} - -func (*PublicChatTypeIsLocationBased) GetType() string { - return TypePublicChatTypeIsLocationBased -} - -func (*PublicChatTypeIsLocationBased) PublicChatTypeType() string { - return TypePublicChatTypeIsLocationBased -} - -// The chat can be reported as spam using the method reportChat with the reason chatReportReasonSpam. 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 - CanUnarchive bool `json:"can_unarchive"` -} - -func (entity *ChatActionBarReportSpam) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatActionBarReportSpam - - return json.Marshal((*stub)(entity)) -} - -func (*ChatActionBarReportSpam) GetClass() string { - return ClassChatActionBar -} - -func (*ChatActionBarReportSpam) GetType() string { - return TypeChatActionBarReportSpam -} - -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 chatReportReasonUnrelatedLocation -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 -} - -func (entity *ChatActionBarInviteMembers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatActionBarInviteMembers - - return json.Marshal((*stub)(entity)) -} - -func (*ChatActionBarInviteMembers) GetClass() string { - return ClassChatActionBar -} - -func (*ChatActionBarInviteMembers) GetType() string { - return TypeChatActionBarInviteMembers -} - -func (*ChatActionBarInviteMembers) ChatActionBarType() string { - return TypeChatActionBarInviteMembers -} - -// The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method toggleMessageSenderIsBlocked, or the other user can be added to the contact list using the method addContact. 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 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"` -} - -func (entity *ChatActionBarReportAddBlock) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatActionBarReportAddBlock - - return json.Marshal((*stub)(entity)) -} - -func (*ChatActionBarReportAddBlock) GetClass() string { - return ClassChatActionBar -} - -func (*ChatActionBarReportAddBlock) GetType() string { - return TypeChatActionBarReportAddBlock -} - -func (*ChatActionBarReportAddBlock) ChatActionBarType() string { - return TypeChatActionBarReportAddBlock -} - -// The chat is a private or secret chat and the other user can be added to the contact list using the method addContact -type ChatActionBarAddContact struct { - meta -} - -func (entity *ChatActionBarAddContact) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatActionBarAddContact - - return json.Marshal((*stub)(entity)) -} - -func (*ChatActionBarAddContact) GetClass() string { - return ClassChatActionBar -} - -func (*ChatActionBarAddContact) GetType() string { - return TypeChatActionBarAddContact -} - -func (*ChatActionBarAddContact) ChatActionBarType() string { - return TypeChatActionBarAddContact -} - -// The chat is a private or secret chat with a mutual contact and the user's phone number can be shared with the other user using the method sharePhoneNumber -type ChatActionBarSharePhoneNumber struct { - meta -} - -func (entity *ChatActionBarSharePhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatActionBarSharePhoneNumber - - return json.Marshal((*stub)(entity)) -} - -func (*ChatActionBarSharePhoneNumber) GetClass() string { - return ClassChatActionBar -} - -func (*ChatActionBarSharePhoneNumber) GetType() string { - return TypeChatActionBarSharePhoneNumber -} - -func (*ChatActionBarSharePhoneNumber) ChatActionBarType() string { - return TypeChatActionBarSharePhoneNumber -} - -// The chat is a private chat with an administrator of a chat to which the user sent join request -type ChatActionBarJoinRequest struct { - meta - // Title of the chat to which the join request was sent - Title string `json:"title"` - // True, if the join request was sent to a channel chat - IsChannel bool `json:"is_channel"` - // Point in time (Unix timestamp) when the join request was sent - RequestDate int32 `json:"request_date"` -} - -func (entity *ChatActionBarJoinRequest) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ChatActionBarJoinRequest - - return json.Marshal((*stub)(entity)) -} - -func (*ChatActionBarJoinRequest) GetClass() string { - return ClassChatActionBar -} - -func (*ChatActionBarJoinRequest) GetType() string { - return TypeChatActionBarJoinRequest -} - -func (*ChatActionBarJoinRequest) ChatActionBarType() string { - return TypeChatActionBarJoinRequest -} - -// A simple button, with text that must be sent when the button is pressed -type KeyboardButtonTypeText struct { - meta -} - -func (entity *KeyboardButtonTypeText) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub KeyboardButtonTypeText - - return json.Marshal((*stub)(entity)) -} - -func (*KeyboardButtonTypeText) GetClass() string { - return ClassKeyboardButtonType -} - -func (*KeyboardButtonTypeText) GetType() string { - return TypeKeyboardButtonTypeText -} - -func (*KeyboardButtonTypeText) KeyboardButtonTypeType() string { - return TypeKeyboardButtonTypeText -} - -// A button that sends the user's phone number when pressed; available only in private chats -type KeyboardButtonTypeRequestPhoneNumber struct { - meta -} - -func (entity *KeyboardButtonTypeRequestPhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub KeyboardButtonTypeRequestPhoneNumber - - return json.Marshal((*stub)(entity)) -} - -func (*KeyboardButtonTypeRequestPhoneNumber) GetClass() string { - return ClassKeyboardButtonType -} - -func (*KeyboardButtonTypeRequestPhoneNumber) GetType() string { - return TypeKeyboardButtonTypeRequestPhoneNumber -} - -func (*KeyboardButtonTypeRequestPhoneNumber) KeyboardButtonTypeType() string { - return TypeKeyboardButtonTypeRequestPhoneNumber -} - -// A button that sends the user's location when pressed; available only in private chats -type KeyboardButtonTypeRequestLocation struct { - meta -} - -func (entity *KeyboardButtonTypeRequestLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub KeyboardButtonTypeRequestLocation - - return json.Marshal((*stub)(entity)) -} - -func (*KeyboardButtonTypeRequestLocation) GetClass() string { - return ClassKeyboardButtonType -} - -func (*KeyboardButtonTypeRequestLocation) GetType() string { - return TypeKeyboardButtonTypeRequestLocation -} - -func (*KeyboardButtonTypeRequestLocation) KeyboardButtonTypeType() string { - return TypeKeyboardButtonTypeRequestLocation -} - -// A button that allows the user to create and send a poll when pressed; available only in private chats -type KeyboardButtonTypeRequestPoll struct { - meta - // If true, only regular polls must be allowed to create - ForceRegular bool `json:"force_regular"` - // If true, only polls in quiz mode must be allowed to create - ForceQuiz bool `json:"force_quiz"` -} - -func (entity *KeyboardButtonTypeRequestPoll) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub KeyboardButtonTypeRequestPoll - - return json.Marshal((*stub)(entity)) -} - -func (*KeyboardButtonTypeRequestPoll) GetClass() string { - return ClassKeyboardButtonType -} - -func (*KeyboardButtonTypeRequestPoll) GetType() string { - return TypeKeyboardButtonTypeRequestPoll -} - -func (*KeyboardButtonTypeRequestPoll) KeyboardButtonTypeType() string { - return TypeKeyboardButtonTypeRequestPoll -} - -// A button that opens a Web App by calling getWebAppUrl -type KeyboardButtonTypeWebApp struct { - meta - // An HTTP URL to pass to getWebAppUrl - Url string `json:"url"` -} - -func (entity *KeyboardButtonTypeWebApp) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub KeyboardButtonTypeWebApp - - return json.Marshal((*stub)(entity)) -} - -func (*KeyboardButtonTypeWebApp) GetClass() string { - return ClassKeyboardButtonType -} - -func (*KeyboardButtonTypeWebApp) GetType() string { - return TypeKeyboardButtonTypeWebApp -} - -func (*KeyboardButtonTypeWebApp) KeyboardButtonTypeType() string { - return TypeKeyboardButtonTypeWebApp -} - -// Represents a single button in a bot keyboard -type KeyboardButton struct { - meta - // Text of the button - Text string `json:"text"` - // Type of the button - Type KeyboardButtonType `json:"type"` -} - -func (entity *KeyboardButton) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub KeyboardButton - - return json.Marshal((*stub)(entity)) -} - -func (*KeyboardButton) GetClass() string { - return ClassKeyboardButton -} - -func (*KeyboardButton) GetType() string { - return TypeKeyboardButton -} - -func (keyboardButton *KeyboardButton) UnmarshalJSON(data []byte) error { - var tmp struct { - Text string `json:"text"` - Type json.RawMessage `json:"type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - keyboardButton.Text = tmp.Text - - fieldType, _ := UnmarshalKeyboardButtonType(tmp.Type) - keyboardButton.Type = fieldType - - return nil -} - -// A button that opens a specified URL -type InlineKeyboardButtonTypeUrl struct { - meta - // HTTP or tg:// URL to open - Url string `json:"url"` -} - -func (entity *InlineKeyboardButtonTypeUrl) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InlineKeyboardButtonTypeUrl - - return json.Marshal((*stub)(entity)) -} - -func (*InlineKeyboardButtonTypeUrl) GetClass() string { - return ClassInlineKeyboardButtonType -} - -func (*InlineKeyboardButtonTypeUrl) GetType() string { - return TypeInlineKeyboardButtonTypeUrl -} - -func (*InlineKeyboardButtonTypeUrl) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeUrl -} - -// A button that opens a specified URL and automatically authorize the current user by calling getLoginUrlInfo -type InlineKeyboardButtonTypeLoginUrl struct { - meta - // An HTTP URL to pass to getLoginUrlInfo - Url string `json:"url"` - // Unique button identifier - Id int64 `json:"id"` - // If non-empty, new text of the button in forwarded messages - ForwardText string `json:"forward_text"` -} - -func (entity *InlineKeyboardButtonTypeLoginUrl) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InlineKeyboardButtonTypeLoginUrl - - return json.Marshal((*stub)(entity)) -} - -func (*InlineKeyboardButtonTypeLoginUrl) GetClass() string { - return ClassInlineKeyboardButtonType -} - -func (*InlineKeyboardButtonTypeLoginUrl) GetType() string { - return TypeInlineKeyboardButtonTypeLoginUrl -} - -func (*InlineKeyboardButtonTypeLoginUrl) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeLoginUrl -} - -// A button that opens a Web App by calling openWebApp -type InlineKeyboardButtonTypeWebApp struct { - meta - // An HTTP URL to pass to openWebApp - Url string `json:"url"` -} - -func (entity *InlineKeyboardButtonTypeWebApp) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InlineKeyboardButtonTypeWebApp - - return json.Marshal((*stub)(entity)) -} - -func (*InlineKeyboardButtonTypeWebApp) GetClass() string { - return ClassInlineKeyboardButtonType -} - -func (*InlineKeyboardButtonTypeWebApp) GetType() string { - return TypeInlineKeyboardButtonTypeWebApp -} - -func (*InlineKeyboardButtonTypeWebApp) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeWebApp -} - -// A button that sends a callback query to a bot -type InlineKeyboardButtonTypeCallback struct { - meta - // Data to be sent to the bot via a callback query - Data []byte `json:"data"` -} - -func (entity *InlineKeyboardButtonTypeCallback) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InlineKeyboardButtonTypeCallback - - return json.Marshal((*stub)(entity)) -} - -func (*InlineKeyboardButtonTypeCallback) GetClass() string { - return ClassInlineKeyboardButtonType -} - -func (*InlineKeyboardButtonTypeCallback) GetType() string { - return TypeInlineKeyboardButtonTypeCallback -} - -func (*InlineKeyboardButtonTypeCallback) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeCallback -} - -// A button that asks for the 2-step verification password of the current user and then sends a callback query to a bot -type InlineKeyboardButtonTypeCallbackWithPassword struct { - meta - // Data to be sent to the bot via a callback query - Data []byte `json:"data"` -} - -func (entity *InlineKeyboardButtonTypeCallbackWithPassword) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InlineKeyboardButtonTypeCallbackWithPassword - - return json.Marshal((*stub)(entity)) -} - -func (*InlineKeyboardButtonTypeCallbackWithPassword) GetClass() string { - return ClassInlineKeyboardButtonType -} - -func (*InlineKeyboardButtonTypeCallbackWithPassword) GetType() string { - return TypeInlineKeyboardButtonTypeCallbackWithPassword -} - -func (*InlineKeyboardButtonTypeCallbackWithPassword) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeCallbackWithPassword -} - -// A button with a game that sends a callback query to a bot. This button must be in the first column and row of the keyboard and can be attached only to a message with content of the type messageGame -type InlineKeyboardButtonTypeCallbackGame struct { - meta -} - -func (entity *InlineKeyboardButtonTypeCallbackGame) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InlineKeyboardButtonTypeCallbackGame - - return json.Marshal((*stub)(entity)) -} - -func (*InlineKeyboardButtonTypeCallbackGame) GetClass() string { - return ClassInlineKeyboardButtonType -} - -func (*InlineKeyboardButtonTypeCallbackGame) GetType() string { - return TypeInlineKeyboardButtonTypeCallbackGame -} - -func (*InlineKeyboardButtonTypeCallbackGame) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeCallbackGame -} - -// A button that forces an inline query to the bot to be inserted in the input field -type InlineKeyboardButtonTypeSwitchInline struct { - meta - // Inline query to be sent to the bot - Query string `json:"query"` - // True, if the inline query must be sent from the current chat - InCurrentChat bool `json:"in_current_chat"` -} - -func (entity *InlineKeyboardButtonTypeSwitchInline) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InlineKeyboardButtonTypeSwitchInline - - return json.Marshal((*stub)(entity)) -} - -func (*InlineKeyboardButtonTypeSwitchInline) GetClass() string { - return ClassInlineKeyboardButtonType -} - -func (*InlineKeyboardButtonTypeSwitchInline) GetType() string { - return TypeInlineKeyboardButtonTypeSwitchInline -} - -func (*InlineKeyboardButtonTypeSwitchInline) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeSwitchInline -} - -// A button to buy something. This button must be in the first column and row of the keyboard and can be attached only to a message with content of the type messageInvoice -type InlineKeyboardButtonTypeBuy struct { - meta -} - -func (entity *InlineKeyboardButtonTypeBuy) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InlineKeyboardButtonTypeBuy - - return json.Marshal((*stub)(entity)) -} - -func (*InlineKeyboardButtonTypeBuy) GetClass() string { - return ClassInlineKeyboardButtonType -} - -func (*InlineKeyboardButtonTypeBuy) GetType() string { - return TypeInlineKeyboardButtonTypeBuy -} - -func (*InlineKeyboardButtonTypeBuy) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeBuy -} - -// A button with a user reference to be handled in the same way as textEntityTypeMentionName entities -type InlineKeyboardButtonTypeUser struct { - meta - // User identifier - UserId int64 `json:"user_id"` -} - -func (entity *InlineKeyboardButtonTypeUser) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InlineKeyboardButtonTypeUser - - return json.Marshal((*stub)(entity)) -} - -func (*InlineKeyboardButtonTypeUser) GetClass() string { - return ClassInlineKeyboardButtonType -} - -func (*InlineKeyboardButtonTypeUser) GetType() string { - return TypeInlineKeyboardButtonTypeUser -} - -func (*InlineKeyboardButtonTypeUser) InlineKeyboardButtonTypeType() string { - return TypeInlineKeyboardButtonTypeUser -} - -// Represents a single button in an inline keyboard -type InlineKeyboardButton struct { - meta - // Text of the button - Text string `json:"text"` - // Type of the button - Type InlineKeyboardButtonType `json:"type"` -} - -func (entity *InlineKeyboardButton) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InlineKeyboardButton - - return json.Marshal((*stub)(entity)) -} - -func (*InlineKeyboardButton) GetClass() string { - return ClassInlineKeyboardButton -} - -func (*InlineKeyboardButton) GetType() string { - return TypeInlineKeyboardButton -} - -func (inlineKeyboardButton *InlineKeyboardButton) UnmarshalJSON(data []byte) error { - var tmp struct { - Text string `json:"text"` - Type json.RawMessage `json:"type"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inlineKeyboardButton.Text = tmp.Text - - fieldType, _ := UnmarshalInlineKeyboardButtonType(tmp.Type) - inlineKeyboardButton.Type = fieldType - - return nil -} - -// Instructs application to remove the keyboard once this message has been received. This kind of keyboard can't be received in an incoming message; instead, updateChatReplyMarkup with message_id == 0 will be sent -type ReplyMarkupRemoveKeyboard struct { - meta - // True, if the keyboard is removed only for the mentioned users or the target user of a reply - IsPersonal bool `json:"is_personal"` -} - -func (entity *ReplyMarkupRemoveKeyboard) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ReplyMarkupRemoveKeyboard - - return json.Marshal((*stub)(entity)) -} - -func (*ReplyMarkupRemoveKeyboard) GetClass() string { - return ClassReplyMarkup -} - -func (*ReplyMarkupRemoveKeyboard) GetType() string { - return TypeReplyMarkupRemoveKeyboard -} - -func (*ReplyMarkupRemoveKeyboard) ReplyMarkupType() string { - return TypeReplyMarkupRemoveKeyboard -} - -// Instructs application to force a reply to this message -type ReplyMarkupForceReply struct { - meta - // True, if a forced reply must automatically be shown to the current user. For outgoing messages, specify true to show the forced reply only for the mentioned users and for the target user of a reply - IsPersonal bool `json:"is_personal"` - // If non-empty, the placeholder to be shown in the input field when the reply is active; 0-64 characters - InputFieldPlaceholder string `json:"input_field_placeholder"` -} - -func (entity *ReplyMarkupForceReply) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ReplyMarkupForceReply - - return json.Marshal((*stub)(entity)) -} - -func (*ReplyMarkupForceReply) GetClass() string { - return ClassReplyMarkup -} - -func (*ReplyMarkupForceReply) GetType() string { - return TypeReplyMarkupForceReply -} - -func (*ReplyMarkupForceReply) ReplyMarkupType() string { - return TypeReplyMarkupForceReply -} - -// Contains a custom keyboard layout to quickly reply to bots -type ReplyMarkupShowKeyboard struct { - meta - // A list of rows of bot keyboard buttons - Rows [][]*KeyboardButton `json:"rows"` - // True, if the keyboard is supposed to be always 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"` - // True, if the application needs to hide the keyboard after use - OneTime bool `json:"one_time"` - // True, if the keyboard must automatically be shown to the current user. For outgoing messages, specify true to show the keyboard only for the mentioned users and for the target user of a reply - IsPersonal bool `json:"is_personal"` - // If non-empty, the placeholder to be shown in the input field when the keyboard is active; 0-64 characters - InputFieldPlaceholder string `json:"input_field_placeholder"` -} - -func (entity *ReplyMarkupShowKeyboard) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ReplyMarkupShowKeyboard - - return json.Marshal((*stub)(entity)) -} - -func (*ReplyMarkupShowKeyboard) GetClass() string { - return ClassReplyMarkup -} - -func (*ReplyMarkupShowKeyboard) GetType() string { - return TypeReplyMarkupShowKeyboard -} - -func (*ReplyMarkupShowKeyboard) ReplyMarkupType() string { - return TypeReplyMarkupShowKeyboard -} - -// Contains an inline keyboard layout -type ReplyMarkupInlineKeyboard struct { - meta - // A list of rows of inline keyboard buttons - Rows [][]*InlineKeyboardButton `json:"rows"` -} - -func (entity *ReplyMarkupInlineKeyboard) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ReplyMarkupInlineKeyboard - - return json.Marshal((*stub)(entity)) -} - -func (*ReplyMarkupInlineKeyboard) GetClass() string { - return ClassReplyMarkup -} - -func (*ReplyMarkupInlineKeyboard) GetType() string { - return TypeReplyMarkupInlineKeyboard -} - -func (*ReplyMarkupInlineKeyboard) ReplyMarkupType() string { - return TypeReplyMarkupInlineKeyboard -} - -// An HTTP url needs to be open -type LoginUrlInfoOpen struct { - meta - // The URL to open - Url string `json:"url"` - // True, if there is no need to show an ordinary open URL confirm - SkipConfirm bool `json:"skip_confirm"` -} - -func (entity *LoginUrlInfoOpen) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub LoginUrlInfoOpen - - return json.Marshal((*stub)(entity)) -} - -func (*LoginUrlInfoOpen) GetClass() string { - return ClassLoginUrlInfo -} - -func (*LoginUrlInfoOpen) GetType() string { - return TypeLoginUrlInfoOpen -} - -func (*LoginUrlInfoOpen) LoginUrlInfoType() string { - return TypeLoginUrlInfoOpen -} - -// An authorization confirmation dialog needs to be shown to the user -type LoginUrlInfoRequestConfirmation struct { - meta - // An HTTP URL to be opened - Url string `json:"url"` - // A domain of the URL - Domain string `json:"domain"` - // User identifier of a bot linked with the website - BotUserId int64 `json:"bot_user_id"` - // True, if the user needs to be requested to give the permission to the bot to send them messages - RequestWriteAccess bool `json:"request_write_access"` -} - -func (entity *LoginUrlInfoRequestConfirmation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub LoginUrlInfoRequestConfirmation - - return json.Marshal((*stub)(entity)) -} - -func (*LoginUrlInfoRequestConfirmation) GetClass() string { - return ClassLoginUrlInfo -} - -func (*LoginUrlInfoRequestConfirmation) GetType() string { - return TypeLoginUrlInfoRequestConfirmation -} - -func (*LoginUrlInfoRequestConfirmation) LoginUrlInfoType() string { - return TypeLoginUrlInfoRequestConfirmation -} - -// Contains information about a Web App -type WebAppInfo struct { - meta - // Unique identifier for the Web App launch - LaunchId JsonInt64 `json:"launch_id"` - // A Web App URL to open in a web view - Url string `json:"url"` -} - -func (entity *WebAppInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub WebAppInfo - - return json.Marshal((*stub)(entity)) -} - -func (*WebAppInfo) GetClass() string { - return ClassWebAppInfo -} - -func (*WebAppInfo) GetType() string { - return TypeWebAppInfo -} - -// Contains information about a message thread -type MessageThreadInfo struct { - meta - // Identifier of the chat to which the message thread belongs - ChatId int64 `json:"chat_id"` - // Message thread identifier, unique within the chat - MessageThreadId int64 `json:"message_thread_id"` - // Information about the message thread; may be null for forum topic threads - 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) - Messages []*Message `json:"messages"` - // A draft of a message in the message thread; may be null - DraftMessage *DraftMessage `json:"draft_message"` -} - -func (entity *MessageThreadInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageThreadInfo - - return json.Marshal((*stub)(entity)) -} - -func (*MessageThreadInfo) GetClass() string { - return ClassMessageThreadInfo -} - -func (*MessageThreadInfo) GetType() string { - return TypeMessageThreadInfo -} - -// Describes a forum topic icon -type ForumTopicIcon struct { - meta - // Color of the topic icon in RGB format - Color int32 `json:"color"` - // Unique identifier of the custom emoji shown on the topic icon; 0 if none - CustomEmojiId JsonInt64 `json:"custom_emoji_id"` -} - -func (entity *ForumTopicIcon) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ForumTopicIcon - - return json.Marshal((*stub)(entity)) -} - -func (*ForumTopicIcon) GetClass() string { - return ClassForumTopicIcon -} - -func (*ForumTopicIcon) GetType() string { - return TypeForumTopicIcon -} - -// Contains basic information about a forum topic -type ForumTopicInfo struct { - meta - // Message thread identifier of the topic - MessageThreadId int64 `json:"message_thread_id"` - // Name of the topic - Name string `json:"name"` - // Icon of the topic - Icon *ForumTopicIcon `json:"icon"` - // Date the topic was created - 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 - 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 - 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"` -} - -func (entity *ForumTopicInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ForumTopicInfo - - return json.Marshal((*stub)(entity)) -} - -func (*ForumTopicInfo) GetClass() string { - return ClassForumTopicInfo -} - -func (*ForumTopicInfo) GetType() string { - return TypeForumTopicInfo -} - -func (forumTopicInfo *ForumTopicInfo) UnmarshalJSON(data []byte) error { - var tmp struct { - MessageThreadId int64 `json:"message_thread_id"` - Name string `json:"name"` - Icon *ForumTopicIcon `json:"icon"` - CreationDate int32 `json:"creation_date"` - CreatorId json.RawMessage `json:"creator_id"` - IsGeneral bool `json:"is_general"` - IsOutgoing bool `json:"is_outgoing"` - IsClosed bool `json:"is_closed"` - IsHidden bool `json:"is_hidden"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - forumTopicInfo.MessageThreadId = tmp.MessageThreadId - forumTopicInfo.Name = tmp.Name - forumTopicInfo.Icon = tmp.Icon - forumTopicInfo.CreationDate = tmp.CreationDate - forumTopicInfo.IsGeneral = tmp.IsGeneral - forumTopicInfo.IsOutgoing = tmp.IsOutgoing - forumTopicInfo.IsClosed = tmp.IsClosed - forumTopicInfo.IsHidden = tmp.IsHidden - - fieldCreatorId, _ := UnmarshalMessageSender(tmp.CreatorId) - forumTopicInfo.CreatorId = fieldCreatorId - - return nil -} - -// Describes a forum topic -type ForumTopic struct { - meta - // Basic information about the topic - Info *ForumTopicInfo `json:"info"` - // Last message in the topic; may be null if unknown - LastMessage *Message `json:"last_message"` - // True, if the topic is pinned in the topic list - IsPinned bool `json:"is_pinned"` - // Number of unread messages in the topic - UnreadCount int32 `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 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 - DraftMessage *DraftMessage `json:"draft_message"` -} - -func (entity *ForumTopic) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ForumTopic - - return json.Marshal((*stub)(entity)) -} - -func (*ForumTopic) GetClass() string { - return ClassForumTopic -} - -func (*ForumTopic) GetType() string { - return TypeForumTopic -} - -// Describes a list of forum topics -type ForumTopics struct { - meta - // Approximate total number of forum topics found - TotalCount int32 `json:"total_count"` - // List of forum topics - Topics []*ForumTopic `json:"topics"` - // Offset date for the next getForumTopics request - 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"` -} - -func (entity *ForumTopics) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ForumTopics - - return json.Marshal((*stub)(entity)) -} - -func (*ForumTopics) GetClass() string { - return ClassForumTopics -} - -func (*ForumTopics) GetType() string { - return TypeForumTopics -} - -// A plain text -type RichTextPlain struct { - meta - // Text - Text string `json:"text"` -} - -func (entity *RichTextPlain) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextPlain - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextPlain) GetClass() string { - return ClassRichText -} - -func (*RichTextPlain) GetType() string { - return TypeRichTextPlain -} - -func (*RichTextPlain) RichTextType() string { - return TypeRichTextPlain -} - -// A bold rich text -type RichTextBold struct { - meta - // Text - Text RichText `json:"text"` -} - -func (entity *RichTextBold) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextBold - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextBold) GetClass() string { - return ClassRichText -} - -func (*RichTextBold) GetType() string { - return TypeRichTextBold -} - -func (*RichTextBold) RichTextType() string { - return TypeRichTextBold -} - -func (richTextBold *RichTextBold) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextBold.Text = fieldText - - return nil -} - -// An italicized rich text -type RichTextItalic struct { - meta - // Text - Text RichText `json:"text"` -} - -func (entity *RichTextItalic) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextItalic - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextItalic) GetClass() string { - return ClassRichText -} - -func (*RichTextItalic) GetType() string { - return TypeRichTextItalic -} - -func (*RichTextItalic) RichTextType() string { - return TypeRichTextItalic -} - -func (richTextItalic *RichTextItalic) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextItalic.Text = fieldText - - return nil -} - -// An underlined rich text -type RichTextUnderline struct { - meta - // Text - Text RichText `json:"text"` -} - -func (entity *RichTextUnderline) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextUnderline - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextUnderline) GetClass() string { - return ClassRichText -} - -func (*RichTextUnderline) GetType() string { - return TypeRichTextUnderline -} - -func (*RichTextUnderline) RichTextType() string { - return TypeRichTextUnderline -} - -func (richTextUnderline *RichTextUnderline) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextUnderline.Text = fieldText - - return nil -} - -// A strikethrough rich text -type RichTextStrikethrough struct { - meta - // Text - Text RichText `json:"text"` -} - -func (entity *RichTextStrikethrough) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextStrikethrough - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextStrikethrough) GetClass() string { - return ClassRichText -} - -func (*RichTextStrikethrough) GetType() string { - return TypeRichTextStrikethrough -} - -func (*RichTextStrikethrough) RichTextType() string { - return TypeRichTextStrikethrough -} - -func (richTextStrikethrough *RichTextStrikethrough) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextStrikethrough.Text = fieldText - - return nil -} - -// A fixed-width rich text -type RichTextFixed struct { - meta - // Text - Text RichText `json:"text"` -} - -func (entity *RichTextFixed) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextFixed - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextFixed) GetClass() string { - return ClassRichText -} - -func (*RichTextFixed) GetType() string { - return TypeRichTextFixed -} - -func (*RichTextFixed) RichTextType() string { - return TypeRichTextFixed -} - -func (richTextFixed *RichTextFixed) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextFixed.Text = fieldText - - return nil -} - -// A rich text URL link -type RichTextUrl struct { - meta - // Text - Text RichText `json:"text"` - // URL - Url string `json:"url"` - // True, if the URL has cached instant view server-side - IsCached bool `json:"is_cached"` -} - -func (entity *RichTextUrl) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextUrl - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextUrl) GetClass() string { - return ClassRichText -} - -func (*RichTextUrl) GetType() string { - return TypeRichTextUrl -} - -func (*RichTextUrl) RichTextType() string { - return TypeRichTextUrl -} - -func (richTextUrl *RichTextUrl) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - Url string `json:"url"` - IsCached bool `json:"is_cached"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - richTextUrl.Url = tmp.Url - richTextUrl.IsCached = tmp.IsCached - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextUrl.Text = fieldText - - return nil -} - -// A rich text email link -type RichTextEmailAddress struct { - meta - // Text - Text RichText `json:"text"` - // Email address - EmailAddress string `json:"email_address"` -} - -func (entity *RichTextEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextEmailAddress - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextEmailAddress) GetClass() string { - return ClassRichText -} - -func (*RichTextEmailAddress) GetType() string { - return TypeRichTextEmailAddress -} - -func (*RichTextEmailAddress) RichTextType() string { - return TypeRichTextEmailAddress -} - -func (richTextEmailAddress *RichTextEmailAddress) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - EmailAddress string `json:"email_address"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - richTextEmailAddress.EmailAddress = tmp.EmailAddress - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextEmailAddress.Text = fieldText - - return nil -} - -// A subscript rich text -type RichTextSubscript struct { - meta - // Text - Text RichText `json:"text"` -} - -func (entity *RichTextSubscript) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextSubscript - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextSubscript) GetClass() string { - return ClassRichText -} - -func (*RichTextSubscript) GetType() string { - return TypeRichTextSubscript -} - -func (*RichTextSubscript) RichTextType() string { - return TypeRichTextSubscript -} - -func (richTextSubscript *RichTextSubscript) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextSubscript.Text = fieldText - - return nil -} - -// A superscript rich text -type RichTextSuperscript struct { - meta - // Text - Text RichText `json:"text"` -} - -func (entity *RichTextSuperscript) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextSuperscript - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextSuperscript) GetClass() string { - return ClassRichText -} - -func (*RichTextSuperscript) GetType() string { - return TypeRichTextSuperscript -} - -func (*RichTextSuperscript) RichTextType() string { - return TypeRichTextSuperscript -} - -func (richTextSuperscript *RichTextSuperscript) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextSuperscript.Text = fieldText - - return nil -} - -// A marked rich text -type RichTextMarked struct { - meta - // Text - Text RichText `json:"text"` -} - -func (entity *RichTextMarked) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextMarked - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextMarked) GetClass() string { - return ClassRichText -} - -func (*RichTextMarked) GetType() string { - return TypeRichTextMarked -} - -func (*RichTextMarked) RichTextType() string { - return TypeRichTextMarked -} - -func (richTextMarked *RichTextMarked) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextMarked.Text = fieldText - - return nil -} - -// A rich text phone number -type RichTextPhoneNumber struct { - meta - // Text - Text RichText `json:"text"` - // Phone number - PhoneNumber string `json:"phone_number"` -} - -func (entity *RichTextPhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextPhoneNumber - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextPhoneNumber) GetClass() string { - return ClassRichText -} - -func (*RichTextPhoneNumber) GetType() string { - return TypeRichTextPhoneNumber -} - -func (*RichTextPhoneNumber) RichTextType() string { - return TypeRichTextPhoneNumber -} - -func (richTextPhoneNumber *RichTextPhoneNumber) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - PhoneNumber string `json:"phone_number"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - richTextPhoneNumber.PhoneNumber = tmp.PhoneNumber - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextPhoneNumber.Text = fieldText - - return nil -} - -// A small image inside the text -type RichTextIcon struct { - meta - // The image represented as a document. The image can be in GIF, JPEG or PNG format - Document *Document `json:"document"` - // Width of a bounding box in which the image must be shown; 0 if unknown - Width int32 `json:"width"` - // Height of a bounding box in which the image must be shown; 0 if unknown - Height int32 `json:"height"` -} - -func (entity *RichTextIcon) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextIcon - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextIcon) GetClass() string { - return ClassRichText -} - -func (*RichTextIcon) GetType() string { - return TypeRichTextIcon -} - -func (*RichTextIcon) RichTextType() string { - return TypeRichTextIcon -} - -// A reference to a richTexts object on the same web page -type RichTextReference struct { - meta - // The text - Text RichText `json:"text"` - // The name of a richTextAnchor object, which is the first element of the target richTexts object - AnchorName string `json:"anchor_name"` - // An HTTP URL, opening the reference - Url string `json:"url"` -} - -func (entity *RichTextReference) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextReference - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextReference) GetClass() string { - return ClassRichText -} - -func (*RichTextReference) GetType() string { - return TypeRichTextReference -} - -func (*RichTextReference) RichTextType() string { - return TypeRichTextReference -} - -func (richTextReference *RichTextReference) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - AnchorName string `json:"anchor_name"` - Url string `json:"url"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - richTextReference.AnchorName = tmp.AnchorName - richTextReference.Url = tmp.Url - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextReference.Text = fieldText - - return nil -} - -// An anchor -type RichTextAnchor struct { - meta - // Anchor name - Name string `json:"name"` -} - -func (entity *RichTextAnchor) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextAnchor - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextAnchor) GetClass() string { - return ClassRichText -} - -func (*RichTextAnchor) GetType() string { - return TypeRichTextAnchor -} - -func (*RichTextAnchor) RichTextType() string { - return TypeRichTextAnchor -} - -// A link to an anchor on the same web page -type RichTextAnchorLink struct { - meta - // The link text - Text RichText `json:"text"` - // The anchor name. If the name is empty, the link must bring back to top - AnchorName string `json:"anchor_name"` - // An HTTP URL, opening the anchor - Url string `json:"url"` -} - -func (entity *RichTextAnchorLink) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTextAnchorLink - - return json.Marshal((*stub)(entity)) -} - -func (*RichTextAnchorLink) GetClass() string { - return ClassRichText -} - -func (*RichTextAnchorLink) GetType() string { - return TypeRichTextAnchorLink -} - -func (*RichTextAnchorLink) RichTextType() string { - return TypeRichTextAnchorLink -} - -func (richTextAnchorLink *RichTextAnchorLink) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - AnchorName string `json:"anchor_name"` - Url string `json:"url"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - richTextAnchorLink.AnchorName = tmp.AnchorName - richTextAnchorLink.Url = tmp.Url - - fieldText, _ := UnmarshalRichText(tmp.Text) - richTextAnchorLink.Text = fieldText - - return nil -} - -// A concatenation of rich texts -type RichTexts struct { - meta - // Texts - Texts []RichText `json:"texts"` -} - -func (entity *RichTexts) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub RichTexts - - return json.Marshal((*stub)(entity)) -} - -func (*RichTexts) GetClass() string { - return ClassRichText -} - -func (*RichTexts) GetType() string { - return TypeRichTexts -} - -func (*RichTexts) RichTextType() string { - return TypeRichTexts -} - -func (richTexts *RichTexts) UnmarshalJSON(data []byte) error { - var tmp struct { - Texts []json.RawMessage `json:"texts"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldTexts, _ := UnmarshalListOfRichText(tmp.Texts) - richTexts.Texts = fieldTexts - - return nil -} - -// Contains a caption of an instant view web page block, consisting of a text and a trailing credit -type PageBlockCaption struct { - meta - // Content of the caption - Text RichText `json:"text"` - // Block credit (like HTML tag ) - Credit RichText `json:"credit"` -} - -func (entity *PageBlockCaption) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockCaption - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockCaption) GetClass() string { - return ClassPageBlockCaption -} - -func (*PageBlockCaption) GetType() string { - return TypePageBlockCaption -} - -func (pageBlockCaption *PageBlockCaption) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - Credit json.RawMessage `json:"credit"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - pageBlockCaption.Text = fieldText - - fieldCredit, _ := UnmarshalRichText(tmp.Credit) - pageBlockCaption.Credit = fieldCredit - - return nil -} - -// Describes an item of a list page block -type PageBlockListItem struct { - meta - // Item label - Label string `json:"label"` - // Item blocks - PageBlocks []PageBlock `json:"page_blocks"` -} - -func (entity *PageBlockListItem) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockListItem - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockListItem) GetClass() string { - return ClassPageBlockListItem -} - -func (*PageBlockListItem) GetType() string { - return TypePageBlockListItem -} - -func (pageBlockListItem *PageBlockListItem) UnmarshalJSON(data []byte) error { - var tmp struct { - Label string `json:"label"` - PageBlocks []json.RawMessage `json:"page_blocks"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockListItem.Label = tmp.Label - - fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) - pageBlockListItem.PageBlocks = fieldPageBlocks - - return nil -} - -// The content must be left-aligned -type PageBlockHorizontalAlignmentLeft struct { - meta -} - -func (entity *PageBlockHorizontalAlignmentLeft) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockHorizontalAlignmentLeft - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockHorizontalAlignmentLeft) GetClass() string { - return ClassPageBlockHorizontalAlignment -} - -func (*PageBlockHorizontalAlignmentLeft) GetType() string { - return TypePageBlockHorizontalAlignmentLeft -} - -func (*PageBlockHorizontalAlignmentLeft) PageBlockHorizontalAlignmentType() string { - return TypePageBlockHorizontalAlignmentLeft -} - -// The content must be center-aligned -type PageBlockHorizontalAlignmentCenter struct { - meta -} - -func (entity *PageBlockHorizontalAlignmentCenter) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockHorizontalAlignmentCenter - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockHorizontalAlignmentCenter) GetClass() string { - return ClassPageBlockHorizontalAlignment -} - -func (*PageBlockHorizontalAlignmentCenter) GetType() string { - return TypePageBlockHorizontalAlignmentCenter -} - -func (*PageBlockHorizontalAlignmentCenter) PageBlockHorizontalAlignmentType() string { - return TypePageBlockHorizontalAlignmentCenter -} - -// The content must be right-aligned -type PageBlockHorizontalAlignmentRight struct { - meta -} - -func (entity *PageBlockHorizontalAlignmentRight) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockHorizontalAlignmentRight - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockHorizontalAlignmentRight) GetClass() string { - return ClassPageBlockHorizontalAlignment -} - -func (*PageBlockHorizontalAlignmentRight) GetType() string { - return TypePageBlockHorizontalAlignmentRight -} - -func (*PageBlockHorizontalAlignmentRight) PageBlockHorizontalAlignmentType() string { - return TypePageBlockHorizontalAlignmentRight -} - -// The content must be top-aligned -type PageBlockVerticalAlignmentTop struct { - meta -} - -func (entity *PageBlockVerticalAlignmentTop) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockVerticalAlignmentTop - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockVerticalAlignmentTop) GetClass() string { - return ClassPageBlockVerticalAlignment -} - -func (*PageBlockVerticalAlignmentTop) GetType() string { - return TypePageBlockVerticalAlignmentTop -} - -func (*PageBlockVerticalAlignmentTop) PageBlockVerticalAlignmentType() string { - return TypePageBlockVerticalAlignmentTop -} - -// The content must be middle-aligned -type PageBlockVerticalAlignmentMiddle struct { - meta -} - -func (entity *PageBlockVerticalAlignmentMiddle) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockVerticalAlignmentMiddle - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockVerticalAlignmentMiddle) GetClass() string { - return ClassPageBlockVerticalAlignment -} - -func (*PageBlockVerticalAlignmentMiddle) GetType() string { - return TypePageBlockVerticalAlignmentMiddle -} - -func (*PageBlockVerticalAlignmentMiddle) PageBlockVerticalAlignmentType() string { - return TypePageBlockVerticalAlignmentMiddle -} - -// The content must be bottom-aligned -type PageBlockVerticalAlignmentBottom struct { - meta -} - -func (entity *PageBlockVerticalAlignmentBottom) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockVerticalAlignmentBottom - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockVerticalAlignmentBottom) GetClass() string { - return ClassPageBlockVerticalAlignment -} - -func (*PageBlockVerticalAlignmentBottom) GetType() string { - return TypePageBlockVerticalAlignmentBottom -} - -func (*PageBlockVerticalAlignmentBottom) PageBlockVerticalAlignmentType() string { - return TypePageBlockVerticalAlignmentBottom -} - -// Represents a cell of a table -type PageBlockTableCell struct { - meta - // Cell text; may be null. If the text is null, then the cell must be invisible - Text RichText `json:"text"` - // True, if it is a header cell - IsHeader bool `json:"is_header"` - // The number of columns the cell spans - Colspan int32 `json:"colspan"` - // The number of rows the cell spans - Rowspan int32 `json:"rowspan"` - // Horizontal cell content alignment - Align PageBlockHorizontalAlignment `json:"align"` - // Vertical cell content alignment - Valign PageBlockVerticalAlignment `json:"valign"` -} - -func (entity *PageBlockTableCell) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockTableCell - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockTableCell) GetClass() string { - return ClassPageBlockTableCell -} - -func (*PageBlockTableCell) GetType() string { - return TypePageBlockTableCell -} - -func (pageBlockTableCell *PageBlockTableCell) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - IsHeader bool `json:"is_header"` - Colspan int32 `json:"colspan"` - Rowspan int32 `json:"rowspan"` - Align json.RawMessage `json:"align"` - Valign json.RawMessage `json:"valign"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockTableCell.IsHeader = tmp.IsHeader - pageBlockTableCell.Colspan = tmp.Colspan - pageBlockTableCell.Rowspan = tmp.Rowspan - - fieldText, _ := UnmarshalRichText(tmp.Text) - pageBlockTableCell.Text = fieldText - - fieldAlign, _ := UnmarshalPageBlockHorizontalAlignment(tmp.Align) - pageBlockTableCell.Align = fieldAlign - - fieldValign, _ := UnmarshalPageBlockVerticalAlignment(tmp.Valign) - pageBlockTableCell.Valign = fieldValign - - return nil -} - -// Contains information about a related article -type PageBlockRelatedArticle struct { - meta - // Related article URL - Url string `json:"url"` - // Article title; may be empty - Title string `json:"title"` - // Article description; may be empty - Description string `json:"description"` - // Article photo; may be null - Photo *Photo `json:"photo"` - // Article author; may be empty - Author string `json:"author"` - // Point in time (Unix timestamp) when the article was published; 0 if unknown - PublishDate int32 `json:"publish_date"` -} - -func (entity *PageBlockRelatedArticle) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockRelatedArticle - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockRelatedArticle) GetClass() string { - return ClassPageBlockRelatedArticle -} - -func (*PageBlockRelatedArticle) GetType() string { - return TypePageBlockRelatedArticle -} - -// The title of a page -type PageBlockTitle struct { - meta - // Title - Title RichText `json:"title"` -} - -func (entity *PageBlockTitle) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockTitle - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockTitle) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockTitle) GetType() string { - return TypePageBlockTitle -} - -func (*PageBlockTitle) PageBlockType() string { - return TypePageBlockTitle -} - -func (pageBlockTitle *PageBlockTitle) UnmarshalJSON(data []byte) error { - var tmp struct { - Title json.RawMessage `json:"title"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldTitle, _ := UnmarshalRichText(tmp.Title) - pageBlockTitle.Title = fieldTitle - - return nil -} - -// The subtitle of a page -type PageBlockSubtitle struct { - meta - // Subtitle - Subtitle RichText `json:"subtitle"` -} - -func (entity *PageBlockSubtitle) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockSubtitle - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockSubtitle) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockSubtitle) GetType() string { - return TypePageBlockSubtitle -} - -func (*PageBlockSubtitle) PageBlockType() string { - return TypePageBlockSubtitle -} - -func (pageBlockSubtitle *PageBlockSubtitle) UnmarshalJSON(data []byte) error { - var tmp struct { - Subtitle json.RawMessage `json:"subtitle"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldSubtitle, _ := UnmarshalRichText(tmp.Subtitle) - pageBlockSubtitle.Subtitle = fieldSubtitle - - return nil -} - -// The author and publishing date of a page -type PageBlockAuthorDate struct { - meta - // Author - Author RichText `json:"author"` - // Point in time (Unix timestamp) when the article was published; 0 if unknown - PublishDate int32 `json:"publish_date"` -} - -func (entity *PageBlockAuthorDate) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockAuthorDate - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockAuthorDate) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockAuthorDate) GetType() string { - return TypePageBlockAuthorDate -} - -func (*PageBlockAuthorDate) PageBlockType() string { - return TypePageBlockAuthorDate -} - -func (pageBlockAuthorDate *PageBlockAuthorDate) UnmarshalJSON(data []byte) error { - var tmp struct { - Author json.RawMessage `json:"author"` - PublishDate int32 `json:"publish_date"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockAuthorDate.PublishDate = tmp.PublishDate - - fieldAuthor, _ := UnmarshalRichText(tmp.Author) - pageBlockAuthorDate.Author = fieldAuthor - - return nil -} - -// A header -type PageBlockHeader struct { - meta - // Header - Header RichText `json:"header"` -} - -func (entity *PageBlockHeader) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockHeader - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockHeader) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockHeader) GetType() string { - return TypePageBlockHeader -} - -func (*PageBlockHeader) PageBlockType() string { - return TypePageBlockHeader -} - -func (pageBlockHeader *PageBlockHeader) UnmarshalJSON(data []byte) error { - var tmp struct { - Header json.RawMessage `json:"header"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldHeader, _ := UnmarshalRichText(tmp.Header) - pageBlockHeader.Header = fieldHeader - - return nil -} - -// A subheader -type PageBlockSubheader struct { - meta - // Subheader - Subheader RichText `json:"subheader"` -} - -func (entity *PageBlockSubheader) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockSubheader - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockSubheader) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockSubheader) GetType() string { - return TypePageBlockSubheader -} - -func (*PageBlockSubheader) PageBlockType() string { - return TypePageBlockSubheader -} - -func (pageBlockSubheader *PageBlockSubheader) UnmarshalJSON(data []byte) error { - var tmp struct { - Subheader json.RawMessage `json:"subheader"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldSubheader, _ := UnmarshalRichText(tmp.Subheader) - pageBlockSubheader.Subheader = fieldSubheader - - return nil -} - -// A kicker -type PageBlockKicker struct { - meta - // Kicker - Kicker RichText `json:"kicker"` -} - -func (entity *PageBlockKicker) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockKicker - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockKicker) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockKicker) GetType() string { - return TypePageBlockKicker -} - -func (*PageBlockKicker) PageBlockType() string { - return TypePageBlockKicker -} - -func (pageBlockKicker *PageBlockKicker) UnmarshalJSON(data []byte) error { - var tmp struct { - Kicker json.RawMessage `json:"kicker"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldKicker, _ := UnmarshalRichText(tmp.Kicker) - pageBlockKicker.Kicker = fieldKicker - - return nil -} - -// A text paragraph -type PageBlockParagraph struct { - meta - // Paragraph text - Text RichText `json:"text"` -} - -func (entity *PageBlockParagraph) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockParagraph - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockParagraph) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockParagraph) GetType() string { - return TypePageBlockParagraph -} - -func (*PageBlockParagraph) PageBlockType() string { - return TypePageBlockParagraph -} - -func (pageBlockParagraph *PageBlockParagraph) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - pageBlockParagraph.Text = fieldText - - return nil -} - -// A preformatted text paragraph -type PageBlockPreformatted struct { - meta - // Paragraph text - Text RichText `json:"text"` - // Programming language for which the text needs to be formatted - Language string `json:"language"` -} - -func (entity *PageBlockPreformatted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockPreformatted - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockPreformatted) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockPreformatted) GetType() string { - return TypePageBlockPreformatted -} - -func (*PageBlockPreformatted) PageBlockType() string { - return TypePageBlockPreformatted -} - -func (pageBlockPreformatted *PageBlockPreformatted) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - Language string `json:"language"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockPreformatted.Language = tmp.Language - - fieldText, _ := UnmarshalRichText(tmp.Text) - pageBlockPreformatted.Text = fieldText - - return nil -} - -// The footer of a page -type PageBlockFooter struct { - meta - // Footer - Footer RichText `json:"footer"` -} - -func (entity *PageBlockFooter) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockFooter - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockFooter) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockFooter) GetType() string { - return TypePageBlockFooter -} - -func (*PageBlockFooter) PageBlockType() string { - return TypePageBlockFooter -} - -func (pageBlockFooter *PageBlockFooter) UnmarshalJSON(data []byte) error { - var tmp struct { - Footer json.RawMessage `json:"footer"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldFooter, _ := UnmarshalRichText(tmp.Footer) - pageBlockFooter.Footer = fieldFooter - - return nil -} - -// An empty block separating a page -type PageBlockDivider struct { - meta -} - -func (entity *PageBlockDivider) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockDivider - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockDivider) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockDivider) GetType() string { - return TypePageBlockDivider -} - -func (*PageBlockDivider) PageBlockType() string { - return TypePageBlockDivider -} - -// An invisible anchor on a page, which can be used in a URL to open the page from the specified anchor -type PageBlockAnchor struct { - meta - // Name of the anchor - Name string `json:"name"` -} - -func (entity *PageBlockAnchor) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockAnchor - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockAnchor) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockAnchor) GetType() string { - return TypePageBlockAnchor -} - -func (*PageBlockAnchor) PageBlockType() string { - return TypePageBlockAnchor -} - -// A list of data blocks -type PageBlockList struct { - meta - // The items of the list - Items []*PageBlockListItem `json:"items"` -} - -func (entity *PageBlockList) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockList - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockList) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockList) GetType() string { - return TypePageBlockList -} - -func (*PageBlockList) PageBlockType() string { - return TypePageBlockList -} - -// A block quote -type PageBlockBlockQuote struct { - meta - // Quote text - Text RichText `json:"text"` - // Quote credit - Credit RichText `json:"credit"` -} - -func (entity *PageBlockBlockQuote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockBlockQuote - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockBlockQuote) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockBlockQuote) GetType() string { - return TypePageBlockBlockQuote -} - -func (*PageBlockBlockQuote) PageBlockType() string { - return TypePageBlockBlockQuote -} - -func (pageBlockBlockQuote *PageBlockBlockQuote) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - Credit json.RawMessage `json:"credit"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - pageBlockBlockQuote.Text = fieldText - - fieldCredit, _ := UnmarshalRichText(tmp.Credit) - pageBlockBlockQuote.Credit = fieldCredit - - return nil -} - -// A pull quote -type PageBlockPullQuote struct { - meta - // Quote text - Text RichText `json:"text"` - // Quote credit - Credit RichText `json:"credit"` -} - -func (entity *PageBlockPullQuote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockPullQuote - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockPullQuote) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockPullQuote) GetType() string { - return TypePageBlockPullQuote -} - -func (*PageBlockPullQuote) PageBlockType() string { - return TypePageBlockPullQuote -} - -func (pageBlockPullQuote *PageBlockPullQuote) UnmarshalJSON(data []byte) error { - var tmp struct { - Text json.RawMessage `json:"text"` - Credit json.RawMessage `json:"credit"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldText, _ := UnmarshalRichText(tmp.Text) - pageBlockPullQuote.Text = fieldText - - fieldCredit, _ := UnmarshalRichText(tmp.Credit) - pageBlockPullQuote.Credit = fieldCredit - - return nil -} - -// An animation -type PageBlockAnimation struct { - meta - // Animation file; may be null - Animation *Animation `json:"animation"` - // Animation caption - Caption *PageBlockCaption `json:"caption"` - // True, if the animation must be played automatically - NeedAutoplay bool `json:"need_autoplay"` -} - -func (entity *PageBlockAnimation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockAnimation - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockAnimation) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockAnimation) GetType() string { - return TypePageBlockAnimation -} - -func (*PageBlockAnimation) PageBlockType() string { - return TypePageBlockAnimation -} - -// An audio file -type PageBlockAudio struct { - meta - // Audio file; may be null - Audio *Audio `json:"audio"` - // Audio file caption - Caption *PageBlockCaption `json:"caption"` -} - -func (entity *PageBlockAudio) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockAudio - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockAudio) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockAudio) GetType() string { - return TypePageBlockAudio -} - -func (*PageBlockAudio) PageBlockType() string { - return TypePageBlockAudio -} - -// A photo -type PageBlockPhoto struct { - meta - // Photo file; may be null - Photo *Photo `json:"photo"` - // Photo caption - Caption *PageBlockCaption `json:"caption"` - // URL that needs to be opened when the photo is clicked - Url string `json:"url"` -} - -func (entity *PageBlockPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockPhoto - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockPhoto) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockPhoto) GetType() string { - return TypePageBlockPhoto -} - -func (*PageBlockPhoto) PageBlockType() string { - return TypePageBlockPhoto -} - -// A video -type PageBlockVideo struct { - meta - // Video file; may be null - Video *Video `json:"video"` - // Video caption - Caption *PageBlockCaption `json:"caption"` - // True, if the video must be played automatically - NeedAutoplay bool `json:"need_autoplay"` - // True, if the video must be looped - IsLooped bool `json:"is_looped"` -} - -func (entity *PageBlockVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockVideo - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockVideo) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockVideo) GetType() string { - return TypePageBlockVideo -} - -func (*PageBlockVideo) PageBlockType() string { - return TypePageBlockVideo -} - -// A voice note -type PageBlockVoiceNote struct { - meta - // Voice note; may be null - VoiceNote *VoiceNote `json:"voice_note"` - // Voice note caption - Caption *PageBlockCaption `json:"caption"` -} - -func (entity *PageBlockVoiceNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockVoiceNote - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockVoiceNote) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockVoiceNote) GetType() string { - return TypePageBlockVoiceNote -} - -func (*PageBlockVoiceNote) PageBlockType() string { - return TypePageBlockVoiceNote -} - -// A page cover -type PageBlockCover struct { - meta - // Cover - Cover PageBlock `json:"cover"` -} - -func (entity *PageBlockCover) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockCover - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockCover) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockCover) GetType() string { - return TypePageBlockCover -} - -func (*PageBlockCover) PageBlockType() string { - return TypePageBlockCover -} - -func (pageBlockCover *PageBlockCover) UnmarshalJSON(data []byte) error { - var tmp struct { - Cover json.RawMessage `json:"cover"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldCover, _ := UnmarshalPageBlock(tmp.Cover) - pageBlockCover.Cover = fieldCover - - return nil -} - -// An embedded web page -type PageBlockEmbedded struct { - meta - // Web page URL, if available - Url string `json:"url"` - // HTML-markup of the embedded page - Html string `json:"html"` - // Poster photo, if available; may be null - PosterPhoto *Photo `json:"poster_photo"` - // Block width; 0 if unknown - Width int32 `json:"width"` - // Block height; 0 if unknown - Height int32 `json:"height"` - // Block caption - Caption *PageBlockCaption `json:"caption"` - // True, if the block must be full width - IsFullWidth bool `json:"is_full_width"` - // True, if scrolling needs to be allowed - AllowScrolling bool `json:"allow_scrolling"` -} - -func (entity *PageBlockEmbedded) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockEmbedded - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockEmbedded) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockEmbedded) GetType() string { - return TypePageBlockEmbedded -} - -func (*PageBlockEmbedded) PageBlockType() string { - return TypePageBlockEmbedded -} - -// An embedded post -type PageBlockEmbeddedPost struct { - meta - // Web page URL - Url string `json:"url"` - // Post author - Author string `json:"author"` - // Post author photo; may be null - AuthorPhoto *Photo `json:"author_photo"` - // Point in time (Unix timestamp) when the post was created; 0 if unknown - Date int32 `json:"date"` - // Post content - PageBlocks []PageBlock `json:"page_blocks"` - // Post caption - Caption *PageBlockCaption `json:"caption"` -} - -func (entity *PageBlockEmbeddedPost) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockEmbeddedPost - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockEmbeddedPost) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockEmbeddedPost) GetType() string { - return TypePageBlockEmbeddedPost -} - -func (*PageBlockEmbeddedPost) PageBlockType() string { - return TypePageBlockEmbeddedPost -} - -func (pageBlockEmbeddedPost *PageBlockEmbeddedPost) UnmarshalJSON(data []byte) error { - var tmp struct { - Url string `json:"url"` - Author string `json:"author"` - AuthorPhoto *Photo `json:"author_photo"` - Date int32 `json:"date"` - PageBlocks []json.RawMessage `json:"page_blocks"` - Caption *PageBlockCaption `json:"caption"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockEmbeddedPost.Url = tmp.Url - pageBlockEmbeddedPost.Author = tmp.Author - pageBlockEmbeddedPost.AuthorPhoto = tmp.AuthorPhoto - pageBlockEmbeddedPost.Date = tmp.Date - pageBlockEmbeddedPost.Caption = tmp.Caption - - fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) - pageBlockEmbeddedPost.PageBlocks = fieldPageBlocks - - return nil -} - -// A collage -type PageBlockCollage struct { - meta - // Collage item contents - PageBlocks []PageBlock `json:"page_blocks"` - // Block caption - Caption *PageBlockCaption `json:"caption"` -} - -func (entity *PageBlockCollage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockCollage - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockCollage) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockCollage) GetType() string { - return TypePageBlockCollage -} - -func (*PageBlockCollage) PageBlockType() string { - return TypePageBlockCollage -} - -func (pageBlockCollage *PageBlockCollage) UnmarshalJSON(data []byte) error { - var tmp struct { - PageBlocks []json.RawMessage `json:"page_blocks"` - Caption *PageBlockCaption `json:"caption"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockCollage.Caption = tmp.Caption - - fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) - pageBlockCollage.PageBlocks = fieldPageBlocks - - return nil -} - -// A slideshow -type PageBlockSlideshow struct { - meta - // Slideshow item contents - PageBlocks []PageBlock `json:"page_blocks"` - // Block caption - Caption *PageBlockCaption `json:"caption"` -} - -func (entity *PageBlockSlideshow) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockSlideshow - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockSlideshow) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockSlideshow) GetType() string { - return TypePageBlockSlideshow -} - -func (*PageBlockSlideshow) PageBlockType() string { - return TypePageBlockSlideshow -} - -func (pageBlockSlideshow *PageBlockSlideshow) UnmarshalJSON(data []byte) error { - var tmp struct { - PageBlocks []json.RawMessage `json:"page_blocks"` - Caption *PageBlockCaption `json:"caption"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockSlideshow.Caption = tmp.Caption - - fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) - pageBlockSlideshow.PageBlocks = fieldPageBlocks - - return nil -} - -// A link to a chat -type PageBlockChatLink struct { - meta - // Chat title - Title string `json:"title"` - // Chat photo; may be null - Photo *ChatPhotoInfo `json:"photo"` - // Chat username by which all other information about the chat can be resolved - Username string `json:"username"` -} - -func (entity *PageBlockChatLink) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockChatLink - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockChatLink) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockChatLink) GetType() string { - return TypePageBlockChatLink -} - -func (*PageBlockChatLink) PageBlockType() string { - return TypePageBlockChatLink -} - -// A table -type PageBlockTable struct { - meta - // Table caption - Caption RichText `json:"caption"` - // Table cells - Cells [][]*PageBlockTableCell `json:"cells"` - // True, if the table is bordered - IsBordered bool `json:"is_bordered"` - // True, if the table is striped - IsStriped bool `json:"is_striped"` -} - -func (entity *PageBlockTable) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockTable - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockTable) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockTable) GetType() string { - return TypePageBlockTable -} - -func (*PageBlockTable) PageBlockType() string { - return TypePageBlockTable -} - -func (pageBlockTable *PageBlockTable) UnmarshalJSON(data []byte) error { - var tmp struct { - Caption json.RawMessage `json:"caption"` - Cells [][]*PageBlockTableCell `json:"cells"` - IsBordered bool `json:"is_bordered"` - IsStriped bool `json:"is_striped"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockTable.Cells = tmp.Cells - pageBlockTable.IsBordered = tmp.IsBordered - pageBlockTable.IsStriped = tmp.IsStriped - - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockTable.Caption = fieldCaption - - return nil -} - -// A collapsible block -type PageBlockDetails struct { - meta - // Always visible heading for the block - Header RichText `json:"header"` - // Block contents - PageBlocks []PageBlock `json:"page_blocks"` - // True, if the block is open by default - IsOpen bool `json:"is_open"` -} - -func (entity *PageBlockDetails) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockDetails - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockDetails) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockDetails) GetType() string { - return TypePageBlockDetails -} - -func (*PageBlockDetails) PageBlockType() string { - return TypePageBlockDetails -} - -func (pageBlockDetails *PageBlockDetails) UnmarshalJSON(data []byte) error { - var tmp struct { - Header json.RawMessage `json:"header"` - PageBlocks []json.RawMessage `json:"page_blocks"` - IsOpen bool `json:"is_open"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockDetails.IsOpen = tmp.IsOpen - - fieldHeader, _ := UnmarshalRichText(tmp.Header) - pageBlockDetails.Header = fieldHeader - - fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) - pageBlockDetails.PageBlocks = fieldPageBlocks - - return nil -} - -// Related articles -type PageBlockRelatedArticles struct { - meta - // Block header - Header RichText `json:"header"` - // List of related articles - Articles []*PageBlockRelatedArticle `json:"articles"` -} - -func (entity *PageBlockRelatedArticles) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockRelatedArticles - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockRelatedArticles) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockRelatedArticles) GetType() string { - return TypePageBlockRelatedArticles -} - -func (*PageBlockRelatedArticles) PageBlockType() string { - return TypePageBlockRelatedArticles -} - -func (pageBlockRelatedArticles *PageBlockRelatedArticles) UnmarshalJSON(data []byte) error { - var tmp struct { - Header json.RawMessage `json:"header"` - Articles []*PageBlockRelatedArticle `json:"articles"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockRelatedArticles.Articles = tmp.Articles - - fieldHeader, _ := UnmarshalRichText(tmp.Header) - pageBlockRelatedArticles.Header = fieldHeader - - return nil -} - -// A map -type PageBlockMap struct { - meta - // Location of the map center - Location *Location `json:"location"` - // Map zoom level - Zoom int32 `json:"zoom"` - // Map width - Width int32 `json:"width"` - // Map height - Height int32 `json:"height"` - // Block caption - Caption *PageBlockCaption `json:"caption"` -} - -func (entity *PageBlockMap) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PageBlockMap - - return json.Marshal((*stub)(entity)) -} - -func (*PageBlockMap) GetClass() string { - return ClassPageBlock -} - -func (*PageBlockMap) GetType() string { - return TypePageBlockMap -} - -func (*PageBlockMap) PageBlockType() string { - return TypePageBlockMap -} - -// Describes an instant view page for a web page -type WebPageInstantView struct { - meta - // Content of the web page - PageBlocks []PageBlock `json:"page_blocks"` - // Number of the instant view views; 0 if unknown - ViewCount int32 `json:"view_count"` - // Version of the instant view; currently, can be 1 or 2 - 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 - IsFull bool `json:"is_full"` - // An internal link to be opened to leave feedback about the instant view - FeedbackLink InternalLinkType `json:"feedback_link"` -} - -func (entity *WebPageInstantView) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub WebPageInstantView - - return json.Marshal((*stub)(entity)) -} - -func (*WebPageInstantView) GetClass() string { - return ClassWebPageInstantView -} - -func (*WebPageInstantView) GetType() string { - return TypeWebPageInstantView -} - -func (webPageInstantView *WebPageInstantView) UnmarshalJSON(data []byte) error { - var tmp struct { - PageBlocks []json.RawMessage `json:"page_blocks"` - ViewCount int32 `json:"view_count"` - Version int32 `json:"version"` - IsRtl bool `json:"is_rtl"` - IsFull bool `json:"is_full"` - FeedbackLink json.RawMessage `json:"feedback_link"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - webPageInstantView.ViewCount = tmp.ViewCount - webPageInstantView.Version = tmp.Version - webPageInstantView.IsRtl = tmp.IsRtl - webPageInstantView.IsFull = tmp.IsFull - - fieldPageBlocks, _ := UnmarshalListOfPageBlock(tmp.PageBlocks) - webPageInstantView.PageBlocks = fieldPageBlocks - - fieldFeedbackLink, _ := UnmarshalInternalLinkType(tmp.FeedbackLink) - webPageInstantView.FeedbackLink = fieldFeedbackLink - - return nil -} - -// Describes a web page preview -type WebPage 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"` - // 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"` - // Version of web page instant view (currently, can be 1 or 2); 0 if none - InstantViewVersion int32 `json:"instant_view_version"` -} - -func (entity *WebPage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub WebPage - - return json.Marshal((*stub)(entity)) -} - -func (*WebPage) GetClass() string { - return ClassWebPage -} - -func (*WebPage) GetType() string { - return TypeWebPage -} - -// Contains information about a country -type CountryInfo struct { - meta - // A two-letter ISO 3166-1 alpha-2 country code - CountryCode string `json:"country_code"` - // Native name of the country - Name string `json:"name"` - // English name of the country - EnglishName string `json:"english_name"` - // True, if the country must be hidden from the list of all countries - IsHidden bool `json:"is_hidden"` - // List of country calling codes - CallingCodes []string `json:"calling_codes"` -} - -func (entity *CountryInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub CountryInfo - - return json.Marshal((*stub)(entity)) -} - -func (*CountryInfo) GetClass() string { - return ClassCountryInfo -} - -func (*CountryInfo) GetType() string { - return TypeCountryInfo -} - -// Contains information about countries -type Countries struct { - meta - // The list of countries - Countries []*CountryInfo `json:"countries"` -} - -func (entity *Countries) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Countries - - return json.Marshal((*stub)(entity)) -} - -func (*Countries) GetClass() string { - return ClassCountries -} - -func (*Countries) GetType() string { - return TypeCountries -} - -// Contains information about a phone number -type PhoneNumberInfo struct { - meta - // Information about the country to which the phone number belongs; may be null - Country *CountryInfo `json:"country"` - // The part of the phone number denoting country calling code or its part - 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 - IsAnonymous bool `json:"is_anonymous"` -} - -func (entity *PhoneNumberInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PhoneNumberInfo - - return json.Marshal((*stub)(entity)) -} - -func (*PhoneNumberInfo) GetClass() string { - return ClassPhoneNumberInfo -} - -func (*PhoneNumberInfo) GetType() string { - return TypePhoneNumberInfo -} - -// Describes an action associated with a bank card number -type BankCardActionOpenUrl struct { - meta - // Action text - Text string `json:"text"` - // The URL to be opened - Url string `json:"url"` -} - -func (entity *BankCardActionOpenUrl) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub BankCardActionOpenUrl - - return json.Marshal((*stub)(entity)) -} - -func (*BankCardActionOpenUrl) GetClass() string { - return ClassBankCardActionOpenUrl -} - -func (*BankCardActionOpenUrl) GetType() string { - return TypeBankCardActionOpenUrl -} - -// Information about a bank card -type BankCardInfo struct { - meta - // Title of the bank card description - Title string `json:"title"` - // Actions that can be done with the bank card number - Actions []*BankCardActionOpenUrl `json:"actions"` -} - -func (entity *BankCardInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub BankCardInfo - - return json.Marshal((*stub)(entity)) -} - -func (*BankCardInfo) GetClass() string { - return ClassBankCardInfo -} - -func (*BankCardInfo) GetType() string { - return TypeBankCardInfo -} - -// Describes an address -type Address struct { - meta - // A two-letter ISO 3166-1 alpha-2 country code - CountryCode string `json:"country_code"` - // State, if applicable - State string `json:"state"` - // City - City string `json:"city"` - // First line of the address - StreetLine1 string `json:"street_line1"` - // Second line of the address - StreetLine2 string `json:"street_line2"` - // Address postal code - PostalCode string `json:"postal_code"` -} - -func (entity *Address) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Address - - return json.Marshal((*stub)(entity)) -} - -func (*Address) GetClass() string { - return ClassAddress -} - -func (*Address) GetType() string { - return TypeAddress -} - -// Contains parameters of the application theme -type ThemeParameters 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 text in the RGB24 format - TextColor int32 `json:"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"` -} - -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 -} - -// Portion of the price of a product (e.g., "delivery cost", "tax amount") -type LabeledPricePart struct { - meta - // Label for this portion of the product price - Label string `json:"label"` - // Currency amount in the smallest units of the currency - Amount int64 `json:"amount"` -} - -func (entity *LabeledPricePart) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub LabeledPricePart - - return json.Marshal((*stub)(entity)) -} - -func (*LabeledPricePart) GetClass() string { - return ClassLabeledPricePart -} - -func (*LabeledPricePart) GetType() string { - return TypeLabeledPricePart -} - -// Product invoice -type Invoice struct { - meta - // ISO 4217 currency code - Currency string `json:"currency"` - // A list of objects used to calculate the total price of the product - PriceParts []*LabeledPricePart `json:"price_parts"` - // 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 - SuggestedTipAmounts []int64 `json:"suggested_tip_amounts"` - // An HTTP URL with terms of service for recurring payments. If non-empty, the invoice payment will result in recurring payments and the user must accept the terms of service before allowed to pay - RecurringPaymentTermsOfServiceUrl string `json:"recurring_payment_terms_of_service_url"` - // True, if the payment is a test payment - IsTest bool `json:"is_test"` - // True, if the user's name is needed for payment - NeedName bool `json:"need_name"` - // True, if the user's phone number is needed for payment - NeedPhoneNumber bool `json:"need_phone_number"` - // True, if the user's email address is needed for payment - NeedEmailAddress bool `json:"need_email_address"` - // True, if the user's shipping address is needed for payment - NeedShippingAddress bool `json:"need_shipping_address"` - // True, if the user's phone number will be sent to the provider - SendPhoneNumberToProvider bool `json:"send_phone_number_to_provider"` - // True, if the user's email address will be sent to the provider - SendEmailAddressToProvider bool `json:"send_email_address_to_provider"` - // True, if the total price depends on the shipping method - IsFlexible bool `json:"is_flexible"` -} - -func (entity *Invoice) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Invoice - - return json.Marshal((*stub)(entity)) -} - -func (*Invoice) GetClass() string { - return ClassInvoice -} - -func (*Invoice) GetType() string { - return TypeInvoice -} - -// Order information -type OrderInfo struct { - meta - // Name of the user - Name string `json:"name"` - // Phone number of the user - PhoneNumber string `json:"phone_number"` - // Email address of the user - EmailAddress string `json:"email_address"` - // Shipping address for this order; may be null - ShippingAddress *Address `json:"shipping_address"` -} - -func (entity *OrderInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub OrderInfo - - return json.Marshal((*stub)(entity)) -} - -func (*OrderInfo) GetClass() string { - return ClassOrderInfo -} - -func (*OrderInfo) GetType() string { - return TypeOrderInfo -} - -// One shipping option -type ShippingOption struct { - meta - // Shipping option identifier - Id string `json:"id"` - // Option title - Title string `json:"title"` - // A list of objects used to calculate the total shipping costs - PriceParts []*LabeledPricePart `json:"price_parts"` -} - -func (entity *ShippingOption) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ShippingOption - - return json.Marshal((*stub)(entity)) -} - -func (*ShippingOption) GetClass() string { - return ClassShippingOption -} - -func (*ShippingOption) GetType() string { - return TypeShippingOption -} - -// Contains information about saved payment credentials -type SavedCredentials struct { - meta - // Unique identifier of the saved credentials - Id string `json:"id"` - // Title of the saved credentials - Title string `json:"title"` -} - -func (entity *SavedCredentials) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub SavedCredentials - - return json.Marshal((*stub)(entity)) -} - -func (*SavedCredentials) GetClass() string { - return ClassSavedCredentials -} - -func (*SavedCredentials) GetType() string { - return TypeSavedCredentials -} - -// Applies if a user chooses some previously saved payment credentials. To use their previously saved credentials, the user must have a valid temporary password -type InputCredentialsSaved struct { - meta - // Identifier of the saved credentials - SavedCredentialsId string `json:"saved_credentials_id"` -} - -func (entity *InputCredentialsSaved) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputCredentialsSaved - - return json.Marshal((*stub)(entity)) -} - -func (*InputCredentialsSaved) GetClass() string { - return ClassInputCredentials -} - -func (*InputCredentialsSaved) GetType() string { - return TypeInputCredentialsSaved -} - -func (*InputCredentialsSaved) InputCredentialsType() string { - return TypeInputCredentialsSaved -} - -// Applies if a user enters new credentials on a payment provider website -type InputCredentialsNew struct { - meta - // JSON-encoded data with the credential identifier from the payment provider - Data string `json:"data"` - // True, if the credential identifier can be saved on the server side - AllowSave bool `json:"allow_save"` -} - -func (entity *InputCredentialsNew) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputCredentialsNew - - return json.Marshal((*stub)(entity)) -} - -func (*InputCredentialsNew) GetClass() string { - return ClassInputCredentials -} - -func (*InputCredentialsNew) GetType() string { - return TypeInputCredentialsNew -} - -func (*InputCredentialsNew) InputCredentialsType() string { - return TypeInputCredentialsNew -} - -// Applies if a user enters new credentials using Apple Pay -type InputCredentialsApplePay struct { - meta - // JSON-encoded data with the credential identifier - Data string `json:"data"` -} - -func (entity *InputCredentialsApplePay) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputCredentialsApplePay - - return json.Marshal((*stub)(entity)) -} - -func (*InputCredentialsApplePay) GetClass() string { - return ClassInputCredentials -} - -func (*InputCredentialsApplePay) GetType() string { - return TypeInputCredentialsApplePay -} - -func (*InputCredentialsApplePay) InputCredentialsType() string { - return TypeInputCredentialsApplePay -} - -// Applies if a user enters new credentials using Google Pay -type InputCredentialsGooglePay struct { - meta - // JSON-encoded data with the credential identifier - Data string `json:"data"` -} - -func (entity *InputCredentialsGooglePay) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputCredentialsGooglePay - - return json.Marshal((*stub)(entity)) -} - -func (*InputCredentialsGooglePay) GetClass() string { - return ClassInputCredentials -} - -func (*InputCredentialsGooglePay) GetType() string { - return TypeInputCredentialsGooglePay -} - -func (*InputCredentialsGooglePay) InputCredentialsType() string { - return TypeInputCredentialsGooglePay -} - -// Smart Glocal payment provider -type PaymentProviderSmartGlocal struct { - meta - // Public payment token - PublicToken string `json:"public_token"` -} - -func (entity *PaymentProviderSmartGlocal) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PaymentProviderSmartGlocal - - return json.Marshal((*stub)(entity)) -} - -func (*PaymentProviderSmartGlocal) GetClass() string { - return ClassPaymentProvider -} - -func (*PaymentProviderSmartGlocal) GetType() string { - return TypePaymentProviderSmartGlocal -} - -func (*PaymentProviderSmartGlocal) PaymentProviderType() string { - return TypePaymentProviderSmartGlocal -} - -// Stripe payment provider -type PaymentProviderStripe struct { - meta - // Stripe API publishable key - PublishableKey string `json:"publishable_key"` - // True, if the user country must be provided - NeedCountry bool `json:"need_country"` - // True, if the user ZIP/postal code must be provided - NeedPostalCode bool `json:"need_postal_code"` - // True, if the cardholder name must be provided - NeedCardholderName bool `json:"need_cardholder_name"` -} - -func (entity *PaymentProviderStripe) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PaymentProviderStripe - - return json.Marshal((*stub)(entity)) -} - -func (*PaymentProviderStripe) GetClass() string { - return ClassPaymentProvider -} - -func (*PaymentProviderStripe) GetType() string { - return TypePaymentProviderStripe -} - -func (*PaymentProviderStripe) PaymentProviderType() string { - return TypePaymentProviderStripe -} - -// Some other payment provider, for which a web payment form must be shown -type PaymentProviderOther struct { - meta - // Payment form URL - Url string `json:"url"` -} - -func (entity *PaymentProviderOther) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PaymentProviderOther - - return json.Marshal((*stub)(entity)) -} - -func (*PaymentProviderOther) GetClass() string { - return ClassPaymentProvider -} - -func (*PaymentProviderOther) GetType() string { - return TypePaymentProviderOther -} - -func (*PaymentProviderOther) PaymentProviderType() string { - return TypePaymentProviderOther -} - -// Describes an additional payment option -type PaymentOption struct { - meta - // Title for the payment option - Title string `json:"title"` - // Payment form URL to be opened in a web view - Url string `json:"url"` -} - -func (entity *PaymentOption) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PaymentOption - - return json.Marshal((*stub)(entity)) -} - -func (*PaymentOption) GetClass() string { - return ClassPaymentOption -} - -func (*PaymentOption) GetType() string { - return TypePaymentOption -} - -// Contains information about an invoice payment form -type PaymentForm 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 - PaymentProvider PaymentProvider `json:"payment_provider"` - // The list of additional payment options - AdditionalPaymentOptions []*PaymentOption `json:"additional_payment_options"` - // Saved server-side order information; may be null - SavedOrderInfo *OrderInfo `json:"saved_order_info"` - // The list of saved payment credentials - SavedCredentials []*SavedCredentials `json:"saved_credentials"` - // True, if the user can choose to save credentials - 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 *PaymentForm) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PaymentForm - - return json.Marshal((*stub)(entity)) -} - -func (*PaymentForm) GetClass() string { - return ClassPaymentForm -} - -func (*PaymentForm) GetType() string { - return TypePaymentForm -} - -func (paymentForm *PaymentForm) UnmarshalJSON(data []byte) error { - var tmp struct { - Id JsonInt64 `json:"id"` - Invoice *Invoice `json:"invoice"` - 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"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - 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 - - fieldPaymentProvider, _ := UnmarshalPaymentProvider(tmp.PaymentProvider) - paymentForm.PaymentProvider = fieldPaymentProvider - - return nil -} - -// Contains a temporary identifier of validated order information, which is stored for one hour. Also contains the available shipping options -type ValidatedOrderInfo struct { - meta - // Temporary identifier of the order information - OrderInfoId string `json:"order_info_id"` - // Available shipping options - ShippingOptions []*ShippingOption `json:"shipping_options"` -} - -func (entity *ValidatedOrderInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ValidatedOrderInfo - - return json.Marshal((*stub)(entity)) -} - -func (*ValidatedOrderInfo) GetClass() string { - return ClassValidatedOrderInfo -} - -func (*ValidatedOrderInfo) GetType() string { - return TypeValidatedOrderInfo -} - -// Contains the result of a payment request -type PaymentResult struct { - meta - // True, if the payment request was successful; otherwise the verification_url will be non-empty - Success bool `json:"success"` - // URL for additional payment credentials verification - VerificationUrl string `json:"verification_url"` -} - -func (entity *PaymentResult) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PaymentResult - - return json.Marshal((*stub)(entity)) -} - -func (*PaymentResult) GetClass() string { - return ClassPaymentResult -} - -func (*PaymentResult) GetType() string { - return TypePaymentResult -} - -// Contains information about a successful payment -type PaymentReceipt 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 - Invoice *Invoice `json:"invoice"` - // Order information; may be null - OrderInfo *OrderInfo `json:"order_info"` - // Chosen shipping option; may be null - ShippingOption *ShippingOption `json:"shipping_option"` - // Title of the saved credentials chosen by the buyer - CredentialsTitle string `json:"credentials_title"` - // The amount of tip chosen by the buyer in the smallest units of the currency - TipAmount int64 `json:"tip_amount"` -} - -func (entity *PaymentReceipt) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PaymentReceipt - - return json.Marshal((*stub)(entity)) -} - -func (*PaymentReceipt) GetClass() string { - return ClassPaymentReceipt -} - -func (*PaymentReceipt) GetType() string { - return TypePaymentReceipt -} - -// An invoice from a message of the type messageInvoice -type InputInvoiceMessage struct { - meta - // Chat identifier of the message - ChatId int64 `json:"chat_id"` - // Message identifier - MessageId int64 `json:"message_id"` -} - -func (entity *InputInvoiceMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputInvoiceMessage - - return json.Marshal((*stub)(entity)) -} - -func (*InputInvoiceMessage) GetClass() string { - return ClassInputInvoice -} - -func (*InputInvoiceMessage) GetType() string { - return TypeInputInvoiceMessage -} - -func (*InputInvoiceMessage) InputInvoiceType() string { - return TypeInputInvoiceMessage -} - -// An invoice from a link of the type internalLinkTypeInvoice -type InputInvoiceName struct { - meta - // Name of the invoice - Name string `json:"name"` -} - -func (entity *InputInvoiceName) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputInvoiceName - - return json.Marshal((*stub)(entity)) -} - -func (*InputInvoiceName) GetClass() string { - return ClassInputInvoice -} - -func (*InputInvoiceName) GetType() string { - return TypeInputInvoiceName -} - -func (*InputInvoiceName) InputInvoiceType() string { - return TypeInputInvoiceName -} - -// The media is hidden until the invoice is paid -type MessageExtendedMediaPreview 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 - 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) { - entity.meta.Type = entity.GetType() - - type stub MessageExtendedMediaPreview - - return json.Marshal((*stub)(entity)) -} - -func (*MessageExtendedMediaPreview) GetClass() string { - return ClassMessageExtendedMedia -} - -func (*MessageExtendedMediaPreview) GetType() string { - return TypeMessageExtendedMediaPreview -} - -func (*MessageExtendedMediaPreview) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaPreview -} - -// The media is a photo -type MessageExtendedMediaPhoto struct { - meta - // The photo - Photo *Photo `json:"photo"` - // Photo caption - Caption *FormattedText `json:"caption"` -} - -func (entity *MessageExtendedMediaPhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageExtendedMediaPhoto - - return json.Marshal((*stub)(entity)) -} - -func (*MessageExtendedMediaPhoto) GetClass() string { - return ClassMessageExtendedMedia -} - -func (*MessageExtendedMediaPhoto) GetType() string { - return TypeMessageExtendedMediaPhoto -} - -func (*MessageExtendedMediaPhoto) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaPhoto -} - -// The media is a video -type MessageExtendedMediaVideo struct { - meta - // The video - Video *Video `json:"video"` - // Photo caption - Caption *FormattedText `json:"caption"` -} - -func (entity *MessageExtendedMediaVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageExtendedMediaVideo - - return json.Marshal((*stub)(entity)) -} - -func (*MessageExtendedMediaVideo) GetClass() string { - return ClassMessageExtendedMedia -} - -func (*MessageExtendedMediaVideo) GetType() string { - return TypeMessageExtendedMediaVideo -} - -func (*MessageExtendedMediaVideo) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaVideo -} - -// The media is unuspported -type MessageExtendedMediaUnsupported struct { - meta - // Media caption - Caption *FormattedText `json:"caption"` -} - -func (entity *MessageExtendedMediaUnsupported) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageExtendedMediaUnsupported - - return json.Marshal((*stub)(entity)) -} - -func (*MessageExtendedMediaUnsupported) GetClass() string { - return ClassMessageExtendedMedia -} - -func (*MessageExtendedMediaUnsupported) GetType() string { - return TypeMessageExtendedMediaUnsupported -} - -func (*MessageExtendedMediaUnsupported) MessageExtendedMediaType() string { - return TypeMessageExtendedMediaUnsupported -} - -// File with the date it was uploaded -type DatedFile struct { - meta - // The file - File *File `json:"file"` - // Point in time (Unix timestamp) when the file was uploaded - Date int32 `json:"date"` -} - -func (entity *DatedFile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub DatedFile - - return json.Marshal((*stub)(entity)) -} - -func (*DatedFile) GetClass() string { - return ClassDatedFile -} - -func (*DatedFile) GetType() string { - return TypeDatedFile -} - -// A Telegram Passport element containing the user's personal details -type PassportElementTypePersonalDetails struct { - meta -} - -func (entity *PassportElementTypePersonalDetails) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypePersonalDetails - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypePersonalDetails) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypePersonalDetails) GetType() string { - return TypePassportElementTypePersonalDetails -} - -func (*PassportElementTypePersonalDetails) PassportElementTypeType() string { - return TypePassportElementTypePersonalDetails -} - -// A Telegram Passport element containing the user's passport -type PassportElementTypePassport struct { - meta -} - -func (entity *PassportElementTypePassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypePassport - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypePassport) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypePassport) GetType() string { - return TypePassportElementTypePassport -} - -func (*PassportElementTypePassport) PassportElementTypeType() string { - return TypePassportElementTypePassport -} - -// A Telegram Passport element containing the user's driver license -type PassportElementTypeDriverLicense struct { - meta -} - -func (entity *PassportElementTypeDriverLicense) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypeDriverLicense - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypeDriverLicense) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypeDriverLicense) GetType() string { - return TypePassportElementTypeDriverLicense -} - -func (*PassportElementTypeDriverLicense) PassportElementTypeType() string { - return TypePassportElementTypeDriverLicense -} - -// A Telegram Passport element containing the user's identity card -type PassportElementTypeIdentityCard struct { - meta -} - -func (entity *PassportElementTypeIdentityCard) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypeIdentityCard - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypeIdentityCard) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypeIdentityCard) GetType() string { - return TypePassportElementTypeIdentityCard -} - -func (*PassportElementTypeIdentityCard) PassportElementTypeType() string { - return TypePassportElementTypeIdentityCard -} - -// A Telegram Passport element containing the user's internal passport -type PassportElementTypeInternalPassport struct { - meta -} - -func (entity *PassportElementTypeInternalPassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypeInternalPassport - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypeInternalPassport) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypeInternalPassport) GetType() string { - return TypePassportElementTypeInternalPassport -} - -func (*PassportElementTypeInternalPassport) PassportElementTypeType() string { - return TypePassportElementTypeInternalPassport -} - -// A Telegram Passport element containing the user's address -type PassportElementTypeAddress struct { - meta -} - -func (entity *PassportElementTypeAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypeAddress - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypeAddress) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypeAddress) GetType() string { - return TypePassportElementTypeAddress -} - -func (*PassportElementTypeAddress) PassportElementTypeType() string { - return TypePassportElementTypeAddress -} - -// A Telegram Passport element containing the user's utility bill -type PassportElementTypeUtilityBill struct { - meta -} - -func (entity *PassportElementTypeUtilityBill) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypeUtilityBill - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypeUtilityBill) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypeUtilityBill) GetType() string { - return TypePassportElementTypeUtilityBill -} - -func (*PassportElementTypeUtilityBill) PassportElementTypeType() string { - return TypePassportElementTypeUtilityBill -} - -// A Telegram Passport element containing the user's bank statement -type PassportElementTypeBankStatement struct { - meta -} - -func (entity *PassportElementTypeBankStatement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypeBankStatement - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypeBankStatement) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypeBankStatement) GetType() string { - return TypePassportElementTypeBankStatement -} - -func (*PassportElementTypeBankStatement) PassportElementTypeType() string { - return TypePassportElementTypeBankStatement -} - -// A Telegram Passport element containing the user's rental agreement -type PassportElementTypeRentalAgreement struct { - meta -} - -func (entity *PassportElementTypeRentalAgreement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypeRentalAgreement - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypeRentalAgreement) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypeRentalAgreement) GetType() string { - return TypePassportElementTypeRentalAgreement -} - -func (*PassportElementTypeRentalAgreement) PassportElementTypeType() string { - return TypePassportElementTypeRentalAgreement -} - -// A Telegram Passport element containing the registration page of the user's passport -type PassportElementTypePassportRegistration struct { - meta -} - -func (entity *PassportElementTypePassportRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypePassportRegistration - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypePassportRegistration) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypePassportRegistration) GetType() string { - return TypePassportElementTypePassportRegistration -} - -func (*PassportElementTypePassportRegistration) PassportElementTypeType() string { - return TypePassportElementTypePassportRegistration -} - -// A Telegram Passport element containing the user's temporary registration -type PassportElementTypeTemporaryRegistration struct { - meta -} - -func (entity *PassportElementTypeTemporaryRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypeTemporaryRegistration - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypeTemporaryRegistration) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypeTemporaryRegistration) GetType() string { - return TypePassportElementTypeTemporaryRegistration -} - -func (*PassportElementTypeTemporaryRegistration) PassportElementTypeType() string { - return TypePassportElementTypeTemporaryRegistration -} - -// A Telegram Passport element containing the user's phone number -type PassportElementTypePhoneNumber struct { - meta -} - -func (entity *PassportElementTypePhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypePhoneNumber - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypePhoneNumber) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypePhoneNumber) GetType() string { - return TypePassportElementTypePhoneNumber -} - -func (*PassportElementTypePhoneNumber) PassportElementTypeType() string { - return TypePassportElementTypePhoneNumber -} - -// A Telegram Passport element containing the user's email address -type PassportElementTypeEmailAddress struct { - meta -} - -func (entity *PassportElementTypeEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTypeEmailAddress - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTypeEmailAddress) GetClass() string { - return ClassPassportElementType -} - -func (*PassportElementTypeEmailAddress) GetType() string { - return TypePassportElementTypeEmailAddress -} - -func (*PassportElementTypeEmailAddress) PassportElementTypeType() string { - return TypePassportElementTypeEmailAddress -} - -// Represents a date according to the Gregorian calendar -type Date struct { - meta - // Day of the month; 1-31 - Day int32 `json:"day"` - // Month; 1-12 - Month int32 `json:"month"` - // Year; 1-9999 - Year int32 `json:"year"` -} - -func (entity *Date) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub Date - - return json.Marshal((*stub)(entity)) -} - -func (*Date) GetClass() string { - return ClassDate -} - -func (*Date) GetType() string { - return TypeDate -} - -// Contains the user's personal details -type PersonalDetails struct { - meta - // First name of the user written in English; 1-255 characters - FirstName string `json:"first_name"` - // Middle name of the user written in English; 0-255 characters - MiddleName string `json:"middle_name"` - // Last name of the user written in English; 1-255 characters - LastName string `json:"last_name"` - // Native first name of the user; 1-255 characters - NativeFirstName string `json:"native_first_name"` - // Native middle name of the user; 0-255 characters - NativeMiddleName string `json:"native_middle_name"` - // Native last name of the user; 1-255 characters - NativeLastName string `json:"native_last_name"` - // Birthdate of the user - Birthdate *Date `json:"birthdate"` - // Gender of the user, "male" or "female" - Gender string `json:"gender"` - // A two-letter ISO 3166-1 alpha-2 country code of the user's country - CountryCode string `json:"country_code"` - // A two-letter ISO 3166-1 alpha-2 country code of the user's residence country - ResidenceCountryCode string `json:"residence_country_code"` -} - -func (entity *PersonalDetails) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PersonalDetails - - return json.Marshal((*stub)(entity)) -} - -func (*PersonalDetails) GetClass() string { - return ClassPersonalDetails -} - -func (*PersonalDetails) GetType() string { - return TypePersonalDetails -} - -// An identity document -type IdentityDocument struct { - meta - // Document number; 1-24 characters - Number string `json:"number"` - // Document expiry date; may be null if not applicable - ExpiryDate *Date `json:"expiry_date"` - // Front side of the document - FrontSide *DatedFile `json:"front_side"` - // Reverse side of the document; only for driver license and identity card; may be null - ReverseSide *DatedFile `json:"reverse_side"` - // Selfie with the document; may be null - Selfie *DatedFile `json:"selfie"` - // List of files containing a certified English translation of the document - Translation []*DatedFile `json:"translation"` -} - -func (entity *IdentityDocument) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub IdentityDocument - - return json.Marshal((*stub)(entity)) -} - -func (*IdentityDocument) GetClass() string { - return ClassIdentityDocument -} - -func (*IdentityDocument) GetType() string { - return TypeIdentityDocument -} - -// An identity document to be saved to Telegram Passport -type InputIdentityDocument struct { - meta - // Document number; 1-24 characters - Number string `json:"number"` - // Document expiry date; pass null if not applicable - ExpiryDate *Date `json:"expiry_date"` - // Front side of the document - FrontSide InputFile `json:"front_side"` - // Reverse side of the document; only for driver license and identity card; pass null otherwise - ReverseSide InputFile `json:"reverse_side"` - // Selfie with the document; pass null if unavailable - Selfie InputFile `json:"selfie"` - // List of files containing a certified English translation of the document - Translation []InputFile `json:"translation"` -} - -func (entity *InputIdentityDocument) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputIdentityDocument - - return json.Marshal((*stub)(entity)) -} - -func (*InputIdentityDocument) GetClass() string { - return ClassInputIdentityDocument -} - -func (*InputIdentityDocument) GetType() string { - return TypeInputIdentityDocument -} - -func (inputIdentityDocument *InputIdentityDocument) UnmarshalJSON(data []byte) error { - var tmp struct { - Number string `json:"number"` - ExpiryDate *Date `json:"expiry_date"` - FrontSide json.RawMessage `json:"front_side"` - ReverseSide json.RawMessage `json:"reverse_side"` - Selfie json.RawMessage `json:"selfie"` - Translation []json.RawMessage `json:"translation"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inputIdentityDocument.Number = tmp.Number - inputIdentityDocument.ExpiryDate = tmp.ExpiryDate - - fieldFrontSide, _ := UnmarshalInputFile(tmp.FrontSide) - inputIdentityDocument.FrontSide = fieldFrontSide - - fieldReverseSide, _ := UnmarshalInputFile(tmp.ReverseSide) - inputIdentityDocument.ReverseSide = fieldReverseSide - - fieldSelfie, _ := UnmarshalInputFile(tmp.Selfie) - inputIdentityDocument.Selfie = fieldSelfie - - fieldTranslation, _ := UnmarshalListOfInputFile(tmp.Translation) - inputIdentityDocument.Translation = fieldTranslation - - return nil -} - -// A personal document, containing some information about a user -type PersonalDocument struct { - meta - // List of files containing the pages of the document - Files []*DatedFile `json:"files"` - // List of files containing a certified English translation of the document - Translation []*DatedFile `json:"translation"` -} - -func (entity *PersonalDocument) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PersonalDocument - - return json.Marshal((*stub)(entity)) -} - -func (*PersonalDocument) GetClass() string { - return ClassPersonalDocument -} - -func (*PersonalDocument) GetType() string { - return TypePersonalDocument -} - -// A personal document to be saved to Telegram Passport -type InputPersonalDocument struct { - meta - // List of files containing the pages of the document - Files []InputFile `json:"files"` - // List of files containing a certified English translation of the document - Translation []InputFile `json:"translation"` -} - -func (entity *InputPersonalDocument) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPersonalDocument - - return json.Marshal((*stub)(entity)) -} - -func (*InputPersonalDocument) GetClass() string { - return ClassInputPersonalDocument -} - -func (*InputPersonalDocument) GetType() string { - return TypeInputPersonalDocument -} - -func (inputPersonalDocument *InputPersonalDocument) UnmarshalJSON(data []byte) error { - var tmp struct { - Files []json.RawMessage `json:"files"` - Translation []json.RawMessage `json:"translation"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldFiles, _ := UnmarshalListOfInputFile(tmp.Files) - inputPersonalDocument.Files = fieldFiles - - fieldTranslation, _ := UnmarshalListOfInputFile(tmp.Translation) - inputPersonalDocument.Translation = fieldTranslation - - return nil -} - -// A Telegram Passport element containing the user's personal details -type PassportElementPersonalDetails struct { - meta - // Personal details of the user - PersonalDetails *PersonalDetails `json:"personal_details"` -} - -func (entity *PassportElementPersonalDetails) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementPersonalDetails - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementPersonalDetails) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementPersonalDetails) GetType() string { - return TypePassportElementPersonalDetails -} - -func (*PassportElementPersonalDetails) PassportElementType() string { - return TypePassportElementPersonalDetails -} - -// A Telegram Passport element containing the user's passport -type PassportElementPassport struct { - meta - // Passport - Passport *IdentityDocument `json:"passport"` -} - -func (entity *PassportElementPassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementPassport - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementPassport) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementPassport) GetType() string { - return TypePassportElementPassport -} - -func (*PassportElementPassport) PassportElementType() string { - return TypePassportElementPassport -} - -// A Telegram Passport element containing the user's driver license -type PassportElementDriverLicense struct { - meta - // Driver license - DriverLicense *IdentityDocument `json:"driver_license"` -} - -func (entity *PassportElementDriverLicense) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementDriverLicense - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementDriverLicense) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementDriverLicense) GetType() string { - return TypePassportElementDriverLicense -} - -func (*PassportElementDriverLicense) PassportElementType() string { - return TypePassportElementDriverLicense -} - -// A Telegram Passport element containing the user's identity card -type PassportElementIdentityCard struct { - meta - // Identity card - IdentityCard *IdentityDocument `json:"identity_card"` -} - -func (entity *PassportElementIdentityCard) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementIdentityCard - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementIdentityCard) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementIdentityCard) GetType() string { - return TypePassportElementIdentityCard -} - -func (*PassportElementIdentityCard) PassportElementType() string { - return TypePassportElementIdentityCard -} - -// A Telegram Passport element containing the user's internal passport -type PassportElementInternalPassport struct { - meta - // Internal passport - InternalPassport *IdentityDocument `json:"internal_passport"` -} - -func (entity *PassportElementInternalPassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementInternalPassport - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementInternalPassport) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementInternalPassport) GetType() string { - return TypePassportElementInternalPassport -} - -func (*PassportElementInternalPassport) PassportElementType() string { - return TypePassportElementInternalPassport -} - -// A Telegram Passport element containing the user's address -type PassportElementAddress struct { - meta - // Address - Address *Address `json:"address"` -} - -func (entity *PassportElementAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementAddress - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementAddress) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementAddress) GetType() string { - return TypePassportElementAddress -} - -func (*PassportElementAddress) PassportElementType() string { - return TypePassportElementAddress -} - -// A Telegram Passport element containing the user's utility bill -type PassportElementUtilityBill struct { - meta - // Utility bill - UtilityBill *PersonalDocument `json:"utility_bill"` -} - -func (entity *PassportElementUtilityBill) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementUtilityBill - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementUtilityBill) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementUtilityBill) GetType() string { - return TypePassportElementUtilityBill -} - -func (*PassportElementUtilityBill) PassportElementType() string { - return TypePassportElementUtilityBill -} - -// A Telegram Passport element containing the user's bank statement -type PassportElementBankStatement struct { - meta - // Bank statement - BankStatement *PersonalDocument `json:"bank_statement"` -} - -func (entity *PassportElementBankStatement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementBankStatement - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementBankStatement) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementBankStatement) GetType() string { - return TypePassportElementBankStatement -} - -func (*PassportElementBankStatement) PassportElementType() string { - return TypePassportElementBankStatement -} - -// A Telegram Passport element containing the user's rental agreement -type PassportElementRentalAgreement struct { - meta - // Rental agreement - RentalAgreement *PersonalDocument `json:"rental_agreement"` -} - -func (entity *PassportElementRentalAgreement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementRentalAgreement - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementRentalAgreement) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementRentalAgreement) GetType() string { - return TypePassportElementRentalAgreement -} - -func (*PassportElementRentalAgreement) PassportElementType() string { - return TypePassportElementRentalAgreement -} - -// A Telegram Passport element containing the user's passport registration pages -type PassportElementPassportRegistration struct { - meta - // Passport registration pages - PassportRegistration *PersonalDocument `json:"passport_registration"` -} - -func (entity *PassportElementPassportRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementPassportRegistration - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementPassportRegistration) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementPassportRegistration) GetType() string { - return TypePassportElementPassportRegistration -} - -func (*PassportElementPassportRegistration) PassportElementType() string { - return TypePassportElementPassportRegistration -} - -// A Telegram Passport element containing the user's temporary registration -type PassportElementTemporaryRegistration struct { - meta - // Temporary registration - TemporaryRegistration *PersonalDocument `json:"temporary_registration"` -} - -func (entity *PassportElementTemporaryRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementTemporaryRegistration - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementTemporaryRegistration) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementTemporaryRegistration) GetType() string { - return TypePassportElementTemporaryRegistration -} - -func (*PassportElementTemporaryRegistration) PassportElementType() string { - return TypePassportElementTemporaryRegistration -} - -// A Telegram Passport element containing the user's phone number -type PassportElementPhoneNumber struct { - meta - // Phone number - PhoneNumber string `json:"phone_number"` -} - -func (entity *PassportElementPhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementPhoneNumber - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementPhoneNumber) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementPhoneNumber) GetType() string { - return TypePassportElementPhoneNumber -} - -func (*PassportElementPhoneNumber) PassportElementType() string { - return TypePassportElementPhoneNumber -} - -// A Telegram Passport element containing the user's email address -type PassportElementEmailAddress struct { - meta - // Email address - EmailAddress string `json:"email_address"` -} - -func (entity *PassportElementEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementEmailAddress - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementEmailAddress) GetClass() string { - return ClassPassportElement -} - -func (*PassportElementEmailAddress) GetType() string { - return TypePassportElementEmailAddress -} - -func (*PassportElementEmailAddress) PassportElementType() string { - return TypePassportElementEmailAddress -} - -// A Telegram Passport element to be saved containing the user's personal details -type InputPassportElementPersonalDetails struct { - meta - // Personal details of the user - PersonalDetails *PersonalDetails `json:"personal_details"` -} - -func (entity *InputPassportElementPersonalDetails) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementPersonalDetails - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementPersonalDetails) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementPersonalDetails) GetType() string { - return TypeInputPassportElementPersonalDetails -} - -func (*InputPassportElementPersonalDetails) InputPassportElementType() string { - return TypeInputPassportElementPersonalDetails -} - -// A Telegram Passport element to be saved containing the user's passport -type InputPassportElementPassport struct { - meta - // The passport to be saved - Passport *InputIdentityDocument `json:"passport"` -} - -func (entity *InputPassportElementPassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementPassport - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementPassport) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementPassport) GetType() string { - return TypeInputPassportElementPassport -} - -func (*InputPassportElementPassport) InputPassportElementType() string { - return TypeInputPassportElementPassport -} - -// A Telegram Passport element to be saved containing the user's driver license -type InputPassportElementDriverLicense struct { - meta - // The driver license to be saved - DriverLicense *InputIdentityDocument `json:"driver_license"` -} - -func (entity *InputPassportElementDriverLicense) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementDriverLicense - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementDriverLicense) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementDriverLicense) GetType() string { - return TypeInputPassportElementDriverLicense -} - -func (*InputPassportElementDriverLicense) InputPassportElementType() string { - return TypeInputPassportElementDriverLicense -} - -// A Telegram Passport element to be saved containing the user's identity card -type InputPassportElementIdentityCard struct { - meta - // The identity card to be saved - IdentityCard *InputIdentityDocument `json:"identity_card"` -} - -func (entity *InputPassportElementIdentityCard) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementIdentityCard - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementIdentityCard) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementIdentityCard) GetType() string { - return TypeInputPassportElementIdentityCard -} - -func (*InputPassportElementIdentityCard) InputPassportElementType() string { - return TypeInputPassportElementIdentityCard -} - -// A Telegram Passport element to be saved containing the user's internal passport -type InputPassportElementInternalPassport struct { - meta - // The internal passport to be saved - InternalPassport *InputIdentityDocument `json:"internal_passport"` -} - -func (entity *InputPassportElementInternalPassport) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementInternalPassport - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementInternalPassport) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementInternalPassport) GetType() string { - return TypeInputPassportElementInternalPassport -} - -func (*InputPassportElementInternalPassport) InputPassportElementType() string { - return TypeInputPassportElementInternalPassport -} - -// A Telegram Passport element to be saved containing the user's address -type InputPassportElementAddress struct { - meta - // The address to be saved - Address *Address `json:"address"` -} - -func (entity *InputPassportElementAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementAddress - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementAddress) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementAddress) GetType() string { - return TypeInputPassportElementAddress -} - -func (*InputPassportElementAddress) InputPassportElementType() string { - return TypeInputPassportElementAddress -} - -// A Telegram Passport element to be saved containing the user's utility bill -type InputPassportElementUtilityBill struct { - meta - // The utility bill to be saved - UtilityBill *InputPersonalDocument `json:"utility_bill"` -} - -func (entity *InputPassportElementUtilityBill) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementUtilityBill - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementUtilityBill) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementUtilityBill) GetType() string { - return TypeInputPassportElementUtilityBill -} - -func (*InputPassportElementUtilityBill) InputPassportElementType() string { - return TypeInputPassportElementUtilityBill -} - -// A Telegram Passport element to be saved containing the user's bank statement -type InputPassportElementBankStatement struct { - meta - // The bank statement to be saved - BankStatement *InputPersonalDocument `json:"bank_statement"` -} - -func (entity *InputPassportElementBankStatement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementBankStatement - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementBankStatement) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementBankStatement) GetType() string { - return TypeInputPassportElementBankStatement -} - -func (*InputPassportElementBankStatement) InputPassportElementType() string { - return TypeInputPassportElementBankStatement -} - -// A Telegram Passport element to be saved containing the user's rental agreement -type InputPassportElementRentalAgreement struct { - meta - // The rental agreement to be saved - RentalAgreement *InputPersonalDocument `json:"rental_agreement"` -} - -func (entity *InputPassportElementRentalAgreement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementRentalAgreement - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementRentalAgreement) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementRentalAgreement) GetType() string { - return TypeInputPassportElementRentalAgreement -} - -func (*InputPassportElementRentalAgreement) InputPassportElementType() string { - return TypeInputPassportElementRentalAgreement -} - -// A Telegram Passport element to be saved containing the user's passport registration -type InputPassportElementPassportRegistration struct { - meta - // The passport registration page to be saved - PassportRegistration *InputPersonalDocument `json:"passport_registration"` -} - -func (entity *InputPassportElementPassportRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementPassportRegistration - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementPassportRegistration) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementPassportRegistration) GetType() string { - return TypeInputPassportElementPassportRegistration -} - -func (*InputPassportElementPassportRegistration) InputPassportElementType() string { - return TypeInputPassportElementPassportRegistration -} - -// A Telegram Passport element to be saved containing the user's temporary registration -type InputPassportElementTemporaryRegistration struct { - meta - // The temporary registration document to be saved - TemporaryRegistration *InputPersonalDocument `json:"temporary_registration"` -} - -func (entity *InputPassportElementTemporaryRegistration) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementTemporaryRegistration - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementTemporaryRegistration) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementTemporaryRegistration) GetType() string { - return TypeInputPassportElementTemporaryRegistration -} - -func (*InputPassportElementTemporaryRegistration) InputPassportElementType() string { - return TypeInputPassportElementTemporaryRegistration -} - -// A Telegram Passport element to be saved containing the user's phone number -type InputPassportElementPhoneNumber struct { - meta - // The phone number to be saved - PhoneNumber string `json:"phone_number"` -} - -func (entity *InputPassportElementPhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementPhoneNumber - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementPhoneNumber) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementPhoneNumber) GetType() string { - return TypeInputPassportElementPhoneNumber -} - -func (*InputPassportElementPhoneNumber) InputPassportElementType() string { - return TypeInputPassportElementPhoneNumber -} - -// A Telegram Passport element to be saved containing the user's email address -type InputPassportElementEmailAddress struct { - meta - // The email address to be saved - EmailAddress string `json:"email_address"` -} - -func (entity *InputPassportElementEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementEmailAddress - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementEmailAddress) GetClass() string { - return ClassInputPassportElement -} - -func (*InputPassportElementEmailAddress) GetType() string { - return TypeInputPassportElementEmailAddress -} - -func (*InputPassportElementEmailAddress) InputPassportElementType() string { - return TypeInputPassportElementEmailAddress -} - -// Contains information about saved Telegram Passport elements -type PassportElements struct { - meta - // Telegram Passport elements - Elements []PassportElement `json:"elements"` -} - -func (entity *PassportElements) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElements - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElements) GetClass() string { - return ClassPassportElements -} - -func (*PassportElements) GetType() string { - return TypePassportElements -} - -func (passportElements *PassportElements) UnmarshalJSON(data []byte) error { - var tmp struct { - Elements []json.RawMessage `json:"elements"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldElements, _ := UnmarshalListOfPassportElement(tmp.Elements) - passportElements.Elements = fieldElements - - return nil -} - -// The element contains an error in an unspecified place. The error will be considered resolved when new data is added -type PassportElementErrorSourceUnspecified struct { - meta -} - -func (entity *PassportElementErrorSourceUnspecified) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementErrorSourceUnspecified - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementErrorSourceUnspecified) GetClass() string { - return ClassPassportElementErrorSource -} - -func (*PassportElementErrorSourceUnspecified) GetType() string { - return TypePassportElementErrorSourceUnspecified -} - -func (*PassportElementErrorSourceUnspecified) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceUnspecified -} - -// One of the data fields contains an error. The error will be considered resolved when the value of the field changes -type PassportElementErrorSourceDataField struct { - meta - // Field name - FieldName string `json:"field_name"` -} - -func (entity *PassportElementErrorSourceDataField) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementErrorSourceDataField - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementErrorSourceDataField) GetClass() string { - return ClassPassportElementErrorSource -} - -func (*PassportElementErrorSourceDataField) GetType() string { - return TypePassportElementErrorSourceDataField -} - -func (*PassportElementErrorSourceDataField) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceDataField -} - -// The front side of the document contains an error. The error will be considered resolved when the file with the front side changes -type PassportElementErrorSourceFrontSide struct { - meta -} - -func (entity *PassportElementErrorSourceFrontSide) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementErrorSourceFrontSide - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementErrorSourceFrontSide) GetClass() string { - return ClassPassportElementErrorSource -} - -func (*PassportElementErrorSourceFrontSide) GetType() string { - return TypePassportElementErrorSourceFrontSide -} - -func (*PassportElementErrorSourceFrontSide) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceFrontSide -} - -// The reverse side of the document contains an error. The error will be considered resolved when the file with the reverse side changes -type PassportElementErrorSourceReverseSide struct { - meta -} - -func (entity *PassportElementErrorSourceReverseSide) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementErrorSourceReverseSide - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementErrorSourceReverseSide) GetClass() string { - return ClassPassportElementErrorSource -} - -func (*PassportElementErrorSourceReverseSide) GetType() string { - return TypePassportElementErrorSourceReverseSide -} - -func (*PassportElementErrorSourceReverseSide) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceReverseSide -} - -// The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes -type PassportElementErrorSourceSelfie struct { - meta -} - -func (entity *PassportElementErrorSourceSelfie) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementErrorSourceSelfie - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementErrorSourceSelfie) GetClass() string { - return ClassPassportElementErrorSource -} - -func (*PassportElementErrorSourceSelfie) GetType() string { - return TypePassportElementErrorSourceSelfie -} - -func (*PassportElementErrorSourceSelfie) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceSelfie -} - -// One of files with the translation of the document contains an error. The error will be considered resolved when the file changes -type PassportElementErrorSourceTranslationFile struct { - meta - // Index of a file with the error - FileIndex int32 `json:"file_index"` -} - -func (entity *PassportElementErrorSourceTranslationFile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementErrorSourceTranslationFile - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementErrorSourceTranslationFile) GetClass() string { - return ClassPassportElementErrorSource -} - -func (*PassportElementErrorSourceTranslationFile) GetType() string { - return TypePassportElementErrorSourceTranslationFile -} - -func (*PassportElementErrorSourceTranslationFile) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceTranslationFile -} - -// The translation of the document contains an error. The error will be considered resolved when the list of translation files changes -type PassportElementErrorSourceTranslationFiles struct { - meta -} - -func (entity *PassportElementErrorSourceTranslationFiles) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementErrorSourceTranslationFiles - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementErrorSourceTranslationFiles) GetClass() string { - return ClassPassportElementErrorSource -} - -func (*PassportElementErrorSourceTranslationFiles) GetType() string { - return TypePassportElementErrorSourceTranslationFiles -} - -func (*PassportElementErrorSourceTranslationFiles) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceTranslationFiles -} - -// The file contains an error. The error will be considered resolved when the file changes -type PassportElementErrorSourceFile struct { - meta - // Index of a file with the error - FileIndex int32 `json:"file_index"` -} - -func (entity *PassportElementErrorSourceFile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementErrorSourceFile - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementErrorSourceFile) GetClass() string { - return ClassPassportElementErrorSource -} - -func (*PassportElementErrorSourceFile) GetType() string { - return TypePassportElementErrorSourceFile -} - -func (*PassportElementErrorSourceFile) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceFile -} - -// The list of attached files contains an error. The error will be considered resolved when the list of files changes -type PassportElementErrorSourceFiles struct { - meta -} - -func (entity *PassportElementErrorSourceFiles) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementErrorSourceFiles - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementErrorSourceFiles) GetClass() string { - return ClassPassportElementErrorSource -} - -func (*PassportElementErrorSourceFiles) GetType() string { - return TypePassportElementErrorSourceFiles -} - -func (*PassportElementErrorSourceFiles) PassportElementErrorSourceType() string { - return TypePassportElementErrorSourceFiles -} - -// Contains the description of an error in a Telegram Passport element -type PassportElementError struct { - meta - // Type of the Telegram Passport element which has the error - Type PassportElementType `json:"type"` - // Error message - Message string `json:"message"` - // Error source - Source PassportElementErrorSource `json:"source"` -} - -func (entity *PassportElementError) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementError - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementError) GetClass() string { - return ClassPassportElementError -} - -func (*PassportElementError) GetType() string { - return TypePassportElementError -} - -func (passportElementError *PassportElementError) UnmarshalJSON(data []byte) error { - var tmp struct { - Type json.RawMessage `json:"type"` - Message string `json:"message"` - Source json.RawMessage `json:"source"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - passportElementError.Message = tmp.Message - - fieldType, _ := UnmarshalPassportElementType(tmp.Type) - passportElementError.Type = fieldType - - fieldSource, _ := UnmarshalPassportElementErrorSource(tmp.Source) - passportElementError.Source = fieldSource - - return nil -} - -// Contains information about a Telegram Passport element that was requested by a service -type PassportSuitableElement struct { - meta - // Type of the element - Type PassportElementType `json:"type"` - // True, if a selfie is required with the identity document - IsSelfieRequired bool `json:"is_selfie_required"` - // True, if a certified English translation is required with the document - IsTranslationRequired bool `json:"is_translation_required"` - // True, if personal details must include the user's name in the language of their country of residence - IsNativeNameRequired bool `json:"is_native_name_required"` -} - -func (entity *PassportSuitableElement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportSuitableElement - - return json.Marshal((*stub)(entity)) -} - -func (*PassportSuitableElement) GetClass() string { - return ClassPassportSuitableElement -} - -func (*PassportSuitableElement) GetType() string { - return TypePassportSuitableElement -} - -func (passportSuitableElement *PassportSuitableElement) UnmarshalJSON(data []byte) error { - var tmp struct { - Type json.RawMessage `json:"type"` - IsSelfieRequired bool `json:"is_selfie_required"` - IsTranslationRequired bool `json:"is_translation_required"` - IsNativeNameRequired bool `json:"is_native_name_required"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - passportSuitableElement.IsSelfieRequired = tmp.IsSelfieRequired - passportSuitableElement.IsTranslationRequired = tmp.IsTranslationRequired - passportSuitableElement.IsNativeNameRequired = tmp.IsNativeNameRequired - - fieldType, _ := UnmarshalPassportElementType(tmp.Type) - passportSuitableElement.Type = fieldType - - return nil -} - -// Contains a description of the required Telegram Passport element that was requested by a service -type PassportRequiredElement struct { - meta - // List of Telegram Passport elements any of which is enough to provide - SuitableElements []*PassportSuitableElement `json:"suitable_elements"` -} - -func (entity *PassportRequiredElement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportRequiredElement - - return json.Marshal((*stub)(entity)) -} - -func (*PassportRequiredElement) GetClass() string { - return ClassPassportRequiredElement -} - -func (*PassportRequiredElement) GetType() string { - return TypePassportRequiredElement -} - -// Contains information about a Telegram Passport authorization form that was requested -type PassportAuthorizationForm struct { - meta - // Unique identifier of the authorization form - Id int32 `json:"id"` - // Telegram Passport elements that must be provided to complete the form - RequiredElements []*PassportRequiredElement `json:"required_elements"` - // URL for the privacy policy of the service; may be empty - PrivacyPolicyUrl string `json:"privacy_policy_url"` -} - -func (entity *PassportAuthorizationForm) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportAuthorizationForm - - return json.Marshal((*stub)(entity)) -} - -func (*PassportAuthorizationForm) GetClass() string { - return ClassPassportAuthorizationForm -} - -func (*PassportAuthorizationForm) GetType() string { - return TypePassportAuthorizationForm -} - -// Contains information about a Telegram Passport elements and corresponding errors -type PassportElementsWithErrors struct { - meta - // Telegram Passport elements - Elements []PassportElement `json:"elements"` - // Errors in the elements that are already available - Errors []*PassportElementError `json:"errors"` -} - -func (entity *PassportElementsWithErrors) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PassportElementsWithErrors - - return json.Marshal((*stub)(entity)) -} - -func (*PassportElementsWithErrors) GetClass() string { - return ClassPassportElementsWithErrors -} - -func (*PassportElementsWithErrors) GetType() string { - return TypePassportElementsWithErrors -} - -func (passportElementsWithErrors *PassportElementsWithErrors) UnmarshalJSON(data []byte) error { - var tmp struct { - Elements []json.RawMessage `json:"elements"` - Errors []*PassportElementError `json:"errors"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - passportElementsWithErrors.Errors = tmp.Errors - - fieldElements, _ := UnmarshalListOfPassportElement(tmp.Elements) - passportElementsWithErrors.Elements = fieldElements - - return nil -} - -// Contains encrypted Telegram Passport data credentials -type EncryptedCredentials struct { - meta - // The encrypted credentials - Data []byte `json:"data"` - // The decrypted data hash - Hash []byte `json:"hash"` - // Secret for data decryption, encrypted with the service's public key - Secret []byte `json:"secret"` -} - -func (entity *EncryptedCredentials) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub EncryptedCredentials - - return json.Marshal((*stub)(entity)) -} - -func (*EncryptedCredentials) GetClass() string { - return ClassEncryptedCredentials -} - -func (*EncryptedCredentials) GetType() string { - return TypeEncryptedCredentials -} - -// Contains information about an encrypted Telegram Passport element; for bots only -type EncryptedPassportElement struct { - meta - // Type of Telegram Passport element - Type PassportElementType `json:"type"` - // Encrypted JSON-encoded data about the user - Data []byte `json:"data"` - // The front side of an identity document - FrontSide *DatedFile `json:"front_side"` - // The reverse side of an identity document; may be null - ReverseSide *DatedFile `json:"reverse_side"` - // Selfie with the document; may be null - Selfie *DatedFile `json:"selfie"` - // List of files containing a certified English translation of the document - Translation []*DatedFile `json:"translation"` - // List of attached files - Files []*DatedFile `json:"files"` - // Unencrypted data, phone number or email address - Value string `json:"value"` - // Hash of the entire element - Hash string `json:"hash"` -} - -func (entity *EncryptedPassportElement) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub EncryptedPassportElement - - return json.Marshal((*stub)(entity)) -} - -func (*EncryptedPassportElement) GetClass() string { - return ClassEncryptedPassportElement -} - -func (*EncryptedPassportElement) GetType() string { - return TypeEncryptedPassportElement -} - -func (encryptedPassportElement *EncryptedPassportElement) UnmarshalJSON(data []byte) error { - var tmp struct { - Type json.RawMessage `json:"type"` - Data []byte `json:"data"` - FrontSide *DatedFile `json:"front_side"` - ReverseSide *DatedFile `json:"reverse_side"` - Selfie *DatedFile `json:"selfie"` - Translation []*DatedFile `json:"translation"` - Files []*DatedFile `json:"files"` - Value string `json:"value"` - Hash string `json:"hash"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - encryptedPassportElement.Data = tmp.Data - encryptedPassportElement.FrontSide = tmp.FrontSide - encryptedPassportElement.ReverseSide = tmp.ReverseSide - encryptedPassportElement.Selfie = tmp.Selfie - encryptedPassportElement.Translation = tmp.Translation - encryptedPassportElement.Files = tmp.Files - encryptedPassportElement.Value = tmp.Value - encryptedPassportElement.Hash = tmp.Hash - - fieldType, _ := UnmarshalPassportElementType(tmp.Type) - encryptedPassportElement.Type = fieldType - - return nil -} - -// The element contains an error in an unspecified place. The error will be considered resolved when new data is added -type InputPassportElementErrorSourceUnspecified struct { - meta - // Current hash of the entire element - ElementHash []byte `json:"element_hash"` -} - -func (entity *InputPassportElementErrorSourceUnspecified) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementErrorSourceUnspecified - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementErrorSourceUnspecified) GetClass() string { - return ClassInputPassportElementErrorSource -} - -func (*InputPassportElementErrorSourceUnspecified) GetType() string { - return TypeInputPassportElementErrorSourceUnspecified -} - -func (*InputPassportElementErrorSourceUnspecified) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceUnspecified -} - -// A data field contains an error. The error is considered resolved when the field's value changes -type InputPassportElementErrorSourceDataField struct { - meta - // Field name - FieldName string `json:"field_name"` - // Current data hash - DataHash []byte `json:"data_hash"` -} - -func (entity *InputPassportElementErrorSourceDataField) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementErrorSourceDataField - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementErrorSourceDataField) GetClass() string { - return ClassInputPassportElementErrorSource -} - -func (*InputPassportElementErrorSourceDataField) GetType() string { - return TypeInputPassportElementErrorSourceDataField -} - -func (*InputPassportElementErrorSourceDataField) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceDataField -} - -// The front side of the document contains an error. The error is considered resolved when the file with the front side of the document changes -type InputPassportElementErrorSourceFrontSide struct { - meta - // Current hash of the file containing the front side - FileHash []byte `json:"file_hash"` -} - -func (entity *InputPassportElementErrorSourceFrontSide) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementErrorSourceFrontSide - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementErrorSourceFrontSide) GetClass() string { - return ClassInputPassportElementErrorSource -} - -func (*InputPassportElementErrorSourceFrontSide) GetType() string { - return TypeInputPassportElementErrorSourceFrontSide -} - -func (*InputPassportElementErrorSourceFrontSide) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceFrontSide -} - -// The reverse side of the document contains an error. The error is considered resolved when the file with the reverse side of the document changes -type InputPassportElementErrorSourceReverseSide struct { - meta - // Current hash of the file containing the reverse side - FileHash []byte `json:"file_hash"` -} - -func (entity *InputPassportElementErrorSourceReverseSide) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementErrorSourceReverseSide - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementErrorSourceReverseSide) GetClass() string { - return ClassInputPassportElementErrorSource -} - -func (*InputPassportElementErrorSourceReverseSide) GetType() string { - return TypeInputPassportElementErrorSourceReverseSide -} - -func (*InputPassportElementErrorSourceReverseSide) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceReverseSide -} - -// The selfie contains an error. The error is considered resolved when the file with the selfie changes -type InputPassportElementErrorSourceSelfie struct { - meta - // Current hash of the file containing the selfie - FileHash []byte `json:"file_hash"` -} - -func (entity *InputPassportElementErrorSourceSelfie) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementErrorSourceSelfie - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementErrorSourceSelfie) GetClass() string { - return ClassInputPassportElementErrorSource -} - -func (*InputPassportElementErrorSourceSelfie) GetType() string { - return TypeInputPassportElementErrorSourceSelfie -} - -func (*InputPassportElementErrorSourceSelfie) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceSelfie -} - -// One of the files containing the translation of the document contains an error. The error is considered resolved when the file with the translation changes -type InputPassportElementErrorSourceTranslationFile struct { - meta - // Current hash of the file containing the translation - FileHash []byte `json:"file_hash"` -} - -func (entity *InputPassportElementErrorSourceTranslationFile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementErrorSourceTranslationFile - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementErrorSourceTranslationFile) GetClass() string { - return ClassInputPassportElementErrorSource -} - -func (*InputPassportElementErrorSourceTranslationFile) GetType() string { - return TypeInputPassportElementErrorSourceTranslationFile -} - -func (*InputPassportElementErrorSourceTranslationFile) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceTranslationFile -} - -// The translation of the document contains an error. The error is considered resolved when the list of files changes -type InputPassportElementErrorSourceTranslationFiles struct { - meta - // Current hashes of all files with the translation - FileHashes [][]byte `json:"file_hashes"` -} - -func (entity *InputPassportElementErrorSourceTranslationFiles) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementErrorSourceTranslationFiles - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementErrorSourceTranslationFiles) GetClass() string { - return ClassInputPassportElementErrorSource -} - -func (*InputPassportElementErrorSourceTranslationFiles) GetType() string { - return TypeInputPassportElementErrorSourceTranslationFiles -} - -func (*InputPassportElementErrorSourceTranslationFiles) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceTranslationFiles -} - -// The file contains an error. The error is considered resolved when the file changes -type InputPassportElementErrorSourceFile struct { - meta - // Current hash of the file which has the error - FileHash []byte `json:"file_hash"` -} - -func (entity *InputPassportElementErrorSourceFile) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementErrorSourceFile - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementErrorSourceFile) GetClass() string { - return ClassInputPassportElementErrorSource -} - -func (*InputPassportElementErrorSourceFile) GetType() string { - return TypeInputPassportElementErrorSourceFile -} - -func (*InputPassportElementErrorSourceFile) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceFile -} - -// The list of attached files contains an error. The error is considered resolved when the file list changes -type InputPassportElementErrorSourceFiles struct { - meta - // Current hashes of all attached files - FileHashes [][]byte `json:"file_hashes"` -} - -func (entity *InputPassportElementErrorSourceFiles) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementErrorSourceFiles - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementErrorSourceFiles) GetClass() string { - return ClassInputPassportElementErrorSource -} - -func (*InputPassportElementErrorSourceFiles) GetType() string { - return TypeInputPassportElementErrorSourceFiles -} - -func (*InputPassportElementErrorSourceFiles) InputPassportElementErrorSourceType() string { - return TypeInputPassportElementErrorSourceFiles -} - -// Contains the description of an error in a Telegram Passport element; for bots only -type InputPassportElementError struct { - meta - // Type of Telegram Passport element that has the error - Type PassportElementType `json:"type"` - // Error message - Message string `json:"message"` - // Error source - Source InputPassportElementErrorSource `json:"source"` -} - -func (entity *InputPassportElementError) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub InputPassportElementError - - return json.Marshal((*stub)(entity)) -} - -func (*InputPassportElementError) GetClass() string { - return ClassInputPassportElementError -} - -func (*InputPassportElementError) GetType() string { - return TypeInputPassportElementError -} - -func (inputPassportElementError *InputPassportElementError) UnmarshalJSON(data []byte) error { - var tmp struct { - Type json.RawMessage `json:"type"` - Message string `json:"message"` - Source json.RawMessage `json:"source"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - inputPassportElementError.Message = tmp.Message - - fieldType, _ := UnmarshalPassportElementType(tmp.Type) - inputPassportElementError.Type = fieldType - - fieldSource, _ := UnmarshalInputPassportElementErrorSource(tmp.Source) - inputPassportElementError.Source = fieldSource - - return nil -} - -// A text message -type MessageText struct { - meta - // Text of the message - Text *FormattedText `json:"text"` - // A preview of the web page that's mentioned in the text; may be null - WebPage *WebPage `json:"web_page"` -} - -func (entity *MessageText) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageText - - return json.Marshal((*stub)(entity)) -} - -func (*MessageText) GetClass() string { - return ClassMessageContent -} - -func (*MessageText) GetType() string { - return TypeMessageText -} - -func (*MessageText) MessageContentType() string { - return TypeMessageText -} - -// An animation message (GIF-style). -type MessageAnimation struct { - meta - // The animation description - Animation *Animation `json:"animation"` - // Animation caption - Caption *FormattedText `json:"caption"` - // 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 - IsSecret bool `json:"is_secret"` -} - -func (entity *MessageAnimation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageAnimation - - return json.Marshal((*stub)(entity)) -} - -func (*MessageAnimation) GetClass() string { - return ClassMessageContent -} - -func (*MessageAnimation) GetType() string { - return TypeMessageAnimation -} - -func (*MessageAnimation) MessageContentType() string { - return TypeMessageAnimation -} - -// An audio message -type MessageAudio struct { - meta - // The audio description - Audio *Audio `json:"audio"` - // Audio caption - Caption *FormattedText `json:"caption"` -} - -func (entity *MessageAudio) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageAudio - - return json.Marshal((*stub)(entity)) -} - -func (*MessageAudio) GetClass() string { - return ClassMessageContent -} - -func (*MessageAudio) GetType() string { - return TypeMessageAudio -} - -func (*MessageAudio) MessageContentType() string { - return TypeMessageAudio -} - -// A document message (general file) -type MessageDocument struct { - meta - // The document description - Document *Document `json:"document"` - // Document caption - Caption *FormattedText `json:"caption"` -} - -func (entity *MessageDocument) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageDocument - - return json.Marshal((*stub)(entity)) -} - -func (*MessageDocument) GetClass() string { - return ClassMessageContent -} - -func (*MessageDocument) GetType() string { - return TypeMessageDocument -} - -func (*MessageDocument) MessageContentType() string { - return TypeMessageDocument -} - -// A photo message -type MessagePhoto struct { - meta - // The photo - Photo *Photo `json:"photo"` - // Photo caption - Caption *FormattedText `json:"caption"` - // 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 - IsSecret bool `json:"is_secret"` -} - -func (entity *MessagePhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessagePhoto - - return json.Marshal((*stub)(entity)) -} - -func (*MessagePhoto) GetClass() string { - return ClassMessageContent -} - -func (*MessagePhoto) GetType() string { - return TypeMessagePhoto -} - -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 - // The sticker description - Sticker *Sticker `json:"sticker"` - // True, if premium animation of the sticker must be played - IsPremium bool `json:"is_premium"` -} - -func (entity *MessageSticker) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSticker - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSticker) GetClass() string { - return ClassMessageContent -} - -func (*MessageSticker) GetType() string { - return TypeMessageSticker -} - -func (*MessageSticker) MessageContentType() string { - return TypeMessageSticker -} - -// A video message -type MessageVideo struct { - meta - // The video description - Video *Video `json:"video"` - // Video caption - Caption *FormattedText `json:"caption"` - // 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 - IsSecret bool `json:"is_secret"` -} - -func (entity *MessageVideo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageVideo - - return json.Marshal((*stub)(entity)) -} - -func (*MessageVideo) GetClass() string { - return ClassMessageContent -} - -func (*MessageVideo) GetType() string { - return TypeMessageVideo -} - -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 - // The video note description - VideoNote *VideoNote `json:"video_note"` - // True, if at least one of the recipients has viewed the video note - IsViewed bool `json:"is_viewed"` - // True, if the video note thumbnail must be blurred and the video note must be shown only while tapped - IsSecret bool `json:"is_secret"` -} - -func (entity *MessageVideoNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageVideoNote - - return json.Marshal((*stub)(entity)) -} - -func (*MessageVideoNote) GetClass() string { - return ClassMessageContent -} - -func (*MessageVideoNote) GetType() string { - return TypeMessageVideoNote -} - -func (*MessageVideoNote) MessageContentType() string { - return TypeMessageVideoNote -} - -// A voice note message -type MessageVoiceNote struct { - meta - // The voice note description - VoiceNote *VoiceNote `json:"voice_note"` - // Voice note caption - Caption *FormattedText `json:"caption"` - // True, if at least one of the recipients has listened to the voice note - IsListened bool `json:"is_listened"` -} - -func (entity *MessageVoiceNote) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageVoiceNote - - return json.Marshal((*stub)(entity)) -} - -func (*MessageVoiceNote) GetClass() string { - return ClassMessageContent -} - -func (*MessageVoiceNote) GetType() string { - return TypeMessageVoiceNote -} - -func (*MessageVoiceNote) MessageContentType() string { - return TypeMessageVoiceNote -} - -// 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 - LivePeriod int32 `json:"live_period"` - // Left time for which the location can be updated, in seconds. 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"` - // For live locations, a maximum distance to another chat member for proximity alerts, in meters (0-100000). 0 if the notification is disabled. Available only to the message sender - ProximityAlertRadius int32 `json:"proximity_alert_radius"` -} - -func (entity *MessageLocation) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageLocation - - return json.Marshal((*stub)(entity)) -} - -func (*MessageLocation) GetClass() string { - return ClassMessageContent -} - -func (*MessageLocation) GetType() string { - return TypeMessageLocation -} - -func (*MessageLocation) MessageContentType() string { - return TypeMessageLocation -} - -// A message with information about a venue -type MessageVenue struct { - meta - // The venue description - Venue *Venue `json:"venue"` -} - -func (entity *MessageVenue) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageVenue - - return json.Marshal((*stub)(entity)) -} - -func (*MessageVenue) GetClass() string { - return ClassMessageContent -} - -func (*MessageVenue) GetType() string { - return TypeMessageVenue -} - -func (*MessageVenue) MessageContentType() string { - return TypeMessageVenue -} - -// A message with a user contact -type MessageContact struct { - meta - // The contact description - Contact *Contact `json:"contact"` -} - -func (entity *MessageContact) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageContact - - return json.Marshal((*stub)(entity)) -} - -func (*MessageContact) GetClass() string { - return ClassMessageContent -} - -func (*MessageContact) GetType() string { - return TypeMessageContact -} - -func (*MessageContact) MessageContentType() string { - return TypeMessageContact -} - -// A message with an animated emoji -type MessageAnimatedEmoji struct { - meta - // The animated emoji - AnimatedEmoji *AnimatedEmoji `json:"animated_emoji"` - // The corresponding emoji - Emoji string `json:"emoji"` -} - -func (entity *MessageAnimatedEmoji) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageAnimatedEmoji - - return json.Marshal((*stub)(entity)) -} - -func (*MessageAnimatedEmoji) GetClass() string { - return ClassMessageContent -} - -func (*MessageAnimatedEmoji) GetType() string { - return TypeMessageAnimatedEmoji -} - -func (*MessageAnimatedEmoji) MessageContentType() string { - return TypeMessageAnimatedEmoji -} - -// 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 - 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 - 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 - 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"` -} - -func (entity *MessageDice) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageDice - - return json.Marshal((*stub)(entity)) -} - -func (*MessageDice) GetClass() string { - return ClassMessageContent -} - -func (*MessageDice) GetType() string { - return TypeMessageDice -} - -func (*MessageDice) MessageContentType() string { - return TypeMessageDice -} - -func (messageDice *MessageDice) UnmarshalJSON(data []byte) error { - var tmp struct { - InitialState json.RawMessage `json:"initial_state"` - FinalState json.RawMessage `json:"final_state"` - Emoji string `json:"emoji"` - Value int32 `json:"value"` - SuccessAnimationFrameNumber int32 `json:"success_animation_frame_number"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageDice.Emoji = tmp.Emoji - messageDice.Value = tmp.Value - messageDice.SuccessAnimationFrameNumber = tmp.SuccessAnimationFrameNumber - - fieldInitialState, _ := UnmarshalDiceStickers(tmp.InitialState) - messageDice.InitialState = fieldInitialState - - fieldFinalState, _ := UnmarshalDiceStickers(tmp.FinalState) - messageDice.FinalState = fieldFinalState - - return nil -} - -// A message with a game -type MessageGame struct { - meta - // The game description - Game *Game `json:"game"` -} - -func (entity *MessageGame) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageGame - - return json.Marshal((*stub)(entity)) -} - -func (*MessageGame) GetClass() string { - return ClassMessageContent -} - -func (*MessageGame) GetType() string { - return TypeMessageGame -} - -func (*MessageGame) MessageContentType() string { - return TypeMessageGame -} - -// A message with a poll -type MessagePoll struct { - meta - // The poll description - Poll *Poll `json:"poll"` -} - -func (entity *MessagePoll) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessagePoll - - return json.Marshal((*stub)(entity)) -} - -func (*MessagePoll) GetClass() string { - return ClassMessageContent -} - -func (*MessagePoll) GetType() string { - return TypeMessagePoll -} - -func (*MessagePoll) MessageContentType() string { - return TypeMessagePoll -} - -// A message with an invoice from a bot -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"` - // Currency for the product price - Currency string `json:"currency"` - // Product total price in the smallest units of the currency - TotalAmount int64 `json:"total_amount"` - // Unique invoice bot start_parameter. To share an invoice use the URL https://t.me/{bot_username}?start={start_parameter} - StartParameter string `json:"start_parameter"` - // True, if the invoice is a test invoice - IsTest bool `json:"is_test"` - // True, if the shipping address must be specified - 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"` -} - -func (entity *MessageInvoice) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageInvoice - - return json.Marshal((*stub)(entity)) -} - -func (*MessageInvoice) GetClass() string { - return ClassMessageContent -} - -func (*MessageInvoice) GetType() string { - return TypeMessageInvoice -} - -func (*MessageInvoice) MessageContentType() string { - return TypeMessageInvoice -} - -func (messageInvoice *MessageInvoice) UnmarshalJSON(data []byte) error { - var tmp struct { - Title string `json:"title"` - Description *FormattedText `json:"description"` - Photo *Photo `json:"photo"` - 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"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageInvoice.Title = tmp.Title - messageInvoice.Description = tmp.Description - messageInvoice.Photo = tmp.Photo - messageInvoice.Currency = tmp.Currency - messageInvoice.TotalAmount = tmp.TotalAmount - messageInvoice.StartParameter = tmp.StartParameter - messageInvoice.IsTest = tmp.IsTest - messageInvoice.NeedShippingAddress = tmp.NeedShippingAddress - messageInvoice.ReceiptMessageId = tmp.ReceiptMessageId - - fieldExtendedMedia, _ := UnmarshalMessageExtendedMedia(tmp.ExtendedMedia) - messageInvoice.ExtendedMedia = fieldExtendedMedia - - return nil -} - -// A message with information about an ended call -type MessageCall struct { - meta - // True, if the call was a video call - IsVideo bool `json:"is_video"` - // Reason why the call was discarded - DiscardReason CallDiscardReason `json:"discard_reason"` - // Call duration, in seconds - Duration int32 `json:"duration"` -} - -func (entity *MessageCall) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageCall - - return json.Marshal((*stub)(entity)) -} - -func (*MessageCall) GetClass() string { - return ClassMessageContent -} - -func (*MessageCall) GetType() string { - return TypeMessageCall -} - -func (*MessageCall) MessageContentType() string { - return TypeMessageCall -} - -func (messageCall *MessageCall) UnmarshalJSON(data []byte) error { - var tmp struct { - IsVideo bool `json:"is_video"` - DiscardReason json.RawMessage `json:"discard_reason"` - Duration int32 `json:"duration"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageCall.IsVideo = tmp.IsVideo - messageCall.Duration = tmp.Duration - - fieldDiscardReason, _ := UnmarshalCallDiscardReason(tmp.DiscardReason) - messageCall.DiscardReason = fieldDiscardReason - - 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 - StartDate int32 `json:"start_date"` -} - -func (entity *MessageVideoChatScheduled) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageVideoChatScheduled - - return json.Marshal((*stub)(entity)) -} - -func (*MessageVideoChatScheduled) GetClass() string { - return ClassMessageContent -} - -func (*MessageVideoChatScheduled) GetType() string { - return TypeMessageVideoChatScheduled -} - -func (*MessageVideoChatScheduled) MessageContentType() string { - return TypeMessageVideoChatScheduled -} - -// A newly created video chat -type MessageVideoChatStarted struct { - meta - // Identifier of the video chat. The video chat can be received through the method getGroupCall - GroupCallId int32 `json:"group_call_id"` -} - -func (entity *MessageVideoChatStarted) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageVideoChatStarted - - return json.Marshal((*stub)(entity)) -} - -func (*MessageVideoChatStarted) GetClass() string { - return ClassMessageContent -} - -func (*MessageVideoChatStarted) GetType() string { - return TypeMessageVideoChatStarted -} - -func (*MessageVideoChatStarted) MessageContentType() string { - return TypeMessageVideoChatStarted -} - -// A message with information about an ended video chat -type MessageVideoChatEnded struct { - meta - // Call duration, in seconds - Duration int32 `json:"duration"` -} - -func (entity *MessageVideoChatEnded) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageVideoChatEnded - - return json.Marshal((*stub)(entity)) -} - -func (*MessageVideoChatEnded) GetClass() string { - return ClassMessageContent -} - -func (*MessageVideoChatEnded) GetType() string { - return TypeMessageVideoChatEnded -} - -func (*MessageVideoChatEnded) MessageContentType() string { - return TypeMessageVideoChatEnded -} - -// A message with information about an invite to a video chat -type MessageInviteVideoChatParticipants struct { - meta - // Identifier of the video chat. The video chat can be received through the method getGroupCall - GroupCallId int32 `json:"group_call_id"` - // Invited user identifiers - UserIds []int64 `json:"user_ids"` -} - -func (entity *MessageInviteVideoChatParticipants) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageInviteVideoChatParticipants - - return json.Marshal((*stub)(entity)) -} - -func (*MessageInviteVideoChatParticipants) GetClass() string { - return ClassMessageContent -} - -func (*MessageInviteVideoChatParticipants) GetType() string { - return TypeMessageInviteVideoChatParticipants -} - -func (*MessageInviteVideoChatParticipants) MessageContentType() string { - return TypeMessageInviteVideoChatParticipants -} - -// A newly created basic group -type MessageBasicGroupChatCreate struct { - meta - // Title of the basic group - Title string `json:"title"` - // User identifiers of members in the basic group - MemberUserIds []int64 `json:"member_user_ids"` -} - -func (entity *MessageBasicGroupChatCreate) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageBasicGroupChatCreate - - return json.Marshal((*stub)(entity)) -} - -func (*MessageBasicGroupChatCreate) GetClass() string { - return ClassMessageContent -} - -func (*MessageBasicGroupChatCreate) GetType() string { - return TypeMessageBasicGroupChatCreate -} - -func (*MessageBasicGroupChatCreate) MessageContentType() string { - return TypeMessageBasicGroupChatCreate -} - -// A newly created supergroup or channel -type MessageSupergroupChatCreate struct { - meta - // Title of the supergroup or channel - Title string `json:"title"` -} - -func (entity *MessageSupergroupChatCreate) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSupergroupChatCreate - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSupergroupChatCreate) GetClass() string { - return ClassMessageContent -} - -func (*MessageSupergroupChatCreate) GetType() string { - return TypeMessageSupergroupChatCreate -} - -func (*MessageSupergroupChatCreate) MessageContentType() string { - return TypeMessageSupergroupChatCreate -} - -// An updated chat title -type MessageChatChangeTitle struct { - meta - // New chat title - Title string `json:"title"` -} - -func (entity *MessageChatChangeTitle) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageChatChangeTitle - - return json.Marshal((*stub)(entity)) -} - -func (*MessageChatChangeTitle) GetClass() string { - return ClassMessageContent -} - -func (*MessageChatChangeTitle) GetType() string { - return TypeMessageChatChangeTitle -} - -func (*MessageChatChangeTitle) MessageContentType() string { - return TypeMessageChatChangeTitle -} - -// An updated chat photo -type MessageChatChangePhoto struct { - meta - // New chat photo - Photo *ChatPhoto `json:"photo"` -} - -func (entity *MessageChatChangePhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageChatChangePhoto - - return json.Marshal((*stub)(entity)) -} - -func (*MessageChatChangePhoto) GetClass() string { - return ClassMessageContent -} - -func (*MessageChatChangePhoto) GetType() string { - return TypeMessageChatChangePhoto -} - -func (*MessageChatChangePhoto) MessageContentType() string { - return TypeMessageChatChangePhoto -} - -// A deleted chat photo -type MessageChatDeletePhoto struct { - meta -} - -func (entity *MessageChatDeletePhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageChatDeletePhoto - - return json.Marshal((*stub)(entity)) -} - -func (*MessageChatDeletePhoto) GetClass() string { - return ClassMessageContent -} - -func (*MessageChatDeletePhoto) GetType() string { - return TypeMessageChatDeletePhoto -} - -func (*MessageChatDeletePhoto) MessageContentType() string { - return TypeMessageChatDeletePhoto -} - -// New chat members were added -type MessageChatAddMembers struct { - meta - // User identifiers of the new members - MemberUserIds []int64 `json:"member_user_ids"` -} - -func (entity *MessageChatAddMembers) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageChatAddMembers - - return json.Marshal((*stub)(entity)) -} - -func (*MessageChatAddMembers) GetClass() string { - return ClassMessageContent -} - -func (*MessageChatAddMembers) GetType() string { - return TypeMessageChatAddMembers -} - -func (*MessageChatAddMembers) MessageContentType() string { - return TypeMessageChatAddMembers -} - -// A new member joined the chat via an invite link -type MessageChatJoinByLink struct { - meta -} - -func (entity *MessageChatJoinByLink) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageChatJoinByLink - - return json.Marshal((*stub)(entity)) -} - -func (*MessageChatJoinByLink) GetClass() string { - return ClassMessageContent -} - -func (*MessageChatJoinByLink) GetType() string { - return TypeMessageChatJoinByLink -} - -func (*MessageChatJoinByLink) MessageContentType() string { - return TypeMessageChatJoinByLink -} - -// A new member was accepted to the chat by an administrator -type MessageChatJoinByRequest struct { - meta -} - -func (entity *MessageChatJoinByRequest) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageChatJoinByRequest - - return json.Marshal((*stub)(entity)) -} - -func (*MessageChatJoinByRequest) GetClass() string { - return ClassMessageContent -} - -func (*MessageChatJoinByRequest) GetType() string { - return TypeMessageChatJoinByRequest -} - -func (*MessageChatJoinByRequest) MessageContentType() string { - return TypeMessageChatJoinByRequest -} - -// A chat member was deleted -type MessageChatDeleteMember struct { - meta - // User identifier of the deleted chat member - UserId int64 `json:"user_id"` -} - -func (entity *MessageChatDeleteMember) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageChatDeleteMember - - return json.Marshal((*stub)(entity)) -} - -func (*MessageChatDeleteMember) GetClass() string { - return ClassMessageContent -} - -func (*MessageChatDeleteMember) GetType() string { - return TypeMessageChatDeleteMember -} - -func (*MessageChatDeleteMember) MessageContentType() string { - return TypeMessageChatDeleteMember -} - -// A basic group was upgraded to a supergroup and was deactivated as the result -type MessageChatUpgradeTo struct { - meta - // Identifier of the supergroup to which the basic group was upgraded - SupergroupId int64 `json:"supergroup_id"` -} - -func (entity *MessageChatUpgradeTo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageChatUpgradeTo - - return json.Marshal((*stub)(entity)) -} - -func (*MessageChatUpgradeTo) GetClass() string { - return ClassMessageContent -} - -func (*MessageChatUpgradeTo) GetType() string { - return TypeMessageChatUpgradeTo -} - -func (*MessageChatUpgradeTo) MessageContentType() string { - return TypeMessageChatUpgradeTo -} - -// A supergroup has been created from a basic group -type MessageChatUpgradeFrom struct { - meta - // Title of the newly created supergroup - Title string `json:"title"` - // The identifier of the original basic group - BasicGroupId int64 `json:"basic_group_id"` -} - -func (entity *MessageChatUpgradeFrom) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageChatUpgradeFrom - - return json.Marshal((*stub)(entity)) -} - -func (*MessageChatUpgradeFrom) GetClass() string { - return ClassMessageContent -} - -func (*MessageChatUpgradeFrom) GetType() string { - return TypeMessageChatUpgradeFrom -} - -func (*MessageChatUpgradeFrom) MessageContentType() string { - return TypeMessageChatUpgradeFrom -} - -// A message has been pinned -type MessagePinMessage struct { - meta - // Identifier of the pinned message, can be an identifier of a deleted message or 0 - MessageId int64 `json:"message_id"` -} - -func (entity *MessagePinMessage) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessagePinMessage - - return json.Marshal((*stub)(entity)) -} - -func (*MessagePinMessage) GetClass() string { - return ClassMessageContent -} - -func (*MessagePinMessage) GetType() string { - return TypeMessagePinMessage -} - -func (*MessagePinMessage) MessageContentType() string { - return TypeMessagePinMessage -} - -// A screenshot of a message in the chat has been taken -type MessageScreenshotTaken struct { - meta -} - -func (entity *MessageScreenshotTaken) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageScreenshotTaken - - return json.Marshal((*stub)(entity)) -} - -func (*MessageScreenshotTaken) GetClass() string { - return ClassMessageContent -} - -func (*MessageScreenshotTaken) GetType() string { - return TypeMessageScreenshotTaken -} - -func (*MessageScreenshotTaken) MessageContentType() string { - return TypeMessageScreenshotTaken -} - -// 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"` -} - -func (entity *MessageChatSetTheme) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageChatSetTheme - - return json.Marshal((*stub)(entity)) -} - -func (*MessageChatSetTheme) GetClass() string { - return ClassMessageContent -} - -func (*MessageChatSetTheme) GetType() string { - return TypeMessageChatSetTheme -} - -func (*MessageChatSetTheme) MessageContentType() string { - return TypeMessageChatSetTheme -} - -// The auto-delete or self-destruct timer for messages in the chat has been changed -type MessageChatSetMessageAutoDeleteTime struct { - meta - // New value auto-delete or self-destruct time, in seconds; 0 if disabled - MessageAutoDeleteTime int32 `json:"message_auto_delete_time"` - // If not 0, a user identifier, which default setting was automatically applied - FromUserId int64 `json:"from_user_id"` -} - -func (entity *MessageChatSetMessageAutoDeleteTime) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageChatSetMessageAutoDeleteTime - - return json.Marshal((*stub)(entity)) -} - -func (*MessageChatSetMessageAutoDeleteTime) GetClass() string { - return ClassMessageContent -} - -func (*MessageChatSetMessageAutoDeleteTime) GetType() string { - return TypeMessageChatSetMessageAutoDeleteTime -} - -func (*MessageChatSetMessageAutoDeleteTime) MessageContentType() string { - return TypeMessageChatSetMessageAutoDeleteTime -} - -// A forum topic has been created -type MessageForumTopicCreated struct { - meta - // Name of the topic - Name string `json:"name"` - // Icon of the topic - Icon *ForumTopicIcon `json:"icon"` -} - -func (entity *MessageForumTopicCreated) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageForumTopicCreated - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForumTopicCreated) GetClass() string { - return ClassMessageContent -} - -func (*MessageForumTopicCreated) GetType() string { - return TypeMessageForumTopicCreated -} - -func (*MessageForumTopicCreated) MessageContentType() string { - return TypeMessageForumTopicCreated -} - -// A forum topic has been edited -type MessageForumTopicEdited struct { - meta - // If non-empty, the new name of the topic - Name string `json:"name"` - // True, if icon's custom_emoji_id is changed - EditIconCustomEmojiId bool `json:"edit_icon_custom_emoji_id"` - // New unique identifier of the custom emoji shown on the topic icon; 0 if none. Must be ignored if edit_icon_custom_emoji_id is false - IconCustomEmojiId JsonInt64 `json:"icon_custom_emoji_id"` -} - -func (entity *MessageForumTopicEdited) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageForumTopicEdited - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForumTopicEdited) GetClass() string { - return ClassMessageContent -} - -func (*MessageForumTopicEdited) GetType() string { - return TypeMessageForumTopicEdited -} - -func (*MessageForumTopicEdited) MessageContentType() string { - return TypeMessageForumTopicEdited -} - -// A forum topic has been closed or opened -type MessageForumTopicIsClosedToggled struct { - meta - // True, if the topic was closed, otherwise the topic was reopened - IsClosed bool `json:"is_closed"` -} - -func (entity *MessageForumTopicIsClosedToggled) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageForumTopicIsClosedToggled - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForumTopicIsClosedToggled) GetClass() string { - return ClassMessageContent -} - -func (*MessageForumTopicIsClosedToggled) GetType() string { - return TypeMessageForumTopicIsClosedToggled -} - -func (*MessageForumTopicIsClosedToggled) MessageContentType() string { - return TypeMessageForumTopicIsClosedToggled -} - -// A General forum topic has been hidden or unhidden -type MessageForumTopicIsHiddenToggled struct { - meta - // True, if the topic was hidden, otherwise the topic was unhidden - IsHidden bool `json:"is_hidden"` -} - -func (entity *MessageForumTopicIsHiddenToggled) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageForumTopicIsHiddenToggled - - return json.Marshal((*stub)(entity)) -} - -func (*MessageForumTopicIsHiddenToggled) GetClass() string { - return ClassMessageContent -} - -func (*MessageForumTopicIsHiddenToggled) GetType() string { - return TypeMessageForumTopicIsHiddenToggled -} - -func (*MessageForumTopicIsHiddenToggled) MessageContentType() string { - return TypeMessageForumTopicIsHiddenToggled -} - -// A profile photo was suggested to a user in a private chat -type MessageSuggestProfilePhoto struct { - meta - // The suggested chat photo. Use the method setProfilePhoto with inputChatPhotoPrevious to apply the photo - Photo *ChatPhoto `json:"photo"` -} - -func (entity *MessageSuggestProfilePhoto) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageSuggestProfilePhoto - - return json.Marshal((*stub)(entity)) -} - -func (*MessageSuggestProfilePhoto) GetClass() string { - return ClassMessageContent -} - -func (*MessageSuggestProfilePhoto) GetType() string { - return TypeMessageSuggestProfilePhoto -} - -func (*MessageSuggestProfilePhoto) MessageContentType() string { - return TypeMessageSuggestProfilePhoto -} - -// A non-standard action has happened in the chat -type MessageCustomServiceAction struct { - meta - // Message text to be shown in the chat - Text string `json:"text"` -} - -func (entity *MessageCustomServiceAction) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageCustomServiceAction - - return json.Marshal((*stub)(entity)) -} - -func (*MessageCustomServiceAction) GetClass() string { - return ClassMessageContent -} - -func (*MessageCustomServiceAction) GetType() string { - return TypeMessageCustomServiceAction -} - -func (*MessageCustomServiceAction) MessageContentType() string { - return TypeMessageCustomServiceAction -} - -// A new high score was achieved in a game -type MessageGameScore struct { - meta - // Identifier of the message with the game, can be an identifier of a deleted message - GameMessageId int64 `json:"game_message_id"` - // Identifier of the game; may be different from the games presented in the message with the game - GameId JsonInt64 `json:"game_id"` - // New score - Score int32 `json:"score"` -} - -func (entity *MessageGameScore) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageGameScore - - return json.Marshal((*stub)(entity)) -} - -func (*MessageGameScore) GetClass() string { - return ClassMessageContent -} - -func (*MessageGameScore) GetType() string { - return TypeMessageGameScore -} - -func (*MessageGameScore) MessageContentType() string { - return TypeMessageGameScore -} - -// A payment has been completed -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 - 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"` - // 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"` - // Name of the invoice; may be empty if unknown - InvoiceName string `json:"invoice_name"` -} - -func (entity *MessagePaymentSuccessful) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessagePaymentSuccessful - - return json.Marshal((*stub)(entity)) -} - -func (*MessagePaymentSuccessful) GetClass() string { - return ClassMessageContent -} - -func (*MessagePaymentSuccessful) GetType() string { - return TypeMessagePaymentSuccessful -} - -func (*MessagePaymentSuccessful) MessageContentType() string { - return TypeMessagePaymentSuccessful -} - -// A payment has been completed; for bots only -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"` - // 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 - ShippingOptionId string `json:"shipping_option_id"` - // Information about the order; may be null - OrderInfo *OrderInfo `json:"order_info"` - // Telegram payment identifier - TelegramPaymentChargeId string `json:"telegram_payment_charge_id"` - // Provider payment identifier - ProviderPaymentChargeId string `json:"provider_payment_charge_id"` -} - -func (entity *MessagePaymentSuccessfulBot) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessagePaymentSuccessfulBot - - return json.Marshal((*stub)(entity)) -} - -func (*MessagePaymentSuccessfulBot) GetClass() string { - return ClassMessageContent -} - -func (*MessagePaymentSuccessfulBot) GetType() string { - return TypeMessagePaymentSuccessfulBot -} - -func (*MessagePaymentSuccessfulBot) MessageContentType() string { - return TypeMessagePaymentSuccessfulBot -} - -// Telegram Premium was gifted to the user -type MessageGiftedPremium struct { - meta - // Currency for the paid amount - Currency string `json:"currency"` - // The paid amount, in the smallest units of the currency - Amount int64 `json:"amount"` - // Number of month the Telegram Premium subscription will be active - MonthCount int32 `json:"month_count"` - // A sticker to be shown in the message; may be null if unknown - Sticker *Sticker `json:"sticker"` -} - -func (entity *MessageGiftedPremium) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageGiftedPremium - - return json.Marshal((*stub)(entity)) -} - -func (*MessageGiftedPremium) GetClass() string { - return ClassMessageContent -} - -func (*MessageGiftedPremium) GetType() string { - return TypeMessageGiftedPremium -} - -func (*MessageGiftedPremium) MessageContentType() string { - return TypeMessageGiftedPremium -} - -// A contact has registered with Telegram -type MessageContactRegistered struct { - meta -} - -func (entity *MessageContactRegistered) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageContactRegistered - - return json.Marshal((*stub)(entity)) -} - -func (*MessageContactRegistered) GetClass() string { - return ClassMessageContent -} - -func (*MessageContactRegistered) GetType() string { - return TypeMessageContactRegistered -} - -func (*MessageContactRegistered) MessageContentType() string { - return TypeMessageContactRegistered -} - -// The current user has connected a website by logging in using Telegram Login Widget on it -type MessageWebsiteConnected struct { - meta - // Domain name of the connected website - DomainName string `json:"domain_name"` -} - -func (entity *MessageWebsiteConnected) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageWebsiteConnected - - return json.Marshal((*stub)(entity)) -} - -func (*MessageWebsiteConnected) GetClass() string { - return ClassMessageContent -} - -func (*MessageWebsiteConnected) GetType() string { - return TypeMessageWebsiteConnected -} - -func (*MessageWebsiteConnected) MessageContentType() string { - return TypeMessageWebsiteConnected -} - -// The user allowed the bot to send messages -type MessageBotWriteAccessAllowed struct { - meta -} - -func (entity *MessageBotWriteAccessAllowed) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageBotWriteAccessAllowed - - return json.Marshal((*stub)(entity)) -} - -func (*MessageBotWriteAccessAllowed) GetClass() string { - return ClassMessageContent -} - -func (*MessageBotWriteAccessAllowed) GetType() string { - return TypeMessageBotWriteAccessAllowed -} - -func (*MessageBotWriteAccessAllowed) MessageContentType() string { - return TypeMessageBotWriteAccessAllowed -} - -// Data from a Web App has been sent to a bot -type MessageWebAppDataSent struct { - meta - // Text of the keyboardButtonTypeWebApp button, which opened the Web App - ButtonText string `json:"button_text"` -} - -func (entity *MessageWebAppDataSent) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageWebAppDataSent - - return json.Marshal((*stub)(entity)) -} - -func (*MessageWebAppDataSent) GetClass() string { - return ClassMessageContent -} - -func (*MessageWebAppDataSent) GetType() string { - return TypeMessageWebAppDataSent -} - -func (*MessageWebAppDataSent) MessageContentType() string { - return TypeMessageWebAppDataSent -} - -// Data from a Web App has been received; for bots only -type MessageWebAppDataReceived struct { - meta - // Text of the keyboardButtonTypeWebApp button, which opened the Web App - ButtonText string `json:"button_text"` - // Received data - Data string `json:"data"` -} - -func (entity *MessageWebAppDataReceived) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageWebAppDataReceived - - return json.Marshal((*stub)(entity)) -} - -func (*MessageWebAppDataReceived) GetClass() string { - return ClassMessageContent -} - -func (*MessageWebAppDataReceived) GetType() string { - return TypeMessageWebAppDataReceived -} - -func (*MessageWebAppDataReceived) MessageContentType() string { - return TypeMessageWebAppDataReceived -} - -// Telegram Passport data has been sent to a bot -type MessagePassportDataSent struct { - meta - // List of Telegram Passport element types sent - Types []PassportElementType `json:"types"` -} - -func (entity *MessagePassportDataSent) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessagePassportDataSent - - return json.Marshal((*stub)(entity)) -} - -func (*MessagePassportDataSent) GetClass() string { - return ClassMessageContent -} - -func (*MessagePassportDataSent) GetType() string { - return TypeMessagePassportDataSent -} - -func (*MessagePassportDataSent) MessageContentType() string { - return TypeMessagePassportDataSent -} - -func (messagePassportDataSent *MessagePassportDataSent) UnmarshalJSON(data []byte) error { - var tmp struct { - Types []json.RawMessage `json:"types"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - fieldTypes, _ := UnmarshalListOfPassportElementType(tmp.Types) - messagePassportDataSent.Types = fieldTypes - - return nil -} - -// Telegram Passport data has been received; for bots only -type MessagePassportDataReceived struct { - meta - // List of received Telegram Passport elements - Elements []*EncryptedPassportElement `json:"elements"` - // Encrypted data credentials - Credentials *EncryptedCredentials `json:"credentials"` -} - -func (entity *MessagePassportDataReceived) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessagePassportDataReceived - - return json.Marshal((*stub)(entity)) -} - -func (*MessagePassportDataReceived) GetClass() string { - return ClassMessageContent -} - -func (*MessagePassportDataReceived) GetType() string { - return TypeMessagePassportDataReceived -} - -func (*MessagePassportDataReceived) MessageContentType() string { - return TypeMessagePassportDataReceived -} - -// A user in the chat came within proximity alert range -type MessageProximityAlertTriggered struct { - meta - // The identifier of a user or chat that triggered the proximity alert - TravelerId MessageSender `json:"traveler_id"` - // The identifier of a user or chat that subscribed for the proximity alert - WatcherId MessageSender `json:"watcher_id"` - // The distance between the users - Distance int32 `json:"distance"` -} - -func (entity *MessageProximityAlertTriggered) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageProximityAlertTriggered - - return json.Marshal((*stub)(entity)) -} - -func (*MessageProximityAlertTriggered) GetClass() string { - return ClassMessageContent -} - -func (*MessageProximityAlertTriggered) GetType() string { - return TypeMessageProximityAlertTriggered -} - -func (*MessageProximityAlertTriggered) MessageContentType() string { - return TypeMessageProximityAlertTriggered -} - -func (messageProximityAlertTriggered *MessageProximityAlertTriggered) UnmarshalJSON(data []byte) error { - var tmp struct { - TravelerId json.RawMessage `json:"traveler_id"` - WatcherId json.RawMessage `json:"watcher_id"` - Distance int32 `json:"distance"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - messageProximityAlertTriggered.Distance = tmp.Distance - - fieldTravelerId, _ := UnmarshalMessageSender(tmp.TravelerId) - messageProximityAlertTriggered.TravelerId = fieldTravelerId - - fieldWatcherId, _ := UnmarshalMessageSender(tmp.WatcherId) - messageProximityAlertTriggered.WatcherId = fieldWatcherId - - return nil -} - -// Message content that is not supported in the current TDLib version -type MessageUnsupported struct { - meta -} - -func (entity *MessageUnsupported) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub MessageUnsupported - - return json.Marshal((*stub)(entity)) -} - -func (*MessageUnsupported) GetClass() string { - return ClassMessageContent -} - -func (*MessageUnsupported) GetType() string { - return TypeMessageUnsupported -} - -func (*MessageUnsupported) MessageContentType() string { - return TypeMessageUnsupported -} - -// A mention of a user, a supergroup, or a channel by their username -type TextEntityTypeMention struct { - meta -} - -func (entity *TextEntityTypeMention) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeMention - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeMention) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeMention) GetType() string { - return TypeTextEntityTypeMention -} - -func (*TextEntityTypeMention) TextEntityTypeType() string { - return TypeTextEntityTypeMention -} - -// A hashtag text, beginning with "#" -type TextEntityTypeHashtag struct { - meta -} - -func (entity *TextEntityTypeHashtag) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeHashtag - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeHashtag) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeHashtag) GetType() string { - return TypeTextEntityTypeHashtag -} - -func (*TextEntityTypeHashtag) TextEntityTypeType() string { - return TypeTextEntityTypeHashtag -} - -// A cashtag text, beginning with "$" and consisting of capital English letters (e.g., "$USD") -type TextEntityTypeCashtag struct { - meta -} - -func (entity *TextEntityTypeCashtag) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeCashtag - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeCashtag) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeCashtag) GetType() string { - return TypeTextEntityTypeCashtag -} - -func (*TextEntityTypeCashtag) TextEntityTypeType() string { - return TypeTextEntityTypeCashtag -} - -// A bot command, beginning with "/" -type TextEntityTypeBotCommand struct { - meta -} - -func (entity *TextEntityTypeBotCommand) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeBotCommand - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeBotCommand) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeBotCommand) GetType() string { - return TypeTextEntityTypeBotCommand -} - -func (*TextEntityTypeBotCommand) TextEntityTypeType() string { - return TypeTextEntityTypeBotCommand -} - -// An HTTP URL -type TextEntityTypeUrl struct { - meta -} - -func (entity *TextEntityTypeUrl) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeUrl - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeUrl) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeUrl) GetType() string { - return TypeTextEntityTypeUrl -} - -func (*TextEntityTypeUrl) TextEntityTypeType() string { - return TypeTextEntityTypeUrl -} - -// An email address -type TextEntityTypeEmailAddress struct { - meta -} - -func (entity *TextEntityTypeEmailAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeEmailAddress - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeEmailAddress) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeEmailAddress) GetType() string { - return TypeTextEntityTypeEmailAddress -} - -func (*TextEntityTypeEmailAddress) TextEntityTypeType() string { - return TypeTextEntityTypeEmailAddress -} - -// A phone number -type TextEntityTypePhoneNumber struct { - meta -} - -func (entity *TextEntityTypePhoneNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypePhoneNumber - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypePhoneNumber) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypePhoneNumber) GetType() string { - return TypeTextEntityTypePhoneNumber -} - -func (*TextEntityTypePhoneNumber) TextEntityTypeType() string { - return TypeTextEntityTypePhoneNumber -} - -// A bank card number. The getBankCardInfo method can be used to get information about the bank card -type TextEntityTypeBankCardNumber struct { - meta -} - -func (entity *TextEntityTypeBankCardNumber) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeBankCardNumber - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeBankCardNumber) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeBankCardNumber) GetType() string { - return TypeTextEntityTypeBankCardNumber -} - -func (*TextEntityTypeBankCardNumber) TextEntityTypeType() string { - return TypeTextEntityTypeBankCardNumber -} - -// A bold text -type TextEntityTypeBold struct { - meta -} - -func (entity *TextEntityTypeBold) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeBold - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeBold) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeBold) GetType() string { - return TypeTextEntityTypeBold -} - -func (*TextEntityTypeBold) TextEntityTypeType() string { - return TypeTextEntityTypeBold -} - -// An italic text -type TextEntityTypeItalic struct { - meta -} - -func (entity *TextEntityTypeItalic) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeItalic - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeItalic) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeItalic) GetType() string { - return TypeTextEntityTypeItalic -} - -func (*TextEntityTypeItalic) TextEntityTypeType() string { - return TypeTextEntityTypeItalic -} - -// An underlined text -type TextEntityTypeUnderline struct { - meta -} - -func (entity *TextEntityTypeUnderline) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeUnderline - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeUnderline) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeUnderline) GetType() string { - return TypeTextEntityTypeUnderline -} - -func (*TextEntityTypeUnderline) TextEntityTypeType() string { - return TypeTextEntityTypeUnderline -} - -// A strikethrough text -type TextEntityTypeStrikethrough struct { - meta -} - -func (entity *TextEntityTypeStrikethrough) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeStrikethrough - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeStrikethrough) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeStrikethrough) GetType() string { - return TypeTextEntityTypeStrikethrough -} - -func (*TextEntityTypeStrikethrough) TextEntityTypeType() string { - return TypeTextEntityTypeStrikethrough -} - -// A spoiler text -type TextEntityTypeSpoiler struct { - meta -} - -func (entity *TextEntityTypeSpoiler) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeSpoiler - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeSpoiler) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeSpoiler) GetType() string { - return TypeTextEntityTypeSpoiler -} - -func (*TextEntityTypeSpoiler) TextEntityTypeType() string { - return TypeTextEntityTypeSpoiler -} - -// Text that must be formatted as if inside a code HTML tag -type TextEntityTypeCode struct { - meta -} - -func (entity *TextEntityTypeCode) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypeCode - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypeCode) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypeCode) GetType() string { - return TypeTextEntityTypeCode -} - -func (*TextEntityTypeCode) TextEntityTypeType() string { - return TypeTextEntityTypeCode -} - -// Text that must be formatted as if inside a pre HTML tag -type TextEntityTypePre struct { - meta -} - -func (entity *TextEntityTypePre) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypePre - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypePre) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypePre) GetType() string { - return TypeTextEntityTypePre -} - -func (*TextEntityTypePre) TextEntityTypeType() string { - return TypeTextEntityTypePre -} - -// Text that must be formatted as if inside pre, and code HTML tags -type TextEntityTypePreCode struct { - meta - // Programming language of the code; as defined by the sender - Language string `json:"language"` -} - -func (entity *TextEntityTypePreCode) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntityTypePreCode - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntityTypePreCode) GetClass() string { - return ClassTextEntityType -} - -func (*TextEntityTypePreCode) GetType() string { - return TypeTextEntityTypePreCode -} - -func (*TextEntityTypePreCode) TextEntityTypeType() string { - return TypeTextEntityTypePreCode -} - -// A text description shown instead of a raw URL -type TextEntityTypeTextUrl struct { - meta - // HTTP or tg:// URL to be opened when the link is clicked - Url string