From 74bc5989565c65881511a25def1bb116e66272b5 Mon Sep 17 00:00:00 2001 From: Aleksandr Zelenin Date: Thu, 6 Sep 2018 00:45:29 +0300 Subject: [PATCH] TDLib 1.3.0 --- Makefile | 2 +- README.md | 11 +- client/function.go | 1428 ++++++++++++++-- client/type.go | 3740 +++++++++++++++++++++++++++++++++++++---- client/unmarshaler.go | 1661 ++++++++++++++++-- data/td_api.json | 2808 ++++++++++++++++++++++++++++--- data/td_api.tl | 739 ++++++-- 7 files changed, 9434 insertions(+), 955 deletions(-) diff --git a/Makefile b/Makefile index 3a0bc91..8a091bf 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -TAG := v1.2.0 +TAG := v1.3.0 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/README.md b/README.md index 983dd5f..e3e3464 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # go-tdlib -Go wrapper for [TDLib (Telegram Database Library)](https://github.com/tdlib/td) with full support of TDLib v1.2.0 +Go wrapper for [TDLib (Telegram Database Library)](https://github.com/tdlib/td) with full support of TDLib v1.3.0 ## TDLib installation @@ -20,6 +20,7 @@ apt-get install -y tdlib-dev ```bash apt-get update -y apt-get install -y \ + bc \ build-essential \ ca-certificates \ ccache \ @@ -29,12 +30,12 @@ apt-get install -y \ libssl-dev \ libreadline-dev \ zlib1g-dev -git clone --depth 1 -b "v1.2.0" "https://github.com/tdlib/td.git" ./tdlib-src +git clone --depth 1 -b "v1.3.0" "https://github.com/tdlib/td.git" ./tdlib-src mkdir ./tdlib-src/build cd ./tdlib-src/build -cmake -j$(getconf _NPROCESSORS_ONLN) -DCMAKE_BUILD_TYPE=Release .. -cmake -j$(getconf _NPROCESSORS_ONLN) --build . -make -j$(getconf _NPROCESSORS_ONLN) install +cmake -j$(echo 'scale=0; ('$(getconf _NPROCESSORS_ONLN)'+1)*3/4' | bc) -DCMAKE_BUILD_TYPE=Release .. +cmake -j$(echo 'scale=0; ('$(getconf _NPROCESSORS_ONLN)'+1)*3/4' | bc) --build . +make -j$(echo 'scale=0; ('$(getconf _NPROCESSORS_ONLN)'+1)*3/4' | bc) install rm -rf ./../../tdlib-src ``` diff --git a/client/function.go b/client/function.go index afa0d60..ff14d6b 100755 --- a/client/function.go +++ b/client/function.go @@ -441,7 +441,7 @@ func (client *Client) SetRecoveryEmailAddress(password string, newRecoveryEmailA } // Requests to send a password recovery code to an email address that was previously set up -func (client *Client) RequestPasswordRecovery() (*PasswordRecoveryInfo, error) { +func (client *Client) RequestPasswordRecovery() (*EmailAddressAuthenticationCodeInfo, error) { result, err := client.Send(Request{ meta: meta{ Type: "requestPasswordRecovery", @@ -456,7 +456,7 @@ func (client *Client) RequestPasswordRecovery() (*PasswordRecoveryInfo, error) { return nil, buildResponseError(result.Data) } - return UnmarshalPasswordRecoveryInfo(result.Data) + return UnmarshalEmailAddressAuthenticationCodeInfo(result.Data) } // Recovers the password using a recovery code sent to an email address that was previously set up @@ -1230,7 +1230,7 @@ func (client *Client) GetGroupsInCommon(userId int32, offsetChatId int64, limit // Returns messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library. This is an offline request if only_local is true // // @param chatId Chat identifier -// @param fromMessageId Identifier of the message starting from which history must be fetched; use 0 to get results from the beginning (i.e., from oldest to newest) +// @param fromMessageId Identifier of the message starting from which history must be fetched; use 0 to get results from the last message // @param offset Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages // @param limit 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. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached // @param onlyLocal If true, returns only messages that are available locally without sending network requests @@ -1288,7 +1288,7 @@ func (client *Client) DeleteChatHistory(chatId int64, removeFromChatList bool) ( // @param chatId Identifier of the chat in which to search messages // @param query Query to search for // @param senderUserId If not 0, only messages sent by the specified user will be returned. Not supported in secret chats -// @param fromMessageId Identifier of the message starting from which history must be fetched; use 0 to get results from the beginning +// @param fromMessageId Identifier of the message starting from which history must be fetched; use 0 to get results from the last message // @param offset Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages // @param limit 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. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached // @param filter Filter for message content in the search results @@ -1321,7 +1321,7 @@ func (client *Client) SearchChatMessages(chatId int64, query string, senderUserI // Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). For optimal performance the number of returned messages is chosen by the library // // @param query Query to search for -// @param offsetDate The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the beginning +// @param offsetDate The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the last message // @param offsetChatId The chat identifier of the last found message, or 0 for the first request // @param offsetMessageId The message identifier of the last found message, or 0 for the first request // @param limit The maximum number of messages to be returned, up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached @@ -1353,7 +1353,7 @@ func (client *Client) SearchMessages(query string, offsetDate int32, offsetChatI // // @param chatId Identifier of the chat in which to search. Specify 0 to search in all secret chats // @param query Query to search for. If empty, searchChatMessages should be used instead -// @param fromSearchId The identifier from the result of a previous request, use 0 to get results from the beginning +// @param fromSearchId The identifier from the result of a previous request, use 0 to get results from the last message // @param limit Maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached // @param filter A filter for the content of messages in the search results func (client *Client) SearchSecretMessages(chatId int64, query string, fromSearchId JsonInt64, limit int32, filter SearchMessagesFilter) (*FoundMessages, error) { @@ -1382,7 +1382,7 @@ func (client *Client) SearchSecretMessages(chatId int64, query string, fromSearc // Searches for call messages. Returns the results in reverse chronological order (i. e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library // -// @param fromMessageId Identifier of the message from which to search; use 0 to get results from the beginning +// @param fromMessageId Identifier of the message from which to search; use 0 to get results from the last message // @param limit The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached // @param onlyMissed If true, returns only messages with missed calls func (client *Client) SearchCallMessages(fromMessageId int64, limit int32, onlyMissed bool) (*Messages, error) { @@ -1476,6 +1476,33 @@ func (client *Client) GetChatMessageByDate(chatId int64, date int32) (*Message, return UnmarshalMessage(result.Data) } +// Returns approximate number of messages of the specified type in the chat +// +// @param chatId Identifier of the chat in which to count messages +// @param filter Filter for message content; searchMessagesFilterEmpty is unsupported in this function +// @param returnLocal If true, returns count that is available locally without sending network requests, returning -1 if the number of messages is unknown +func (client *Client) GetChatMessageCount(chatId int64, filter SearchMessagesFilter, returnLocal bool) (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatMessageCount", + }, + Data: map[string]interface{}{ + "chat_id": chatId, + "filter": filter, + "return_local": returnLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + // Returns a public HTTPS link to a message. Available only for messages in public supergroups and channels // // @param chatId Identifier of the chat to which the message belongs @@ -1708,6 +1735,37 @@ func (client *Client) SendChatScreenshotTakenNotification(chatId int64) (*Ok, er return UnmarshalOk(result.Data) } +// Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message +// +// @param chatId Target chat +// @param senderUserId Identifier of the user who will be shown as the sender of the message; may be 0 for channel posts +// @param replyToMessageId Identifier of the message to reply to or 0 +// @param disableNotification Pass true to disable notification for the message +// @param inputMessageContent The content of the message to be added +func (client *Client) AddLocalMessage(chatId int64, senderUserId int32, replyToMessageId int64, disableNotification bool, inputMessageContent InputMessageContent) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addLocalMessage", + }, + Data: map[string]interface{}{ + "chat_id": chatId, + "sender_user_id": senderUserId, + "reply_to_message_id": replyToMessageId, + "disable_notification": disableNotification, + "input_message_content": inputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + // Deletes messages // // @param chatId Chat identifier @@ -1760,7 +1818,7 @@ func (client *Client) DeleteChatMessagesFromUser(chatId int64, userId int32) (*O return UnmarshalOk(result.Data) } -// Edits the text of a message (or a text of a game message). Non-bot users can edit messages for a limited period of time. Returns the edited message after the edit is completed on the server side +// Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side // // @param chatId The chat the message belongs to // @param messageId Identifier of the message @@ -1789,11 +1847,11 @@ func (client *Client) EditMessageText(chatId int64, messageId int64, replyMarkup return UnmarshalMessage(result.Data) } -// Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed server-side +// Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side // // @param chatId The chat the message belongs to // @param messageId Identifier of the message -// @param replyMarkup Tew message reply markup; for bots only +// @param replyMarkup The new message reply markup; for bots only // @param location New location content of the message; may be null. Pass null to stop sharing the live location func (client *Client) EditMessageLiveLocation(chatId int64, messageId int64, replyMarkup ReplyMarkup, location *Location) (*Message, error) { result, err := client.Send(Request{ @@ -1818,12 +1876,41 @@ func (client *Client) EditMessageLiveLocation(chatId int64, messageId int64, rep return UnmarshalMessage(result.Data) } -// Edits the message content caption. Non-bots can edit messages for a limited period of time. Returns the edited message after the edit is completed server-side +// Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can't be replaced if the message was set to self-destruct. Media can't be replaced by self-destructing media. Media in an album can be edited only to contain a photo or a video. Returns the edited message after the edit is completed on the server side // // @param chatId The chat the message belongs to // @param messageId Identifier of the message // @param replyMarkup The new message reply markup; for bots only -// @param caption New message content caption; 0-200 characters +// @param inputMessageContent New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo +func (client *Client) EditMessageMedia(chatId int64, messageId int64, replyMarkup ReplyMarkup, inputMessageContent InputMessageContent) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editMessageMedia", + }, + Data: map[string]interface{}{ + "chat_id": chatId, + "message_id": messageId, + "reply_markup": replyMarkup, + "input_message_content": inputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + +// Edits the message content caption. Returns the edited message after the edit is completed on the server side +// +// @param chatId The chat the message belongs to +// @param messageId Identifier of the message +// @param replyMarkup The new message reply markup; for bots only +// @param caption New message content caption; 0-GetOption("message_caption_length_max") characters func (client *Client) EditMessageCaption(chatId int64, messageId int64, replyMarkup ReplyMarkup, caption *FormattedText) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1847,11 +1934,11 @@ func (client *Client) EditMessageCaption(chatId int64, messageId int64, replyMar return UnmarshalMessage(result.Data) } -// Edits the message reply markup; for bots only. Returns the edited message after the edit is completed server-side +// Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side // // @param chatId The chat the message belongs to // @param messageId Identifier of the message -// @param replyMarkup New message reply markup +// @param replyMarkup The new message reply markup func (client *Client) EditMessageReplyMarkup(chatId int64, messageId int64, replyMarkup ReplyMarkup) (*Message, error) { result, err := client.Send(Request{ meta: meta{ @@ -1877,7 +1964,7 @@ func (client *Client) EditMessageReplyMarkup(chatId int64, messageId int64, repl // Edits the text of an inline text or game message sent via a bot; for bots only // // @param inlineMessageId Inline message identifier -// @param replyMarkup New message reply markup +// @param replyMarkup The new message reply markup // @param inputMessageContent New text content of the message. Should be of type InputMessageText func (client *Client) EditInlineMessageText(inlineMessageId string, replyMarkup ReplyMarkup, inputMessageContent InputMessageContent) (*Ok, error) { result, err := client.Send(Request{ @@ -1904,7 +1991,7 @@ func (client *Client) EditInlineMessageText(inlineMessageId string, replyMarkup // Edits the content of a live location in an inline message sent via a bot; for bots only // // @param inlineMessageId Inline message identifier -// @param replyMarkup New message reply markup +// @param replyMarkup The new message reply markup // @param location New location content of the message; may be null. Pass null to stop sharing the live location func (client *Client) EditInlineMessageLiveLocation(inlineMessageId string, replyMarkup ReplyMarkup, location *Location) (*Ok, error) { result, err := client.Send(Request{ @@ -1928,11 +2015,38 @@ func (client *Client) EditInlineMessageLiveLocation(inlineMessageId string, repl return UnmarshalOk(result.Data) } +// Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only +// +// @param inlineMessageId Inline message identifier +// @param replyMarkup The new message reply markup; for bots only +// @param inputMessageContent New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo +func (client *Client) EditInlineMessageMedia(inlineMessageId string, replyMarkup ReplyMarkup, inputMessageContent InputMessageContent) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editInlineMessageMedia", + }, + Data: map[string]interface{}{ + "inline_message_id": inlineMessageId, + "reply_markup": replyMarkup, + "input_message_content": inputMessageContent, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Edits the caption of an inline message sent via a bot; for bots only // // @param inlineMessageId Inline message identifier -// @param replyMarkup New message reply markup -// @param caption New message content caption; 0-200 characters +// @param replyMarkup The new message reply markup +// @param caption New message content caption; 0-GetOption("message_caption_length_max") characters func (client *Client) EditInlineMessageCaption(inlineMessageId string, replyMarkup ReplyMarkup, caption *FormattedText) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -1958,7 +2072,7 @@ func (client *Client) EditInlineMessageCaption(inlineMessageId string, replyMark // Edits the reply markup of an inline message sent via a bot; for bots only // // @param inlineMessageId Inline message identifier -// @param replyMarkup New message reply markup +// @param replyMarkup The new message reply markup func (client *Client) EditInlineMessageReplyMarkup(inlineMessageId string, replyMarkup ReplyMarkup) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -2074,6 +2188,70 @@ func (client *Client) GetFileExtension(mimeType string) (*Text, error) { return UnmarshalText(result.Data) } +// Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. This is an offline method. Can be called before authorization. Can be called synchronously +// +// @param fileName File name or path to the file +func (client *Client) CleanFileName(fileName string) (*Text, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "cleanFileName", + }, + Data: map[string]interface{}{ + "file_name": fileName, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +// Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. This is an offline method. Can be called before authorization. Can be called synchronously +// +// @param languagePackDatabasePath Path to the language pack database in which strings are stored +// @param localizationTarget Localization target to which the language pack belongs +// @param languagePackId Language pack identifier +// @param key Language pack key of the string to be returned +func (client *Client) GetLanguagePackString(languagePackDatabasePath string, localizationTarget string, languagePackId string, key string) (LanguagePackStringValue, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getLanguagePackString", + }, + Data: map[string]interface{}{ + "language_pack_database_path": languagePackDatabasePath, + "localization_target": localizationTarget, + "language_pack_id": languagePackId, + "key": key, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeLanguagePackStringValueOrdinary: + return UnmarshalLanguagePackStringValueOrdinary(result.Data) + + case TypeLanguagePackStringValuePluralized: + return UnmarshalLanguagePackStringValuePluralized(result.Data) + + case TypeLanguagePackStringValueDeleted: + return UnmarshalLanguagePackStringValueDeleted(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + // Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires // // @param botUserId The identifier of the target bot @@ -2808,6 +2986,31 @@ func (client *Client) SetChatDraftMessage(chatId int64, draftMessage *DraftMessa return UnmarshalOk(result.Data) } +// Changes the notification settings of a chat +// +// @param chatId Chat identifier +// @param notificationSettings New notification settings for the chat +func (client *Client) SetChatNotificationSettings(chatId int64, notificationSettings *ChatNotificationSettings) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setChatNotificationSettings", + }, + Data: map[string]interface{}{ + "chat_id": chatId, + "notification_settings": notificationSettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Changes the pinned state of a chat. You can pin up to GetOption("pinned_chat_count_max") non-secret chats and the same number of secret chats // // @param chatId Chat identifier @@ -2833,6 +3036,56 @@ func (client *Client) ToggleChatIsPinned(chatId int64, isPinned bool) (*Ok, erro return UnmarshalOk(result.Data) } +// Changes the marked as unread state of a chat +// +// @param chatId Chat identifier +// @param isMarkedAsUnread New value of is_marked_as_unread +func (client *Client) ToggleChatIsMarkedAsUnread(chatId int64, isMarkedAsUnread bool) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatIsMarkedAsUnread", + }, + Data: map[string]interface{}{ + "chat_id": chatId, + "is_marked_as_unread": isMarkedAsUnread, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Changes the value of the default disable_notification parameter, used when a message is sent to a chat +// +// @param chatId Chat identifier +// @param defaultDisableNotification New value of default_disable_notification +func (client *Client) ToggleChatDefaultDisableNotification(chatId int64, defaultDisableNotification bool) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "toggleChatDefaultDisableNotification", + }, + Data: map[string]interface{}{ + "chat_id": chatId, + "default_disable_notification": defaultDisableNotification, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Changes client data associated with a chat // // @param chatId Chat identifier @@ -2858,6 +3111,52 @@ func (client *Client) SetChatClientData(chatId int64, clientData string) (*Ok, e return UnmarshalOk(result.Data) } +// Adds current user as a new member to a chat. Private and secret chats can't be joined using this method +// +// @param chatId Chat identifier +func (client *Client) JoinChat(chatId int64) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "joinChat", + }, + Data: map[string]interface{}{ + "chat_id": chatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Removes current user from chat members. Private and secret chats can't be left using this method +// +// @param chatId Chat identifier +func (client *Client) LeaveChat(chatId int64) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "leaveChat", + }, + Data: map[string]interface{}{ + "chat_id": chatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Adds a new member to a chat. Members can't be added to private or secret chats. Members will not be added until the chat state has been synchronized with the server // // @param chatId Chat identifier @@ -2967,7 +3266,8 @@ func (client *Client) GetChatMember(chatId int64, userId int32) (*ChatMember, er // @param chatId Chat identifier // @param query Query to search for // @param limit The maximum number of users to be returned -func (client *Client) SearchChatMembers(chatId int64, query string, limit int32) (*ChatMembers, error) { +// @param filter The type of users to return. By default, chatMembersFilterMembers +func (client *Client) SearchChatMembers(chatId int64, query string, limit int32, filter ChatMembersFilter) (*ChatMembers, error) { result, err := client.Send(Request{ meta: meta{ Type: "searchChatMembers", @@ -2976,6 +3276,7 @@ func (client *Client) SearchChatMembers(chatId int64, query string, limit int32) "chat_id": chatId, "query": query, "limit": limit, + "filter": filter, }, }) if err != nil { @@ -3012,6 +3313,96 @@ func (client *Client) GetChatAdministrators(chatId int64) (*Users, error) { return UnmarshalUsers(result.Data) } +// Clears draft messages in all chats +// +// @param excludeSecretChats If true, local draft messages in secret chats will not be cleared +func (client *Client) ClearAllDraftMessages(excludeSecretChats bool) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "clearAllDraftMessages", + }, + Data: map[string]interface{}{ + "exclude_secret_chats": excludeSecretChats, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns the notification settings for chats of a given type +// +// @param scope Types of chats for which to return the notification settings information +func (client *Client) GetScopeNotificationSettings(scope NotificationSettingsScope) (*ScopeNotificationSettings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getScopeNotificationSettings", + }, + Data: map[string]interface{}{ + "scope": scope, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalScopeNotificationSettings(result.Data) +} + +// Changes notification settings for chats of a given type +// +// @param scope Types of chats for which to change the notification settings +// @param notificationSettings The new notification settings for the given scope +func (client *Client) SetScopeNotificationSettings(scope NotificationSettingsScope, notificationSettings *ScopeNotificationSettings) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setScopeNotificationSettings", + }, + Data: map[string]interface{}{ + "scope": scope, + "notification_settings": notificationSettings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Resets all notification settings to their default values. By default, all chats are unmuted, the sound is set to "default" and message previews are shown +func (client *Client) ResetAllNotificationSettings() (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resetAllNotificationSettings", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Changes the order of pinned chats // // @param chatIds The new list of pinned chats @@ -3483,7 +3874,7 @@ func (client *Client) GetBlockedUsers(offset int32, limit int32) (*Users, error) // Adds new contacts or edits existing contacts; contacts' user identifiers are ignored // -// @param contacts The list of contacts to import or edit +// @param contacts The list of contacts to import or edit, contact's vCard are ignored and are not imported func (client *Client) ImportContacts(contacts []*Contact) (*ImportedContacts, error) { result, err := client.Send(Request{ meta: meta{ @@ -3504,6 +3895,25 @@ func (client *Client) ImportContacts(contacts []*Contact) (*ImportedContacts, er return UnmarshalImportedContacts(result.Data) } +// Returns all user contacts +func (client *Client) GetContacts() (*Users, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getContacts", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUsers(result.Data) +} + // Searches for the specified query in the first names, last names and usernames of the known user contacts // // @param query Query to search for; can be empty to return all contacts @@ -3573,7 +3983,7 @@ func (client *Client) GetImportedContactCount() (*Count, error) { // Changes imported contacts using the list of current user contacts saved on the device. Imports newly added contacts and, if at least the file database is enabled, deletes recently deleted contacts. Query result depends on the result of the previous query, so only one query is possible at the same time // -// @param contacts The new list of contacts +// @param contacts The new list of contacts, contact's vCard are ignored and are not imported func (client *Client) ChangeImportedContacts(contacts []*Contact) (*ImportedContacts, error) { result, err := client.Send(Request{ meta: meta{ @@ -3594,7 +4004,7 @@ func (client *Client) ChangeImportedContacts(contacts []*Contact) (*ImportedCont return UnmarshalImportedContacts(result.Data) } -// Clears all imported contacts +// Clears all imported contacts, contacts list remains unchanged func (client *Client) ClearImportedContacts() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4317,73 +4727,6 @@ func (client *Client) GetWebPageInstantView(url string, forceFull bool) (*WebPag return UnmarshalWebPageInstantView(result.Data) } -// Returns the notification settings for a given scope -// -// @param scope Scope for which to return the notification settings information -func (client *Client) GetNotificationSettings(scope NotificationSettingsScope) (*NotificationSettings, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "getNotificationSettings", - }, - Data: map[string]interface{}{ - "scope": scope, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalNotificationSettings(result.Data) -} - -// Changes notification settings for a given scope -// -// @param scope Scope for which to change the notification settings -// @param notificationSettings The new notification settings for the given scope -func (client *Client) SetNotificationSettings(scope NotificationSettingsScope, notificationSettings *NotificationSettings) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "setNotificationSettings", - }, - Data: map[string]interface{}{ - "scope": scope, - "notification_settings": notificationSettings, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - -// Resets all notification settings to their default values. By default, the only muted chats are supergroups, the sound is set to "default" and message previews are shown -func (client *Client) ResetAllNotificationSettings() (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "resetAllNotificationSettings", - }, - Data: map[string]interface{}{}, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - // Uploads a new profile photo for the current user. If something changes, updateUser will be sent // // @param photo Profile photo to set. inputFileId and inputFileRemote may still be unsupported @@ -4917,7 +5260,7 @@ func (client *Client) UnpinSupergroupMessage(supergroupId int32) (*Ok, error) { return UnmarshalOk(result.Data) } -// Reports some messages from a user in a supergroup as spam +// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup // // @param supergroupId Supergroup identifier // @param userId User identifier @@ -5257,6 +5600,150 @@ func (client *Client) GetWallpapers() (*Wallpapers, error) { return UnmarshalWallpapers(result.Data) } +// Returns information about the current localization target. This is an offline request if only_local is true +// +// @param onlyLocal If true, returns only locally available information without sending network requests +func (client *Client) GetLocalizationTargetInfo(onlyLocal bool) (*LocalizationTargetInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLocalizationTargetInfo", + }, + Data: map[string]interface{}{ + "only_local": onlyLocal, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLocalizationTargetInfo(result.Data) +} + +// Returns strings from a language pack in the current localization target by their keys +// +// @param languagePackId Language pack identifier of the strings to be returned +// @param keys Language pack keys of the strings to be returned; leave empty to request all available strings +func (client *Client) GetLanguagePackStrings(languagePackId string, keys []string) (*LanguagePackStrings, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLanguagePackStrings", + }, + Data: map[string]interface{}{ + "language_pack_id": languagePackId, + "keys": keys, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLanguagePackStrings(result.Data) +} + +// Adds or changes a custom language pack to the current localization target +// +// @param info 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 +// @param strings Strings of the new language pack +func (client *Client) SetCustomLanguagePack(info *LanguagePackInfo, strings []*LanguagePackString) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setCustomLanguagePack", + }, + Data: map[string]interface{}{ + "info": info, + "strings": strings, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Edits information about a custom language pack in the current localization target +// +// @param info New information about the custom language pack +func (client *Client) EditCustomLanguagePackInfo(info *LanguagePackInfo) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editCustomLanguagePackInfo", + }, + Data: map[string]interface{}{ + "info": info, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Adds, edits or deletes a string in a custom language pack +// +// @param languagePackId Identifier of a previously added custom language pack in the current localization target +// @param newString New language pack string +func (client *Client) SetCustomLanguagePackString(languagePackId string, newString *LanguagePackString) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setCustomLanguagePackString", + }, + Data: map[string]interface{}{ + "language_pack_id": languagePackId, + "new_string": newString, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Deletes all information about a language pack in the current localization target. The language pack that is currently in use can't be deleted +// +// @param languagePackId Identifier of the language pack to delete +func (client *Client) DeleteLanguagePack(languagePackId string) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deleteLanguagePack", + }, + Data: map[string]interface{}{ + "language_pack_id": languagePackId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Registers the currently used device for receiving push notifications // // @param deviceToken Device token @@ -5458,7 +5945,7 @@ func (client *Client) GetAccountTtl() (*AccountTtl, error) { return UnmarshalAccountTtl(result.Data) } -// Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account +// Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account. Can be called before authorization when the current authorization state is authorizationStateWaitPassword // // @param reason The reason why the account was deleted; optional func (client *Client) DeleteAccount(reason string) (*Ok, error) { @@ -5723,6 +6210,495 @@ func (client *Client) ResetNetworkStatistics() (*Ok, error) { return UnmarshalOk(result.Data) } +// Returns one of the available Telegram Passport elements +// +// @param typeParam Telegram Passport element type +// @param password Password of the current user +func (client *Client) GetPassportElement(typeParam PassportElementType, password string) (PassportElement, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPassportElement", + }, + Data: map[string]interface{}{ + "type": typeParam, + "password": password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(result.Data) + + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(result.Data) + + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(result.Data) + + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(result.Data) + + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(result.Data) + + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(result.Data) + + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(result.Data) + + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(result.Data) + + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(result.Data) + + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(result.Data) + + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(result.Data) + + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(result.Data) + + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +// Returns all available Telegram Passport elements +// +// @param password Password of the current user +func (client *Client) GetAllPassportElements(password string) (*PassportElements, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getAllPassportElements", + }, + Data: map[string]interface{}{ + "password": password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPassportElements(result.Data) +} + +// Adds an element to the user's Telegram Passport. May return an error with a message "PHONE_VERIFICATION_NEEDED" or "EMAIL_VERIFICATION_NEEDED" if the chosen phone number or the chosen email address must be verified first +// +// @param element Input Telegram Passport element +// @param password Password of the current user +func (client *Client) SetPassportElement(element InputPassportElement, password string) (PassportElement, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPassportElement", + }, + Data: map[string]interface{}{ + "element": element, + "password": password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(result.Data) + + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(result.Data) + + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(result.Data) + + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(result.Data) + + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(result.Data) + + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(result.Data) + + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(result.Data) + + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(result.Data) + + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(result.Data) + + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(result.Data) + + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(result.Data) + + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(result.Data) + + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +// Deletes a Telegram Passport element +// +// @param typeParam Element type +func (client *Client) DeletePassportElement(typeParam PassportElementType) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "deletePassportElement", + }, + Data: map[string]interface{}{ + "type": typeParam, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Informs the user that some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed +// +// @param userId User identifier +// @param errors The errors +func (client *Client) SetPassportElementErrors(userId int32, errors []*InputPassportElementError) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPassportElementErrors", + }, + Data: map[string]interface{}{ + "user_id": userId, + "errors": errors, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns an IETF language tag of the language preferred in the country, which should be used to fill native fields in Telegram Passport personal details. Returns a 404 error if unknown +// +// @param countryCode A two-letter ISO 3166-1 alpha-2 country code +func (client *Client) GetPreferredCountryLanguage(countryCode string) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPreferredCountryLanguage", + }, + Data: map[string]interface{}{ + "country_code": countryCode, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +// Sends a code to verify a phone number to be added to a user's Telegram Passport +// +// @param phoneNumber The phone number of the user, in international format +// @param allowFlashCall Pass true if the authentication code may be sent via flash call to the specified phone number +// @param isCurrentPhoneNumber Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false +func (client *Client) SendPhoneNumberVerificationCode(phoneNumber string, allowFlashCall bool, isCurrentPhoneNumber bool) (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendPhoneNumberVerificationCode", + }, + Data: map[string]interface{}{ + "phone_number": phoneNumber, + "allow_flash_call": allowFlashCall, + "is_current_phone_number": isCurrentPhoneNumber, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAuthenticationCodeInfo(result.Data) +} + +// Re-sends the code to verify a phone number to be added to a user's Telegram Passport +func (client *Client) ResendPhoneNumberVerificationCode() (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendPhoneNumberVerificationCode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAuthenticationCodeInfo(result.Data) +} + +// Checks the phone number verification code for Telegram Passport +// +// @param code Verification code +func (client *Client) CheckPhoneNumberVerificationCode(code string) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkPhoneNumberVerificationCode", + }, + Data: map[string]interface{}{ + "code": code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Sends a code to verify an email address to be added to a user's Telegram Passport +// +// @param emailAddress Email address +func (client *Client) SendEmailAddressVerificationCode(emailAddress string) (*EmailAddressAuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendEmailAddressVerificationCode", + }, + Data: map[string]interface{}{ + "email_address": emailAddress, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmailAddressAuthenticationCodeInfo(result.Data) +} + +// Re-sends the code to verify an email address to be added to a user's Telegram Passport +func (client *Client) ResendEmailAddressVerificationCode() (*EmailAddressAuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendEmailAddressVerificationCode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalEmailAddressAuthenticationCodeInfo(result.Data) +} + +// Checks the email address verification code for Telegram Passport +// +// @param code Verification code +func (client *Client) CheckEmailAddressVerificationCode(code string) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkEmailAddressVerificationCode", + }, + Data: map[string]interface{}{ + "code": code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns a Telegram Passport authorization form for sharing data with a service +// +// @param botUserId User identifier of the service's bot +// @param scope Telegram Passport element types requested by the service +// @param publicKey Service's public_key +// @param nonce Authorization form nonce provided by the service +// @param password Password of the current user +func (client *Client) GetPassportAuthorizationForm(botUserId int32, scope string, publicKey string, nonce string, password string) (*PassportAuthorizationForm, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPassportAuthorizationForm", + }, + Data: map[string]interface{}{ + "bot_user_id": botUserId, + "scope": scope, + "public_key": publicKey, + "nonce": nonce, + "password": password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPassportAuthorizationForm(result.Data) +} + +// Sends a Telegram Passport authorization form, effectively sharing data with the service +// +// @param autorizationFormId Authorization form identifier +// @param types Types of Telegram Passport elements chosen by user to complete the authorization form +func (client *Client) SendPassportAuthorizationForm(autorizationFormId int32, types []PassportElementType) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendPassportAuthorizationForm", + }, + Data: map[string]interface{}{ + "autorization_form_id": autorizationFormId, + "types": types, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Sends phone number confirmation code. Should be called when user presses "https://t.me/confirmphone?phone=*******&hash=**********" or "tg://confirmphone?phone=*******&hash=**********" link +// +// @param hash Value of the "hash" parameter from the link +// @param phoneNumber Value of the "phone" parameter from the link +// @param allowFlashCall Pass true if the authentication code may be sent via flash call to the specified phone number +// @param isCurrentPhoneNumber Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false +func (client *Client) SendPhoneNumberConfirmationCode(hash string, phoneNumber string, allowFlashCall bool, isCurrentPhoneNumber bool) (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "sendPhoneNumberConfirmationCode", + }, + Data: map[string]interface{}{ + "hash": hash, + "phone_number": phoneNumber, + "allow_flash_call": allowFlashCall, + "is_current_phone_number": isCurrentPhoneNumber, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAuthenticationCodeInfo(result.Data) +} + +// Resends phone number confirmation code +func (client *Client) ResendPhoneNumberConfirmationCode() (*AuthenticationCodeInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendPhoneNumberConfirmationCode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalAuthenticationCodeInfo(result.Data) +} + +// Checks phone number confirmation code +// +// @param code The phone number confirmation code +func (client *Client) CheckPhoneNumberConfirmationCode(code string) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkPhoneNumberConfirmationCode", + }, + Data: map[string]interface{}{ + "code": code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only // // @param pendingUpdateCount The number of pending updates @@ -5879,6 +6855,62 @@ func (client *Client) RemoveStickerFromSet(sticker InputFile) (*Ok, error) { return UnmarshalOk(result.Data) } +// Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded +// +// @param location Location of the map center +// @param zoom Map zoom level; 13-20 +// @param width Map width in pixels before applying scale; 16-1024 +// @param height Map height in pixels before applying scale; 16-1024 +// @param scale Map scale; 1-3 +// @param chatId Identifier of a chat, in which the thumbnail will be shown. Use 0 if unknown +func (client *Client) GetMapThumbnailFile(location *Location, zoom int32, width int32, height int32, scale int32, chatId int64) (*File, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMapThumbnailFile", + }, + Data: map[string]interface{}{ + "location": location, + "zoom": zoom, + "width": width, + "height": height, + "scale": scale, + "chat_id": chatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFile(result.Data) +} + +// Accepts Telegram terms of services +// +// @param termsOfServiceId Terms of service identifier +func (client *Client) AcceptTermsOfService(termsOfServiceId string) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "acceptTermsOfService", + }, + Data: map[string]interface{}{ + "terms_of_service_id": termsOfServiceId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + // Sends a custom request; for bots only // // @param method The method name @@ -5929,7 +6961,7 @@ func (client *Client) AnswerCustomQuery(customQueryId JsonInt64, data string) (* return UnmarshalOk(result.Data) } -// Succeeds after a specified amount of time has passed. Can be called before authorization +// Succeeds after a specified amount of time has passed. Can be called before authorization. Can be called before initialization // // @param seconds Number of seconds before the function returns func (client *Client) SetAlarm(seconds float64) (*Ok, error) { @@ -5990,13 +7022,17 @@ func (client *Client) GetInviteText() (*Text, error) { return UnmarshalText(result.Data) } -// Returns the terms of service. Can be called before authorization -func (client *Client) GetTermsOfService() (*Text, error) { +// Returns information about a tg:// deep link. Use "tg://need_update_for_some_feature" or "tg:some_unsupported_feature" for testing. Returns a 404 error for unknown links. Can be called before authorization +// +// @param link The link +func (client *Client) GetDeepLinkInfo(link string) (*DeepLinkInfo, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getTermsOfService", + Type: "getDeepLinkInfo", + }, + Data: map[string]interface{}{ + "link": link, }, - Data: map[string]interface{}{}, }) if err != nil { return nil, err @@ -6006,19 +7042,79 @@ func (client *Client) GetTermsOfService() (*Text, error) { return nil, buildResponseError(result.Data) } - return UnmarshalText(result.Data) + return UnmarshalDeepLinkInfo(result.Data) } -// Sets the proxy server for network requests. Can be called before authorization +// Adds a proxy server for network requests. Can be called before authorization // -// @param proxy Proxy server to use. Specify null to remove the proxy server -func (client *Client) SetProxy(proxy Proxy) (*Ok, error) { +// @param server Proxy server IP address +// @param port Proxy server port +// @param enable True, if the proxy should be enabled +// @param typeParam Proxy type +func (client *Client) AddProxy(server string, port int32, enable bool, typeParam ProxyType) (*Proxy, error) { result, err := client.Send(Request{ meta: meta{ - Type: "setProxy", + Type: "addProxy", }, Data: map[string]interface{}{ - "proxy": proxy, + "server": server, + "port": port, + "enable": enable, + "type": typeParam, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalProxy(result.Data) +} + +// Edits an existing proxy server for network requests. Can be called before authorization +// +// @param proxyId Proxy identifier +// @param server Proxy server IP address +// @param port Proxy server port +// @param enable True, if the proxy should be enabled +// @param typeParam Proxy type +func (client *Client) EditProxy(proxyId int32, server string, port int32, enable bool, typeParam ProxyType) (*Proxy, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "editProxy", + }, + Data: map[string]interface{}{ + "proxy_id": proxyId, + "server": server, + "port": port, + "enable": enable, + "type": typeParam, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalProxy(result.Data) +} + +// Enables a proxy. Only one proxy can be enabled at a time. Can be called before authorization +// +// @param proxyId Proxy identifier +func (client *Client) EnableProxy(proxyId int32) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "enableProxy", + }, + Data: map[string]interface{}{ + "proxy_id": proxyId, }, }) if err != nil { @@ -6032,11 +7128,11 @@ func (client *Client) SetProxy(proxy Proxy) (*Ok, error) { return UnmarshalOk(result.Data) } -// Returns the proxy that is currently set up. Can be called before authorization -func (client *Client) GetProxy() (Proxy, error) { +// Disables the currently enabled proxy. Can be called before authorization +func (client *Client) DisableProxy() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ - Type: "getProxy", + Type: "disableProxy", }, Data: map[string]interface{}{}, }) @@ -6048,16 +7144,95 @@ func (client *Client) GetProxy() (Proxy, error) { return nil, buildResponseError(result.Data) } - switch result.Type { - case TypeProxyEmpty: - return UnmarshalProxyEmpty(result.Data) + return UnmarshalOk(result.Data) +} - case TypeProxySocks5: - return UnmarshalProxySocks5(result.Data) +// Removes a proxy server. Can be called before authorization +// +// @param proxyId Proxy identifier +func (client *Client) RemoveProxy(proxyId int32) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeProxy", + }, + Data: map[string]interface{}{ + "proxy_id": proxyId, + }, + }) + if err != nil { + return nil, err + } - default: - return nil, errors.New("invalid type") - } + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns list of proxies that are currently set up. Can be called before authorization +func (client *Client) GetProxies() (*Proxies, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getProxies", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalProxies(result.Data) +} + +// Returns an HTTPS link, which can be used to add a proxy. Available only for SOCKS5 and MTProto proxies. Can be called before authorization +// +// @param proxyId Proxy identifier +func (client *Client) GetProxyLink(proxyId int32) (*Text, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getProxyLink", + }, + Data: map[string]interface{}{ + "proxy_id": proxyId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +// Computes time needed to receive a response from a Telegram server through a proxy. Can be called before authorization +// +// @param proxyId Proxy identifier. Use 0 to ping a Telegram server without a proxy +func (client *Client) PingProxy(proxyId int32) (*Seconds, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "pingProxy", + }, + Data: map[string]interface{}{ + "proxy_id": proxyId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalSeconds(result.Data) } // Does nothing; for testing only @@ -6343,6 +7518,15 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatIsPinned: return UnmarshalUpdateChatIsPinned(result.Data) + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(result.Data) + + case TypeUpdateChatIsSponsored: + return UnmarshalUpdateChatIsSponsored(result.Data) + + case TypeUpdateChatDefaultDisableNotification: + return UnmarshalUpdateChatDefaultDisableNotification(result.Data) + case TypeUpdateChatReadInbox: return UnmarshalUpdateChatReadInbox(result.Data) @@ -6352,8 +7536,11 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateChatUnreadMentionCount: return UnmarshalUpdateChatUnreadMentionCount(result.Data) - case TypeUpdateNotificationSettings: - return UnmarshalUpdateNotificationSettings(result.Data) + case TypeUpdateChatNotificationSettings: + return UnmarshalUpdateChatNotificationSettings(result.Data) + + case TypeUpdateScopeNotificationSettings: + return UnmarshalUpdateScopeNotificationSettings(result.Data) case TypeUpdateChatReplyMarkup: return UnmarshalUpdateChatReplyMarkup(result.Data) @@ -6412,6 +7599,9 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateUnreadMessageCount: return UnmarshalUpdateUnreadMessageCount(result.Data) + case TypeUpdateUnreadChatCount: + return UnmarshalUpdateUnreadChatCount(result.Data) + case TypeUpdateOption: return UnmarshalUpdateOption(result.Data) @@ -6430,9 +7620,15 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateSavedAnimations: return UnmarshalUpdateSavedAnimations(result.Data) + case TypeUpdateLanguagePackStrings: + return UnmarshalUpdateLanguagePackStrings(result.Data) + case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(result.Data) + case TypeUpdateTermsOfService: + return UnmarshalUpdateTermsOfService(result.Data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(result.Data) diff --git a/client/type.go b/client/type.go index d3550aa..9bbf15c 100755 --- a/client/type.go +++ b/client/type.go @@ -14,6 +14,7 @@ const ( ClassLinkState = "LinkState" ClassUserType = "UserType" ClassChatMemberStatus = "ChatMemberStatus" + ClassChatMembersFilter = "ChatMembersFilter" ClassSupergroupMembersFilter = "SupergroupMembersFilter" ClassSecretChatState = "SecretChatState" ClassMessageForwardInfo = "MessageForwardInfo" @@ -26,6 +27,11 @@ const ( ClassRichText = "RichText" ClassPageBlock = "PageBlock" ClassInputCredentials = "InputCredentials" + ClassPassportElementType = "PassportElementType" + ClassPassportElement = "PassportElement" + ClassInputPassportElement = "InputPassportElement" + ClassPassportElementErrorSource = "PassportElementErrorSource" + ClassInputPassportElementErrorSource = "InputPassportElementErrorSource" ClassMessageContent = "MessageContent" ClassTextEntityType = "TextEntityType" ClassInputMessageContent = "InputMessageContent" @@ -38,6 +44,7 @@ const ( ClassInlineQueryResult = "InlineQueryResult" ClassCallbackQueryPayload = "CallbackQueryPayload" ClassChatEventAction = "ChatEventAction" + ClassLanguagePackStringValue = "LanguagePackStringValue" ClassDeviceToken = "DeviceToken" ClassCheckChatUsernameResult = "CheckChatUsernameResult" ClassOptionValue = "OptionValue" @@ -51,14 +58,18 @@ const ( ClassTopChatCategory = "TopChatCategory" ClassTMeUrlType = "TMeUrlType" ClassTextParseMode = "TextParseMode" - ClassProxy = "Proxy" + ClassProxyType = "ProxyType" ClassUpdate = "Update" ClassError = "Error" ClassOk = "Ok" ClassTdlibParameters = "TdlibParameters" ClassAuthenticationCodeInfo = "AuthenticationCodeInfo" + ClassEmailAddressAuthenticationCodeInfo = "EmailAddressAuthenticationCodeInfo" + ClassTextEntity = "TextEntity" + ClassTextEntities = "TextEntities" + ClassFormattedText = "FormattedText" + ClassTermsOfService = "TermsOfService" ClassPasswordState = "PasswordState" - ClassPasswordRecoveryInfo = "PasswordRecoveryInfo" ClassRecoveryEmailAddress = "RecoveryEmailAddress" ClassTemporaryPasswordState = "TemporaryPasswordState" ClassLocalFile = "LocalFile" @@ -66,9 +77,6 @@ const ( ClassFile = "File" ClassPhotoSize = "PhotoSize" ClassMaskPosition = "MaskPosition" - ClassTextEntity = "TextEntity" - ClassTextEntities = "TextEntities" - ClassFormattedText = "FormattedText" ClassAnimation = "Animation" ClassAudio = "Audio" ClassDocument = "Document" @@ -99,7 +107,8 @@ const ( ClassMessage = "Message" ClassMessages = "Messages" ClassFoundMessages = "FoundMessages" - ClassNotificationSettings = "NotificationSettings" + ClassChatNotificationSettings = "ChatNotificationSettings" + ClassScopeNotificationSettings = "ScopeNotificationSettings" ClassDraftMessage = "DraftMessage" ClassChat = "Chat" ClassChats = "Chats" @@ -109,9 +118,9 @@ const ( ClassInlineKeyboardButton = "InlineKeyboardButton" ClassWebPageInstantView = "WebPageInstantView" ClassWebPage = "WebPage" + ClassAddress = "Address" ClassLabeledPricePart = "LabeledPricePart" ClassInvoice = "Invoice" - ClassShippingAddress = "ShippingAddress" ClassOrderInfo = "OrderInfo" ClassShippingOption = "ShippingOption" ClassSavedCredentials = "SavedCredentials" @@ -120,6 +129,21 @@ const ( 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" + ClassEncryptedCredentials = "EncryptedCredentials" + ClassEncryptedPassportElement = "EncryptedPassportElement" + ClassInputPassportElementError = "InputPassportElementError" ClassInputThumbnail = "InputThumbnail" ClassStickers = "Stickers" ClassStickerEmojis = "StickerEmojis" @@ -140,6 +164,10 @@ const ( ClassChatEvent = "ChatEvent" ClassChatEvents = "ChatEvents" ClassChatEventLogFilters = "ChatEventLogFilters" + ClassLanguagePackString = "LanguagePackString" + ClassLanguagePackStrings = "LanguagePackStrings" + ClassLanguagePackInfo = "LanguagePackInfo" + ClassLocalizationTargetInfo = "LocalizationTargetInfo" ClassWallpaper = "Wallpaper" ClassWallpapers = "Wallpapers" ClassHashtags = "Hashtags" @@ -160,6 +188,10 @@ const ( ClassTMeUrls = "TMeUrls" ClassCount = "Count" ClassText = "Text" + ClassSeconds = "Seconds" + ClassDeepLinkInfo = "DeepLinkInfo" + ClassProxy = "Proxy" + ClassProxies = "Proxies" ClassInputSticker = "InputSticker" ClassTestInt = "TestInt" ClassTestString = "TestString" @@ -179,6 +211,11 @@ const ( TypeAuthenticationCodeTypeCall = "authenticationCodeTypeCall" TypeAuthenticationCodeTypeFlashCall = "authenticationCodeTypeFlashCall" TypeAuthenticationCodeInfo = "authenticationCodeInfo" + TypeEmailAddressAuthenticationCodeInfo = "emailAddressAuthenticationCodeInfo" + TypeTextEntity = "textEntity" + TypeTextEntities = "textEntities" + TypeFormattedText = "formattedText" + TypeTermsOfService = "termsOfService" TypeAuthorizationStateWaitTdlibParameters = "authorizationStateWaitTdlibParameters" TypeAuthorizationStateWaitEncryptionKey = "authorizationStateWaitEncryptionKey" TypeAuthorizationStateWaitPhoneNumber = "authorizationStateWaitPhoneNumber" @@ -189,7 +226,6 @@ const ( TypeAuthorizationStateClosing = "authorizationStateClosing" TypeAuthorizationStateClosed = "authorizationStateClosed" TypePasswordState = "passwordState" - TypePasswordRecoveryInfo = "passwordRecoveryInfo" TypeRecoveryEmailAddress = "recoveryEmailAddress" TypeTemporaryPasswordState = "temporaryPasswordState" TypeLocalFile = "localFile" @@ -205,9 +241,6 @@ const ( TypeMaskPointMouth = "maskPointMouth" TypeMaskPointChin = "maskPointChin" TypeMaskPosition = "maskPosition" - TypeTextEntity = "textEntity" - TypeTextEntities = "textEntities" - TypeFormattedText = "formattedText" TypeAnimation = "animation" TypeAudio = "audio" TypeDocument = "document" @@ -243,6 +276,11 @@ const ( TypeChatMemberStatusBanned = "chatMemberStatusBanned" TypeChatMember = "chatMember" TypeChatMembers = "chatMembers" + TypeChatMembersFilterAdministrators = "chatMembersFilterAdministrators" + TypeChatMembersFilterMembers = "chatMembersFilterMembers" + TypeChatMembersFilterRestricted = "chatMembersFilterRestricted" + TypeChatMembersFilterBanned = "chatMembersFilterBanned" + TypeChatMembersFilterBots = "chatMembersFilterBots" TypeSupergroupMembersFilterRecent = "supergroupMembersFilterRecent" TypeSupergroupMembersFilterAdministrators = "supergroupMembersFilterAdministrators" TypeSupergroupMembersFilterSearch = "supergroupMembersFilterSearch" @@ -264,11 +302,10 @@ const ( TypeMessage = "message" TypeMessages = "messages" TypeFoundMessages = "foundMessages" - TypeNotificationSettingsScopeChat = "notificationSettingsScopeChat" TypeNotificationSettingsScopePrivateChats = "notificationSettingsScopePrivateChats" - TypeNotificationSettingsScopeBasicGroupChats = "notificationSettingsScopeBasicGroupChats" - TypeNotificationSettingsScopeAllChats = "notificationSettingsScopeAllChats" - TypeNotificationSettings = "notificationSettings" + TypeNotificationSettingsScopeGroupChats = "notificationSettingsScopeGroupChats" + TypeChatNotificationSettings = "chatNotificationSettings" + TypeScopeNotificationSettings = "scopeNotificationSettings" TypeDraftMessage = "draftMessage" TypeChatTypePrivate = "chatTypePrivate" TypeChatTypeBasicGroup = "chatTypeBasicGroup" @@ -326,9 +363,9 @@ const ( TypePageBlockChatLink = "pageBlockChatLink" TypeWebPageInstantView = "webPageInstantView" TypeWebPage = "webPage" + TypeAddress = "address" TypeLabeledPricePart = "labeledPricePart" TypeInvoice = "invoice" - TypeShippingAddress = "shippingAddress" TypeOrderInfo = "orderInfo" TypeShippingOption = "shippingOption" TypeSavedCredentials = "savedCredentials" @@ -341,6 +378,78 @@ const ( TypeValidatedOrderInfo = "validatedOrderInfo" TypePaymentResult = "paymentResult" TypePaymentReceipt = "paymentReceipt" + 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" + 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" @@ -377,6 +486,8 @@ const ( TypeMessagePaymentSuccessfulBot = "messagePaymentSuccessfulBot" TypeMessageContactRegistered = "messageContactRegistered" TypeMessageWebsiteConnected = "messageWebsiteConnected" + TypeMessagePassportDataSent = "messagePassportDataSent" + TypeMessagePassportDataReceived = "messagePassportDataReceived" TypeMessageUnsupported = "messageUnsupported" TypeTextEntityTypeMention = "textEntityTypeMention" TypeTextEntityTypeHashtag = "textEntityTypeHashtag" @@ -517,6 +628,13 @@ const ( TypeChatEvent = "chatEvent" TypeChatEvents = "chatEvents" TypeChatEventLogFilters = "chatEventLogFilters" + TypeLanguagePackStringValueOrdinary = "languagePackStringValueOrdinary" + TypeLanguagePackStringValuePluralized = "languagePackStringValuePluralized" + TypeLanguagePackStringValueDeleted = "languagePackStringValueDeleted" + TypeLanguagePackString = "languagePackString" + TypeLanguagePackStrings = "languagePackStrings" + TypeLanguagePackInfo = "languagePackInfo" + TypeLocalizationTargetInfo = "localizationTargetInfo" TypeDeviceTokenGoogleCloudMessaging = "deviceTokenGoogleCloudMessaging" TypeDeviceTokenApplePush = "deviceTokenApplePush" TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" @@ -559,6 +677,7 @@ const ( TypeChatReportReasonSpam = "chatReportReasonSpam" TypeChatReportReasonViolence = "chatReportReasonViolence" TypeChatReportReasonPornography = "chatReportReasonPornography" + TypeChatReportReasonCopyright = "chatReportReasonCopyright" TypeChatReportReasonCustom = "chatReportReasonCustom" TypePublicMessageLink = "publicMessageLink" TypeFileTypeNone = "fileTypeNone" @@ -568,6 +687,8 @@ const ( TypeFileTypePhoto = "fileTypePhoto" TypeFileTypeProfilePhoto = "fileTypeProfilePhoto" TypeFileTypeSecret = "fileTypeSecret" + TypeFileTypeSecretThumbnail = "fileTypeSecretThumbnail" + TypeFileTypeSecure = "fileTypeSecure" TypeFileTypeSticker = "fileTypeSticker" TypeFileTypeThumbnail = "fileTypeThumbnail" TypeFileTypeUnknown = "fileTypeUnknown" @@ -575,7 +696,6 @@ const ( TypeFileTypeVideoNote = "fileTypeVideoNote" TypeFileTypeVoiceNote = "fileTypeVoiceNote" TypeFileTypeWallpaper = "fileTypeWallpaper" - TypeFileTypeSecretThumbnail = "fileTypeSecretThumbnail" TypeStorageStatisticsByFileType = "storageStatisticsByFileType" TypeStorageStatisticsByChat = "storageStatisticsByChat" TypeStorageStatistics = "storageStatistics" @@ -607,10 +727,15 @@ const ( TypeTMeUrls = "tMeUrls" TypeCount = "count" TypeText = "text" + TypeSeconds = "seconds" + TypeDeepLinkInfo = "deepLinkInfo" TypeTextParseModeMarkdown = "textParseModeMarkdown" TypeTextParseModeHTML = "textParseModeHTML" - TypeProxyEmpty = "proxyEmpty" - TypeProxySocks5 = "proxySocks5" + TypeProxyTypeSocks5 = "proxyTypeSocks5" + TypeProxyTypeHttp = "proxyTypeHttp" + TypeProxyTypeMtproto = "proxyTypeMtproto" + TypeProxy = "proxy" + TypeProxies = "proxies" TypeInputSticker = "inputSticker" TypeUpdateAuthorizationState = "updateAuthorizationState" TypeUpdateNewMessage = "updateNewMessage" @@ -628,10 +753,14 @@ const ( TypeUpdateChatLastMessage = "updateChatLastMessage" TypeUpdateChatOrder = "updateChatOrder" TypeUpdateChatIsPinned = "updateChatIsPinned" + TypeUpdateChatIsMarkedAsUnread = "updateChatIsMarkedAsUnread" + TypeUpdateChatIsSponsored = "updateChatIsSponsored" + TypeUpdateChatDefaultDisableNotification = "updateChatDefaultDisableNotification" TypeUpdateChatReadInbox = "updateChatReadInbox" TypeUpdateChatReadOutbox = "updateChatReadOutbox" TypeUpdateChatUnreadMentionCount = "updateChatUnreadMentionCount" - TypeUpdateNotificationSettings = "updateNotificationSettings" + TypeUpdateChatNotificationSettings = "updateChatNotificationSettings" + TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" TypeUpdateChatReplyMarkup = "updateChatReplyMarkup" TypeUpdateChatDraftMessage = "updateChatDraftMessage" TypeUpdateDeleteMessages = "updateDeleteMessages" @@ -651,13 +780,16 @@ const ( TypeUpdateCall = "updateCall" TypeUpdateUserPrivacySettingRules = "updateUserPrivacySettingRules" TypeUpdateUnreadMessageCount = "updateUnreadMessageCount" + TypeUpdateUnreadChatCount = "updateUnreadChatCount" TypeUpdateOption = "updateOption" TypeUpdateInstalledStickerSets = "updateInstalledStickerSets" TypeUpdateTrendingStickerSets = "updateTrendingStickerSets" TypeUpdateRecentStickers = "updateRecentStickers" TypeUpdateFavoriteStickers = "updateFavoriteStickers" TypeUpdateSavedAnimations = "updateSavedAnimations" + TypeUpdateLanguagePackStrings = "updateLanguagePackStrings" TypeUpdateConnectionState = "updateConnectionState" + TypeUpdateTermsOfService = "updateTermsOfService" TypeUpdateNewInlineQuery = "updateNewInlineQuery" TypeUpdateNewChosenInlineResult = "updateNewChosenInlineResult" TypeUpdateNewCallbackQuery = "updateNewCallbackQuery" @@ -710,6 +842,11 @@ type ChatMemberStatus interface { ChatMemberStatusType() string } +// Specifies the kind of chat members to return in searchChatMembers +type ChatMembersFilter interface { + ChatMembersFilterType() string +} + // Specifies the kind of chat members to return in getSupergroupMembers type SupergroupMembersFilter interface { SupergroupMembersFilterType() string @@ -730,7 +867,7 @@ type MessageSendingState interface { MessageSendingStateType() string } -// Describes the types of chats for which notification settings are applied +// Describes the types of chats to which notification settings are applied type NotificationSettingsScope interface { NotificationSettingsScopeType() string } @@ -770,6 +907,31 @@ type InputCredentials interface { InputCredentialsType() string } +// Contains the type of a Telegram Passport element +type PassportElementType interface { + PassportElementTypeType() string +} + +// Contains information about a Telegram Passport element +type PassportElement interface { + PassportElementType() string +} + +// Contains information about a Telegram Passport element to be saved +type InputPassportElement interface { + InputPassportElementType() string +} + +// Contains the description of an error in a Telegram Passport element +type PassportElementErrorSource interface { + PassportElementErrorSourceType() string +} + +// Contains the description of an error in a Telegram Passport element; for bots only +type InputPassportElementErrorSource interface { + InputPassportElementErrorSourceType() string +} + // Contains the content of a message type MessageContent interface { MessageContentType() string @@ -830,6 +992,11 @@ type ChatEventAction interface { ChatEventActionType() string } +// Represents the value of a string in a language pack +type LanguagePackStringValue interface { + LanguagePackStringValueType() string +} + // Represents a data needed to subscribe for push notifications. To use specific push notification service, you must specify the correct application platform and upload valid server authentication data at https://my.telegram.org type DeviceToken interface { DeviceTokenType() string @@ -895,9 +1062,9 @@ type TextParseMode interface { TextParseModeType() string } -// Contains information about a proxy server -type Proxy interface { - ProxyType() string +// Describes the type of the proxy server +type ProxyType interface { + ProxyTypeType() string } // Contains notifications about data changes @@ -1164,6 +1331,154 @@ func (authenticationCodeInfo *AuthenticationCodeInfo) UnmarshalJSON(data []byte) 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"` +} + +func (entity *EmailAddressAuthenticationCodeInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub EmailAddressAuthenticationCodeInfo + + return json.Marshal((*stub)(entity)) +} + +func (*EmailAddressAuthenticationCodeInfo) GetClass() string { + return ClassEmailAddressAuthenticationCodeInfo +} + +func (*EmailAddressAuthenticationCodeInfo) GetType() string { + return TypeEmailAddressAuthenticationCodeInfo +} + +// 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 points + Offset int32 `json:"offset"` + // Length of the entity, in UTF-16 code points + Length int32 `json:"length"` + // Type of the entity + Type TextEntityType `json:"type"` +} + +func (entity *TextEntity) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntity + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntity) GetClass() string { + return ClassTextEntity +} + +func (*TextEntity) GetType() string { + 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"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + textEntity.Offset = tmp.Offset + textEntity.Length = tmp.Length + + fieldType, _ := UnmarshalTextEntityType(tmp.Type) + textEntity.Type = fieldType + + return nil +} + +// Contains a list of text entities +type TextEntities struct { + meta + // List of text entities + Entities []*TextEntity `json:"entities"` +} + +func (entity *TextEntities) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub TextEntities + + return json.Marshal((*stub)(entity)) +} + +func (*TextEntities) GetClass() string { + return ClassTextEntities +} + +func (*TextEntities) GetType() string { + return TypeTextEntities +} + +// A text with some entities +type FormattedText struct { + meta + // The text + Text string `json:"text"` + // Entities contained in the text + Entities []*TextEntity `json:"entities"` +} + +func (entity *FormattedText) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FormattedText + + return json.Marshal((*stub)(entity)) +} + +func (*FormattedText) GetClass() string { + return ClassFormattedText +} + +func (*FormattedText) GetType() string { + return TypeFormattedText +} + +// Contains Telegram terms of service +type TermsOfService struct { + meta + // Text of the terms of service + Text *FormattedText `json:"text"` + // Mininum age of a user to be able to accept the terms; 0 if any + 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() + + type stub TermsOfService + + return json.Marshal((*stub)(entity)) +} + +func (*TermsOfService) GetClass() string { + return ClassTermsOfService +} + +func (*TermsOfService) GetType() string { + return TypeTermsOfService +} + // TDLib needs TdlibParameters for initialization type AuthorizationStateWaitTdlibParameters struct{ meta @@ -1246,6 +1561,8 @@ type AuthorizationStateWaitCode struct { meta // True, if the user is already registered IsRegistered bool `json:"is_registered"` + // Telegram terms of service, which should be accepted before user can continue registration; may be null + TermsOfService *TermsOfService `json:"terms_of_service"` // Information about the authorization code that was sent CodeInfo *AuthenticationCodeInfo `json:"code_info"` } @@ -1404,13 +1721,15 @@ func (*AuthorizationStateClosed) AuthorizationStateType() string { // Represents the current state of 2-step verification type PasswordState struct { meta - // True if a 2-step verification password has been set up + // True if a 2-step verification password is set HasPassword bool `json:"has_password"` // Hint for the password; can be empty PasswordHint string `json:"password_hint"` - // True if a recovery email has been set up + // True if a recovery email is set HasRecoveryEmailAddress bool `json:"has_recovery_email_address"` - // Pattern of the email address to which a confirmation email was sent + // True if some Telegram Passport elements were saved + HasPassportData bool `json:"has_passport_data"` + // Pattern of the email address to which the confirmation email was sent UnconfirmedRecoveryEmailAddressPattern string `json:"unconfirmed_recovery_email_address_pattern"` } @@ -1430,29 +1749,6 @@ func (*PasswordState) GetType() string { return TypePasswordState } -// Contains information available to the user after requesting password recovery -type PasswordRecoveryInfo struct { - meta - // Pattern of the email address to which a recovery email was sent - RecoveryEmailAddressPattern string `json:"recovery_email_address_pattern"` -} - -func (entity *PasswordRecoveryInfo) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub PasswordRecoveryInfo - - return json.Marshal((*stub)(entity)) -} - -func (*PasswordRecoveryInfo) GetClass() string { - return ClassPasswordRecoveryInfo -} - -func (*PasswordRecoveryInfo) GetType() string { - return TypePasswordRecoveryInfo -} - // Contains information about the current recovery email address type RecoveryEmailAddress struct { meta @@ -1539,7 +1835,7 @@ func (*LocalFile) GetType() string { // Represents a remote file type RemoteFile struct { meta - // Remote file identifier, may be empty. Can be used across application restarts or even from other devices for the current user. 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 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 client with the HTTP URL in the original_path and "#url#" as the conversion string. Clients should generate the file by downloading it to the specified location + // Remote file identifier; may be empty. Can be used across application restarts or even from other devices for the current user. 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 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 client with the HTTP URL in the original_path and "#url#" as the conversion string. Clients should generate the file by downloading it to the specified location Id string `json:"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"` @@ -1680,7 +1976,7 @@ func (*InputFileLocal) InputFileType() string { // A file generated by the client type InputFileGenerated struct { meta - // Local path to a file from which the file is generated, may be empty if there is no such file + // Local path to a file from which the file is generated; may be empty if there is no such file OriginalPath string `json:"original_path"` // String specifying the conversion applied to the original file; should be persistent across application restarts Conversion string `json:"conversion"` @@ -1889,102 +2185,6 @@ func (maskPosition *MaskPosition) UnmarshalJSON(data []byte) error { return nil } -// 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 points - Offset int32 `json:"offset"` - // Length of the entity, in UTF-16 code points - Length int32 `json:"length"` - // Type of the entity - Type TextEntityType `json:"type"` -} - -func (entity *TextEntity) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntity - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntity) GetClass() string { - return ClassTextEntity -} - -func (*TextEntity) GetType() string { - 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"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - textEntity.Offset = tmp.Offset - textEntity.Length = tmp.Length - - fieldType, _ := UnmarshalTextEntityType(tmp.Type) - textEntity.Type = fieldType - - return nil -} - -// Contains a list of text entities -type TextEntities struct { - meta - // List of text entities - Entities []*TextEntity `json:"entities"` -} - -func (entity *TextEntities) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub TextEntities - - return json.Marshal((*stub)(entity)) -} - -func (*TextEntities) GetClass() string { - return ClassTextEntities -} - -func (*TextEntities) GetType() string { - return TypeTextEntities -} - -// A text with some entities -type FormattedText struct { - meta - // The text - Text string `json:"text"` - // Entities contained in the text - Entities []*TextEntity `json:"entities"` -} - -func (entity *FormattedText) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub FormattedText - - return json.Marshal((*stub)(entity)) -} - -func (*FormattedText) GetClass() string { - return ClassFormattedText -} - -func (*FormattedText) GetType() string { - return TypeFormattedText -} - // Describes an animation file. The animation must be encoded in GIF or MPEG4 format type Animation struct { meta @@ -2254,6 +2454,8 @@ type Contact struct { 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 int32 `json:"user_id"` } @@ -2312,6 +2514,8 @@ type Venue struct { 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) { @@ -3100,6 +3304,131 @@ func (*ChatMembers) GetType() string { return TypeChatMembers } +// Returns the creator 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 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 @@ -3730,7 +4059,7 @@ func (*MessageSendingStateFailed) MessageSendingStateType() string { // Describes a message type Message struct { meta - // Unique message identifier + // Message identifier, unique for the chat to which the message belongs Id int64 `json:"id"` // Identifier of the user who sent the message; 0 if unknown. It is unknown for channel posts SenderUserId int32 `json:"sender_user_id"` @@ -3911,34 +4240,7 @@ func (*FoundMessages) GetType() string { return TypeFoundMessages } -// Notification settings applied to a particular chat -type NotificationSettingsScopeChat struct { - meta - // Chat identifier - ChatId int64 `json:"chat_id"` -} - -func (entity *NotificationSettingsScopeChat) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub NotificationSettingsScopeChat - - return json.Marshal((*stub)(entity)) -} - -func (*NotificationSettingsScopeChat) GetClass() string { - return ClassNotificationSettingsScope -} - -func (*NotificationSettingsScopeChat) GetType() string { - return TypeNotificationSettingsScopeChat -} - -func (*NotificationSettingsScopeChat) NotificationSettingsScopeType() string { - return TypeNotificationSettingsScopeChat -} - -// Notification settings applied to all private chats +// Notification settings applied to all private and secret chats when the corresponding chat setting has a default value type NotificationSettingsScopePrivateChats struct{ meta } @@ -3963,81 +4265,89 @@ func (*NotificationSettingsScopePrivateChats) NotificationSettingsScopeType() st return TypeNotificationSettingsScopePrivateChats } -// Notification settings applied to all basic groups and channels. (Supergroups have no common settings) -type NotificationSettingsScopeBasicGroupChats struct{ +// Notification settings applied to all basic groups, supergroups and channels when the corresponding chat setting has a default value +type NotificationSettingsScopeGroupChats struct{ meta } -func (entity *NotificationSettingsScopeBasicGroupChats) MarshalJSON() ([]byte, error) { +func (entity *NotificationSettingsScopeGroupChats) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub NotificationSettingsScopeBasicGroupChats + type stub NotificationSettingsScopeGroupChats return json.Marshal((*stub)(entity)) } -func (*NotificationSettingsScopeBasicGroupChats) GetClass() string { +func (*NotificationSettingsScopeGroupChats) GetClass() string { return ClassNotificationSettingsScope } -func (*NotificationSettingsScopeBasicGroupChats) GetType() string { - return TypeNotificationSettingsScopeBasicGroupChats +func (*NotificationSettingsScopeGroupChats) GetType() string { + return TypeNotificationSettingsScopeGroupChats } -func (*NotificationSettingsScopeBasicGroupChats) NotificationSettingsScopeType() string { - return TypeNotificationSettingsScopeBasicGroupChats +func (*NotificationSettingsScopeGroupChats) NotificationSettingsScopeType() string { + return TypeNotificationSettingsScopeGroupChats } -// Notification settings applied to all chats -type NotificationSettingsScopeAllChats struct{ +// Contains information about notification settings for a chat +type ChatNotificationSettings struct { meta + // If true, mute_for is ignored and the value for the relevant type of 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, sound is ignored and the value for the relevant type of chat is used instead + UseDefaultSound bool `json:"use_default_sound"` + // The name of an audio file to be used for notification sounds; only applies to iOS applications + Sound string `json:"sound"` + // If true, show_preview is ignored and the value for the relevant type of chat is used instead + UseDefaultShowPreview bool `json:"use_default_show_preview"` + // True, if message content should be displayed in notifications + ShowPreview bool `json:"show_preview"` } -func (entity *NotificationSettingsScopeAllChats) MarshalJSON() ([]byte, error) { +func (entity *ChatNotificationSettings) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub NotificationSettingsScopeAllChats + type stub ChatNotificationSettings return json.Marshal((*stub)(entity)) } -func (*NotificationSettingsScopeAllChats) GetClass() string { - return ClassNotificationSettingsScope +func (*ChatNotificationSettings) GetClass() string { + return ClassChatNotificationSettings } -func (*NotificationSettingsScopeAllChats) GetType() string { - return TypeNotificationSettingsScopeAllChats +func (*ChatNotificationSettings) GetType() string { + return TypeChatNotificationSettings } -func (*NotificationSettingsScopeAllChats) NotificationSettingsScopeType() string { - return TypeNotificationSettingsScopeAllChats -} - -// Contains information about notification settings for a chat or several chats -type NotificationSettings struct { +// 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"` - // An audio file name for notification sounds; only applies to iOS applications + // The name of an audio file to be used for notification sounds; only applies to iOS applications Sound string `json:"sound"` // True, if message content should be displayed in notifications ShowPreview bool `json:"show_preview"` } -func (entity *NotificationSettings) MarshalJSON() ([]byte, error) { +func (entity *ScopeNotificationSettings) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub NotificationSettings + type stub ScopeNotificationSettings return json.Marshal((*stub)(entity)) } -func (*NotificationSettings) GetClass() string { - return ClassNotificationSettings +func (*ScopeNotificationSettings) GetClass() string { + return ClassScopeNotificationSettings } -func (*NotificationSettings) GetType() string { - return TypeNotificationSettings +func (*ScopeNotificationSettings) GetType() string { + return TypeScopeNotificationSettings } // Contains information about a message draft @@ -4213,8 +4523,14 @@ type Chat struct { Order JsonInt64 `json:"order"` // True, if the chat is pinned IsPinned bool `json:"is_pinned"` + // True, if the chat is marked as unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + // True, if the chat is sponsored by the user's MTProxy server + IsSponsored bool `json:"is_sponsored"` // True, if the chat can be reported to Telegram moderators through reportChat 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 @@ -4224,7 +4540,7 @@ type Chat struct { // Number of unread messages with a mention/reply in the chat UnreadMentionCount int32 `json:"unread_mention_count"` // Notification settings for this chat - NotificationSettings *NotificationSettings `json:"notification_settings"` + NotificationSettings *ChatNotificationSettings `json:"notification_settings"` // 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 @@ -4258,12 +4574,15 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { LastMessage *Message `json:"last_message"` Order JsonInt64 `json:"order"` IsPinned bool `json:"is_pinned"` + IsMarkedAsUnread bool `json:"is_marked_as_unread"` + IsSponsored bool `json:"is_sponsored"` 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"` - NotificationSettings *NotificationSettings `json:"notification_settings"` + NotificationSettings *ChatNotificationSettings `json:"notification_settings"` ReplyMarkupMessageId int64 `json:"reply_markup_message_id"` DraftMessage *DraftMessage `json:"draft_message"` ClientData string `json:"client_data"` @@ -4280,7 +4599,10 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.LastMessage = tmp.LastMessage chat.Order = tmp.Order chat.IsPinned = tmp.IsPinned + chat.IsMarkedAsUnread = tmp.IsMarkedAsUnread + chat.IsSponsored = tmp.IsSponsored chat.CanBeReported = tmp.CanBeReported + chat.DefaultDisableNotification = tmp.DefaultDisableNotification chat.UnreadCount = tmp.UnreadCount chat.LastReadInboxMessageId = tmp.LastReadInboxMessageId chat.LastReadOutboxMessageId = tmp.LastReadOutboxMessageId @@ -4528,7 +4850,7 @@ func (keyboardButton *KeyboardButton) UnmarshalJSON(data []byte) error { // A button that opens a specified URL type InlineKeyboardButtonTypeUrl struct { meta - // URL to open + // HTTP or tg:// URL to open Url string `json:"url"` } @@ -6312,6 +6634,39 @@ func (*WebPage) GetType() string { return TypeWebPage } +// 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 +} + // Portion of the price of a product (e.g., "delivery cost", "tax amount") type LabeledPricePart struct { meta @@ -6378,39 +6733,6 @@ func (*Invoice) GetType() string { return TypeInvoice } -// Describes a shipping address -type ShippingAddress struct { - meta - // 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 *ShippingAddress) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub ShippingAddress - - return json.Marshal((*stub)(entity)) -} - -func (*ShippingAddress) GetClass() string { - return ClassShippingAddress -} - -func (*ShippingAddress) GetType() string { - return TypeShippingAddress -} - // Order information type OrderInfo struct { meta @@ -6421,7 +6743,7 @@ type OrderInfo struct { // Email address of the user EmailAddress string `json:"email_address"` // Shipping address for this order; may be null - ShippingAddress *ShippingAddress `json:"shipping_address"` + ShippingAddress *Address `json:"shipping_address"` } func (entity *OrderInfo) MarshalJSON() ([]byte, error) { @@ -6749,6 +7071,2073 @@ func (*PaymentReceipt) GetType() string { return TypePaymentReceipt } +// 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 + 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 + 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, if available + 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 + ReverseSide InputFile `json:"reverse_side"` + // Selfie with the document, if available + 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 []InputFile `json:"translation"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + inputIdentityDocument.Number = tmp.Number + inputIdentityDocument.ExpiryDate = tmp.ExpiryDate + inputIdentityDocument.Translation = tmp.Translation + + fieldFrontSide, _ := UnmarshalInputFile(tmp.FrontSide) + inputIdentityDocument.FrontSide = fieldFrontSide + + fieldReverseSide, _ := UnmarshalInputFile(tmp.ReverseSide) + inputIdentityDocument.ReverseSide = fieldReverseSide + + fieldSelfie, _ := UnmarshalInputFile(tmp.Selfie) + inputIdentityDocument.Selfie = fieldSelfie + + 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 +} + +// 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 +} + +// 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 +} + +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 +} + +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"` + // Information about the Telegram Passport elements that need to be provided to complete the form + RequiredElements []*PassportRequiredElement `json:"required_elements"` + // Already available Telegram Passport elements + Elements []PassportElement `json:"elements"` + // Errors in the elements that are already available + Errors []*PassportElementError `json:"errors"` + // URL for the privacy policy of the service; can 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 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 @@ -7720,7 +10109,7 @@ type MessagePaymentSuccessfulBot struct { TotalAmount int64 `json:"total_amount"` // Invoice payload InvoicePayload []byte `json:"invoice_payload"` - // Identifier of the shipping option chosen by the user, may be empty if not applicable + // Identifier of the shipping option chosen by the user; may be empty if not applicable ShippingOptionId string `json:"shipping_option_id"` // Information about the order; may be null OrderInfo *OrderInfo `json:"order_info"` @@ -7802,6 +10191,62 @@ func (*MessageWebsiteConnected) MessageContentType() string { return TypeMessageWebsiteConnected } +// Telegram Passport data has been sent +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 +} + +// 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 +} + // Message content that is not supported by the client type MessageUnsupported struct{ meta @@ -8107,7 +10552,7 @@ func (*TextEntityTypePreCode) TextEntityTypeType() string { // A text description shown instead of a raw URL type TextEntityTypeTextUrl struct { meta - // URL to be opened when the link is clicked + // HTTP or tg:// URL to be opened when the link is clicked Url string `json:"url"` } @@ -8234,7 +10679,7 @@ func (inputThumbnail *InputThumbnail) UnmarshalJSON(data []byte) error { // A text message type InputMessageText struct { meta - // Formatted text to be sent. Only Bold, Italic, Code, Pre, PreCode and TextUrl entities are allowed to be specified manually + // Formatted text to be sent; 1-GetOption("message_text_length_max") characters. Only Bold, Italic, Code, Pre, PreCode and TextUrl entities are allowed to be specified manually Text *FormattedText `json:"text"` // True, if rich web page previews for URLs in the message text should be disabled DisableWebPagePreview bool `json:"disable_web_page_preview"` @@ -8275,7 +10720,7 @@ type InputMessageAnimation struct { Width int32 `json:"width"` // Height of the animation; may be replaced by the server Height int32 `json:"height"` - // Animation caption; 0-200 characters + // Animation caption; 0-GetOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` } @@ -8339,7 +10784,7 @@ type InputMessageAudio struct { Title string `json:"title"` // Performer of the audio; 0-64 characters, may be replaced by the server Performer string `json:"performer"` - // Audio caption; 0-200 characters + // Audio caption; 0-GetOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` } @@ -8397,7 +10842,7 @@ type InputMessageDocument struct { Document InputFile `json:"document"` // Document thumbnail, if available Thumbnail *InputThumbnail `json:"thumbnail"` - // Document caption; 0-200 characters + // Document caption; 0-GetOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` } @@ -8455,7 +10900,7 @@ type InputMessagePhoto struct { Width int32 `json:"width"` // Photo height Height int32 `json:"height"` - // Photo caption; 0-200 characters + // Photo caption; 0-GetOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` // Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats Ttl int32 `json:"ttl"` @@ -8583,7 +11028,7 @@ type InputMessageVideo struct { Height int32 `json:"height"` // True, if the video should be tried to be streamed SupportsStreaming bool `json:"supports_streaming"` - // Video caption; 0-200 characters + // Video caption; 0-GetOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` // Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats Ttl int32 `json:"ttl"` @@ -8707,7 +11152,7 @@ type InputMessageVoiceNote struct { Duration int32 `json:"duration"` // Waveform representation of the voice note, in 5-bit format Waveform []byte `json:"waveform"` - // Voice note caption; 0-200 characters + // Voice note caption; 0-GetOption("message_caption_length_max") characters Caption *FormattedText `json:"caption"` } @@ -12668,10 +15113,218 @@ func (*ChatEventLogFilters) GetType() string { return TypeChatEventLogFilters } +// An ordinary language pack string +type LanguagePackStringValueOrdinary struct { + meta + // String value + Value string `json:"value"` +} + +func (entity *LanguagePackStringValueOrdinary) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackStringValueOrdinary + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackStringValueOrdinary) GetClass() string { + return ClassLanguagePackStringValue +} + +func (*LanguagePackStringValueOrdinary) GetType() string { + return TypeLanguagePackStringValueOrdinary +} + +func (*LanguagePackStringValueOrdinary) LanguagePackStringValueType() string { + return TypeLanguagePackStringValueOrdinary +} + +// A language pack string which has different forms based on the number of some object it mentions +type LanguagePackStringValuePluralized struct { + meta + // Value for zero objects + ZeroValue string `json:"zero_value"` + // Value for one object + OneValue string `json:"one_value"` + // Value for two objects + TwoValue string `json:"two_value"` + // Value for few objects + FewValue string `json:"few_value"` + // Value for many objects + ManyValue string `json:"many_value"` + // Default value + OtherValue string `json:"other_value"` +} + +func (entity *LanguagePackStringValuePluralized) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackStringValuePluralized + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackStringValuePluralized) GetClass() string { + return ClassLanguagePackStringValue +} + +func (*LanguagePackStringValuePluralized) GetType() string { + return TypeLanguagePackStringValuePluralized +} + +func (*LanguagePackStringValuePluralized) LanguagePackStringValueType() string { + return TypeLanguagePackStringValuePluralized +} + +// A deleted language pack string, the value should be taken from the built-in english language pack +type LanguagePackStringValueDeleted struct{ + meta +} + +func (entity *LanguagePackStringValueDeleted) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackStringValueDeleted + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackStringValueDeleted) GetClass() string { + return ClassLanguagePackStringValue +} + +func (*LanguagePackStringValueDeleted) GetType() string { + return TypeLanguagePackStringValueDeleted +} + +func (*LanguagePackStringValueDeleted) LanguagePackStringValueType() string { + return TypeLanguagePackStringValueDeleted +} + +// Represents one language pack string +type LanguagePackString struct { + meta + // String key + Key string `json:"key"` + // String value + Value LanguagePackStringValue `json:"value"` +} + +func (entity *LanguagePackString) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackString + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackString) GetClass() string { + return ClassLanguagePackString +} + +func (*LanguagePackString) GetType() string { + return TypeLanguagePackString +} + +func (languagePackString *LanguagePackString) UnmarshalJSON(data []byte) error { + var tmp struct { + Key string `json:"key"` + Value json.RawMessage `json:"value"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + languagePackString.Key = tmp.Key + + fieldValue, _ := UnmarshalLanguagePackStringValue(tmp.Value) + languagePackString.Value = fieldValue + + return nil +} + +// Contains a list of language pack strings +type LanguagePackStrings struct { + meta + // A list of language pack strings + Strings []*LanguagePackString `json:"strings"` +} + +func (entity *LanguagePackStrings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackStrings + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackStrings) GetClass() string { + return ClassLanguagePackStrings +} + +func (*LanguagePackStrings) GetType() string { + return TypeLanguagePackStrings +} + +// Contains information about a language pack +type LanguagePackInfo struct { + meta + // Unique language pack identifier + Id string `json:"id"` + // Language name + Name string `json:"name"` + // Name of the language in that language + NativeName string `json:"native_name"` + // Total number of non-deleted strings from the language pack available locally + LocalStringCount int32 `json:"local_string_count"` +} + +func (entity *LanguagePackInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LanguagePackInfo + + return json.Marshal((*stub)(entity)) +} + +func (*LanguagePackInfo) GetClass() string { + return ClassLanguagePackInfo +} + +func (*LanguagePackInfo) GetType() string { + return TypeLanguagePackInfo +} + +// Contains information about the current localization target +type LocalizationTargetInfo struct { + meta + // List of available language packs for this application + LanguagePacks []*LanguagePackInfo `json:"language_packs"` +} + +func (entity *LocalizationTargetInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LocalizationTargetInfo + + return json.Marshal((*stub)(entity)) +} + +func (*LocalizationTargetInfo) GetClass() string { + return ClassLocalizationTargetInfo +} + +func (*LocalizationTargetInfo) GetType() string { + return TypeLocalizationTargetInfo +} + // A token for Google Cloud Messaging type DeviceTokenGoogleCloudMessaging struct { meta - // Device registration token, may be empty to de-register a device + // Device registration token; may be empty to de-register a device Token string `json:"token"` } @@ -12698,7 +15351,7 @@ func (*DeviceTokenGoogleCloudMessaging) DeviceTokenType() string { // A token for Apple Push Notification service type DeviceTokenApplePush struct { meta - // Device token, may be empty to de-register a device + // Device token; may be empty to de-register a device DeviceToken string `json:"device_token"` // True, if App Sandbox is enabled IsAppSandbox bool `json:"is_app_sandbox"` @@ -12727,7 +15380,7 @@ func (*DeviceTokenApplePush) DeviceTokenType() string { // A token for Apple Push Notification service VoIP notifications type DeviceTokenApplePushVoIP struct { meta - // Device token, may be empty to de-register a device + // Device token; may be empty to de-register a device DeviceToken string `json:"device_token"` // True, if App Sandbox is enabled IsAppSandbox bool `json:"is_app_sandbox"` @@ -12756,7 +15409,7 @@ func (*DeviceTokenApplePushVoIP) DeviceTokenType() string { // A token for Windows Push Notification Services type DeviceTokenWindowsPush struct { meta - // The access token that will be used to send notifications, may be empty to de-register a device + // The access token that will be used to send notifications; may be empty to de-register a device AccessToken string `json:"access_token"` } @@ -12783,7 +15436,7 @@ func (*DeviceTokenWindowsPush) DeviceTokenType() string { // A token for Microsoft Push Notification Service type DeviceTokenMicrosoftPush struct { meta - // Push notification channel URI, may be empty to de-register a device + // Push notification channel URI; may be empty to de-register a device ChannelUri string `json:"channel_uri"` } @@ -12810,7 +15463,7 @@ func (*DeviceTokenMicrosoftPush) DeviceTokenType() string { // A token for Microsoft Push Notification Service VoIP channel type DeviceTokenMicrosoftPushVoIP struct { meta - // Push notification channel URI, may be empty to de-register a device + // Push notification channel URI; may be empty to de-register a device ChannelUri string `json:"channel_uri"` } @@ -12837,7 +15490,7 @@ func (*DeviceTokenMicrosoftPushVoIP) DeviceTokenType() string { // A token for web Push API type DeviceTokenWebPush struct { meta - // Absolute URL exposed by the push service where the application server can send push messages, may be empty to de-register a device + // Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device Endpoint string `json:"endpoint"` // Base64url-encoded P-256 elliptic curve Diffie-Hellman public key P256dhBase64url string `json:"p256dh_base64url"` @@ -12868,7 +15521,7 @@ func (*DeviceTokenWebPush) DeviceTokenType() string { // A token for Simple Push API for Firefox OS type DeviceTokenSimplePush struct { meta - // Absolute URL exposed by the push service where the application server can send push messages, may be empty to de-register a device + // Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device Endpoint string `json:"endpoint"` } @@ -12895,7 +15548,7 @@ func (*DeviceTokenSimplePush) DeviceTokenType() string { // A token for Ubuntu Push Client service type DeviceTokenUbuntuPush struct { meta - // Token, may be empty to de-register a device + // Token; may be empty to de-register a device Token string `json:"token"` } @@ -12922,7 +15575,7 @@ func (*DeviceTokenUbuntuPush) DeviceTokenType() string { // A token for BlackBerry Push Service type DeviceTokenBlackBerryPush struct { meta - // Token, may be empty to de-register a device + // Token; may be empty to de-register a device Token string `json:"token"` } @@ -12949,7 +15602,7 @@ func (*DeviceTokenBlackBerryPush) DeviceTokenType() string { // A token for Tizen Push Service type DeviceTokenTizenPush struct { meta - // Push service registration identifier, may be empty to de-register a device + // Push service registration identifier; may be empty to de-register a device RegId string `json:"reg_id"` } @@ -13784,6 +16437,31 @@ func (*ChatReportReasonPornography) ChatReportReasonType() string { return TypeChatReportReasonPornography } +// The chat contains copyrighted content +type ChatReportReasonCopyright struct{ + meta +} + +func (entity *ChatReportReasonCopyright) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatReportReasonCopyright + + return json.Marshal((*stub)(entity)) +} + +func (*ChatReportReasonCopyright) GetClass() string { + return ClassChatReportReason +} + +func (*ChatReportReasonCopyright) GetType() string { + return TypeChatReportReasonCopyright +} + +func (*ChatReportReasonCopyright) ChatReportReasonType() string { + return TypeChatReportReasonCopyright +} + // A custom reason provided by the user type ChatReportReasonCustom struct { meta @@ -14011,6 +16689,56 @@ func (*FileTypeSecret) FileTypeType() string { return TypeFileTypeSecret } +// The file is a thumbnail of a file from a secret chat +type FileTypeSecretThumbnail struct{ + meta +} + +func (entity *FileTypeSecretThumbnail) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSecretThumbnail + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSecretThumbnail) GetClass() string { + return ClassFileType +} + +func (*FileTypeSecretThumbnail) GetType() string { + return TypeFileTypeSecretThumbnail +} + +func (*FileTypeSecretThumbnail) FileTypeType() string { + return TypeFileTypeSecretThumbnail +} + +// The file is a file from Secure storage used for storing Telegram Passport files +type FileTypeSecure struct{ + meta +} + +func (entity *FileTypeSecure) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FileTypeSecure + + return json.Marshal((*stub)(entity)) +} + +func (*FileTypeSecure) GetClass() string { + return ClassFileType +} + +func (*FileTypeSecure) GetType() string { + return TypeFileTypeSecure +} + +func (*FileTypeSecure) FileTypeType() string { + return TypeFileTypeSecure +} + // The file is a sticker type FileTypeSticker struct{ meta @@ -14186,31 +16914,6 @@ func (*FileTypeWallpaper) FileTypeType() string { return TypeFileTypeWallpaper } -// The file is a thumbnail of a file from a secret chat -type FileTypeSecretThumbnail struct{ - meta -} - -func (entity *FileTypeSecretThumbnail) MarshalJSON() ([]byte, error) { - entity.meta.Type = entity.GetType() - - type stub FileTypeSecretThumbnail - - return json.Marshal((*stub)(entity)) -} - -func (*FileTypeSecretThumbnail) GetClass() string { - return ClassFileType -} - -func (*FileTypeSecretThumbnail) GetType() string { - return TypeFileTypeSecretThumbnail -} - -func (*FileTypeSecretThumbnail) FileTypeType() string { - return TypeFileTypeSecretThumbnail -} - // Contains the storage usage statistics for a specific file type type StorageStatisticsByFileType struct { meta @@ -15102,6 +17805,54 @@ func (*Text) GetType() string { return TypeText } +// Contains a value representing a number of seconds +type Seconds struct { + meta + // Number of seconds + Seconds float64 `json:"seconds"` +} + +func (entity *Seconds) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Seconds + + return json.Marshal((*stub)(entity)) +} + +func (*Seconds) GetClass() string { + return ClassSeconds +} + +func (*Seconds) GetType() string { + return TypeSeconds +} + +// Contains information about a tg:// deep link +type DeepLinkInfo struct { + meta + // Text to be shown to the user + Text *FormattedText `json:"text"` + // True, if user should be asked to update the application + NeedUpdateApplication bool `json:"need_update_application"` +} + +func (entity *DeepLinkInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DeepLinkInfo + + return json.Marshal((*stub)(entity)) +} + +func (*DeepLinkInfo) GetClass() string { + return ClassDeepLinkInfo +} + +func (*DeepLinkInfo) GetType() string { + return TypeDeepLinkInfo +} + // The text should be parsed in markdown-style type TextParseModeMarkdown struct{ meta @@ -15152,62 +17903,174 @@ func (*TextParseModeHTML) TextParseModeType() string { return TypeTextParseModeHTML } -// An empty proxy server -type ProxyEmpty struct{ +// A SOCKS5 proxy server +type ProxyTypeSocks5 struct { meta + // Username for logging in; may be empty + Username string `json:"username"` + // Password for logging in; may be empty + Password string `json:"password"` } -func (entity *ProxyEmpty) MarshalJSON() ([]byte, error) { +func (entity *ProxyTypeSocks5) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ProxyEmpty + type stub ProxyTypeSocks5 return json.Marshal((*stub)(entity)) } -func (*ProxyEmpty) GetClass() string { - return ClassProxy +func (*ProxyTypeSocks5) GetClass() string { + return ClassProxyType } -func (*ProxyEmpty) GetType() string { - return TypeProxyEmpty +func (*ProxyTypeSocks5) GetType() string { + return TypeProxyTypeSocks5 } -func (*ProxyEmpty) ProxyType() string { - return TypeProxyEmpty +func (*ProxyTypeSocks5) ProxyTypeType() string { + return TypeProxyTypeSocks5 } -// A SOCKS5 proxy server -type ProxySocks5 struct { +// A HTTP transparent proxy server +type ProxyTypeHttp struct { meta + // Username for logging in; may be empty + Username string `json:"username"` + // Password for logging in; may be empty + Password string `json:"password"` + // Pass true, if the proxy supports only HTTP requests and doesn't support transparent TCP connections via HTTP CONNECT method + HttpOnly bool `json:"http_only"` +} + +func (entity *ProxyTypeHttp) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProxyTypeHttp + + return json.Marshal((*stub)(entity)) +} + +func (*ProxyTypeHttp) GetClass() string { + return ClassProxyType +} + +func (*ProxyTypeHttp) GetType() string { + return TypeProxyTypeHttp +} + +func (*ProxyTypeHttp) ProxyTypeType() string { + return TypeProxyTypeHttp +} + +// An MTProto proxy server +type ProxyTypeMtproto struct { + meta + // The proxy's secret in hexadecimal encoding + Secret string `json:"secret"` +} + +func (entity *ProxyTypeMtproto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ProxyTypeMtproto + + return json.Marshal((*stub)(entity)) +} + +func (*ProxyTypeMtproto) GetClass() string { + return ClassProxyType +} + +func (*ProxyTypeMtproto) GetType() string { + return TypeProxyTypeMtproto +} + +func (*ProxyTypeMtproto) ProxyTypeType() string { + return TypeProxyTypeMtproto +} + +// Contains information about a proxy server +type Proxy struct { + meta + // Unique identifier of the proxy + Id int32 `json:"id"` // Proxy server IP address Server string `json:"server"` // Proxy server port Port int32 `json:"port"` - // Username for logging in - Username string `json:"username"` - // Password for logging in - Password string `json:"password"` + // Point in time (Unix timestamp) when the proxy was last used; 0 if never + LastUsedDate int32 `json:"last_used_date"` + // True, if the proxy is enabled now + IsEnabled bool `json:"is_enabled"` + // Type of the proxy + Type ProxyType `json:"type"` } -func (entity *ProxySocks5) MarshalJSON() ([]byte, error) { +func (entity *Proxy) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub ProxySocks5 + type stub Proxy return json.Marshal((*stub)(entity)) } -func (*ProxySocks5) GetClass() string { +func (*Proxy) GetClass() string { return ClassProxy } -func (*ProxySocks5) GetType() string { - return TypeProxySocks5 +func (*Proxy) GetType() string { + return TypeProxy } -func (*ProxySocks5) ProxyType() string { - return TypeProxySocks5 +func (proxy *Proxy) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int32 `json:"id"` + Server string `json:"server"` + Port int32 `json:"port"` + LastUsedDate int32 `json:"last_used_date"` + IsEnabled bool `json:"is_enabled"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + proxy.Id = tmp.Id + proxy.Server = tmp.Server + proxy.Port = tmp.Port + proxy.LastUsedDate = tmp.LastUsedDate + proxy.IsEnabled = tmp.IsEnabled + + fieldType, _ := UnmarshalProxyType(tmp.Type) + proxy.Type = fieldType + + return nil +} + +// Represents a list of proxy servers +type Proxies struct { + meta + // List of proxy servers + Proxies []*Proxy `json:"proxies"` +} + +func (entity *Proxies) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Proxies + + return json.Marshal((*stub)(entity)) +} + +func (*Proxies) GetClass() string { + return ClassProxies +} + +func (*Proxies) GetType() string { + return TypeProxies } // Describes a sticker that should be added to a sticker set @@ -15798,6 +18661,95 @@ func (*UpdateChatIsPinned) UpdateType() string { return TypeUpdateChatIsPinned } +// A chat was marked as unread or was read +type UpdateChatIsMarkedAsUnread struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of is_marked_as_unread + IsMarkedAsUnread bool `json:"is_marked_as_unread"` +} + +func (entity *UpdateChatIsMarkedAsUnread) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatIsMarkedAsUnread + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatIsMarkedAsUnread) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatIsMarkedAsUnread) GetType() string { + return TypeUpdateChatIsMarkedAsUnread +} + +func (*UpdateChatIsMarkedAsUnread) UpdateType() string { + return TypeUpdateChatIsMarkedAsUnread +} + +// A chat's is_sponsored field has changed +type UpdateChatIsSponsored struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // New value of is_sponsored + IsSponsored bool `json:"is_sponsored"` + // New value of chat order + Order JsonInt64 `json:"order"` +} + +func (entity *UpdateChatIsSponsored) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatIsSponsored + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatIsSponsored) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatIsSponsored) GetType() string { + return TypeUpdateChatIsSponsored +} + +func (*UpdateChatIsSponsored) UpdateType() string { + return TypeUpdateChatIsSponsored +} + +// The value of the default disable_notification parameter, used when a message is sent to the chat, was changed +type UpdateChatDefaultDisableNotification struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new default_disable_notification value + DefaultDisableNotification bool `json:"default_disable_notification"` +} + +func (entity *UpdateChatDefaultDisableNotification) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatDefaultDisableNotification + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatDefaultDisableNotification) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatDefaultDisableNotification) GetType() string { + return TypeUpdateChatDefaultDisableNotification +} + +func (*UpdateChatDefaultDisableNotification) UpdateType() string { + return TypeUpdateChatDefaultDisableNotification +} + // Incoming messages were read or number of unread messages has been changed type UpdateChatReadInbox struct { meta @@ -15887,39 +18839,68 @@ func (*UpdateChatUnreadMentionCount) UpdateType() string { return TypeUpdateChatUnreadMentionCount } -// Notification settings for some chats were updated -type UpdateNotificationSettings struct { +// Notification settings for a chat were changed +type UpdateChatNotificationSettings struct { meta - // Types of chats for which notification settings were updated - Scope NotificationSettingsScope `json:"scope"` + // Chat identifier + ChatId int64 `json:"chat_id"` // The new notification settings - NotificationSettings *NotificationSettings `json:"notification_settings"` + NotificationSettings *ChatNotificationSettings `json:"notification_settings"` } -func (entity *UpdateNotificationSettings) MarshalJSON() ([]byte, error) { +func (entity *UpdateChatNotificationSettings) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub UpdateNotificationSettings + type stub UpdateChatNotificationSettings return json.Marshal((*stub)(entity)) } -func (*UpdateNotificationSettings) GetClass() string { +func (*UpdateChatNotificationSettings) GetClass() string { return ClassUpdate } -func (*UpdateNotificationSettings) GetType() string { - return TypeUpdateNotificationSettings +func (*UpdateChatNotificationSettings) GetType() string { + return TypeUpdateChatNotificationSettings } -func (*UpdateNotificationSettings) UpdateType() string { - return TypeUpdateNotificationSettings +func (*UpdateChatNotificationSettings) UpdateType() string { + return TypeUpdateChatNotificationSettings } -func (updateNotificationSettings *UpdateNotificationSettings) UnmarshalJSON(data []byte) error { +// Notification settings for some type of chats were updated +type UpdateScopeNotificationSettings struct { + meta + // Types of chats for which notification settings were updated + Scope NotificationSettingsScope `json:"scope"` + // The new notification settings + NotificationSettings *ScopeNotificationSettings `json:"notification_settings"` +} + +func (entity *UpdateScopeNotificationSettings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateScopeNotificationSettings + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateScopeNotificationSettings) GetClass() string { + return ClassUpdate +} + +func (*UpdateScopeNotificationSettings) GetType() string { + return TypeUpdateScopeNotificationSettings +} + +func (*UpdateScopeNotificationSettings) UpdateType() string { + return TypeUpdateScopeNotificationSettings +} + +func (updateScopeNotificationSettings *UpdateScopeNotificationSettings) UnmarshalJSON(data []byte) error { var tmp struct { Scope json.RawMessage `json:"scope"` - NotificationSettings *NotificationSettings `json:"notification_settings"` + NotificationSettings *ScopeNotificationSettings `json:"notification_settings"` } err := json.Unmarshal(data, &tmp) @@ -15927,10 +18908,10 @@ func (updateNotificationSettings *UpdateNotificationSettings) UnmarshalJSON(data return err } - updateNotificationSettings.NotificationSettings = tmp.NotificationSettings + updateScopeNotificationSettings.NotificationSettings = tmp.NotificationSettings fieldScope, _ := UnmarshalNotificationSettingsScope(tmp.Scope) - updateNotificationSettings.Scope = fieldScope + updateScopeNotificationSettings.Scope = fieldScope return nil } @@ -15964,7 +18945,7 @@ func (*UpdateChatReplyMarkup) UpdateType() string { return TypeUpdateChatReplyMarkup } -// A draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update shouldn't be applied +// A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update shouldn't be applied type UpdateChatDraftMessage struct { meta // Chat identifier @@ -16326,7 +19307,7 @@ func (*UpdateSupergroupFullInfo) UpdateType() string { // Service notification from the server. Upon receiving this the client must show a popup with the content of the notification type UpdateServiceNotification struct { meta - // Notification type + // Notification type. If type begins with "AUTH_KEY_DROP_", then two buttons "Cancel" and "Log out" should be shown under notification; if user presses the second, all local data should be destroyed using Destroy method Type string `json:"type"` // Notification content Content MessageContent `json:"content"` @@ -16403,11 +19384,11 @@ type UpdateFileGenerationStart struct { meta // Unique identifier for the generation process GenerationId JsonInt64 `json:"generation_id"` - // The path to a file from which a new file is generated, may be empty + // The path to a file from which a new file is generated; may be empty OriginalPath string `json:"original_path"` // The path to a file that should be created and where the new file should be generated DestinationPath string `json:"destination_path"` - // String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains a HTTP/HTTPS URL of a file, which should be downloaded by the client + // String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file, which should be downloaded by the client Conversion string `json:"conversion"` } @@ -16562,6 +19543,39 @@ func (*UpdateUnreadMessageCount) UpdateType() string { return TypeUpdateUnreadMessageCount } +// Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if a message database is used +type UpdateUnreadChatCount struct { + meta + // Total number of unread chats + UnreadCount int32 `json:"unread_count"` + // Total number of unread unmuted chats + UnreadUnmutedCount int32 `json:"unread_unmuted_count"` + // Total number of chats marked as unread + MarkedAsUnreadCount int32 `json:"marked_as_unread_count"` + // Total number of unmuted chats marked as unread + MarkedAsUnreadUnmutedCount int32 `json:"marked_as_unread_unmuted_count"` +} + +func (entity *UpdateUnreadChatCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateUnreadChatCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateUnreadChatCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateUnreadChatCount) GetType() string { + return TypeUpdateUnreadChatCount +} + +func (*UpdateUnreadChatCount) UpdateType() string { + return TypeUpdateUnreadChatCount +} + // An option changed its value type UpdateOption struct { meta @@ -16749,6 +19763,37 @@ func (*UpdateSavedAnimations) UpdateType() string { return TypeUpdateSavedAnimations } +// Some language pack strings have been updated +type UpdateLanguagePackStrings struct { + meta + // Localization target to which the language pack belongs + LocalizationTarget string `json:"localization_target"` + // Identifier of the updated language pack + LanguagePackId string `json:"language_pack_id"` + // List of changed language pack strings + Strings []*LanguagePackString `json:"strings"` +} + +func (entity *UpdateLanguagePackStrings) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateLanguagePackStrings + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateLanguagePackStrings) GetClass() string { + return ClassUpdate +} + +func (*UpdateLanguagePackStrings) GetType() string { + return TypeUpdateLanguagePackStrings +} + +func (*UpdateLanguagePackStrings) UpdateType() string { + return TypeUpdateLanguagePackStrings +} + // The connection state has changed type UpdateConnectionState struct { meta @@ -16792,6 +19837,35 @@ func (updateConnectionState *UpdateConnectionState) UnmarshalJSON(data []byte) e return nil } +// New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method should be called with the reason "Decline ToS update" +type UpdateTermsOfService struct { + meta + // Identifier of the terms of service + TermsOfServiceId string `json:"terms_of_service_id"` + // The new terms of service + TermsOfService *TermsOfService `json:"terms_of_service"` +} + +func (entity *UpdateTermsOfService) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateTermsOfService + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateTermsOfService) GetClass() string { + return ClassUpdate +} + +func (*UpdateTermsOfService) GetType() string { + return TypeUpdateTermsOfService +} + +func (*UpdateTermsOfService) UpdateType() string { + return TypeUpdateTermsOfService +} + // A new incoming inline query; for bots only type UpdateNewInlineQuery struct { meta @@ -16996,7 +20070,7 @@ type UpdateNewShippingQuery struct { // Invoice payload InvoicePayload string `json:"invoice_payload"` // User shipping address - ShippingAddress *ShippingAddress `json:"shipping_address"` + ShippingAddress *Address `json:"shipping_address"` } func (entity *UpdateNewShippingQuery) MarshalJSON() ([]byte, error) { diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 8033502..5994c71 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -207,6 +207,35 @@ func UnmarshalChatMemberStatus(data json.RawMessage) (ChatMemberStatus, error) { } } +func UnmarshalChatMembersFilter(data json.RawMessage) (ChatMembersFilter, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeChatMembersFilterAdministrators: + return UnmarshalChatMembersFilterAdministrators(data) + + case TypeChatMembersFilterMembers: + return UnmarshalChatMembersFilterMembers(data) + + case TypeChatMembersFilterRestricted: + return UnmarshalChatMembersFilterRestricted(data) + + case TypeChatMembersFilterBanned: + return UnmarshalChatMembersFilterBanned(data) + + case TypeChatMembersFilterBots: + return UnmarshalChatMembersFilterBots(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + func UnmarshalSupergroupMembersFilter(data json.RawMessage) (SupergroupMembersFilter, error) { var meta meta @@ -311,17 +340,11 @@ func UnmarshalNotificationSettingsScope(data json.RawMessage) (NotificationSetti } switch meta.Type { - case TypeNotificationSettingsScopeChat: - return UnmarshalNotificationSettingsScopeChat(data) - case TypeNotificationSettingsScopePrivateChats: return UnmarshalNotificationSettingsScopePrivateChats(data) - case TypeNotificationSettingsScopeBasicGroupChats: - return UnmarshalNotificationSettingsScopeBasicGroupChats(data) - - case TypeNotificationSettingsScopeAllChats: - return UnmarshalNotificationSettingsScopeAllChats(data) + case TypeNotificationSettingsScopeGroupChats: + return UnmarshalNotificationSettingsScopeGroupChats(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) @@ -582,6 +605,247 @@ func UnmarshalInputCredentials(data json.RawMessage) (InputCredentials, error) { } } +func UnmarshalPassportElementType(data json.RawMessage) (PassportElementType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePassportElementTypePersonalDetails: + return UnmarshalPassportElementTypePersonalDetails(data) + + case TypePassportElementTypePassport: + return UnmarshalPassportElementTypePassport(data) + + case TypePassportElementTypeDriverLicense: + return UnmarshalPassportElementTypeDriverLicense(data) + + case TypePassportElementTypeIdentityCard: + return UnmarshalPassportElementTypeIdentityCard(data) + + case TypePassportElementTypeInternalPassport: + return UnmarshalPassportElementTypeInternalPassport(data) + + case TypePassportElementTypeAddress: + return UnmarshalPassportElementTypeAddress(data) + + case TypePassportElementTypeUtilityBill: + return UnmarshalPassportElementTypeUtilityBill(data) + + case TypePassportElementTypeBankStatement: + return UnmarshalPassportElementTypeBankStatement(data) + + case TypePassportElementTypeRentalAgreement: + return UnmarshalPassportElementTypeRentalAgreement(data) + + case TypePassportElementTypePassportRegistration: + return UnmarshalPassportElementTypePassportRegistration(data) + + case TypePassportElementTypeTemporaryRegistration: + return UnmarshalPassportElementTypeTemporaryRegistration(data) + + case TypePassportElementTypePhoneNumber: + return UnmarshalPassportElementTypePhoneNumber(data) + + case TypePassportElementTypeEmailAddress: + return UnmarshalPassportElementTypeEmailAddress(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalPassportElement(data json.RawMessage) (PassportElement, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(data) + + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(data) + + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(data) + + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(data) + + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(data) + + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(data) + + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(data) + + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(data) + + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(data) + + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(data) + + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(data) + + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(data) + + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalInputPassportElement(data json.RawMessage) (InputPassportElement, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputPassportElementPersonalDetails: + return UnmarshalInputPassportElementPersonalDetails(data) + + case TypeInputPassportElementPassport: + return UnmarshalInputPassportElementPassport(data) + + case TypeInputPassportElementDriverLicense: + return UnmarshalInputPassportElementDriverLicense(data) + + case TypeInputPassportElementIdentityCard: + return UnmarshalInputPassportElementIdentityCard(data) + + case TypeInputPassportElementInternalPassport: + return UnmarshalInputPassportElementInternalPassport(data) + + case TypeInputPassportElementAddress: + return UnmarshalInputPassportElementAddress(data) + + case TypeInputPassportElementUtilityBill: + return UnmarshalInputPassportElementUtilityBill(data) + + case TypeInputPassportElementBankStatement: + return UnmarshalInputPassportElementBankStatement(data) + + case TypeInputPassportElementRentalAgreement: + return UnmarshalInputPassportElementRentalAgreement(data) + + case TypeInputPassportElementPassportRegistration: + return UnmarshalInputPassportElementPassportRegistration(data) + + case TypeInputPassportElementTemporaryRegistration: + return UnmarshalInputPassportElementTemporaryRegistration(data) + + case TypeInputPassportElementPhoneNumber: + return UnmarshalInputPassportElementPhoneNumber(data) + + case TypeInputPassportElementEmailAddress: + return UnmarshalInputPassportElementEmailAddress(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalPassportElementErrorSource(data json.RawMessage) (PassportElementErrorSource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePassportElementErrorSourceUnspecified: + return UnmarshalPassportElementErrorSourceUnspecified(data) + + case TypePassportElementErrorSourceDataField: + return UnmarshalPassportElementErrorSourceDataField(data) + + case TypePassportElementErrorSourceFrontSide: + return UnmarshalPassportElementErrorSourceFrontSide(data) + + case TypePassportElementErrorSourceReverseSide: + return UnmarshalPassportElementErrorSourceReverseSide(data) + + case TypePassportElementErrorSourceSelfie: + return UnmarshalPassportElementErrorSourceSelfie(data) + + case TypePassportElementErrorSourceTranslationFile: + return UnmarshalPassportElementErrorSourceTranslationFile(data) + + case TypePassportElementErrorSourceTranslationFiles: + return UnmarshalPassportElementErrorSourceTranslationFiles(data) + + case TypePassportElementErrorSourceFile: + return UnmarshalPassportElementErrorSourceFile(data) + + case TypePassportElementErrorSourceFiles: + return UnmarshalPassportElementErrorSourceFiles(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalInputPassportElementErrorSource(data json.RawMessage) (InputPassportElementErrorSource, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeInputPassportElementErrorSourceUnspecified: + return UnmarshalInputPassportElementErrorSourceUnspecified(data) + + case TypeInputPassportElementErrorSourceDataField: + return UnmarshalInputPassportElementErrorSourceDataField(data) + + case TypeInputPassportElementErrorSourceFrontSide: + return UnmarshalInputPassportElementErrorSourceFrontSide(data) + + case TypeInputPassportElementErrorSourceReverseSide: + return UnmarshalInputPassportElementErrorSourceReverseSide(data) + + case TypeInputPassportElementErrorSourceSelfie: + return UnmarshalInputPassportElementErrorSourceSelfie(data) + + case TypeInputPassportElementErrorSourceTranslationFile: + return UnmarshalInputPassportElementErrorSourceTranslationFile(data) + + case TypeInputPassportElementErrorSourceTranslationFiles: + return UnmarshalInputPassportElementErrorSourceTranslationFiles(data) + + case TypeInputPassportElementErrorSourceFile: + return UnmarshalInputPassportElementErrorSourceFile(data) + + case TypeInputPassportElementErrorSourceFiles: + return UnmarshalInputPassportElementErrorSourceFiles(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { var meta meta @@ -699,6 +963,12 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageWebsiteConnected: return UnmarshalMessageWebsiteConnected(data) + case TypeMessagePassportDataSent: + return UnmarshalMessagePassportDataSent(data) + + case TypeMessagePassportDataReceived: + return UnmarshalMessagePassportDataReceived(data) + case TypeMessageUnsupported: return UnmarshalMessageUnsupported(data) @@ -1218,6 +1488,29 @@ func UnmarshalChatEventAction(data json.RawMessage) (ChatEventAction, error) { } } +func UnmarshalLanguagePackStringValue(data json.RawMessage) (LanguagePackStringValue, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeLanguagePackStringValueOrdinary: + return UnmarshalLanguagePackStringValueOrdinary(data) + + case TypeLanguagePackStringValuePluralized: + return UnmarshalLanguagePackStringValuePluralized(data) + + case TypeLanguagePackStringValueDeleted: + return UnmarshalLanguagePackStringValueDeleted(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + func UnmarshalDeviceToken(data json.RawMessage) (DeviceToken, error) { var meta meta @@ -1393,6 +1686,9 @@ func UnmarshalChatReportReason(data json.RawMessage) (ChatReportReason, error) { case TypeChatReportReasonPornography: return UnmarshalChatReportReasonPornography(data) + case TypeChatReportReasonCopyright: + return UnmarshalChatReportReasonCopyright(data) + case TypeChatReportReasonCustom: return UnmarshalChatReportReasonCustom(data) @@ -1431,6 +1727,12 @@ func UnmarshalFileType(data json.RawMessage) (FileType, error) { case TypeFileTypeSecret: return UnmarshalFileTypeSecret(data) + case TypeFileTypeSecretThumbnail: + return UnmarshalFileTypeSecretThumbnail(data) + + case TypeFileTypeSecure: + return UnmarshalFileTypeSecure(data) + case TypeFileTypeSticker: return UnmarshalFileTypeSticker(data) @@ -1452,9 +1754,6 @@ func UnmarshalFileType(data json.RawMessage) (FileType, error) { case TypeFileTypeWallpaper: return UnmarshalFileTypeWallpaper(data) - case TypeFileTypeSecretThumbnail: - return UnmarshalFileTypeSecretThumbnail(data) - default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -1616,7 +1915,7 @@ func UnmarshalTextParseMode(data json.RawMessage) (TextParseMode, error) { } } -func UnmarshalProxy(data json.RawMessage) (Proxy, error) { +func UnmarshalProxyType(data json.RawMessage) (ProxyType, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -1625,11 +1924,14 @@ func UnmarshalProxy(data json.RawMessage) (Proxy, error) { } switch meta.Type { - case TypeProxyEmpty: - return UnmarshalProxyEmpty(data) + case TypeProxyTypeSocks5: + return UnmarshalProxyTypeSocks5(data) - case TypeProxySocks5: - return UnmarshalProxySocks5(data) + case TypeProxyTypeHttp: + return UnmarshalProxyTypeHttp(data) + + case TypeProxyTypeMtproto: + return UnmarshalProxyTypeMtproto(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) @@ -1693,6 +1995,15 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatIsPinned: return UnmarshalUpdateChatIsPinned(data) + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(data) + + case TypeUpdateChatIsSponsored: + return UnmarshalUpdateChatIsSponsored(data) + + case TypeUpdateChatDefaultDisableNotification: + return UnmarshalUpdateChatDefaultDisableNotification(data) + case TypeUpdateChatReadInbox: return UnmarshalUpdateChatReadInbox(data) @@ -1702,8 +2013,11 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateChatUnreadMentionCount: return UnmarshalUpdateChatUnreadMentionCount(data) - case TypeUpdateNotificationSettings: - return UnmarshalUpdateNotificationSettings(data) + case TypeUpdateChatNotificationSettings: + return UnmarshalUpdateChatNotificationSettings(data) + + case TypeUpdateScopeNotificationSettings: + return UnmarshalUpdateScopeNotificationSettings(data) case TypeUpdateChatReplyMarkup: return UnmarshalUpdateChatReplyMarkup(data) @@ -1762,6 +2076,9 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateUnreadMessageCount: return UnmarshalUpdateUnreadMessageCount(data) + case TypeUpdateUnreadChatCount: + return UnmarshalUpdateUnreadChatCount(data) + case TypeUpdateOption: return UnmarshalUpdateOption(data) @@ -1780,9 +2097,15 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateSavedAnimations: return UnmarshalUpdateSavedAnimations(data) + case TypeUpdateLanguagePackStrings: + return UnmarshalUpdateLanguagePackStrings(data) + case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(data) + case TypeUpdateTermsOfService: + return UnmarshalUpdateTermsOfService(data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(data) @@ -1876,6 +2199,46 @@ func UnmarshalAuthenticationCodeInfo(data json.RawMessage) (*AuthenticationCodeI return &resp, err } +func UnmarshalEmailAddressAuthenticationCodeInfo(data json.RawMessage) (*EmailAddressAuthenticationCodeInfo, error) { + var resp EmailAddressAuthenticationCodeInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntity(data json.RawMessage) (*TextEntity, error) { + var resp TextEntity + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTextEntities(data json.RawMessage) (*TextEntities, error) { + var resp TextEntities + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFormattedText(data json.RawMessage) (*FormattedText, error) { + var resp FormattedText + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalTermsOfService(data json.RawMessage) (*TermsOfService, error) { + var resp TermsOfService + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAuthorizationStateWaitTdlibParameters(data json.RawMessage) (*AuthorizationStateWaitTdlibParameters, error) { var resp AuthorizationStateWaitTdlibParameters @@ -1956,14 +2319,6 @@ func UnmarshalPasswordState(data json.RawMessage) (*PasswordState, error) { return &resp, err } -func UnmarshalPasswordRecoveryInfo(data json.RawMessage) (*PasswordRecoveryInfo, error) { - var resp PasswordRecoveryInfo - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalRecoveryEmailAddress(data json.RawMessage) (*RecoveryEmailAddress, error) { var resp RecoveryEmailAddress @@ -2084,30 +2439,6 @@ func UnmarshalMaskPosition(data json.RawMessage) (*MaskPosition, error) { return &resp, err } -func UnmarshalTextEntity(data json.RawMessage) (*TextEntity, error) { - var resp TextEntity - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalTextEntities(data json.RawMessage) (*TextEntities, error) { - var resp TextEntities - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - -func UnmarshalFormattedText(data json.RawMessage) (*FormattedText, error) { - var resp FormattedText - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalAnimation(data json.RawMessage) (*Animation, error) { var resp Animation @@ -2388,6 +2719,46 @@ func UnmarshalChatMembers(data json.RawMessage) (*ChatMembers, error) { return &resp, err } +func UnmarshalChatMembersFilterAdministrators(data json.RawMessage) (*ChatMembersFilterAdministrators, error) { + var resp ChatMembersFilterAdministrators + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembersFilterMembers(data json.RawMessage) (*ChatMembersFilterMembers, error) { + var resp ChatMembersFilterMembers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembersFilterRestricted(data json.RawMessage) (*ChatMembersFilterRestricted, error) { + var resp ChatMembersFilterRestricted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembersFilterBanned(data json.RawMessage) (*ChatMembersFilterBanned, error) { + var resp ChatMembersFilterBanned + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalChatMembersFilterBots(data json.RawMessage) (*ChatMembersFilterBots, error) { + var resp ChatMembersFilterBots + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalSupergroupMembersFilterRecent(data json.RawMessage) (*SupergroupMembersFilterRecent, error) { var resp SupergroupMembersFilterRecent @@ -2556,14 +2927,6 @@ func UnmarshalFoundMessages(data json.RawMessage) (*FoundMessages, error) { return &resp, err } -func UnmarshalNotificationSettingsScopeChat(data json.RawMessage) (*NotificationSettingsScopeChat, error) { - var resp NotificationSettingsScopeChat - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalNotificationSettingsScopePrivateChats(data json.RawMessage) (*NotificationSettingsScopePrivateChats, error) { var resp NotificationSettingsScopePrivateChats @@ -2572,24 +2935,24 @@ func UnmarshalNotificationSettingsScopePrivateChats(data json.RawMessage) (*Noti return &resp, err } -func UnmarshalNotificationSettingsScopeBasicGroupChats(data json.RawMessage) (*NotificationSettingsScopeBasicGroupChats, error) { - var resp NotificationSettingsScopeBasicGroupChats +func UnmarshalNotificationSettingsScopeGroupChats(data json.RawMessage) (*NotificationSettingsScopeGroupChats, error) { + var resp NotificationSettingsScopeGroupChats err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalNotificationSettingsScopeAllChats(data json.RawMessage) (*NotificationSettingsScopeAllChats, error) { - var resp NotificationSettingsScopeAllChats +func UnmarshalChatNotificationSettings(data json.RawMessage) (*ChatNotificationSettings, error) { + var resp ChatNotificationSettings err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalNotificationSettings(data json.RawMessage) (*NotificationSettings, error) { - var resp NotificationSettings +func UnmarshalScopeNotificationSettings(data json.RawMessage) (*ScopeNotificationSettings, error) { + var resp ScopeNotificationSettings err := json.Unmarshal(data, &resp) @@ -3052,6 +3415,14 @@ func UnmarshalWebPage(data json.RawMessage) (*WebPage, error) { return &resp, err } +func UnmarshalAddress(data json.RawMessage) (*Address, error) { + var resp Address + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalLabeledPricePart(data json.RawMessage) (*LabeledPricePart, error) { var resp LabeledPricePart @@ -3068,14 +3439,6 @@ func UnmarshalInvoice(data json.RawMessage) (*Invoice, error) { return &resp, err } -func UnmarshalShippingAddress(data json.RawMessage) (*ShippingAddress, error) { - var resp ShippingAddress - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalOrderInfo(data json.RawMessage) (*OrderInfo, error) { var resp OrderInfo @@ -3172,6 +3535,582 @@ func UnmarshalPaymentReceipt(data json.RawMessage) (*PaymentReceipt, error) { return &resp, err } +func UnmarshalDatedFile(data json.RawMessage) (*DatedFile, error) { + var resp DatedFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypePersonalDetails(data json.RawMessage) (*PassportElementTypePersonalDetails, error) { + var resp PassportElementTypePersonalDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypePassport(data json.RawMessage) (*PassportElementTypePassport, error) { + var resp PassportElementTypePassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeDriverLicense(data json.RawMessage) (*PassportElementTypeDriverLicense, error) { + var resp PassportElementTypeDriverLicense + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeIdentityCard(data json.RawMessage) (*PassportElementTypeIdentityCard, error) { + var resp PassportElementTypeIdentityCard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeInternalPassport(data json.RawMessage) (*PassportElementTypeInternalPassport, error) { + var resp PassportElementTypeInternalPassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeAddress(data json.RawMessage) (*PassportElementTypeAddress, error) { + var resp PassportElementTypeAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeUtilityBill(data json.RawMessage) (*PassportElementTypeUtilityBill, error) { + var resp PassportElementTypeUtilityBill + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeBankStatement(data json.RawMessage) (*PassportElementTypeBankStatement, error) { + var resp PassportElementTypeBankStatement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeRentalAgreement(data json.RawMessage) (*PassportElementTypeRentalAgreement, error) { + var resp PassportElementTypeRentalAgreement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypePassportRegistration(data json.RawMessage) (*PassportElementTypePassportRegistration, error) { + var resp PassportElementTypePassportRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeTemporaryRegistration(data json.RawMessage) (*PassportElementTypeTemporaryRegistration, error) { + var resp PassportElementTypeTemporaryRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypePhoneNumber(data json.RawMessage) (*PassportElementTypePhoneNumber, error) { + var resp PassportElementTypePhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTypeEmailAddress(data json.RawMessage) (*PassportElementTypeEmailAddress, error) { + var resp PassportElementTypeEmailAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDate(data json.RawMessage) (*Date, error) { + var resp Date + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPersonalDetails(data json.RawMessage) (*PersonalDetails, error) { + var resp PersonalDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalIdentityDocument(data json.RawMessage) (*IdentityDocument, error) { + var resp IdentityDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputIdentityDocument(data json.RawMessage) (*InputIdentityDocument, error) { + var resp InputIdentityDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPersonalDocument(data json.RawMessage) (*PersonalDocument, error) { + var resp PersonalDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPersonalDocument(data json.RawMessage) (*InputPersonalDocument, error) { + var resp InputPersonalDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementPersonalDetails(data json.RawMessage) (*PassportElementPersonalDetails, error) { + var resp PassportElementPersonalDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementPassport(data json.RawMessage) (*PassportElementPassport, error) { + var resp PassportElementPassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementDriverLicense(data json.RawMessage) (*PassportElementDriverLicense, error) { + var resp PassportElementDriverLicense + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementIdentityCard(data json.RawMessage) (*PassportElementIdentityCard, error) { + var resp PassportElementIdentityCard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementInternalPassport(data json.RawMessage) (*PassportElementInternalPassport, error) { + var resp PassportElementInternalPassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementAddress(data json.RawMessage) (*PassportElementAddress, error) { + var resp PassportElementAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementUtilityBill(data json.RawMessage) (*PassportElementUtilityBill, error) { + var resp PassportElementUtilityBill + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementBankStatement(data json.RawMessage) (*PassportElementBankStatement, error) { + var resp PassportElementBankStatement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementRentalAgreement(data json.RawMessage) (*PassportElementRentalAgreement, error) { + var resp PassportElementRentalAgreement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementPassportRegistration(data json.RawMessage) (*PassportElementPassportRegistration, error) { + var resp PassportElementPassportRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementTemporaryRegistration(data json.RawMessage) (*PassportElementTemporaryRegistration, error) { + var resp PassportElementTemporaryRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementPhoneNumber(data json.RawMessage) (*PassportElementPhoneNumber, error) { + var resp PassportElementPhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementEmailAddress(data json.RawMessage) (*PassportElementEmailAddress, error) { + var resp PassportElementEmailAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementPersonalDetails(data json.RawMessage) (*InputPassportElementPersonalDetails, error) { + var resp InputPassportElementPersonalDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementPassport(data json.RawMessage) (*InputPassportElementPassport, error) { + var resp InputPassportElementPassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementDriverLicense(data json.RawMessage) (*InputPassportElementDriverLicense, error) { + var resp InputPassportElementDriverLicense + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementIdentityCard(data json.RawMessage) (*InputPassportElementIdentityCard, error) { + var resp InputPassportElementIdentityCard + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementInternalPassport(data json.RawMessage) (*InputPassportElementInternalPassport, error) { + var resp InputPassportElementInternalPassport + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementAddress(data json.RawMessage) (*InputPassportElementAddress, error) { + var resp InputPassportElementAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementUtilityBill(data json.RawMessage) (*InputPassportElementUtilityBill, error) { + var resp InputPassportElementUtilityBill + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementBankStatement(data json.RawMessage) (*InputPassportElementBankStatement, error) { + var resp InputPassportElementBankStatement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementRentalAgreement(data json.RawMessage) (*InputPassportElementRentalAgreement, error) { + var resp InputPassportElementRentalAgreement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementPassportRegistration(data json.RawMessage) (*InputPassportElementPassportRegistration, error) { + var resp InputPassportElementPassportRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementTemporaryRegistration(data json.RawMessage) (*InputPassportElementTemporaryRegistration, error) { + var resp InputPassportElementTemporaryRegistration + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementPhoneNumber(data json.RawMessage) (*InputPassportElementPhoneNumber, error) { + var resp InputPassportElementPhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementEmailAddress(data json.RawMessage) (*InputPassportElementEmailAddress, error) { + var resp InputPassportElementEmailAddress + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElements(data json.RawMessage) (*PassportElements, error) { + var resp PassportElements + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceUnspecified(data json.RawMessage) (*PassportElementErrorSourceUnspecified, error) { + var resp PassportElementErrorSourceUnspecified + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceDataField(data json.RawMessage) (*PassportElementErrorSourceDataField, error) { + var resp PassportElementErrorSourceDataField + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceFrontSide(data json.RawMessage) (*PassportElementErrorSourceFrontSide, error) { + var resp PassportElementErrorSourceFrontSide + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceReverseSide(data json.RawMessage) (*PassportElementErrorSourceReverseSide, error) { + var resp PassportElementErrorSourceReverseSide + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceSelfie(data json.RawMessage) (*PassportElementErrorSourceSelfie, error) { + var resp PassportElementErrorSourceSelfie + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceTranslationFile(data json.RawMessage) (*PassportElementErrorSourceTranslationFile, error) { + var resp PassportElementErrorSourceTranslationFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceTranslationFiles(data json.RawMessage) (*PassportElementErrorSourceTranslationFiles, error) { + var resp PassportElementErrorSourceTranslationFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceFile(data json.RawMessage) (*PassportElementErrorSourceFile, error) { + var resp PassportElementErrorSourceFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementErrorSourceFiles(data json.RawMessage) (*PassportElementErrorSourceFiles, error) { + var resp PassportElementErrorSourceFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportElementError(data json.RawMessage) (*PassportElementError, error) { + var resp PassportElementError + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportSuitableElement(data json.RawMessage) (*PassportSuitableElement, error) { + var resp PassportSuitableElement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportRequiredElement(data json.RawMessage) (*PassportRequiredElement, error) { + var resp PassportRequiredElement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPassportAuthorizationForm(data json.RawMessage) (*PassportAuthorizationForm, error) { + var resp PassportAuthorizationForm + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEncryptedCredentials(data json.RawMessage) (*EncryptedCredentials, error) { + var resp EncryptedCredentials + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalEncryptedPassportElement(data json.RawMessage) (*EncryptedPassportElement, error) { + var resp EncryptedPassportElement + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceUnspecified(data json.RawMessage) (*InputPassportElementErrorSourceUnspecified, error) { + var resp InputPassportElementErrorSourceUnspecified + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceDataField(data json.RawMessage) (*InputPassportElementErrorSourceDataField, error) { + var resp InputPassportElementErrorSourceDataField + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceFrontSide(data json.RawMessage) (*InputPassportElementErrorSourceFrontSide, error) { + var resp InputPassportElementErrorSourceFrontSide + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceReverseSide(data json.RawMessage) (*InputPassportElementErrorSourceReverseSide, error) { + var resp InputPassportElementErrorSourceReverseSide + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceSelfie(data json.RawMessage) (*InputPassportElementErrorSourceSelfie, error) { + var resp InputPassportElementErrorSourceSelfie + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceTranslationFile(data json.RawMessage) (*InputPassportElementErrorSourceTranslationFile, error) { + var resp InputPassportElementErrorSourceTranslationFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceTranslationFiles(data json.RawMessage) (*InputPassportElementErrorSourceTranslationFiles, error) { + var resp InputPassportElementErrorSourceTranslationFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceFile(data json.RawMessage) (*InputPassportElementErrorSourceFile, error) { + var resp InputPassportElementErrorSourceFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementErrorSourceFiles(data json.RawMessage) (*InputPassportElementErrorSourceFiles, error) { + var resp InputPassportElementErrorSourceFiles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalInputPassportElementError(data json.RawMessage) (*InputPassportElementError, error) { + var resp InputPassportElementError + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageText(data json.RawMessage) (*MessageText, error) { var resp MessageText @@ -3460,6 +4399,22 @@ func UnmarshalMessageWebsiteConnected(data json.RawMessage) (*MessageWebsiteConn return &resp, err } +func UnmarshalMessagePassportDataSent(data json.RawMessage) (*MessagePassportDataSent, error) { + var resp MessagePassportDataSent + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessagePassportDataReceived(data json.RawMessage) (*MessagePassportDataReceived, error) { + var resp MessagePassportDataReceived + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageUnsupported(data json.RawMessage) (*MessageUnsupported, error) { var resp MessageUnsupported @@ -4580,6 +5535,62 @@ func UnmarshalChatEventLogFilters(data json.RawMessage) (*ChatEventLogFilters, e return &resp, err } +func UnmarshalLanguagePackStringValueOrdinary(data json.RawMessage) (*LanguagePackStringValueOrdinary, error) { + var resp LanguagePackStringValueOrdinary + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLanguagePackStringValuePluralized(data json.RawMessage) (*LanguagePackStringValuePluralized, error) { + var resp LanguagePackStringValuePluralized + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLanguagePackStringValueDeleted(data json.RawMessage) (*LanguagePackStringValueDeleted, error) { + var resp LanguagePackStringValueDeleted + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLanguagePackString(data json.RawMessage) (*LanguagePackString, error) { + var resp LanguagePackString + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLanguagePackStrings(data json.RawMessage) (*LanguagePackStrings, error) { + var resp LanguagePackStrings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLanguagePackInfo(data json.RawMessage) (*LanguagePackInfo, error) { + var resp LanguagePackInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLocalizationTargetInfo(data json.RawMessage) (*LocalizationTargetInfo, error) { + var resp LocalizationTargetInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalDeviceTokenGoogleCloudMessaging(data json.RawMessage) (*DeviceTokenGoogleCloudMessaging, error) { var resp DeviceTokenGoogleCloudMessaging @@ -4916,6 +5927,14 @@ func UnmarshalChatReportReasonPornography(data json.RawMessage) (*ChatReportReas return &resp, err } +func UnmarshalChatReportReasonCopyright(data json.RawMessage) (*ChatReportReasonCopyright, error) { + var resp ChatReportReasonCopyright + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatReportReasonCustom(data json.RawMessage) (*ChatReportReasonCustom, error) { var resp ChatReportReasonCustom @@ -4988,6 +6007,22 @@ func UnmarshalFileTypeSecret(data json.RawMessage) (*FileTypeSecret, error) { return &resp, err } +func UnmarshalFileTypeSecretThumbnail(data json.RawMessage) (*FileTypeSecretThumbnail, error) { + var resp FileTypeSecretThumbnail + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalFileTypeSecure(data json.RawMessage) (*FileTypeSecure, error) { + var resp FileTypeSecure + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFileTypeSticker(data json.RawMessage) (*FileTypeSticker, error) { var resp FileTypeSticker @@ -5044,14 +6079,6 @@ func UnmarshalFileTypeWallpaper(data json.RawMessage) (*FileTypeWallpaper, error return &resp, err } -func UnmarshalFileTypeSecretThumbnail(data json.RawMessage) (*FileTypeSecretThumbnail, error) { - var resp FileTypeSecretThumbnail - - err := json.Unmarshal(data, &resp) - - return &resp, err -} - func UnmarshalStorageStatisticsByFileType(data json.RawMessage) (*StorageStatisticsByFileType, error) { var resp StorageStatisticsByFileType @@ -5300,6 +6327,22 @@ func UnmarshalText(data json.RawMessage) (*Text, error) { return &resp, err } +func UnmarshalSeconds(data json.RawMessage) (*Seconds, error) { + var resp Seconds + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalDeepLinkInfo(data json.RawMessage) (*DeepLinkInfo, error) { + var resp DeepLinkInfo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTextParseModeMarkdown(data json.RawMessage) (*TextParseModeMarkdown, error) { var resp TextParseModeMarkdown @@ -5316,16 +6359,40 @@ func UnmarshalTextParseModeHTML(data json.RawMessage) (*TextParseModeHTML, error return &resp, err } -func UnmarshalProxyEmpty(data json.RawMessage) (*ProxyEmpty, error) { - var resp ProxyEmpty +func UnmarshalProxyTypeSocks5(data json.RawMessage) (*ProxyTypeSocks5, error) { + var resp ProxyTypeSocks5 err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalProxySocks5(data json.RawMessage) (*ProxySocks5, error) { - var resp ProxySocks5 +func UnmarshalProxyTypeHttp(data json.RawMessage) (*ProxyTypeHttp, error) { + var resp ProxyTypeHttp + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProxyTypeMtproto(data json.RawMessage) (*ProxyTypeMtproto, error) { + var resp ProxyTypeMtproto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProxy(data json.RawMessage) (*Proxy, error) { + var resp Proxy + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalProxies(data json.RawMessage) (*Proxies, error) { + var resp Proxies err := json.Unmarshal(data, &resp) @@ -5468,6 +6535,30 @@ func UnmarshalUpdateChatIsPinned(data json.RawMessage) (*UpdateChatIsPinned, err return &resp, err } +func UnmarshalUpdateChatIsMarkedAsUnread(data json.RawMessage) (*UpdateChatIsMarkedAsUnread, error) { + var resp UpdateChatIsMarkedAsUnread + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatIsSponsored(data json.RawMessage) (*UpdateChatIsSponsored, error) { + var resp UpdateChatIsSponsored + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateChatDefaultDisableNotification(data json.RawMessage) (*UpdateChatDefaultDisableNotification, error) { + var resp UpdateChatDefaultDisableNotification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatReadInbox(data json.RawMessage) (*UpdateChatReadInbox, error) { var resp UpdateChatReadInbox @@ -5492,8 +6583,16 @@ func UnmarshalUpdateChatUnreadMentionCount(data json.RawMessage) (*UpdateChatUnr return &resp, err } -func UnmarshalUpdateNotificationSettings(data json.RawMessage) (*UpdateNotificationSettings, error) { - var resp UpdateNotificationSettings +func UnmarshalUpdateChatNotificationSettings(data json.RawMessage) (*UpdateChatNotificationSettings, error) { + var resp UpdateChatNotificationSettings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateScopeNotificationSettings(data json.RawMessage) (*UpdateScopeNotificationSettings, error) { + var resp UpdateScopeNotificationSettings err := json.Unmarshal(data, &resp) @@ -5652,6 +6751,14 @@ func UnmarshalUpdateUnreadMessageCount(data json.RawMessage) (*UpdateUnreadMessa return &resp, err } +func UnmarshalUpdateUnreadChatCount(data json.RawMessage) (*UpdateUnreadChatCount, error) { + var resp UpdateUnreadChatCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateOption(data json.RawMessage) (*UpdateOption, error) { var resp UpdateOption @@ -5700,6 +6807,14 @@ func UnmarshalUpdateSavedAnimations(data json.RawMessage) (*UpdateSavedAnimation return &resp, err } +func UnmarshalUpdateLanguagePackStrings(data json.RawMessage) (*UpdateLanguagePackStrings, error) { + var resp UpdateLanguagePackStrings + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateConnectionState(data json.RawMessage) (*UpdateConnectionState, error) { var resp UpdateConnectionState @@ -5708,6 +6823,14 @@ func UnmarshalUpdateConnectionState(data json.RawMessage) (*UpdateConnectionStat return &resp, err } +func UnmarshalUpdateTermsOfService(data json.RawMessage) (*UpdateTermsOfService, error) { + var resp UpdateTermsOfService + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateNewInlineQuery(data json.RawMessage) (*UpdateNewInlineQuery, error) { var resp UpdateNewInlineQuery @@ -5861,6 +6984,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeAuthenticationCodeInfo: return UnmarshalAuthenticationCodeInfo(data) + case TypeEmailAddressAuthenticationCodeInfo: + return UnmarshalEmailAddressAuthenticationCodeInfo(data) + + case TypeTextEntity: + return UnmarshalTextEntity(data) + + case TypeTextEntities: + return UnmarshalTextEntities(data) + + case TypeFormattedText: + return UnmarshalFormattedText(data) + + case TypeTermsOfService: + return UnmarshalTermsOfService(data) + case TypeAuthorizationStateWaitTdlibParameters: return UnmarshalAuthorizationStateWaitTdlibParameters(data) @@ -5891,9 +7029,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePasswordState: return UnmarshalPasswordState(data) - case TypePasswordRecoveryInfo: - return UnmarshalPasswordRecoveryInfo(data) - case TypeRecoveryEmailAddress: return UnmarshalRecoveryEmailAddress(data) @@ -5939,15 +7074,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMaskPosition: return UnmarshalMaskPosition(data) - case TypeTextEntity: - return UnmarshalTextEntity(data) - - case TypeTextEntities: - return UnmarshalTextEntities(data) - - case TypeFormattedText: - return UnmarshalFormattedText(data) - case TypeAnimation: return UnmarshalAnimation(data) @@ -6053,6 +7179,21 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatMembers: return UnmarshalChatMembers(data) + case TypeChatMembersFilterAdministrators: + return UnmarshalChatMembersFilterAdministrators(data) + + case TypeChatMembersFilterMembers: + return UnmarshalChatMembersFilterMembers(data) + + case TypeChatMembersFilterRestricted: + return UnmarshalChatMembersFilterRestricted(data) + + case TypeChatMembersFilterBanned: + return UnmarshalChatMembersFilterBanned(data) + + case TypeChatMembersFilterBots: + return UnmarshalChatMembersFilterBots(data) + case TypeSupergroupMembersFilterRecent: return UnmarshalSupergroupMembersFilterRecent(data) @@ -6116,20 +7257,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFoundMessages: return UnmarshalFoundMessages(data) - case TypeNotificationSettingsScopeChat: - return UnmarshalNotificationSettingsScopeChat(data) - case TypeNotificationSettingsScopePrivateChats: return UnmarshalNotificationSettingsScopePrivateChats(data) - case TypeNotificationSettingsScopeBasicGroupChats: - return UnmarshalNotificationSettingsScopeBasicGroupChats(data) + case TypeNotificationSettingsScopeGroupChats: + return UnmarshalNotificationSettingsScopeGroupChats(data) - case TypeNotificationSettingsScopeAllChats: - return UnmarshalNotificationSettingsScopeAllChats(data) + case TypeChatNotificationSettings: + return UnmarshalChatNotificationSettings(data) - case TypeNotificationSettings: - return UnmarshalNotificationSettings(data) + case TypeScopeNotificationSettings: + return UnmarshalScopeNotificationSettings(data) case TypeDraftMessage: return UnmarshalDraftMessage(data) @@ -6302,15 +7440,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeWebPage: return UnmarshalWebPage(data) + case TypeAddress: + return UnmarshalAddress(data) + case TypeLabeledPricePart: return UnmarshalLabeledPricePart(data) case TypeInvoice: return UnmarshalInvoice(data) - case TypeShippingAddress: - return UnmarshalShippingAddress(data) - case TypeOrderInfo: return UnmarshalOrderInfo(data) @@ -6347,6 +7485,222 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePaymentReceipt: return UnmarshalPaymentReceipt(data) + case TypeDatedFile: + return UnmarshalDatedFile(data) + + case TypePassportElementTypePersonalDetails: + return UnmarshalPassportElementTypePersonalDetails(data) + + case TypePassportElementTypePassport: + return UnmarshalPassportElementTypePassport(data) + + case TypePassportElementTypeDriverLicense: + return UnmarshalPassportElementTypeDriverLicense(data) + + case TypePassportElementTypeIdentityCard: + return UnmarshalPassportElementTypeIdentityCard(data) + + case TypePassportElementTypeInternalPassport: + return UnmarshalPassportElementTypeInternalPassport(data) + + case TypePassportElementTypeAddress: + return UnmarshalPassportElementTypeAddress(data) + + case TypePassportElementTypeUtilityBill: + return UnmarshalPassportElementTypeUtilityBill(data) + + case TypePassportElementTypeBankStatement: + return UnmarshalPassportElementTypeBankStatement(data) + + case TypePassportElementTypeRentalAgreement: + return UnmarshalPassportElementTypeRentalAgreement(data) + + case TypePassportElementTypePassportRegistration: + return UnmarshalPassportElementTypePassportRegistration(data) + + case TypePassportElementTypeTemporaryRegistration: + return UnmarshalPassportElementTypeTemporaryRegistration(data) + + case TypePassportElementTypePhoneNumber: + return UnmarshalPassportElementTypePhoneNumber(data) + + case TypePassportElementTypeEmailAddress: + return UnmarshalPassportElementTypeEmailAddress(data) + + case TypeDate: + return UnmarshalDate(data) + + case TypePersonalDetails: + return UnmarshalPersonalDetails(data) + + case TypeIdentityDocument: + return UnmarshalIdentityDocument(data) + + case TypeInputIdentityDocument: + return UnmarshalInputIdentityDocument(data) + + case TypePersonalDocument: + return UnmarshalPersonalDocument(data) + + case TypeInputPersonalDocument: + return UnmarshalInputPersonalDocument(data) + + case TypePassportElementPersonalDetails: + return UnmarshalPassportElementPersonalDetails(data) + + case TypePassportElementPassport: + return UnmarshalPassportElementPassport(data) + + case TypePassportElementDriverLicense: + return UnmarshalPassportElementDriverLicense(data) + + case TypePassportElementIdentityCard: + return UnmarshalPassportElementIdentityCard(data) + + case TypePassportElementInternalPassport: + return UnmarshalPassportElementInternalPassport(data) + + case TypePassportElementAddress: + return UnmarshalPassportElementAddress(data) + + case TypePassportElementUtilityBill: + return UnmarshalPassportElementUtilityBill(data) + + case TypePassportElementBankStatement: + return UnmarshalPassportElementBankStatement(data) + + case TypePassportElementRentalAgreement: + return UnmarshalPassportElementRentalAgreement(data) + + case TypePassportElementPassportRegistration: + return UnmarshalPassportElementPassportRegistration(data) + + case TypePassportElementTemporaryRegistration: + return UnmarshalPassportElementTemporaryRegistration(data) + + case TypePassportElementPhoneNumber: + return UnmarshalPassportElementPhoneNumber(data) + + case TypePassportElementEmailAddress: + return UnmarshalPassportElementEmailAddress(data) + + case TypeInputPassportElementPersonalDetails: + return UnmarshalInputPassportElementPersonalDetails(data) + + case TypeInputPassportElementPassport: + return UnmarshalInputPassportElementPassport(data) + + case TypeInputPassportElementDriverLicense: + return UnmarshalInputPassportElementDriverLicense(data) + + case TypeInputPassportElementIdentityCard: + return UnmarshalInputPassportElementIdentityCard(data) + + case TypeInputPassportElementInternalPassport: + return UnmarshalInputPassportElementInternalPassport(data) + + case TypeInputPassportElementAddress: + return UnmarshalInputPassportElementAddress(data) + + case TypeInputPassportElementUtilityBill: + return UnmarshalInputPassportElementUtilityBill(data) + + case TypeInputPassportElementBankStatement: + return UnmarshalInputPassportElementBankStatement(data) + + case TypeInputPassportElementRentalAgreement: + return UnmarshalInputPassportElementRentalAgreement(data) + + case TypeInputPassportElementPassportRegistration: + return UnmarshalInputPassportElementPassportRegistration(data) + + case TypeInputPassportElementTemporaryRegistration: + return UnmarshalInputPassportElementTemporaryRegistration(data) + + case TypeInputPassportElementPhoneNumber: + return UnmarshalInputPassportElementPhoneNumber(data) + + case TypeInputPassportElementEmailAddress: + return UnmarshalInputPassportElementEmailAddress(data) + + case TypePassportElements: + return UnmarshalPassportElements(data) + + case TypePassportElementErrorSourceUnspecified: + return UnmarshalPassportElementErrorSourceUnspecified(data) + + case TypePassportElementErrorSourceDataField: + return UnmarshalPassportElementErrorSourceDataField(data) + + case TypePassportElementErrorSourceFrontSide: + return UnmarshalPassportElementErrorSourceFrontSide(data) + + case TypePassportElementErrorSourceReverseSide: + return UnmarshalPassportElementErrorSourceReverseSide(data) + + case TypePassportElementErrorSourceSelfie: + return UnmarshalPassportElementErrorSourceSelfie(data) + + case TypePassportElementErrorSourceTranslationFile: + return UnmarshalPassportElementErrorSourceTranslationFile(data) + + case TypePassportElementErrorSourceTranslationFiles: + return UnmarshalPassportElementErrorSourceTranslationFiles(data) + + case TypePassportElementErrorSourceFile: + return UnmarshalPassportElementErrorSourceFile(data) + + case TypePassportElementErrorSourceFiles: + return UnmarshalPassportElementErrorSourceFiles(data) + + case TypePassportElementError: + return UnmarshalPassportElementError(data) + + case TypePassportSuitableElement: + return UnmarshalPassportSuitableElement(data) + + case TypePassportRequiredElement: + return UnmarshalPassportRequiredElement(data) + + case TypePassportAuthorizationForm: + return UnmarshalPassportAuthorizationForm(data) + + case TypeEncryptedCredentials: + return UnmarshalEncryptedCredentials(data) + + case TypeEncryptedPassportElement: + return UnmarshalEncryptedPassportElement(data) + + case TypeInputPassportElementErrorSourceUnspecified: + return UnmarshalInputPassportElementErrorSourceUnspecified(data) + + case TypeInputPassportElementErrorSourceDataField: + return UnmarshalInputPassportElementErrorSourceDataField(data) + + case TypeInputPassportElementErrorSourceFrontSide: + return UnmarshalInputPassportElementErrorSourceFrontSide(data) + + case TypeInputPassportElementErrorSourceReverseSide: + return UnmarshalInputPassportElementErrorSourceReverseSide(data) + + case TypeInputPassportElementErrorSourceSelfie: + return UnmarshalInputPassportElementErrorSourceSelfie(data) + + case TypeInputPassportElementErrorSourceTranslationFile: + return UnmarshalInputPassportElementErrorSourceTranslationFile(data) + + case TypeInputPassportElementErrorSourceTranslationFiles: + return UnmarshalInputPassportElementErrorSourceTranslationFiles(data) + + case TypeInputPassportElementErrorSourceFile: + return UnmarshalInputPassportElementErrorSourceFile(data) + + case TypeInputPassportElementErrorSourceFiles: + return UnmarshalInputPassportElementErrorSourceFiles(data) + + case TypeInputPassportElementError: + return UnmarshalInputPassportElementError(data) + case TypeMessageText: return UnmarshalMessageText(data) @@ -6455,6 +7809,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageWebsiteConnected: return UnmarshalMessageWebsiteConnected(data) + case TypeMessagePassportDataSent: + return UnmarshalMessagePassportDataSent(data) + + case TypeMessagePassportDataReceived: + return UnmarshalMessagePassportDataReceived(data) + case TypeMessageUnsupported: return UnmarshalMessageUnsupported(data) @@ -6875,6 +8235,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatEventLogFilters: return UnmarshalChatEventLogFilters(data) + case TypeLanguagePackStringValueOrdinary: + return UnmarshalLanguagePackStringValueOrdinary(data) + + case TypeLanguagePackStringValuePluralized: + return UnmarshalLanguagePackStringValuePluralized(data) + + case TypeLanguagePackStringValueDeleted: + return UnmarshalLanguagePackStringValueDeleted(data) + + case TypeLanguagePackString: + return UnmarshalLanguagePackString(data) + + case TypeLanguagePackStrings: + return UnmarshalLanguagePackStrings(data) + + case TypeLanguagePackInfo: + return UnmarshalLanguagePackInfo(data) + + case TypeLocalizationTargetInfo: + return UnmarshalLocalizationTargetInfo(data) + case TypeDeviceTokenGoogleCloudMessaging: return UnmarshalDeviceTokenGoogleCloudMessaging(data) @@ -7001,6 +8382,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatReportReasonPornography: return UnmarshalChatReportReasonPornography(data) + case TypeChatReportReasonCopyright: + return UnmarshalChatReportReasonCopyright(data) + case TypeChatReportReasonCustom: return UnmarshalChatReportReasonCustom(data) @@ -7028,6 +8412,12 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFileTypeSecret: return UnmarshalFileTypeSecret(data) + case TypeFileTypeSecretThumbnail: + return UnmarshalFileTypeSecretThumbnail(data) + + case TypeFileTypeSecure: + return UnmarshalFileTypeSecure(data) + case TypeFileTypeSticker: return UnmarshalFileTypeSticker(data) @@ -7049,9 +8439,6 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeFileTypeWallpaper: return UnmarshalFileTypeWallpaper(data) - case TypeFileTypeSecretThumbnail: - return UnmarshalFileTypeSecretThumbnail(data) - case TypeStorageStatisticsByFileType: return UnmarshalStorageStatisticsByFileType(data) @@ -7145,17 +8532,32 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeText: return UnmarshalText(data) + case TypeSeconds: + return UnmarshalSeconds(data) + + case TypeDeepLinkInfo: + return UnmarshalDeepLinkInfo(data) + case TypeTextParseModeMarkdown: return UnmarshalTextParseModeMarkdown(data) case TypeTextParseModeHTML: return UnmarshalTextParseModeHTML(data) - case TypeProxyEmpty: - return UnmarshalProxyEmpty(data) + case TypeProxyTypeSocks5: + return UnmarshalProxyTypeSocks5(data) - case TypeProxySocks5: - return UnmarshalProxySocks5(data) + case TypeProxyTypeHttp: + return UnmarshalProxyTypeHttp(data) + + case TypeProxyTypeMtproto: + return UnmarshalProxyTypeMtproto(data) + + case TypeProxy: + return UnmarshalProxy(data) + + case TypeProxies: + return UnmarshalProxies(data) case TypeInputSticker: return UnmarshalInputSticker(data) @@ -7208,6 +8610,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatIsPinned: return UnmarshalUpdateChatIsPinned(data) + case TypeUpdateChatIsMarkedAsUnread: + return UnmarshalUpdateChatIsMarkedAsUnread(data) + + case TypeUpdateChatIsSponsored: + return UnmarshalUpdateChatIsSponsored(data) + + case TypeUpdateChatDefaultDisableNotification: + return UnmarshalUpdateChatDefaultDisableNotification(data) + case TypeUpdateChatReadInbox: return UnmarshalUpdateChatReadInbox(data) @@ -7217,8 +8628,11 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateChatUnreadMentionCount: return UnmarshalUpdateChatUnreadMentionCount(data) - case TypeUpdateNotificationSettings: - return UnmarshalUpdateNotificationSettings(data) + case TypeUpdateChatNotificationSettings: + return UnmarshalUpdateChatNotificationSettings(data) + + case TypeUpdateScopeNotificationSettings: + return UnmarshalUpdateScopeNotificationSettings(data) case TypeUpdateChatReplyMarkup: return UnmarshalUpdateChatReplyMarkup(data) @@ -7277,6 +8691,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateUnreadMessageCount: return UnmarshalUpdateUnreadMessageCount(data) + case TypeUpdateUnreadChatCount: + return UnmarshalUpdateUnreadChatCount(data) + case TypeUpdateOption: return UnmarshalUpdateOption(data) @@ -7295,9 +8712,15 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateSavedAnimations: return UnmarshalUpdateSavedAnimations(data) + case TypeUpdateLanguagePackStrings: + return UnmarshalUpdateLanguagePackStrings(data) + case TypeUpdateConnectionState: return UnmarshalUpdateConnectionState(data) + case TypeUpdateTermsOfService: + return UnmarshalUpdateTermsOfService(data) + case TypeUpdateNewInlineQuery: return UnmarshalUpdateNewInlineQuery(data) diff --git a/data/td_api.json b/data/td_api.json index 09d735b..a1ec58a 100755 --- a/data/td_api.json +++ b/data/td_api.json @@ -234,6 +234,96 @@ } ] }, + { + "name": "emailAddressAuthenticationCodeInfo", + "description": "Information about the email address authentication code that was sent", + "class": "EmailAddressAuthenticationCodeInfo", + "properties": [ + { + "name": "email_address_pattern", + "type": "string", + "description": "Pattern of the email address to which an authentication code was sent" + }, + { + "name": "length", + "type": "int32", + "description": "Length of the code; 0 if unknown" + } + ] + }, + { + "name": "textEntity", + "description": "Represents a part of the text that needs to be formatted in some unusual way", + "class": "TextEntity", + "properties": [ + { + "name": "offset", + "type": "int32", + "description": "Offset of the entity in UTF-16 code points" + }, + { + "name": "length", + "type": "int32", + "description": "Length of the entity, in UTF-16 code points" + }, + { + "name": "type", + "type": "TextEntityType", + "description": "Type of the entity" + } + ] + }, + { + "name": "textEntities", + "description": "Contains a list of text entities", + "class": "TextEntities", + "properties": [ + { + "name": "entities", + "type": "vector\u003ctextEntity\u003e", + "description": "List of text entities" + } + ] + }, + { + "name": "formattedText", + "description": "A text with some entities", + "class": "FormattedText", + "properties": [ + { + "name": "text", + "type": "string", + "description": "The text" + }, + { + "name": "entities", + "type": "vector\u003ctextEntity\u003e", + "description": "Entities contained in the text" + } + ] + }, + { + "name": "termsOfService", + "description": "Contains Telegram terms of service", + "class": "TermsOfService", + "properties": [ + { + "name": "text", + "type": "formattedText", + "description": "Text of the terms of service" + }, + { + "name": "min_user_age", + "type": "int32", + "description": "Mininum age of a user to be able to accept the terms; 0 if any" + }, + { + "name": "show_popup", + "type": "Bool", + "description": "True, if a blocking popup with terms of service must be shown to the user" + } + ] + }, { "name": "authorizationStateWaitTdlibParameters", "description": "TDLib needs TdlibParameters for initialization", @@ -268,6 +358,11 @@ "type": "Bool", "description": "True, if the user is already registered" }, + { + "name": "terms_of_service", + "type": "termsOfService", + "description": "Telegram terms of service, which should be accepted before user can continue registration; may be null" + }, { "name": "code_info", "type": "authenticationCodeInfo", @@ -329,7 +424,7 @@ { "name": "has_password", "type": "Bool", - "description": "True if a 2-step verification password has been set up" + "description": "True if a 2-step verification password is set" }, { "name": "password_hint", @@ -339,24 +434,17 @@ { "name": "has_recovery_email_address", "type": "Bool", - "description": "True if a recovery email has been set up" + "description": "True if a recovery email is set" + }, + { + "name": "has_passport_data", + "type": "Bool", + "description": "True if some Telegram Passport elements were saved" }, { "name": "unconfirmed_recovery_email_address_pattern", "type": "string", - "description": "Pattern of the email address to which a confirmation email was sent" - } - ] - }, - { - "name": "passwordRecoveryInfo", - "description": "Contains information available to the user after requesting password recovery", - "class": "PasswordRecoveryInfo", - "properties": [ - { - "name": "recovery_email_address_pattern", - "type": "string", - "description": "Pattern of the email address to which a recovery email was sent" + "description": "Pattern of the email address to which the confirmation email was sent" } ] }, @@ -439,7 +527,7 @@ { "name": "id", "type": "string", - "description": "Remote file identifier, may be empty. Can be used across application restarts or even from other devices for the current user. 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 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 client with the HTTP URL in the original_path and \"#url#\" as the conversion string. Clients should generate the file by downloading it to the specified location" + "description": "Remote file identifier; may be empty. Can be used across application restarts or even from other devices for the current user. 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 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 client with the HTTP URL in the original_path and \"#url#\" as the conversion string. Clients should generate the file by downloading it to the specified location" }, { "name": "is_uploading_active", @@ -534,7 +622,7 @@ { "name": "original_path", "type": "string", - "description": "Local path to a file from which the file is generated, may be empty if there is no such file" + "description": "Local path to a file from which the file is generated; may be empty if there is no such file" }, { "name": "conversion", @@ -626,57 +714,6 @@ } ] }, - { - "name": "textEntity", - "description": "Represents a part of the text that needs to be formatted in some unusual way", - "class": "TextEntity", - "properties": [ - { - "name": "offset", - "type": "int32", - "description": "Offset of the entity in UTF-16 code points" - }, - { - "name": "length", - "type": "int32", - "description": "Length of the entity, in UTF-16 code points" - }, - { - "name": "type", - "type": "TextEntityType", - "description": "Type of the entity" - } - ] - }, - { - "name": "textEntities", - "description": "Contains a list of text entities", - "class": "TextEntities", - "properties": [ - { - "name": "entities", - "type": "vector\u003ctextEntity\u003e", - "description": "List of text entities" - } - ] - }, - { - "name": "formattedText", - "description": "A text with some entities", - "class": "FormattedText", - "properties": [ - { - "name": "text", - "type": "string", - "description": "The text" - }, - { - "name": "entities", - "type": "vector\u003ctextEntity\u003e", - "description": "Entities contained in the text" - } - ] - }, { "name": "animation", "description": "Describes an animation file. The animation must be encoded in GIF or MPEG4 format", @@ -983,6 +1020,11 @@ "type": "string", "description": "Last name of the user" }, + { + "name": "vcard", + "type": "string", + "description": "Additional data about the user in a form of vCard; 0-2048 bytes in length" + }, { "name": "user_id", "type": "int32", @@ -1036,6 +1078,11 @@ "name": "id", "type": "string", "description": "Identifier of the venue in the provider database; as defined by the sender" + }, + { + "name": "type", + "type": "string", + "description": "Type of the venue in the provider database; as defined by the sender" } ] }, @@ -1549,6 +1596,36 @@ } ] }, + { + "name": "chatMembersFilterAdministrators", + "description": "Returns the creator and administrators", + "class": "ChatMembersFilter", + "properties": [] + }, + { + "name": "chatMembersFilterMembers", + "description": "Returns all chat members, including restricted chat members", + "class": "ChatMembersFilter", + "properties": [] + }, + { + "name": "chatMembersFilterRestricted", + "description": "Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup", + "class": "ChatMembersFilter", + "properties": [] + }, + { + "name": "chatMembersFilterBanned", + "description": "Returns users banned from the chat; can be used only by administrators in a supergroup or in a channel", + "class": "ChatMembersFilter", + "properties": [] + }, + { + "name": "chatMembersFilterBots", + "description": "Returns bot members of the chat", + "class": "ChatMembersFilter", + "properties": [] + }, { "name": "supergroupMembersFilterRecent", "description": "Returns recently active users in reverse chronological order", @@ -1940,7 +2017,7 @@ { "name": "id", "type": "int53", - "description": "Unique message identifier" + "description": "Message identifier, unique for the chat to which the message belongs" }, { "name": "sender_user_id", @@ -2089,39 +2166,58 @@ ] }, { - "name": "notificationSettingsScopeChat", - "description": "Notification settings applied to a particular chat", + "name": "notificationSettingsScopePrivateChats", + "description": "Notification settings applied to all private and secret chats when the corresponding chat setting has a default value", "class": "NotificationSettingsScope", + "properties": [] + }, + { + "name": "notificationSettingsScopeGroupChats", + "description": "Notification settings applied to all basic groups, supergroups and channels when the corresponding chat setting has a default value", + "class": "NotificationSettingsScope", + "properties": [] + }, + { + "name": "chatNotificationSettings", + "description": "Contains information about notification settings for a chat", + "class": "ChatNotificationSettings", "properties": [ { - "name": "chat_id", - "type": "int53", - "description": "Chat identifier" + "name": "use_default_mute_for", + "type": "Bool", + "description": "If true, mute_for is ignored and the value for the relevant type of chat is used instead" + }, + { + "name": "mute_for", + "type": "int32", + "description": "Time left before notifications will be unmuted, in seconds" + }, + { + "name": "use_default_sound", + "type": "Bool", + "description": "If true, sound is ignored and the value for the relevant type of chat is used instead" + }, + { + "name": "sound", + "type": "string", + "description": "The name of an audio file to be used for notification sounds; only applies to iOS applications" + }, + { + "name": "use_default_show_preview", + "type": "Bool", + "description": "If true, show_preview is ignored and the value for the relevant type of chat is used instead" + }, + { + "name": "show_preview", + "type": "Bool", + "description": "True, if message content should be displayed in notifications" } ] }, { - "name": "notificationSettingsScopePrivateChats", - "description": "Notification settings applied to all private chats", - "class": "NotificationSettingsScope", - "properties": [] - }, - { - "name": "notificationSettingsScopeBasicGroupChats", - "description": "Notification settings applied to all basic groups and channels. (Supergroups have no common settings)", - "class": "NotificationSettingsScope", - "properties": [] - }, - { - "name": "notificationSettingsScopeAllChats", - "description": "Notification settings applied to all chats", - "class": "NotificationSettingsScope", - "properties": [] - }, - { - "name": "notificationSettings", - "description": "Contains information about notification settings for a chat or several chats", - "class": "NotificationSettings", + "name": "scopeNotificationSettings", + "description": "Contains information about notification settings for several chats", + "class": "ScopeNotificationSettings", "properties": [ { "name": "mute_for", @@ -2131,7 +2227,7 @@ { "name": "sound", "type": "string", - "description": "An audio file name for notification sounds; only applies to iOS applications" + "description": "The name of an audio file to be used for notification sounds; only applies to iOS applications" }, { "name": "show_preview", @@ -2255,11 +2351,26 @@ "type": "Bool", "description": "True, if the chat is pinned" }, + { + "name": "is_marked_as_unread", + "type": "Bool", + "description": "True, if the chat is marked as unread" + }, + { + "name": "is_sponsored", + "type": "Bool", + "description": "True, if the chat is sponsored by the user's MTProxy server" + }, { "name": "can_be_reported", "type": "Bool", "description": "True, if the chat can be reported to Telegram moderators through reportChat" }, + { + "name": "default_disable_notification", + "type": "Bool", + "description": "Default value of the disable_notification parameter, used when a message is sent to the chat" + }, { "name": "unread_count", "type": "int32", @@ -2282,7 +2393,7 @@ }, { "name": "notification_settings", - "type": "notificationSettings", + "type": "chatNotificationSettings", "description": "Notification settings for this chat" }, { @@ -2411,7 +2522,7 @@ { "name": "url", "type": "string", - "description": "URL to open" + "description": "HTTP or tg:// URL to open" } ] }, @@ -3193,6 +3304,43 @@ } ] }, + { + "name": "address", + "description": "Describes an address", + "class": "Address", + "properties": [ + { + "name": "country_code", + "type": "string", + "description": "A two-letter ISO 3166-1 alpha-2 country code" + }, + { + "name": "state", + "type": "string", + "description": "State, if applicable" + }, + { + "name": "city", + "type": "string", + "description": "City" + }, + { + "name": "street_line1", + "type": "string", + "description": "First line of the address" + }, + { + "name": "street_line2", + "type": "string", + "description": "Second line of the address" + }, + { + "name": "postal_code", + "type": "string", + "description": "Address postal code" + } + ] + }, { "name": "labeledPricePart", "description": "Portion of the price of a product (e.g., \"delivery cost\", \"tax amount\")", @@ -3267,43 +3415,6 @@ } ] }, - { - "name": "shippingAddress", - "description": "Describes a shipping address", - "class": "ShippingAddress", - "properties": [ - { - "name": "country_code", - "type": "string", - "description": "Two-letter ISO 3166-1 alpha-2 country code" - }, - { - "name": "state", - "type": "string", - "description": "State, if applicable" - }, - { - "name": "city", - "type": "string", - "description": "City" - }, - { - "name": "street_line1", - "type": "string", - "description": "First line of the address" - }, - { - "name": "street_line2", - "type": "string", - "description": "Second line of the address" - }, - { - "name": "postal_code", - "type": "string", - "description": "Address postal code" - } - ] - }, { "name": "orderInfo", "description": "Order information", @@ -3326,7 +3437,7 @@ }, { "name": "shipping_address", - "type": "shippingAddress", + "type": "address", "description": "Shipping address for this order; may be null" } ] @@ -3563,6 +3674,974 @@ } ] }, + { + "name": "datedFile", + "description": "File with the date it was uploaded", + "class": "DatedFile", + "properties": [ + { + "name": "file", + "type": "file", + "description": "The file" + }, + { + "name": "date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the file was uploaded" + } + ] + }, + { + "name": "passportElementTypePersonalDetails", + "description": "A Telegram Passport element containing the user's personal details", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypePassport", + "description": "A Telegram Passport element containing the user's passport", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeDriverLicense", + "description": "A Telegram Passport element containing the user's driver license", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeIdentityCard", + "description": "A Telegram Passport element containing the user's identity card", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeInternalPassport", + "description": "A Telegram Passport element containing the user's internal passport", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeAddress", + "description": "A Telegram Passport element containing the user's address", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeUtilityBill", + "description": "A Telegram Passport element containing the user's utility bill", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeBankStatement", + "description": "A Telegram Passport element containing the user's bank statement", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeRentalAgreement", + "description": "A Telegram Passport element containing the user's rental agreement", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypePassportRegistration", + "description": "A Telegram Passport element containing the registration page of the user's passport", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeTemporaryRegistration", + "description": "A Telegram Passport element containing the user's temporary registration", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypePhoneNumber", + "description": "A Telegram Passport element containing the user's phone number", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "passportElementTypeEmailAddress", + "description": "A Telegram Passport element containing the user's email address", + "class": "PassportElementType", + "properties": [] + }, + { + "name": "date", + "description": "Represents a date according to the Gregorian calendar", + "class": "Date", + "properties": [ + { + "name": "day", + "type": "int32", + "description": "Day of the month, 1-31" + }, + { + "name": "month", + "type": "int32", + "description": "Month, 1-12" + }, + { + "name": "year", + "type": "int32", + "description": "Year, 1-9999" + } + ] + }, + { + "name": "personalDetails", + "description": "Contains the user's personal details", + "class": "PersonalDetails", + "properties": [ + { + "name": "first_name", + "type": "string", + "description": "First name of the user written in English; 1-255 characters" + }, + { + "name": "middle_name", + "type": "string", + "description": "Middle name of the user written in English; 0-255 characters" + }, + { + "name": "last_name", + "type": "string", + "description": "Last name of the user written in English; 1-255 characters" + }, + { + "name": "native_first_name", + "type": "string", + "description": "Native first name of the user; 1-255 characters" + }, + { + "name": "native_middle_name", + "type": "string", + "description": "Native middle name of the user; 0-255 characters" + }, + { + "name": "native_last_name", + "type": "string", + "description": "Native last name of the user; 1-255 characters" + }, + { + "name": "birthdate", + "type": "date", + "description": "Birthdate of the user" + }, + { + "name": "gender", + "type": "string", + "description": "Gender of the user, \"male\" or \"female\"" + }, + { + "name": "country_code", + "type": "string", + "description": "A two-letter ISO 3166-1 alpha-2 country code of the user's country" + }, + { + "name": "residence_country_code", + "type": "string", + "description": "A two-letter ISO 3166-1 alpha-2 country code of the user's residence country" + } + ] + }, + { + "name": "identityDocument", + "description": "An identity document", + "class": "IdentityDocument", + "properties": [ + { + "name": "number", + "type": "string", + "description": "Document number; 1-24 characters" + }, + { + "name": "expiry_date", + "type": "date", + "description": "Document expiry date; may be null" + }, + { + "name": "front_side", + "type": "datedFile", + "description": "Front side of the document" + }, + { + "name": "reverse_side", + "type": "datedFile", + "description": "Reverse side of the document; only for driver license and identity card" + }, + { + "name": "selfie", + "type": "datedFile", + "description": "Selfie with the document; may be null" + }, + { + "name": "translation", + "type": "vector\u003cdatedFile\u003e", + "description": "List of files containing a certified English translation of the document" + } + ] + }, + { + "name": "inputIdentityDocument", + "description": "An identity document to be saved to Telegram Passport", + "class": "InputIdentityDocument", + "properties": [ + { + "name": "number", + "type": "string", + "description": "Document number; 1-24 characters" + }, + { + "name": "expiry_date", + "type": "date", + "description": "Document expiry date, if available" + }, + { + "name": "front_side", + "type": "InputFile", + "description": "Front side of the document" + }, + { + "name": "reverse_side", + "type": "InputFile", + "description": "Reverse side of the document; only for driver license and identity card" + }, + { + "name": "selfie", + "type": "InputFile", + "description": "Selfie with the document, if available" + }, + { + "name": "translation", + "type": "vector\u003cInputFile\u003e", + "description": "List of files containing a certified English translation of the document" + } + ] + }, + { + "name": "personalDocument", + "description": "A personal document, containing some information about a user", + "class": "PersonalDocument", + "properties": [ + { + "name": "files", + "type": "vector\u003cdatedFile\u003e", + "description": "List of files containing the pages of the document" + }, + { + "name": "translation", + "type": "vector\u003cdatedFile\u003e", + "description": "List of files containing a certified English translation of the document" + } + ] + }, + { + "name": "inputPersonalDocument", + "description": "A personal document to be saved to Telegram Passport", + "class": "InputPersonalDocument", + "properties": [ + { + "name": "files", + "type": "vector\u003cInputFile\u003e", + "description": "List of files containing the pages of the document" + }, + { + "name": "translation", + "type": "vector\u003cInputFile\u003e", + "description": "List of files containing a certified English translation of the document" + } + ] + }, + { + "name": "passportElementPersonalDetails", + "description": "A Telegram Passport element containing the user's personal details", + "class": "PassportElement", + "properties": [ + { + "name": "personal_details", + "type": "personalDetails", + "description": "Personal details of the user" + } + ] + }, + { + "name": "passportElementPassport", + "description": "A Telegram Passport element containing the user's passport", + "class": "PassportElement", + "properties": [ + { + "name": "passport", + "type": "identityDocument", + "description": "Passport" + } + ] + }, + { + "name": "passportElementDriverLicense", + "description": "A Telegram Passport element containing the user's driver license", + "class": "PassportElement", + "properties": [ + { + "name": "driver_license", + "type": "identityDocument", + "description": "Driver license" + } + ] + }, + { + "name": "passportElementIdentityCard", + "description": "A Telegram Passport element containing the user's identity card", + "class": "PassportElement", + "properties": [ + { + "name": "identity_card", + "type": "identityDocument", + "description": "Identity card" + } + ] + }, + { + "name": "passportElementInternalPassport", + "description": "A Telegram Passport element containing the user's internal passport", + "class": "PassportElement", + "properties": [ + { + "name": "internal_passport", + "type": "identityDocument", + "description": "Internal passport" + } + ] + }, + { + "name": "passportElementAddress", + "description": "A Telegram Passport element containing the user's address", + "class": "PassportElement", + "properties": [ + { + "name": "address", + "type": "address", + "description": "Address" + } + ] + }, + { + "name": "passportElementUtilityBill", + "description": "A Telegram Passport element containing the user's utility bill", + "class": "PassportElement", + "properties": [ + { + "name": "utility_bill", + "type": "personalDocument", + "description": "Utility bill" + } + ] + }, + { + "name": "passportElementBankStatement", + "description": "A Telegram Passport element containing the user's bank statement", + "class": "PassportElement", + "properties": [ + { + "name": "bank_statement", + "type": "personalDocument", + "description": "Bank statement" + } + ] + }, + { + "name": "passportElementRentalAgreement", + "description": "A Telegram Passport element containing the user's rental agreement", + "class": "PassportElement", + "properties": [ + { + "name": "rental_agreement", + "type": "personalDocument", + "description": "Rental agreement" + } + ] + }, + { + "name": "passportElementPassportRegistration", + "description": "A Telegram Passport element containing the user's passport registration pages", + "class": "PassportElement", + "properties": [ + { + "name": "passport_registration", + "type": "personalDocument", + "description": "Passport registration pages" + } + ] + }, + { + "name": "passportElementTemporaryRegistration", + "description": "A Telegram Passport element containing the user's temporary registration", + "class": "PassportElement", + "properties": [ + { + "name": "temporary_registration", + "type": "personalDocument", + "description": "Temporary registration" + } + ] + }, + { + "name": "passportElementPhoneNumber", + "description": "A Telegram Passport element containing the user's phone number", + "class": "PassportElement", + "properties": [ + { + "name": "phone_number", + "type": "string", + "description": "Phone number" + } + ] + }, + { + "name": "passportElementEmailAddress", + "description": "A Telegram Passport element containing the user's email address", + "class": "PassportElement", + "properties": [ + { + "name": "email_address", + "type": "string", + "description": "Email address" + } + ] + }, + { + "name": "inputPassportElementPersonalDetails", + "description": "A Telegram Passport element to be saved containing the user's personal details", + "class": "InputPassportElement", + "properties": [ + { + "name": "personal_details", + "type": "personalDetails", + "description": "Personal details of the user" + } + ] + }, + { + "name": "inputPassportElementPassport", + "description": "A Telegram Passport element to be saved containing the user's passport", + "class": "InputPassportElement", + "properties": [ + { + "name": "passport", + "type": "inputIdentityDocument", + "description": "The passport to be saved" + } + ] + }, + { + "name": "inputPassportElementDriverLicense", + "description": "A Telegram Passport element to be saved containing the user's driver license", + "class": "InputPassportElement", + "properties": [ + { + "name": "driver_license", + "type": "inputIdentityDocument", + "description": "The driver license to be saved" + } + ] + }, + { + "name": "inputPassportElementIdentityCard", + "description": "A Telegram Passport element to be saved containing the user's identity card", + "class": "InputPassportElement", + "properties": [ + { + "name": "identity_card", + "type": "inputIdentityDocument", + "description": "The identity card to be saved" + } + ] + }, + { + "name": "inputPassportElementInternalPassport", + "description": "A Telegram Passport element to be saved containing the user's internal passport", + "class": "InputPassportElement", + "properties": [ + { + "name": "internal_passport", + "type": "inputIdentityDocument", + "description": "The internal passport to be saved" + } + ] + }, + { + "name": "inputPassportElementAddress", + "description": "A Telegram Passport element to be saved containing the user's address", + "class": "InputPassportElement", + "properties": [ + { + "name": "address", + "type": "address", + "description": "The address to be saved" + } + ] + }, + { + "name": "inputPassportElementUtilityBill", + "description": "A Telegram Passport element to be saved containing the user's utility bill", + "class": "InputPassportElement", + "properties": [ + { + "name": "utility_bill", + "type": "inputPersonalDocument", + "description": "The utility bill to be saved" + } + ] + }, + { + "name": "inputPassportElementBankStatement", + "description": "A Telegram Passport element to be saved containing the user's bank statement", + "class": "InputPassportElement", + "properties": [ + { + "name": "bank_statement", + "type": "inputPersonalDocument", + "description": "The bank statement to be saved" + } + ] + }, + { + "name": "inputPassportElementRentalAgreement", + "description": "A Telegram Passport element to be saved containing the user's rental agreement", + "class": "InputPassportElement", + "properties": [ + { + "name": "rental_agreement", + "type": "inputPersonalDocument", + "description": "The rental agreement to be saved" + } + ] + }, + { + "name": "inputPassportElementPassportRegistration", + "description": "A Telegram Passport element to be saved containing the user's passport registration", + "class": "InputPassportElement", + "properties": [ + { + "name": "passport_registration", + "type": "inputPersonalDocument", + "description": "The passport registration page to be saved" + } + ] + }, + { + "name": "inputPassportElementTemporaryRegistration", + "description": "A Telegram Passport element to be saved containing the user's temporary registration", + "class": "InputPassportElement", + "properties": [ + { + "name": "temporary_registration", + "type": "inputPersonalDocument", + "description": "The temporary registration document to be saved" + } + ] + }, + { + "name": "inputPassportElementPhoneNumber", + "description": "A Telegram Passport element to be saved containing the user's phone number", + "class": "InputPassportElement", + "properties": [ + { + "name": "phone_number", + "type": "string", + "description": "The phone number to be saved" + } + ] + }, + { + "name": "inputPassportElementEmailAddress", + "description": "A Telegram Passport element to be saved containing the user's email address", + "class": "InputPassportElement", + "properties": [ + { + "name": "email_address", + "type": "string", + "description": "The email address to be saved" + } + ] + }, + { + "name": "passportElements", + "description": "Contains information about saved Telegram Passport elements", + "class": "PassportElements", + "properties": [ + { + "name": "elements", + "type": "vector\u003cPassportElement\u003e", + "description": "Telegram Passport elements" + } + ] + }, + { + "name": "passportElementErrorSourceUnspecified", + "description": "The element contains an error in an unspecified place. The error will be considered resolved when new data is added", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceDataField", + "description": "One of the data fields contains an error. The error will be considered resolved when the value of the field changes", + "class": "PassportElementErrorSource", + "properties": [ + { + "name": "field_name", + "type": "string", + "description": "Field name" + } + ] + }, + { + "name": "passportElementErrorSourceFrontSide", + "description": "The front side of the document contains an error. The error will be considered resolved when the file with the front side changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceReverseSide", + "description": "The reverse side of the document contains an error. The error will be considered resolved when the file with the reverse side changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceSelfie", + "description": "The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceTranslationFile", + "description": "One of files with the translation of the document contains an error. The error will be considered resolved when the file changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceTranslationFiles", + "description": "The translation of the document contains an error. The error will be considered resolved when the list of translation files changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceFile", + "description": "The file contains an error. The error will be considered resolved when the file changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementErrorSourceFiles", + "description": "The list of attached files contains an error. The error will be considered resolved when the list of files changes", + "class": "PassportElementErrorSource", + "properties": [] + }, + { + "name": "passportElementError", + "description": "Contains the description of an error in a Telegram Passport element", + "class": "PassportElementError", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Type of the Telegram Passport element which has the error" + }, + { + "name": "message", + "type": "string", + "description": "Error message" + }, + { + "name": "source", + "type": "PassportElementErrorSource", + "description": "Error source" + } + ] + }, + { + "name": "passportSuitableElement", + "description": "Contains information about a Telegram Passport element that was requested by a service", + "class": "PassportSuitableElement", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Type of the element" + }, + { + "name": "is_selfie_required", + "type": "Bool", + "description": "True, if a selfie is required with the identity document" + }, + { + "name": "is_translation_required", + "type": "Bool", + "description": "True, if a certified English translation is required with the document" + }, + { + "name": "is_native_name_required", + "type": "Bool", + "description": "True, if personal details must include the user's name in the language of their country of residence" + } + ] + }, + { + "name": "passportRequiredElement", + "description": "Contains a description of the required Telegram Passport element that was requested by a service", + "class": "PassportRequiredElement", + "properties": [ + { + "name": "suitable_elements", + "type": "vector\u003cpassportSuitableElement\u003e", + "description": "List of Telegram Passport elements any of which is enough to provide" + } + ] + }, + { + "name": "passportAuthorizationForm", + "description": "Contains information about a Telegram Passport authorization form that was requested", + "class": "PassportAuthorizationForm", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Unique identifier of the authorization form" + }, + { + "name": "required_elements", + "type": "vector\u003cpassportRequiredElement\u003e", + "description": "Information about the Telegram Passport elements that need to be provided to complete the form" + }, + { + "name": "elements", + "type": "vector\u003cPassportElement\u003e", + "description": "Already available Telegram Passport elements" + }, + { + "name": "errors", + "type": "vector\u003cpassportElementError\u003e", + "description": "Errors in the elements that are already available" + }, + { + "name": "privacy_policy_url", + "type": "string", + "description": "URL for the privacy policy of the service; can be empty" + } + ] + }, + { + "name": "encryptedCredentials", + "description": "Contains encrypted Telegram Passport data credentials", + "class": "EncryptedCredentials", + "properties": [ + { + "name": "data", + "type": "bytes", + "description": "The encrypted credentials" + }, + { + "name": "hash", + "type": "bytes", + "description": "The decrypted data hash" + }, + { + "name": "secret", + "type": "bytes", + "description": "Secret for data decryption, encrypted with the service's public key" + } + ] + }, + { + "name": "encryptedPassportElement", + "description": "Contains information about an encrypted Telegram Passport element; for bots only", + "class": "EncryptedPassportElement", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Type of Telegram Passport element" + }, + { + "name": "data", + "type": "bytes", + "description": "Encrypted JSON-encoded data about the user" + }, + { + "name": "front_side", + "type": "datedFile", + "description": "The front side of an identity document" + }, + { + "name": "reverse_side", + "type": "datedFile", + "description": "The reverse side of an identity document; may be null" + }, + { + "name": "selfie", + "type": "datedFile", + "description": "Selfie with the document; may be null" + }, + { + "name": "translation", + "type": "vector\u003cdatedFile\u003e", + "description": "List of files containing a certified English translation of the document" + }, + { + "name": "files", + "type": "vector\u003cdatedFile\u003e", + "description": "List of attached files" + }, + { + "name": "value", + "type": "string", + "description": "Unencrypted data, phone number or email address" + }, + { + "name": "hash", + "type": "string", + "description": "Hash of the entire element" + } + ] + }, + { + "name": "inputPassportElementErrorSourceUnspecified", + "description": "The element contains an error in an unspecified place. The error will be considered resolved when new data is added", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "element_hash", + "type": "bytes", + "description": "Current hash of the entire element" + } + ] + }, + { + "name": "inputPassportElementErrorSourceDataField", + "description": "A data field contains an error. The error is considered resolved when the field's value changes", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "field_name", + "type": "string", + "description": "Field name" + }, + { + "name": "data_hash", + "type": "bytes", + "description": "Current data hash" + } + ] + }, + { + "name": "inputPassportElementErrorSourceFrontSide", + "description": "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", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hash", + "type": "bytes", + "description": "Current hash of the file containing the front side" + } + ] + }, + { + "name": "inputPassportElementErrorSourceReverseSide", + "description": "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", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hash", + "type": "bytes", + "description": "Current hash of the file containing the reverse side" + } + ] + }, + { + "name": "inputPassportElementErrorSourceSelfie", + "description": "The selfie contains an error. The error is considered resolved when the file with the selfie changes", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hash", + "type": "bytes", + "description": "Current hash of the file containing the selfie" + } + ] + }, + { + "name": "inputPassportElementErrorSourceTranslationFile", + "description": "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", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hash", + "type": "bytes", + "description": "Current hash of the file containing the translation" + } + ] + }, + { + "name": "inputPassportElementErrorSourceTranslationFiles", + "description": "The translation of the document contains an error. The error is considered resolved when the list of files changes", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hashes", + "type": "vector\u003cbytes\u003e", + "description": "Current hashes of all files with the translation" + } + ] + }, + { + "name": "inputPassportElementErrorSourceFile", + "description": "The file contains an error. The error is considered resolved when the file changes", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hash", + "type": "bytes", + "description": "Current hash of the file which has the error" + } + ] + }, + { + "name": "inputPassportElementErrorSourceFiles", + "description": "The list of attached files contains an error. The error is considered resolved when the file list changes", + "class": "InputPassportElementErrorSource", + "properties": [ + { + "name": "file_hashes", + "type": "vector\u003cbytes\u003e", + "description": "Current hashes of all attached files" + } + ] + }, + { + "name": "inputPassportElementError", + "description": "Contains the description of an error in a Telegram Passport element; for bots only", + "class": "InputPassportElementError", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Type of Telegram Passport element that has the error" + }, + { + "name": "message", + "type": "string", + "description": "Error message" + }, + { + "name": "source", + "type": "InputPassportElementErrorSource", + "description": "Error source" + } + ] + }, { "name": "messageText", "description": "A text message", @@ -4107,7 +5186,7 @@ { "name": "shipping_option_id", "type": "string", - "description": "Identifier of the shipping option chosen by the user, may be empty if not applicable" + "description": "Identifier of the shipping option chosen by the user; may be empty if not applicable" }, { "name": "order_info", @@ -4144,6 +5223,35 @@ } ] }, + { + "name": "messagePassportDataSent", + "description": "Telegram Passport data has been sent", + "class": "MessageContent", + "properties": [ + { + "name": "types", + "type": "vector\u003cPassportElementType\u003e", + "description": "List of Telegram Passport element types sent" + } + ] + }, + { + "name": "messagePassportDataReceived", + "description": "Telegram Passport data has been received; for bots only", + "class": "MessageContent", + "properties": [ + { + "name": "elements", + "type": "vector\u003cencryptedPassportElement\u003e", + "description": "List of received Telegram Passport elements" + }, + { + "name": "credentials", + "type": "encryptedCredentials", + "description": "Encrypted data credentials" + } + ] + }, { "name": "messageUnsupported", "description": "Message content that is not supported by the client", @@ -4230,7 +5338,7 @@ { "name": "url", "type": "string", - "description": "URL to be opened when the link is clicked" + "description": "HTTP or tg:// URL to be opened when the link is clicked" } ] }, @@ -4282,7 +5390,7 @@ { "name": "text", "type": "formattedText", - "description": "Formatted text to be sent. Only Bold, Italic, Code, Pre, PreCode and TextUrl entities are allowed to be specified manually" + "description": "Formatted text to be sent; 1-GetOption(\"message_text_length_max\") characters. Only Bold, Italic, Code, Pre, PreCode and TextUrl entities are allowed to be specified manually" }, { "name": "disable_web_page_preview", @@ -4329,7 +5437,7 @@ { "name": "caption", "type": "formattedText", - "description": "Animation caption; 0-200 characters" + "description": "Animation caption; 0-GetOption(\"message_caption_length_max\") characters" } ] }, @@ -4366,7 +5474,7 @@ { "name": "caption", "type": "formattedText", - "description": "Audio caption; 0-200 characters" + "description": "Audio caption; 0-GetOption(\"message_caption_length_max\") characters" } ] }, @@ -4388,7 +5496,7 @@ { "name": "caption", "type": "formattedText", - "description": "Document caption; 0-200 characters" + "description": "Document caption; 0-GetOption(\"message_caption_length_max\") characters" } ] }, @@ -4425,7 +5533,7 @@ { "name": "caption", "type": "formattedText", - "description": "Photo caption; 0-200 characters" + "description": "Photo caption; 0-GetOption(\"message_caption_length_max\") characters" }, { "name": "ttl", @@ -4504,7 +5612,7 @@ { "name": "caption", "type": "formattedText", - "description": "Video caption; 0-200 characters" + "description": "Video caption; 0-GetOption(\"message_caption_length_max\") characters" }, { "name": "ttl", @@ -4563,7 +5671,7 @@ { "name": "caption", "type": "formattedText", - "description": "Voice note caption; 0-200 characters" + "description": "Voice note caption; 0-GetOption(\"message_caption_length_max\") characters" } ] }, @@ -6724,6 +7832,129 @@ } ] }, + { + "name": "languagePackStringValueOrdinary", + "description": "An ordinary language pack string", + "class": "LanguagePackStringValue", + "properties": [ + { + "name": "value", + "type": "string", + "description": "String value" + } + ] + }, + { + "name": "languagePackStringValuePluralized", + "description": "A language pack string which has different forms based on the number of some object it mentions", + "class": "LanguagePackStringValue", + "properties": [ + { + "name": "zero_value", + "type": "string", + "description": "Value for zero objects" + }, + { + "name": "one_value", + "type": "string", + "description": "Value for one object" + }, + { + "name": "two_value", + "type": "string", + "description": "Value for two objects" + }, + { + "name": "few_value", + "type": "string", + "description": "Value for few objects" + }, + { + "name": "many_value", + "type": "string", + "description": "Value for many objects" + }, + { + "name": "other_value", + "type": "string", + "description": "Default value" + } + ] + }, + { + "name": "languagePackStringValueDeleted", + "description": "A deleted language pack string, the value should be taken from the built-in english language pack", + "class": "LanguagePackStringValue", + "properties": [] + }, + { + "name": "languagePackString", + "description": "Represents one language pack string", + "class": "LanguagePackString", + "properties": [ + { + "name": "key", + "type": "string", + "description": "String key" + }, + { + "name": "value", + "type": "LanguagePackStringValue", + "description": "String value" + } + ] + }, + { + "name": "languagePackStrings", + "description": "Contains a list of language pack strings", + "class": "LanguagePackStrings", + "properties": [ + { + "name": "strings", + "type": "vector\u003clanguagePackString\u003e", + "description": "A list of language pack strings" + } + ] + }, + { + "name": "languagePackInfo", + "description": "Contains information about a language pack", + "class": "LanguagePackInfo", + "properties": [ + { + "name": "id", + "type": "string", + "description": "Unique language pack identifier" + }, + { + "name": "name", + "type": "string", + "description": "Language name" + }, + { + "name": "native_name", + "type": "string", + "description": "Name of the language in that language" + }, + { + "name": "local_string_count", + "type": "int32", + "description": "Total number of non-deleted strings from the language pack available locally" + } + ] + }, + { + "name": "localizationTargetInfo", + "description": "Contains information about the current localization target", + "class": "LocalizationTargetInfo", + "properties": [ + { + "name": "language_packs", + "type": "vector\u003clanguagePackInfo\u003e", + "description": "List of available language packs for this application" + } + ] + }, { "name": "deviceTokenGoogleCloudMessaging", "description": "A token for Google Cloud Messaging", @@ -6732,7 +7963,7 @@ { "name": "token", "type": "string", - "description": "Device registration token, may be empty to de-register a device" + "description": "Device registration token; may be empty to de-register a device" } ] }, @@ -6744,7 +7975,7 @@ { "name": "device_token", "type": "string", - "description": "Device token, may be empty to de-register a device" + "description": "Device token; may be empty to de-register a device" }, { "name": "is_app_sandbox", @@ -6761,7 +7992,7 @@ { "name": "device_token", "type": "string", - "description": "Device token, may be empty to de-register a device" + "description": "Device token; may be empty to de-register a device" }, { "name": "is_app_sandbox", @@ -6778,7 +8009,7 @@ { "name": "access_token", "type": "string", - "description": "The access token that will be used to send notifications, may be empty to de-register a device" + "description": "The access token that will be used to send notifications; may be empty to de-register a device" } ] }, @@ -6790,7 +8021,7 @@ { "name": "channel_uri", "type": "string", - "description": "Push notification channel URI, may be empty to de-register a device" + "description": "Push notification channel URI; may be empty to de-register a device" } ] }, @@ -6802,7 +8033,7 @@ { "name": "channel_uri", "type": "string", - "description": "Push notification channel URI, may be empty to de-register a device" + "description": "Push notification channel URI; may be empty to de-register a device" } ] }, @@ -6814,7 +8045,7 @@ { "name": "endpoint", "type": "string", - "description": "Absolute URL exposed by the push service where the application server can send push messages, may be empty to de-register a device" + "description": "Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device" }, { "name": "p256dh_base64url", @@ -6836,7 +8067,7 @@ { "name": "endpoint", "type": "string", - "description": "Absolute URL exposed by the push service where the application server can send push messages, may be empty to de-register a device" + "description": "Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device" } ] }, @@ -6848,7 +8079,7 @@ { "name": "token", "type": "string", - "description": "Token, may be empty to de-register a device" + "description": "Token; may be empty to de-register a device" } ] }, @@ -6860,7 +8091,7 @@ { "name": "token", "type": "string", - "description": "Token, may be empty to de-register a device" + "description": "Token; may be empty to de-register a device" } ] }, @@ -6872,7 +8103,7 @@ { "name": "reg_id", "type": "string", - "description": "Push service registration identifier, may be empty to de-register a device" + "description": "Push service registration identifier; may be empty to de-register a device" } ] }, @@ -7267,6 +8498,12 @@ "class": "ChatReportReason", "properties": [] }, + { + "name": "chatReportReasonCopyright", + "description": "The chat contains copyrighted content", + "class": "ChatReportReason", + "properties": [] + }, { "name": "chatReportReasonCustom", "description": "A custom reason provided by the user", @@ -7338,6 +8575,18 @@ "class": "FileType", "properties": [] }, + { + "name": "fileTypeSecretThumbnail", + "description": "The file is a thumbnail of a file from a secret chat", + "class": "FileType", + "properties": [] + }, + { + "name": "fileTypeSecure", + "description": "The file is a file from Secure storage used for storing Telegram Passport files", + "class": "FileType", + "properties": [] + }, { "name": "fileTypeSticker", "description": "The file is a sticker", @@ -7380,12 +8629,6 @@ "class": "FileType", "properties": [] }, - { - "name": "fileTypeSecretThumbnail", - "description": "The file is a thumbnail of a file from a secret chat", - "class": "FileType", - "properties": [] - }, { "name": "storageStatisticsByFileType", "description": "Contains the storage usage statistics for a specific file type", @@ -7747,6 +8990,35 @@ } ] }, + { + "name": "seconds", + "description": "Contains a value representing a number of seconds", + "class": "Seconds", + "properties": [ + { + "name": "seconds", + "type": "double", + "description": "Number of seconds" + } + ] + }, + { + "name": "deepLinkInfo", + "description": "Contains information about a tg:// deep link", + "class": "DeepLinkInfo", + "properties": [ + { + "name": "text", + "type": "formattedText", + "description": "Text to be shown to the user" + }, + { + "name": "need_update_application", + "type": "Bool", + "description": "True, if user should be asked to update the application" + } + ] + }, { "name": "textParseModeMarkdown", "description": "The text should be parsed in markdown-style", @@ -7760,16 +9032,66 @@ "properties": [] }, { - "name": "proxyEmpty", - "description": "An empty proxy server", - "class": "Proxy", - "properties": [] + "name": "proxyTypeSocks5", + "description": "A SOCKS5 proxy server", + "class": "ProxyType", + "properties": [ + { + "name": "username", + "type": "string", + "description": "Username for logging in; may be empty" + }, + { + "name": "password", + "type": "string", + "description": "Password for logging in; may be empty" + } + ] }, { - "name": "proxySocks5", - "description": "A SOCKS5 proxy server", + "name": "proxyTypeHttp", + "description": "A HTTP transparent proxy server", + "class": "ProxyType", + "properties": [ + { + "name": "username", + "type": "string", + "description": "Username for logging in; may be empty" + }, + { + "name": "password", + "type": "string", + "description": "Password for logging in; may be empty" + }, + { + "name": "http_only", + "type": "Bool", + "description": "Pass true, if the proxy supports only HTTP requests and doesn't support transparent TCP connections via HTTP CONNECT method" + } + ] + }, + { + "name": "proxyTypeMtproto", + "description": "An MTProto proxy server", + "class": "ProxyType", + "properties": [ + { + "name": "secret", + "type": "string", + "description": "The proxy's secret in hexadecimal encoding" + } + ] + }, + { + "name": "proxy", + "description": "Contains information about a proxy server", "class": "Proxy", "properties": [ + { + "name": "id", + "type": "int32", + "description": "Unique identifier of the proxy" + }, { "name": "server", "type": "string", @@ -7781,14 +9103,31 @@ "description": "Proxy server port" }, { - "name": "username", - "type": "string", - "description": "Username for logging in" + "name": "last_used_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the proxy was last used; 0 if never" }, { - "name": "password", - "type": "string", - "description": "Password for logging in" + "name": "is_enabled", + "type": "Bool", + "description": "True, if the proxy is enabled now" + }, + { + "name": "type", + "type": "ProxyType", + "description": "Type of the proxy" + } + ] + }, + { + "name": "proxies", + "description": "Represents a list of proxy servers", + "class": "Proxies", + "properties": [ + { + "name": "proxies", + "type": "vector\u003cproxy\u003e", + "description": "List of proxy servers" } ] }, @@ -8126,6 +9465,62 @@ } ] }, + { + "name": "updateChatIsMarkedAsUnread", + "description": "A chat was marked as unread or was read", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "is_marked_as_unread", + "type": "Bool", + "description": "New value of is_marked_as_unread" + } + ] + }, + { + "name": "updateChatIsSponsored", + "description": "A chat's is_sponsored field has changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "is_sponsored", + "type": "Bool", + "description": "New value of is_sponsored" + }, + { + "name": "order", + "type": "int64", + "description": "New value of chat order" + } + ] + }, + { + "name": "updateChatDefaultDisableNotification", + "description": "The value of the default disable_notification parameter, used when a message is sent to the chat, was changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "default_disable_notification", + "type": "Bool", + "description": "The new default_disable_notification value" + } + ] + }, { "name": "updateChatReadInbox", "description": "Incoming messages were read or number of unread messages has been changed", @@ -8183,8 +9578,25 @@ ] }, { - "name": "updateNotificationSettings", - "description": "Notification settings for some chats were updated", + "name": "updateChatNotificationSettings", + "description": "Notification settings for a chat were changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "notification_settings", + "type": "chatNotificationSettings", + "description": "The new notification settings" + } + ] + }, + { + "name": "updateScopeNotificationSettings", + "description": "Notification settings for some type of chats were updated", "class": "Update", "properties": [ { @@ -8194,7 +9606,7 @@ }, { "name": "notification_settings", - "type": "notificationSettings", + "type": "scopeNotificationSettings", "description": "The new notification settings" } ] @@ -8218,7 +9630,7 @@ }, { "name": "updateChatDraftMessage", - "description": "A draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update shouldn't be applied", + "description": "A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update shouldn't be applied", "class": "Update", "properties": [ { @@ -8411,7 +9823,7 @@ { "name": "type", "type": "string", - "description": "Notification type" + "description": "Notification type. If type begins with \"AUTH_KEY_DROP_\", then two buttons \"Cancel\" and \"Log out\" should be shown under notification; if user presses the second, all local data should be destroyed using Destroy method" }, { "name": "content", @@ -8445,7 +9857,7 @@ { "name": "original_path", "type": "string", - "description": "The path to a file from which a new file is generated, may be empty" + "description": "The path to a file from which a new file is generated; may be empty" }, { "name": "destination_path", @@ -8455,7 +9867,7 @@ { "name": "conversion", "type": "string", - "description": "String specifying the conversion applied to the original file. If conversion is \"#url#\" than original_path contains a HTTP/HTTPS URL of a file, which should be downloaded by the client" + "description": "String specifying the conversion applied to the original file. If conversion is \"#url#\" than original_path contains an HTTP/HTTPS URL of a file, which should be downloaded by the client" } ] }, @@ -8517,6 +9929,33 @@ } ] }, + { + "name": "updateUnreadChatCount", + "description": "Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if a message database is used", + "class": "Update", + "properties": [ + { + "name": "unread_count", + "type": "int32", + "description": "Total number of unread chats" + }, + { + "name": "unread_unmuted_count", + "type": "int32", + "description": "Total number of unread unmuted chats" + }, + { + "name": "marked_as_unread_count", + "type": "int32", + "description": "Total number of chats marked as unread" + }, + { + "name": "marked_as_unread_unmuted_count", + "type": "int32", + "description": "Total number of unmuted chats marked as unread" + } + ] + }, { "name": "updateOption", "description": "An option changed its value", @@ -8604,6 +10043,28 @@ } ] }, + { + "name": "updateLanguagePackStrings", + "description": "Some language pack strings have been updated", + "class": "Update", + "properties": [ + { + "name": "localization_target", + "type": "string", + "description": "Localization target to which the language pack belongs" + }, + { + "name": "language_pack_id", + "type": "string", + "description": "Identifier of the updated language pack" + }, + { + "name": "strings", + "type": "vector\u003clanguagePackString\u003e", + "description": "List of changed language pack strings" + } + ] + }, { "name": "updateConnectionState", "description": "The connection state has changed", @@ -8616,6 +10077,23 @@ } ] }, + { + "name": "updateTermsOfService", + "description": "New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method should be called with the reason \"Decline ToS update\"", + "class": "Update", + "properties": [ + { + "name": "terms_of_service_id", + "type": "string", + "description": "Identifier of the terms of service" + }, + { + "name": "terms_of_service", + "type": "termsOfService", + "description": "The new terms of service" + } + ] + }, { "name": "updateNewInlineQuery", "description": "A new incoming inline query; for bots only", @@ -8771,7 +10249,7 @@ }, { "name": "shipping_address", - "type": "shippingAddress", + "type": "address", "description": "User shipping address" } ] @@ -8966,6 +10444,10 @@ "name": "ChatMemberStatus", "description": "Provides information about the status of a member in a chat" }, + { + "name": "ChatMembersFilter", + "description": "Specifies the kind of chat members to return in searchChatMembers" + }, { "name": "SupergroupMembersFilter", "description": "Specifies the kind of chat members to return in getSupergroupMembers" @@ -8984,7 +10466,7 @@ }, { "name": "NotificationSettingsScope", - "description": "Describes the types of chats for which notification settings are applied" + "description": "Describes the types of chats to which notification settings are applied" }, { "name": "ChatType", @@ -9014,6 +10496,26 @@ "name": "InputCredentials", "description": "Contains information about the payment method chosen by the user" }, + { + "name": "PassportElementType", + "description": "Contains the type of a Telegram Passport element" + }, + { + "name": "PassportElement", + "description": "Contains information about a Telegram Passport element" + }, + { + "name": "InputPassportElement", + "description": "Contains information about a Telegram Passport element to be saved" + }, + { + "name": "PassportElementErrorSource", + "description": "Contains the description of an error in a Telegram Passport element" + }, + { + "name": "InputPassportElementErrorSource", + "description": "Contains the description of an error in a Telegram Passport element; for bots only" + }, { "name": "MessageContent", "description": "Contains the content of a message" @@ -9062,6 +10564,10 @@ "name": "ChatEventAction", "description": "Represents a chat event" }, + { + "name": "LanguagePackStringValue", + "description": "Represents the value of a string in a language pack" + }, { "name": "DeviceToken", "description": "Represents a data needed to subscribe for push notifications. To use specific push notification service, you must specify the correct application platform and upload valid server authentication data at https://my.telegram.org" @@ -9115,8 +10621,8 @@ "description": "Describes the way the text should be parsed for TextEntities" }, { - "name": "Proxy", - "description": "Contains information about a proxy server" + "name": "ProxyType", + "description": "Describes the type of the proxy server" }, { "name": "Update", @@ -9364,7 +10870,7 @@ { "name": "requestPasswordRecovery", "description": "Requests to send a password recovery code to an email address that was previously set up", - "class": "PasswordRecoveryInfo", + "class": "EmailAddressAuthenticationCodeInfo", "properties": [], "is_synchronous": false }, @@ -9848,7 +11354,7 @@ { "name": "from_message_id", "type": "int53", - "description": "Identifier of the message starting from which history must be fetched; use 0 to get results from the beginning (i.e., from oldest to newest)" + "description": "Identifier of the message starting from which history must be fetched; use 0 to get results from the last message" }, { "name": "offset", @@ -9909,7 +11415,7 @@ { "name": "from_message_id", "type": "int53", - "description": "Identifier of the message starting from which history must be fetched; use 0 to get results from the beginning" + "description": "Identifier of the message starting from which history must be fetched; use 0 to get results from the last message" }, { "name": "offset", @@ -9942,7 +11448,7 @@ { "name": "offset_date", "type": "int32", - "description": "The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the beginning" + "description": "The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the last message" }, { "name": "offset_chat_id", @@ -9980,7 +11486,7 @@ { "name": "from_search_id", "type": "int64", - "description": "The identifier from the result of a previous request, use 0 to get results from the beginning" + "description": "The identifier from the result of a previous request, use 0 to get results from the last message" }, { "name": "limit", @@ -10003,7 +11509,7 @@ { "name": "from_message_id", "type": "int53", - "description": "Identifier of the message from which to search; use 0 to get results from the beginning" + "description": "Identifier of the message from which to search; use 0 to get results from the last message" }, { "name": "limit", @@ -10061,6 +11567,29 @@ ], "is_synchronous": false }, + { + "name": "getChatMessageCount", + "description": "Returns approximate number of messages of the specified type in the chat", + "class": "Count", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat in which to count messages" + }, + { + "name": "filter", + "type": "SearchMessagesFilter", + "description": "Filter for message content; searchMessagesFilterEmpty is unsupported in this function" + }, + { + "name": "return_local", + "type": "Bool", + "description": "If true, returns count that is available locally without sending network requests, returning -1 if the number of messages is unknown" + } + ], + "is_synchronous": false + }, { "name": "getPublicMessageLink", "description": "Returns a public HTTPS link to a message. Available only for messages in public supergroups and channels", @@ -10285,6 +11814,39 @@ ], "is_synchronous": false }, + { + "name": "addLocalMessage", + "description": "Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Target chat" + }, + { + "name": "sender_user_id", + "type": "int32", + "description": "Identifier of the user who will be shown as the sender of the message; may be 0 for channel posts" + }, + { + "name": "reply_to_message_id", + "type": "int53", + "description": "Identifier of the message to reply to or 0" + }, + { + "name": "disable_notification", + "type": "Bool", + "description": "Pass true to disable notification for the message" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "The content of the message to be added" + } + ], + "is_synchronous": false + }, { "name": "deleteMessages", "description": "Deletes messages", @@ -10328,7 +11890,7 @@ }, { "name": "editMessageText", - "description": "Edits the text of a message (or a text of a game message). Non-bot users can edit messages for a limited period of time. Returns the edited message after the edit is completed on the server side", + "description": "Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side", "class": "Message", "properties": [ { @@ -10356,7 +11918,7 @@ }, { "name": "editMessageLiveLocation", - "description": "Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed server-side", + "description": "Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side", "class": "Message", "properties": [ { @@ -10372,7 +11934,7 @@ { "name": "reply_markup", "type": "ReplyMarkup", - "description": "Tew message reply markup; for bots only" + "description": "The new message reply markup; for bots only" }, { "name": "location", @@ -10382,9 +11944,37 @@ ], "is_synchronous": false }, + { + "name": "editMessageMedia", + "description": "Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can't be replaced if the message was set to self-destruct. Media can't be replaced by self-destructing media. Media in an album can be edited only to contain a photo or a video. Returns the edited message after the edit is completed on the server side", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "The chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup; for bots only" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo" + } + ], + "is_synchronous": false + }, { "name": "editMessageCaption", - "description": "Edits the message content caption. Non-bots can edit messages for a limited period of time. Returns the edited message after the edit is completed server-side", + "description": "Edits the message content caption. Returns the edited message after the edit is completed on the server side", "class": "Message", "properties": [ { @@ -10405,14 +11995,14 @@ { "name": "caption", "type": "formattedText", - "description": "New message content caption; 0-200 characters" + "description": "New message content caption; 0-GetOption(\"message_caption_length_max\") characters" } ], "is_synchronous": false }, { "name": "editMessageReplyMarkup", - "description": "Edits the message reply markup; for bots only. Returns the edited message after the edit is completed server-side", + "description": "Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side", "class": "Message", "properties": [ { @@ -10428,7 +12018,7 @@ { "name": "reply_markup", "type": "ReplyMarkup", - "description": "New message reply markup" + "description": "The new message reply markup" } ], "is_synchronous": false @@ -10446,7 +12036,7 @@ { "name": "reply_markup", "type": "ReplyMarkup", - "description": "New message reply markup" + "description": "The new message reply markup" }, { "name": "input_message_content", @@ -10469,7 +12059,7 @@ { "name": "reply_markup", "type": "ReplyMarkup", - "description": "New message reply markup" + "description": "The new message reply markup" }, { "name": "location", @@ -10479,6 +12069,29 @@ ], "is_synchronous": false }, + { + "name": "editInlineMessageMedia", + "description": "Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only", + "class": "Ok", + "properties": [ + { + "name": "inline_message_id", + "type": "string", + "description": "Inline message identifier" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup; for bots only" + }, + { + "name": "input_message_content", + "type": "InputMessageContent", + "description": "New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo" + } + ], + "is_synchronous": false + }, { "name": "editInlineMessageCaption", "description": "Edits the caption of an inline message sent via a bot; for bots only", @@ -10492,12 +12105,12 @@ { "name": "reply_markup", "type": "ReplyMarkup", - "description": "New message reply markup" + "description": "The new message reply markup" }, { "name": "caption", "type": "formattedText", - "description": "New message content caption; 0-200 characters" + "description": "New message content caption; 0-GetOption(\"message_caption_length_max\") characters" } ], "is_synchronous": false @@ -10515,7 +12128,7 @@ { "name": "reply_markup", "type": "ReplyMarkup", - "description": "New message reply markup" + "description": "The new message reply markup" } ], "is_synchronous": false @@ -10577,6 +12190,47 @@ ], "is_synchronous": true }, + { + "name": "cleanFileName", + "description": "Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "Text", + "properties": [ + { + "name": "file_name", + "type": "string", + "description": "File name or path to the file" + } + ], + "is_synchronous": true + }, + { + "name": "getLanguagePackString", + "description": "Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "LanguagePackStringValue", + "properties": [ + { + "name": "language_pack_database_path", + "type": "string", + "description": "Path to the language pack database in which strings are stored" + }, + { + "name": "localization_target", + "type": "string", + "description": "Localization target to which the language pack belongs" + }, + { + "name": "language_pack_id", + "type": "string", + "description": "Language pack identifier" + }, + { + "name": "key", + "type": "string", + "description": "Language pack key of the string to be returned" + } + ], + "is_synchronous": true + }, { "name": "getInlineQueryResults", "description": "Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires", @@ -11166,6 +12820,24 @@ ], "is_synchronous": false }, + { + "name": "setChatNotificationSettings", + "description": "Changes the notification settings of a chat", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "notification_settings", + "type": "chatNotificationSettings", + "description": "New notification settings for the chat" + } + ], + "is_synchronous": false + }, { "name": "toggleChatIsPinned", "description": "Changes the pinned state of a chat. You can pin up to GetOption(\"pinned_chat_count_max\") non-secret chats and the same number of secret chats", @@ -11184,6 +12856,42 @@ ], "is_synchronous": false }, + { + "name": "toggleChatIsMarkedAsUnread", + "description": "Changes the marked as unread state of a chat", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "is_marked_as_unread", + "type": "Bool", + "description": "New value of is_marked_as_unread" + } + ], + "is_synchronous": false + }, + { + "name": "toggleChatDefaultDisableNotification", + "description": "Changes the value of the default disable_notification parameter, used when a message is sent to a chat", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "default_disable_notification", + "type": "Bool", + "description": "New value of default_disable_notification" + } + ], + "is_synchronous": false + }, { "name": "setChatClientData", "description": "Changes client data associated with a chat", @@ -11202,6 +12910,32 @@ ], "is_synchronous": false }, + { + "name": "joinChat", + "description": "Adds current user as a new member to a chat. Private and secret chats can't be joined using this method", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false + }, + { + "name": "leaveChat", + "description": "Removes current user from chat members. Private and secret chats can't be left using this method", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + } + ], + "is_synchronous": false + }, { "name": "addChatMember", "description": "Adds a new member to a chat. Members can't be added to private or secret chats. Members will not be added until the chat state has been synchronized with the server", @@ -11303,6 +13037,11 @@ "name": "limit", "type": "int32", "description": "The maximum number of users to be returned" + }, + { + "name": "filter", + "type": "ChatMembersFilter", + "description": "The type of users to return. By default, chatMembersFilterMembers" } ], "is_synchronous": false @@ -11320,6 +13059,57 @@ ], "is_synchronous": false }, + { + "name": "clearAllDraftMessages", + "description": "Clears draft messages in all chats", + "class": "Ok", + "properties": [ + { + "name": "exclude_secret_chats", + "type": "Bool", + "description": "If true, local draft messages in secret chats will not be cleared" + } + ], + "is_synchronous": false + }, + { + "name": "getScopeNotificationSettings", + "description": "Returns the notification settings for chats of a given type", + "class": "ScopeNotificationSettings", + "properties": [ + { + "name": "scope", + "type": "NotificationSettingsScope", + "description": "Types of chats for which to return the notification settings information" + } + ], + "is_synchronous": false + }, + { + "name": "setScopeNotificationSettings", + "description": "Changes notification settings for chats of a given type", + "class": "Ok", + "properties": [ + { + "name": "scope", + "type": "NotificationSettingsScope", + "description": "Types of chats for which to change the notification settings" + }, + { + "name": "notification_settings", + "type": "scopeNotificationSettings", + "description": "The new notification settings for the given scope" + } + ], + "is_synchronous": false + }, + { + "name": "resetAllNotificationSettings", + "description": "Resets all notification settings to their default values. By default, all chats are unmuted, the sound is set to \"default\" and message previews are shown", + "class": "Ok", + "properties": [], + "is_synchronous": false + }, { "name": "setPinnedChats", "description": "Changes the order of pinned chats", @@ -11655,11 +13445,18 @@ { "name": "contacts", "type": "vector\u003ccontact\u003e", - "description": "The list of contacts to import or edit" + "description": "The list of contacts to import or edit, contact's vCard are ignored and are not imported" } ], "is_synchronous": false }, + { + "name": "getContacts", + "description": "Returns all user contacts", + "class": "Users", + "properties": [], + "is_synchronous": false + }, { "name": "searchContacts", "description": "Searches for the specified query in the first names, last names and usernames of the known user contacts", @@ -11706,14 +13503,14 @@ { "name": "contacts", "type": "vector\u003ccontact\u003e", - "description": "The new list of contacts" + "description": "The new list of contacts, contact's vCard are ignored and are not imported" } ], "is_synchronous": false }, { "name": "clearImportedContacts", - "description": "Clears all imported contacts", + "description": "Clears all imported contacts, contacts list remains unchanged", "class": "Ok", "properties": [], "is_synchronous": false @@ -12159,44 +13956,6 @@ ], "is_synchronous": false }, - { - "name": "getNotificationSettings", - "description": "Returns the notification settings for a given scope", - "class": "NotificationSettings", - "properties": [ - { - "name": "scope", - "type": "NotificationSettingsScope", - "description": "Scope for which to return the notification settings information" - } - ], - "is_synchronous": false - }, - { - "name": "setNotificationSettings", - "description": "Changes notification settings for a given scope", - "class": "Ok", - "properties": [ - { - "name": "scope", - "type": "NotificationSettingsScope", - "description": "Scope for which to change the notification settings" - }, - { - "name": "notification_settings", - "type": "notificationSettings", - "description": "The new notification settings for the given scope" - } - ], - "is_synchronous": false - }, - { - "name": "resetAllNotificationSettings", - "description": "Resets all notification settings to their default values. By default, the only muted chats are supergroups, the sound is set to \"default\" and message previews are shown", - "class": "Ok", - "properties": [], - "is_synchronous": false - }, { "name": "setProfilePhoto", "description": "Uploads a new profile photo for the current user. If something changes, updateUser will be sent", @@ -12528,7 +14287,7 @@ }, { "name": "reportSupergroupSpam", - "description": "Reports some messages from a user in a supergroup as spam", + "description": "Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup", "class": "Ok", "properties": [ { @@ -12773,6 +14532,99 @@ "properties": [], "is_synchronous": false }, + { + "name": "getLocalizationTargetInfo", + "description": "Returns information about the current localization target. This is an offline request if only_local is true", + "class": "LocalizationTargetInfo", + "properties": [ + { + "name": "only_local", + "type": "Bool", + "description": "If true, returns only locally available information without sending network requests" + } + ], + "is_synchronous": false + }, + { + "name": "getLanguagePackStrings", + "description": "Returns strings from a language pack in the current localization target by their keys", + "class": "LanguagePackStrings", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Language pack identifier of the strings to be returned" + }, + { + "name": "keys", + "type": "vector\u003cstring\u003e", + "description": "Language pack keys of the strings to be returned; leave empty to request all available strings" + } + ], + "is_synchronous": false + }, + { + "name": "setCustomLanguagePack", + "description": "Adds or changes a custom language pack to the current localization target", + "class": "Ok", + "properties": [ + { + "name": "info", + "type": "languagePackInfo", + "description": "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" + }, + { + "name": "strings", + "type": "vector\u003clanguagePackString\u003e", + "description": "Strings of the new language pack" + } + ], + "is_synchronous": false + }, + { + "name": "editCustomLanguagePackInfo", + "description": "Edits information about a custom language pack in the current localization target", + "class": "Ok", + "properties": [ + { + "name": "info", + "type": "languagePackInfo", + "description": "New information about the custom language pack" + } + ], + "is_synchronous": false + }, + { + "name": "setCustomLanguagePackString", + "description": "Adds, edits or deletes a string in a custom language pack", + "class": "Ok", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Identifier of a previously added custom language pack in the current localization target" + }, + { + "name": "new_string", + "type": "languagePackString", + "description": "New language pack string" + } + ], + "is_synchronous": false + }, + { + "name": "deleteLanguagePack", + "description": "Deletes all information about a language pack in the current localization target. The language pack that is currently in use can't be deleted", + "class": "Ok", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Identifier of the language pack to delete" + } + ], + "is_synchronous": false + }, { "name": "registerDevice", "description": "Registers the currently used device for receiving push notifications", @@ -12888,7 +14740,7 @@ }, { "name": "deleteAccount", - "description": "Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account", + "description": "Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account. Can be called before authorization when the current authorization state is authorizationStateWaitPassword", "class": "Ok", "properties": [ { @@ -13067,6 +14919,274 @@ "properties": [], "is_synchronous": false }, + { + "name": "getPassportElement", + "description": "Returns one of the available Telegram Passport elements", + "class": "PassportElement", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Telegram Passport element type" + }, + { + "name": "password", + "type": "string", + "description": "Password of the current user" + } + ], + "is_synchronous": false + }, + { + "name": "getAllPassportElements", + "description": "Returns all available Telegram Passport elements", + "class": "PassportElements", + "properties": [ + { + "name": "password", + "type": "string", + "description": "Password of the current user" + } + ], + "is_synchronous": false + }, + { + "name": "setPassportElement", + "description": "Adds an element to the user's Telegram Passport. May return an error with a message \"PHONE_VERIFICATION_NEEDED\" or \"EMAIL_VERIFICATION_NEEDED\" if the chosen phone number or the chosen email address must be verified first", + "class": "PassportElement", + "properties": [ + { + "name": "element", + "type": "InputPassportElement", + "description": "Input Telegram Passport element" + }, + { + "name": "password", + "type": "string", + "description": "Password of the current user" + } + ], + "is_synchronous": false + }, + { + "name": "deletePassportElement", + "description": "Deletes a Telegram Passport element", + "class": "Ok", + "properties": [ + { + "name": "type", + "type": "PassportElementType", + "description": "Element type" + } + ], + "is_synchronous": false + }, + { + "name": "setPassportElementErrors", + "description": "Informs the user that some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed", + "class": "Ok", + "properties": [ + { + "name": "user_id", + "type": "int32", + "description": "User identifier" + }, + { + "name": "errors", + "type": "vector\u003cinputPassportElementError\u003e", + "description": "The errors" + } + ], + "is_synchronous": false + }, + { + "name": "getPreferredCountryLanguage", + "description": "Returns an IETF language tag of the language preferred in the country, which should be used to fill native fields in Telegram Passport personal details. Returns a 404 error if unknown", + "class": "Text", + "properties": [ + { + "name": "country_code", + "type": "string", + "description": "A two-letter ISO 3166-1 alpha-2 country code" + } + ], + "is_synchronous": false + }, + { + "name": "sendPhoneNumberVerificationCode", + "description": "Sends a code to verify a phone number to be added to a user's Telegram Passport", + "class": "AuthenticationCodeInfo", + "properties": [ + { + "name": "phone_number", + "type": "string", + "description": "The phone number of the user, in international format" + }, + { + "name": "allow_flash_call", + "type": "Bool", + "description": "Pass true if the authentication code may be sent via flash call to the specified phone number" + }, + { + "name": "is_current_phone_number", + "type": "Bool", + "description": "Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false" + } + ], + "is_synchronous": false + }, + { + "name": "resendPhoneNumberVerificationCode", + "description": "Re-sends the code to verify a phone number to be added to a user's Telegram Passport", + "class": "AuthenticationCodeInfo", + "properties": [], + "is_synchronous": false + }, + { + "name": "checkPhoneNumberVerificationCode", + "description": "Checks the phone number verification code for Telegram Passport", + "class": "Ok", + "properties": [ + { + "name": "code", + "type": "string", + "description": "Verification code" + } + ], + "is_synchronous": false + }, + { + "name": "sendEmailAddressVerificationCode", + "description": "Sends a code to verify an email address to be added to a user's Telegram Passport", + "class": "EmailAddressAuthenticationCodeInfo", + "properties": [ + { + "name": "email_address", + "type": "string", + "description": "Email address" + } + ], + "is_synchronous": false + }, + { + "name": "resendEmailAddressVerificationCode", + "description": "Re-sends the code to verify an email address to be added to a user's Telegram Passport", + "class": "EmailAddressAuthenticationCodeInfo", + "properties": [], + "is_synchronous": false + }, + { + "name": "checkEmailAddressVerificationCode", + "description": "Checks the email address verification code for Telegram Passport", + "class": "Ok", + "properties": [ + { + "name": "code", + "type": "string", + "description": "Verification code" + } + ], + "is_synchronous": false + }, + { + "name": "getPassportAuthorizationForm", + "description": "Returns a Telegram Passport authorization form for sharing data with a service", + "class": "PassportAuthorizationForm", + "properties": [ + { + "name": "bot_user_id", + "type": "int32", + "description": "User identifier of the service's bot" + }, + { + "name": "scope", + "type": "string", + "description": "Telegram Passport element types requested by the service" + }, + { + "name": "public_key", + "type": "string", + "description": "Service's public_key" + }, + { + "name": "nonce", + "type": "string", + "description": "Authorization form nonce provided by the service" + }, + { + "name": "password", + "type": "string", + "description": "Password of the current user" + } + ], + "is_synchronous": false + }, + { + "name": "sendPassportAuthorizationForm", + "description": "Sends a Telegram Passport authorization form, effectively sharing data with the service", + "class": "Ok", + "properties": [ + { + "name": "autorization_form_id", + "type": "int32", + "description": "Authorization form identifier" + }, + { + "name": "types", + "type": "vector\u003cPassportElementType\u003e", + "description": "Types of Telegram Passport elements chosen by user to complete the authorization form" + } + ], + "is_synchronous": false + }, + { + "name": "sendPhoneNumberConfirmationCode", + "description": "Sends phone number confirmation code. Should be called when user presses \"https://t.me/confirmphone?phone=*******\u0026hash=**********\" or \"tg://confirmphone?phone=*******\u0026hash=**********\" link", + "class": "AuthenticationCodeInfo", + "properties": [ + { + "name": "hash", + "type": "string", + "description": "Value of the \"hash\" parameter from the link" + }, + { + "name": "phone_number", + "type": "string", + "description": "Value of the \"phone\" parameter from the link" + }, + { + "name": "allow_flash_call", + "type": "Bool", + "description": "Pass true if the authentication code may be sent via flash call to the specified phone number" + }, + { + "name": "is_current_phone_number", + "type": "Bool", + "description": "Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false" + } + ], + "is_synchronous": false + }, + { + "name": "resendPhoneNumberConfirmationCode", + "description": "Resends phone number confirmation code", + "class": "AuthenticationCodeInfo", + "properties": [], + "is_synchronous": false + }, + { + "name": "checkPhoneNumberConfirmationCode", + "description": "Checks phone number confirmation code", + "class": "Ok", + "properties": [ + { + "name": "code", + "type": "string", + "description": "The phone number confirmation code" + } + ], + "is_synchronous": false + }, { "name": "setBotUpdatesStatus", "description": "Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only", @@ -13190,6 +15310,57 @@ ], "is_synchronous": false }, + { + "name": "getMapThumbnailFile", + "description": "Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded", + "class": "File", + "properties": [ + { + "name": "location", + "type": "location", + "description": "Location of the map center" + }, + { + "name": "zoom", + "type": "int32", + "description": "Map zoom level; 13-20" + }, + { + "name": "width", + "type": "int32", + "description": "Map width in pixels before applying scale; 16-1024" + }, + { + "name": "height", + "type": "int32", + "description": "Map height in pixels before applying scale; 16-1024" + }, + { + "name": "scale", + "type": "int32", + "description": "Map scale; 1-3" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of a chat, in which the thumbnail will be shown. Use 0 if unknown" + } + ], + "is_synchronous": false + }, + { + "name": "acceptTermsOfService", + "description": "Accepts Telegram terms of services", + "class": "Ok", + "properties": [ + { + "name": "terms_of_service_id", + "type": "string", + "description": "Terms of service identifier" + } + ], + "is_synchronous": false + }, { "name": "sendCustomRequest", "description": "Sends a custom request; for bots only", @@ -13228,7 +15399,7 @@ }, { "name": "setAlarm", - "description": "Succeeds after a specified amount of time has passed. Can be called before authorization", + "description": "Succeeds after a specified amount of time has passed. Can be called before authorization. Can be called before initialization", "class": "Ok", "properties": [ { @@ -13254,32 +15425,145 @@ "is_synchronous": false }, { - "name": "getTermsOfService", - "description": "Returns the terms of service. Can be called before authorization", - "class": "Text", - "properties": [], - "is_synchronous": false - }, - { - "name": "setProxy", - "description": "Sets the proxy server for network requests. Can be called before authorization", - "class": "Ok", + "name": "getDeepLinkInfo", + "description": "Returns information about a tg:// deep link. Use \"tg://need_update_for_some_feature\" or \"tg:some_unsupported_feature\" for testing. Returns a 404 error for unknown links. Can be called before authorization", + "class": "DeepLinkInfo", "properties": [ { - "name": "proxy", - "type": "Proxy", - "description": "Proxy server to use. Specify null to remove the proxy server" + "name": "link", + "type": "string", + "description": "The link" } ], "is_synchronous": false }, { - "name": "getProxy", - "description": "Returns the proxy that is currently set up. Can be called before authorization", + "name": "addProxy", + "description": "Adds a proxy server for network requests. Can be called before authorization", "class": "Proxy", + "properties": [ + { + "name": "server", + "type": "string", + "description": "Proxy server IP address" + }, + { + "name": "port", + "type": "int32", + "description": "Proxy server port" + }, + { + "name": "enable", + "type": "Bool", + "description": "True, if the proxy should be enabled" + }, + { + "name": "type", + "type": "ProxyType", + "description": "Proxy type" + } + ], + "is_synchronous": false + }, + { + "name": "editProxy", + "description": "Edits an existing proxy server for network requests. Can be called before authorization", + "class": "Proxy", + "properties": [ + { + "name": "proxy_id", + "type": "int32", + "description": "Proxy identifier" + }, + { + "name": "server", + "type": "string", + "description": "Proxy server IP address" + }, + { + "name": "port", + "type": "int32", + "description": "Proxy server port" + }, + { + "name": "enable", + "type": "Bool", + "description": "True, if the proxy should be enabled" + }, + { + "name": "type", + "type": "ProxyType", + "description": "Proxy type" + } + ], + "is_synchronous": false + }, + { + "name": "enableProxy", + "description": "Enables a proxy. Only one proxy can be enabled at a time. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "proxy_id", + "type": "int32", + "description": "Proxy identifier" + } + ], + "is_synchronous": false + }, + { + "name": "disableProxy", + "description": "Disables the currently enabled proxy. Can be called before authorization", + "class": "Ok", "properties": [], "is_synchronous": false }, + { + "name": "removeProxy", + "description": "Removes a proxy server. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "proxy_id", + "type": "int32", + "description": "Proxy identifier" + } + ], + "is_synchronous": false + }, + { + "name": "getProxies", + "description": "Returns list of proxies that are currently set up. Can be called before authorization", + "class": "Proxies", + "properties": [], + "is_synchronous": false + }, + { + "name": "getProxyLink", + "description": "Returns an HTTPS link, which can be used to add a proxy. Available only for SOCKS5 and MTProto proxies. Can be called before authorization", + "class": "Text", + "properties": [ + { + "name": "proxy_id", + "type": "int32", + "description": "Proxy identifier" + } + ], + "is_synchronous": false + }, + { + "name": "pingProxy", + "description": "Computes time needed to receive a response from a Telegram server through a proxy. Can be called before authorization", + "class": "Seconds", + "properties": [ + { + "name": "proxy_id", + "type": "int32", + "description": "Proxy identifier. Use 0 to ping a Telegram server without a proxy" + } + ], + "is_synchronous": false + }, { "name": "testCallEmpty", "description": "Does nothing; for testing only", diff --git a/data/td_api.tl b/data/td_api.tl index 2e7008e..dcb1e0b 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -59,6 +59,23 @@ authenticationCodeTypeFlashCall pattern:string = AuthenticationCodeType; //@description Information about the authentication code that was sent @phone_number A phone number that is being authenticated @type Describes the way the code was sent to the user @next_type Describes the way the next code will be sent to the user; may be null @timeout Timeout before the code should be re-sent, in seconds authenticationCodeInfo phone_number:string type:AuthenticationCodeType next_type:AuthenticationCodeType timeout:int32 = AuthenticationCodeInfo; +//@description Information about the email address authentication code that was sent @email_address_pattern Pattern of the email address to which an authentication code was sent @length Length of the code; 0 if unknown +emailAddressAuthenticationCodeInfo email_address_pattern:string length:int32 = EmailAddressAuthenticationCodeInfo; + + +//@description Represents a part of the text that needs to be formatted in some unusual way @offset Offset of the entity in UTF-16 code points @length Length of the entity, in UTF-16 code points @type Type of the entity +textEntity offset:int32 length:int32 type:TextEntityType = TextEntity; + +//@description Contains a list of text entities @entities List of text entities +textEntities entities:vector = TextEntities; + +//@description A text with some entities @text The text @entities Entities contained in the text +formattedText text:string entities:vector = FormattedText; + + +//@description Contains Telegram terms of service @text Text of the terms of service @min_user_age Mininum age of a user to be able to accept the terms; 0 if any @show_popup True, if a blocking popup with terms of service must be shown to the user +termsOfService text:formattedText min_user_age:int32 show_popup:Bool = TermsOfService; + //@class AuthorizationState @description Represents the current authorization state of the client @@ -71,8 +88,8 @@ authorizationStateWaitEncryptionKey is_encrypted:Bool = AuthorizationState; //@description TDLib needs the user's phone number to authorize authorizationStateWaitPhoneNumber = AuthorizationState; -//@description TDLib needs the user's authentication code to finalize authorization @is_registered True, if the user is already registered @code_info Information about the authorization code that was sent -authorizationStateWaitCode is_registered:Bool code_info:authenticationCodeInfo = AuthorizationState; +//@description TDLib needs the user's authentication code to finalize authorization @is_registered True, if the user is already registered @terms_of_service Telegram terms of service, which should be accepted before user can continue registration; may be null @code_info Information about the authorization code that was sent +authorizationStateWaitCode is_registered:Bool terms_of_service:termsOfService code_info:authenticationCodeInfo = AuthorizationState; //@description The user has been authorized, but needs to enter a password to start using the application @password_hint Hint for the password; can be empty @has_recovery_email_address True if a recovery email address has been set up //@recovery_email_address_pattern Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent @@ -92,11 +109,8 @@ authorizationStateClosing = AuthorizationState; authorizationStateClosed = AuthorizationState; -//@description Represents the current state of 2-step verification @has_password True if a 2-step verification password has been set up @password_hint Hint for the password; can be empty @has_recovery_email_address True if a recovery email has been set up @unconfirmed_recovery_email_address_pattern Pattern of the email address to which a confirmation email was sent -passwordState has_password:Bool password_hint:string has_recovery_email_address:Bool unconfirmed_recovery_email_address_pattern:string = PasswordState; - -//@description Contains information available to the user after requesting password recovery @recovery_email_address_pattern Pattern of the email address to which a recovery email was sent -passwordRecoveryInfo recovery_email_address_pattern:string = PasswordRecoveryInfo; +//@description Represents the current state of 2-step verification @has_password True if a 2-step verification password is set @password_hint Hint for the password; can be empty @has_recovery_email_address True if a recovery email is set @has_passport_data True if some Telegram Passport elements were saved @unconfirmed_recovery_email_address_pattern Pattern of the email address to which the confirmation email was sent +passwordState has_password:Bool password_hint:string has_recovery_email_address:Bool has_passport_data:Bool unconfirmed_recovery_email_address_pattern:string = PasswordState; //@description Contains information about the current recovery email address @recovery_email_address Recovery email address recoveryEmailAddress recovery_email_address:string = RecoveryEmailAddress; @@ -117,7 +131,7 @@ temporaryPasswordState has_password:Bool valid_for:int32 = TemporaryPasswordStat localFile path:string can_be_downloaded:Bool can_be_deleted:Bool is_downloading_active:Bool is_downloading_completed:Bool downloaded_prefix_size:int32 downloaded_size:int32 = LocalFile; //@description Represents a remote file -//@id Remote file identifier, may be empty. Can be used across application restarts or even from other devices for the current user. 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. +//@id Remote file identifier; may be empty. Can be used across application restarts or even from other devices for the current user. 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 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 client with the HTTP URL in the original_path and "#url#" as the conversion string. Clients should generate the file by downloading it to the specified location //@is_uploading_active True, if the file is currently being uploaded (or a remote copy is being generated by some other means) //@is_uploading_completed True, if a remote copy is fully available @@ -144,7 +158,7 @@ inputFileRemote id:string = InputFile; //@description A file defined by a local path @path Local path to the file inputFileLocal path:string = InputFile; -//@description A file generated by the client @original_path Local path to a file from which the file is generated, may be empty if there is no such file @conversion String specifying the conversion applied to the original file; should be persistent across application restarts @expected_size Expected size of the generated file; 0 if unknown +//@description A file generated by the client @original_path Local path to a file from which the file is generated; may be empty if there is no such file @conversion String specifying the conversion applied to the original file; should be persistent across application restarts @expected_size Expected size of the generated file; 0 if unknown inputFileGenerated original_path:string conversion:string expected_size:int32 = InputFile; @@ -173,16 +187,6 @@ maskPointChin = MaskPoint; maskPosition point:MaskPoint x_shift:double y_shift:double scale:double = MaskPosition; -//@description Represents a part of the text that needs to be formatted in some unusual way @offset Offset of the entity in UTF-16 code points @length Length of the entity, in UTF-16 code points @type Type of the entity -textEntity offset:int32 length:int32 type:TextEntityType = TextEntity; - -//@description Contains a list of text entities @entities List of text entities -textEntities entities:vector = TextEntities; - -//@description A text with some entities @text The text @entities Entities contained in the text -formattedText text:string entities:vector = FormattedText; - - //@description Describes an animation file. The animation must be encoded in GIF or MPEG4 format @duration Duration of the animation, in seconds; as defined by the sender @width Width of the animation @height Height of the animation //@file_name Original name of the file; as defined by the sender @mime_type MIME type of the file, usually "image/gif" or "video/mp4" @thumbnail Animation thumbnail; may be null @animation File containing the animation animation duration:int32 width:int32 height:int32 file_name:string mime_type:string thumbnail:photoSize animation:file = Animation; @@ -214,15 +218,15 @@ videoNote duration:int32 length:int32 thumbnail:photoSize video:file = VideoNote //@waveform A waveform representation of the voice note in 5-bit format @mime_type MIME type of the file; as defined by the sender @voice File containing the voice note voiceNote duration:int32 waveform:bytes mime_type:string voice:file = VoiceNote; -//@description Describes a user contact @phone_number Phone number of the user @first_name First name of the user; 1-255 characters in length @last_name Last name of the user @user_id Identifier of the user, if known; otherwise 0 -contact phone_number:string first_name:string last_name:string user_id:int32 = Contact; +//@description Describes a user contact @phone_number Phone number of the user @first_name First name of the user; 1-255 characters in length @last_name Last name of the user @vcard Additional data about the user in a form of vCard; 0-2048 bytes in length @user_id Identifier of the user, if known; otherwise 0 +contact phone_number:string first_name:string last_name:string vcard:string user_id:int32 = Contact; //@description Describes a location on planet Earth @latitude Latitude of the location in degrees; as defined by the sender @longitude Longitude of the location, in degrees; as defined by the sender location latitude:double longitude:double = Location; //@description Describes a venue @location Venue location; as defined by the sender @title Venue name; as defined by the sender @address Venue address; as defined by the sender @provider Provider of the venue database; as defined by the sender. Currently only "foursquare" needs to be supported -//@id Identifier of the venue in the provider database; as defined by the sender -venue location:location title:string address:string provider:string id:string = Venue; +//@id Identifier of the venue in the provider database; as defined by the sender @type Type of the venue in the provider database; as defined by the sender +venue location:location title:string address:string provider:string id:string type:string = Venue; //@description Describes a game @id Game ID @short_name Game short name. To share a game use the URL https://t.me/{bot_username}?game={game_short_name} @title Game title @text Game text, usually containing scoreboards for a game //@param_description Game description @photo Game photo @animation Game animation; may be null @@ -336,6 +340,24 @@ chatMember user_id:int32 inviter_user_id:int32 joined_chat_date:int32 status:Cha chatMembers total_count:int32 members:vector = ChatMembers; +//@class ChatMembersFilter @description Specifies the kind of chat members to return in searchChatMembers + +//@description Returns the creator and administrators +chatMembersFilterAdministrators = ChatMembersFilter; + +//@description Returns all chat members, including restricted chat members +chatMembersFilterMembers = ChatMembersFilter; + +//@description Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup +chatMembersFilterRestricted = ChatMembersFilter; + +//@description Returns users banned from the chat; can be used only by administrators in a supergroup or in a channel +chatMembersFilterBanned = ChatMembersFilter; + +//@description Returns bot members of the chat +chatMembersFilterBots = ChatMembersFilter; + + //@class SupergroupMembersFilter @description Specifies the kind of chat members to return in getSupergroupMembers //@description Returns recently active users in reverse chronological order @@ -450,7 +472,7 @@ messageSendingStateFailed = MessageSendingState; //@description Describes a message -//@id Unique message identifier +//@id Message identifier, unique for the chat to which the message belongs //@sender_user_id Identifier of the user who sent the message; 0 if unknown. It is unknown for channel posts //@chat_id Chat identifier //@sending_state Information about the sending state of the message; may be null @@ -482,23 +504,24 @@ messages total_count:int32 messages:vector = Messages; foundMessages messages:vector next_from_search_id:int64 = FoundMessages; -//@class NotificationSettingsScope @description Describes the types of chats for which notification settings are applied +//@class NotificationSettingsScope @description Describes the types of chats to which notification settings are applied -//@description Notification settings applied to a particular chat @chat_id Chat identifier -notificationSettingsScopeChat chat_id:int53 = NotificationSettingsScope; - -//@description Notification settings applied to all private chats +//@description Notification settings applied to all private and secret chats when the corresponding chat setting has a default value notificationSettingsScopePrivateChats = NotificationSettingsScope; -//@description Notification settings applied to all basic groups and channels. (Supergroups have no common settings) -notificationSettingsScopeBasicGroupChats = NotificationSettingsScope; - -//@description Notification settings applied to all chats -notificationSettingsScopeAllChats = NotificationSettingsScope; +//@description Notification settings applied to all basic groups, supergroups and channels when the corresponding chat setting has a default value +notificationSettingsScopeGroupChats = NotificationSettingsScope; -//@description Contains information about notification settings for a chat or several chats @mute_for Time left before notifications will be unmuted, in seconds @sound An audio file name for notification sounds; only applies to iOS applications @show_preview True, if message content should be displayed in notifications -notificationSettings mute_for:int32 sound:string show_preview:Bool = NotificationSettings; +//@description Contains information about notification settings for a chat +//@use_default_mute_for If true, mute_for is ignored and the value for the relevant type of chat is used instead @mute_for Time left before notifications will be unmuted, in seconds +//@use_default_sound If true, sound is ignored and the value for the relevant type of chat is used instead @sound The name of an audio file to be used for notification sounds; only applies to iOS applications +//@use_default_show_preview If true, show_preview is ignored and the value for the relevant type of chat is used instead @show_preview True, if message content should be displayed in notifications +chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound:string use_default_show_preview:Bool show_preview:Bool = ChatNotificationSettings; + +//@description Contains information about notification settings for several chats @mute_for Time left before notifications will be unmuted, in seconds +//@sound The name of an audio file to be used for notification sounds; only applies to iOS applications @show_preview True, if message content should be displayed in notifications +scopeNotificationSettings mute_for:int32 sound:string show_preview:Bool = ScopeNotificationSettings; //@description Contains information about a message draft @reply_to_message_id Identifier of the message to reply to; 0 if none @input_message_text Content of the message draft; this should always be of type inputMessageText @@ -528,7 +551,10 @@ chatTypeSecret secret_chat_id:int32 user_id:int32 = ChatType; //@last_message Last message in the chat; may be null //@order Descending parameter by which chats are sorted in the main chat list. If the order number of two chats is the same, they must be sorted in descending order by ID. If 0, the position of the chat in the list is undetermined //@is_pinned True, if the chat is pinned +//@is_marked_as_unread True, if the chat is marked as unread +//@is_sponsored True, if the chat is sponsored by the user's MTProxy server //@can_be_reported True, if the chat can be reported to Telegram moderators through reportChat +//@default_disable_notification Default value of the disable_notification parameter, used when a message is sent to the chat //@unread_count Number of unread messages in the chat //@last_read_inbox_message_id Identifier of the last read incoming message //@last_read_outbox_message_id Identifier of the last read outgoing message @@ -537,7 +563,7 @@ chatTypeSecret secret_chat_id:int32 user_id:int32 = ChatType; //@reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat //@draft_message A draft of a message in the chat; may be null //@client_data Contains client-specific data associated with the chat. (For example, the chat position or local chat notification settings can be stored here.) Persistent if a message database is used -chat id:int53 type:ChatType title:string photo:chatPhoto last_message:message order:int64 is_pinned:Bool can_be_reported:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:notificationSettings reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; +chat id:int53 type:ChatType title:string photo:chatPhoto last_message:message order:int64 is_pinned:Bool is_marked_as_unread:Bool is_sponsored:Bool can_be_reported:Bool default_disable_notification:Bool unread_count:int32 last_read_inbox_message_id:int53 last_read_outbox_message_id:int53 unread_mention_count:int32 notification_settings:chatNotificationSettings reply_markup_message_id:int53 draft_message:draftMessage client_data:string = Chat; //@description Represents a list of chats @chat_ids List of chat identifiers chats chat_ids:vector = Chats; @@ -575,7 +601,7 @@ keyboardButton text:string type:KeyboardButtonType = KeyboardButton; //@class InlineKeyboardButtonType @description Describes the type of an inline keyboard button -//@description A button that opens a specified URL @url URL to open +//@description A button that opens a specified URL @url HTTP or tg:// URL to open inlineKeyboardButtonTypeUrl url:string = InlineKeyboardButtonType; //@description A button that sends a special callback query to a bot @data Data to be sent to the bot via a callback query @@ -744,6 +770,10 @@ webPageInstantView page_blocks:vector is_full:Bool = WebPageInstantVi webPage url:string display_url:string type:string site_name:string title:string description:string photo:photo embed_url:string embed_type:string embed_width:int32 embed_height:int32 duration:int32 author:string animation:animation audio:audio document:document sticker:sticker video:video video_note:videoNote voice_note:voiceNote has_instant_view:Bool = WebPage; +//@description Describes an address @country_code A two-letter ISO 3166-1 alpha-2 country code @state State, if applicable @city City @street_line1 First line of the address @street_line2 Second line of the address @postal_code Address postal code +address country_code:string state:string city:string street_line1:string street_line2:string postal_code:string = Address; + + //@description Portion of the price of a product (e.g., "delivery cost", "tax amount") @label Label for this portion of the product price @amount Currency amount in minimal quantity of the currency labeledPricePart label:string amount:int53 = LabeledPricePart; @@ -753,11 +783,8 @@ labeledPricePart label:string amount:int53 = LabeledPricePart; //@send_email_address_to_provider True, if the user's email address will be sent to the provider @is_flexible True, if the total price depends on the shipping method invoice currency:string price_parts:vector is_test:Bool need_name:Bool need_phone_number:Bool need_email_address:Bool need_shipping_address:Bool send_phone_number_to_provider:Bool send_email_address_to_provider:Bool is_flexible:Bool = Invoice; -//@description Describes a shipping address @country_code Two-letter ISO 3166-1 alpha-2 country code @state State, if applicable @city City @street_line1 First line of the address @street_line2 Second line of the address @postal_code Address postal code -shippingAddress country_code:string state:string city:string street_line1:string street_line2:string postal_code:string = ShippingAddress; - //@description Order information @name Name of the user @phone_number Phone number of the user @email_address Email address of the user @shipping_address Shipping address for this order; may be null -orderInfo name:string phone_number:string email_address:string shipping_address:shippingAddress = OrderInfo; +orderInfo name:string phone_number:string email_address:string shipping_address:address = OrderInfo; //@description One shipping option @id Shipping option identifier @title Option title @price_parts A list of objects used to calculate the total shipping costs shippingOption id:string title:string price_parts:vector = ShippingOption; @@ -797,6 +824,253 @@ paymentResult success:Bool verification_url:string = PaymentResult; paymentReceipt date:int32 payments_provider_user_id:int32 invoice:invoice order_info:orderInfo shipping_option:shippingOption credentials_title:string = PaymentReceipt; +//@description File with the date it was uploaded @file The file @date Point in time (Unix timestamp) when the file was uploaded +datedFile file:file date:int32 = DatedFile; + + +//@class PassportElementType @description Contains the type of a Telegram Passport element + +//@description A Telegram Passport element containing the user's personal details +passportElementTypePersonalDetails = PassportElementType; + +//@description A Telegram Passport element containing the user's passport +passportElementTypePassport = PassportElementType; + +//@description A Telegram Passport element containing the user's driver license +passportElementTypeDriverLicense = PassportElementType; + +//@description A Telegram Passport element containing the user's identity card +passportElementTypeIdentityCard = PassportElementType; + +//@description A Telegram Passport element containing the user's internal passport +passportElementTypeInternalPassport = PassportElementType; + +//@description A Telegram Passport element containing the user's address +passportElementTypeAddress = PassportElementType; + +//@description A Telegram Passport element containing the user's utility bill +passportElementTypeUtilityBill = PassportElementType; + +//@description A Telegram Passport element containing the user's bank statement +passportElementTypeBankStatement = PassportElementType; + +//@description A Telegram Passport element containing the user's rental agreement +passportElementTypeRentalAgreement = PassportElementType; + +//@description A Telegram Passport element containing the registration page of the user's passport +passportElementTypePassportRegistration = PassportElementType; + +//@description A Telegram Passport element containing the user's temporary registration +passportElementTypeTemporaryRegistration = PassportElementType; + +//@description A Telegram Passport element containing the user's phone number +passportElementTypePhoneNumber = PassportElementType; + +//@description A Telegram Passport element containing the user's email address +passportElementTypeEmailAddress = PassportElementType; + + +//@description Represents a date according to the Gregorian calendar @day Day of the month, 1-31 @month Month, 1-12 @year Year, 1-9999 +date day:int32 month:int32 year:int32 = Date; + +//@description Contains the user's personal details +//@first_name First name of the user written in English; 1-255 characters @middle_name Middle name of the user written in English; 0-255 characters @last_name Last name of the user written in English; 1-255 characters +//@native_first_name Native first name of the user; 1-255 characters @native_middle_name Native middle name of the user; 0-255 characters @native_last_name Native last name of the user; 1-255 characters +//@birthdate Birthdate of the user @gender Gender of the user, "male" or "female" @country_code A two-letter ISO 3166-1 alpha-2 country code of the user's country @residence_country_code A two-letter ISO 3166-1 alpha-2 country code of the user's residence country +personalDetails first_name:string middle_name:string last_name:string native_first_name:string native_middle_name:string native_last_name:string birthdate:date gender:string country_code:string residence_country_code:string = PersonalDetails; + +//@description An identity document @number Document number; 1-24 characters @expiry_date Document expiry date; may be null @front_side Front side of the document +//@reverse_side Reverse side of the document; only for driver license and identity card @selfie Selfie with the document; may be null @translation List of files containing a certified English translation of the document +identityDocument number:string expiry_date:date front_side:datedFile reverse_side:datedFile selfie:datedFile translation:vector = IdentityDocument; + +//@description An identity document to be saved to Telegram Passport @number Document number; 1-24 characters @expiry_date Document expiry date, if available @front_side Front side of the document +//@reverse_side Reverse side of the document; only for driver license and identity card @selfie Selfie with the document, if available @translation List of files containing a certified English translation of the document +inputIdentityDocument number:string expiry_date:date front_side:InputFile reverse_side:InputFile selfie:InputFile translation:vector = InputIdentityDocument; + +//@description A personal document, containing some information about a user @files List of files containing the pages of the document @translation List of files containing a certified English translation of the document +personalDocument files:vector translation:vector = PersonalDocument; + +//@description A personal document to be saved to Telegram Passport @files List of files containing the pages of the document @translation List of files containing a certified English translation of the document +inputPersonalDocument files:vector translation:vector = InputPersonalDocument; + + +//@class PassportElement @description Contains information about a Telegram Passport element + +//@description A Telegram Passport element containing the user's personal details @personal_details Personal details of the user +passportElementPersonalDetails personal_details:personalDetails = PassportElement; + +//@description A Telegram Passport element containing the user's passport @passport Passport +passportElementPassport passport:identityDocument = PassportElement; + +//@description A Telegram Passport element containing the user's driver license @driver_license Driver license +passportElementDriverLicense driver_license:identityDocument = PassportElement; + +//@description A Telegram Passport element containing the user's identity card @identity_card Identity card +passportElementIdentityCard identity_card:identityDocument = PassportElement; + +//@description A Telegram Passport element containing the user's internal passport @internal_passport Internal passport +passportElementInternalPassport internal_passport:identityDocument = PassportElement; + +//@description A Telegram Passport element containing the user's address @address Address +passportElementAddress address:address = PassportElement; + +//@description A Telegram Passport element containing the user's utility bill @utility_bill Utility bill +passportElementUtilityBill utility_bill:personalDocument = PassportElement; + +//@description A Telegram Passport element containing the user's bank statement @bank_statement Bank statement +passportElementBankStatement bank_statement:personalDocument = PassportElement; + +//@description A Telegram Passport element containing the user's rental agreement @rental_agreement Rental agreement +passportElementRentalAgreement rental_agreement:personalDocument = PassportElement; + +//@description A Telegram Passport element containing the user's passport registration pages @passport_registration Passport registration pages +passportElementPassportRegistration passport_registration:personalDocument = PassportElement; + +//@description A Telegram Passport element containing the user's temporary registration @temporary_registration Temporary registration +passportElementTemporaryRegistration temporary_registration:personalDocument = PassportElement; + +//@description A Telegram Passport element containing the user's phone number @phone_number Phone number +passportElementPhoneNumber phone_number:string = PassportElement; + +//@description A Telegram Passport element containing the user's email address @email_address Email address +passportElementEmailAddress email_address:string = PassportElement; + + +//@class InputPassportElement @description Contains information about a Telegram Passport element to be saved + +//@description A Telegram Passport element to be saved containing the user's personal details @personal_details Personal details of the user +inputPassportElementPersonalDetails personal_details:personalDetails = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's passport @passport The passport to be saved +inputPassportElementPassport passport:inputIdentityDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's driver license @driver_license The driver license to be saved +inputPassportElementDriverLicense driver_license:inputIdentityDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's identity card @identity_card The identity card to be saved +inputPassportElementIdentityCard identity_card:inputIdentityDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's internal passport @internal_passport The internal passport to be saved +inputPassportElementInternalPassport internal_passport:inputIdentityDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's address @address The address to be saved +inputPassportElementAddress address:address = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's utility bill @utility_bill The utility bill to be saved +inputPassportElementUtilityBill utility_bill:inputPersonalDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's bank statement @bank_statement The bank statement to be saved +inputPassportElementBankStatement bank_statement:inputPersonalDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's rental agreement @rental_agreement The rental agreement to be saved +inputPassportElementRentalAgreement rental_agreement:inputPersonalDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's passport registration @passport_registration The passport registration page to be saved +inputPassportElementPassportRegistration passport_registration:inputPersonalDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's temporary registration @temporary_registration The temporary registration document to be saved +inputPassportElementTemporaryRegistration temporary_registration:inputPersonalDocument = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's phone number @phone_number The phone number to be saved +inputPassportElementPhoneNumber phone_number:string = InputPassportElement; + +//@description A Telegram Passport element to be saved containing the user's email address @email_address The email address to be saved +inputPassportElementEmailAddress email_address:string = InputPassportElement; + + +//@description Contains information about saved Telegram Passport elements @elements Telegram Passport elements +passportElements elements:vector = PassportElements; + + +//@class PassportElementErrorSource @description Contains the description of an error in a Telegram Passport element + +//@description The element contains an error in an unspecified place. The error will be considered resolved when new data is added +passportElementErrorSourceUnspecified = PassportElementErrorSource; + +//@description One of the data fields contains an error. The error will be considered resolved when the value of the field changes @field_name Field name +passportElementErrorSourceDataField field_name:string = PassportElementErrorSource; + +//@description The front side of the document contains an error. The error will be considered resolved when the file with the front side changes +passportElementErrorSourceFrontSide = PassportElementErrorSource; + +//@description The reverse side of the document contains an error. The error will be considered resolved when the file with the reverse side changes +passportElementErrorSourceReverseSide = PassportElementErrorSource; + +//@description The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes +passportElementErrorSourceSelfie = PassportElementErrorSource; + +//@description One of files with the translation of the document contains an error. The error will be considered resolved when the file changes +passportElementErrorSourceTranslationFile = PassportElementErrorSource; + +//@description The translation of the document contains an error. The error will be considered resolved when the list of translation files changes +passportElementErrorSourceTranslationFiles = PassportElementErrorSource; + +//@description The file contains an error. The error will be considered resolved when the file changes +passportElementErrorSourceFile = PassportElementErrorSource; + +//@description The list of attached files contains an error. The error will be considered resolved when the list of files changes +passportElementErrorSourceFiles = PassportElementErrorSource; + + +//@description Contains the description of an error in a Telegram Passport element @type Type of the Telegram Passport element which has the error @message Error message @source Error source +passportElementError type:PassportElementType message:string source:PassportElementErrorSource = PassportElementError; + + +//@description Contains information about a Telegram Passport element that was requested by a service @type Type of the element @is_selfie_required True, if a selfie is required with the identity document +//@is_translation_required True, if a certified English translation is required with the document @is_native_name_required True, if personal details must include the user's name in the language of their country of residence +passportSuitableElement type:PassportElementType is_selfie_required:Bool is_translation_required:Bool is_native_name_required:Bool = PassportSuitableElement; + +//@description Contains a description of the required Telegram Passport element that was requested by a service @suitable_elements List of Telegram Passport elements any of which is enough to provide +passportRequiredElement suitable_elements:vector = PassportRequiredElement; + +//@description Contains information about a Telegram Passport authorization form that was requested @id Unique identifier of the authorization form +//@required_elements Information about the Telegram Passport elements that need to be provided to complete the form @elements Already available Telegram Passport elements +//@errors Errors in the elements that are already available @privacy_policy_url URL for the privacy policy of the service; can be empty +passportAuthorizationForm id:int32 required_elements:vector elements:vector errors:vector privacy_policy_url:string = PassportAuthorizationForm; + + +//@description Contains encrypted Telegram Passport data credentials @data The encrypted credentials @hash The decrypted data hash @secret Secret for data decryption, encrypted with the service's public key +encryptedCredentials data:bytes hash:bytes secret:bytes = EncryptedCredentials; + + +//@description Contains information about an encrypted Telegram Passport element; for bots only @type Type of Telegram Passport element @data Encrypted JSON-encoded data about the user @front_side The front side of an identity document @reverse_side The reverse side of an identity document; may be null @selfie Selfie with the document; may be null @translation List of files containing a certified English translation of the document @files List of attached files @value Unencrypted data, phone number or email address @hash Hash of the entire element +encryptedPassportElement type:PassportElementType data:bytes front_side:datedFile reverse_side:datedFile selfie:datedFile translation:vector files:vector value:string hash:string = EncryptedPassportElement; + + +//@class InputPassportElementErrorSource @description Contains the description of an error in a Telegram Passport element; for bots only + +//@description The element contains an error in an unspecified place. The error will be considered resolved when new data is added @element_hash Current hash of the entire element +inputPassportElementErrorSourceUnspecified element_hash:bytes = InputPassportElementErrorSource; + +//@description A data field contains an error. The error is considered resolved when the field's value changes @field_name Field name @data_hash Current data hash +inputPassportElementErrorSourceDataField field_name:string data_hash:bytes = InputPassportElementErrorSource; + +//@description 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 @file_hash Current hash of the file containing the front side +inputPassportElementErrorSourceFrontSide file_hash:bytes = InputPassportElementErrorSource; + +//@description 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 @file_hash Current hash of the file containing the reverse side +inputPassportElementErrorSourceReverseSide file_hash:bytes = InputPassportElementErrorSource; + +//@description The selfie contains an error. The error is considered resolved when the file with the selfie changes @file_hash Current hash of the file containing the selfie +inputPassportElementErrorSourceSelfie file_hash:bytes = InputPassportElementErrorSource; + +//@description 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 @file_hash Current hash of the file containing the translation +inputPassportElementErrorSourceTranslationFile file_hash:bytes = InputPassportElementErrorSource; + +//@description The translation of the document contains an error. The error is considered resolved when the list of files changes @file_hashes Current hashes of all files with the translation +inputPassportElementErrorSourceTranslationFiles file_hashes:vector = InputPassportElementErrorSource; + +//@description The file contains an error. The error is considered resolved when the file changes @file_hash Current hash of the file which has the error +inputPassportElementErrorSourceFile file_hash:bytes = InputPassportElementErrorSource; + +//@description The list of attached files contains an error. The error is considered resolved when the file list changes @file_hashes Current hashes of all attached files +inputPassportElementErrorSourceFiles file_hashes:vector = InputPassportElementErrorSource; + + +//@description Contains the description of an error in a Telegram Passport element; for bots only @type Type of Telegram Passport element that has the error @message Error message @source Error source +inputPassportElementError type:PassportElementType message:string source:InputPassportElementErrorSource = InputPassportElementError; + + //@class MessageContent @description Contains the content of a message //@description A text message @text Text of the message @web_page A preview of the web page that's mentioned in the text; may be null @@ -902,7 +1176,7 @@ messageGameScore game_message_id:int53 game_id:int64 score:int32 = MessageConten messagePaymentSuccessful invoice_message_id:int53 currency:string total_amount:int53 = MessageContent; //@description A payment has been completed; for bots only @invoice_message_id Identifier of the message with the corresponding invoice; can be an identifier of a deleted message @currency Currency for price of the product -//@total_amount Total price for the product, in the minimal quantity of the currency @invoice_payload Invoice payload @shipping_option_id Identifier of the shipping option chosen by the user, may be empty if not applicable @order_info Information about the order; may be null +//@total_amount Total price for the product, in the minimal quantity of the currency @invoice_payload Invoice payload @shipping_option_id Identifier of the shipping option chosen by the user; may be empty if not applicable @order_info Information about the order; may be null //@telegram_payment_charge_id Telegram payment identifier @provider_payment_charge_id Provider payment identifier messagePaymentSuccessfulBot invoice_message_id:int53 currency:string total_amount:int53 invoice_payload:bytes shipping_option_id:string order_info:orderInfo telegram_payment_charge_id:string provider_payment_charge_id:string = MessageContent; @@ -912,6 +1186,12 @@ messageContactRegistered = MessageContent; //@description The current user has connected a website by logging in using Telegram Login Widget on it @domain_name Domain name of the connected website messageWebsiteConnected domain_name:string = MessageContent; +//@description Telegram Passport data has been sent @types List of Telegram Passport element types sent +messagePassportDataSent types:vector = MessageContent; + +//@description Telegram Passport data has been received; for bots only @elements List of received Telegram Passport elements @credentials Encrypted data credentials +messagePassportDataReceived elements:vector credentials:encryptedCredentials = MessageContent; + //@description Message content that is not supported by the client messageUnsupported = MessageContent; @@ -951,7 +1231,7 @@ textEntityTypePre = TextEntityType; //@description Text that must be formatted as if inside pre, and code HTML tags @language Programming language of the code; as defined by the sender textEntityTypePreCode language:string = TextEntityType; -//@description A text description shown instead of a raw URL @url URL to be opened when the link is clicked +//@description A text description shown instead of a raw URL @url HTTP or tg:// URL to be opened when the link is clicked textEntityTypeTextUrl url:string = TextEntityType; //@description A text shows instead of a raw mention of the user (e.g., when the user has no username) @user_id Identifier of the mentioned user @@ -968,21 +1248,21 @@ inputThumbnail thumbnail:InputFile width:int32 height:int32 = InputThumbnail; //@class InputMessageContent @description The content of a message to send -//@description A text message @text Formatted text to be sent. Only Bold, Italic, Code, Pre, PreCode and TextUrl entities are allowed to be specified manually +//@description A text message @text Formatted text to be sent; 1-GetOption("message_text_length_max") characters. Only Bold, Italic, Code, Pre, PreCode and TextUrl entities are allowed to be specified manually //@disable_web_page_preview True, if rich web page previews for URLs in the message text should be disabled @clear_draft True, if a chat message draft should be deleted inputMessageText text:formattedText disable_web_page_preview:Bool clear_draft:Bool = InputMessageContent; -//@description An animation message (GIF-style). @animation Animation file to be sent @thumbnail Animation thumbnail, if available @duration Duration of the animation, in seconds @width Width of the animation; may be replaced by the server @height Height of the animation; may be replaced by the server @caption Animation caption; 0-200 characters +//@description An animation message (GIF-style). @animation Animation file to be sent @thumbnail Animation thumbnail, if available @duration Duration of the animation, in seconds @width Width of the animation; may be replaced by the server @height Height of the animation; may be replaced by the server @caption Animation caption; 0-GetOption("message_caption_length_max") characters inputMessageAnimation animation:InputFile thumbnail:inputThumbnail duration:int32 width:int32 height:int32 caption:formattedText = InputMessageContent; //@description An audio message @audio Audio file to be sent @album_cover_thumbnail Thumbnail of the cover for the album, if available @duration Duration of the audio, in seconds; may be replaced by the server @title Title of the audio; 0-64 characters; may be replaced by the server -//@performer Performer of the audio; 0-64 characters, may be replaced by the server @caption Audio caption; 0-200 characters +//@performer Performer of the audio; 0-64 characters, may be replaced by the server @caption Audio caption; 0-GetOption("message_caption_length_max") characters inputMessageAudio audio:InputFile album_cover_thumbnail:inputThumbnail duration:int32 title:string performer:string caption:formattedText = InputMessageContent; -//@description A document message (general file) @document Document to be sent @thumbnail Document thumbnail, if available @caption Document caption; 0-200 characters +//@description A document message (general file) @document Document to be sent @thumbnail Document thumbnail, if available @caption Document caption; 0-GetOption("message_caption_length_max") characters inputMessageDocument document:InputFile thumbnail:inputThumbnail caption:formattedText = InputMessageContent; -//@description A photo message @photo Photo to send @thumbnail Photo thumbnail to be sent, this is sent to the other party in secret chats only @added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable @width Photo width @height Photo height @caption Photo caption; 0-200 characters +//@description A photo message @photo Photo to send @thumbnail Photo thumbnail to be sent, this is sent to the other party in secret chats only @added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable @width Photo width @height Photo height @caption Photo caption; 0-GetOption("message_caption_length_max") characters //@ttl Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector width:int32 height:int32 caption:formattedText ttl:int32 = InputMessageContent; @@ -991,13 +1271,13 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh //@description A video message @video Video to be sent @thumbnail Video thumbnail, if available @added_sticker_file_ids File identifiers of the stickers added to the video, if applicable //@duration Duration of the video, in seconds @width Video width @height Video height @supports_streaming True, if the video should be tried to be streamed -//@caption Video caption; 0-200 characters @ttl Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats +//@caption Video caption; 0-GetOption("message_caption_length_max") characters @ttl Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText ttl:int32 = InputMessageContent; //@description A video note message @video_note Video note to be sent @thumbnail Video thumbnail, if available @duration Duration of the video, in seconds @length Video width and height; must be positive and not greater than 640 inputMessageVideoNote video_note:InputFile thumbnail:inputThumbnail duration:int32 length:int32 = InputMessageContent; -//@description A voice note message @voice_note Voice note to be sent @duration Duration of the voice note, in seconds @waveform Waveform representation of the voice note, in 5-bit format @caption Voice note caption; 0-200 characters +//@description A voice note message @voice_note Voice note to be sent @duration Duration of the voice note, in seconds @waveform Waveform representation of the voice note, in 5-bit format @caption Voice note caption; 0-GetOption("message_caption_length_max") characters inputMessageVoiceNote voice_note:InputFile duration:int32 waveform:bytes caption:formattedText = InputMessageContent; //@description A message with a location @location Location to be sent @live_period Period for which the location can be updated, in seconds; should bebetween 60 and 86400 for a live location and 0 otherwise @@ -1423,40 +1703,66 @@ chatEvents events:vector = ChatEvents; chatEventLogFilters message_edits:Bool message_deletions:Bool message_pins:Bool member_joins:Bool member_leaves:Bool member_invites:Bool member_promotions:Bool member_restrictions:Bool info_changes:Bool setting_changes:Bool = ChatEventLogFilters; +//@class LanguagePackStringValue @description Represents the value of a string in a language pack + +//@description An ordinary language pack string @value String value +languagePackStringValueOrdinary value:string = LanguagePackStringValue; + +//@description A language pack string which has different forms based on the number of some object it mentions @zero_value Value for zero objects @one_value Value for one object @two_value Value for two objects +//@few_value Value for few objects @many_value Value for many objects @other_value Default value +languagePackStringValuePluralized zero_value:string one_value:string two_value:string few_value:string many_value:string other_value:string = LanguagePackStringValue; + +//@description A deleted language pack string, the value should be taken from the built-in english language pack +languagePackStringValueDeleted = LanguagePackStringValue; + + +//@description Represents one language pack string @key String key @value String value +languagePackString key:string value:LanguagePackStringValue = LanguagePackString; + +//@description Contains a list of language pack strings @strings A list of language pack strings +languagePackStrings strings:vector = LanguagePackStrings; + +//@description Contains information about a language pack @id Unique language pack identifier @name Language name @native_name Name of the language in that language @local_string_count Total number of non-deleted strings from the language pack available locally +languagePackInfo id:string name:string native_name:string local_string_count:int32 = LanguagePackInfo; + +//@description Contains information about the current localization target @language_packs List of available language packs for this application +localizationTargetInfo language_packs:vector = LocalizationTargetInfo; + + //@class DeviceToken @description Represents a data needed to subscribe for push notifications. To use specific push notification service, you must specify the correct application platform and upload valid server authentication data at https://my.telegram.org -//@description A token for Google Cloud Messaging @token Device registration token, may be empty to de-register a device +//@description A token for Google Cloud Messaging @token Device registration token; may be empty to de-register a device deviceTokenGoogleCloudMessaging token:string = DeviceToken; -//@description A token for Apple Push Notification service @device_token Device token, may be empty to de-register a device @is_app_sandbox True, if App Sandbox is enabled +//@description A token for Apple Push Notification service @device_token Device token; may be empty to de-register a device @is_app_sandbox True, if App Sandbox is enabled deviceTokenApplePush device_token:string is_app_sandbox:Bool = DeviceToken; -//@description A token for Apple Push Notification service VoIP notifications @device_token Device token, may be empty to de-register a device @is_app_sandbox True, if App Sandbox is enabled +//@description A token for Apple Push Notification service VoIP notifications @device_token Device token; may be empty to de-register a device @is_app_sandbox True, if App Sandbox is enabled deviceTokenApplePushVoIP device_token:string is_app_sandbox:Bool = DeviceToken; -//@description A token for Windows Push Notification Services @access_token The access token that will be used to send notifications, may be empty to de-register a device +//@description A token for Windows Push Notification Services @access_token The access token that will be used to send notifications; may be empty to de-register a device deviceTokenWindowsPush access_token:string = DeviceToken; -//@description A token for Microsoft Push Notification Service @channel_uri Push notification channel URI, may be empty to de-register a device +//@description A token for Microsoft Push Notification Service @channel_uri Push notification channel URI; may be empty to de-register a device deviceTokenMicrosoftPush channel_uri:string = DeviceToken; -//@description A token for Microsoft Push Notification Service VoIP channel @channel_uri Push notification channel URI, may be empty to de-register a device +//@description A token for Microsoft Push Notification Service VoIP channel @channel_uri Push notification channel URI; may be empty to de-register a device deviceTokenMicrosoftPushVoIP channel_uri:string = DeviceToken; -//@description A token for web Push API @endpoint Absolute URL exposed by the push service where the application server can send push messages, may be empty to de-register a device +//@description A token for web Push API @endpoint Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device //@p256dh_base64url Base64url-encoded P-256 elliptic curve Diffie-Hellman public key @auth_base64url Base64url-encoded authentication secret deviceTokenWebPush endpoint:string p256dh_base64url:string auth_base64url:string = DeviceToken; -//@description A token for Simple Push API for Firefox OS @endpoint Absolute URL exposed by the push service where the application server can send push messages, may be empty to de-register a device +//@description A token for Simple Push API for Firefox OS @endpoint Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device deviceTokenSimplePush endpoint:string = DeviceToken; -//@description A token for Ubuntu Push Client service @token Token, may be empty to de-register a device +//@description A token for Ubuntu Push Client service @token Token; may be empty to de-register a device deviceTokenUbuntuPush token:string = DeviceToken; -//@description A token for BlackBerry Push Service @token Token, may be empty to de-register a device +//@description A token for BlackBerry Push Service @token Token; may be empty to de-register a device deviceTokenBlackBerryPush token:string = DeviceToken; -//@description A token for Tizen Push Service @reg_id Push service registration identifier, may be empty to de-register a device +//@description A token for Tizen Push Service @reg_id Push service registration identifier; may be empty to de-register a device deviceTokenTizenPush reg_id:string = DeviceToken; @@ -1586,6 +1892,9 @@ chatReportReasonViolence = ChatReportReason; //@description The chat contains pornographic messages chatReportReasonPornography = ChatReportReason; +//@description The chat contains copyrighted content +chatReportReasonCopyright = ChatReportReason; + //@description A custom reason provided by the user @text Report text chatReportReasonCustom text:string = ChatReportReason; @@ -1617,6 +1926,12 @@ fileTypeProfilePhoto = FileType; //@description The file was sent to a secret chat (the file type is not known to the server) fileTypeSecret = FileType; +//@description The file is a thumbnail of a file from a secret chat +fileTypeSecretThumbnail = FileType; + +//@description The file is a file from Secure storage used for storing Telegram Passport files +fileTypeSecure = FileType; + //@description The file is a sticker fileTypeSticker = FileType; @@ -1638,9 +1953,6 @@ fileTypeVoiceNote = FileType; //@description The file is a wallpaper fileTypeWallpaper = FileType; -//@description The file is a thumbnail of a file from a secret chat -fileTypeSecretThumbnail = FileType; - //@description Contains the storage usage statistics for a specific file type @file_type File type @size Total size of the files @count Total number of files storageStatisticsByFileType file_type:FileType size:int53 count:int32 = StorageStatisticsByFileType; @@ -1753,6 +2065,13 @@ count count:int32 = Count; //@description Contains some text @text Text text text:string = Text; +//@description Contains a value representing a number of seconds @seconds Number of seconds +seconds seconds:double = Seconds; + + +//@description Contains information about a tg:// deep link @text Text to be shown to the user @need_update_application True, if user should be asked to update the application +deepLinkInfo text:formattedText need_update_application:Bool = DeepLinkInfo; + //@class TextParseMode @description Describes the way the text should be parsed for TextEntities @@ -1763,13 +2082,23 @@ textParseModeMarkdown = TextParseMode; textParseModeHTML = TextParseMode; -//@class Proxy @description Contains information about a proxy server +//@class ProxyType @description Describes the type of the proxy server -//@description An empty proxy server -proxyEmpty = Proxy; +//@description A SOCKS5 proxy server @username Username for logging in; may be empty @password Password for logging in; may be empty +proxyTypeSocks5 username:string password:string = ProxyType; -//@description A SOCKS5 proxy server @server Proxy server IP address @port Proxy server port @username Username for logging in @password Password for logging in -proxySocks5 server:string port:int32 username:string password:string = Proxy; +//@description A HTTP transparent proxy server @username Username for logging in; may be empty @password Password for logging in; may be empty @http_only Pass true, if the proxy supports only HTTP requests and doesn't support transparent TCP connections via HTTP CONNECT method +proxyTypeHttp username:string password:string http_only:Bool = ProxyType; + +//@description An MTProto proxy server @secret The proxy's secret in hexadecimal encoding +proxyTypeMtproto secret:string = ProxyType; + + +//@description Contains information about a proxy server @id Unique identifier of the proxy @server Proxy server IP address @port Proxy server port @last_used_date Point in time (Unix timestamp) when the proxy was last used; 0 if never @is_enabled True, if the proxy is enabled now @type Type of the proxy +proxy id:int32 server:string port:int32 last_used_date:int32 is_enabled:Bool type:ProxyType = Proxy; + +//@description Represents a list of proxy servers @proxies List of proxy servers +proxies proxies:vector = Proxies; //@description Describes a sticker that should be added to a sticker set @png_sticker PNG image with the sticker; must be up to 512 kB in size and fit in a 512x512 square @emojis Emoji corresponding to the sticker @mask_position For masks, position where the mask should be placed; may be null @@ -1828,6 +2157,15 @@ updateChatOrder chat_id:int53 order:int64 = Update; //@description A chat was pinned or unpinned @chat_id Chat identifier @is_pinned New value of is_pinned @order New value of the chat order updateChatIsPinned chat_id:int53 is_pinned:Bool order:int64 = Update; +//@description A chat was marked as unread or was read @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread +updateChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Update; + +//@description A chat's is_sponsored field has changed @chat_id Chat identifier @is_sponsored New value of is_sponsored @order New value of chat order +updateChatIsSponsored chat_id:int53 is_sponsored:Bool order:int64 = Update; + +//@description The value of the default disable_notification parameter, used when a message is sent to the chat, was changed @chat_id Chat identifier @default_disable_notification The new default_disable_notification value +updateChatDefaultDisableNotification chat_id:int53 default_disable_notification:Bool = Update; + //@description Incoming messages were read or number of unread messages has been changed @chat_id Chat identifier @last_read_inbox_message_id Identifier of the last read incoming message @unread_count The number of unread messages left in the chat updateChatReadInbox chat_id:int53 last_read_inbox_message_id:int53 unread_count:int32 = Update; @@ -1837,14 +2175,17 @@ updateChatReadOutbox chat_id:int53 last_read_outbox_message_id:int53 = Update; //@description The chat unread_mention_count has changed @chat_id Chat identifier @unread_mention_count The number of unread mention messages left in the chat updateChatUnreadMentionCount chat_id:int53 unread_mention_count:int32 = Update; -//@description Notification settings for some chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings -updateNotificationSettings scope:NotificationSettingsScope notification_settings:notificationSettings = Update; +//@description Notification settings for a chat were changed @chat_id Chat identifier @notification_settings The new notification settings +updateChatNotificationSettings chat_id:int53 notification_settings:chatNotificationSettings = Update; + +//@description Notification settings for some type of chats were updated @scope Types of chats for which notification settings were updated @notification_settings The new notification settings +updateScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Update; //@description The default chat reply markup was changed. Can occur because new messages with reply markup were received or because an old reply markup was hidden by the user //@chat_id Chat identifier @reply_markup_message_id Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat updateChatReplyMarkup chat_id:int53 reply_markup_message_id:int53 = Update; -//@description A draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update shouldn't be applied @chat_id Chat identifier @draft_message The new draft message; may be null @order New value of the chat order +//@description A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update shouldn't be applied @chat_id Chat identifier @draft_message The new draft message; may be null @order New value of the chat order updateChatDraftMessage chat_id:int53 draft_message:draftMessage order:int64 = Update; //@description Some messages were deleted @chat_id Chat identifier @message_ids Identifiers of the deleted messages @@ -1879,7 +2220,9 @@ updateBasicGroupFullInfo basic_group_id:int32 basic_group_full_info:basicGroupFu //@description Some data from supergroupFullInfo has been changed @supergroup_id Identifier of the supergroup or channel @supergroup_full_info New full information about the supergroup updateSupergroupFullInfo supergroup_id:int32 supergroup_full_info:supergroupFullInfo = Update; -//@description Service notification from the server. Upon receiving this the client must show a popup with the content of the notification @type Notification type @content Notification content +//@description Service notification from the server. Upon receiving this the client must show a popup with the content of the notification +//@type Notification type. If type begins with "AUTH_KEY_DROP_", then two buttons "Cancel" and "Log out" should be shown under notification; if user presses the second, all local data should be destroyed using Destroy method +//@content Notification content updateServiceNotification type:string content:MessageContent = Update; //@description Information about a file was updated @file New data about the file @@ -1887,9 +2230,9 @@ updateFile file:file = Update; //@description The file generation process needs to be started by the client //@generation_id Unique identifier for the generation process -//@original_path The path to a file from which a new file is generated, may be empty +//@original_path The path to a file from which a new file is generated; may be empty //@destination_path The path to a file that should be created and where the new file should be generated -//@conversion String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains a HTTP/HTTPS URL of a file, which should be downloaded by the client +//@conversion String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file, which should be downloaded by the client updateFileGenerationStart generation_id:int64 original_path:string destination_path:string conversion:string = Update; //@description File generation is no longer needed @generation_id Unique identifier for the generation process @@ -1904,6 +2247,11 @@ updateUserPrivacySettingRules setting:UserPrivacySetting rules:userPrivacySettin //@description Number of unread messages has changed. This update is sent only if a message database is used @unread_count Total number of unread messages @unread_unmuted_count Total number of unread messages in unmuted chats updateUnreadMessageCount unread_count:int32 unread_unmuted_count:int32 = Update; +//@description Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if a message database is used +//@unread_count Total number of unread chats @unread_unmuted_count Total number of unread unmuted chats +//@marked_as_unread_count Total number of chats marked as unread @marked_as_unread_unmuted_count Total number of unmuted chats marked as unread +updateUnreadChatCount unread_count:int32 unread_unmuted_count:int32 marked_as_unread_count:int32 marked_as_unread_unmuted_count:int32 = Update; + //@description An option changed its value @name The option name @value The new option value updateOption name:string value:OptionValue = Update; @@ -1922,9 +2270,15 @@ updateFavoriteStickers sticker_ids:vector = Update; //@description The list of saved animations was updated @animation_ids The new list of file identifiers of saved animations updateSavedAnimations animation_ids:vector = Update; +//@description Some language pack strings have been updated @localization_target Localization target to which the language pack belongs @language_pack_id Identifier of the updated language pack @strings List of changed language pack strings +updateLanguagePackStrings localization_target:string language_pack_id:string strings:vector = Update; + //@description The connection state has changed @state The new connection state updateConnectionState state:ConnectionState = Update; +//@description New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method should be called with the reason "Decline ToS update" @terms_of_service_id Identifier of the terms of service @terms_of_service The new terms of service +updateTermsOfService terms_of_service_id:string terms_of_service:termsOfService = Update; + //@description A new incoming inline query; for bots only @id Unique query identifier @sender_user_id Identifier of the user who sent the query @user_location User location, provided by the client; may be null @query Text of the query @offset Offset of the first entry to return updateNewInlineQuery id:int64 sender_user_id:int32 user_location:location query:string offset:string = Update; @@ -1940,7 +2294,7 @@ updateNewCallbackQuery id:int64 sender_user_id:int32 chat_id:int53 message_id:in updateNewInlineCallbackQuery id:int64 sender_user_id:int32 inline_message_id:string chat_instance:int64 payload:CallbackQueryPayload = Update; //@description A new incoming shipping query; for bots only. Only for invoices with flexible price @id Unique query identifier @sender_user_id Identifier of the user who sent the query @invoice_payload Invoice payload @shipping_address User shipping address -updateNewShippingQuery id:int64 sender_user_id:int32 invoice_payload:string shipping_address:shippingAddress = Update; +updateNewShippingQuery id:int64 sender_user_id:int32 invoice_payload:string shipping_address:address = Update; //@description A new incoming pre-checkout query; for bots only. Contains full information about a checkout @id Unique query identifier @sender_user_id Identifier of the user who sent the query @currency Currency for the product price @total_amount Total price for the product, in the minimal quantity of the currency //@invoice_payload Invoice payload @shipping_option_id Identifier of a shipping option chosen by the user; may be empty if not applicable @order_info Information about the order; may be null @@ -2032,7 +2386,7 @@ getRecoveryEmailAddress password:string = RecoveryEmailAddress; setRecoveryEmailAddress password:string new_recovery_email_address:string = PasswordState; //@description Requests to send a password recovery code to an email address that was previously set up -requestPasswordRecovery = PasswordRecoveryInfo; +requestPasswordRecovery = EmailAddressAuthenticationCodeInfo; //@description Recovers the password using a recovery code sent to an email address that was previously set up @recovery_code Recovery code to check recoverPassword recovery_code:string = PasswordState; @@ -2139,7 +2493,7 @@ getGroupsInCommon user_id:int32 offset_chat_id:int53 limit:int32 = Chats; //@description Returns messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id). //-For optimal performance the number of returned messages is chosen by the library. This is an offline request if only_local is true //@chat_id Chat identifier -//@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the beginning (i.e., from oldest to newest) +//@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages //@limit 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. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached //@only_local If true, returns only messages that are available locally without sending network requests @@ -2153,7 +2507,7 @@ deleteChatHistory chat_id:int53 remove_from_chat_list:Bool = Ok; //@chat_id Identifier of the chat in which to search messages //@query Query to search for //@sender_user_id If not 0, only messages sent by the specified user will be returned. Not supported in secret chats -//@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the beginning +//@from_message_id Identifier of the message starting from which history must be fetched; use 0 to get results from the last message //@offset Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages //@limit 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. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached //@filter Filter for message content in the search results @@ -2162,7 +2516,7 @@ searchChatMessages chat_id:int53 query:string sender_user_id:int32 from_message_ //@description Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)). //-For optimal performance the number of returned messages is chosen by the library //@query Query to search for -//@offset_date The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the beginning +//@offset_date The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the last message //@offset_chat_id The chat identifier of the last found message, or 0 for the first request //@offset_message_id The message identifier of the last found message, or 0 for the first request //@limit The maximum number of messages to be returned, up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached @@ -2170,13 +2524,13 @@ searchMessages query:string offset_date:int32 offset_chat_id:int53 offset_messag //@description Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance the number of returned messages is chosen by the library //@chat_id Identifier of the chat in which to search. Specify 0 to search in all secret chats @query Query to search for. If empty, searchChatMessages should be used instead -//@from_search_id The identifier from the result of a previous request, use 0 to get results from the beginning +//@from_search_id The identifier from the result of a previous request, use 0 to get results from the last message //@limit Maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached //@filter A filter for the content of messages in the search results searchSecretMessages chat_id:int53 query:string from_search_id:int64 limit:int32 filter:SearchMessagesFilter = FoundMessages; //@description Searches for call messages. Returns the results in reverse chronological order (i. e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library -//@from_message_id Identifier of the message from which to search; use 0 to get results from the beginning +//@from_message_id Identifier of the message from which to search; use 0 to get results from the last message //@limit The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached @only_missed If true, returns only messages with missed calls searchCallMessages from_message_id:int53 limit:int32 only_missed:Bool = Messages; @@ -2189,6 +2543,9 @@ getActiveLiveLocationMessages = Messages; //@description Returns the last message sent in a chat no later than the specified date @chat_id Chat identifier @date Point in time (Unix timestamp) relative to which to search for messages getChatMessageByDate chat_id:int53 date:int32 = Message; +//@description Returns approximate number of messages of the specified type in the chat @chat_id Identifier of the chat in which to count messages @filter Filter for message content; searchMessagesFilterEmpty is unsupported in this function @return_local If true, returns count that is available locally without sending network requests, returning -1 if the number of messages is unknown +getChatMessageCount chat_id:int53 filter:SearchMessagesFilter return_local:Bool = Count; + //@description Returns a public HTTPS link to a message. Available only for messages in public supergroups and channels //@chat_id Identifier of the chat to which the message belongs @@ -2228,6 +2585,10 @@ sendChatSetTtlMessage chat_id:int53 ttl:int32 = Message; //@description Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats @chat_id Chat identifier sendChatScreenshotTakenNotification chat_id:int53 = Ok; +//@description Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message @chat_id Target chat @sender_user_id Identifier of the user who will be shown as the sender of the message; may be 0 for channel posts +//@reply_to_message_id Identifier of the message to reply to or 0 @disable_notification Pass true to disable notification for the message @input_message_content The content of the message to be added +addLocalMessage chat_id:int53 sender_user_id:int32 reply_to_message_id:int53 disable_notification:Bool input_message_content:InputMessageContent = Message; + //@description Deletes messages @chat_id Chat identifier @message_ids Identifiers of the messages to be deleted @revoke Pass true to try to delete outgoing messages for all chat members (may fail if messages are too old). Always true for supergroups, channels and secret chats deleteMessages chat_id:int53 message_ids:vector revoke:Bool = Ok; @@ -2235,32 +2596,40 @@ deleteMessages chat_id:int53 message_ids:vector revoke:Bool = Ok; deleteChatMessagesFromUser chat_id:int53 user_id:int32 = Ok; -//@description Edits the text of a message (or a text of a game message). Non-bot users can edit messages for a limited period of time. Returns the edited message after the edit is completed on the server side +//@description Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side //@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @input_message_content New text content of the message. Should be of type InputMessageText editMessageText chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; -//@description Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed server-side -//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup Tew message reply markup; for bots only @location New location content of the message; may be null. Pass null to stop sharing the live location +//@description Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @location New location content of the message; may be null. Pass null to stop sharing the live location editMessageLiveLocation chat_id:int53 message_id:int53 reply_markup:ReplyMarkup location:location = Message; -//@description Edits the message content caption. Non-bots can edit messages for a limited period of time. Returns the edited message after the edit is completed server-side -//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @caption New message content caption; 0-200 characters +//@description Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can't be replaced if the message was set to self-destruct. Media can't be replaced by self-destructing media. Media in an album can be edited only to contain a photo or a video. Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @input_message_content New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo +editMessageMedia chat_id:int53 message_id:int53 reply_markup:ReplyMarkup input_message_content:InputMessageContent = Message; + +//@description Edits the message content caption. Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup; for bots only @caption New message content caption; 0-GetOption("message_caption_length_max") characters editMessageCaption chat_id:int53 message_id:int53 reply_markup:ReplyMarkup caption:formattedText = Message; -//@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed server-side -//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup New message reply markup +//@description Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side +//@chat_id The chat the message belongs to @message_id Identifier of the message @reply_markup The new message reply markup editMessageReplyMarkup chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Message; -//@description Edits the text of an inline text or game message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup New message reply markup @input_message_content New text content of the message. Should be of type InputMessageText +//@description Edits the text of an inline text or game message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup @input_message_content New text content of the message. Should be of type InputMessageText editInlineMessageText inline_message_id:string reply_markup:ReplyMarkup input_message_content:InputMessageContent = Ok; -//@description Edits the content of a live location in an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup New message reply markup @location New location content of the message; may be null. Pass null to stop sharing the live location +//@description Edits the content of a live location in an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup @location New location content of the message; may be null. Pass null to stop sharing the live location editInlineMessageLiveLocation inline_message_id:string reply_markup:ReplyMarkup location:location = Ok; -//@description Edits the caption of an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup New message reply markup @caption New message content caption; 0-200 characters +//@description Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only @inline_message_id Inline message identifier +//@reply_markup The new message reply markup; for bots only @input_message_content New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo +editInlineMessageMedia inline_message_id:string reply_markup:ReplyMarkup input_message_content:InputMessageContent = Ok; + +//@description Edits the caption of an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup @caption New message content caption; 0-GetOption("message_caption_length_max") characters editInlineMessageCaption inline_message_id:string reply_markup:ReplyMarkup caption:formattedText = Ok; -//@description Edits the reply markup of an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup New message reply markup +//@description Edits the reply markup of an inline message sent via a bot; for bots only @inline_message_id Inline message identifier @reply_markup The new message reply markup editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup = Ok; @@ -2276,6 +2645,13 @@ getFileMimeType file_name:string = Text; //@description Returns the extension of a file, guessed by its MIME type. Returns an empty string on failure. This is an offline method. Can be called before authorization. Can be called synchronously @mime_type The MIME type of the file getFileExtension mime_type:string = Text; +//@description Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. This is an offline method. Can be called before authorization. Can be called synchronously @file_name File name or path to the file +cleanFileName file_name:string = Text; + +//@description Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. This is an offline method. Can be called before authorization. Can be called synchronously +//@language_pack_database_path Path to the language pack database in which strings are stored @localization_target Localization target to which the language pack belongs @language_pack_id Language pack identifier @key Language pack key of the string to be returned +getLanguagePackString language_pack_database_path:string localization_target:string language_pack_id:string key:string = LanguagePackStringValue; + //@description Sends an inline query to a bot and returns its results. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires @bot_user_id The identifier of the target bot //@chat_id Identifier of the chat, where the query was sent @user_location Location of the user, only if needed @query Text of the query @offset Offset of the first entry to return @@ -2379,12 +2755,27 @@ setChatPhoto chat_id:int53 photo:InputFile = Ok; //@description Changes the draft message in a chat @chat_id Chat identifier @draft_message New draft message; may be null setChatDraftMessage chat_id:int53 draft_message:draftMessage = Ok; +//@description Changes the notification settings of a chat @chat_id Chat identifier @notification_settings New notification settings for the chat +setChatNotificationSettings chat_id:int53 notification_settings:chatNotificationSettings = Ok; + //@description Changes the pinned state of a chat. You can pin up to GetOption("pinned_chat_count_max") non-secret chats and the same number of secret chats @chat_id Chat identifier @is_pinned New value of is_pinned toggleChatIsPinned chat_id:int53 is_pinned:Bool = Ok; +//@description Changes the marked as unread state of a chat @chat_id Chat identifier @is_marked_as_unread New value of is_marked_as_unread +toggleChatIsMarkedAsUnread chat_id:int53 is_marked_as_unread:Bool = Ok; + +//@description Changes the value of the default disable_notification parameter, used when a message is sent to a chat @chat_id Chat identifier @default_disable_notification New value of default_disable_notification +toggleChatDefaultDisableNotification chat_id:int53 default_disable_notification:Bool = Ok; + //@description Changes client data associated with a chat @chat_id Chat identifier @client_data New value of client_data setChatClientData chat_id:int53 client_data:string = Ok; +//@description Adds current user as a new member to a chat. Private and secret chats can't be joined using this method @chat_id Chat identifier +joinChat chat_id:int53 = Ok; + +//@description Removes current user from chat members. Private and secret chats can't be left using this method @chat_id Chat identifier +leaveChat chat_id:int53 = Ok; + //@description Adds a new member to a chat. Members can't be added to private or secret chats. Members will not be added until the chat state has been synchronized with the server //@chat_id Chat identifier @user_id Identifier of the user @forward_limit The number of earlier messages from the chat to be forwarded to the new member; up to 300. Ignored for supergroups and channels addChatMember chat_id:int53 user_id:int32 forward_limit:int32 = Ok; @@ -2400,13 +2791,27 @@ setChatMemberStatus chat_id:int53 user_id:int32 status:ChatMemberStatus = Ok; //@description Returns information about a single member of a chat @chat_id Chat identifier @user_id User identifier getChatMember chat_id:int53 user_id:int32 = ChatMember; -//@description Searches for a specified query in the first name, last name and username of the members of a specified chat. Requires administrator rights in channels @chat_id Chat identifier @query Query to search for @limit The maximum number of users to be returned -searchChatMembers chat_id:int53 query:string limit:int32 = ChatMembers; +//@description Searches for a specified query in the first name, last name and username of the members of a specified chat. Requires administrator rights in channels @chat_id Chat identifier @query Query to search for @limit The maximum number of users to be returned @filter The type of users to return. By default, chatMembersFilterMembers +searchChatMembers chat_id:int53 query:string limit:int32 filter:ChatMembersFilter = ChatMembers; //@description Returns a list of users who are administrators of the chat @chat_id Chat identifier getChatAdministrators chat_id:int53 = Users; +//@description Clears draft messages in all chats @exclude_secret_chats If true, local draft messages in secret chats will not be cleared +clearAllDraftMessages exclude_secret_chats:Bool = Ok; + + +//@description Returns the notification settings for chats of a given type @scope Types of chats for which to return the notification settings information +getScopeNotificationSettings scope:NotificationSettingsScope = ScopeNotificationSettings; + +//@description Changes notification settings for chats of a given type @scope Types of chats for which to change the notification settings @notification_settings The new notification settings for the given scope +setScopeNotificationSettings scope:NotificationSettingsScope notification_settings:scopeNotificationSettings = Ok; + +//@description Resets all notification settings to their default values. By default, all chats are unmuted, the sound is set to "default" and message previews are shown +resetAllNotificationSettings = Ok; + + //@description Changes the order of pinned chats @chat_ids The new list of pinned chats setPinnedChats chat_ids:vector = Ok; @@ -2479,9 +2884,12 @@ unblockUser user_id:int32 = Ok; getBlockedUsers offset:int32 limit:int32 = Users; -//@description Adds new contacts or edits existing contacts; contacts' user identifiers are ignored @contacts The list of contacts to import or edit +//@description Adds new contacts or edits existing contacts; contacts' user identifiers are ignored @contacts The list of contacts to import or edit, contact's vCard are ignored and are not imported importContacts contacts:vector = ImportedContacts; +//@description Returns all user contacts +getContacts = Users; + //@description Searches for the specified query in the first names, last names and usernames of the known user contacts @query Query to search for; can be empty to return all contacts @limit Maximum number of users to be returned searchContacts query:string limit:int32 = Users; @@ -2492,10 +2900,10 @@ removeContacts user_ids:vector = Ok; getImportedContactCount = Count; //@description Changes imported contacts using the list of current user contacts saved on the device. Imports newly added contacts and, if at least the file database is enabled, deletes recently deleted contacts. -//-Query result depends on the result of the previous query, so only one query is possible at the same time @contacts The new list of contacts +//-Query result depends on the result of the previous query, so only one query is possible at the same time @contacts The new list of contacts, contact's vCard are ignored and are not imported changeImportedContacts contacts:vector = ImportedContacts; -//@description Clears all imported contacts +//@description Clears all imported contacts, contacts list remains unchanged clearImportedContacts = Ok; @@ -2598,17 +3006,6 @@ getWebPagePreview text:formattedText = WebPage; getWebPageInstantView url:string force_full:Bool = WebPageInstantView; -//@description Returns the notification settings for a given scope @scope Scope for which to return the notification settings information -getNotificationSettings scope:NotificationSettingsScope = NotificationSettings; - -//@description Changes notification settings for a given scope @scope Scope for which to change the notification settings -//@notification_settings The new notification settings for the given scope -setNotificationSettings scope:NotificationSettingsScope notification_settings:notificationSettings = Ok; - -//@description Resets all notification settings to their default values. By default, the only muted chats are supergroups, the sound is set to "default" and message previews are shown -resetAllNotificationSettings = Ok; - - //@description Uploads a new profile photo for the current user. If something changes, updateUser will be sent @photo Profile photo to set. inputFileId and inputFileRemote may still be unsupported setProfilePhoto photo:InputFile = Ok; @@ -2683,7 +3080,7 @@ pinSupergroupMessage supergroup_id:int32 message_id:int53 disable_notification:B //@description Removes the pinned message from a supergroup or channel; requires appropriate administrator rights in the supergroup or channel @supergroup_id Identifier of the supergroup or channel unpinSupergroupMessage supergroup_id:int32 = Ok; -//@description Reports some messages from a user in a supergroup as spam @supergroup_id Supergroup identifier @user_id User identifier @message_ids Identifiers of messages sent in the supergroup by the user. This list must be non-empty +//@description Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup @supergroup_id Supergroup identifier @user_id User identifier @message_ids Identifiers of messages sent in the supergroup by the user. This list must be non-empty reportSupergroupSpam supergroup_id:int32 user_id:int32 message_ids:vector = Ok; //@description Returns information about members or banned users in a supergroup or channel. Can be used only if SupergroupFullInfo.can_get_members == true; additionally, administrator privileges may be required for some filters @supergroup_id Identifier of the supergroup or channel @@ -2734,6 +3131,25 @@ getSupportUser = User; getWallpapers = Wallpapers; +//@description Returns information about the current localization target. This is an offline request if only_local is true @only_local If true, returns only locally available information without sending network requests +getLocalizationTargetInfo only_local:Bool = LocalizationTargetInfo; + +//@description Returns strings from a language pack in the current localization target by their keys @language_pack_id Language pack identifier of the strings to be returned @keys Language pack keys of the strings to be returned; leave empty to request all available strings +getLanguagePackStrings language_pack_id:string keys:vector = LanguagePackStrings; + +//@description Adds or changes a custom language pack to the current localization target @info 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 @strings Strings of the new language pack +setCustomLanguagePack info:languagePackInfo strings:vector = Ok; + +//@description Edits information about a custom language pack in the current localization target @info New information about the custom language pack +editCustomLanguagePackInfo info:languagePackInfo = Ok; + +//@description Adds, edits or deletes a string in a custom language pack @language_pack_id Identifier of a previously added custom language pack in the current localization target @new_string New language pack string +setCustomLanguagePackString language_pack_id:string new_string:languagePackString = Ok; + +//@description Deletes all information about a language pack in the current localization target. The language pack that is currently in use can't be deleted @language_pack_id Identifier of the language pack to delete +deleteLanguagePack language_pack_id:string = Ok; + + //@description Registers the currently used device for receiving push notifications @device_token Device token @other_user_ids List of at most 100 user identifiers of other users currently using the client registerDevice device_token:DeviceToken other_user_ids:vector = Ok; @@ -2764,7 +3180,7 @@ setAccountTtl ttl:accountTtl = Ok; //@description Returns the period of inactivity after which the account of the current user will automatically be deleted getAccountTtl = AccountTtl; -//@description Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account @reason The reason why the account was deleted; optional +//@description Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account. Can be called before authorization when the current authorization state is authorizationStateWaitPassword @reason The reason why the account was deleted; optional deleteAccount reason:string = Ok; @@ -2810,6 +3226,65 @@ addNetworkStatistics entry:NetworkStatisticsEntry = Ok; resetNetworkStatistics = Ok; +//@description Returns one of the available Telegram Passport elements @type Telegram Passport element type @password Password of the current user +getPassportElement type:PassportElementType password:string = PassportElement; + +//@description Returns all available Telegram Passport elements @password Password of the current user +getAllPassportElements password:string = PassportElements; + +//@description Adds an element to the user's Telegram Passport. May return an error with a message "PHONE_VERIFICATION_NEEDED" or "EMAIL_VERIFICATION_NEEDED" if the chosen phone number or the chosen email address must be verified first @element Input Telegram Passport element @password Password of the current user +setPassportElement element:InputPassportElement password:string = PassportElement; + +//@description Deletes a Telegram Passport element @type Element type +deletePassportElement type:PassportElementType = Ok; + +//@description Informs the user that some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed @user_id User identifier @errors The errors +setPassportElementErrors user_id:int32 errors:vector = Ok; + + +//@description Returns an IETF language tag of the language preferred in the country, which should be used to fill native fields in Telegram Passport personal details. Returns a 404 error if unknown @country_code A two-letter ISO 3166-1 alpha-2 country code +getPreferredCountryLanguage country_code:string = Text; + + +//@description Sends a code to verify a phone number to be added to a user's Telegram Passport +//@phone_number The phone number of the user, in international format @allow_flash_call Pass true if the authentication code may be sent via flash call to the specified phone number @is_current_phone_number Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false +sendPhoneNumberVerificationCode phone_number:string allow_flash_call:Bool is_current_phone_number:Bool = AuthenticationCodeInfo; + +//@description Re-sends the code to verify a phone number to be added to a user's Telegram Passport +resendPhoneNumberVerificationCode = AuthenticationCodeInfo; + +//@description Checks the phone number verification code for Telegram Passport @code Verification code +checkPhoneNumberVerificationCode code:string = Ok; + + +//@description Sends a code to verify an email address to be added to a user's Telegram Passport @email_address Email address +sendEmailAddressVerificationCode email_address:string = EmailAddressAuthenticationCodeInfo; + +//@description Re-sends the code to verify an email address to be added to a user's Telegram Passport +resendEmailAddressVerificationCode = EmailAddressAuthenticationCodeInfo; + +//@description Checks the email address verification code for Telegram Passport @code Verification code +checkEmailAddressVerificationCode code:string = Ok; + + +//@description Returns a Telegram Passport authorization form for sharing data with a service @bot_user_id User identifier of the service's bot @scope Telegram Passport element types requested by the service @public_key Service's public_key @nonce Authorization form nonce provided by the service @password Password of the current user +getPassportAuthorizationForm bot_user_id:int32 scope:string public_key:string nonce:string password:string = PassportAuthorizationForm; + +//@description Sends a Telegram Passport authorization form, effectively sharing data with the service @autorization_form_id Authorization form identifier @types Types of Telegram Passport elements chosen by user to complete the authorization form +sendPassportAuthorizationForm autorization_form_id:int32 types:vector = Ok; + + +//@description Sends phone number confirmation code. Should be called when user presses "https://t.me/confirmphone?phone=*******&hash=**********" or "tg://confirmphone?phone=*******&hash=**********" link @hash Value of the "hash" parameter from the link +//@phone_number Value of the "phone" parameter from the link @allow_flash_call Pass true if the authentication code may be sent via flash call to the specified phone number @is_current_phone_number Pass true if the phone number is used on the current device. Ignored if allow_flash_call is false +sendPhoneNumberConfirmationCode hash:string phone_number:string allow_flash_call:Bool is_current_phone_number:Bool = AuthenticationCodeInfo; + +//@description Resends phone number confirmation code +resendPhoneNumberConfirmationCode = AuthenticationCodeInfo; + +//@description Checks phone number confirmation code @code The phone number confirmation code +checkPhoneNumberConfirmationCode code:string = Ok; + + //@description Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only @pending_update_count The number of pending updates @error_message The last error message setBotUpdatesStatus pending_update_count:int32 error_message:string = Ok; @@ -2831,6 +3306,14 @@ setStickerPositionInSet sticker:InputFile position:int32 = Ok; removeStickerFromSet sticker:InputFile = Ok; +//@description Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded @location Location of the map center @zoom Map zoom level; 13-20 @width Map width in pixels before applying scale; 16-1024 @height Map height in pixels before applying scale; 16-1024 @scale Map scale; 1-3 @chat_id Identifier of a chat, in which the thumbnail will be shown. Use 0 if unknown +getMapThumbnailFile location:location zoom:int32 width:int32 height:int32 scale:int32 chat_id:int53 = File; + + +//@description Accepts Telegram terms of services @terms_of_service_id Terms of service identifier +acceptTermsOfService terms_of_service_id:string = Ok; + + //@description Sends a custom request; for bots only @method The method name @parameters JSON-serialized method parameters sendCustomRequest method:string parameters:string = CustomRequestResult; @@ -2838,7 +3321,7 @@ sendCustomRequest method:string parameters:string = CustomRequestResult; answerCustomQuery custom_query_id:int64 data:string = Ok; -//@description Succeeds after a specified amount of time has passed. Can be called before authorization @seconds Number of seconds before the function returns +//@description Succeeds after a specified amount of time has passed. Can be called before authorization. Can be called before initialization @seconds Number of seconds before the function returns setAlarm seconds:double = Ok; @@ -2848,15 +3331,33 @@ getCountryCode = Text; //@description Returns the default text for invitation messages to be used as a placeholder when the current user invites friends to Telegram getInviteText = Text; -//@description Returns the terms of service. Can be called before authorization -getTermsOfService = Text; +//@description Returns information about a tg:// deep link. Use "tg://need_update_for_some_feature" or "tg:some_unsupported_feature" for testing. Returns a 404 error for unknown links. Can be called before authorization @link The link +getDeepLinkInfo link:string = DeepLinkInfo; -//@description Sets the proxy server for network requests. Can be called before authorization @proxy Proxy server to use. Specify null to remove the proxy server -setProxy proxy:Proxy = Ok; +//@description Adds a proxy server for network requests. Can be called before authorization @server Proxy server IP address @port Proxy server port @enable True, if the proxy should be enabled @type Proxy type +addProxy server:string port:int32 enable:Bool type:ProxyType = Proxy; -//@description Returns the proxy that is currently set up. Can be called before authorization -getProxy = Proxy; +//@description Edits an existing proxy server for network requests. Can be called before authorization @proxy_id Proxy identifier @server Proxy server IP address @port Proxy server port @enable True, if the proxy should be enabled @type Proxy type +editProxy proxy_id:int32 server:string port:int32 enable:Bool type:ProxyType = Proxy; + +//@description Enables a proxy. Only one proxy can be enabled at a time. Can be called before authorization @proxy_id Proxy identifier +enableProxy proxy_id:int32 = Ok; + +//@description Disables the currently enabled proxy. Can be called before authorization +disableProxy = Ok; + +//@description Removes a proxy server. Can be called before authorization @proxy_id Proxy identifier +removeProxy proxy_id:int32 = Ok; + +//@description Returns list of proxies that are currently set up. Can be called before authorization +getProxies = Proxies; + +//@description Returns an HTTPS link, which can be used to add a proxy. Available only for SOCKS5 and MTProto proxies. Can be called before authorization @proxy_id Proxy identifier +getProxyLink proxy_id:int32 = Text; + +//@description Computes time needed to receive a response from a Telegram server through a proxy. Can be called before authorization @proxy_id Proxy identifier. Use 0 to ping a Telegram server without a proxy +pingProxy proxy_id:int32 = Seconds; //@description Does nothing; for testing only