From f8029204e473c004369cf6964aad76c5618d38cc Mon Sep 17 00:00:00 2001 From: Aleksandr Zelenin Date: Fri, 7 Jun 2019 13:56:06 +0300 Subject: [PATCH] version bump --- Makefile | 2 +- client/function.go | 1226 ++++++++++++-- client/type.go | 3573 +++++++++++++++++++++++++++++++++++++---- client/unmarshaler.go | 1367 +++++++++++++++- data/td_api.json | 2546 ++++++++++++++++++++++++++--- data/td_api.tl | 782 +++++++-- 6 files changed, 8617 insertions(+), 879 deletions(-) diff --git a/Makefile b/Makefile index b4b70eb..4cfbd8b 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -TAG := v1.3.0 +TAG := v1.4.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/client/function.go b/client/function.go index 8401d7d..ed48a4e 100755 --- a/client/function.go +++ b/client/function.go @@ -161,9 +161,9 @@ func (client *Client) ResendAuthenticationCode() (*Ok, error) { type CheckAuthenticationCodeRequest struct { // The verification code received via SMS, Telegram message, phone call, or flash call Code string `json:"code"` - // If the user is not yet registered, the first name of the user; 1-255 characters + // If the user is not yet registered, the first name of the user; 1-64 characters. You can also pass an empty string for unregistered user there to check verification code validness. In the latter case PHONE_NUMBER_UNOCCUPIED error will be returned for a valid code FirstName string `json:"first_name"` - // If the user is not yet registered; the last name of the user; optional; 0-255 characters + // If the user is not yet registered; the last name of the user; optional; 0-64 characters LastName string `json:"last_name"` } @@ -344,6 +344,25 @@ func (client *Client) Destroy() (*Ok, error) { return UnmarshalOk(result.Data) } +// Returns all updates needed to restore current TDLib state, i.e. all actual UpdateAuthorizationState/UpdateUser/UpdateNewChat and others. This is especially usefull if TDLib is run in a separate process. This is an offline method. Can be called before authorization +func (client *Client) GetCurrentState() (*Updates, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getCurrentState", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalUpdates(result.Data) +} + type SetDatabaseEncryptionKeyRequest struct { // New encryption key NewEncryptionKey []byte `json:"new_encryption_key"` @@ -402,7 +421,7 @@ type SetPasswordRequest struct { NewRecoveryEmailAddress string `json:"new_recovery_email_address"` } -// Changes the password for the user. If a new recovery email address is specified, then the error EMAIL_UNCONFIRMED is returned and the password change will not be applied until the new recovery email address has been confirmed. The application should periodically call getPasswordState to check whether the new email address has been confirmed +// Changes the password for the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed func (client *Client) SetPassword(req *SetPasswordRequest) (*PasswordState, error) { result, err := client.Send(Request{ meta: meta{ @@ -432,7 +451,7 @@ type GetRecoveryEmailAddressRequest struct { Password string `json:"password"` } -// Returns a recovery email address that was previously set up. This method can be used to verify a password provided by the user +// Returns a 2-step verification recovery email address that was previously set up. This method can be used to verify a password provided by the user func (client *Client) GetRecoveryEmailAddress(req *GetRecoveryEmailAddressRequest) (*RecoveryEmailAddress, error) { result, err := client.Send(Request{ meta: meta{ @@ -460,7 +479,7 @@ type SetRecoveryEmailAddressRequest struct { NewRecoveryEmailAddress string `json:"new_recovery_email_address"` } -// Changes the recovery email address of the user. If a new recovery email address is specified, then the error EMAIL_UNCONFIRMED is returned and the email address will not be changed until the new email has been confirmed. The application should periodically call getPasswordState to check whether the email address has been confirmed. If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation +// Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation func (client *Client) SetRecoveryEmailAddress(req *SetRecoveryEmailAddressRequest) (*PasswordState, error) { result, err := client.Send(Request{ meta: meta{ @@ -482,6 +501,51 @@ func (client *Client) SetRecoveryEmailAddress(req *SetRecoveryEmailAddressReques return UnmarshalPasswordState(result.Data) } +type CheckRecoveryEmailAddressCodeRequest struct { + // Verification code + Code string `json:"code"` +} + +// Checks the 2-step verification recovery email address verification code +func (client *Client) CheckRecoveryEmailAddressCode(req *CheckRecoveryEmailAddressCodeRequest) (*PasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "checkRecoveryEmailAddressCode", + }, + Data: map[string]interface{}{ + "code": req.Code, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasswordState(result.Data) +} + +// Resends the 2-step verification recovery email address verification code +func (client *Client) ResendRecoveryEmailAddressCode() (*PasswordState, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "resendRecoveryEmailAddressCode", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPasswordState(result.Data) +} + // Requests to send a password recovery code to an email address that was previously set up func (client *Client) RequestPasswordRecovery() (*EmailAddressAuthenticationCodeInfo, error) { result, err := client.Send(Request{ @@ -575,35 +639,6 @@ func (client *Client) GetTemporaryPasswordState() (*TemporaryPasswordState, erro return UnmarshalTemporaryPasswordState(result.Data) } -type ProcessDcUpdateRequest struct { - // Value of the "dc" parameter of the notification - Dc string `json:"dc"` - // Value of the "addr" parameter of the notification - Addr string `json:"addr"` -} - -// Handles a DC_UPDATE push service notification. Can be called before authorization -func (client *Client) ProcessDcUpdate(req *ProcessDcUpdateRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "processDcUpdate", - }, - Data: map[string]interface{}{ - "dc": req.Dc, - "addr": req.Addr, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - // Returns the current user func (client *Client) GetMe() (*User, error) { result, err := client.Send(Request{ @@ -860,6 +895,35 @@ func (client *Client) GetMessage(req *GetMessageRequest) (*Message, error) { return UnmarshalMessage(result.Data) } +type GetMessageLocallyRequest struct { + // Identifier of the chat the message belongs to + ChatId int64 `json:"chat_id"` + // Identifier of the message to get + MessageId int64 `json:"message_id"` +} + +// Returns information about a message, if it is available locally without sending network request. This is an offline request +func (client *Client) GetMessageLocally(req *GetMessageLocallyRequest) (*Message, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageLocally", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalMessage(result.Data) +} + type GetRepliedMessageRequest struct { // Identifier of the chat the message belongs to ChatId int64 `json:"chat_id"` @@ -1008,7 +1072,7 @@ type GetChatsRequest struct { Limit int32 `json:"limit"` } -// Returns an ordered list of chats. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to 2^63 - 1). For optimal performance the number of returned chats is chosen by the library. +// Returns an ordered list of chats. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed 64-bit number 9223372036854775807 == 2^63 - 1). For optimal performance the number of returned chats is chosen by the library. func (client *Client) GetChats(req *GetChatsRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -1272,7 +1336,7 @@ func (client *Client) ClearRecentlyFoundChats() (*Ok, error) { type CheckChatUsernameRequest struct { // Chat identifier; should be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if chat is being created - ChatId JsonInt64 `json:"chat_id"` + ChatId int64 `json:"chat_id"` // Username to be checked Username string `json:"username"` } @@ -1345,7 +1409,7 @@ type GetGroupsInCommonRequest struct { Limit int32 `json:"limit"` } -// Returns a list of common chats with a given user. Chats are sorted by their type and creation date +// Returns a list of common group chats with a given user. Chats are sorted by their type and creation date func (client *Client) GetGroupsInCommon(req *GetGroupsInCommonRequest) (*Chats, error) { result, err := client.Send(Request{ meta: meta{ @@ -1373,9 +1437,9 @@ type GetChatHistoryRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the message starting from which history must be fetched; use 0 to get results from the last message FromMessageId int64 `json:"from_message_id"` - // Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages + // Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages Offset int32 `json:"offset"` - // The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached + // 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 or equal to -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached Limit int32 `json:"limit"` // If true, returns only messages that are available locally without sending network requests OnlyLocal bool `json:"only_local"` @@ -1409,11 +1473,13 @@ func (client *Client) GetChatHistory(req *GetChatHistoryRequest) (*Messages, err type DeleteChatHistoryRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // Pass true if the chat should be removed from the chats list + // Pass true if the chat should be removed from the chat list RemoveFromChatList bool `json:"remove_from_chat_list"` + // Pass true to try to delete chat history for all users + Revoke bool `json:"revoke"` } -// Deletes all messages in the chat only for the user. Cannot be used in channels and public supergroups +// Deletes all messages in the chat. Use Chat.can_be_deleted_only_for_self and Chat.can_be_deleted_for_all_users fields to find whether and how the method can be applied to the chat func (client *Client) DeleteChatHistory(req *DeleteChatHistoryRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -1422,6 +1488,7 @@ func (client *Client) DeleteChatHistory(req *DeleteChatHistoryRequest) (*Ok, err Data: map[string]interface{}{ "chat_id": req.ChatId, "remove_from_chat_list": req.RemoveFromChatList, + "revoke": req.Revoke, }, }) if err != nil { @@ -1696,6 +1763,64 @@ func (client *Client) GetChatMessageCount(req *GetChatMessageCountRequest) (*Cou return UnmarshalCount(result.Data) } +type RemoveNotificationRequest struct { + // Identifier of notification group to which the notification belongs + NotificationGroupId int32 `json:"notification_group_id"` + // Identifier of removed notification + NotificationId int32 `json:"notification_id"` +} + +// Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user +func (client *Client) RemoveNotification(req *RemoveNotificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeNotification", + }, + Data: map[string]interface{}{ + "notification_group_id": req.NotificationGroupId, + "notification_id": req.NotificationId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type RemoveNotificationGroupRequest struct { + // Notification group identifier + NotificationGroupId int32 `json:"notification_group_id"` + // Maximum identifier of removed notifications + MaxNotificationId int32 `json:"max_notification_id"` +} + +// Removes a group of active notifications. Needs to be called only if the notification group is removed by the current user +func (client *Client) RemoveNotificationGroup(req *RemoveNotificationGroupRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "removeNotificationGroup", + }, + Data: map[string]interface{}{ + "notification_group_id": req.NotificationGroupId, + "max_notification_id": req.MaxNotificationId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetPublicMessageLinkRequest struct { // Identifier of the chat to which the message belongs ChatId int64 `json:"chat_id"` @@ -1728,6 +1853,35 @@ func (client *Client) GetPublicMessageLink(req *GetPublicMessageLinkRequest) (*P return UnmarshalPublicMessageLink(result.Data) } +type GetMessageLinkRequest struct { + // Identifier of the chat to which the message belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message + MessageId int64 `json:"message_id"` +} + +// Returns a private HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels. The link will work only for members of the chat +func (client *Client) GetMessageLink(req *GetMessageLinkRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getMessageLink", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type SendMessageRequest struct { // Target chat ChatId int64 `json:"chat_id"` @@ -1852,6 +2006,8 @@ type SendInlineQueryResultMessageRequest struct { QueryId JsonInt64 `json:"query_id"` // Identifier of the inline result ResultId string `json:"result_id"` + // If true, there will be no mention of a bot, via which the message is sent. Can be used only for bots GetOption("animation_search_bot_username"), GetOption("photo_search_bot_username") and GetOption("venue_search_bot_username") + HideViaBot bool `json:"hide_via_bot"` } // Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message @@ -1867,6 +2023,7 @@ func (client *Client) SendInlineQueryResultMessage(req *SendInlineQueryResultMes "from_background": req.FromBackground, "query_id": req.QueryId, "result_id": req.ResultId, + "hide_via_bot": req.HideViaBot, }, }) if err != nil { @@ -2019,7 +2176,7 @@ type DeleteMessagesRequest struct { ChatId int64 `json:"chat_id"` // Identifiers of the messages to be deleted MessageIds []int64 `json:"message_ids"` - // 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 + // Pass true to try to delete messages for all chat members. Always true for supergroups, channels and secret chats Revoke bool `json:"revoke"` } @@ -2584,6 +2741,143 @@ func (client *Client) GetLanguagePackString(req *GetLanguagePackStringRequest) ( } } +type GetJsonValueRequest struct { + // The JSON-serialized string + Json string `json:"json"` +} + +// Converts a JSON-serialized string to corresponding JsonValue object. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) GetJsonValue(req *GetJsonValueRequest) (JsonValue, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getJsonValue", + }, + Data: map[string]interface{}{ + "json": req.Json, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeJsonValueNull: + return UnmarshalJsonValueNull(result.Data) + + case TypeJsonValueBoolean: + return UnmarshalJsonValueBoolean(result.Data) + + case TypeJsonValueNumber: + return UnmarshalJsonValueNumber(result.Data) + + case TypeJsonValueString: + return UnmarshalJsonValueString(result.Data) + + case TypeJsonValueArray: + return UnmarshalJsonValueArray(result.Data) + + case TypeJsonValueObject: + return UnmarshalJsonValueObject(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type GetJsonStringRequest struct { + // The JsonValue object + JsonValue JsonValue `json:"json_value"` +} + +// Converts a JsonValue object to corresponding JSON-serialized string. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) GetJsonString(req *GetJsonStringRequest) (*Text, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getJsonString", + }, + Data: map[string]interface{}{ + "json_value": req.JsonValue, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalText(result.Data) +} + +type SetPollAnswerRequest struct { + // Identifier of the chat to which the poll belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the poll + MessageId int64 `json:"message_id"` + // 0-based identifiers of options, chosen by the user. Currently user can't choose more than 1 option + OptionIds []int32 `json:"option_ids"` +} + +// Changes user answer to a poll +func (client *Client) SetPollAnswer(req *SetPollAnswerRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "setPollAnswer", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "option_ids": req.OptionIds, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type StopPollRequest struct { + // Identifier of the chat to which the poll belongs + ChatId int64 `json:"chat_id"` + // Identifier of the message containing the poll + MessageId int64 `json:"message_id"` + // The new message reply markup; for bots only + ReplyMarkup ReplyMarkup `json:"reply_markup"` +} + +// Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set +func (client *Client) StopPoll(req *StopPollRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "stopPoll", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "reply_markup": req.ReplyMarkup, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type GetInlineQueryResultsRequest struct { // The identifier of the target bot BotUserId int32 `json:"bot_user_id"` @@ -2798,7 +3092,7 @@ func (client *Client) AnswerPreCheckoutQuery(req *AnswerPreCheckoutQueryRequest) } type SetGameScoreRequest struct { - // The chat to which the message with the game + // The chat to which the message with the game belongs ChatId int64 `json:"chat_id"` // Identifier of the message MessageId int64 `json:"message_id"` @@ -3000,7 +3294,7 @@ type OpenChatRequest struct { ChatId int64 `json:"chat_id"` } -// This method should be called if the chat is opened by the user. Many useful activities depend on the chat being opened or closed (e.g., in supergroups and channels all updates are received only for opened chats) +// Informs TDLib that the chat is opened by the user. Many useful activities depend on the chat being opened or closed (e.g., in supergroups and channels all updates are received only for opened chats) func (client *Client) OpenChat(req *OpenChatRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3026,7 +3320,7 @@ type CloseChatRequest struct { ChatId int64 `json:"chat_id"` } -// This method should be called if the chat is closed by the user. Many useful activities depend on the chat being opened or closed +// Informs TDLib that the chat is closed by the user. Many useful activities depend on the chat being opened or closed func (client *Client) CloseChat(req *CloseChatRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3056,7 +3350,7 @@ type ViewMessagesRequest struct { ForceRead bool `json:"force_read"` } -// This method should be called if messages are being viewed by the user. Many useful activities depend on whether the messages are currently being viewed or not (e.g., marking messages as read, incrementing a view counter, updating a view counter, removing deleted messages in supergroups and channels) +// Informs TDLib that messages are being viewed by the user. Many useful activities depend on whether the messages are currently being viewed or not (e.g., marking messages as read, incrementing a view counter, updating a view counter, removing deleted messages in supergroups and channels) func (client *Client) ViewMessages(req *ViewMessagesRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3086,7 +3380,7 @@ type OpenMessageContentRequest struct { MessageId int64 `json:"message_id"` } -// This method should be called if the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). An updateMessageContentOpened update will be generated if something has changed +// Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). An updateMessageContentOpened update will be generated if something has changed func (client *Client) OpenMessageContent(req *OpenMessageContentRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -3250,7 +3544,7 @@ func (client *Client) CreateSecretChat(req *CreateSecretChatRequest) (*Chat, err type CreateNewBasicGroupChatRequest struct { // Identifiers of users to be added to the basic group UserIds []int32 `json:"user_ids"` - // Title of the new basic group; 1-255 characters + // Title of the new basic group; 1-128 characters Title string `json:"title"` } @@ -3277,7 +3571,7 @@ func (client *Client) CreateNewBasicGroupChat(req *CreateNewBasicGroupChatReques } type CreateNewSupergroupChatRequest struct { - // Title of the new chat; 1-255 characters + // Title of the new chat; 1-128 characters Title string `json:"title"` // True, if a channel chat should be created IsChannel bool `json:"is_channel"` @@ -3363,7 +3657,7 @@ func (client *Client) UpgradeBasicGroupChatToSupergroupChat(req *UpgradeBasicGro type SetChatTitleRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` - // New title of the chat; 1-255 characters + // New title of the chat; 1-128 characters Title string `json:"title"` } @@ -3592,6 +3886,64 @@ func (client *Client) SetChatClientData(req *SetChatClientDataRequest) (*Ok, err return UnmarshalOk(result.Data) } +type PinChatMessageRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // Identifier of the new pinned message + MessageId int64 `json:"message_id"` + // True, if there should be no notification about the pinned message + DisableNotification bool `json:"disable_notification"` +} + +// Pins a message in a chat; requires appropriate administrator rights in the group or channel +func (client *Client) PinChatMessage(req *PinChatMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "pinChatMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "message_id": req.MessageId, + "disable_notification": req.DisableNotification, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type UnpinChatMessageRequest struct { + // Identifier of the chat + ChatId int64 `json:"chat_id"` +} + +// Removes the pinned message from a chat; requires appropriate administrator rights in the group or channel +func (client *Client) UnpinChatMessage(req *UnpinChatMessageRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "unpinChatMessage", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type JoinChatRequest struct { // Chat identifier ChatId int64 `json:"chat_id"` @@ -3649,7 +4001,7 @@ type AddChatMemberRequest struct { ChatId int64 `json:"chat_id"` // Identifier of the user UserId int32 `json:"user_id"` - // The number of earlier messages from the chat to be forwarded to the new member; up to 300. Ignored for supergroups and channels + // The number of earlier messages from the chat to be forwarded to the new member; up to 100. Ignored for supergroups and channels ForwardLimit int32 `json:"forward_limit"` } @@ -3853,6 +4205,35 @@ func (client *Client) ClearAllDraftMessages(req *ClearAllDraftMessagesRequest) ( return UnmarshalOk(result.Data) } +type GetChatNotificationSettingsExceptionsRequest struct { + // If specified, only chats from the specified scope will be returned + Scope NotificationSettingsScope `json:"scope"` + // If true, also chats with non-default sound will be returned + CompareSound bool `json:"compare_sound"` +} + +// Returns list of chats with non-default notification settings +func (client *Client) GetChatNotificationSettingsExceptions(req *GetChatNotificationSettingsExceptionsRequest) (*Chats, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatNotificationSettingsExceptions", + }, + Data: map[string]interface{}{ + "scope": req.Scope, + "compare_sound": req.CompareSound, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalChats(result.Data) +} + type GetScopeNotificationSettingsRequest struct { // Types of chats for which to return the notification settings information Scope NotificationSettingsScope `json:"scope"` @@ -3958,17 +4339,26 @@ type DownloadFileRequest struct { FileId int32 `json:"file_id"` // Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first Priority int32 `json:"priority"` + // The starting position from which the file should be downloaded + Offset int32 `json:"offset"` + // Number of bytes which should be downloaded starting from the "offset" position before the download will be automatically cancelled; use 0 to download without a limit + Limit int32 `json:"limit"` + // If false, this request returns file state just after the download has been started. If true, this request returns file state only after the download has succeeded, has failed, has been cancelled or a new downloadFile request with different offset/limit parameters was sent + Synchronous bool `json:"synchronous"` } -// Asynchronously downloads a file from the cloud. updateFile will be used to notify about the download progress and successful completion of the download. Returns file state just after the download has been started +// Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates func (client *Client) DownloadFile(req *DownloadFileRequest) (*File, error) { result, err := client.Send(Request{ meta: meta{ Type: "downloadFile", }, Data: map[string]interface{}{ - "file_id": req.FileId, - "priority": req.Priority, + "file_id": req.FileId, + "priority": req.Priority, + "offset": req.Offset, + "limit": req.Limit, + "synchronous": req.Synchronous, }, }) if err != nil { @@ -3982,6 +4372,35 @@ func (client *Client) DownloadFile(req *DownloadFileRequest) (*File, error) { return UnmarshalFile(result.Data) } +type GetFileDownloadedPrefixSizeRequest struct { + // Identifier of the file + FileId int32 `json:"file_id"` + // Offset from which downloaded prefix size should be calculated + Offset int32 `json:"offset"` +} + +// Returns file downloaded prefix size from a given offset +func (client *Client) GetFileDownloadedPrefixSize(req *GetFileDownloadedPrefixSizeRequest) (*Count, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getFileDownloadedPrefixSize", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + "offset": req.Offset, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalCount(result.Data) +} + type CancelDownloadFileRequest struct { // Identifier of a file to stop downloading FileId int32 `json:"file_id"` @@ -4069,6 +4488,38 @@ func (client *Client) CancelUploadFile(req *CancelUploadFileRequest) (*Ok, error return UnmarshalOk(result.Data) } +type WriteGeneratedFilePartRequest struct { + // The identifier of the generation process + GenerationId JsonInt64 `json:"generation_id"` + // The offset from which to write the data to the file + Offset int32 `json:"offset"` + // The data to write + Data []byte `json:"data"` +} + +// Writes a part of a generated file. This method is intended to be used only if the client has no direct access to TDLib's file system, because it is usually slower than a direct write to the destination file +func (client *Client) WriteGeneratedFilePart(req *WriteGeneratedFilePartRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "writeGeneratedFilePart", + }, + Data: map[string]interface{}{ + "generation_id": req.GenerationId, + "offset": req.Offset, + "data": req.Data, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetFileGenerationProgressRequest struct { // The identifier of the generation process GenerationId JsonInt64 `json:"generation_id"` @@ -4078,7 +4529,7 @@ type SetFileGenerationProgressRequest struct { LocalPrefixSize int32 `json:"local_prefix_size"` } -// The next part of a file was generated +// Informs TDLib on a file generation prograss func (client *Client) SetFileGenerationProgress(req *SetFileGenerationProgressRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4130,6 +4581,38 @@ func (client *Client) FinishFileGeneration(req *FinishFileGenerationRequest) (*O return UnmarshalOk(result.Data) } +type ReadFilePartRequest struct { + // Identifier of the file. The file must be located in the TDLib file cache + FileId int32 `json:"file_id"` + // The offset from which to read the file + Offset int32 `json:"offset"` + // Number of bytes to read. An error will be returned if there are not enough bytes available in the file from the specified position. Pass 0 to read all available data from the specified position + Count int32 `json:"count"` +} + +// Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the client has no direct access to TDLib's file system, because it is usually slower than a direct read from the file +func (client *Client) ReadFilePart(req *ReadFilePartRequest) (*FilePart, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "readFilePart", + }, + Data: map[string]interface{}{ + "file_id": req.FileId, + "offset": req.Offset, + "count": req.Count, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalFilePart(result.Data) +} + type DeleteFileRequest struct { // Identifier of the file to delete FileId int32 `json:"file_id"` @@ -4515,7 +4998,7 @@ func (client *Client) GetContacts() (*Users, error) { } type SearchContactsRequest struct { - // Query to search for; can be empty to return all contacts + // Query to search for; may be empty to return all contacts Query string `json:"query"` // Maximum number of users to be returned Limit int32 `json:"limit"` @@ -4548,7 +5031,7 @@ type RemoveContactsRequest struct { UserIds []int32 `json:"user_ids"` } -// Removes users from the contacts list +// Removes users from the contact list func (client *Client) RemoveContacts(req *RemoveContactsRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -4614,7 +5097,7 @@ func (client *Client) ChangeImportedContacts(req *ChangeImportedContactsRequest) return UnmarshalImportedContacts(result.Data) } -// Clears all imported contacts, contacts list remains unchanged +// Clears all imported contacts, contact list remains unchanged func (client *Client) ClearImportedContacts() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -5483,9 +5966,9 @@ func (client *Client) DeleteProfilePhoto(req *DeleteProfilePhotoRequest) (*Ok, e } type SetNameRequest struct { - // The new value of the first name for the user; 1-255 characters + // The new value of the first name for the user; 1-64 characters FirstName string `json:"first_name"` - // The new value of the optional last name for the user; 0-255 characters + // The new value of the optional last name for the user; 0-64 characters LastName string `json:"last_name"` } @@ -5971,64 +6454,6 @@ func (client *Client) SetSupergroupDescription(req *SetSupergroupDescriptionRequ return UnmarshalOk(result.Data) } -type PinSupergroupMessageRequest struct { - // Identifier of the supergroup or channel - SupergroupId int32 `json:"supergroup_id"` - // Identifier of the new pinned message - MessageId int64 `json:"message_id"` - // True, if there should be no notification about the pinned message - DisableNotification bool `json:"disable_notification"` -} - -// Pins a message in a supergroup or channel; requires appropriate administrator rights in the supergroup or channel -func (client *Client) PinSupergroupMessage(req *PinSupergroupMessageRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "pinSupergroupMessage", - }, - Data: map[string]interface{}{ - "supergroup_id": req.SupergroupId, - "message_id": req.MessageId, - "disable_notification": req.DisableNotification, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - -type UnpinSupergroupMessageRequest struct { - // Identifier of the supergroup or channel - SupergroupId int32 `json:"supergroup_id"` -} - -// Removes the pinned message from a supergroup or channel; requires appropriate administrator rights in the supergroup or channel -func (client *Client) UnpinSupergroupMessage(req *UnpinSupergroupMessageRequest) (*Ok, error) { - result, err := client.Send(Request{ - meta: meta{ - Type: "unpinSupergroupMessage", - }, - Data: map[string]interface{}{ - "supergroup_id": req.SupergroupId, - }, - }) - if err != nil { - return nil, err - } - - if result.Type == "error" { - return nil, buildResponseError(result.Data) - } - - return UnmarshalOk(result.Data) -} - type ReportSupergroupSpamRequest struct { // Supergroup identifier SupergroupId int32 `json:"supergroup_id"` @@ -6420,7 +6845,7 @@ type GetLocalizationTargetInfoRequest struct { OnlyLocal bool `json:"only_local"` } -// Returns information about the current localization target. This is an offline request if only_local is true +// Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization func (client *Client) GetLocalizationTargetInfo(req *GetLocalizationTargetInfoRequest) (*LocalizationTargetInfo, error) { result, err := client.Send(Request{ meta: meta{ @@ -6441,6 +6866,32 @@ func (client *Client) GetLocalizationTargetInfo(req *GetLocalizationTargetInfoRe return UnmarshalLocalizationTargetInfo(result.Data) } +type GetLanguagePackInfoRequest struct { + // Language pack identifier + LanguagePackId string `json:"language_pack_id"` +} + +// Returns information about a language pack. Returned language pack identifier may be different from a provided one. Can be called before authorization +func (client *Client) GetLanguagePackInfo(req *GetLanguagePackInfoRequest) (*LanguagePackInfo, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getLanguagePackInfo", + }, + Data: map[string]interface{}{ + "language_pack_id": req.LanguagePackId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLanguagePackInfo(result.Data) +} + type GetLanguagePackStringsRequest struct { // Language pack identifier of the strings to be returned LanguagePackId string `json:"language_pack_id"` @@ -6448,7 +6899,7 @@ type GetLanguagePackStringsRequest struct { Keys []string `json:"keys"` } -// Returns strings from a language pack in the current localization target by their keys +// Returns strings from a language pack in the current localization target by their keys. Can be called before authorization func (client *Client) GetLanguagePackStrings(req *GetLanguagePackStringsRequest) (*LanguagePackStrings, error) { result, err := client.Send(Request{ meta: meta{ @@ -6470,14 +6921,66 @@ func (client *Client) GetLanguagePackStrings(req *GetLanguagePackStringsRequest) return UnmarshalLanguagePackStrings(result.Data) } +type SynchronizeLanguagePackRequest struct { + // Language pack identifier + LanguagePackId string `json:"language_pack_id"` +} + +// Fetches the latest versions of all strings from a language pack in the current localization target from the server. This method doesn't need to be called explicitly for the current used/base language packs. Can be called before authorization +func (client *Client) SynchronizeLanguagePack(req *SynchronizeLanguagePackRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "synchronizeLanguagePack", + }, + Data: map[string]interface{}{ + "language_pack_id": req.LanguagePackId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type AddCustomServerLanguagePackRequest struct { + // Identifier of a language pack to be added; may be different from a name that is used in an "https://t.me/setlanguage/" link + LanguagePackId string `json:"language_pack_id"` +} + +// Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization +func (client *Client) AddCustomServerLanguagePack(req *AddCustomServerLanguagePackRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "addCustomServerLanguagePack", + }, + Data: map[string]interface{}{ + "language_pack_id": req.LanguagePackId, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type SetCustomLanguagePackRequest struct { - // Information about the language pack. Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters + // Information about the language pack. Language pack ID must start with 'X', consist only of English letters, digits and hyphens, and must not exceed 64 characters. Can be called before authorization Info *LanguagePackInfo `json:"info"` // Strings of the new language pack Strings []*LanguagePackString `json:"strings"` } -// Adds or changes a custom language pack to the current localization target +// Adds or changes a custom local language pack to the current localization target func (client *Client) SetCustomLanguagePack(req *SetCustomLanguagePackRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6500,11 +7003,11 @@ func (client *Client) SetCustomLanguagePack(req *SetCustomLanguagePackRequest) ( } type EditCustomLanguagePackInfoRequest struct { - // New information about the custom language pack + // New information about the custom local language pack Info *LanguagePackInfo `json:"info"` } -// Edits information about a custom language pack in the current localization target +// Edits information about a custom local language pack in the current localization target. Can be called before authorization func (client *Client) EditCustomLanguagePackInfo(req *EditCustomLanguagePackInfoRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6526,13 +7029,13 @@ func (client *Client) EditCustomLanguagePackInfo(req *EditCustomLanguagePackInfo } type SetCustomLanguagePackStringRequest struct { - // Identifier of a previously added custom language pack in the current localization target + // Identifier of a previously added custom local language pack in the current localization target LanguagePackId string `json:"language_pack_id"` // New language pack string NewString *LanguagePackString `json:"new_string"` } -// Adds, edits or deletes a string in a custom language pack +// Adds, edits or deletes a string in a custom local language pack. Can be called before authorization func (client *Client) SetCustomLanguagePackString(req *SetCustomLanguagePackStringRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6559,7 +7062,7 @@ type DeleteLanguagePackRequest struct { LanguagePackId string `json:"language_pack_id"` } -// Deletes all information about a language pack in the current localization target. The language pack that is currently in use can't be deleted +// Deletes all information about a language pack in the current localization target. The language pack which is currently in use (including base language pack) or is being synchronized can't be deleted. Can be called before authorization func (client *Client) DeleteLanguagePack(req *DeleteLanguagePackRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6583,12 +7086,12 @@ func (client *Client) DeleteLanguagePack(req *DeleteLanguagePackRequest) (*Ok, e type RegisterDeviceRequest struct { // Device token DeviceToken DeviceToken `json:"device_token"` - // List of at most 100 user identifiers of other users currently using the client + // List of user identifiers of other users currently using the client OtherUserIds []int32 `json:"other_user_ids"` } -// Registers the currently used device for receiving push notifications -func (client *Client) RegisterDevice(req *RegisterDeviceRequest) (*Ok, error) { +// Registers the currently used device for receiving push notifications. Returns a globally unique identifier of the push notification subscription +func (client *Client) RegisterDevice(req *RegisterDeviceRequest) (*PushReceiverId, error) { result, err := client.Send(Request{ meta: meta{ Type: "registerDevice", @@ -6606,9 +7109,61 @@ func (client *Client) RegisterDevice(req *RegisterDeviceRequest) (*Ok, error) { return nil, buildResponseError(result.Data) } + return UnmarshalPushReceiverId(result.Data) +} + +type ProcessPushNotificationRequest struct { + // JSON-encoded push notification payload with all fields sent by the server, and "google.sent_time" and "google.notification.sound" fields added + Payload string `json:"payload"` +} + +// Handles a push notification. Returns error with code 406 if the push notification is not supported and connection to the server is required to fetch new data. Can be called before authorization +func (client *Client) ProcessPushNotification(req *ProcessPushNotificationRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "processPushNotification", + }, + Data: map[string]interface{}{ + "payload": req.Payload, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + return UnmarshalOk(result.Data) } +type GetPushReceiverIdRequest struct { + // JSON-encoded push notification payload + Payload string `json:"payload"` +} + +// Returns a globally unique push notification subscription identifier for identification of an account, which has received a push notification. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) GetPushReceiverId(req *GetPushReceiverIdRequest) (*PushReceiverId, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getPushReceiverId", + }, + Data: map[string]interface{}{ + "payload": req.Payload, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPushReceiverId(result.Data) +} + type GetRecentlyVisitedTMeUrlsRequest struct { // Google Play referrer to identify the user Referrer string `json:"referrer"` @@ -6864,7 +7419,7 @@ type ChangeChatReportSpamStateRequest struct { IsSpamChat bool `json:"is_spam_chat"` } -// Used to let the server know whether a chat is spam or not. Can be used only if ChatReportSpamState.can_report_spam is true. After this request, ChatReportSpamState.can_report_spam becomes false forever +// Reports to the server whether a chat is a spam chat or not. Can be used only if ChatReportSpamState.can_report_spam is true. After this request, ChatReportSpamState.can_report_spam becomes false forever func (client *Client) ChangeChatReportSpamState(req *ChangeChatReportSpamStateRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -6918,12 +7473,44 @@ func (client *Client) ReportChat(req *ReportChatRequest) (*Ok, error) { return UnmarshalOk(result.Data) } +type GetChatStatisticsUrlRequest struct { + // Chat identifier + ChatId int64 `json:"chat_id"` + // Parameters from "tg://statsrefresh?params=******" link + Parameters string `json:"parameters"` + // Pass true if a URL with the dark theme must be returned + IsDark bool `json:"is_dark"` +} + +// Returns URL with the chat statistics. Currently this method can be used only for channels +func (client *Client) GetChatStatisticsUrl(req *GetChatStatisticsUrlRequest) (*HttpUrl, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getChatStatisticsUrl", + }, + Data: map[string]interface{}{ + "chat_id": req.ChatId, + "parameters": req.Parameters, + "is_dark": req.IsDark, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalHttpUrl(result.Data) +} + type GetStorageStatisticsRequest struct { // Maximum number of chats with the largest storage usage for which separate statistics should be returned. All other chats will be grouped in entries with chat_id == 0. If the chat info database is not used, the chat_limit is ignored and is always set to 0 ChatLimit int32 `json:"chat_limit"` } -// Returns storage usage statistics +// Returns storage usage statistics. Can be called before authorization func (client *Client) GetStorageStatistics(req *GetStorageStatisticsRequest) (*StorageStatistics, error) { result, err := client.Send(Request{ meta: meta{ @@ -6944,7 +7531,7 @@ func (client *Client) GetStorageStatistics(req *GetStorageStatisticsRequest) (*S return UnmarshalStorageStatistics(result.Data) } -// Quickly returns approximate storage usage statistics +// Quickly returns approximate storage usage statistics. Can be called before authorization func (client *Client) GetStorageStatisticsFast() (*StorageStatisticsFast, error) { result, err := client.Send(Request{ meta: meta{ @@ -6963,6 +7550,25 @@ func (client *Client) GetStorageStatisticsFast() (*StorageStatisticsFast, error) return UnmarshalStorageStatisticsFast(result.Data) } +// Returns database statistics +func (client *Client) GetDatabaseStatistics() (*DatabaseStatistics, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getDatabaseStatistics", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalDatabaseStatistics(result.Data) +} + type OptimizeStorageRequest struct { // Limit on the total size of files after deletion. Pass -1 to use the default limit Size int64 `json:"size"` @@ -7513,8 +8119,6 @@ type GetPassportAuthorizationFormRequest struct { PublicKey string `json:"public_key"` // Authorization form nonce provided by the service Nonce string `json:"nonce"` - // Password of the current user - Password string `json:"password"` } // Returns a Telegram Passport authorization form for sharing data with a service @@ -7528,7 +8132,6 @@ func (client *Client) GetPassportAuthorizationForm(req *GetPassportAuthorization "scope": req.Scope, "public_key": req.PublicKey, "nonce": req.Nonce, - "password": req.Password, }, }) if err != nil { @@ -7542,6 +8145,35 @@ func (client *Client) GetPassportAuthorizationForm(req *GetPassportAuthorization return UnmarshalPassportAuthorizationForm(result.Data) } +type GetPassportAuthorizationFormAvailableElementsRequest struct { + // Authorization form identifier + AutorizationFormId int32 `json:"autorization_form_id"` + // Password of the current user + Password string `json:"password"` +} + +// Returns already available Telegram Passport elements suitable for completing a Telegram Passport authorization form. Result can be received only once for each authorization form +func (client *Client) GetPassportAuthorizationFormAvailableElements(req *GetPassportAuthorizationFormAvailableElementsRequest) (*PassportElementsWithErrors, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getPassportAuthorizationFormAvailableElements", + }, + Data: map[string]interface{}{ + "autorization_form_id": req.AutorizationFormId, + "password": req.Password, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalPassportElementsWithErrors(result.Data) +} + type SendPassportAuthorizationFormRequest struct { // Authorization form identifier AutorizationFormId int32 `json:"autorization_form_id"` @@ -7549,7 +8181,7 @@ type SendPassportAuthorizationFormRequest struct { Types []PassportElementType `json:"types"` } -// Sends a Telegram Passport authorization form, effectively sharing data with the service +// Sends a Telegram Passport authorization form, effectively sharing data with the service. This method must be called after getPassportAuthorizationFormAvailableElements if some previously available elements need to be used func (client *Client) SendPassportAuthorizationForm(req *SendPassportAuthorizationFormRequest) (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8049,6 +8681,78 @@ func (client *Client) GetDeepLinkInfo(req *GetDeepLinkInfoRequest) (*DeepLinkInf return UnmarshalDeepLinkInfo(result.Data) } +// Returns application config, provided by the server. Can be called before authorization +func (client *Client) GetApplicationConfig() (JsonValue, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "getApplicationConfig", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeJsonValueNull: + return UnmarshalJsonValueNull(result.Data) + + case TypeJsonValueBoolean: + return UnmarshalJsonValueBoolean(result.Data) + + case TypeJsonValueNumber: + return UnmarshalJsonValueNumber(result.Data) + + case TypeJsonValueString: + return UnmarshalJsonValueString(result.Data) + + case TypeJsonValueArray: + return UnmarshalJsonValueArray(result.Data) + + case TypeJsonValueObject: + return UnmarshalJsonValueObject(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type SaveApplicationLogEventRequest struct { + // Event type + Type string `json:"type"` + // Optional chat identifier, associated with the event + ChatId int64 `json:"chat_id"` + // The log event data + Data JsonValue `json:"data"` +} + +// Saves application log event on the server. Can be called before authorization +func (client *Client) SaveApplicationLogEvent(req *SaveApplicationLogEventRequest) (*Ok, error) { + result, err := client.Send(Request{ + meta: meta{ + Type: "saveApplicationLogEvent", + }, + Data: map[string]interface{}{ + "type": req.Type, + "chat_id": req.ChatId, + "data": req.Data, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + type AddProxyRequest struct { // Proxy server IP address Server string `json:"server"` @@ -8264,7 +8968,212 @@ func (client *Client) PingProxy(req *PingProxyRequest) (*Seconds, error) { return UnmarshalSeconds(result.Data) } -// Does nothing; for testing only +type SetLogStreamRequest struct { + // New log stream + LogStream LogStream `json:"log_stream"` +} + +// Sets new log stream for internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) SetLogStream(req *SetLogStreamRequest) (*Ok, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "setLogStream", + }, + Data: map[string]interface{}{ + "log_stream": req.LogStream, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns information about currently used log stream for internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) GetLogStream() (LogStream, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getLogStream", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + switch result.Type { + case TypeLogStreamDefault: + return UnmarshalLogStreamDefault(result.Data) + + case TypeLogStreamFile: + return UnmarshalLogStreamFile(result.Data) + + case TypeLogStreamEmpty: + return UnmarshalLogStreamEmpty(result.Data) + + default: + return nil, errors.New("invalid type") + } +} + +type SetLogVerbosityLevelRequest struct { + // New value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1023 can be used to enable even more logging + NewVerbosityLevel int32 `json:"new_verbosity_level"` +} + +// Sets the verbosity level of the internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) SetLogVerbosityLevel(req *SetLogVerbosityLevelRequest) (*Ok, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "setLogVerbosityLevel", + }, + Data: map[string]interface{}{ + "new_verbosity_level": req.NewVerbosityLevel, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Returns current verbosity level of the internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) GetLogVerbosityLevel() (*LogVerbosityLevel, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getLogVerbosityLevel", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLogVerbosityLevel(result.Data) +} + +// Returns list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) GetLogTags() (*LogTags, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getLogTags", + }, + Data: map[string]interface{}{}, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLogTags(result.Data) +} + +type SetLogTagVerbosityLevelRequest struct { + // Logging tag to change verbosity level + Tag string `json:"tag"` + // New verbosity level; 1-1024 + NewVerbosityLevel int32 `json:"new_verbosity_level"` +} + +// Sets the verbosity level for a specified TDLib internal log tag. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) SetLogTagVerbosityLevel(req *SetLogTagVerbosityLevelRequest) (*Ok, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "setLogTagVerbosityLevel", + }, + Data: map[string]interface{}{ + "tag": req.Tag, + "new_verbosity_level": req.NewVerbosityLevel, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +type GetLogTagVerbosityLevelRequest struct { + // Logging tag to change verbosity level + Tag string `json:"tag"` +} + +// Returns current verbosity level for a specified TDLib internal log tag. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) GetLogTagVerbosityLevel(req *GetLogTagVerbosityLevelRequest) (*LogVerbosityLevel, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "getLogTagVerbosityLevel", + }, + Data: map[string]interface{}{ + "tag": req.Tag, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalLogVerbosityLevel(result.Data) +} + +type AddLogMessageRequest struct { + // Minimum verbosity level needed for the message to be logged, 0-1023 + VerbosityLevel int32 `json:"verbosity_level"` + // Text of a message to log + Text string `json:"text"` +} + +// Adds a message to TDLib internal log. This is an offline method. Can be called before authorization. Can be called synchronously +func (client *Client) AddLogMessage(req *AddLogMessageRequest) (*Ok, error) { + result, err := client.jsonClient.Execute(Request{ + meta: meta{ + Type: "addLogMessage", + }, + Data: map[string]interface{}{ + "verbosity_level": req.VerbosityLevel, + "text": req.Text, + }, + }) + if err != nil { + return nil, err + } + + if result.Type == "error" { + return nil, buildResponseError(result.Data) + } + + return UnmarshalOk(result.Data) +} + +// Does nothing; for testing only. This is an offline method. Can be called before authorization func (client *Client) TestCallEmpty() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8288,7 +9197,7 @@ type TestCallStringRequest struct { X string `json:"x"` } -// Returns the received string; for testing only +// Returns the received string; for testing only. This is an offline method. Can be called before authorization func (client *Client) TestCallString(req *TestCallStringRequest) (*TestString, error) { result, err := client.Send(Request{ meta: meta{ @@ -8314,7 +9223,7 @@ type TestCallBytesRequest struct { X []byte `json:"x"` } -// Returns the received bytes; for testing only +// Returns the received bytes; for testing only. This is an offline method. Can be called before authorization func (client *Client) TestCallBytes(req *TestCallBytesRequest) (*TestBytes, error) { result, err := client.Send(Request{ meta: meta{ @@ -8340,7 +9249,7 @@ type TestCallVectorIntRequest struct { X []int32 `json:"x"` } -// Returns the received vector of numbers; for testing only +// Returns the received vector of numbers; for testing only. This is an offline method. Can be called before authorization func (client *Client) TestCallVectorInt(req *TestCallVectorIntRequest) (*TestVectorInt, error) { result, err := client.Send(Request{ meta: meta{ @@ -8366,7 +9275,7 @@ type TestCallVectorIntObjectRequest struct { X []*TestInt `json:"x"` } -// Returns the received vector of objects containing a number; for testing only +// Returns the received vector of objects containing a number; for testing only. This is an offline method. Can be called before authorization func (client *Client) TestCallVectorIntObject(req *TestCallVectorIntObjectRequest) (*TestVectorIntObject, error) { result, err := client.Send(Request{ meta: meta{ @@ -8392,7 +9301,7 @@ type TestCallVectorStringRequest struct { X []string `json:"x"` } -// For testing only request. Returns the received vector of strings; for testing only +// Returns the received vector of strings; for testing only. This is an offline method. Can be called before authorization func (client *Client) TestCallVectorString(req *TestCallVectorStringRequest) (*TestVectorString, error) { result, err := client.Send(Request{ meta: meta{ @@ -8418,7 +9327,7 @@ type TestCallVectorStringObjectRequest struct { X []*TestString `json:"x"` } -// Returns the received vector of objects containing a string; for testing only +// Returns the received vector of objects containing a string; for testing only. This is an offline method. Can be called before authorization func (client *Client) TestCallVectorStringObject(req *TestCallVectorStringObjectRequest) (*TestVectorStringObject, error) { result, err := client.Send(Request{ meta: meta{ @@ -8444,7 +9353,7 @@ type TestSquareIntRequest struct { X int32 `json:"x"` } -// Returns the squared received number; for testing only +// Returns the squared received number; for testing only. This is an offline method. Can be called before authorization func (client *Client) TestSquareInt(req *TestSquareIntRequest) (*TestInt, error) { result, err := client.Send(Request{ meta: meta{ @@ -8465,7 +9374,7 @@ func (client *Client) TestSquareInt(req *TestSquareIntRequest) (*TestInt, error) return UnmarshalTestInt(result.Data) } -// Sends a simple network request to the Telegram servers; for testing only +// Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization func (client *Client) TestNetwork() (*Ok, error) { result, err := client.Send(Request{ meta: meta{ @@ -8503,7 +9412,7 @@ func (client *Client) TestGetDifference() (*Ok, error) { return UnmarshalOk(result.Data) } -// Does nothing and ensures that the Update object is used; for testing only +// Does nothing and ensures that the Update object is used; for testing only. This is an offline method. Can be called before authorization func (client *Client) TestUseUpdate() (Update, error) { result, err := client.Send(Request{ meta: meta{ @@ -8592,12 +9501,30 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(result.Data) + case TypeUpdateChatPinnedMessage: + return UnmarshalUpdateChatPinnedMessage(result.Data) + case TypeUpdateChatReplyMarkup: return UnmarshalUpdateChatReplyMarkup(result.Data) case TypeUpdateChatDraftMessage: return UnmarshalUpdateChatDraftMessage(result.Data) + case TypeUpdateChatOnlineMemberCount: + return UnmarshalUpdateChatOnlineMemberCount(result.Data) + + case TypeUpdateNotification: + return UnmarshalUpdateNotification(result.Data) + + case TypeUpdateNotificationGroup: + return UnmarshalUpdateNotificationGroup(result.Data) + + case TypeUpdateActiveNotifications: + return UnmarshalUpdateActiveNotifications(result.Data) + + case TypeUpdateHavePendingNotifications: + return UnmarshalUpdateHavePendingNotifications(result.Data) + case TypeUpdateDeleteMessages: return UnmarshalUpdateDeleteMessages(result.Data) @@ -8703,12 +9630,15 @@ func (client *Client) TestUseUpdate() (Update, error) { case TypeUpdateNewCustomQuery: return UnmarshalUpdateNewCustomQuery(result.Data) + case TypeUpdatePoll: + return UnmarshalUpdatePoll(result.Data) + default: return nil, errors.New("invalid type") } } -// Does nothing and ensures that the Error object is used; for testing only +// Does nothing and ensures that the Error object is used; for testing only. This is an offline method. Can be called before authorization func (client *Client) TestUseError() (*Error, error) { result, err := client.Send(Request{ meta: meta{ diff --git a/client/type.go b/client/type.go index e6c4ed3..cdbd110 100755 --- a/client/type.go +++ b/client/type.go @@ -17,7 +17,7 @@ const ( ClassChatMembersFilter = "ChatMembersFilter" ClassSupergroupMembersFilter = "SupergroupMembersFilter" ClassSecretChatState = "SecretChatState" - ClassMessageForwardInfo = "MessageForwardInfo" + ClassMessageForwardOrigin = "MessageForwardOrigin" ClassMessageSendingState = "MessageSendingState" ClassNotificationSettingsScope = "NotificationSettingsScope" ClassChatType = "ChatType" @@ -25,6 +25,8 @@ const ( ClassInlineKeyboardButtonType = "InlineKeyboardButtonType" ClassReplyMarkup = "ReplyMarkup" ClassRichText = "RichText" + ClassPageBlockHorizontalAlignment = "PageBlockHorizontalAlignment" + ClassPageBlockVerticalAlignment = "PageBlockVerticalAlignment" ClassPageBlock = "PageBlock" ClassInputCredentials = "InputCredentials" ClassPassportElementType = "PassportElementType" @@ -47,7 +49,11 @@ const ( ClassLanguagePackStringValue = "LanguagePackStringValue" ClassDeviceToken = "DeviceToken" ClassCheckChatUsernameResult = "CheckChatUsernameResult" + ClassPushMessageContent = "PushMessageContent" + ClassNotificationType = "NotificationType" + ClassNotificationGroupType = "NotificationGroupType" ClassOptionValue = "OptionValue" + ClassJsonValue = "JsonValue" ClassUserPrivacySettingRule = "UserPrivacySettingRule" ClassUserPrivacySetting = "UserPrivacySetting" ClassChatReportReason = "ChatReportReason" @@ -60,6 +66,7 @@ const ( ClassTextParseMode = "TextParseMode" ClassProxyType = "ProxyType" ClassUpdate = "Update" + ClassLogStream = "LogStream" ClassError = "Error" ClassOk = "Ok" ClassTdlibParameters = "TdlibParameters" @@ -77,6 +84,7 @@ const ( ClassFile = "File" ClassPhotoSize = "PhotoSize" ClassMaskPosition = "MaskPosition" + ClassPollOption = "PollOption" ClassAnimation = "Animation" ClassAudio = "Audio" ClassDocument = "Document" @@ -89,12 +97,14 @@ const ( ClassLocation = "Location" ClassVenue = "Venue" ClassGame = "Game" + ClassPoll = "Poll" ClassProfilePhoto = "ProfilePhoto" ClassChatPhoto = "ChatPhoto" ClassBotCommand = "BotCommand" ClassBotInfo = "BotInfo" ClassUser = "User" ClassUserFullInfo = "UserFullInfo" + ClassUserProfilePhoto = "UserProfilePhoto" ClassUserProfilePhotos = "UserProfilePhotos" ClassUsers = "Users" ClassChatMember = "ChatMember" @@ -104,6 +114,7 @@ const ( ClassSupergroup = "Supergroup" ClassSupergroupFullInfo = "SupergroupFullInfo" ClassSecretChat = "SecretChat" + ClassMessageForwardInfo = "MessageForwardInfo" ClassMessage = "Message" ClassMessages = "Messages" ClassFoundMessages = "FoundMessages" @@ -116,6 +127,10 @@ const ( ClassChatInviteLinkInfo = "ChatInviteLinkInfo" ClassKeyboardButton = "KeyboardButton" ClassInlineKeyboardButton = "InlineKeyboardButton" + ClassPageBlockCaption = "PageBlockCaption" + ClassPageBlockListItem = "PageBlockListItem" + ClassPageBlockTableCell = "PageBlockTableCell" + ClassPageBlockRelatedArticle = "PageBlockRelatedArticle" ClassWebPageInstantView = "WebPageInstantView" ClassWebPage = "WebPage" ClassAddress = "Address" @@ -141,6 +156,7 @@ const ( ClassPassportSuitableElement = "PassportSuitableElement" ClassPassportRequiredElement = "PassportRequiredElement" ClassPassportAuthorizationForm = "PassportAuthorizationForm" + ClassPassportElementsWithErrors = "PassportElementsWithErrors" ClassEncryptedCredentials = "EncryptedCredentials" ClassEncryptedPassportElement = "EncryptedPassportElement" ClassInputPassportElementError = "InputPassportElementError" @@ -156,6 +172,7 @@ const ( ClassCall = "Call" ClassAnimations = "Animations" ClassImportedContacts = "ImportedContacts" + ClassHttpUrl = "HttpUrl" ClassInlineQueryResults = "InlineQueryResults" ClassCallbackQueryAnswer = "CallbackQueryAnswer" ClassCustomRequestResult = "CustomRequestResult" @@ -168,9 +185,13 @@ const ( ClassLanguagePackStrings = "LanguagePackStrings" ClassLanguagePackInfo = "LanguagePackInfo" ClassLocalizationTargetInfo = "LocalizationTargetInfo" + ClassPushReceiverId = "PushReceiverId" ClassWallpaper = "Wallpaper" ClassWallpapers = "Wallpapers" ClassHashtags = "Hashtags" + ClassNotification = "Notification" + ClassNotificationGroup = "NotificationGroup" + ClassJsonObjectMember = "JsonObjectMember" ClassUserPrivacySettingRules = "UserPrivacySettingRules" ClassAccountTtl = "AccountTtl" ClassSession = "Session" @@ -179,10 +200,12 @@ const ( ClassConnectedWebsites = "ConnectedWebsites" ClassChatReportSpamState = "ChatReportSpamState" ClassPublicMessageLink = "PublicMessageLink" + ClassFilePart = "FilePart" ClassStorageStatisticsByFileType = "StorageStatisticsByFileType" ClassStorageStatisticsByChat = "StorageStatisticsByChat" ClassStorageStatistics = "StorageStatistics" ClassStorageStatisticsFast = "StorageStatisticsFast" + ClassDatabaseStatistics = "DatabaseStatistics" ClassNetworkStatistics = "NetworkStatistics" ClassTMeUrl = "TMeUrl" ClassTMeUrls = "TMeUrls" @@ -193,6 +216,9 @@ const ( ClassProxy = "Proxy" ClassProxies = "Proxies" ClassInputSticker = "InputSticker" + ClassUpdates = "Updates" + ClassLogVerbosityLevel = "LogVerbosityLevel" + ClassLogTags = "LogTags" ClassTestInt = "TestInt" ClassTestString = "TestString" ClassTestBytes = "TestBytes" @@ -241,6 +267,7 @@ const ( TypeMaskPointMouth = "maskPointMouth" TypeMaskPointChin = "maskPointChin" TypeMaskPosition = "maskPosition" + TypePollOption = "pollOption" TypeAnimation = "animation" TypeAudio = "audio" TypeDocument = "document" @@ -253,6 +280,7 @@ const ( TypeLocation = "location" TypeVenue = "venue" TypeGame = "game" + TypePoll = "poll" TypeProfilePhoto = "profilePhoto" TypeChatPhoto = "chatPhoto" TypeLinkStateNone = "linkStateNone" @@ -266,6 +294,7 @@ const ( TypeBotInfo = "botInfo" TypeUser = "user" TypeUserFullInfo = "userFullInfo" + TypeUserProfilePhoto = "userProfilePhoto" TypeUserProfilePhotos = "userProfilePhotos" TypeUsers = "users" TypeChatMemberStatusCreator = "chatMemberStatusCreator" @@ -295,8 +324,10 @@ const ( TypeSecretChatStateReady = "secretChatStateReady" TypeSecretChatStateClosed = "secretChatStateClosed" TypeSecretChat = "secretChat" - TypeMessageForwardedFromUser = "messageForwardedFromUser" - TypeMessageForwardedPost = "messageForwardedPost" + TypeMessageForwardOriginUser = "messageForwardOriginUser" + TypeMessageForwardOriginHiddenUser = "messageForwardOriginHiddenUser" + TypeMessageForwardOriginChannel = "messageForwardOriginChannel" + TypeMessageForwardInfo = "messageForwardInfo" TypeMessageSendingStatePending = "messageSendingStatePending" TypeMessageSendingStateFailed = "messageSendingStateFailed" TypeMessage = "message" @@ -304,6 +335,7 @@ const ( TypeFoundMessages = "foundMessages" TypeNotificationSettingsScopePrivateChats = "notificationSettingsScopePrivateChats" TypeNotificationSettingsScopeGroupChats = "notificationSettingsScopeGroupChats" + TypeNotificationSettingsScopeChannelChats = "notificationSettingsScopeChannelChats" TypeChatNotificationSettings = "chatNotificationSettings" TypeScopeNotificationSettings = "scopeNotificationSettings" TypeDraftMessage = "draftMessage" @@ -337,12 +369,29 @@ const ( TypeRichTextFixed = "richTextFixed" TypeRichTextUrl = "richTextUrl" TypeRichTextEmailAddress = "richTextEmailAddress" + TypeRichTextSubscript = "richTextSubscript" + TypeRichTextSuperscript = "richTextSuperscript" + TypeRichTextMarked = "richTextMarked" + TypeRichTextPhoneNumber = "richTextPhoneNumber" + TypeRichTextIcon = "richTextIcon" + TypeRichTextAnchor = "richTextAnchor" TypeRichTexts = "richTexts" + TypePageBlockCaption = "pageBlockCaption" + TypePageBlockListItem = "pageBlockListItem" + TypePageBlockHorizontalAlignmentLeft = "pageBlockHorizontalAlignmentLeft" + TypePageBlockHorizontalAlignmentCenter = "pageBlockHorizontalAlignmentCenter" + TypePageBlockHorizontalAlignmentRight = "pageBlockHorizontalAlignmentRight" + TypePageBlockVerticalAlignmentTop = "pageBlockVerticalAlignmentTop" + TypePageBlockVerticalAlignmentMiddle = "pageBlockVerticalAlignmentMiddle" + TypePageBlockVerticalAlignmentBottom = "pageBlockVerticalAlignmentBottom" + TypePageBlockTableCell = "pageBlockTableCell" + TypePageBlockRelatedArticle = "pageBlockRelatedArticle" TypePageBlockTitle = "pageBlockTitle" TypePageBlockSubtitle = "pageBlockSubtitle" TypePageBlockAuthorDate = "pageBlockAuthorDate" TypePageBlockHeader = "pageBlockHeader" TypePageBlockSubheader = "pageBlockSubheader" + TypePageBlockKicker = "pageBlockKicker" TypePageBlockParagraph = "pageBlockParagraph" TypePageBlockPreformatted = "pageBlockPreformatted" TypePageBlockFooter = "pageBlockFooter" @@ -361,6 +410,10 @@ const ( TypePageBlockCollage = "pageBlockCollage" TypePageBlockSlideshow = "pageBlockSlideshow" TypePageBlockChatLink = "pageBlockChatLink" + TypePageBlockTable = "pageBlockTable" + TypePageBlockDetails = "pageBlockDetails" + TypePageBlockRelatedArticles = "pageBlockRelatedArticles" + TypePageBlockMap = "pageBlockMap" TypeWebPageInstantView = "webPageInstantView" TypeWebPage = "webPage" TypeAddress = "address" @@ -438,6 +491,7 @@ const ( TypePassportSuitableElement = "passportSuitableElement" TypePassportRequiredElement = "passportRequiredElement" TypePassportAuthorizationForm = "passportAuthorizationForm" + TypePassportElementsWithErrors = "passportElementsWithErrors" TypeEncryptedCredentials = "encryptedCredentials" TypeEncryptedPassportElement = "encryptedPassportElement" TypeInputPassportElementErrorSourceUnspecified = "inputPassportElementErrorSourceUnspecified" @@ -465,6 +519,7 @@ const ( TypeMessageVenue = "messageVenue" TypeMessageContact = "messageContact" TypeMessageGame = "messageGame" + TypeMessagePoll = "messagePoll" TypeMessageInvoice = "messageInvoice" TypeMessageCall = "messageCall" TypeMessageBasicGroupChatCreate = "messageBasicGroupChatCreate" @@ -518,6 +573,7 @@ const ( TypeInputMessageContact = "inputMessageContact" TypeInputMessageGame = "inputMessageGame" TypeInputMessageInvoice = "inputMessageInvoice" + TypeInputMessagePoll = "inputMessagePoll" TypeInputMessageForwarded = "inputMessageForwarded" TypeSearchMessagesFilterEmpty = "searchMessagesFilterEmpty" TypeSearchMessagesFilterAnimation = "searchMessagesFilterAnimation" @@ -576,6 +632,7 @@ const ( TypeCall = "call" TypeAnimations = "animations" TypeImportedContacts = "importedContacts" + TypeHttpUrl = "httpUrl" TypeInputInlineQueryResultAnimatedGif = "inputInlineQueryResultAnimatedGif" TypeInputInlineQueryResultAnimatedMpeg4 = "inputInlineQueryResultAnimatedMpeg4" TypeInputInlineQueryResultArticle = "inputInlineQueryResultArticle" @@ -635,7 +692,7 @@ const ( TypeLanguagePackStrings = "languagePackStrings" TypeLanguagePackInfo = "languagePackInfo" TypeLocalizationTargetInfo = "localizationTargetInfo" - TypeDeviceTokenGoogleCloudMessaging = "deviceTokenGoogleCloudMessaging" + TypeDeviceTokenFirebaseCloudMessaging = "deviceTokenFirebaseCloudMessaging" TypeDeviceTokenApplePush = "deviceTokenApplePush" TypeDeviceTokenApplePushVoIP = "deviceTokenApplePushVoIP" TypeDeviceTokenWindowsPush = "deviceTokenWindowsPush" @@ -646,6 +703,7 @@ const ( TypeDeviceTokenUbuntuPush = "deviceTokenUbuntuPush" TypeDeviceTokenBlackBerryPush = "deviceTokenBlackBerryPush" TypeDeviceTokenTizenPush = "deviceTokenTizenPush" + TypePushReceiverId = "pushReceiverId" TypeWallpaper = "wallpaper" TypeWallpapers = "wallpapers" TypeHashtags = "hashtags" @@ -654,10 +712,53 @@ const ( TypeCheckChatUsernameResultUsernameOccupied = "checkChatUsernameResultUsernameOccupied" TypeCheckChatUsernameResultPublicChatsTooMuch = "checkChatUsernameResultPublicChatsTooMuch" TypeCheckChatUsernameResultPublicGroupsUnavailable = "checkChatUsernameResultPublicGroupsUnavailable" + TypePushMessageContentHidden = "pushMessageContentHidden" + TypePushMessageContentAnimation = "pushMessageContentAnimation" + TypePushMessageContentAudio = "pushMessageContentAudio" + TypePushMessageContentContact = "pushMessageContentContact" + TypePushMessageContentContactRegistered = "pushMessageContentContactRegistered" + TypePushMessageContentDocument = "pushMessageContentDocument" + TypePushMessageContentGame = "pushMessageContentGame" + TypePushMessageContentGameScore = "pushMessageContentGameScore" + TypePushMessageContentInvoice = "pushMessageContentInvoice" + TypePushMessageContentLocation = "pushMessageContentLocation" + TypePushMessageContentPhoto = "pushMessageContentPhoto" + TypePushMessageContentPoll = "pushMessageContentPoll" + TypePushMessageContentScreenshotTaken = "pushMessageContentScreenshotTaken" + TypePushMessageContentSticker = "pushMessageContentSticker" + TypePushMessageContentText = "pushMessageContentText" + TypePushMessageContentVideo = "pushMessageContentVideo" + TypePushMessageContentVideoNote = "pushMessageContentVideoNote" + TypePushMessageContentVoiceNote = "pushMessageContentVoiceNote" + TypePushMessageContentBasicGroupChatCreate = "pushMessageContentBasicGroupChatCreate" + TypePushMessageContentChatAddMembers = "pushMessageContentChatAddMembers" + TypePushMessageContentChatChangePhoto = "pushMessageContentChatChangePhoto" + TypePushMessageContentChatChangeTitle = "pushMessageContentChatChangeTitle" + TypePushMessageContentChatDeleteMember = "pushMessageContentChatDeleteMember" + TypePushMessageContentChatJoinByLink = "pushMessageContentChatJoinByLink" + TypePushMessageContentMessageForwards = "pushMessageContentMessageForwards" + TypePushMessageContentMediaAlbum = "pushMessageContentMediaAlbum" + TypeNotificationTypeNewMessage = "notificationTypeNewMessage" + TypeNotificationTypeNewSecretChat = "notificationTypeNewSecretChat" + TypeNotificationTypeNewCall = "notificationTypeNewCall" + TypeNotificationTypeNewPushMessage = "notificationTypeNewPushMessage" + TypeNotificationGroupTypeMessages = "notificationGroupTypeMessages" + TypeNotificationGroupTypeMentions = "notificationGroupTypeMentions" + TypeNotificationGroupTypeSecretChat = "notificationGroupTypeSecretChat" + TypeNotificationGroupTypeCalls = "notificationGroupTypeCalls" + TypeNotification = "notification" + TypeNotificationGroup = "notificationGroup" TypeOptionValueBoolean = "optionValueBoolean" TypeOptionValueEmpty = "optionValueEmpty" TypeOptionValueInteger = "optionValueInteger" TypeOptionValueString = "optionValueString" + TypeJsonObjectMember = "jsonObjectMember" + TypeJsonValueNull = "jsonValueNull" + TypeJsonValueBoolean = "jsonValueBoolean" + TypeJsonValueNumber = "jsonValueNumber" + TypeJsonValueString = "jsonValueString" + TypeJsonValueArray = "jsonValueArray" + TypeJsonValueObject = "jsonValueObject" TypeUserPrivacySettingRuleAllowAll = "userPrivacySettingRuleAllowAll" TypeUserPrivacySettingRuleAllowContacts = "userPrivacySettingRuleAllowContacts" TypeUserPrivacySettingRuleAllowUsers = "userPrivacySettingRuleAllowUsers" @@ -668,6 +769,7 @@ const ( TypeUserPrivacySettingShowStatus = "userPrivacySettingShowStatus" TypeUserPrivacySettingAllowChatInvites = "userPrivacySettingAllowChatInvites" TypeUserPrivacySettingAllowCalls = "userPrivacySettingAllowCalls" + TypeUserPrivacySettingAllowPeerToPeerCalls = "userPrivacySettingAllowPeerToPeerCalls" TypeAccountTtl = "accountTtl" TypeSession = "session" TypeSessions = "sessions" @@ -677,9 +779,11 @@ const ( TypeChatReportReasonSpam = "chatReportReasonSpam" TypeChatReportReasonViolence = "chatReportReasonViolence" TypeChatReportReasonPornography = "chatReportReasonPornography" + TypeChatReportReasonChildAbuse = "chatReportReasonChildAbuse" TypeChatReportReasonCopyright = "chatReportReasonCopyright" TypeChatReportReasonCustom = "chatReportReasonCustom" TypePublicMessageLink = "publicMessageLink" + TypeFilePart = "filePart" TypeFileTypeNone = "fileTypeNone" TypeFileTypeAnimation = "fileTypeAnimation" TypeFileTypeAudio = "fileTypeAudio" @@ -700,6 +804,7 @@ const ( TypeStorageStatisticsByChat = "storageStatisticsByChat" TypeStorageStatistics = "storageStatistics" TypeStorageStatisticsFast = "storageStatisticsFast" + TypeDatabaseStatistics = "databaseStatistics" TypeNetworkTypeNone = "networkTypeNone" TypeNetworkTypeMobile = "networkTypeMobile" TypeNetworkTypeMobileRoaming = "networkTypeMobileRoaming" @@ -761,8 +866,14 @@ const ( TypeUpdateChatUnreadMentionCount = "updateChatUnreadMentionCount" TypeUpdateChatNotificationSettings = "updateChatNotificationSettings" TypeUpdateScopeNotificationSettings = "updateScopeNotificationSettings" + TypeUpdateChatPinnedMessage = "updateChatPinnedMessage" TypeUpdateChatReplyMarkup = "updateChatReplyMarkup" TypeUpdateChatDraftMessage = "updateChatDraftMessage" + TypeUpdateChatOnlineMemberCount = "updateChatOnlineMemberCount" + TypeUpdateNotification = "updateNotification" + TypeUpdateNotificationGroup = "updateNotificationGroup" + TypeUpdateActiveNotifications = "updateActiveNotifications" + TypeUpdateHavePendingNotifications = "updateHavePendingNotifications" TypeUpdateDeleteMessages = "updateDeleteMessages" TypeUpdateUserChatAction = "updateUserChatAction" TypeUpdateUserStatus = "updateUserStatus" @@ -798,6 +909,13 @@ const ( TypeUpdateNewPreCheckoutQuery = "updateNewPreCheckoutQuery" TypeUpdateNewCustomEvent = "updateNewCustomEvent" TypeUpdateNewCustomQuery = "updateNewCustomQuery" + TypeUpdatePoll = "updatePoll" + TypeUpdates = "updates" + TypeLogStreamDefault = "logStreamDefault" + TypeLogStreamFile = "logStreamFile" + TypeLogStreamEmpty = "logStreamEmpty" + TypeLogVerbosityLevel = "logVerbosityLevel" + TypeLogTags = "logTags" TypeTestInt = "testInt" TypeTestString = "testString" TypeTestBytes = "testBytes" @@ -857,9 +975,9 @@ type SecretChatState interface { SecretChatStateType() string } -// Contains information about the initial sender of a forwarded message -type MessageForwardInfo interface { - MessageForwardInfoType() string +// Contains information about the origin of a forwarded message +type MessageForwardOrigin interface { + MessageForwardOriginType() string } // Contains information about the sending state of the message @@ -897,6 +1015,16 @@ type RichText interface { RichTextType() string } +// Describes a horizontal alignment of a table cell content +type PageBlockHorizontalAlignment interface { + PageBlockHorizontalAlignmentType() string +} + +// Describes a Vertical alignment of a table cell content +type PageBlockVerticalAlignment interface { + PageBlockVerticalAlignmentType() string +} + // Describes a block of an instant view web page type PageBlock interface { PageBlockType() string @@ -997,7 +1125,7 @@ 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 +// Represents a data needed to subscribe for push notifications through registerDevice method. 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 } @@ -1007,11 +1135,31 @@ type CheckChatUsernameResult interface { CheckChatUsernameResultType() string } +// Contains content of a push message notification +type PushMessageContent interface { + PushMessageContentType() string +} + +// Contains detailed information about a notification +type NotificationType interface { + NotificationTypeType() string +} + +// Describes type of notifications in the group +type NotificationGroupType interface { + NotificationGroupTypeType() string +} + // Represents the value of an option type OptionValue interface { OptionValueType() string } +// Represents a JSON value +type JsonValue interface { + JsonValueType() string +} + // Represents a single rule for managing privacy settings type UserPrivacySettingRule interface { UserPrivacySettingRuleType() string @@ -1072,6 +1220,11 @@ type Update interface { UpdateType() string } +// Describes a stream to which TDLib internal log is written +type LogStream interface { + LogStreamType() string +} + // An object of this type can be returned on every function call, in case of an error type Error struct { meta @@ -1590,7 +1743,7 @@ func (*AuthorizationStateWaitCode) AuthorizationStateType() string { // The user has been authorized, but needs to enter a password to start using the application type AuthorizationStateWaitPassword struct { meta - // Hint for the password; can be empty + // Hint for the password; may be empty PasswordHint string `json:"password_hint"` // True if a recovery email address has been set up HasRecoveryEmailAddress bool `json:"has_recovery_email_address"` @@ -1721,16 +1874,16 @@ func (*AuthorizationStateClosed) AuthorizationStateType() string { // Represents the current state of 2-step verification type PasswordState struct { meta - // True if a 2-step verification password is set + // True, if a 2-step verification password is set HasPassword bool `json:"has_password"` - // Hint for the password; can be empty + // Hint for the password; may be empty PasswordHint string `json:"password_hint"` - // True if a recovery email is set + // True, if a recovery email is set HasRecoveryEmailAddress bool `json:"has_recovery_email_address"` - // True if some Telegram Passport elements were saved + // 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"` + // Information about the recovery email address to which the confirmation email was sent; may be null + RecoveryEmailAddressCodeInfo *EmailAddressAuthenticationCodeInfo `json:"recovery_email_address_code_info"` } func (entity *PasswordState) MarshalJSON() ([]byte, error) { @@ -1810,7 +1963,9 @@ type LocalFile struct { IsDownloadingActive bool `json:"is_downloading_active"` // True, if the local copy is fully available IsDownloadingCompleted bool `json:"is_downloading_completed"` - // If is_downloading_completed is false, then only some prefix of the file is ready to be read. downloaded_prefix_size is the size of that prefix + // Download will be started from this offset. downloaded_prefix_size is calculated from this offset + DownloadOffset int32 `json:"download_offset"` + // If is_downloading_completed is false, then only some prefix of the file starting from download_offset is ready to be read. downloaded_prefix_size is the size of that prefix DownloadedPrefixSize int32 `json:"downloaded_prefix_size"` // Total downloaded file bytes. Should be used only for calculating download progress. The actual file size may be bigger, and some parts of it may contain garbage DownloadedSize int32 `json:"downloaded_size"` @@ -1978,7 +2133,7 @@ type InputFileGenerated struct { meta // Local path to a file from which the file is generated; may be empty if there is no such file OriginalPath string `json:"original_path"` - // String specifying the conversion applied to the original file; should be persistent across application restarts + // String specifying the conversion applied to the original file; should be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage Conversion string `json:"conversion"` // Expected size of the generated file; 0 if unknown ExpectedSize int32 `json:"expected_size"` @@ -2185,6 +2340,37 @@ func (maskPosition *MaskPosition) UnmarshalJSON(data []byte) error { return nil } +// Describes one answer option of a poll +type PollOption struct { + meta + // Option text, 1-100 characters + Text string `json:"text"` + // Number of voters for this option, available only for closed or voted polls + VoterCount int32 `json:"voter_count"` + // The percentage of votes for this option, 0-100 + VotePercentage int32 `json:"vote_percentage"` + // True, if the option was chosen by the user + IsChosen bool `json:"is_chosen"` + // True, if the option is being chosen by a pending setPollAnswer request + IsBeingChosen bool `json:"is_being_chosen"` +} + +func (entity *PollOption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PollOption + + return json.Marshal((*stub)(entity)) +} + +func (*PollOption) GetClass() string { + return ClassPollOption +} + +func (*PollOption) GetType() string { + return TypePollOption +} + // Describes an animation file. The animation must be encoded in GIF or MPEG4 format type Animation struct { meta @@ -2287,8 +2473,6 @@ func (*Document) GetType() string { // Describes a photo type Photo struct { meta - // Photo identifier; 0 for deleted photos - Id JsonInt64 `json:"id"` // True, if stickers were added to the photo HasStickers bool `json:"has_stickers"` // Available variants of the photo, in different sizes @@ -2569,6 +2753,37 @@ func (*Game) GetType() string { return TypeGame } +// Describes a poll +type Poll struct { + meta + // Unique poll identifier + Id JsonInt64 `json:"id"` + // Poll question, 1-255 characters + Question string `json:"question"` + // List of poll answer options + Options []*PollOption `json:"options"` + // Total number of voters, participating in the poll + TotalVoterCount int32 `json:"total_voter_count"` + // True, if the poll is closed + IsClosed bool `json:"is_closed"` +} + +func (entity *Poll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Poll + + return json.Marshal((*stub)(entity)) +} + +func (*Poll) GetClass() string { + return ClassPoll +} + +func (*Poll) GetType() string { + return TypePoll +} + // Describes a user profile photo type ProfilePhoto struct { meta @@ -2646,7 +2861,7 @@ func (*LinkStateNone) LinkStateType() string { return TypeLinkStateNone } -// The phone number of user A is known but that number has not been saved to the contacts list of user B +// The phone number of user A is known but that number has not been saved to the contact list of user B type LinkStateKnowsPhoneNumber struct { meta } @@ -2671,7 +2886,7 @@ func (*LinkStateKnowsPhoneNumber) LinkStateType() string { return TypeLinkStateKnowsPhoneNumber } -// The phone number of user A has been saved to the contacts list of user B +// The phone number of user A has been saved to the contact list of user B type LinkStateIsContact struct { meta } @@ -2879,6 +3094,8 @@ type User struct { IncomingLink LinkState `json:"incoming_link"` // True, if the user is verified IsVerified bool `json:"is_verified"` + // True, if the user is Telegram support account + IsSupport bool `json:"is_support"` // If non-empty, it contains the reason why access to this user must be restricted. The format of the string is "{type}: {description}". {type} contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user) RestrictionReason string `json:"restriction_reason"` // If false, the user is inaccessible, and the only information known about the user is inside this class. It can't be passed to any method except GetUser @@ -2917,6 +3134,7 @@ func (user *User) UnmarshalJSON(data []byte) error { OutgoingLink json.RawMessage `json:"outgoing_link"` IncomingLink json.RawMessage `json:"incoming_link"` IsVerified bool `json:"is_verified"` + IsSupport bool `json:"is_support"` RestrictionReason string `json:"restriction_reason"` HaveAccess bool `json:"have_access"` Type json.RawMessage `json:"type"` @@ -2935,6 +3153,7 @@ func (user *User) UnmarshalJSON(data []byte) error { user.PhoneNumber = tmp.PhoneNumber user.ProfilePhoto = tmp.ProfilePhoto user.IsVerified = tmp.IsVerified + user.IsSupport = tmp.IsSupport user.RestrictionReason = tmp.RestrictionReason user.HaveAccess = tmp.HaveAccess user.LanguageCode = tmp.LanguageCode @@ -2989,13 +3208,40 @@ func (*UserFullInfo) GetType() string { return TypeUserFullInfo } +// Contains full information about a user profile photo +type UserProfilePhoto struct { + meta + // Unique user profile photo identifier + Id JsonInt64 `json:"id"` + // Point in time (Unix timestamp) when the photo has been added + AddedDate int32 `json:"added_date"` + // Available variants of the user photo, in different sizes + Sizes []*PhotoSize `json:"sizes"` +} + +func (entity *UserProfilePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserProfilePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*UserProfilePhoto) GetClass() string { + return ClassUserProfilePhoto +} + +func (*UserProfilePhoto) GetType() string { + return TypeUserProfilePhoto +} + // Contains part of the list of user photos type UserProfilePhotos struct { meta // Total number of user profile photos TotalCount int32 `json:"total_count"` // A list of photos - Photos []*Photo `json:"photos"` + Photos []*UserProfilePhoto `json:"photos"` } func (entity *UserProfilePhotos) MarshalJSON() ([]byte, error) { @@ -3083,7 +3329,7 @@ type ChatMemberStatusAdministrator struct { CanInviteUsers bool `json:"can_invite_users"` // True, if the administrator can restrict, ban, or unban chat members CanRestrictMembers bool `json:"can_restrict_members"` - // True, if the administrator can pin messages; applicable to supergroups only + // True, if the administrator can pin messages; applicable to groups only CanPinMessages bool `json:"can_pin_messages"` // True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that were directly or indirectly promoted by him CanPromoteMembers bool `json:"can_promote_members"` @@ -3767,14 +4013,14 @@ type SupergroupFullInfo struct { CanSetUsername bool `json:"can_set_username"` // True, if the supergroup sticker set can be changed CanSetStickerSet bool `json:"can_set_sticker_set"` + // True, if the channel statistics is available through getChatStatisticsUrl + CanViewStatistics bool `json:"can_view_statistics"` // True, if new chat members will have access to old messages. In public supergroups and both public and private channels, old messages are always available, so this option affects only private supergroups. The value of this field is only available for chat administrators IsAllHistoryAvailable bool `json:"is_all_history_available"` // Identifier of the supergroup sticker set; 0 if none StickerSetId JsonInt64 `json:"sticker_set_id"` // Invite link for this chat InviteLink string `json:"invite_link"` - // Identifier of the pinned message in the chat; 0 if none - PinnedMessageId int64 `json:"pinned_message_id"` // Identifier of the basic group from which supergroup was upgraded; 0 if none UpgradedFromBasicGroupId int32 `json:"upgraded_from_basic_group_id"` // Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none @@ -3937,73 +4183,140 @@ func (secretChat *SecretChat) UnmarshalJSON(data []byte) error { } // The message was originally written by a known user -type MessageForwardedFromUser struct { +type MessageForwardOriginUser struct { meta - // Identifier of the user that originally sent this message + // Identifier of the user that originally sent the message SenderUserId int32 `json:"sender_user_id"` - // Point in time (Unix timestamp) when the message was originally sent - Date int32 `json:"date"` - // For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown - ForwardedFromChatId int64 `json:"forwarded_from_chat_id"` - // For messages forwarded to the chat with the current user (saved messages) the identifier of the original message from which the new message was forwarded; 0 if unknown - ForwardedFromMessageId int64 `json:"forwarded_from_message_id"` } -func (entity *MessageForwardedFromUser) MarshalJSON() ([]byte, error) { +func (entity *MessageForwardOriginUser) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageForwardedFromUser + type stub MessageForwardOriginUser return json.Marshal((*stub)(entity)) } -func (*MessageForwardedFromUser) GetClass() string { - return ClassMessageForwardInfo +func (*MessageForwardOriginUser) GetClass() string { + return ClassMessageForwardOrigin } -func (*MessageForwardedFromUser) GetType() string { - return TypeMessageForwardedFromUser +func (*MessageForwardOriginUser) GetType() string { + return TypeMessageForwardOriginUser } -func (*MessageForwardedFromUser) MessageForwardInfoType() string { - return TypeMessageForwardedFromUser +func (*MessageForwardOriginUser) MessageForwardOriginType() string { + return TypeMessageForwardOriginUser +} + +// The message was originally written by a user, which is hidden by his privacy settings +type MessageForwardOriginHiddenUser struct { + meta + // Name of the sender + SenderName string `json:"sender_name"` +} + +func (entity *MessageForwardOriginHiddenUser) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageForwardOriginHiddenUser + + return json.Marshal((*stub)(entity)) +} + +func (*MessageForwardOriginHiddenUser) GetClass() string { + return ClassMessageForwardOrigin +} + +func (*MessageForwardOriginHiddenUser) GetType() string { + return TypeMessageForwardOriginHiddenUser +} + +func (*MessageForwardOriginHiddenUser) MessageForwardOriginType() string { + return TypeMessageForwardOriginHiddenUser } // The message was originally a post in a channel -type MessageForwardedPost struct { +type MessageForwardOriginChannel struct { meta - // Identifier of the chat from which the message was forwarded + // Identifier of the chat from which the message was originally forwarded ChatId int64 `json:"chat_id"` - // Post author signature - AuthorSignature string `json:"author_signature"` - // Point in time (Unix timestamp) when the message was originally sent - Date int32 `json:"date"` - // Message identifier of the original message from which the new message was forwarded; 0 if unknown + // Message identifier of the original message; 0 if unknown MessageId int64 `json:"message_id"` - // For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown - ForwardedFromChatId int64 `json:"forwarded_from_chat_id"` - // For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded; 0 if unknown - ForwardedFromMessageId int64 `json:"forwarded_from_message_id"` + // Original post author signature + AuthorSignature string `json:"author_signature"` } -func (entity *MessageForwardedPost) MarshalJSON() ([]byte, error) { +func (entity *MessageForwardOriginChannel) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub MessageForwardedPost + type stub MessageForwardOriginChannel return json.Marshal((*stub)(entity)) } -func (*MessageForwardedPost) GetClass() string { +func (*MessageForwardOriginChannel) GetClass() string { + return ClassMessageForwardOrigin +} + +func (*MessageForwardOriginChannel) GetType() string { + return TypeMessageForwardOriginChannel +} + +func (*MessageForwardOriginChannel) MessageForwardOriginType() string { + return TypeMessageForwardOriginChannel +} + +// Contains information about a forwarded message +type MessageForwardInfo struct { + meta + // Origin of a forwarded message + Origin MessageForwardOrigin `json:"origin"` + // Point in time (Unix timestamp) when the message was originally sent + Date int32 `json:"date"` + // For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded last time; 0 if unknown + FromChatId int64 `json:"from_chat_id"` + // For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded last time; 0 if unknown + FromMessageId int64 `json:"from_message_id"` +} + +func (entity *MessageForwardInfo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessageForwardInfo + + return json.Marshal((*stub)(entity)) +} + +func (*MessageForwardInfo) GetClass() string { return ClassMessageForwardInfo } -func (*MessageForwardedPost) GetType() string { - return TypeMessageForwardedPost +func (*MessageForwardInfo) GetType() string { + return TypeMessageForwardInfo } -func (*MessageForwardedPost) MessageForwardInfoType() string { - return TypeMessageForwardedPost +func (messageForwardInfo *MessageForwardInfo) UnmarshalJSON(data []byte) error { + var tmp struct { + Origin json.RawMessage `json:"origin"` + Date int32 `json:"date"` + FromChatId int64 `json:"from_chat_id"` + FromMessageId int64 `json:"from_message_id"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + messageForwardInfo.Date = tmp.Date + messageForwardInfo.FromChatId = tmp.FromChatId + messageForwardInfo.FromMessageId = tmp.FromMessageId + + fieldOrigin, _ := UnmarshalMessageForwardOrigin(tmp.Origin) + messageForwardInfo.Origin = fieldOrigin + + return nil } // The message is being sent now, but has not yet been delivered to the server @@ -4069,7 +4382,7 @@ type Message struct { SendingState MessageSendingState `json:"sending_state"` // True, if the message is outgoing IsOutgoing bool `json:"is_outgoing"` - // True, if the message can be edited + // True, if the message can be edited. For live location and poll messages this fields shows, whether editMessageLiveLocation or stopPoll can be used with this message by the client CanBeEdited bool `json:"can_be_edited"` // True, if the message can be forwarded CanBeForwarded bool `json:"can_be_forwarded"` @@ -4086,7 +4399,7 @@ type Message struct { // Point in time (Unix timestamp) when the message was last edited EditDate int32 `json:"edit_date"` // Information about the initial message sender; may be null - ForwardInfo MessageForwardInfo `json:"forward_info"` + ForwardInfo *MessageForwardInfo `json:"forward_info"` // If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message ReplyToMessageId int64 `json:"reply_to_message_id"` // For self-destructing messages, the message's TTL (Time To Live), in seconds; 0 if none. TDLib will send updateDeleteMessages or updateMessageContent once the TTL expires @@ -4125,29 +4438,29 @@ func (*Message) GetType() string { func (message *Message) UnmarshalJSON(data []byte) error { var tmp struct { - Id int64 `json:"id"` - SenderUserId int32 `json:"sender_user_id"` - ChatId int64 `json:"chat_id"` - SendingState json.RawMessage `json:"sending_state"` - IsOutgoing bool `json:"is_outgoing"` - CanBeEdited bool `json:"can_be_edited"` - CanBeForwarded bool `json:"can_be_forwarded"` - CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` - CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` - IsChannelPost bool `json:"is_channel_post"` - ContainsUnreadMention bool `json:"contains_unread_mention"` - Date int32 `json:"date"` - EditDate int32 `json:"edit_date"` - ForwardInfo json.RawMessage `json:"forward_info"` - ReplyToMessageId int64 `json:"reply_to_message_id"` - Ttl int32 `json:"ttl"` - TtlExpiresIn float64 `json:"ttl_expires_in"` - ViaBotUserId int32 `json:"via_bot_user_id"` - AuthorSignature string `json:"author_signature"` - Views int32 `json:"views"` - MediaAlbumId JsonInt64 `json:"media_album_id"` - Content json.RawMessage `json:"content"` - ReplyMarkup json.RawMessage `json:"reply_markup"` + Id int64 `json:"id"` + SenderUserId int32 `json:"sender_user_id"` + ChatId int64 `json:"chat_id"` + SendingState json.RawMessage `json:"sending_state"` + IsOutgoing bool `json:"is_outgoing"` + CanBeEdited bool `json:"can_be_edited"` + CanBeForwarded bool `json:"can_be_forwarded"` + CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` + CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` + IsChannelPost bool `json:"is_channel_post"` + ContainsUnreadMention bool `json:"contains_unread_mention"` + Date int32 `json:"date"` + EditDate int32 `json:"edit_date"` + ForwardInfo *MessageForwardInfo `json:"forward_info"` + ReplyToMessageId int64 `json:"reply_to_message_id"` + Ttl int32 `json:"ttl"` + TtlExpiresIn float64 `json:"ttl_expires_in"` + ViaBotUserId int32 `json:"via_bot_user_id"` + AuthorSignature string `json:"author_signature"` + Views int32 `json:"views"` + MediaAlbumId JsonInt64 `json:"media_album_id"` + Content json.RawMessage `json:"content"` + ReplyMarkup json.RawMessage `json:"reply_markup"` } err := json.Unmarshal(data, &tmp) @@ -4167,6 +4480,7 @@ func (message *Message) UnmarshalJSON(data []byte) error { message.ContainsUnreadMention = tmp.ContainsUnreadMention message.Date = tmp.Date message.EditDate = tmp.EditDate + message.ForwardInfo = tmp.ForwardInfo message.ReplyToMessageId = tmp.ReplyToMessageId message.Ttl = tmp.Ttl message.TtlExpiresIn = tmp.TtlExpiresIn @@ -4178,9 +4492,6 @@ func (message *Message) UnmarshalJSON(data []byte) error { fieldSendingState, _ := UnmarshalMessageSendingState(tmp.SendingState) message.SendingState = fieldSendingState - fieldForwardInfo, _ := UnmarshalMessageForwardInfo(tmp.ForwardInfo) - message.ForwardInfo = fieldForwardInfo - fieldContent, _ := UnmarshalMessageContent(tmp.Content) message.Content = fieldContent @@ -4265,7 +4576,7 @@ func (*NotificationSettingsScopePrivateChats) NotificationSettingsScopeType() st return TypeNotificationSettingsScopePrivateChats } -// Notification settings applied to all basic groups, supergroups and channels when the corresponding chat setting has a default value +// Notification settings applied to all basic groups and supergroups when the corresponding chat setting has a default value type NotificationSettingsScopeGroupChats struct { meta } @@ -4290,6 +4601,31 @@ func (*NotificationSettingsScopeGroupChats) NotificationSettingsScopeType() stri return TypeNotificationSettingsScopeGroupChats } +// Notification settings applied to all channels when the corresponding chat setting has a default value +type NotificationSettingsScopeChannelChats struct { + meta +} + +func (entity *NotificationSettingsScopeChannelChats) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationSettingsScopeChannelChats + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationSettingsScopeChannelChats) GetClass() string { + return ClassNotificationSettingsScope +} + +func (*NotificationSettingsScopeChannelChats) GetType() string { + return TypeNotificationSettingsScopeChannelChats +} + +func (*NotificationSettingsScopeChannelChats) NotificationSettingsScopeType() string { + return TypeNotificationSettingsScopeChannelChats +} + // Contains information about notification settings for a chat type ChatNotificationSettings struct { meta @@ -4305,6 +4641,14 @@ type ChatNotificationSettings struct { UseDefaultShowPreview bool `json:"use_default_show_preview"` // True, if message content should be displayed in notifications ShowPreview bool `json:"show_preview"` + // If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat is used instead + UseDefaultDisablePinnedMessageNotifications bool `json:"use_default_disable_pinned_message_notifications"` + // If true, notifications for incoming pinned messages will be created as for an ordinary unread message + DisablePinnedMessageNotifications bool `json:"disable_pinned_message_notifications"` + // If true, disable_mention_notifications is ignored and the value for the relevant type of chat is used instead + UseDefaultDisableMentionNotifications bool `json:"use_default_disable_mention_notifications"` + // If true, notifications for messages with mentions will be created as for an ordinary unread message + DisableMentionNotifications bool `json:"disable_mention_notifications"` } func (entity *ChatNotificationSettings) MarshalJSON() ([]byte, error) { @@ -4332,6 +4676,10 @@ type ScopeNotificationSettings struct { Sound string `json:"sound"` // True, if message content should be displayed in notifications ShowPreview bool `json:"show_preview"` + // True, if notifications for incoming pinned messages will be created as for an ordinary unread message + DisablePinnedMessageNotifications bool `json:"disable_pinned_message_notifications"` + // True, if notifications for messages with mentions will be created as for an ordinary unread message + DisableMentionNotifications bool `json:"disable_mention_notifications"` } func (entity *ScopeNotificationSettings) MarshalJSON() ([]byte, error) { @@ -4527,6 +4875,10 @@ type Chat struct { 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 messages can be deleted only for the current user while other users will continue to see the messages + CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` + // True, if the chat messages can be deleted for all users + CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` // True, if the chat can be reported to Telegram moderators through reportChat CanBeReported bool `json:"can_be_reported"` // Default value of the disable_notification parameter, used when a message is sent to the chat @@ -4541,6 +4893,8 @@ type Chat struct { UnreadMentionCount int32 `json:"unread_mention_count"` // Notification settings for this chat NotificationSettings *ChatNotificationSettings `json:"notification_settings"` + // Identifier of the pinned message in the chat; 0 if none + PinnedMessageId int64 `json:"pinned_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 ReplyMarkupMessageId int64 `json:"reply_markup_message_id"` // A draft of a message in the chat; may be null @@ -4576,6 +4930,8 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { IsPinned bool `json:"is_pinned"` IsMarkedAsUnread bool `json:"is_marked_as_unread"` IsSponsored bool `json:"is_sponsored"` + CanBeDeletedOnlyForSelf bool `json:"can_be_deleted_only_for_self"` + CanBeDeletedForAllUsers bool `json:"can_be_deleted_for_all_users"` CanBeReported bool `json:"can_be_reported"` DefaultDisableNotification bool `json:"default_disable_notification"` UnreadCount int32 `json:"unread_count"` @@ -4583,6 +4939,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { LastReadOutboxMessageId int64 `json:"last_read_outbox_message_id"` UnreadMentionCount int32 `json:"unread_mention_count"` NotificationSettings *ChatNotificationSettings `json:"notification_settings"` + PinnedMessageId int64 `json:"pinned_message_id"` ReplyMarkupMessageId int64 `json:"reply_markup_message_id"` DraftMessage *DraftMessage `json:"draft_message"` ClientData string `json:"client_data"` @@ -4601,6 +4958,8 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.IsPinned = tmp.IsPinned chat.IsMarkedAsUnread = tmp.IsMarkedAsUnread chat.IsSponsored = tmp.IsSponsored + chat.CanBeDeletedOnlyForSelf = tmp.CanBeDeletedOnlyForSelf + chat.CanBeDeletedForAllUsers = tmp.CanBeDeletedForAllUsers chat.CanBeReported = tmp.CanBeReported chat.DefaultDisableNotification = tmp.DefaultDisableNotification chat.UnreadCount = tmp.UnreadCount @@ -4608,6 +4967,7 @@ func (chat *Chat) UnmarshalJSON(data []byte) error { chat.LastReadOutboxMessageId = tmp.LastReadOutboxMessageId chat.UnreadMentionCount = tmp.UnreadMentionCount chat.NotificationSettings = tmp.NotificationSettings + chat.PinnedMessageId = tmp.PinnedMessageId chat.ReplyMarkupMessageId = tmp.ReplyMarkupMessageId chat.DraftMessage = tmp.DraftMessage chat.ClientData = tmp.ClientData @@ -5476,6 +5836,262 @@ func (richTextEmailAddress *RichTextEmailAddress) UnmarshalJSON(data []byte) err return nil } +// A subscript rich text +type RichTextSubscript struct { + meta + // Text + Text RichText `json:"text"` +} + +func (entity *RichTextSubscript) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextSubscript + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextSubscript) GetClass() string { + return ClassRichText +} + +func (*RichTextSubscript) GetType() string { + return TypeRichTextSubscript +} + +func (*RichTextSubscript) RichTextType() string { + return TypeRichTextSubscript +} + +func (richTextSubscript *RichTextSubscript) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextSubscript.Text = fieldText + + return nil +} + +// A superscript rich text +type RichTextSuperscript struct { + meta + // Text + Text RichText `json:"text"` +} + +func (entity *RichTextSuperscript) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextSuperscript + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextSuperscript) GetClass() string { + return ClassRichText +} + +func (*RichTextSuperscript) GetType() string { + return TypeRichTextSuperscript +} + +func (*RichTextSuperscript) RichTextType() string { + return TypeRichTextSuperscript +} + +func (richTextSuperscript *RichTextSuperscript) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextSuperscript.Text = fieldText + + return nil +} + +// A marked rich text +type RichTextMarked struct { + meta + // Text + Text RichText `json:"text"` +} + +func (entity *RichTextMarked) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextMarked + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextMarked) GetClass() string { + return ClassRichText +} + +func (*RichTextMarked) GetType() string { + return TypeRichTextMarked +} + +func (*RichTextMarked) RichTextType() string { + return TypeRichTextMarked +} + +func (richTextMarked *RichTextMarked) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextMarked.Text = fieldText + + return nil +} + +// A rich text phone number +type RichTextPhoneNumber struct { + meta + // Text + Text RichText `json:"text"` + // Phone number + PhoneNumber string `json:"phone_number"` +} + +func (entity *RichTextPhoneNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextPhoneNumber + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextPhoneNumber) GetClass() string { + return ClassRichText +} + +func (*RichTextPhoneNumber) GetType() string { + return TypeRichTextPhoneNumber +} + +func (*RichTextPhoneNumber) RichTextType() string { + return TypeRichTextPhoneNumber +} + +func (richTextPhoneNumber *RichTextPhoneNumber) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + PhoneNumber string `json:"phone_number"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + richTextPhoneNumber.PhoneNumber = tmp.PhoneNumber + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextPhoneNumber.Text = fieldText + + return nil +} + +// A small image inside the text +type RichTextIcon struct { + meta + // The image represented as a document. The image can be in GIF, JPEG or PNG format + Document *Document `json:"document"` + // Width of a bounding box in which the image should be shown, 0 if unknown + Width int32 `json:"width"` + // Height of a bounding box in which the image should be shown, 0 if unknown + Height int32 `json:"height"` +} + +func (entity *RichTextIcon) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextIcon + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextIcon) GetClass() string { + return ClassRichText +} + +func (*RichTextIcon) GetType() string { + return TypeRichTextIcon +} + +func (*RichTextIcon) RichTextType() string { + return TypeRichTextIcon +} + +// A rich text anchor +type RichTextAnchor struct { + meta + // Text + Text RichText `json:"text"` + // Anchor name + Name string `json:"name"` +} + +func (entity *RichTextAnchor) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub RichTextAnchor + + return json.Marshal((*stub)(entity)) +} + +func (*RichTextAnchor) GetClass() string { + return ClassRichText +} + +func (*RichTextAnchor) GetType() string { + return TypeRichTextAnchor +} + +func (*RichTextAnchor) RichTextType() string { + return TypeRichTextAnchor +} + +func (richTextAnchor *RichTextAnchor) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + Name string `json:"name"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + richTextAnchor.Name = tmp.Name + + fieldText, _ := UnmarshalRichText(tmp.Text) + richTextAnchor.Text = fieldText + + return nil +} + // A concatenation of rich texts type RichTexts struct { meta @@ -5503,6 +6119,323 @@ func (*RichTexts) RichTextType() string { return TypeRichTexts } +// Contains a caption of an instant view web page block, consisting of a text and a trailing credit +type PageBlockCaption struct { + meta + // Content of the caption + Text RichText `json:"text"` + // Block credit (like HTML tag ) + Credit RichText `json:"credit"` +} + +func (entity *PageBlockCaption) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockCaption + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockCaption) GetClass() string { + return ClassPageBlockCaption +} + +func (*PageBlockCaption) GetType() string { + return TypePageBlockCaption +} + +func (pageBlockCaption *PageBlockCaption) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + Credit json.RawMessage `json:"credit"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockCaption.Text = fieldText + + fieldCredit, _ := UnmarshalRichText(tmp.Credit) + pageBlockCaption.Credit = fieldCredit + + return nil +} + +// Describes an item of a list page block +type PageBlockListItem struct { + meta + // Item label + Label string `json:"label"` + // Item blocks + PageBlocks []PageBlock `json:"page_blocks"` +} + +func (entity *PageBlockListItem) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockListItem + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockListItem) GetClass() string { + return ClassPageBlockListItem +} + +func (*PageBlockListItem) GetType() string { + return TypePageBlockListItem +} + +// The content should be left-aligned +type PageBlockHorizontalAlignmentLeft struct { + meta +} + +func (entity *PageBlockHorizontalAlignmentLeft) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockHorizontalAlignmentLeft + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockHorizontalAlignmentLeft) GetClass() string { + return ClassPageBlockHorizontalAlignment +} + +func (*PageBlockHorizontalAlignmentLeft) GetType() string { + return TypePageBlockHorizontalAlignmentLeft +} + +func (*PageBlockHorizontalAlignmentLeft) PageBlockHorizontalAlignmentType() string { + return TypePageBlockHorizontalAlignmentLeft +} + +// The content should be center-aligned +type PageBlockHorizontalAlignmentCenter struct { + meta +} + +func (entity *PageBlockHorizontalAlignmentCenter) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockHorizontalAlignmentCenter + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockHorizontalAlignmentCenter) GetClass() string { + return ClassPageBlockHorizontalAlignment +} + +func (*PageBlockHorizontalAlignmentCenter) GetType() string { + return TypePageBlockHorizontalAlignmentCenter +} + +func (*PageBlockHorizontalAlignmentCenter) PageBlockHorizontalAlignmentType() string { + return TypePageBlockHorizontalAlignmentCenter +} + +// The content should be right-aligned +type PageBlockHorizontalAlignmentRight struct { + meta +} + +func (entity *PageBlockHorizontalAlignmentRight) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockHorizontalAlignmentRight + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockHorizontalAlignmentRight) GetClass() string { + return ClassPageBlockHorizontalAlignment +} + +func (*PageBlockHorizontalAlignmentRight) GetType() string { + return TypePageBlockHorizontalAlignmentRight +} + +func (*PageBlockHorizontalAlignmentRight) PageBlockHorizontalAlignmentType() string { + return TypePageBlockHorizontalAlignmentRight +} + +// The content should be top-aligned +type PageBlockVerticalAlignmentTop struct { + meta +} + +func (entity *PageBlockVerticalAlignmentTop) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockVerticalAlignmentTop + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockVerticalAlignmentTop) GetClass() string { + return ClassPageBlockVerticalAlignment +} + +func (*PageBlockVerticalAlignmentTop) GetType() string { + return TypePageBlockVerticalAlignmentTop +} + +func (*PageBlockVerticalAlignmentTop) PageBlockVerticalAlignmentType() string { + return TypePageBlockVerticalAlignmentTop +} + +// The content should be middle-aligned +type PageBlockVerticalAlignmentMiddle struct { + meta +} + +func (entity *PageBlockVerticalAlignmentMiddle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockVerticalAlignmentMiddle + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockVerticalAlignmentMiddle) GetClass() string { + return ClassPageBlockVerticalAlignment +} + +func (*PageBlockVerticalAlignmentMiddle) GetType() string { + return TypePageBlockVerticalAlignmentMiddle +} + +func (*PageBlockVerticalAlignmentMiddle) PageBlockVerticalAlignmentType() string { + return TypePageBlockVerticalAlignmentMiddle +} + +// The content should be bottom-aligned +type PageBlockVerticalAlignmentBottom struct { + meta +} + +func (entity *PageBlockVerticalAlignmentBottom) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockVerticalAlignmentBottom + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockVerticalAlignmentBottom) GetClass() string { + return ClassPageBlockVerticalAlignment +} + +func (*PageBlockVerticalAlignmentBottom) GetType() string { + return TypePageBlockVerticalAlignmentBottom +} + +func (*PageBlockVerticalAlignmentBottom) PageBlockVerticalAlignmentType() string { + return TypePageBlockVerticalAlignmentBottom +} + +// Represents a cell of a table +type PageBlockTableCell struct { + meta + // Cell text + Text RichText `json:"text"` + // True, if it is a header cell + IsHeader bool `json:"is_header"` + // The number of columns the cell should span + Colspan int32 `json:"colspan"` + // The number of rows the cell should span + Rowspan int32 `json:"rowspan"` + // Horizontal cell content alignment + Align PageBlockHorizontalAlignment `json:"align"` + // Vertical cell content alignment + Valign PageBlockVerticalAlignment `json:"valign"` +} + +func (entity *PageBlockTableCell) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockTableCell + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockTableCell) GetClass() string { + return ClassPageBlockTableCell +} + +func (*PageBlockTableCell) GetType() string { + return TypePageBlockTableCell +} + +func (pageBlockTableCell *PageBlockTableCell) UnmarshalJSON(data []byte) error { + var tmp struct { + Text json.RawMessage `json:"text"` + IsHeader bool `json:"is_header"` + Colspan int32 `json:"colspan"` + Rowspan int32 `json:"rowspan"` + Align json.RawMessage `json:"align"` + Valign json.RawMessage `json:"valign"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockTableCell.IsHeader = tmp.IsHeader + pageBlockTableCell.Colspan = tmp.Colspan + pageBlockTableCell.Rowspan = tmp.Rowspan + + fieldText, _ := UnmarshalRichText(tmp.Text) + pageBlockTableCell.Text = fieldText + + fieldAlign, _ := UnmarshalPageBlockHorizontalAlignment(tmp.Align) + pageBlockTableCell.Align = fieldAlign + + fieldValign, _ := UnmarshalPageBlockVerticalAlignment(tmp.Valign) + pageBlockTableCell.Valign = fieldValign + + return nil +} + +// Contains information about a related article +type PageBlockRelatedArticle struct { + meta + // Related article URL + Url string `json:"url"` + // Article title; may be empty + Title string `json:"title"` + // Article description; may be empty + Description string `json:"description"` + // Article photo; may be null + Photo *Photo `json:"photo"` + // Article author; may be empty + Author string `json:"author"` + // Point in time (Unix timestamp) when the article was published; 0 if unknown + PublishDate int32 `json:"publish_date"` +} + +func (entity *PageBlockRelatedArticle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockRelatedArticle + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockRelatedArticle) GetClass() string { + return ClassPageBlockRelatedArticle +} + +func (*PageBlockRelatedArticle) GetType() string { + return TypePageBlockRelatedArticle +} + // The title of a page type PageBlockTitle struct { meta @@ -5723,6 +6656,49 @@ func (pageBlockSubheader *PageBlockSubheader) UnmarshalJSON(data []byte) error { return nil } +// A kicker +type PageBlockKicker struct { + meta + // Kicker + Kicker RichText `json:"kicker"` +} + +func (entity *PageBlockKicker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockKicker + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockKicker) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockKicker) GetType() string { + return TypePageBlockKicker +} + +func (*PageBlockKicker) PageBlockType() string { + return TypePageBlockKicker +} + +func (pageBlockKicker *PageBlockKicker) UnmarshalJSON(data []byte) error { + var tmp struct { + Kicker json.RawMessage `json:"kicker"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + fieldKicker, _ := UnmarshalRichText(tmp.Kicker) + pageBlockKicker.Kicker = fieldKicker + + return nil +} + // A text paragraph type PageBlockParagraph struct { meta @@ -5909,13 +6885,11 @@ func (*PageBlockAnchor) PageBlockType() string { return TypePageBlockAnchor } -// A list of texts +// A list of data blocks type PageBlockList struct { meta - // Texts - Items []RichText `json:"items"` - // True, if the items should be marked with numbers - IsOrdered bool `json:"is_ordered"` + // The items of the list + Items []*PageBlockListItem `json:"items"` } func (entity *PageBlockList) MarshalJSON() ([]byte, error) { @@ -5943,8 +6917,8 @@ type PageBlockBlockQuote struct { meta // Quote text Text RichText `json:"text"` - // Quote caption - Caption RichText `json:"caption"` + // Quote credit + Credit RichText `json:"credit"` } func (entity *PageBlockBlockQuote) MarshalJSON() ([]byte, error) { @@ -5969,8 +6943,8 @@ func (*PageBlockBlockQuote) PageBlockType() string { func (pageBlockBlockQuote *PageBlockBlockQuote) UnmarshalJSON(data []byte) error { var tmp struct { - Text json.RawMessage `json:"text"` - Caption json.RawMessage `json:"caption"` + Text json.RawMessage `json:"text"` + Credit json.RawMessage `json:"credit"` } err := json.Unmarshal(data, &tmp) @@ -5981,8 +6955,8 @@ func (pageBlockBlockQuote *PageBlockBlockQuote) UnmarshalJSON(data []byte) error fieldText, _ := UnmarshalRichText(tmp.Text) pageBlockBlockQuote.Text = fieldText - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockBlockQuote.Caption = fieldCaption + fieldCredit, _ := UnmarshalRichText(tmp.Credit) + pageBlockBlockQuote.Credit = fieldCredit return nil } @@ -5992,8 +6966,8 @@ type PageBlockPullQuote struct { meta // Quote text Text RichText `json:"text"` - // Quote caption - Caption RichText `json:"caption"` + // Quote credit + Credit RichText `json:"credit"` } func (entity *PageBlockPullQuote) MarshalJSON() ([]byte, error) { @@ -6018,8 +6992,8 @@ func (*PageBlockPullQuote) PageBlockType() string { func (pageBlockPullQuote *PageBlockPullQuote) UnmarshalJSON(data []byte) error { var tmp struct { - Text json.RawMessage `json:"text"` - Caption json.RawMessage `json:"caption"` + Text json.RawMessage `json:"text"` + Credit json.RawMessage `json:"credit"` } err := json.Unmarshal(data, &tmp) @@ -6030,8 +7004,8 @@ func (pageBlockPullQuote *PageBlockPullQuote) UnmarshalJSON(data []byte) error { fieldText, _ := UnmarshalRichText(tmp.Text) pageBlockPullQuote.Text = fieldText - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockPullQuote.Caption = fieldCaption + fieldCredit, _ := UnmarshalRichText(tmp.Credit) + pageBlockPullQuote.Credit = fieldCredit return nil } @@ -6042,7 +7016,7 @@ type PageBlockAnimation struct { // Animation file; may be null Animation *Animation `json:"animation"` // Animation caption - Caption RichText `json:"caption"` + Caption *PageBlockCaption `json:"caption"` // True, if the animation should be played automatically NeedAutoplay bool `json:"need_autoplay"` } @@ -6067,34 +7041,13 @@ func (*PageBlockAnimation) PageBlockType() string { return TypePageBlockAnimation } -func (pageBlockAnimation *PageBlockAnimation) UnmarshalJSON(data []byte) error { - var tmp struct { - Animation *Animation `json:"animation"` - Caption json.RawMessage `json:"caption"` - NeedAutoplay bool `json:"need_autoplay"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockAnimation.Animation = tmp.Animation - pageBlockAnimation.NeedAutoplay = tmp.NeedAutoplay - - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockAnimation.Caption = fieldCaption - - return nil -} - // An audio file type PageBlockAudio struct { meta // Audio file; may be null Audio *Audio `json:"audio"` // Audio file caption - Caption RichText `json:"caption"` + Caption *PageBlockCaption `json:"caption"` } func (entity *PageBlockAudio) MarshalJSON() ([]byte, error) { @@ -6117,32 +7070,15 @@ func (*PageBlockAudio) PageBlockType() string { return TypePageBlockAudio } -func (pageBlockAudio *PageBlockAudio) UnmarshalJSON(data []byte) error { - var tmp struct { - Audio *Audio `json:"audio"` - Caption json.RawMessage `json:"caption"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockAudio.Audio = tmp.Audio - - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockAudio.Caption = fieldCaption - - return nil -} - // A photo type PageBlockPhoto struct { meta // Photo file; may be null Photo *Photo `json:"photo"` // Photo caption - Caption RichText `json:"caption"` + Caption *PageBlockCaption `json:"caption"` + // URL that needs to be opened when the photo is clicked + Url string `json:"url"` } func (entity *PageBlockPhoto) MarshalJSON() ([]byte, error) { @@ -6165,32 +7101,13 @@ func (*PageBlockPhoto) PageBlockType() string { return TypePageBlockPhoto } -func (pageBlockPhoto *PageBlockPhoto) UnmarshalJSON(data []byte) error { - var tmp struct { - Photo *Photo `json:"photo"` - Caption json.RawMessage `json:"caption"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockPhoto.Photo = tmp.Photo - - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockPhoto.Caption = fieldCaption - - return nil -} - // A video type PageBlockVideo struct { meta // Video file; may be null Video *Video `json:"video"` // Video caption - Caption RichText `json:"caption"` + Caption *PageBlockCaption `json:"caption"` // True, if the video should be played automatically NeedAutoplay bool `json:"need_autoplay"` // True, if the video should be looped @@ -6217,29 +7134,6 @@ func (*PageBlockVideo) PageBlockType() string { return TypePageBlockVideo } -func (pageBlockVideo *PageBlockVideo) UnmarshalJSON(data []byte) error { - var tmp struct { - Video *Video `json:"video"` - Caption json.RawMessage `json:"caption"` - NeedAutoplay bool `json:"need_autoplay"` - IsLooped bool `json:"is_looped"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockVideo.Video = tmp.Video - pageBlockVideo.NeedAutoplay = tmp.NeedAutoplay - pageBlockVideo.IsLooped = tmp.IsLooped - - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockVideo.Caption = fieldCaption - - return nil -} - // A page cover type PageBlockCover struct { meta @@ -6292,12 +7186,12 @@ type PageBlockEmbedded struct { Html string `json:"html"` // Poster photo, if available; may be null PosterPhoto *Photo `json:"poster_photo"` - // Block width + // Block width, 0 if unknown Width int32 `json:"width"` - // Block height + // Block height, 0 if unknown Height int32 `json:"height"` // Block caption - Caption RichText `json:"caption"` + Caption *PageBlockCaption `json:"caption"` // True, if the block should be full width IsFullWidth bool `json:"is_full_width"` // True, if scrolling should be allowed @@ -6324,37 +7218,6 @@ func (*PageBlockEmbedded) PageBlockType() string { return TypePageBlockEmbedded } -func (pageBlockEmbedded *PageBlockEmbedded) UnmarshalJSON(data []byte) error { - var tmp struct { - Url string `json:"url"` - Html string `json:"html"` - PosterPhoto *Photo `json:"poster_photo"` - Width int32 `json:"width"` - Height int32 `json:"height"` - Caption json.RawMessage `json:"caption"` - IsFullWidth bool `json:"is_full_width"` - AllowScrolling bool `json:"allow_scrolling"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockEmbedded.Url = tmp.Url - pageBlockEmbedded.Html = tmp.Html - pageBlockEmbedded.PosterPhoto = tmp.PosterPhoto - pageBlockEmbedded.Width = tmp.Width - pageBlockEmbedded.Height = tmp.Height - pageBlockEmbedded.IsFullWidth = tmp.IsFullWidth - pageBlockEmbedded.AllowScrolling = tmp.AllowScrolling - - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockEmbedded.Caption = fieldCaption - - return nil -} - // An embedded post type PageBlockEmbeddedPost struct { meta @@ -6369,7 +7232,7 @@ type PageBlockEmbeddedPost struct { // Post content PageBlocks []PageBlock `json:"page_blocks"` // Post caption - Caption RichText `json:"caption"` + Caption *PageBlockCaption `json:"caption"` } func (entity *PageBlockEmbeddedPost) MarshalJSON() ([]byte, error) { @@ -6392,40 +7255,13 @@ func (*PageBlockEmbeddedPost) PageBlockType() string { return TypePageBlockEmbeddedPost } -func (pageBlockEmbeddedPost *PageBlockEmbeddedPost) UnmarshalJSON(data []byte) error { - var tmp struct { - Url string `json:"url"` - Author string `json:"author"` - AuthorPhoto *Photo `json:"author_photo"` - Date int32 `json:"date"` - PageBlocks []PageBlock `json:"page_blocks"` - Caption json.RawMessage `json:"caption"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockEmbeddedPost.Url = tmp.Url - pageBlockEmbeddedPost.Author = tmp.Author - pageBlockEmbeddedPost.AuthorPhoto = tmp.AuthorPhoto - pageBlockEmbeddedPost.Date = tmp.Date - pageBlockEmbeddedPost.PageBlocks = tmp.PageBlocks - - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockEmbeddedPost.Caption = fieldCaption - - return nil -} - // A collage type PageBlockCollage struct { meta // Collage item contents PageBlocks []PageBlock `json:"page_blocks"` // Block caption - Caption RichText `json:"caption"` + Caption *PageBlockCaption `json:"caption"` } func (entity *PageBlockCollage) MarshalJSON() ([]byte, error) { @@ -6448,32 +7284,13 @@ func (*PageBlockCollage) PageBlockType() string { return TypePageBlockCollage } -func (pageBlockCollage *PageBlockCollage) UnmarshalJSON(data []byte) error { - var tmp struct { - PageBlocks []PageBlock `json:"page_blocks"` - Caption json.RawMessage `json:"caption"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockCollage.PageBlocks = tmp.PageBlocks - - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockCollage.Caption = fieldCaption - - return nil -} - // A slideshow type PageBlockSlideshow struct { meta // Slideshow item contents PageBlocks []PageBlock `json:"page_blocks"` // Block caption - Caption RichText `json:"caption"` + Caption *PageBlockCaption `json:"caption"` } func (entity *PageBlockSlideshow) MarshalJSON() ([]byte, error) { @@ -6496,25 +7313,6 @@ func (*PageBlockSlideshow) PageBlockType() string { return TypePageBlockSlideshow } -func (pageBlockSlideshow *PageBlockSlideshow) UnmarshalJSON(data []byte) error { - var tmp struct { - PageBlocks []PageBlock `json:"page_blocks"` - Caption json.RawMessage `json:"caption"` - } - - err := json.Unmarshal(data, &tmp) - if err != nil { - return err - } - - pageBlockSlideshow.PageBlocks = tmp.PageBlocks - - fieldCaption, _ := UnmarshalRichText(tmp.Caption) - pageBlockSlideshow.Caption = fieldCaption - - return nil -} - // A link to a chat type PageBlockChatLink struct { meta @@ -6546,11 +7344,208 @@ func (*PageBlockChatLink) PageBlockType() string { return TypePageBlockChatLink } +// A table +type PageBlockTable struct { + meta + // Table caption + Caption RichText `json:"caption"` + // Table cells + Cells [][]*PageBlockTableCell `json:"cells"` + // True, if the table is bordered + IsBordered bool `json:"is_bordered"` + // True, if the table is striped + IsStriped bool `json:"is_striped"` +} + +func (entity *PageBlockTable) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockTable + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockTable) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockTable) GetType() string { + return TypePageBlockTable +} + +func (*PageBlockTable) PageBlockType() string { + return TypePageBlockTable +} + +func (pageBlockTable *PageBlockTable) UnmarshalJSON(data []byte) error { + var tmp struct { + Caption json.RawMessage `json:"caption"` + Cells [][]*PageBlockTableCell `json:"cells"` + IsBordered bool `json:"is_bordered"` + IsStriped bool `json:"is_striped"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockTable.Cells = tmp.Cells + pageBlockTable.IsBordered = tmp.IsBordered + pageBlockTable.IsStriped = tmp.IsStriped + + fieldCaption, _ := UnmarshalRichText(tmp.Caption) + pageBlockTable.Caption = fieldCaption + + return nil +} + +// A collapsible block +type PageBlockDetails struct { + meta + // Always visible heading for the block + Header RichText `json:"header"` + // Block contents + PageBlocks []PageBlock `json:"page_blocks"` + // True, if the block is open by default + IsOpen bool `json:"is_open"` +} + +func (entity *PageBlockDetails) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockDetails + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockDetails) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockDetails) GetType() string { + return TypePageBlockDetails +} + +func (*PageBlockDetails) PageBlockType() string { + return TypePageBlockDetails +} + +func (pageBlockDetails *PageBlockDetails) UnmarshalJSON(data []byte) error { + var tmp struct { + Header json.RawMessage `json:"header"` + PageBlocks []PageBlock `json:"page_blocks"` + IsOpen bool `json:"is_open"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockDetails.PageBlocks = tmp.PageBlocks + pageBlockDetails.IsOpen = tmp.IsOpen + + fieldHeader, _ := UnmarshalRichText(tmp.Header) + pageBlockDetails.Header = fieldHeader + + return nil +} + +// Related articles +type PageBlockRelatedArticles struct { + meta + // Block header + Header RichText `json:"header"` + // List of related articles + Articles []*PageBlockRelatedArticle `json:"articles"` +} + +func (entity *PageBlockRelatedArticles) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockRelatedArticles + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockRelatedArticles) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockRelatedArticles) GetType() string { + return TypePageBlockRelatedArticles +} + +func (*PageBlockRelatedArticles) PageBlockType() string { + return TypePageBlockRelatedArticles +} + +func (pageBlockRelatedArticles *PageBlockRelatedArticles) UnmarshalJSON(data []byte) error { + var tmp struct { + Header json.RawMessage `json:"header"` + Articles []*PageBlockRelatedArticle `json:"articles"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + pageBlockRelatedArticles.Articles = tmp.Articles + + fieldHeader, _ := UnmarshalRichText(tmp.Header) + pageBlockRelatedArticles.Header = fieldHeader + + return nil +} + +// A map +type PageBlockMap struct { + meta + // Location of the map center + Location *Location `json:"location"` + // Map zoom level + Zoom int32 `json:"zoom"` + // Map width + Width int32 `json:"width"` + // Map height + Height int32 `json:"height"` + // Block caption + Caption *PageBlockCaption `json:"caption"` +} + +func (entity *PageBlockMap) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PageBlockMap + + return json.Marshal((*stub)(entity)) +} + +func (*PageBlockMap) GetClass() string { + return ClassPageBlock +} + +func (*PageBlockMap) GetType() string { + return TypePageBlockMap +} + +func (*PageBlockMap) PageBlockType() string { + return TypePageBlockMap +} + // Describes an instant view page for a web page type WebPageInstantView struct { meta // Content of the web page PageBlocks []PageBlock `json:"page_blocks"` + // Version of the instant view, currently can be 1 or 2 + Version int32 `json:"version"` + // Instant view URL; may be different from WebPage.url and must be used for the correct anchors handling + Url string `json:"url"` + // True, if the instant view must be shown from right to left + IsRtl bool `json:"is_rtl"` // True, if the instant view contains the full page. A network request might be needed to get the full web page instant view IsFull bool `json:"is_full"` } @@ -6614,8 +7609,8 @@ type WebPage struct { VideoNote *VideoNote `json:"video_note"` // Preview of the content as a voice note, if available; may be null VoiceNote *VoiceNote `json:"voice_note"` - // True, if the web page has an instant view - HasInstantView bool `json:"has_instant_view"` + // Version of instant view, available for the web page (currently can be 1 or 2), 0 if none + InstantViewVersion int32 `json:"instant_view_version"` } func (entity *WebPage) MarshalJSON() ([]byte, error) { @@ -8491,6 +9486,8 @@ func (*PassportElementErrorSourceSelfie) PassportElementErrorSourceType() string // One of files with the translation of the document contains an error. The error will be considered resolved when the file changes type PassportElementErrorSourceTranslationFile struct { meta + // Index of a file with the error + FileIndex int32 `json:"file_index"` } func (entity *PassportElementErrorSourceTranslationFile) MarshalJSON() ([]byte, error) { @@ -8541,6 +9538,8 @@ func (*PassportElementErrorSourceTranslationFiles) PassportElementErrorSourceTyp // The file contains an error. The error will be considered resolved when the file changes type PassportElementErrorSourceFile struct { meta + // Index of a file with the error + FileIndex int32 `json:"file_index"` } func (entity *PassportElementErrorSourceFile) MarshalJSON() ([]byte, error) { @@ -8720,11 +9719,7 @@ type PassportAuthorizationForm struct { 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 + // URL for the privacy policy of the service; may be empty PrivacyPolicyUrl string `json:"privacy_policy_url"` } @@ -8744,6 +9739,31 @@ func (*PassportAuthorizationForm) GetType() string { return TypePassportAuthorizationForm } +// Contains information about a Telegram Passport elements and corresponding errors +type PassportElementsWithErrors struct { + meta + // Telegram Passport elements + Elements []PassportElement `json:"elements"` + // Errors in the elements that are already available + Errors []*PassportElementError `json:"errors"` +} + +func (entity *PassportElementsWithErrors) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PassportElementsWithErrors + + return json.Marshal((*stub)(entity)) +} + +func (*PassportElementsWithErrors) GetClass() string { + return ClassPassportElementsWithErrors +} + +func (*PassportElementsWithErrors) GetType() string { + return TypePassportElementsWithErrors +} + // Contains encrypted Telegram Passport data credentials type EncryptedCredentials struct { meta @@ -9569,6 +10589,33 @@ func (*MessageGame) MessageContentType() string { return TypeMessageGame } +// A message with a poll +type MessagePoll struct { + meta + // Poll + Poll *Poll `json:"poll"` +} + +func (entity *MessagePoll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub MessagePoll + + return json.Marshal((*stub)(entity)) +} + +func (*MessagePoll) GetClass() string { + return ClassMessageContent +} + +func (*MessagePoll) GetType() string { + return TypeMessagePoll +} + +func (*MessagePoll) MessageContentType() string { + return TypeMessagePoll +} + // A message with an invoice from a bot type MessageInvoice struct { meta @@ -9933,7 +10980,7 @@ func (*MessageChatUpgradeFrom) MessageContentType() string { // A message has been pinned type MessagePinMessage struct { meta - // Identifier of the pinned message, can be an identifier of a deleted message + // Identifier of the pinned message, can be an identifier of a deleted message or 0 MessageId int64 `json:"message_id"` } @@ -10041,7 +11088,7 @@ type MessageGameScore struct { meta // Identifier of the message with the game, can be an identifier of a deleted message GameMessageId int64 `json:"game_message_id"` - // Identifier of the game, may be different from the games presented in the message with the game + // Identifier of the game; may be different from the games presented in the message with the game GameId JsonInt64 `json:"game_id"` // New score Score int32 `json:"score"` @@ -10633,9 +11680,9 @@ type InputThumbnail struct { meta // Thumbnail file to send. Sending thumbnails by file_id is currently not supported Thumbnail InputFile `json:"thumbnail"` - // Thumbnail width, usually shouldn't exceed 90. Use 0 if unknown + // Thumbnail width, usually shouldn't exceed 320. Use 0 if unknown Width int32 `json:"width"` - // Thumbnail height, usually shouldn't exceed 90. Use 0 if unknown + // Thumbnail height, usually shouldn't exceed 320. Use 0 if unknown Height int32 `json:"height"` } @@ -11358,6 +12405,35 @@ func (*InputMessageInvoice) InputMessageContentType() string { return TypeInputMessageInvoice } +// A message with a poll. Polls can't be sent to private or secret chats +type InputMessagePoll struct { + meta + // Poll question, 1-255 characters + Question string `json:"question"` + // List of poll answer options, 2-10 strings 1-100 characters each + Options []string `json:"options"` +} + +func (entity *InputMessagePoll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub InputMessagePoll + + return json.Marshal((*stub)(entity)) +} + +func (*InputMessagePoll) GetClass() string { + return ClassInputMessageContent +} + +func (*InputMessagePoll) GetType() string { + return TypeInputMessagePoll +} + +func (*InputMessagePoll) InputMessageContentType() string { + return TypeInputMessagePoll +} + // A forwarded message type InputMessageForwarded struct { meta @@ -11764,7 +12840,7 @@ func (*SearchMessagesFilterMention) SearchMessagesFilterType() string { return TypeSearchMessagesFilterMention } -// Returns only messages with unread mentions of the current user or messages that are replies to their messages. When using this filter the results can't be additionally filtered by a query or by the sending user +// Returns only messages with unread mentions of the current user, or messages that are replies to their messages. When using this filter the results can't be additionally filtered by a query or by the sending user type SearchMessagesFilterUnreadMention struct { meta } @@ -12706,6 +13782,8 @@ type CallStateReady struct { EncryptionKey []byte `json:"encryption_key"` // Encryption key emojis fingerprint Emojis []string `json:"emojis"` + // True, if peer-to-peer connection is allowed by users privacy settings + AllowP2p bool `json:"allow_p2p"` } func (entity *CallStateReady) MarshalJSON() ([]byte, error) { @@ -12932,6 +14010,29 @@ func (*ImportedContacts) GetType() string { return TypeImportedContacts } +// Contains an HTTP URL +type HttpUrl struct { + meta + // The URL + Url string `json:"url"` +} + +func (entity *HttpUrl) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub HttpUrl + + return json.Marshal((*stub)(entity)) +} + +func (*HttpUrl) GetClass() string { + return ClassHttpUrl +} + +func (*HttpUrl) GetType() string { + return TypeHttpUrl +} + // Represents a link to an animated GIF type InputInlineQueryResultAnimatedGif struct { meta @@ -15140,7 +16241,7 @@ func (*LanguagePackStringValueOrdinary) LanguagePackStringValueType() string { return TypeLanguagePackStringValueOrdinary } -// A language pack string which has different forms based on the number of some object it mentions +// A language pack string which has different forms based on the number of some object it mentions. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more info type LanguagePackStringValuePluralized struct { meta // Value for zero objects @@ -15274,12 +16375,30 @@ type LanguagePackInfo struct { meta // Unique language pack identifier Id string `json:"id"` + // Identifier of a base language pack; may be empty. If a string is missed in the language pack, then it should be fetched from base language pack. Unsupported in custom language packs + BaseLanguagePackId string `json:"base_language_pack_id"` // Language name Name string `json:"name"` // Name of the language in that language NativeName string `json:"native_name"` + // A language code to be used to apply plural forms. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more info + PluralCode string `json:"plural_code"` + // True, if the language pack is official + IsOfficial bool `json:"is_official"` + // True, if the language pack strings are RTL + IsRtl bool `json:"is_rtl"` + // True, if the language pack is a beta language pack + IsBeta bool `json:"is_beta"` + // True, if the language pack is installed by the current user + IsInstalled bool `json:"is_installed"` + // Total number of non-deleted strings from the language pack + TotalStringCount int32 `json:"total_string_count"` + // Total number of translated strings from the language pack + TranslatedStringCount int32 `json:"translated_string_count"` // Total number of non-deleted strings from the language pack available locally LocalStringCount int32 `json:"local_string_count"` + // Link to language translation interface; empty for custom local language packs + TranslationUrl string `json:"translation_url"` } func (entity *LanguagePackInfo) MarshalJSON() ([]byte, error) { @@ -15321,31 +16440,33 @@ func (*LocalizationTargetInfo) GetType() string { return TypeLocalizationTargetInfo } -// A token for Google Cloud Messaging -type DeviceTokenGoogleCloudMessaging struct { +// A token for Firebase Cloud Messaging +type DeviceTokenFirebaseCloudMessaging struct { meta // Device registration token; may be empty to de-register a device Token string `json:"token"` + // True, if push notifications should be additionally encrypted + Encrypt bool `json:"encrypt"` } -func (entity *DeviceTokenGoogleCloudMessaging) MarshalJSON() ([]byte, error) { +func (entity *DeviceTokenFirebaseCloudMessaging) MarshalJSON() ([]byte, error) { entity.meta.Type = entity.GetType() - type stub DeviceTokenGoogleCloudMessaging + type stub DeviceTokenFirebaseCloudMessaging return json.Marshal((*stub)(entity)) } -func (*DeviceTokenGoogleCloudMessaging) GetClass() string { +func (*DeviceTokenFirebaseCloudMessaging) GetClass() string { return ClassDeviceToken } -func (*DeviceTokenGoogleCloudMessaging) GetType() string { - return TypeDeviceTokenGoogleCloudMessaging +func (*DeviceTokenFirebaseCloudMessaging) GetType() string { + return TypeDeviceTokenFirebaseCloudMessaging } -func (*DeviceTokenGoogleCloudMessaging) DeviceTokenType() string { - return TypeDeviceTokenGoogleCloudMessaging +func (*DeviceTokenFirebaseCloudMessaging) DeviceTokenType() string { + return TypeDeviceTokenFirebaseCloudMessaging } // A token for Apple Push Notification service @@ -15384,6 +16505,8 @@ type DeviceTokenApplePushVoIP struct { DeviceToken string `json:"device_token"` // True, if App Sandbox is enabled IsAppSandbox bool `json:"is_app_sandbox"` + // True, if push notifications should be additionally encrypted + Encrypt bool `json:"encrypt"` } func (entity *DeviceTokenApplePushVoIP) MarshalJSON() ([]byte, error) { @@ -15626,6 +16749,29 @@ func (*DeviceTokenTizenPush) DeviceTokenType() string { return TypeDeviceTokenTizenPush } +// Contains a globally unique push receiver identifier, which can be used to identify which account has received a push notification +type PushReceiverId struct { + meta + // The globally unique identifier of push notification subscription + Id JsonInt64 `json:"id"` +} + +func (entity *PushReceiverId) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushReceiverId + + return json.Marshal((*stub)(entity)) +} + +func (*PushReceiverId) GetClass() string { + return ClassPushReceiverId +} + +func (*PushReceiverId) GetType() string { + return TypePushReceiverId +} + // Contains information about a wallpaper type Wallpaper struct { meta @@ -15824,7 +16970,1090 @@ func (*CheckChatUsernameResultPublicGroupsUnavailable) CheckChatUsernameResultTy return TypeCheckChatUsernameResultPublicGroupsUnavailable } -// Boolean option +// A general message with hidden content +type PushMessageContentHidden struct { + meta + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentHidden) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentHidden + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentHidden) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentHidden) GetType() string { + return TypePushMessageContentHidden +} + +func (*PushMessageContentHidden) PushMessageContentType() string { + return TypePushMessageContentHidden +} + +// An animation message (GIF-style) +type PushMessageContentAnimation struct { + meta + // Message content; may be null + Animation *Animation `json:"animation"` + // Animation caption + Caption string `json:"caption"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentAnimation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentAnimation + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentAnimation) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentAnimation) GetType() string { + return TypePushMessageContentAnimation +} + +func (*PushMessageContentAnimation) PushMessageContentType() string { + return TypePushMessageContentAnimation +} + +// An audio message +type PushMessageContentAudio struct { + meta + // Message content; may be null + Audio *Audio `json:"audio"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentAudio) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentAudio + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentAudio) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentAudio) GetType() string { + return TypePushMessageContentAudio +} + +func (*PushMessageContentAudio) PushMessageContentType() string { + return TypePushMessageContentAudio +} + +// A message with a user contact +type PushMessageContentContact struct { + meta + // Contact's name + Name string `json:"name"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentContact) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentContact + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentContact) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentContact) GetType() string { + return TypePushMessageContentContact +} + +func (*PushMessageContentContact) PushMessageContentType() string { + return TypePushMessageContentContact +} + +// A contact has registered with Telegram +type PushMessageContentContactRegistered struct { + meta +} + +func (entity *PushMessageContentContactRegistered) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentContactRegistered + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentContactRegistered) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentContactRegistered) GetType() string { + return TypePushMessageContentContactRegistered +} + +func (*PushMessageContentContactRegistered) PushMessageContentType() string { + return TypePushMessageContentContactRegistered +} + +// A document message (a general file) +type PushMessageContentDocument struct { + meta + // Message content; may be null + Document *Document `json:"document"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentDocument) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentDocument + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentDocument) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentDocument) GetType() string { + return TypePushMessageContentDocument +} + +func (*PushMessageContentDocument) PushMessageContentType() string { + return TypePushMessageContentDocument +} + +// A message with a game +type PushMessageContentGame struct { + meta + // Game title, empty for pinned game message + Title string `json:"title"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentGame) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentGame + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentGame) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentGame) GetType() string { + return TypePushMessageContentGame +} + +func (*PushMessageContentGame) PushMessageContentType() string { + return TypePushMessageContentGame +} + +// A new high score was achieved in a game +type PushMessageContentGameScore struct { + meta + // Game title, empty for pinned message + Title string `json:"title"` + // New score, 0 for pinned message + Score int32 `json:"score"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentGameScore) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentGameScore + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentGameScore) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentGameScore) GetType() string { + return TypePushMessageContentGameScore +} + +func (*PushMessageContentGameScore) PushMessageContentType() string { + return TypePushMessageContentGameScore +} + +// A message with an invoice from a bot +type PushMessageContentInvoice struct { + meta + // Product price + Price string `json:"price"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentInvoice) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentInvoice + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentInvoice) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentInvoice) GetType() string { + return TypePushMessageContentInvoice +} + +func (*PushMessageContentInvoice) PushMessageContentType() string { + return TypePushMessageContentInvoice +} + +// A message with a location +type PushMessageContentLocation struct { + meta + // True, if the location is live + IsLive bool `json:"is_live"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentLocation) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentLocation + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentLocation) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentLocation) GetType() string { + return TypePushMessageContentLocation +} + +func (*PushMessageContentLocation) PushMessageContentType() string { + return TypePushMessageContentLocation +} + +// A photo message +type PushMessageContentPhoto struct { + meta + // Message content; may be null + Photo *Photo `json:"photo"` + // Photo caption + Caption string `json:"caption"` + // True, if the photo is secret + IsSecret bool `json:"is_secret"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentPhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentPhoto + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentPhoto) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentPhoto) GetType() string { + return TypePushMessageContentPhoto +} + +func (*PushMessageContentPhoto) PushMessageContentType() string { + return TypePushMessageContentPhoto +} + +// A message with a poll +type PushMessageContentPoll struct { + meta + // Poll question + Question string `json:"question"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentPoll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentPoll + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentPoll) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentPoll) GetType() string { + return TypePushMessageContentPoll +} + +func (*PushMessageContentPoll) PushMessageContentType() string { + return TypePushMessageContentPoll +} + +// A screenshot of a message in the chat has been taken +type PushMessageContentScreenshotTaken struct { + meta +} + +func (entity *PushMessageContentScreenshotTaken) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentScreenshotTaken + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentScreenshotTaken) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentScreenshotTaken) GetType() string { + return TypePushMessageContentScreenshotTaken +} + +func (*PushMessageContentScreenshotTaken) PushMessageContentType() string { + return TypePushMessageContentScreenshotTaken +} + +// A message with a sticker +type PushMessageContentSticker struct { + meta + // Message content; may be null + Sticker *Sticker `json:"sticker"` + // Emoji corresponding to the sticker; may be empty + Emoji string `json:"emoji"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentSticker) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentSticker + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentSticker) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentSticker) GetType() string { + return TypePushMessageContentSticker +} + +func (*PushMessageContentSticker) PushMessageContentType() string { + return TypePushMessageContentSticker +} + +// A text message +type PushMessageContentText struct { + meta + // Message text + Text string `json:"text"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentText) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentText + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentText) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentText) GetType() string { + return TypePushMessageContentText +} + +func (*PushMessageContentText) PushMessageContentType() string { + return TypePushMessageContentText +} + +// A video message +type PushMessageContentVideo struct { + meta + // Message content; may be null + Video *Video `json:"video"` + // Video caption + Caption string `json:"caption"` + // True, if the video is secret + IsSecret bool `json:"is_secret"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentVideo) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideo + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideo) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideo) GetType() string { + return TypePushMessageContentVideo +} + +func (*PushMessageContentVideo) PushMessageContentType() string { + return TypePushMessageContentVideo +} + +// A video note message +type PushMessageContentVideoNote struct { + meta + // Message content; may be null + VideoNote *VideoNote `json:"video_note"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentVideoNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVideoNote + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVideoNote) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVideoNote) GetType() string { + return TypePushMessageContentVideoNote +} + +func (*PushMessageContentVideoNote) PushMessageContentType() string { + return TypePushMessageContentVideoNote +} + +// A voice note message +type PushMessageContentVoiceNote struct { + meta + // Message content; may be null + VoiceNote *VoiceNote `json:"voice_note"` + // True, if the message is a pinned message with the specified content + IsPinned bool `json:"is_pinned"` +} + +func (entity *PushMessageContentVoiceNote) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentVoiceNote + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentVoiceNote) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentVoiceNote) GetType() string { + return TypePushMessageContentVoiceNote +} + +func (*PushMessageContentVoiceNote) PushMessageContentType() string { + return TypePushMessageContentVoiceNote +} + +// A newly created basic group +type PushMessageContentBasicGroupChatCreate struct { + meta +} + +func (entity *PushMessageContentBasicGroupChatCreate) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentBasicGroupChatCreate + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentBasicGroupChatCreate) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentBasicGroupChatCreate) GetType() string { + return TypePushMessageContentBasicGroupChatCreate +} + +func (*PushMessageContentBasicGroupChatCreate) PushMessageContentType() string { + return TypePushMessageContentBasicGroupChatCreate +} + +// New chat members were invited to a group +type PushMessageContentChatAddMembers struct { + meta + // Name of the added member + MemberName string `json:"member_name"` + // True, if the current user was added to the group + IsCurrentUser bool `json:"is_current_user"` + // True, if the user has returned to the group himself + IsReturned bool `json:"is_returned"` +} + +func (entity *PushMessageContentChatAddMembers) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChatAddMembers + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChatAddMembers) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChatAddMembers) GetType() string { + return TypePushMessageContentChatAddMembers +} + +func (*PushMessageContentChatAddMembers) PushMessageContentType() string { + return TypePushMessageContentChatAddMembers +} + +// A chat photo was edited +type PushMessageContentChatChangePhoto struct { + meta +} + +func (entity *PushMessageContentChatChangePhoto) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChatChangePhoto + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChatChangePhoto) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChatChangePhoto) GetType() string { + return TypePushMessageContentChatChangePhoto +} + +func (*PushMessageContentChatChangePhoto) PushMessageContentType() string { + return TypePushMessageContentChatChangePhoto +} + +// A chat title was edited +type PushMessageContentChatChangeTitle struct { + meta + // New chat title + Title string `json:"title"` +} + +func (entity *PushMessageContentChatChangeTitle) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChatChangeTitle + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChatChangeTitle) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChatChangeTitle) GetType() string { + return TypePushMessageContentChatChangeTitle +} + +func (*PushMessageContentChatChangeTitle) PushMessageContentType() string { + return TypePushMessageContentChatChangeTitle +} + +// A chat member was deleted +type PushMessageContentChatDeleteMember struct { + meta + // Name of the deleted member + MemberName string `json:"member_name"` + // True, if the current user was deleted from the group + IsCurrentUser bool `json:"is_current_user"` + // True, if the user has left the group himself + IsLeft bool `json:"is_left"` +} + +func (entity *PushMessageContentChatDeleteMember) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChatDeleteMember + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChatDeleteMember) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChatDeleteMember) GetType() string { + return TypePushMessageContentChatDeleteMember +} + +func (*PushMessageContentChatDeleteMember) PushMessageContentType() string { + return TypePushMessageContentChatDeleteMember +} + +// A new member joined the chat by invite link +type PushMessageContentChatJoinByLink struct { + meta +} + +func (entity *PushMessageContentChatJoinByLink) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentChatJoinByLink + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentChatJoinByLink) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentChatJoinByLink) GetType() string { + return TypePushMessageContentChatJoinByLink +} + +func (*PushMessageContentChatJoinByLink) PushMessageContentType() string { + return TypePushMessageContentChatJoinByLink +} + +// A forwarded messages +type PushMessageContentMessageForwards struct { + meta + // Number of forwarded messages + TotalCount int32 `json:"total_count"` +} + +func (entity *PushMessageContentMessageForwards) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentMessageForwards + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentMessageForwards) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentMessageForwards) GetType() string { + return TypePushMessageContentMessageForwards +} + +func (*PushMessageContentMessageForwards) PushMessageContentType() string { + return TypePushMessageContentMessageForwards +} + +// A media album +type PushMessageContentMediaAlbum struct { + meta + // Number of messages in the album + TotalCount int32 `json:"total_count"` + // True, if the album has at least one photo + HasPhotos bool `json:"has_photos"` + // True, if the album has at least one video + HasVideos bool `json:"has_videos"` +} + +func (entity *PushMessageContentMediaAlbum) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub PushMessageContentMediaAlbum + + return json.Marshal((*stub)(entity)) +} + +func (*PushMessageContentMediaAlbum) GetClass() string { + return ClassPushMessageContent +} + +func (*PushMessageContentMediaAlbum) GetType() string { + return TypePushMessageContentMediaAlbum +} + +func (*PushMessageContentMediaAlbum) PushMessageContentType() string { + return TypePushMessageContentMediaAlbum +} + +// New message was received +type NotificationTypeNewMessage struct { + meta + // The message + Message *Message `json:"message"` +} + +func (entity *NotificationTypeNewMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationTypeNewMessage + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationTypeNewMessage) GetClass() string { + return ClassNotificationType +} + +func (*NotificationTypeNewMessage) GetType() string { + return TypeNotificationTypeNewMessage +} + +func (*NotificationTypeNewMessage) NotificationTypeType() string { + return TypeNotificationTypeNewMessage +} + +// New secret chat was created +type NotificationTypeNewSecretChat struct { + meta +} + +func (entity *NotificationTypeNewSecretChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationTypeNewSecretChat + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationTypeNewSecretChat) GetClass() string { + return ClassNotificationType +} + +func (*NotificationTypeNewSecretChat) GetType() string { + return TypeNotificationTypeNewSecretChat +} + +func (*NotificationTypeNewSecretChat) NotificationTypeType() string { + return TypeNotificationTypeNewSecretChat +} + +// New call was received +type NotificationTypeNewCall struct { + meta + // Call identifier + CallId int32 `json:"call_id"` +} + +func (entity *NotificationTypeNewCall) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationTypeNewCall + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationTypeNewCall) GetClass() string { + return ClassNotificationType +} + +func (*NotificationTypeNewCall) GetType() string { + return TypeNotificationTypeNewCall +} + +func (*NotificationTypeNewCall) NotificationTypeType() string { + return TypeNotificationTypeNewCall +} + +// New message was received through a push notification +type NotificationTypeNewPushMessage struct { + meta + // The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages and as reply_to_message_id + MessageId int64 `json:"message_id"` + // Sender of the message. Corresponding user may be inaccessible + SenderUserId int32 `json:"sender_user_id"` + // Push message content + Content PushMessageContent `json:"content"` +} + +func (entity *NotificationTypeNewPushMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationTypeNewPushMessage + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationTypeNewPushMessage) GetClass() string { + return ClassNotificationType +} + +func (*NotificationTypeNewPushMessage) GetType() string { + return TypeNotificationTypeNewPushMessage +} + +func (*NotificationTypeNewPushMessage) NotificationTypeType() string { + return TypeNotificationTypeNewPushMessage +} + +func (notificationTypeNewPushMessage *NotificationTypeNewPushMessage) UnmarshalJSON(data []byte) error { + var tmp struct { + MessageId int64 `json:"message_id"` + SenderUserId int32 `json:"sender_user_id"` + Content json.RawMessage `json:"content"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + notificationTypeNewPushMessage.MessageId = tmp.MessageId + notificationTypeNewPushMessage.SenderUserId = tmp.SenderUserId + + fieldContent, _ := UnmarshalPushMessageContent(tmp.Content) + notificationTypeNewPushMessage.Content = fieldContent + + return nil +} + +// A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with ordinary unread messages +type NotificationGroupTypeMessages struct { + meta +} + +func (entity *NotificationGroupTypeMessages) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationGroupTypeMessages + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationGroupTypeMessages) GetClass() string { + return ClassNotificationGroupType +} + +func (*NotificationGroupTypeMessages) GetType() string { + return TypeNotificationGroupTypeMessages +} + +func (*NotificationGroupTypeMessages) NotificationGroupTypeType() string { + return TypeNotificationGroupTypeMessages +} + +// A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with unread mentions of the current user, replies to their messages, or a pinned message +type NotificationGroupTypeMentions struct { + meta +} + +func (entity *NotificationGroupTypeMentions) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationGroupTypeMentions + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationGroupTypeMentions) GetClass() string { + return ClassNotificationGroupType +} + +func (*NotificationGroupTypeMentions) GetType() string { + return TypeNotificationGroupTypeMentions +} + +func (*NotificationGroupTypeMentions) NotificationGroupTypeType() string { + return TypeNotificationGroupTypeMentions +} + +// A group containing a notification of type notificationTypeNewSecretChat +type NotificationGroupTypeSecretChat struct { + meta +} + +func (entity *NotificationGroupTypeSecretChat) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationGroupTypeSecretChat + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationGroupTypeSecretChat) GetClass() string { + return ClassNotificationGroupType +} + +func (*NotificationGroupTypeSecretChat) GetType() string { + return TypeNotificationGroupTypeSecretChat +} + +func (*NotificationGroupTypeSecretChat) NotificationGroupTypeType() string { + return TypeNotificationGroupTypeSecretChat +} + +// A group containing notifications of type notificationTypeNewCall +type NotificationGroupTypeCalls struct { + meta +} + +func (entity *NotificationGroupTypeCalls) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationGroupTypeCalls + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationGroupTypeCalls) GetClass() string { + return ClassNotificationGroupType +} + +func (*NotificationGroupTypeCalls) GetType() string { + return TypeNotificationGroupTypeCalls +} + +func (*NotificationGroupTypeCalls) NotificationGroupTypeType() string { + return TypeNotificationGroupTypeCalls +} + +// Contains information about a notification +type Notification struct { + meta + // Unique persistent identifier of this notification + Id int32 `json:"id"` + // Notification date + Date int32 `json:"date"` + // Notification type + Type NotificationType `json:"type"` +} + +func (entity *Notification) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Notification + + return json.Marshal((*stub)(entity)) +} + +func (*Notification) GetClass() string { + return ClassNotification +} + +func (*Notification) GetType() string { + return TypeNotification +} + +func (notification *Notification) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int32 `json:"id"` + Date int32 `json:"date"` + Type json.RawMessage `json:"type"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + notification.Id = tmp.Id + notification.Date = tmp.Date + + fieldType, _ := UnmarshalNotificationType(tmp.Type) + notification.Type = fieldType + + return nil +} + +// Describes a group of notifications +type NotificationGroup struct { + meta + // Unique persistent auto-incremented from 1 identifier of the notification group + Id int32 `json:"id"` + // Type of the group + Type NotificationGroupType `json:"type"` + // Identifier of a chat to which all notifications in the group belong + ChatId int64 `json:"chat_id"` + // Total number of active notifications in the group + TotalCount int32 `json:"total_count"` + // The list of active notifications + Notifications []*Notification `json:"notifications"` +} + +func (entity *NotificationGroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub NotificationGroup + + return json.Marshal((*stub)(entity)) +} + +func (*NotificationGroup) GetClass() string { + return ClassNotificationGroup +} + +func (*NotificationGroup) GetType() string { + return TypeNotificationGroup +} + +func (notificationGroup *NotificationGroup) UnmarshalJSON(data []byte) error { + var tmp struct { + Id int32 `json:"id"` + Type json.RawMessage `json:"type"` + ChatId int64 `json:"chat_id"` + TotalCount int32 `json:"total_count"` + Notifications []*Notification `json:"notifications"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + notificationGroup.Id = tmp.Id + notificationGroup.ChatId = tmp.ChatId + notificationGroup.TotalCount = tmp.TotalCount + notificationGroup.Notifications = tmp.Notifications + + fieldType, _ := UnmarshalNotificationGroupType(tmp.Type) + notificationGroup.Type = fieldType + + return nil +} + +// Represents a boolean option type OptionValueBoolean struct { meta // The value of the option @@ -15851,7 +18080,7 @@ func (*OptionValueBoolean) OptionValueType() string { return TypeOptionValueBoolean } -// An unknown option or an option which has a default value +// Represents an unknown option or an option which has a default value type OptionValueEmpty struct { meta } @@ -15876,7 +18105,7 @@ func (*OptionValueEmpty) OptionValueType() string { return TypeOptionValueEmpty } -// An integer option +// Represents an integer option type OptionValueInteger struct { meta // The value of the option @@ -15903,7 +18132,7 @@ func (*OptionValueInteger) OptionValueType() string { return TypeOptionValueInteger } -// A string option +// Represents a string option type OptionValueString struct { meta // The value of the option @@ -15930,6 +18159,210 @@ func (*OptionValueString) OptionValueType() string { return TypeOptionValueString } +// Represents one member of a JSON object +type JsonObjectMember struct { + meta + // Member's key + Key string `json:"key"` + // Member's value + Value JsonValue `json:"value"` +} + +func (entity *JsonObjectMember) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub JsonObjectMember + + return json.Marshal((*stub)(entity)) +} + +func (*JsonObjectMember) GetClass() string { + return ClassJsonObjectMember +} + +func (*JsonObjectMember) GetType() string { + return TypeJsonObjectMember +} + +func (jsonObjectMember *JsonObjectMember) 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 + } + + jsonObjectMember.Key = tmp.Key + + fieldValue, _ := UnmarshalJsonValue(tmp.Value) + jsonObjectMember.Value = fieldValue + + return nil +} + +// Represents a null JSON value +type JsonValueNull struct { + meta +} + +func (entity *JsonValueNull) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub JsonValueNull + + return json.Marshal((*stub)(entity)) +} + +func (*JsonValueNull) GetClass() string { + return ClassJsonValue +} + +func (*JsonValueNull) GetType() string { + return TypeJsonValueNull +} + +func (*JsonValueNull) JsonValueType() string { + return TypeJsonValueNull +} + +// Represents a boolean JSON value +type JsonValueBoolean struct { + meta + // The value + Value bool `json:"value"` +} + +func (entity *JsonValueBoolean) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub JsonValueBoolean + + return json.Marshal((*stub)(entity)) +} + +func (*JsonValueBoolean) GetClass() string { + return ClassJsonValue +} + +func (*JsonValueBoolean) GetType() string { + return TypeJsonValueBoolean +} + +func (*JsonValueBoolean) JsonValueType() string { + return TypeJsonValueBoolean +} + +// Represents a numeric JSON value +type JsonValueNumber struct { + meta + // The value + Value float64 `json:"value"` +} + +func (entity *JsonValueNumber) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub JsonValueNumber + + return json.Marshal((*stub)(entity)) +} + +func (*JsonValueNumber) GetClass() string { + return ClassJsonValue +} + +func (*JsonValueNumber) GetType() string { + return TypeJsonValueNumber +} + +func (*JsonValueNumber) JsonValueType() string { + return TypeJsonValueNumber +} + +// Represents a string JSON value +type JsonValueString struct { + meta + // The value + Value string `json:"value"` +} + +func (entity *JsonValueString) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub JsonValueString + + return json.Marshal((*stub)(entity)) +} + +func (*JsonValueString) GetClass() string { + return ClassJsonValue +} + +func (*JsonValueString) GetType() string { + return TypeJsonValueString +} + +func (*JsonValueString) JsonValueType() string { + return TypeJsonValueString +} + +// Represents a JSON array +type JsonValueArray struct { + meta + // The list of array elements + Values []JsonValue `json:"values"` +} + +func (entity *JsonValueArray) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub JsonValueArray + + return json.Marshal((*stub)(entity)) +} + +func (*JsonValueArray) GetClass() string { + return ClassJsonValue +} + +func (*JsonValueArray) GetType() string { + return TypeJsonValueArray +} + +func (*JsonValueArray) JsonValueType() string { + return TypeJsonValueArray +} + +// Represents a JSON object +type JsonValueObject struct { + meta + // The list of object members + Members []*JsonObjectMember `json:"members"` +} + +func (entity *JsonValueObject) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub JsonValueObject + + return json.Marshal((*stub)(entity)) +} + +func (*JsonValueObject) GetClass() string { + return ClassJsonValue +} + +func (*JsonValueObject) GetType() string { + return TypeJsonValueObject +} + +func (*JsonValueObject) JsonValueType() string { + return TypeJsonValueObject +} + // A rule to allow all users to do something type UserPrivacySettingRuleAllowAll struct { meta @@ -16182,6 +18615,31 @@ func (*UserPrivacySettingAllowCalls) UserPrivacySettingType() string { return TypeUserPrivacySettingAllowCalls } +// A privacy setting for managing whether peer-to-peer connections can be used for calls +type UserPrivacySettingAllowPeerToPeerCalls struct { + meta +} + +func (entity *UserPrivacySettingAllowPeerToPeerCalls) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UserPrivacySettingAllowPeerToPeerCalls + + return json.Marshal((*stub)(entity)) +} + +func (*UserPrivacySettingAllowPeerToPeerCalls) GetClass() string { + return ClassUserPrivacySetting +} + +func (*UserPrivacySettingAllowPeerToPeerCalls) GetType() string { + return TypeUserPrivacySettingAllowPeerToPeerCalls +} + +func (*UserPrivacySettingAllowPeerToPeerCalls) UserPrivacySettingType() string { + return TypeUserPrivacySettingAllowPeerToPeerCalls +} + // Contains information about the period of inactivity after which the current user's account will automatically be deleted type AccountTtl struct { meta @@ -16205,13 +18663,15 @@ func (*AccountTtl) GetType() string { return TypeAccountTtl } -// Contains information about one session in a Telegram application used by the current user +// Contains information about one session in a Telegram application used by the current user. Sessions should be shown to the user in the returned order type Session struct { meta // Session identifier Id JsonInt64 `json:"id"` // True, if this session is the current session IsCurrent bool `json:"is_current"` + // True, if a password is needed to complete authorization of the session + IsPasswordPending bool `json:"is_password_pending"` // Telegram API identifier, as provided by the application ApiId int32 `json:"api_id"` // Name of the application, as provided by the application @@ -16437,6 +18897,31 @@ func (*ChatReportReasonPornography) ChatReportReasonType() string { return TypeChatReportReasonPornography } +// The chat has child abuse related content +type ChatReportReasonChildAbuse struct { + meta +} + +func (entity *ChatReportReasonChildAbuse) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub ChatReportReasonChildAbuse + + return json.Marshal((*stub)(entity)) +} + +func (*ChatReportReasonChildAbuse) GetClass() string { + return ClassChatReportReason +} + +func (*ChatReportReasonChildAbuse) GetType() string { + return TypeChatReportReasonChildAbuse +} + +func (*ChatReportReasonChildAbuse) ChatReportReasonType() string { + return TypeChatReportReasonChildAbuse +} + // The chat contains copyrighted content type ChatReportReasonCopyright struct { meta @@ -16514,6 +18999,29 @@ func (*PublicMessageLink) GetType() string { return TypePublicMessageLink } +// Contains a part of a file +type FilePart struct { + meta + // File bytes + Data []byte `json:"data"` +} + +func (entity *FilePart) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub FilePart + + return json.Marshal((*stub)(entity)) +} + +func (*FilePart) GetClass() string { + return ClassFilePart +} + +func (*FilePart) GetType() string { + return TypeFilePart +} + // The data is not a file type FileTypeNone struct { meta @@ -17027,6 +19535,10 @@ type StorageStatisticsFast struct { FileCount int32 `json:"file_count"` // Size of the database DatabaseSize int64 `json:"database_size"` + // Size of the language pack database + LanguagePackDatabaseSize int64 `json:"language_pack_database_size"` + // Size of the TDLib internal log + LogSize int64 `json:"log_size"` } func (entity *StorageStatisticsFast) MarshalJSON() ([]byte, error) { @@ -17045,6 +19557,29 @@ func (*StorageStatisticsFast) GetType() string { return TypeStorageStatisticsFast } +// Contains database statistics +type DatabaseStatistics struct { + meta + // Database statistics in an unspecified human-readable format + Statistics string `json:"statistics"` +} + +func (entity *DatabaseStatistics) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub DatabaseStatistics + + return json.Marshal((*stub)(entity)) +} + +func (*DatabaseStatistics) GetClass() string { + return ClassDatabaseStatistics +} + +func (*DatabaseStatistics) GetType() string { + return TypeDatabaseStatistics +} + // The network is not available type NetworkTypeNone struct { meta @@ -18169,10 +20704,6 @@ type UpdateNewMessage struct { meta // The new message Message *Message `json:"message"` - // True, if this message must not generate a notification - DisableNotification bool `json:"disable_notification"` - // True, if the message contains a mention of the current user - ContainsMention bool `json:"contains_mention"` } func (entity *UpdateNewMessage) MarshalJSON() ([]byte, error) { @@ -18601,7 +21132,7 @@ func (*UpdateChatLastMessage) UpdateType() string { return TypeUpdateChatLastMessage } -// The order of the chat in the chats list has changed. Instead of this update updateChatLastMessage, updateChatIsPinned or updateChatDraftMessage might be sent +// The order of the chat in the chat list has changed. Instead of this update updateChatLastMessage, updateChatIsPinned or updateChatDraftMessage might be sent type UpdateChatOrder struct { meta // Chat identifier @@ -18916,6 +21447,35 @@ func (updateScopeNotificationSettings *UpdateScopeNotificationSettings) Unmarsha return nil } +// The chat pinned message was changed +type UpdateChatPinnedMessage struct { + meta + // Chat identifier + ChatId int64 `json:"chat_id"` + // The new identifier of the pinned message; 0 if there is no pinned message in the chat + PinnedMessageId int64 `json:"pinned_message_id"` +} + +func (entity *UpdateChatPinnedMessage) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatPinnedMessage + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatPinnedMessage) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatPinnedMessage) GetType() string { + return TypeUpdateChatPinnedMessage +} + +func (*UpdateChatPinnedMessage) UpdateType() string { + return TypeUpdateChatPinnedMessage +} + // 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 type UpdateChatReplyMarkup struct { meta @@ -18976,6 +21536,192 @@ func (*UpdateChatDraftMessage) UpdateType() string { return TypeUpdateChatDraftMessage } +// The number of online group members has changed. This update with non-zero count is sent only for currently opened chats. There is no guarantee that it will be sent just after the count has changed +type UpdateChatOnlineMemberCount struct { + meta + // Identifier of the chat + ChatId int64 `json:"chat_id"` + // New number of online members in the chat, or 0 if unknown + OnlineMemberCount int32 `json:"online_member_count"` +} + +func (entity *UpdateChatOnlineMemberCount) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateChatOnlineMemberCount + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateChatOnlineMemberCount) GetClass() string { + return ClassUpdate +} + +func (*UpdateChatOnlineMemberCount) GetType() string { + return TypeUpdateChatOnlineMemberCount +} + +func (*UpdateChatOnlineMemberCount) UpdateType() string { + return TypeUpdateChatOnlineMemberCount +} + +// A notification was changed +type UpdateNotification struct { + meta + // Unique notification group identifier + NotificationGroupId int32 `json:"notification_group_id"` + // Changed notification + Notification *Notification `json:"notification"` +} + +func (entity *UpdateNotification) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNotification + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNotification) GetClass() string { + return ClassUpdate +} + +func (*UpdateNotification) GetType() string { + return TypeUpdateNotification +} + +func (*UpdateNotification) UpdateType() string { + return TypeUpdateNotification +} + +// A list of active notifications in a notification group has changed +type UpdateNotificationGroup struct { + meta + // Unique notification group identifier + NotificationGroupId int32 `json:"notification_group_id"` + // New type of the notification group + Type NotificationGroupType `json:"type"` + // Identifier of a chat to which all notifications in the group belong + ChatId int64 `json:"chat_id"` + // Chat identifier, which notification settings must be applied to the added notifications + NotificationSettingsChatId int64 `json:"notification_settings_chat_id"` + // True, if the notifications should be shown without sound + IsSilent bool `json:"is_silent"` + // Total number of unread notifications in the group, can be bigger than number of active notifications + TotalCount int32 `json:"total_count"` + // List of added group notifications, sorted by notification ID + AddedNotifications []*Notification `json:"added_notifications"` + // Identifiers of removed group notifications, sorted by notification ID + RemovedNotificationIds []int32 `json:"removed_notification_ids"` +} + +func (entity *UpdateNotificationGroup) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateNotificationGroup + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateNotificationGroup) GetClass() string { + return ClassUpdate +} + +func (*UpdateNotificationGroup) GetType() string { + return TypeUpdateNotificationGroup +} + +func (*UpdateNotificationGroup) UpdateType() string { + return TypeUpdateNotificationGroup +} + +func (updateNotificationGroup *UpdateNotificationGroup) UnmarshalJSON(data []byte) error { + var tmp struct { + NotificationGroupId int32 `json:"notification_group_id"` + Type json.RawMessage `json:"type"` + ChatId int64 `json:"chat_id"` + NotificationSettingsChatId int64 `json:"notification_settings_chat_id"` + IsSilent bool `json:"is_silent"` + TotalCount int32 `json:"total_count"` + AddedNotifications []*Notification `json:"added_notifications"` + RemovedNotificationIds []int32 `json:"removed_notification_ids"` + } + + err := json.Unmarshal(data, &tmp) + if err != nil { + return err + } + + updateNotificationGroup.NotificationGroupId = tmp.NotificationGroupId + updateNotificationGroup.ChatId = tmp.ChatId + updateNotificationGroup.NotificationSettingsChatId = tmp.NotificationSettingsChatId + updateNotificationGroup.IsSilent = tmp.IsSilent + updateNotificationGroup.TotalCount = tmp.TotalCount + updateNotificationGroup.AddedNotifications = tmp.AddedNotifications + updateNotificationGroup.RemovedNotificationIds = tmp.RemovedNotificationIds + + fieldType, _ := UnmarshalNotificationGroupType(tmp.Type) + updateNotificationGroup.Type = fieldType + + return nil +} + +// Contains active notifications that was shown on previous application launches. This update is sent only if a message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update +type UpdateActiveNotifications struct { + meta + // Lists of active notification groups + Groups []*NotificationGroup `json:"groups"` +} + +func (entity *UpdateActiveNotifications) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateActiveNotifications + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateActiveNotifications) GetClass() string { + return ClassUpdate +} + +func (*UpdateActiveNotifications) GetType() string { + return TypeUpdateActiveNotifications +} + +func (*UpdateActiveNotifications) UpdateType() string { + return TypeUpdateActiveNotifications +} + +// Describes, whether there are some pending notification updates. Can be used to prevent application from killing, while there are some pending notifications +type UpdateHavePendingNotifications struct { + meta + // True, if there are some delayed notification updates, which will be sent soon + HaveDelayedNotifications bool `json:"have_delayed_notifications"` + // True, if there can be some yet unreceived notifications, which are being fetched from the server + HaveUnreceivedNotifications bool `json:"have_unreceived_notifications"` +} + +func (entity *UpdateHavePendingNotifications) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdateHavePendingNotifications + + return json.Marshal((*stub)(entity)) +} + +func (*UpdateHavePendingNotifications) GetClass() string { + return ClassUpdate +} + +func (*UpdateHavePendingNotifications) GetType() string { + return TypeUpdateHavePendingNotifications +} + +func (*UpdateHavePendingNotifications) UpdateType() string { + return TypeUpdateHavePendingNotifications +} + // Some messages were deleted type UpdateDeleteMessages struct { meta @@ -18983,7 +21729,7 @@ type UpdateDeleteMessages struct { ChatId int64 `json:"chat_id"` // Identifiers of the deleted messages MessageIds []int64 `json:"message_ids"` - // True, if the messages are permanently deleted by a user (as opposed to just becoming unaccessible) + // True, if the messages are permanently deleted by a user (as opposed to just becoming inaccessible) IsPermanent bool `json:"is_permanent"` // True, if the messages are deleted only from the cache and can possibly be retrieved again in the future FromCache bool `json:"from_cache"` @@ -20190,6 +22936,181 @@ func (*UpdateNewCustomQuery) UpdateType() string { return TypeUpdateNewCustomQuery } +// Information about a poll was updated; for bots only +type UpdatePoll struct { + meta + // New data about the poll + Poll *Poll `json:"poll"` +} + +func (entity *UpdatePoll) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub UpdatePoll + + return json.Marshal((*stub)(entity)) +} + +func (*UpdatePoll) GetClass() string { + return ClassUpdate +} + +func (*UpdatePoll) GetType() string { + return TypeUpdatePoll +} + +func (*UpdatePoll) UpdateType() string { + return TypeUpdatePoll +} + +// Contains a list of updates +type Updates struct { + meta + // List of updates + Updates []Update `json:"updates"` +} + +func (entity *Updates) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub Updates + + return json.Marshal((*stub)(entity)) +} + +func (*Updates) GetClass() string { + return ClassUpdates +} + +func (*Updates) GetType() string { + return TypeUpdates +} + +// The log is written to stderr or an OS specific log +type LogStreamDefault struct { + meta +} + +func (entity *LogStreamDefault) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LogStreamDefault + + return json.Marshal((*stub)(entity)) +} + +func (*LogStreamDefault) GetClass() string { + return ClassLogStream +} + +func (*LogStreamDefault) GetType() string { + return TypeLogStreamDefault +} + +func (*LogStreamDefault) LogStreamType() string { + return TypeLogStreamDefault +} + +// The log is written to a file +type LogStreamFile struct { + meta + // Path to the file to where the internal TDLib log will be written + Path string `json:"path"` + // Maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated + MaxFileSize int64 `json:"max_file_size"` +} + +func (entity *LogStreamFile) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LogStreamFile + + return json.Marshal((*stub)(entity)) +} + +func (*LogStreamFile) GetClass() string { + return ClassLogStream +} + +func (*LogStreamFile) GetType() string { + return TypeLogStreamFile +} + +func (*LogStreamFile) LogStreamType() string { + return TypeLogStreamFile +} + +// The log is written nowhere +type LogStreamEmpty struct { + meta +} + +func (entity *LogStreamEmpty) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LogStreamEmpty + + return json.Marshal((*stub)(entity)) +} + +func (*LogStreamEmpty) GetClass() string { + return ClassLogStream +} + +func (*LogStreamEmpty) GetType() string { + return TypeLogStreamEmpty +} + +func (*LogStreamEmpty) LogStreamType() string { + return TypeLogStreamEmpty +} + +// Contains a TDLib internal log verbosity level +type LogVerbosityLevel struct { + meta + // Log verbosity level + VerbosityLevel int32 `json:"verbosity_level"` +} + +func (entity *LogVerbosityLevel) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LogVerbosityLevel + + return json.Marshal((*stub)(entity)) +} + +func (*LogVerbosityLevel) GetClass() string { + return ClassLogVerbosityLevel +} + +func (*LogVerbosityLevel) GetType() string { + return TypeLogVerbosityLevel +} + +// Contains a list of available TDLib internal log tags +type LogTags struct { + meta + // List of log tags + Tags []string `json:"tags"` +} + +func (entity *LogTags) MarshalJSON() ([]byte, error) { + entity.meta.Type = entity.GetType() + + type stub LogTags + + return json.Marshal((*stub)(entity)) +} + +func (*LogTags) GetClass() string { + return ClassLogTags +} + +func (*LogTags) GetType() string { + return TypeLogTags +} + // A simple object containing a number; for testing only type TestInt struct { meta diff --git a/client/unmarshaler.go b/client/unmarshaler.go index 6ec9403..8468a11 100755 --- a/client/unmarshaler.go +++ b/client/unmarshaler.go @@ -291,7 +291,7 @@ func UnmarshalSecretChatState(data json.RawMessage) (SecretChatState, error) { } } -func UnmarshalMessageForwardInfo(data json.RawMessage) (MessageForwardInfo, error) { +func UnmarshalMessageForwardOrigin(data json.RawMessage) (MessageForwardOrigin, error) { var meta meta err := json.Unmarshal(data, &meta) @@ -300,11 +300,14 @@ func UnmarshalMessageForwardInfo(data json.RawMessage) (MessageForwardInfo, erro } switch meta.Type { - case TypeMessageForwardedFromUser: - return UnmarshalMessageForwardedFromUser(data) + case TypeMessageForwardOriginUser: + return UnmarshalMessageForwardOriginUser(data) - case TypeMessageForwardedPost: - return UnmarshalMessageForwardedPost(data) + case TypeMessageForwardOriginHiddenUser: + return UnmarshalMessageForwardOriginHiddenUser(data) + + case TypeMessageForwardOriginChannel: + return UnmarshalMessageForwardOriginChannel(data) default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) @@ -346,6 +349,9 @@ func UnmarshalNotificationSettingsScope(data json.RawMessage) (NotificationSetti case TypeNotificationSettingsScopeGroupChats: return UnmarshalNotificationSettingsScopeGroupChats(data) + case TypeNotificationSettingsScopeChannelChats: + return UnmarshalNotificationSettingsScopeChannelChats(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -488,6 +494,24 @@ func UnmarshalRichText(data json.RawMessage) (RichText, error) { case TypeRichTextEmailAddress: return UnmarshalRichTextEmailAddress(data) + case TypeRichTextSubscript: + return UnmarshalRichTextSubscript(data) + + case TypeRichTextSuperscript: + return UnmarshalRichTextSuperscript(data) + + case TypeRichTextMarked: + return UnmarshalRichTextMarked(data) + + case TypeRichTextPhoneNumber: + return UnmarshalRichTextPhoneNumber(data) + + case TypeRichTextIcon: + return UnmarshalRichTextIcon(data) + + case TypeRichTextAnchor: + return UnmarshalRichTextAnchor(data) + case TypeRichTexts: return UnmarshalRichTexts(data) @@ -496,6 +520,52 @@ func UnmarshalRichText(data json.RawMessage) (RichText, error) { } } +func UnmarshalPageBlockHorizontalAlignment(data json.RawMessage) (PageBlockHorizontalAlignment, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePageBlockHorizontalAlignmentLeft: + return UnmarshalPageBlockHorizontalAlignmentLeft(data) + + case TypePageBlockHorizontalAlignmentCenter: + return UnmarshalPageBlockHorizontalAlignmentCenter(data) + + case TypePageBlockHorizontalAlignmentRight: + return UnmarshalPageBlockHorizontalAlignmentRight(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalPageBlockVerticalAlignment(data json.RawMessage) (PageBlockVerticalAlignment, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePageBlockVerticalAlignmentTop: + return UnmarshalPageBlockVerticalAlignmentTop(data) + + case TypePageBlockVerticalAlignmentMiddle: + return UnmarshalPageBlockVerticalAlignmentMiddle(data) + + case TypePageBlockVerticalAlignmentBottom: + return UnmarshalPageBlockVerticalAlignmentBottom(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + func UnmarshalPageBlock(data json.RawMessage) (PageBlock, error) { var meta meta @@ -520,6 +590,9 @@ func UnmarshalPageBlock(data json.RawMessage) (PageBlock, error) { case TypePageBlockSubheader: return UnmarshalPageBlockSubheader(data) + case TypePageBlockKicker: + return UnmarshalPageBlockKicker(data) + case TypePageBlockParagraph: return UnmarshalPageBlockParagraph(data) @@ -574,6 +647,18 @@ func UnmarshalPageBlock(data json.RawMessage) (PageBlock, error) { case TypePageBlockChatLink: return UnmarshalPageBlockChatLink(data) + case TypePageBlockTable: + return UnmarshalPageBlockTable(data) + + case TypePageBlockDetails: + return UnmarshalPageBlockDetails(data) + + case TypePageBlockRelatedArticles: + return UnmarshalPageBlockRelatedArticles(data) + + case TypePageBlockMap: + return UnmarshalPageBlockMap(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -900,6 +985,9 @@ func UnmarshalMessageContent(data json.RawMessage) (MessageContent, error) { case TypeMessageGame: return UnmarshalMessageGame(data) + case TypeMessagePoll: + return UnmarshalMessagePoll(data) + case TypeMessageInvoice: return UnmarshalMessageInvoice(data) @@ -1084,6 +1172,9 @@ func UnmarshalInputMessageContent(data json.RawMessage) (InputMessageContent, er case TypeInputMessageInvoice: return UnmarshalInputMessageInvoice(data) + case TypeInputMessagePoll: + return UnmarshalInputMessagePoll(data) + case TypeInputMessageForwarded: return UnmarshalInputMessageForwarded(data) @@ -1520,8 +1611,8 @@ func UnmarshalDeviceToken(data json.RawMessage) (DeviceToken, error) { } switch meta.Type { - case TypeDeviceTokenGoogleCloudMessaging: - return UnmarshalDeviceTokenGoogleCloudMessaging(data) + case TypeDeviceTokenFirebaseCloudMessaging: + return UnmarshalDeviceTokenFirebaseCloudMessaging(data) case TypeDeviceTokenApplePush: return UnmarshalDeviceTokenApplePush(data) @@ -1587,6 +1678,150 @@ func UnmarshalCheckChatUsernameResult(data json.RawMessage) (CheckChatUsernameRe } } +func UnmarshalPushMessageContent(data json.RawMessage) (PushMessageContent, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypePushMessageContentHidden: + return UnmarshalPushMessageContentHidden(data) + + case TypePushMessageContentAnimation: + return UnmarshalPushMessageContentAnimation(data) + + case TypePushMessageContentAudio: + return UnmarshalPushMessageContentAudio(data) + + case TypePushMessageContentContact: + return UnmarshalPushMessageContentContact(data) + + case TypePushMessageContentContactRegistered: + return UnmarshalPushMessageContentContactRegistered(data) + + case TypePushMessageContentDocument: + return UnmarshalPushMessageContentDocument(data) + + case TypePushMessageContentGame: + return UnmarshalPushMessageContentGame(data) + + case TypePushMessageContentGameScore: + return UnmarshalPushMessageContentGameScore(data) + + case TypePushMessageContentInvoice: + return UnmarshalPushMessageContentInvoice(data) + + case TypePushMessageContentLocation: + return UnmarshalPushMessageContentLocation(data) + + case TypePushMessageContentPhoto: + return UnmarshalPushMessageContentPhoto(data) + + case TypePushMessageContentPoll: + return UnmarshalPushMessageContentPoll(data) + + case TypePushMessageContentScreenshotTaken: + return UnmarshalPushMessageContentScreenshotTaken(data) + + case TypePushMessageContentSticker: + return UnmarshalPushMessageContentSticker(data) + + case TypePushMessageContentText: + return UnmarshalPushMessageContentText(data) + + case TypePushMessageContentVideo: + return UnmarshalPushMessageContentVideo(data) + + case TypePushMessageContentVideoNote: + return UnmarshalPushMessageContentVideoNote(data) + + case TypePushMessageContentVoiceNote: + return UnmarshalPushMessageContentVoiceNote(data) + + case TypePushMessageContentBasicGroupChatCreate: + return UnmarshalPushMessageContentBasicGroupChatCreate(data) + + case TypePushMessageContentChatAddMembers: + return UnmarshalPushMessageContentChatAddMembers(data) + + case TypePushMessageContentChatChangePhoto: + return UnmarshalPushMessageContentChatChangePhoto(data) + + case TypePushMessageContentChatChangeTitle: + return UnmarshalPushMessageContentChatChangeTitle(data) + + case TypePushMessageContentChatDeleteMember: + return UnmarshalPushMessageContentChatDeleteMember(data) + + case TypePushMessageContentChatJoinByLink: + return UnmarshalPushMessageContentChatJoinByLink(data) + + case TypePushMessageContentMessageForwards: + return UnmarshalPushMessageContentMessageForwards(data) + + case TypePushMessageContentMediaAlbum: + return UnmarshalPushMessageContentMediaAlbum(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalNotificationType(data json.RawMessage) (NotificationType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeNotificationTypeNewMessage: + return UnmarshalNotificationTypeNewMessage(data) + + case TypeNotificationTypeNewSecretChat: + return UnmarshalNotificationTypeNewSecretChat(data) + + case TypeNotificationTypeNewCall: + return UnmarshalNotificationTypeNewCall(data) + + case TypeNotificationTypeNewPushMessage: + return UnmarshalNotificationTypeNewPushMessage(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalNotificationGroupType(data json.RawMessage) (NotificationGroupType, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeNotificationGroupTypeMessages: + return UnmarshalNotificationGroupTypeMessages(data) + + case TypeNotificationGroupTypeMentions: + return UnmarshalNotificationGroupTypeMentions(data) + + case TypeNotificationGroupTypeSecretChat: + return UnmarshalNotificationGroupTypeSecretChat(data) + + case TypeNotificationGroupTypeCalls: + return UnmarshalNotificationGroupTypeCalls(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + func UnmarshalOptionValue(data json.RawMessage) (OptionValue, error) { var meta meta @@ -1613,6 +1848,38 @@ func UnmarshalOptionValue(data json.RawMessage) (OptionValue, error) { } } +func UnmarshalJsonValue(data json.RawMessage) (JsonValue, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeJsonValueNull: + return UnmarshalJsonValueNull(data) + + case TypeJsonValueBoolean: + return UnmarshalJsonValueBoolean(data) + + case TypeJsonValueNumber: + return UnmarshalJsonValueNumber(data) + + case TypeJsonValueString: + return UnmarshalJsonValueString(data) + + case TypeJsonValueArray: + return UnmarshalJsonValueArray(data) + + case TypeJsonValueObject: + return UnmarshalJsonValueObject(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + func UnmarshalUserPrivacySettingRule(data json.RawMessage) (UserPrivacySettingRule, error) { var meta meta @@ -1663,6 +1930,9 @@ func UnmarshalUserPrivacySetting(data json.RawMessage) (UserPrivacySetting, erro case TypeUserPrivacySettingAllowCalls: return UnmarshalUserPrivacySettingAllowCalls(data) + case TypeUserPrivacySettingAllowPeerToPeerCalls: + return UnmarshalUserPrivacySettingAllowPeerToPeerCalls(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -1686,6 +1956,9 @@ func UnmarshalChatReportReason(data json.RawMessage) (ChatReportReason, error) { case TypeChatReportReasonPornography: return UnmarshalChatReportReasonPornography(data) + case TypeChatReportReasonChildAbuse: + return UnmarshalChatReportReasonChildAbuse(data) + case TypeChatReportReasonCopyright: return UnmarshalChatReportReasonCopyright(data) @@ -2019,12 +2292,30 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) + case TypeUpdateChatPinnedMessage: + return UnmarshalUpdateChatPinnedMessage(data) + case TypeUpdateChatReplyMarkup: return UnmarshalUpdateChatReplyMarkup(data) case TypeUpdateChatDraftMessage: return UnmarshalUpdateChatDraftMessage(data) + case TypeUpdateChatOnlineMemberCount: + return UnmarshalUpdateChatOnlineMemberCount(data) + + case TypeUpdateNotification: + return UnmarshalUpdateNotification(data) + + case TypeUpdateNotificationGroup: + return UnmarshalUpdateNotificationGroup(data) + + case TypeUpdateActiveNotifications: + return UnmarshalUpdateActiveNotifications(data) + + case TypeUpdateHavePendingNotifications: + return UnmarshalUpdateHavePendingNotifications(data) + case TypeUpdateDeleteMessages: return UnmarshalUpdateDeleteMessages(data) @@ -2130,6 +2421,32 @@ func UnmarshalUpdate(data json.RawMessage) (Update, error) { case TypeUpdateNewCustomQuery: return UnmarshalUpdateNewCustomQuery(data) + case TypeUpdatePoll: + return UnmarshalUpdatePoll(data) + + default: + return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) + } +} + +func UnmarshalLogStream(data json.RawMessage) (LogStream, error) { + var meta meta + + err := json.Unmarshal(data, &meta) + if err != nil { + return nil, err + } + + switch meta.Type { + case TypeLogStreamDefault: + return UnmarshalLogStreamDefault(data) + + case TypeLogStreamFile: + return UnmarshalLogStreamFile(data) + + case TypeLogStreamEmpty: + return UnmarshalLogStreamEmpty(data) + default: return nil, fmt.Errorf("Error unmarshaling. Unknown type: " + meta.Type) } @@ -2439,6 +2756,14 @@ func UnmarshalMaskPosition(data json.RawMessage) (*MaskPosition, error) { return &resp, err } +func UnmarshalPollOption(data json.RawMessage) (*PollOption, error) { + var resp PollOption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAnimation(data json.RawMessage) (*Animation, error) { var resp Animation @@ -2535,6 +2860,14 @@ func UnmarshalGame(data json.RawMessage) (*Game, error) { return &resp, err } +func UnmarshalPoll(data json.RawMessage) (*Poll, error) { + var resp Poll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalProfilePhoto(data json.RawMessage) (*ProfilePhoto, error) { var resp ProfilePhoto @@ -2639,6 +2972,14 @@ func UnmarshalUserFullInfo(data json.RawMessage) (*UserFullInfo, error) { return &resp, err } +func UnmarshalUserProfilePhoto(data json.RawMessage) (*UserProfilePhoto, error) { + var resp UserProfilePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserProfilePhotos(data json.RawMessage) (*UserProfilePhotos, error) { var resp UserProfilePhotos @@ -2871,16 +3212,32 @@ func UnmarshalSecretChat(data json.RawMessage) (*SecretChat, error) { return &resp, err } -func UnmarshalMessageForwardedFromUser(data json.RawMessage) (*MessageForwardedFromUser, error) { - var resp MessageForwardedFromUser +func UnmarshalMessageForwardOriginUser(data json.RawMessage) (*MessageForwardOriginUser, error) { + var resp MessageForwardOriginUser err := json.Unmarshal(data, &resp) return &resp, err } -func UnmarshalMessageForwardedPost(data json.RawMessage) (*MessageForwardedPost, error) { - var resp MessageForwardedPost +func UnmarshalMessageForwardOriginHiddenUser(data json.RawMessage) (*MessageForwardOriginHiddenUser, error) { + var resp MessageForwardOriginHiddenUser + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageForwardOriginChannel(data json.RawMessage) (*MessageForwardOriginChannel, error) { + var resp MessageForwardOriginChannel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalMessageForwardInfo(data json.RawMessage) (*MessageForwardInfo, error) { + var resp MessageForwardInfo err := json.Unmarshal(data, &resp) @@ -2943,6 +3300,14 @@ func UnmarshalNotificationSettingsScopeGroupChats(data json.RawMessage) (*Notifi return &resp, err } +func UnmarshalNotificationSettingsScopeChannelChats(data json.RawMessage) (*NotificationSettingsScopeChannelChats, error) { + var resp NotificationSettingsScopeChannelChats + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatNotificationSettings(data json.RawMessage) (*ChatNotificationSettings, error) { var resp ChatNotificationSettings @@ -3207,6 +3572,54 @@ func UnmarshalRichTextEmailAddress(data json.RawMessage) (*RichTextEmailAddress, return &resp, err } +func UnmarshalRichTextSubscript(data json.RawMessage) (*RichTextSubscript, error) { + var resp RichTextSubscript + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextSuperscript(data json.RawMessage) (*RichTextSuperscript, error) { + var resp RichTextSuperscript + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextMarked(data json.RawMessage) (*RichTextMarked, error) { + var resp RichTextMarked + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextPhoneNumber(data json.RawMessage) (*RichTextPhoneNumber, error) { + var resp RichTextPhoneNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextIcon(data json.RawMessage) (*RichTextIcon, error) { + var resp RichTextIcon + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalRichTextAnchor(data json.RawMessage) (*RichTextAnchor, error) { + var resp RichTextAnchor + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalRichTexts(data json.RawMessage) (*RichTexts, error) { var resp RichTexts @@ -3215,6 +3628,86 @@ func UnmarshalRichTexts(data json.RawMessage) (*RichTexts, error) { return &resp, err } +func UnmarshalPageBlockCaption(data json.RawMessage) (*PageBlockCaption, error) { + var resp PageBlockCaption + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockListItem(data json.RawMessage) (*PageBlockListItem, error) { + var resp PageBlockListItem + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockHorizontalAlignmentLeft(data json.RawMessage) (*PageBlockHorizontalAlignmentLeft, error) { + var resp PageBlockHorizontalAlignmentLeft + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockHorizontalAlignmentCenter(data json.RawMessage) (*PageBlockHorizontalAlignmentCenter, error) { + var resp PageBlockHorizontalAlignmentCenter + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockHorizontalAlignmentRight(data json.RawMessage) (*PageBlockHorizontalAlignmentRight, error) { + var resp PageBlockHorizontalAlignmentRight + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockVerticalAlignmentTop(data json.RawMessage) (*PageBlockVerticalAlignmentTop, error) { + var resp PageBlockVerticalAlignmentTop + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockVerticalAlignmentMiddle(data json.RawMessage) (*PageBlockVerticalAlignmentMiddle, error) { + var resp PageBlockVerticalAlignmentMiddle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockVerticalAlignmentBottom(data json.RawMessage) (*PageBlockVerticalAlignmentBottom, error) { + var resp PageBlockVerticalAlignmentBottom + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockTableCell(data json.RawMessage) (*PageBlockTableCell, error) { + var resp PageBlockTableCell + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockRelatedArticle(data json.RawMessage) (*PageBlockRelatedArticle, error) { + var resp PageBlockRelatedArticle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPageBlockTitle(data json.RawMessage) (*PageBlockTitle, error) { var resp PageBlockTitle @@ -3255,6 +3748,14 @@ func UnmarshalPageBlockSubheader(data json.RawMessage) (*PageBlockSubheader, err return &resp, err } +func UnmarshalPageBlockKicker(data json.RawMessage) (*PageBlockKicker, error) { + var resp PageBlockKicker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalPageBlockParagraph(data json.RawMessage) (*PageBlockParagraph, error) { var resp PageBlockParagraph @@ -3399,6 +3900,38 @@ func UnmarshalPageBlockChatLink(data json.RawMessage) (*PageBlockChatLink, error return &resp, err } +func UnmarshalPageBlockTable(data json.RawMessage) (*PageBlockTable, error) { + var resp PageBlockTable + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockDetails(data json.RawMessage) (*PageBlockDetails, error) { + var resp PageBlockDetails + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockRelatedArticles(data json.RawMessage) (*PageBlockRelatedArticles, error) { + var resp PageBlockRelatedArticles + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPageBlockMap(data json.RawMessage) (*PageBlockMap, error) { + var resp PageBlockMap + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalWebPageInstantView(data json.RawMessage) (*WebPageInstantView, error) { var resp WebPageInstantView @@ -4015,6 +4548,14 @@ func UnmarshalPassportAuthorizationForm(data json.RawMessage) (*PassportAuthoriz return &resp, err } +func UnmarshalPassportElementsWithErrors(data json.RawMessage) (*PassportElementsWithErrors, error) { + var resp PassportElementsWithErrors + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalEncryptedCredentials(data json.RawMessage) (*EncryptedCredentials, error) { var resp EncryptedCredentials @@ -4231,6 +4772,14 @@ func UnmarshalMessageGame(data json.RawMessage) (*MessageGame, error) { return &resp, err } +func UnmarshalMessagePoll(data json.RawMessage) (*MessagePoll, error) { + var resp MessagePoll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalMessageInvoice(data json.RawMessage) (*MessageInvoice, error) { var resp MessageInvoice @@ -4655,6 +5204,14 @@ func UnmarshalInputMessageInvoice(data json.RawMessage) (*InputMessageInvoice, e return &resp, err } +func UnmarshalInputMessagePoll(data json.RawMessage) (*InputMessagePoll, error) { + var resp InputMessagePoll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputMessageForwarded(data json.RawMessage) (*InputMessageForwarded, error) { var resp InputMessageForwarded @@ -5119,6 +5676,14 @@ func UnmarshalImportedContacts(data json.RawMessage) (*ImportedContacts, error) return &resp, err } +func UnmarshalHttpUrl(data json.RawMessage) (*HttpUrl, error) { + var resp HttpUrl + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalInputInlineQueryResultAnimatedGif(data json.RawMessage) (*InputInlineQueryResultAnimatedGif, error) { var resp InputInlineQueryResultAnimatedGif @@ -5591,8 +6156,8 @@ func UnmarshalLocalizationTargetInfo(data json.RawMessage) (*LocalizationTargetI return &resp, err } -func UnmarshalDeviceTokenGoogleCloudMessaging(data json.RawMessage) (*DeviceTokenGoogleCloudMessaging, error) { - var resp DeviceTokenGoogleCloudMessaging +func UnmarshalDeviceTokenFirebaseCloudMessaging(data json.RawMessage) (*DeviceTokenFirebaseCloudMessaging, error) { + var resp DeviceTokenFirebaseCloudMessaging err := json.Unmarshal(data, &resp) @@ -5679,6 +6244,14 @@ func UnmarshalDeviceTokenTizenPush(data json.RawMessage) (*DeviceTokenTizenPush, return &resp, err } +func UnmarshalPushReceiverId(data json.RawMessage) (*PushReceiverId, error) { + var resp PushReceiverId + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalWallpaper(data json.RawMessage) (*Wallpaper, error) { var resp Wallpaper @@ -5743,6 +6316,294 @@ func UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(data json.RawMessag return &resp, err } +func UnmarshalPushMessageContentHidden(data json.RawMessage) (*PushMessageContentHidden, error) { + var resp PushMessageContentHidden + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentAnimation(data json.RawMessage) (*PushMessageContentAnimation, error) { + var resp PushMessageContentAnimation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentAudio(data json.RawMessage) (*PushMessageContentAudio, error) { + var resp PushMessageContentAudio + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentContact(data json.RawMessage) (*PushMessageContentContact, error) { + var resp PushMessageContentContact + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentContactRegistered(data json.RawMessage) (*PushMessageContentContactRegistered, error) { + var resp PushMessageContentContactRegistered + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentDocument(data json.RawMessage) (*PushMessageContentDocument, error) { + var resp PushMessageContentDocument + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentGame(data json.RawMessage) (*PushMessageContentGame, error) { + var resp PushMessageContentGame + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentGameScore(data json.RawMessage) (*PushMessageContentGameScore, error) { + var resp PushMessageContentGameScore + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentInvoice(data json.RawMessage) (*PushMessageContentInvoice, error) { + var resp PushMessageContentInvoice + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentLocation(data json.RawMessage) (*PushMessageContentLocation, error) { + var resp PushMessageContentLocation + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentPhoto(data json.RawMessage) (*PushMessageContentPhoto, error) { + var resp PushMessageContentPhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentPoll(data json.RawMessage) (*PushMessageContentPoll, error) { + var resp PushMessageContentPoll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentScreenshotTaken(data json.RawMessage) (*PushMessageContentScreenshotTaken, error) { + var resp PushMessageContentScreenshotTaken + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentSticker(data json.RawMessage) (*PushMessageContentSticker, error) { + var resp PushMessageContentSticker + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentText(data json.RawMessage) (*PushMessageContentText, error) { + var resp PushMessageContentText + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentVideo(data json.RawMessage) (*PushMessageContentVideo, error) { + var resp PushMessageContentVideo + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentVideoNote(data json.RawMessage) (*PushMessageContentVideoNote, error) { + var resp PushMessageContentVideoNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentVoiceNote(data json.RawMessage) (*PushMessageContentVoiceNote, error) { + var resp PushMessageContentVoiceNote + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentBasicGroupChatCreate(data json.RawMessage) (*PushMessageContentBasicGroupChatCreate, error) { + var resp PushMessageContentBasicGroupChatCreate + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChatAddMembers(data json.RawMessage) (*PushMessageContentChatAddMembers, error) { + var resp PushMessageContentChatAddMembers + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChatChangePhoto(data json.RawMessage) (*PushMessageContentChatChangePhoto, error) { + var resp PushMessageContentChatChangePhoto + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChatChangeTitle(data json.RawMessage) (*PushMessageContentChatChangeTitle, error) { + var resp PushMessageContentChatChangeTitle + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChatDeleteMember(data json.RawMessage) (*PushMessageContentChatDeleteMember, error) { + var resp PushMessageContentChatDeleteMember + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentChatJoinByLink(data json.RawMessage) (*PushMessageContentChatJoinByLink, error) { + var resp PushMessageContentChatJoinByLink + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentMessageForwards(data json.RawMessage) (*PushMessageContentMessageForwards, error) { + var resp PushMessageContentMessageForwards + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalPushMessageContentMediaAlbum(data json.RawMessage) (*PushMessageContentMediaAlbum, error) { + var resp PushMessageContentMediaAlbum + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationTypeNewMessage(data json.RawMessage) (*NotificationTypeNewMessage, error) { + var resp NotificationTypeNewMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationTypeNewSecretChat(data json.RawMessage) (*NotificationTypeNewSecretChat, error) { + var resp NotificationTypeNewSecretChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationTypeNewCall(data json.RawMessage) (*NotificationTypeNewCall, error) { + var resp NotificationTypeNewCall + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationTypeNewPushMessage(data json.RawMessage) (*NotificationTypeNewPushMessage, error) { + var resp NotificationTypeNewPushMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationGroupTypeMessages(data json.RawMessage) (*NotificationGroupTypeMessages, error) { + var resp NotificationGroupTypeMessages + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationGroupTypeMentions(data json.RawMessage) (*NotificationGroupTypeMentions, error) { + var resp NotificationGroupTypeMentions + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationGroupTypeSecretChat(data json.RawMessage) (*NotificationGroupTypeSecretChat, error) { + var resp NotificationGroupTypeSecretChat + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationGroupTypeCalls(data json.RawMessage) (*NotificationGroupTypeCalls, error) { + var resp NotificationGroupTypeCalls + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotification(data json.RawMessage) (*Notification, error) { + var resp Notification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalNotificationGroup(data json.RawMessage) (*NotificationGroup, error) { + var resp NotificationGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalOptionValueBoolean(data json.RawMessage) (*OptionValueBoolean, error) { var resp OptionValueBoolean @@ -5775,6 +6636,62 @@ func UnmarshalOptionValueString(data json.RawMessage) (*OptionValueString, error return &resp, err } +func UnmarshalJsonObjectMember(data json.RawMessage) (*JsonObjectMember, error) { + var resp JsonObjectMember + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueNull(data json.RawMessage) (*JsonValueNull, error) { + var resp JsonValueNull + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueBoolean(data json.RawMessage) (*JsonValueBoolean, error) { + var resp JsonValueBoolean + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueNumber(data json.RawMessage) (*JsonValueNumber, error) { + var resp JsonValueNumber + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueString(data json.RawMessage) (*JsonValueString, error) { + var resp JsonValueString + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueArray(data json.RawMessage) (*JsonValueArray, error) { + var resp JsonValueArray + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalJsonValueObject(data json.RawMessage) (*JsonValueObject, error) { + var resp JsonValueObject + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUserPrivacySettingRuleAllowAll(data json.RawMessage) (*UserPrivacySettingRuleAllowAll, error) { var resp UserPrivacySettingRuleAllowAll @@ -5855,6 +6772,14 @@ func UnmarshalUserPrivacySettingAllowCalls(data json.RawMessage) (*UserPrivacySe return &resp, err } +func UnmarshalUserPrivacySettingAllowPeerToPeerCalls(data json.RawMessage) (*UserPrivacySettingAllowPeerToPeerCalls, error) { + var resp UserPrivacySettingAllowPeerToPeerCalls + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalAccountTtl(data json.RawMessage) (*AccountTtl, error) { var resp AccountTtl @@ -5927,6 +6852,14 @@ func UnmarshalChatReportReasonPornography(data json.RawMessage) (*ChatReportReas return &resp, err } +func UnmarshalChatReportReasonChildAbuse(data json.RawMessage) (*ChatReportReasonChildAbuse, error) { + var resp ChatReportReasonChildAbuse + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalChatReportReasonCopyright(data json.RawMessage) (*ChatReportReasonCopyright, error) { var resp ChatReportReasonCopyright @@ -5951,6 +6884,14 @@ func UnmarshalPublicMessageLink(data json.RawMessage) (*PublicMessageLink, error return &resp, err } +func UnmarshalFilePart(data json.RawMessage) (*FilePart, error) { + var resp FilePart + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalFileTypeNone(data json.RawMessage) (*FileTypeNone, error) { var resp FileTypeNone @@ -6111,6 +7052,14 @@ func UnmarshalStorageStatisticsFast(data json.RawMessage) (*StorageStatisticsFas return &resp, err } +func UnmarshalDatabaseStatistics(data json.RawMessage) (*DatabaseStatistics, error) { + var resp DatabaseStatistics + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalNetworkTypeNone(data json.RawMessage) (*NetworkTypeNone, error) { var resp NetworkTypeNone @@ -6599,6 +7548,14 @@ func UnmarshalUpdateScopeNotificationSettings(data json.RawMessage) (*UpdateScop return &resp, err } +func UnmarshalUpdateChatPinnedMessage(data json.RawMessage) (*UpdateChatPinnedMessage, error) { + var resp UpdateChatPinnedMessage + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateChatReplyMarkup(data json.RawMessage) (*UpdateChatReplyMarkup, error) { var resp UpdateChatReplyMarkup @@ -6615,6 +7572,46 @@ func UnmarshalUpdateChatDraftMessage(data json.RawMessage) (*UpdateChatDraftMess return &resp, err } +func UnmarshalUpdateChatOnlineMemberCount(data json.RawMessage) (*UpdateChatOnlineMemberCount, error) { + var resp UpdateChatOnlineMemberCount + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNotification(data json.RawMessage) (*UpdateNotification, error) { + var resp UpdateNotification + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateNotificationGroup(data json.RawMessage) (*UpdateNotificationGroup, error) { + var resp UpdateNotificationGroup + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateActiveNotifications(data json.RawMessage) (*UpdateActiveNotifications, error) { + var resp UpdateActiveNotifications + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdateHavePendingNotifications(data json.RawMessage) (*UpdateHavePendingNotifications, error) { + var resp UpdateHavePendingNotifications + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalUpdateDeleteMessages(data json.RawMessage) (*UpdateDeleteMessages, error) { var resp UpdateDeleteMessages @@ -6895,6 +7892,62 @@ func UnmarshalUpdateNewCustomQuery(data json.RawMessage) (*UpdateNewCustomQuery, return &resp, err } +func UnmarshalUpdatePoll(data json.RawMessage) (*UpdatePoll, error) { + var resp UpdatePoll + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalUpdates(data json.RawMessage) (*Updates, error) { + var resp Updates + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLogStreamDefault(data json.RawMessage) (*LogStreamDefault, error) { + var resp LogStreamDefault + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLogStreamFile(data json.RawMessage) (*LogStreamFile, error) { + var resp LogStreamFile + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLogStreamEmpty(data json.RawMessage) (*LogStreamEmpty, error) { + var resp LogStreamEmpty + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLogVerbosityLevel(data json.RawMessage) (*LogVerbosityLevel, error) { + var resp LogVerbosityLevel + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + +func UnmarshalLogTags(data json.RawMessage) (*LogTags, error) { + var resp LogTags + + err := json.Unmarshal(data, &resp) + + return &resp, err +} + func UnmarshalTestInt(data json.RawMessage) (*TestInt, error) { var resp TestInt @@ -7074,6 +8127,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMaskPosition: return UnmarshalMaskPosition(data) + case TypePollOption: + return UnmarshalPollOption(data) + case TypeAnimation: return UnmarshalAnimation(data) @@ -7110,6 +8166,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeGame: return UnmarshalGame(data) + case TypePoll: + return UnmarshalPoll(data) + case TypeProfilePhoto: return UnmarshalProfilePhoto(data) @@ -7149,6 +8208,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserFullInfo: return UnmarshalUserFullInfo(data) + case TypeUserProfilePhoto: + return UnmarshalUserProfilePhoto(data) + case TypeUserProfilePhotos: return UnmarshalUserProfilePhotos(data) @@ -7236,11 +8298,17 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeSecretChat: return UnmarshalSecretChat(data) - case TypeMessageForwardedFromUser: - return UnmarshalMessageForwardedFromUser(data) + case TypeMessageForwardOriginUser: + return UnmarshalMessageForwardOriginUser(data) - case TypeMessageForwardedPost: - return UnmarshalMessageForwardedPost(data) + case TypeMessageForwardOriginHiddenUser: + return UnmarshalMessageForwardOriginHiddenUser(data) + + case TypeMessageForwardOriginChannel: + return UnmarshalMessageForwardOriginChannel(data) + + case TypeMessageForwardInfo: + return UnmarshalMessageForwardInfo(data) case TypeMessageSendingStatePending: return UnmarshalMessageSendingStatePending(data) @@ -7263,6 +8331,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeNotificationSettingsScopeGroupChats: return UnmarshalNotificationSettingsScopeGroupChats(data) + case TypeNotificationSettingsScopeChannelChats: + return UnmarshalNotificationSettingsScopeChannelChats(data) + case TypeChatNotificationSettings: return UnmarshalChatNotificationSettings(data) @@ -7362,9 +8433,57 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeRichTextEmailAddress: return UnmarshalRichTextEmailAddress(data) + case TypeRichTextSubscript: + return UnmarshalRichTextSubscript(data) + + case TypeRichTextSuperscript: + return UnmarshalRichTextSuperscript(data) + + case TypeRichTextMarked: + return UnmarshalRichTextMarked(data) + + case TypeRichTextPhoneNumber: + return UnmarshalRichTextPhoneNumber(data) + + case TypeRichTextIcon: + return UnmarshalRichTextIcon(data) + + case TypeRichTextAnchor: + return UnmarshalRichTextAnchor(data) + case TypeRichTexts: return UnmarshalRichTexts(data) + case TypePageBlockCaption: + return UnmarshalPageBlockCaption(data) + + case TypePageBlockListItem: + return UnmarshalPageBlockListItem(data) + + case TypePageBlockHorizontalAlignmentLeft: + return UnmarshalPageBlockHorizontalAlignmentLeft(data) + + case TypePageBlockHorizontalAlignmentCenter: + return UnmarshalPageBlockHorizontalAlignmentCenter(data) + + case TypePageBlockHorizontalAlignmentRight: + return UnmarshalPageBlockHorizontalAlignmentRight(data) + + case TypePageBlockVerticalAlignmentTop: + return UnmarshalPageBlockVerticalAlignmentTop(data) + + case TypePageBlockVerticalAlignmentMiddle: + return UnmarshalPageBlockVerticalAlignmentMiddle(data) + + case TypePageBlockVerticalAlignmentBottom: + return UnmarshalPageBlockVerticalAlignmentBottom(data) + + case TypePageBlockTableCell: + return UnmarshalPageBlockTableCell(data) + + case TypePageBlockRelatedArticle: + return UnmarshalPageBlockRelatedArticle(data) + case TypePageBlockTitle: return UnmarshalPageBlockTitle(data) @@ -7380,6 +8499,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePageBlockSubheader: return UnmarshalPageBlockSubheader(data) + case TypePageBlockKicker: + return UnmarshalPageBlockKicker(data) + case TypePageBlockParagraph: return UnmarshalPageBlockParagraph(data) @@ -7434,6 +8556,18 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePageBlockChatLink: return UnmarshalPageBlockChatLink(data) + case TypePageBlockTable: + return UnmarshalPageBlockTable(data) + + case TypePageBlockDetails: + return UnmarshalPageBlockDetails(data) + + case TypePageBlockRelatedArticles: + return UnmarshalPageBlockRelatedArticles(data) + + case TypePageBlockMap: + return UnmarshalPageBlockMap(data) + case TypeWebPageInstantView: return UnmarshalWebPageInstantView(data) @@ -7665,6 +8799,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePassportAuthorizationForm: return UnmarshalPassportAuthorizationForm(data) + case TypePassportElementsWithErrors: + return UnmarshalPassportElementsWithErrors(data) + case TypeEncryptedCredentials: return UnmarshalEncryptedCredentials(data) @@ -7746,6 +8883,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeMessageGame: return UnmarshalMessageGame(data) + case TypeMessagePoll: + return UnmarshalMessagePoll(data) + case TypeMessageInvoice: return UnmarshalMessageInvoice(data) @@ -7905,6 +9045,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeInputMessageInvoice: return UnmarshalInputMessageInvoice(data) + case TypeInputMessagePoll: + return UnmarshalInputMessagePoll(data) + case TypeInputMessageForwarded: return UnmarshalInputMessageForwarded(data) @@ -8079,6 +9222,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeImportedContacts: return UnmarshalImportedContacts(data) + case TypeHttpUrl: + return UnmarshalHttpUrl(data) + case TypeInputInlineQueryResultAnimatedGif: return UnmarshalInputInlineQueryResultAnimatedGif(data) @@ -8256,8 +9402,8 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeLocalizationTargetInfo: return UnmarshalLocalizationTargetInfo(data) - case TypeDeviceTokenGoogleCloudMessaging: - return UnmarshalDeviceTokenGoogleCloudMessaging(data) + case TypeDeviceTokenFirebaseCloudMessaging: + return UnmarshalDeviceTokenFirebaseCloudMessaging(data) case TypeDeviceTokenApplePush: return UnmarshalDeviceTokenApplePush(data) @@ -8289,6 +9435,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeDeviceTokenTizenPush: return UnmarshalDeviceTokenTizenPush(data) + case TypePushReceiverId: + return UnmarshalPushReceiverId(data) + case TypeWallpaper: return UnmarshalWallpaper(data) @@ -8313,6 +9462,114 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeCheckChatUsernameResultPublicGroupsUnavailable: return UnmarshalCheckChatUsernameResultPublicGroupsUnavailable(data) + case TypePushMessageContentHidden: + return UnmarshalPushMessageContentHidden(data) + + case TypePushMessageContentAnimation: + return UnmarshalPushMessageContentAnimation(data) + + case TypePushMessageContentAudio: + return UnmarshalPushMessageContentAudio(data) + + case TypePushMessageContentContact: + return UnmarshalPushMessageContentContact(data) + + case TypePushMessageContentContactRegistered: + return UnmarshalPushMessageContentContactRegistered(data) + + case TypePushMessageContentDocument: + return UnmarshalPushMessageContentDocument(data) + + case TypePushMessageContentGame: + return UnmarshalPushMessageContentGame(data) + + case TypePushMessageContentGameScore: + return UnmarshalPushMessageContentGameScore(data) + + case TypePushMessageContentInvoice: + return UnmarshalPushMessageContentInvoice(data) + + case TypePushMessageContentLocation: + return UnmarshalPushMessageContentLocation(data) + + case TypePushMessageContentPhoto: + return UnmarshalPushMessageContentPhoto(data) + + case TypePushMessageContentPoll: + return UnmarshalPushMessageContentPoll(data) + + case TypePushMessageContentScreenshotTaken: + return UnmarshalPushMessageContentScreenshotTaken(data) + + case TypePushMessageContentSticker: + return UnmarshalPushMessageContentSticker(data) + + case TypePushMessageContentText: + return UnmarshalPushMessageContentText(data) + + case TypePushMessageContentVideo: + return UnmarshalPushMessageContentVideo(data) + + case TypePushMessageContentVideoNote: + return UnmarshalPushMessageContentVideoNote(data) + + case TypePushMessageContentVoiceNote: + return UnmarshalPushMessageContentVoiceNote(data) + + case TypePushMessageContentBasicGroupChatCreate: + return UnmarshalPushMessageContentBasicGroupChatCreate(data) + + case TypePushMessageContentChatAddMembers: + return UnmarshalPushMessageContentChatAddMembers(data) + + case TypePushMessageContentChatChangePhoto: + return UnmarshalPushMessageContentChatChangePhoto(data) + + case TypePushMessageContentChatChangeTitle: + return UnmarshalPushMessageContentChatChangeTitle(data) + + case TypePushMessageContentChatDeleteMember: + return UnmarshalPushMessageContentChatDeleteMember(data) + + case TypePushMessageContentChatJoinByLink: + return UnmarshalPushMessageContentChatJoinByLink(data) + + case TypePushMessageContentMessageForwards: + return UnmarshalPushMessageContentMessageForwards(data) + + case TypePushMessageContentMediaAlbum: + return UnmarshalPushMessageContentMediaAlbum(data) + + case TypeNotificationTypeNewMessage: + return UnmarshalNotificationTypeNewMessage(data) + + case TypeNotificationTypeNewSecretChat: + return UnmarshalNotificationTypeNewSecretChat(data) + + case TypeNotificationTypeNewCall: + return UnmarshalNotificationTypeNewCall(data) + + case TypeNotificationTypeNewPushMessage: + return UnmarshalNotificationTypeNewPushMessage(data) + + case TypeNotificationGroupTypeMessages: + return UnmarshalNotificationGroupTypeMessages(data) + + case TypeNotificationGroupTypeMentions: + return UnmarshalNotificationGroupTypeMentions(data) + + case TypeNotificationGroupTypeSecretChat: + return UnmarshalNotificationGroupTypeSecretChat(data) + + case TypeNotificationGroupTypeCalls: + return UnmarshalNotificationGroupTypeCalls(data) + + case TypeNotification: + return UnmarshalNotification(data) + + case TypeNotificationGroup: + return UnmarshalNotificationGroup(data) + case TypeOptionValueBoolean: return UnmarshalOptionValueBoolean(data) @@ -8325,6 +9582,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeOptionValueString: return UnmarshalOptionValueString(data) + case TypeJsonObjectMember: + return UnmarshalJsonObjectMember(data) + + case TypeJsonValueNull: + return UnmarshalJsonValueNull(data) + + case TypeJsonValueBoolean: + return UnmarshalJsonValueBoolean(data) + + case TypeJsonValueNumber: + return UnmarshalJsonValueNumber(data) + + case TypeJsonValueString: + return UnmarshalJsonValueString(data) + + case TypeJsonValueArray: + return UnmarshalJsonValueArray(data) + + case TypeJsonValueObject: + return UnmarshalJsonValueObject(data) + case TypeUserPrivacySettingRuleAllowAll: return UnmarshalUserPrivacySettingRuleAllowAll(data) @@ -8355,6 +9633,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUserPrivacySettingAllowCalls: return UnmarshalUserPrivacySettingAllowCalls(data) + case TypeUserPrivacySettingAllowPeerToPeerCalls: + return UnmarshalUserPrivacySettingAllowPeerToPeerCalls(data) + case TypeAccountTtl: return UnmarshalAccountTtl(data) @@ -8382,6 +9663,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeChatReportReasonPornography: return UnmarshalChatReportReasonPornography(data) + case TypeChatReportReasonChildAbuse: + return UnmarshalChatReportReasonChildAbuse(data) + case TypeChatReportReasonCopyright: return UnmarshalChatReportReasonCopyright(data) @@ -8391,6 +9675,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypePublicMessageLink: return UnmarshalPublicMessageLink(data) + case TypeFilePart: + return UnmarshalFilePart(data) + case TypeFileTypeNone: return UnmarshalFileTypeNone(data) @@ -8451,6 +9738,9 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeStorageStatisticsFast: return UnmarshalStorageStatisticsFast(data) + case TypeDatabaseStatistics: + return UnmarshalDatabaseStatistics(data) + case TypeNetworkTypeNone: return UnmarshalNetworkTypeNone(data) @@ -8634,12 +9924,30 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateScopeNotificationSettings: return UnmarshalUpdateScopeNotificationSettings(data) + case TypeUpdateChatPinnedMessage: + return UnmarshalUpdateChatPinnedMessage(data) + case TypeUpdateChatReplyMarkup: return UnmarshalUpdateChatReplyMarkup(data) case TypeUpdateChatDraftMessage: return UnmarshalUpdateChatDraftMessage(data) + case TypeUpdateChatOnlineMemberCount: + return UnmarshalUpdateChatOnlineMemberCount(data) + + case TypeUpdateNotification: + return UnmarshalUpdateNotification(data) + + case TypeUpdateNotificationGroup: + return UnmarshalUpdateNotificationGroup(data) + + case TypeUpdateActiveNotifications: + return UnmarshalUpdateActiveNotifications(data) + + case TypeUpdateHavePendingNotifications: + return UnmarshalUpdateHavePendingNotifications(data) + case TypeUpdateDeleteMessages: return UnmarshalUpdateDeleteMessages(data) @@ -8745,6 +10053,27 @@ func UnmarshalType(data json.RawMessage) (Type, error) { case TypeUpdateNewCustomQuery: return UnmarshalUpdateNewCustomQuery(data) + case TypeUpdatePoll: + return UnmarshalUpdatePoll(data) + + case TypeUpdates: + return UnmarshalUpdates(data) + + case TypeLogStreamDefault: + return UnmarshalLogStreamDefault(data) + + case TypeLogStreamFile: + return UnmarshalLogStreamFile(data) + + case TypeLogStreamEmpty: + return UnmarshalLogStreamEmpty(data) + + case TypeLogVerbosityLevel: + return UnmarshalLogVerbosityLevel(data) + + case TypeLogTags: + return UnmarshalLogTags(data) + case TypeTestInt: return UnmarshalTestInt(data) diff --git a/data/td_api.json b/data/td_api.json index c4e453c..b7346e4 100755 --- a/data/td_api.json +++ b/data/td_api.json @@ -378,7 +378,7 @@ { "name": "password_hint", "type": "string", - "description": "Hint for the password; can be empty" + "description": "Hint for the password; may be empty" }, { "name": "has_recovery_email_address", @@ -424,27 +424,27 @@ { "name": "has_password", "type": "Bool", - "description": "True if a 2-step verification password is set" + "description": "True, if a 2-step verification password is set" }, { "name": "password_hint", "type": "string", - "description": "Hint for the password; can be empty" + "description": "Hint for the password; may be empty" }, { "name": "has_recovery_email_address", "type": "Bool", - "description": "True if a recovery email is set" + "description": "True, if a recovery email is set" }, { "name": "has_passport_data", "type": "Bool", - "description": "True if some Telegram Passport elements were saved" + "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 the confirmation email was sent" + "name": "recovery_email_address_code_info", + "type": "emailAddressAuthenticationCodeInfo", + "description": "Information about the recovery email address to which the confirmation email was sent; may be null" } ] }, @@ -507,10 +507,15 @@ "type": "Bool", "description": "True, if the local copy is fully available" }, + { + "name": "download_offset", + "type": "int32", + "description": "Download will be started from this offset. downloaded_prefix_size is calculated from this offset" + }, { "name": "downloaded_prefix_size", "type": "int32", - "description": "If is_downloading_completed is false, then only some prefix of the file is ready to be read. downloaded_prefix_size is the size of that prefix" + "description": "If is_downloading_completed is false, then only some prefix of the file starting from download_offset is ready to be read. downloaded_prefix_size is the size of that prefix" }, { "name": "downloaded_size", @@ -627,7 +632,7 @@ { "name": "conversion", "type": "string", - "description": "String specifying the conversion applied to the original file; should be persistent across application restarts" + "description": "String specifying the conversion applied to the original file; should be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage" }, { "name": "expected_size", @@ -714,6 +719,38 @@ } ] }, + { + "name": "pollOption", + "description": "Describes one answer option of a poll", + "class": "PollOption", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Option text, 1-100 characters" + }, + { + "name": "voter_count", + "type": "int32", + "description": "Number of voters for this option, available only for closed or voted polls" + }, + { + "name": "vote_percentage", + "type": "int32", + "description": "The percentage of votes for this option, 0-100" + }, + { + "name": "is_chosen", + "type": "Bool", + "description": "True, if the option was chosen by the user" + }, + { + "name": "is_being_chosen", + "type": "Bool", + "description": "True, if the option is being chosen by a pending setPollAnswer request" + } + ] + }, { "name": "animation", "description": "Describes an animation file. The animation must be encoded in GIF or MPEG4 format", @@ -830,11 +867,6 @@ "description": "Describes a photo", "class": "Photo", "properties": [ - { - "name": "id", - "type": "int64", - "description": "Photo identifier; 0 for deleted photos" - }, { "name": "has_stickers", "type": "Bool", @@ -1128,6 +1160,38 @@ } ] }, + { + "name": "poll", + "description": "Describes a poll", + "class": "Poll", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Unique poll identifier" + }, + { + "name": "question", + "type": "string", + "description": "Poll question, 1-255 characters" + }, + { + "name": "options", + "type": "vector\u003cpollOption\u003e", + "description": "List of poll answer options" + }, + { + "name": "total_voter_count", + "type": "int32", + "description": "Total number of voters, participating in the poll" + }, + { + "name": "is_closed", + "type": "Bool", + "description": "True, if the poll is closed" + } + ] + }, { "name": "profilePhoto", "description": "Describes a user profile photo", @@ -1175,13 +1239,13 @@ }, { "name": "linkStateKnowsPhoneNumber", - "description": "The phone number of user A is known but that number has not been saved to the contacts list of user B", + "description": "The phone number of user A is known but that number has not been saved to the contact list of user B", "class": "LinkState", "properties": [] }, { "name": "linkStateIsContact", - "description": "The phone number of user A has been saved to the contacts list of user B", + "description": "The phone number of user A has been saved to the contact list of user B", "class": "LinkState", "properties": [] }, @@ -1324,6 +1388,11 @@ "type": "Bool", "description": "True, if the user is verified" }, + { + "name": "is_support", + "type": "Bool", + "description": "True, if the user is Telegram support account" + }, { "name": "restriction_reason", "type": "string", @@ -1388,6 +1457,28 @@ } ] }, + { + "name": "userProfilePhoto", + "description": "Contains full information about a user profile photo", + "class": "UserProfilePhoto", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "Unique user profile photo identifier" + }, + { + "name": "added_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the photo has been added" + }, + { + "name": "sizes", + "type": "vector\u003cphotoSize\u003e", + "description": "Available variants of the user photo, in different sizes" + } + ] + }, { "name": "userProfilePhotos", "description": "Contains part of the list of user photos", @@ -1400,7 +1491,7 @@ }, { "name": "photos", - "type": "vector\u003cphoto\u003e", + "type": "vector\u003cuserProfilePhoto\u003e", "description": "A list of photos" } ] @@ -1477,7 +1568,7 @@ { "name": "can_pin_messages", "type": "Bool", - "description": "True, if the administrator can pin messages; applicable to supergroups only" + "description": "True, if the administrator can pin messages; applicable to groups only" }, { "name": "can_promote_members", @@ -1841,6 +1932,11 @@ "type": "Bool", "description": "True, if the supergroup sticker set can be changed" }, + { + "name": "can_view_statistics", + "type": "Bool", + "description": "True, if the channel statistics is available through getChatStatisticsUrl" + }, { "name": "is_all_history_available", "type": "Bool", @@ -1856,11 +1952,6 @@ "type": "string", "description": "Invite link for this chat" }, - { - "name": "pinned_message_id", - "type": "int53", - "description": "Identifier of the pinned message in the chat; 0 if none" - }, { "name": "upgraded_from_basic_group_id", "type": "int32", @@ -1934,46 +2025,60 @@ ] }, { - "name": "messageForwardedFromUser", + "name": "messageForwardOriginUser", "description": "The message was originally written by a known user", - "class": "MessageForwardInfo", + "class": "MessageForwardOrigin", "properties": [ { "name": "sender_user_id", "type": "int32", - "description": "Identifier of the user that originally sent this message" - }, - { - "name": "date", - "type": "int32", - "description": "Point in time (Unix timestamp) when the message was originally sent" - }, - { - "name": "forwarded_from_chat_id", - "type": "int53", - "description": "For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown" - }, - { - "name": "forwarded_from_message_id", - "type": "int53", - "description": "For messages forwarded to the chat with the current user (saved messages) the identifier of the original message from which the new message was forwarded; 0 if unknown" + "description": "Identifier of the user that originally sent the message" } ] }, { - "name": "messageForwardedPost", + "name": "messageForwardOriginHiddenUser", + "description": "The message was originally written by a user, which is hidden by his privacy settings", + "class": "MessageForwardOrigin", + "properties": [ + { + "name": "sender_name", + "type": "string", + "description": "Name of the sender" + } + ] + }, + { + "name": "messageForwardOriginChannel", "description": "The message was originally a post in a channel", - "class": "MessageForwardInfo", + "class": "MessageForwardOrigin", "properties": [ { "name": "chat_id", "type": "int53", - "description": "Identifier of the chat from which the message was forwarded" + "description": "Identifier of the chat from which the message was originally forwarded" + }, + { + "name": "message_id", + "type": "int53", + "description": "Message identifier of the original message; 0 if unknown" }, { "name": "author_signature", "type": "string", - "description": "Post author signature" + "description": "Original post author signature" + } + ] + }, + { + "name": "messageForwardInfo", + "description": "Contains information about a forwarded message", + "class": "MessageForwardInfo", + "properties": [ + { + "name": "origin", + "type": "MessageForwardOrigin", + "description": "Origin of a forwarded message" }, { "name": "date", @@ -1981,19 +2086,14 @@ "description": "Point in time (Unix timestamp) when the message was originally sent" }, { - "name": "message_id", + "name": "from_chat_id", "type": "int53", - "description": "Message identifier of the original message from which the new message was forwarded; 0 if unknown" + "description": "For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded last time; 0 if unknown" }, { - "name": "forwarded_from_chat_id", + "name": "from_message_id", "type": "int53", - "description": "For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown" - }, - { - "name": "forwarded_from_message_id", - "type": "int53", - "description": "For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded; 0 if unknown" + "description": "For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded last time; 0 if unknown" } ] }, @@ -2042,7 +2142,7 @@ { "name": "can_be_edited", "type": "Bool", - "description": "True, if the message can be edited" + "description": "True, if the message can be edited. For live location and poll messages this fields shows, whether editMessageLiveLocation or stopPoll can be used with this message by the client" }, { "name": "can_be_forwarded", @@ -2081,7 +2181,7 @@ }, { "name": "forward_info", - "type": "MessageForwardInfo", + "type": "messageForwardInfo", "description": "Information about the initial message sender; may be null" }, { @@ -2173,7 +2273,13 @@ }, { "name": "notificationSettingsScopeGroupChats", - "description": "Notification settings applied to all basic groups, supergroups and channels when the corresponding chat setting has a default value", + "description": "Notification settings applied to all basic groups and supergroups when the corresponding chat setting has a default value", + "class": "NotificationSettingsScope", + "properties": [] + }, + { + "name": "notificationSettingsScopeChannelChats", + "description": "Notification settings applied to all channels when the corresponding chat setting has a default value", "class": "NotificationSettingsScope", "properties": [] }, @@ -2211,6 +2317,26 @@ "name": "show_preview", "type": "Bool", "description": "True, if message content should be displayed in notifications" + }, + { + "name": "use_default_disable_pinned_message_notifications", + "type": "Bool", + "description": "If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat is used instead" + }, + { + "name": "disable_pinned_message_notifications", + "type": "Bool", + "description": "If true, notifications for incoming pinned messages will be created as for an ordinary unread message" + }, + { + "name": "use_default_disable_mention_notifications", + "type": "Bool", + "description": "If true, disable_mention_notifications is ignored and the value for the relevant type of chat is used instead" + }, + { + "name": "disable_mention_notifications", + "type": "Bool", + "description": "If true, notifications for messages with mentions will be created as for an ordinary unread message" } ] }, @@ -2233,6 +2359,16 @@ "name": "show_preview", "type": "Bool", "description": "True, if message content should be displayed in notifications" + }, + { + "name": "disable_pinned_message_notifications", + "type": "Bool", + "description": "True, if notifications for incoming pinned messages will be created as for an ordinary unread message" + }, + { + "name": "disable_mention_notifications", + "type": "Bool", + "description": "True, if notifications for messages with mentions will be created as for an ordinary unread message" } ] }, @@ -2361,6 +2497,16 @@ "type": "Bool", "description": "True, if the chat is sponsored by the user's MTProxy server" }, + { + "name": "can_be_deleted_only_for_self", + "type": "Bool", + "description": "True, if the chat messages can be deleted only for the current user while other users will continue to see the messages" + }, + { + "name": "can_be_deleted_for_all_users", + "type": "Bool", + "description": "True, if the chat messages can be deleted for all users" + }, { "name": "can_be_reported", "type": "Bool", @@ -2396,6 +2542,11 @@ "type": "chatNotificationSettings", "description": "Notification settings for this chat" }, + { + "name": "pinned_message_id", + "type": "int53", + "description": "Identifier of the pinned message in the chat; 0 if none" + }, { "name": "reply_markup_message_id", "type": "int53", @@ -2753,6 +2904,98 @@ } ] }, + { + "name": "richTextSubscript", + "description": "A subscript rich text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + } + ] + }, + { + "name": "richTextSuperscript", + "description": "A superscript rich text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + } + ] + }, + { + "name": "richTextMarked", + "description": "A marked rich text", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + } + ] + }, + { + "name": "richTextPhoneNumber", + "description": "A rich text phone number", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + }, + { + "name": "phone_number", + "type": "string", + "description": "Phone number" + } + ] + }, + { + "name": "richTextIcon", + "description": "A small image inside the text", + "class": "RichText", + "properties": [ + { + "name": "document", + "type": "document", + "description": "The image represented as a document. The image can be in GIF, JPEG or PNG format" + }, + { + "name": "width", + "type": "int32", + "description": "Width of a bounding box in which the image should be shown, 0 if unknown" + }, + { + "name": "height", + "type": "int32", + "description": "Height of a bounding box in which the image should be shown, 0 if unknown" + } + ] + }, + { + "name": "richTextAnchor", + "description": "A rich text anchor", + "class": "RichText", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Text" + }, + { + "name": "name", + "type": "string", + "description": "Anchor name" + } + ] + }, { "name": "richTexts", "description": "A concatenation of rich texts", @@ -2765,6 +3008,150 @@ } ] }, + { + "name": "pageBlockCaption", + "description": "Contains a caption of an instant view web page block, consisting of a text and a trailing credit", + "class": "PageBlockCaption", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Content of the caption" + }, + { + "name": "credit", + "type": "RichText", + "description": "Block credit (like HTML tag \u003ccite\u003e)" + } + ] + }, + { + "name": "pageBlockListItem", + "description": "Describes an item of a list page block", + "class": "PageBlockListItem", + "properties": [ + { + "name": "label", + "type": "string", + "description": "Item label" + }, + { + "name": "page_blocks", + "type": "vector\u003cPageBlock\u003e", + "description": "Item blocks" + } + ] + }, + { + "name": "pageBlockHorizontalAlignmentLeft", + "description": "The content should be left-aligned", + "class": "PageBlockHorizontalAlignment", + "properties": [] + }, + { + "name": "pageBlockHorizontalAlignmentCenter", + "description": "The content should be center-aligned", + "class": "PageBlockHorizontalAlignment", + "properties": [] + }, + { + "name": "pageBlockHorizontalAlignmentRight", + "description": "The content should be right-aligned", + "class": "PageBlockHorizontalAlignment", + "properties": [] + }, + { + "name": "pageBlockVerticalAlignmentTop", + "description": "The content should be top-aligned", + "class": "PageBlockVerticalAlignment", + "properties": [] + }, + { + "name": "pageBlockVerticalAlignmentMiddle", + "description": "The content should be middle-aligned", + "class": "PageBlockVerticalAlignment", + "properties": [] + }, + { + "name": "pageBlockVerticalAlignmentBottom", + "description": "The content should be bottom-aligned", + "class": "PageBlockVerticalAlignment", + "properties": [] + }, + { + "name": "pageBlockTableCell", + "description": "Represents a cell of a table", + "class": "PageBlockTableCell", + "properties": [ + { + "name": "text", + "type": "RichText", + "description": "Cell text" + }, + { + "name": "is_header", + "type": "Bool", + "description": "True, if it is a header cell" + }, + { + "name": "colspan", + "type": "int32", + "description": "The number of columns the cell should span" + }, + { + "name": "rowspan", + "type": "int32", + "description": "The number of rows the cell should span" + }, + { + "name": "align", + "type": "PageBlockHorizontalAlignment", + "description": "Horizontal cell content alignment" + }, + { + "name": "valign", + "type": "PageBlockVerticalAlignment", + "description": "Vertical cell content alignment" + } + ] + }, + { + "name": "pageBlockRelatedArticle", + "description": "Contains information about a related article", + "class": "PageBlockRelatedArticle", + "properties": [ + { + "name": "url", + "type": "string", + "description": "Related article URL" + }, + { + "name": "title", + "type": "string", + "description": "Article title; may be empty" + }, + { + "name": "description", + "type": "string", + "description": "Article description; may be empty" + }, + { + "name": "photo", + "type": "photo", + "description": "Article photo; may be null" + }, + { + "name": "author", + "type": "string", + "description": "Article author; may be empty" + }, + { + "name": "publish_date", + "type": "int32", + "description": "Point in time (Unix timestamp) when the article was published; 0 if unknown" + } + ] + }, { "name": "pageBlockTitle", "description": "The title of a page", @@ -2830,6 +3217,18 @@ } ] }, + { + "name": "pageBlockKicker", + "description": "A kicker", + "class": "PageBlock", + "properties": [ + { + "name": "kicker", + "type": "RichText", + "description": "Kicker" + } + ] + }, { "name": "pageBlockParagraph", "description": "A text paragraph", @@ -2891,18 +3290,13 @@ }, { "name": "pageBlockList", - "description": "A list of texts", + "description": "A list of data blocks", "class": "PageBlock", "properties": [ { "name": "items", - "type": "vector\u003cRichText\u003e", - "description": "Texts" - }, - { - "name": "is_ordered", - "type": "Bool", - "description": "True, if the items should be marked with numbers" + "type": "vector\u003cpageBlockListItem\u003e", + "description": "The items of the list" } ] }, @@ -2917,9 +3311,9 @@ "description": "Quote text" }, { - "name": "caption", + "name": "credit", "type": "RichText", - "description": "Quote caption" + "description": "Quote credit" } ] }, @@ -2934,9 +3328,9 @@ "description": "Quote text" }, { - "name": "caption", + "name": "credit", "type": "RichText", - "description": "Quote caption" + "description": "Quote credit" } ] }, @@ -2952,7 +3346,7 @@ }, { "name": "caption", - "type": "RichText", + "type": "pageBlockCaption", "description": "Animation caption" }, { @@ -2974,7 +3368,7 @@ }, { "name": "caption", - "type": "RichText", + "type": "pageBlockCaption", "description": "Audio file caption" } ] @@ -2991,8 +3385,13 @@ }, { "name": "caption", - "type": "RichText", + "type": "pageBlockCaption", "description": "Photo caption" + }, + { + "name": "url", + "type": "string", + "description": "URL that needs to be opened when the photo is clicked" } ] }, @@ -3008,7 +3407,7 @@ }, { "name": "caption", - "type": "RichText", + "type": "pageBlockCaption", "description": "Video caption" }, { @@ -3058,16 +3457,16 @@ { "name": "width", "type": "int32", - "description": "Block width" + "description": "Block width, 0 if unknown" }, { "name": "height", "type": "int32", - "description": "Block height" + "description": "Block height, 0 if unknown" }, { "name": "caption", - "type": "RichText", + "type": "pageBlockCaption", "description": "Block caption" }, { @@ -3114,7 +3513,7 @@ }, { "name": "caption", - "type": "RichText", + "type": "pageBlockCaption", "description": "Post caption" } ] @@ -3131,7 +3530,7 @@ }, { "name": "caption", - "type": "RichText", + "type": "pageBlockCaption", "description": "Block caption" } ] @@ -3148,7 +3547,7 @@ }, { "name": "caption", - "type": "RichText", + "type": "pageBlockCaption", "description": "Block caption" } ] @@ -3175,6 +3574,104 @@ } ] }, + { + "name": "pageBlockTable", + "description": "A table", + "class": "PageBlock", + "properties": [ + { + "name": "caption", + "type": "RichText", + "description": "Table caption" + }, + { + "name": "cells", + "type": "vector\u003cvector\u003cpageBlockTableCell\u003e\u003e", + "description": "Table cells" + }, + { + "name": "is_bordered", + "type": "Bool", + "description": "True, if the table is bordered" + }, + { + "name": "is_striped", + "type": "Bool", + "description": "True, if the table is striped" + } + ] + }, + { + "name": "pageBlockDetails", + "description": "A collapsible block", + "class": "PageBlock", + "properties": [ + { + "name": "header", + "type": "RichText", + "description": "Always visible heading for the block" + }, + { + "name": "page_blocks", + "type": "vector\u003cPageBlock\u003e", + "description": "Block contents" + }, + { + "name": "is_open", + "type": "Bool", + "description": "True, if the block is open by default" + } + ] + }, + { + "name": "pageBlockRelatedArticles", + "description": "Related articles", + "class": "PageBlock", + "properties": [ + { + "name": "header", + "type": "RichText", + "description": "Block header" + }, + { + "name": "articles", + "type": "vector\u003cpageBlockRelatedArticle\u003e", + "description": "List of related articles" + } + ] + }, + { + "name": "pageBlockMap", + "description": "A map", + "class": "PageBlock", + "properties": [ + { + "name": "location", + "type": "location", + "description": "Location of the map center" + }, + { + "name": "zoom", + "type": "int32", + "description": "Map zoom level" + }, + { + "name": "width", + "type": "int32", + "description": "Map width" + }, + { + "name": "height", + "type": "int32", + "description": "Map height" + }, + { + "name": "caption", + "type": "pageBlockCaption", + "description": "Block caption" + } + ] + }, { "name": "webPageInstantView", "description": "Describes an instant view page for a web page", @@ -3185,6 +3682,21 @@ "type": "vector\u003cPageBlock\u003e", "description": "Content of the web page" }, + { + "name": "version", + "type": "int32", + "description": "Version of the instant view, currently can be 1 or 2" + }, + { + "name": "url", + "type": "string", + "description": "Instant view URL; may be different from WebPage.url and must be used for the correct anchors handling" + }, + { + "name": "is_rtl", + "type": "Bool", + "description": "True, if the instant view must be shown from right to left" + }, { "name": "is_full", "type": "Bool", @@ -3298,9 +3810,9 @@ "description": "Preview of the content as a voice note, if available; may be null" }, { - "name": "has_instant_view", - "type": "Bool", - "description": "True, if the web page has an instant view" + "name": "instant_view_version", + "type": "int32", + "description": "Version of instant view, available for the web page (currently can be 1 or 2), 0 if none" } ] }, @@ -4320,7 +4832,13 @@ "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": [] + "properties": [ + { + "name": "file_index", + "type": "int32", + "description": "Index of a file with the error" + } + ] }, { "name": "passportElementErrorSourceTranslationFiles", @@ -4332,7 +4850,13 @@ "name": "passportElementErrorSourceFile", "description": "The file contains an error. The error will be considered resolved when the file changes", "class": "PassportElementErrorSource", - "properties": [] + "properties": [ + { + "name": "file_index", + "type": "int32", + "description": "Index of a file with the error" + } + ] }, { "name": "passportElementErrorSourceFiles", @@ -4416,20 +4940,27 @@ "type": "vector\u003cpassportRequiredElement\u003e", "description": "Information about the Telegram Passport elements that need to be provided to complete the form" }, + { + "name": "privacy_policy_url", + "type": "string", + "description": "URL for the privacy policy of the service; may be empty" + } + ] + }, + { + "name": "passportElementsWithErrors", + "description": "Contains information about a Telegram Passport elements and corresponding errors", + "class": "PassportElementsWithErrors", + "properties": [ { "name": "elements", "type": "vector\u003cPassportElement\u003e", - "description": "Already available Telegram Passport elements" + "description": "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" } ] }, @@ -4885,6 +5416,18 @@ } ] }, + { + "name": "messagePoll", + "description": "A message with a poll", + "class": "MessageContent", + "properties": [ + { + "name": "poll", + "type": "poll", + "description": "Poll" + } + ] + }, { "name": "messageInvoice", "description": "A message with an invoice from a bot", @@ -5080,7 +5623,7 @@ { "name": "message_id", "type": "int53", - "description": "Identifier of the pinned message, can be an identifier of a deleted message" + "description": "Identifier of the pinned message, can be an identifier of a deleted message or 0" } ] }, @@ -5127,7 +5670,7 @@ { "name": "game_id", "type": "int64", - "description": "Identifier of the game, may be different from the games presented in the message with the game" + "description": "Identifier of the game; may be different from the games presented in the message with the game" }, { "name": "score", @@ -5373,12 +5916,12 @@ { "name": "width", "type": "int32", - "description": "Thumbnail width, usually shouldn't exceed 90. Use 0 if unknown" + "description": "Thumbnail width, usually shouldn't exceed 320. Use 0 if unknown" }, { "name": "height", "type": "int32", - "description": "Thumbnail height, usually shouldn't exceed 90. Use 0 if unknown" + "description": "Thumbnail height, usually shouldn't exceed 320. Use 0 if unknown" } ] }, @@ -5795,6 +6338,23 @@ } ] }, + { + "name": "inputMessagePoll", + "description": "A message with a poll. Polls can't be sent to private or secret chats", + "class": "InputMessageContent", + "properties": [ + { + "name": "question", + "type": "string", + "description": "Poll question, 1-255 characters" + }, + { + "name": "options", + "type": "vector\u003cstring\u003e", + "description": "List of poll answer options, 2-10 strings 1-100 characters each" + } + ] + }, { "name": "inputMessageForwarded", "description": "A forwarded message", @@ -5909,7 +6469,7 @@ }, { "name": "searchMessagesFilterUnreadMention", - "description": "Returns only messages with unread mentions of the current user or messages that are replies to their messages. When using this filter the results can't be additionally filtered by a query or by the sending user", + "description": "Returns only messages with unread mentions of the current user, or messages that are replies to their messages. When using this filter the results can't be additionally filtered by a query or by the sending user", "class": "SearchMessagesFilter", "properties": [] }, @@ -6377,6 +6937,11 @@ "name": "emojis", "type": "vector\u003cstring\u003e", "description": "Encryption key emojis fingerprint" + }, + { + "name": "allow_p2p", + "type": "Bool", + "description": "True, if peer-to-peer connection is allowed by users privacy settings" } ] }, @@ -6476,6 +7041,18 @@ } ] }, + { + "name": "httpUrl", + "description": "Contains an HTTP URL", + "class": "HttpUrl", + "properties": [ + { + "name": "url", + "type": "string", + "description": "The URL" + } + ] + }, { "name": "inputInlineQueryResultAnimatedGif", "description": "Represents a link to an animated GIF", @@ -7846,7 +8423,7 @@ }, { "name": "languagePackStringValuePluralized", - "description": "A language pack string which has different forms based on the number of some object it mentions", + "description": "A language pack string which has different forms based on the number of some object it mentions. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more info", "class": "LanguagePackStringValue", "properties": [ { @@ -7926,6 +8503,11 @@ "type": "string", "description": "Unique language pack identifier" }, + { + "name": "base_language_pack_id", + "type": "string", + "description": "Identifier of a base language pack; may be empty. If a string is missed in the language pack, then it should be fetched from base language pack. Unsupported in custom language packs" + }, { "name": "name", "type": "string", @@ -7936,10 +8518,50 @@ "type": "string", "description": "Name of the language in that language" }, + { + "name": "plural_code", + "type": "string", + "description": "A language code to be used to apply plural forms. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more info" + }, + { + "name": "is_official", + "type": "Bool", + "description": "True, if the language pack is official" + }, + { + "name": "is_rtl", + "type": "Bool", + "description": "True, if the language pack strings are RTL" + }, + { + "name": "is_beta", + "type": "Bool", + "description": "True, if the language pack is a beta language pack" + }, + { + "name": "is_installed", + "type": "Bool", + "description": "True, if the language pack is installed by the current user" + }, + { + "name": "total_string_count", + "type": "int32", + "description": "Total number of non-deleted strings from the language pack" + }, + { + "name": "translated_string_count", + "type": "int32", + "description": "Total number of translated strings from the language pack" + }, { "name": "local_string_count", "type": "int32", "description": "Total number of non-deleted strings from the language pack available locally" + }, + { + "name": "translation_url", + "type": "string", + "description": "Link to language translation interface; empty for custom local language packs" } ] }, @@ -7956,14 +8578,19 @@ ] }, { - "name": "deviceTokenGoogleCloudMessaging", - "description": "A token for Google Cloud Messaging", + "name": "deviceTokenFirebaseCloudMessaging", + "description": "A token for Firebase Cloud Messaging", "class": "DeviceToken", "properties": [ { "name": "token", "type": "string", "description": "Device registration token; may be empty to de-register a device" + }, + { + "name": "encrypt", + "type": "Bool", + "description": "True, if push notifications should be additionally encrypted" } ] }, @@ -7998,6 +8625,11 @@ "name": "is_app_sandbox", "type": "Bool", "description": "True, if App Sandbox is enabled" + }, + { + "name": "encrypt", + "type": "Bool", + "description": "True, if push notifications should be additionally encrypted" } ] }, @@ -8107,6 +8739,18 @@ } ] }, + { + "name": "pushReceiverId", + "description": "Contains a globally unique push receiver identifier, which can be used to identify which account has received a push notification", + "class": "PushReceiverId", + "properties": [ + { + "name": "id", + "type": "int64", + "description": "The globally unique identifier of push notification subscription" + } + ] + }, { "name": "wallpaper", "description": "Contains information about a wallpaper", @@ -8183,9 +8827,561 @@ "class": "CheckChatUsernameResult", "properties": [] }, + { + "name": "pushMessageContentHidden", + "description": "A general message with hidden content", + "class": "PushMessageContent", + "properties": [ + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentAnimation", + "description": "An animation message (GIF-style)", + "class": "PushMessageContent", + "properties": [ + { + "name": "animation", + "type": "animation", + "description": "Message content; may be null" + }, + { + "name": "caption", + "type": "string", + "description": "Animation caption" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentAudio", + "description": "An audio message", + "class": "PushMessageContent", + "properties": [ + { + "name": "audio", + "type": "audio", + "description": "Message content; may be null" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentContact", + "description": "A message with a user contact", + "class": "PushMessageContent", + "properties": [ + { + "name": "name", + "type": "string", + "description": "Contact's name" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentContactRegistered", + "description": "A contact has registered with Telegram", + "class": "PushMessageContent", + "properties": [] + }, + { + "name": "pushMessageContentDocument", + "description": "A document message (a general file)", + "class": "PushMessageContent", + "properties": [ + { + "name": "document", + "type": "document", + "description": "Message content; may be null" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentGame", + "description": "A message with a game", + "class": "PushMessageContent", + "properties": [ + { + "name": "title", + "type": "string", + "description": "Game title, empty for pinned game message" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentGameScore", + "description": "A new high score was achieved in a game", + "class": "PushMessageContent", + "properties": [ + { + "name": "title", + "type": "string", + "description": "Game title, empty for pinned message" + }, + { + "name": "score", + "type": "int32", + "description": "New score, 0 for pinned message" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentInvoice", + "description": "A message with an invoice from a bot", + "class": "PushMessageContent", + "properties": [ + { + "name": "price", + "type": "string", + "description": "Product price" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentLocation", + "description": "A message with a location", + "class": "PushMessageContent", + "properties": [ + { + "name": "is_live", + "type": "Bool", + "description": "True, if the location is live" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentPhoto", + "description": "A photo message", + "class": "PushMessageContent", + "properties": [ + { + "name": "photo", + "type": "photo", + "description": "Message content; may be null" + }, + { + "name": "caption", + "type": "string", + "description": "Photo caption" + }, + { + "name": "is_secret", + "type": "Bool", + "description": "True, if the photo is secret" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentPoll", + "description": "A message with a poll", + "class": "PushMessageContent", + "properties": [ + { + "name": "question", + "type": "string", + "description": "Poll question" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentScreenshotTaken", + "description": "A screenshot of a message in the chat has been taken", + "class": "PushMessageContent", + "properties": [] + }, + { + "name": "pushMessageContentSticker", + "description": "A message with a sticker", + "class": "PushMessageContent", + "properties": [ + { + "name": "sticker", + "type": "sticker", + "description": "Message content; may be null" + }, + { + "name": "emoji", + "type": "string", + "description": "Emoji corresponding to the sticker; may be empty" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentText", + "description": "A text message", + "class": "PushMessageContent", + "properties": [ + { + "name": "text", + "type": "string", + "description": "Message text" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentVideo", + "description": "A video message", + "class": "PushMessageContent", + "properties": [ + { + "name": "video", + "type": "video", + "description": "Message content; may be null" + }, + { + "name": "caption", + "type": "string", + "description": "Video caption" + }, + { + "name": "is_secret", + "type": "Bool", + "description": "True, if the video is secret" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentVideoNote", + "description": "A video note message", + "class": "PushMessageContent", + "properties": [ + { + "name": "video_note", + "type": "videoNote", + "description": "Message content; may be null" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentVoiceNote", + "description": "A voice note message", + "class": "PushMessageContent", + "properties": [ + { + "name": "voice_note", + "type": "voiceNote", + "description": "Message content; may be null" + }, + { + "name": "is_pinned", + "type": "Bool", + "description": "True, if the message is a pinned message with the specified content" + } + ] + }, + { + "name": "pushMessageContentBasicGroupChatCreate", + "description": "A newly created basic group", + "class": "PushMessageContent", + "properties": [] + }, + { + "name": "pushMessageContentChatAddMembers", + "description": "New chat members were invited to a group", + "class": "PushMessageContent", + "properties": [ + { + "name": "member_name", + "type": "string", + "description": "Name of the added member" + }, + { + "name": "is_current_user", + "type": "Bool", + "description": "True, if the current user was added to the group" + }, + { + "name": "is_returned", + "type": "Bool", + "description": "True, if the user has returned to the group himself" + } + ] + }, + { + "name": "pushMessageContentChatChangePhoto", + "description": "A chat photo was edited", + "class": "PushMessageContent", + "properties": [] + }, + { + "name": "pushMessageContentChatChangeTitle", + "description": "A chat title was edited", + "class": "PushMessageContent", + "properties": [ + { + "name": "title", + "type": "string", + "description": "New chat title" + } + ] + }, + { + "name": "pushMessageContentChatDeleteMember", + "description": "A chat member was deleted", + "class": "PushMessageContent", + "properties": [ + { + "name": "member_name", + "type": "string", + "description": "Name of the deleted member" + }, + { + "name": "is_current_user", + "type": "Bool", + "description": "True, if the current user was deleted from the group" + }, + { + "name": "is_left", + "type": "Bool", + "description": "True, if the user has left the group himself" + } + ] + }, + { + "name": "pushMessageContentChatJoinByLink", + "description": "A new member joined the chat by invite link", + "class": "PushMessageContent", + "properties": [] + }, + { + "name": "pushMessageContentMessageForwards", + "description": "A forwarded messages", + "class": "PushMessageContent", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Number of forwarded messages" + } + ] + }, + { + "name": "pushMessageContentMediaAlbum", + "description": "A media album", + "class": "PushMessageContent", + "properties": [ + { + "name": "total_count", + "type": "int32", + "description": "Number of messages in the album" + }, + { + "name": "has_photos", + "type": "Bool", + "description": "True, if the album has at least one photo" + }, + { + "name": "has_videos", + "type": "Bool", + "description": "True, if the album has at least one video" + } + ] + }, + { + "name": "notificationTypeNewMessage", + "description": "New message was received", + "class": "NotificationType", + "properties": [ + { + "name": "message", + "type": "message", + "description": "The message" + } + ] + }, + { + "name": "notificationTypeNewSecretChat", + "description": "New secret chat was created", + "class": "NotificationType", + "properties": [] + }, + { + "name": "notificationTypeNewCall", + "description": "New call was received", + "class": "NotificationType", + "properties": [ + { + "name": "call_id", + "type": "int32", + "description": "Call identifier" + } + ] + }, + { + "name": "notificationTypeNewPushMessage", + "description": "New message was received through a push notification", + "class": "NotificationType", + "properties": [ + { + "name": "message_id", + "type": "int53", + "description": "The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages and as reply_to_message_id" + }, + { + "name": "sender_user_id", + "type": "int32", + "description": "Sender of the message. Corresponding user may be inaccessible" + }, + { + "name": "content", + "type": "PushMessageContent", + "description": "Push message content" + } + ] + }, + { + "name": "notificationGroupTypeMessages", + "description": "A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with ordinary unread messages", + "class": "NotificationGroupType", + "properties": [] + }, + { + "name": "notificationGroupTypeMentions", + "description": "A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with unread mentions of the current user, replies to their messages, or a pinned message", + "class": "NotificationGroupType", + "properties": [] + }, + { + "name": "notificationGroupTypeSecretChat", + "description": "A group containing a notification of type notificationTypeNewSecretChat", + "class": "NotificationGroupType", + "properties": [] + }, + { + "name": "notificationGroupTypeCalls", + "description": "A group containing notifications of type notificationTypeNewCall", + "class": "NotificationGroupType", + "properties": [] + }, + { + "name": "notification", + "description": "Contains information about a notification", + "class": "Notification", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Unique persistent identifier of this notification" + }, + { + "name": "date", + "type": "int32", + "description": "Notification date" + }, + { + "name": "type", + "type": "NotificationType", + "description": "Notification type" + } + ] + }, + { + "name": "notificationGroup", + "description": "Describes a group of notifications", + "class": "NotificationGroup", + "properties": [ + { + "name": "id", + "type": "int32", + "description": "Unique persistent auto-incremented from 1 identifier of the notification group" + }, + { + "name": "type", + "type": "NotificationGroupType", + "description": "Type of the group" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of a chat to which all notifications in the group belong" + }, + { + "name": "total_count", + "type": "int32", + "description": "Total number of active notifications in the group" + }, + { + "name": "notifications", + "type": "vector\u003cnotification\u003e", + "description": "The list of active notifications" + } + ] + }, { "name": "optionValueBoolean", - "description": "Boolean option", + "description": "Represents a boolean option", "class": "OptionValue", "properties": [ { @@ -8197,13 +9393,13 @@ }, { "name": "optionValueEmpty", - "description": "An unknown option or an option which has a default value", + "description": "Represents an unknown option or an option which has a default value", "class": "OptionValue", "properties": [] }, { "name": "optionValueInteger", - "description": "An integer option", + "description": "Represents an integer option", "class": "OptionValue", "properties": [ { @@ -8215,7 +9411,7 @@ }, { "name": "optionValueString", - "description": "A string option", + "description": "Represents a string option", "class": "OptionValue", "properties": [ { @@ -8225,6 +9421,89 @@ } ] }, + { + "name": "jsonObjectMember", + "description": "Represents one member of a JSON object", + "class": "JsonObjectMember", + "properties": [ + { + "name": "key", + "type": "string", + "description": "Member's key" + }, + { + "name": "value", + "type": "JsonValue", + "description": "Member's value" + } + ] + }, + { + "name": "jsonValueNull", + "description": "Represents a null JSON value", + "class": "JsonValue", + "properties": [] + }, + { + "name": "jsonValueBoolean", + "description": "Represents a boolean JSON value", + "class": "JsonValue", + "properties": [ + { + "name": "value", + "type": "Bool", + "description": "The value" + } + ] + }, + { + "name": "jsonValueNumber", + "description": "Represents a numeric JSON value", + "class": "JsonValue", + "properties": [ + { + "name": "value", + "type": "double", + "description": "The value" + } + ] + }, + { + "name": "jsonValueString", + "description": "Represents a string JSON value", + "class": "JsonValue", + "properties": [ + { + "name": "value", + "type": "string", + "description": "The value" + } + ] + }, + { + "name": "jsonValueArray", + "description": "Represents a JSON array", + "class": "JsonValue", + "properties": [ + { + "name": "values", + "type": "vector\u003cJsonValue\u003e", + "description": "The list of array elements" + } + ] + }, + { + "name": "jsonValueObject", + "description": "Represents a JSON object", + "class": "JsonValue", + "properties": [ + { + "name": "members", + "type": "vector\u003cjsonObjectMember\u003e", + "description": "The list of object members" + } + ] + }, { "name": "userPrivacySettingRuleAllowAll", "description": "A rule to allow all users to do something", @@ -8303,6 +9582,12 @@ "class": "UserPrivacySetting", "properties": [] }, + { + "name": "userPrivacySettingAllowPeerToPeerCalls", + "description": "A privacy setting for managing whether peer-to-peer connections can be used for calls", + "class": "UserPrivacySetting", + "properties": [] + }, { "name": "accountTtl", "description": "Contains information about the period of inactivity after which the current user's account will automatically be deleted", @@ -8317,7 +9602,7 @@ }, { "name": "session", - "description": "Contains information about one session in a Telegram application used by the current user", + "description": "Contains information about one session in a Telegram application used by the current user. Sessions should be shown to the user in the returned order", "class": "Session", "properties": [ { @@ -8330,6 +9615,11 @@ "type": "Bool", "description": "True, if this session is the current session" }, + { + "name": "is_password_pending", + "type": "Bool", + "description": "True, if a password is needed to complete authorization of the session" + }, { "name": "api_id", "type": "int32", @@ -8498,6 +9788,12 @@ "class": "ChatReportReason", "properties": [] }, + { + "name": "chatReportReasonChildAbuse", + "description": "The chat has child abuse related content", + "class": "ChatReportReason", + "properties": [] + }, { "name": "chatReportReasonCopyright", "description": "The chat contains copyrighted content", @@ -8533,6 +9829,18 @@ } ] }, + { + "name": "filePart", + "description": "Contains a part of a file", + "class": "FilePart", + "properties": [ + { + "name": "data", + "type": "bytes", + "description": "File bytes" + } + ] + }, { "name": "fileTypeNone", "description": "The data is not a file", @@ -8719,6 +10027,28 @@ "name": "database_size", "type": "int53", "description": "Size of the database" + }, + { + "name": "language_pack_database_size", + "type": "int53", + "description": "Size of the language pack database" + }, + { + "name": "log_size", + "type": "int53", + "description": "Size of the TDLib internal log" + } + ] + }, + { + "name": "databaseStatistics", + "description": "Contains database statistics", + "class": "DatabaseStatistics", + "properties": [ + { + "name": "statistics", + "type": "string", + "description": "Database statistics in an unspecified human-readable format" } ] }, @@ -9174,16 +10504,6 @@ "name": "message", "type": "message", "description": "The new message" - }, - { - "name": "disable_notification", - "type": "Bool", - "description": "True, if this message must not generate a notification" - }, - { - "name": "contains_mention", - "type": "Bool", - "description": "True, if the message contains a mention of the current user" } ] }, @@ -9428,7 +10748,7 @@ }, { "name": "updateChatOrder", - "description": "The order of the chat in the chats list has changed. Instead of this update updateChatLastMessage, updateChatIsPinned or updateChatDraftMessage might be sent", + "description": "The order of the chat in the chat list has changed. Instead of this update updateChatLastMessage, updateChatIsPinned or updateChatDraftMessage might be sent", "class": "Update", "properties": [ { @@ -9611,6 +10931,23 @@ } ] }, + { + "name": "updateChatPinnedMessage", + "description": "The chat pinned message was changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "pinned_message_id", + "type": "int53", + "description": "The new identifier of the pinned message; 0 if there is no pinned message in the chat" + } + ] + }, { "name": "updateChatReplyMarkup", "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", @@ -9650,6 +10987,116 @@ } ] }, + { + "name": "updateChatOnlineMemberCount", + "description": "The number of online group members has changed. This update with non-zero count is sent only for currently opened chats. There is no guarantee that it will be sent just after the count has changed", + "class": "Update", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat" + }, + { + "name": "online_member_count", + "type": "int32", + "description": "New number of online members in the chat, or 0 if unknown" + } + ] + }, + { + "name": "updateNotification", + "description": "A notification was changed", + "class": "Update", + "properties": [ + { + "name": "notification_group_id", + "type": "int32", + "description": "Unique notification group identifier" + }, + { + "name": "notification", + "type": "notification", + "description": "Changed notification" + } + ] + }, + { + "name": "updateNotificationGroup", + "description": "A list of active notifications in a notification group has changed", + "class": "Update", + "properties": [ + { + "name": "notification_group_id", + "type": "int32", + "description": "Unique notification group identifier" + }, + { + "name": "type", + "type": "NotificationGroupType", + "description": "New type of the notification group" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of a chat to which all notifications in the group belong" + }, + { + "name": "notification_settings_chat_id", + "type": "int53", + "description": "Chat identifier, which notification settings must be applied to the added notifications" + }, + { + "name": "is_silent", + "type": "Bool", + "description": "True, if the notifications should be shown without sound" + }, + { + "name": "total_count", + "type": "int32", + "description": "Total number of unread notifications in the group, can be bigger than number of active notifications" + }, + { + "name": "added_notifications", + "type": "vector\u003cnotification\u003e", + "description": "List of added group notifications, sorted by notification ID" + }, + { + "name": "removed_notification_ids", + "type": "vector\u003cint32\u003e", + "description": "Identifiers of removed group notifications, sorted by notification ID" + } + ] + }, + { + "name": "updateActiveNotifications", + "description": "Contains active notifications that was shown on previous application launches. This update is sent only if a message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update", + "class": "Update", + "properties": [ + { + "name": "groups", + "type": "vector\u003cnotificationGroup\u003e", + "description": "Lists of active notification groups" + } + ] + }, + { + "name": "updateHavePendingNotifications", + "description": "Describes, whether there are some pending notification updates. Can be used to prevent application from killing, while there are some pending notifications", + "class": "Update", + "properties": [ + { + "name": "have_delayed_notifications", + "type": "Bool", + "description": "True, if there are some delayed notification updates, which will be sent soon" + }, + { + "name": "have_unreceived_notifications", + "type": "Bool", + "description": "True, if there can be some yet unreceived notifications, which are being fetched from the server" + } + ] + }, { "name": "updateDeleteMessages", "description": "Some messages were deleted", @@ -9668,7 +11115,7 @@ { "name": "is_permanent", "type": "Bool", - "description": "True, if the messages are permanently deleted by a user (as opposed to just becoming unaccessible)" + "description": "True, if the messages are permanently deleted by a user (as opposed to just becoming inaccessible)" }, { "name": "from_cache", @@ -10330,6 +11777,83 @@ } ] }, + { + "name": "updatePoll", + "description": "Information about a poll was updated; for bots only", + "class": "Update", + "properties": [ + { + "name": "poll", + "type": "poll", + "description": "New data about the poll" + } + ] + }, + { + "name": "updates", + "description": "Contains a list of updates", + "class": "Updates", + "properties": [ + { + "name": "updates", + "type": "vector\u003cUpdate\u003e", + "description": "List of updates" + } + ] + }, + { + "name": "logStreamDefault", + "description": "The log is written to stderr or an OS specific log", + "class": "LogStream", + "properties": [] + }, + { + "name": "logStreamFile", + "description": "The log is written to a file", + "class": "LogStream", + "properties": [ + { + "name": "path", + "type": "string", + "description": "Path to the file to where the internal TDLib log will be written" + }, + { + "name": "max_file_size", + "type": "int53", + "description": "Maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated" + } + ] + }, + { + "name": "logStreamEmpty", + "description": "The log is written nowhere", + "class": "LogStream", + "properties": [] + }, + { + "name": "logVerbosityLevel", + "description": "Contains a TDLib internal log verbosity level", + "class": "LogVerbosityLevel", + "properties": [ + { + "name": "verbosity_level", + "type": "int32", + "description": "Log verbosity level" + } + ] + }, + { + "name": "logTags", + "description": "Contains a list of available TDLib internal log tags", + "class": "LogTags", + "properties": [ + { + "name": "tags", + "type": "vector\u003cstring\u003e", + "description": "List of log tags" + } + ] + }, { "name": "testInt", "description": "A simple object containing a number; for testing only", @@ -10457,8 +11981,8 @@ "description": "Describes the current secret chat state" }, { - "name": "MessageForwardInfo", - "description": "Contains information about the initial sender of a forwarded message" + "name": "MessageForwardOrigin", + "description": "Contains information about the origin of a forwarded message" }, { "name": "MessageSendingState", @@ -10488,6 +12012,14 @@ "name": "RichText", "description": "Describes a text object inside an instant-view web page" }, + { + "name": "PageBlockHorizontalAlignment", + "description": "Describes a horizontal alignment of a table cell content" + }, + { + "name": "PageBlockVerticalAlignment", + "description": "Describes a Vertical alignment of a table cell content" + }, { "name": "PageBlock", "description": "Describes a block of an instant view web page" @@ -10570,16 +12102,32 @@ }, { "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" + "description": "Represents a data needed to subscribe for push notifications through registerDevice method. To use specific push notification service, you must specify the correct application platform and upload valid server authentication data at https://my.telegram.org" }, { "name": "CheckChatUsernameResult", "description": "Represents result of checking whether a username can be set for a chat" }, + { + "name": "PushMessageContent", + "description": "Contains content of a push message notification" + }, + { + "name": "NotificationType", + "description": "Contains detailed information about a notification" + }, + { + "name": "NotificationGroupType", + "description": "Describes type of notifications in the group" + }, { "name": "OptionValue", "description": "Represents the value of an option" }, + { + "name": "JsonValue", + "description": "Represents a JSON value" + }, { "name": "UserPrivacySettingRule", "description": "Represents a single rule for managing privacy settings" @@ -10627,6 +12175,10 @@ { "name": "Update", "description": "Contains notifications about data changes" + }, + { + "name": "LogStream", + "description": "Describes a stream to which TDLib internal log is written" } ], "functions": [ @@ -10711,12 +12263,12 @@ { "name": "first_name", "type": "string", - "description": "If the user is not yet registered, the first name of the user; 1-255 characters" + "description": "If the user is not yet registered, the first name of the user; 1-64 characters. You can also pass an empty string for unregistered user there to check verification code validness. In the latter case PHONE_NUMBER_UNOCCUPIED error will be returned for a valid code" }, { "name": "last_name", "type": "string", - "description": "If the user is not yet registered; the last name of the user; optional; 0-255 characters" + "description": "If the user is not yet registered; the last name of the user; optional; 0-64 characters" } ], "is_synchronous": false, @@ -10796,6 +12348,14 @@ "is_synchronous": false, "type": 1 }, + { + "name": "getCurrentState", + "description": "Returns all updates needed to restore current TDLib state, i.e. all actual UpdateAuthorizationState/UpdateUser/UpdateNewChat and others. This is especially usefull if TDLib is run in a separate process. This is an offline method. Can be called before authorization", + "class": "Updates", + "properties": [], + "is_synchronous": false, + "type": 1 + }, { "name": "setDatabaseEncryptionKey", "description": "Changes the database encryption key. Usually the encryption key is never changed and is stored in some OS keychain", @@ -10820,7 +12380,7 @@ }, { "name": "setPassword", - "description": "Changes the password for the user. If a new recovery email address is specified, then the error EMAIL_UNCONFIRMED is returned and the password change will not be applied until the new recovery email address has been confirmed. The application should periodically call getPasswordState to check whether the new email address has been confirmed", + "description": "Changes the password for the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed", "class": "PasswordState", "properties": [ { @@ -10854,7 +12414,7 @@ }, { "name": "getRecoveryEmailAddress", - "description": "Returns a recovery email address that was previously set up. This method can be used to verify a password provided by the user", + "description": "Returns a 2-step verification recovery email address that was previously set up. This method can be used to verify a password provided by the user", "class": "RecoveryEmailAddress", "properties": [ { @@ -10868,7 +12428,7 @@ }, { "name": "setRecoveryEmailAddress", - "description": "Changes the recovery email address of the user. If a new recovery email address is specified, then the error EMAIL_UNCONFIRMED is returned and the email address will not be changed until the new email has been confirmed. The application should periodically call getPasswordState to check whether the email address has been confirmed. If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation", + "description": "Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation", "class": "PasswordState", "properties": [ { @@ -10885,6 +12445,28 @@ "is_synchronous": false, "type": 2 }, + { + "name": "checkRecoveryEmailAddressCode", + "description": "Checks the 2-step verification recovery email address verification code", + "class": "PasswordState", + "properties": [ + { + "name": "code", + "type": "string", + "description": "Verification code" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "resendRecoveryEmailAddressCode", + "description": "Resends the 2-step verification recovery email address verification code", + "class": "PasswordState", + "properties": [], + "is_synchronous": false, + "type": 2 + }, { "name": "requestPasswordRecovery", "description": "Requests to send a password recovery code to an email address that was previously set up", @@ -10934,25 +12516,6 @@ "is_synchronous": false, "type": 2 }, - { - "name": "processDcUpdate", - "description": "Handles a DC_UPDATE push service notification. Can be called before authorization", - "class": "Ok", - "properties": [ - { - "name": "dc", - "type": "string", - "description": "Value of the \"dc\" parameter of the notification" - }, - { - "name": "addr", - "type": "string", - "description": "Value of the \"addr\" parameter of the notification" - } - ], - "is_synchronous": false, - "type": 1 - }, { "name": "getMe", "description": "Returns the current user", @@ -11092,6 +12655,25 @@ "is_synchronous": false, "type": 1 }, + { + "name": "getMessageLocally", + "description": "Returns information about a message, if it is available locally without sending network request. This is an offline request", + "class": "Message", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat the message belongs to" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message to get" + } + ], + "is_synchronous": false, + "type": 1 + }, { "name": "getRepliedMessage", "description": "Returns information about a message that is replied by given message", @@ -11179,7 +12761,7 @@ }, { "name": "getChats", - "description": "Returns an ordered list of chats. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to 2^63 - 1). For optimal performance the number of returned chats is chosen by the library.", + "description": "Returns an ordered list of chats. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed 64-bit number 9223372036854775807 == 2^63 - 1). For optimal performance the number of returned chats is chosen by the library.", "class": "Chats", "properties": [ { @@ -11348,7 +12930,7 @@ "properties": [ { "name": "chat_id", - "type": "int64", + "type": "int53", "description": "Chat identifier; should be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if chat is being created" }, { @@ -11370,7 +12952,7 @@ }, { "name": "getGroupsInCommon", - "description": "Returns a list of common chats with a given user. Chats are sorted by their type and creation date", + "description": "Returns a list of common group chats with a given user. Chats are sorted by their type and creation date", "class": "Chats", "properties": [ { @@ -11410,12 +12992,12 @@ { "name": "offset", "type": "int32", - "description": "Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages" + "description": "Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally some newer messages" }, { "name": "limit", "type": "int32", - "description": "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" + "description": "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 or equal to -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached" }, { "name": "only_local", @@ -11428,7 +13010,7 @@ }, { "name": "deleteChatHistory", - "description": "Deletes all messages in the chat only for the user. Cannot be used in channels and public supergroups", + "description": "Deletes all messages in the chat. Use Chat.can_be_deleted_only_for_self and Chat.can_be_deleted_for_all_users fields to find whether and how the method can be applied to the chat", "class": "Ok", "properties": [ { @@ -11439,7 +13021,12 @@ { "name": "remove_from_chat_list", "type": "Bool", - "description": "Pass true if the chat should be removed from the chats list" + "description": "Pass true if the chat should be removed from the chat list" + }, + { + "name": "revoke", + "type": "Bool", + "description": "Pass true to try to delete chat history for all users" } ], "is_synchronous": false, @@ -11651,6 +13238,44 @@ "is_synchronous": false, "type": 2 }, + { + "name": "removeNotification", + "description": "Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user", + "class": "Ok", + "properties": [ + { + "name": "notification_group_id", + "type": "int32", + "description": "Identifier of notification group to which the notification belongs" + }, + { + "name": "notification_id", + "type": "int32", + "description": "Identifier of removed notification" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "removeNotificationGroup", + "description": "Removes a group of active notifications. Needs to be called only if the notification group is removed by the current user", + "class": "Ok", + "properties": [ + { + "name": "notification_group_id", + "type": "int32", + "description": "Notification group identifier" + }, + { + "name": "max_notification_id", + "type": "int32", + "description": "Maximum identifier of removed notifications" + } + ], + "is_synchronous": false, + "type": 2 + }, { "name": "getPublicMessageLink", "description": "Returns a public HTTPS link to a message. Available only for messages in public supergroups and channels", @@ -11673,7 +13298,26 @@ } ], "is_synchronous": false, - "type": 1 + "type": 2 + }, + { + "name": "getMessageLink", + "description": "Returns a private HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels. The link will work only for members of the chat", + "class": "HttpUrl", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to which the message belongs" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message" + } + ], + "is_synchronous": false, + "type": 2 }, { "name": "sendMessage", @@ -11806,6 +13450,11 @@ "name": "result_id", "type": "string", "description": "Identifier of the inline result" + }, + { + "name": "hide_via_bot", + "type": "Bool", + "description": "If true, there will be no mention of a bot, via which the message is sent. Can be used only for bots GetOption(\"animation_search_bot_username\"), GetOption(\"photo_search_bot_username\") and GetOption(\"venue_search_bot_username\")" } ], "is_synchronous": false, @@ -11935,7 +13584,7 @@ { "name": "revoke", "type": "Bool", - "description": "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" + "description": "Pass true to try to delete messages for all chat members. Always true for supergroups, channels and secret chats" } ], "is_synchronous": false, @@ -12319,6 +13968,82 @@ "is_synchronous": true, "type": 1 }, + { + "name": "getJsonValue", + "description": "Converts a JSON-serialized string to corresponding JsonValue object. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "JsonValue", + "properties": [ + { + "name": "json", + "type": "string", + "description": "The JSON-serialized string" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getJsonString", + "description": "Converts a JsonValue object to corresponding JSON-serialized string. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "Text", + "properties": [ + { + "name": "json_value", + "type": "JsonValue", + "description": "The JsonValue object" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "setPollAnswer", + "description": "Changes user answer to a poll", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to which the poll belongs" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message containing the poll" + }, + { + "name": "option_ids", + "type": "vector\u003cint32\u003e", + "description": "0-based identifiers of options, chosen by the user. Currently user can't choose more than 1 option" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "stopPoll", + "description": "Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat to which the poll belongs" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the message containing the poll" + }, + { + "name": "reply_markup", + "type": "ReplyMarkup", + "description": "The new message reply markup; for bots only" + } + ], + "is_synchronous": false, + "type": 1 + }, { "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", @@ -12506,7 +14231,7 @@ { "name": "chat_id", "type": "int53", - "description": "The chat to which the message with the game" + "description": "The chat to which the message with the game belongs" }, { "name": "message_id", @@ -12654,7 +14379,7 @@ }, { "name": "openChat", - "description": "This method should be called if the chat is opened by the user. Many useful activities depend on the chat being opened or closed (e.g., in supergroups and channels all updates are received only for opened chats)", + "description": "Informs TDLib that the chat is opened by the user. Many useful activities depend on the chat being opened or closed (e.g., in supergroups and channels all updates are received only for opened chats)", "class": "Ok", "properties": [ { @@ -12668,7 +14393,7 @@ }, { "name": "closeChat", - "description": "This method should be called if the chat is closed by the user. Many useful activities depend on the chat being opened or closed", + "description": "Informs TDLib that the chat is closed by the user. Many useful activities depend on the chat being opened or closed", "class": "Ok", "properties": [ { @@ -12682,7 +14407,7 @@ }, { "name": "viewMessages", - "description": "This method should be called if messages are being viewed by the user. Many useful activities depend on whether the messages are currently being viewed or not (e.g., marking messages as read, incrementing a view counter, updating a view counter, removing deleted messages in supergroups and channels)", + "description": "Informs TDLib that messages are being viewed by the user. Many useful activities depend on whether the messages are currently being viewed or not (e.g., marking messages as read, incrementing a view counter, updating a view counter, removing deleted messages in supergroups and channels)", "class": "Ok", "properties": [ { @@ -12706,7 +14431,7 @@ }, { "name": "openMessageContent", - "description": "This method should be called if the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). An updateMessageContentOpened update will be generated if something has changed", + "description": "Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). An updateMessageContentOpened update will be generated if something has changed", "class": "Ok", "properties": [ { @@ -12821,7 +14546,7 @@ { "name": "title", "type": "string", - "description": "Title of the new basic group; 1-255 characters" + "description": "Title of the new basic group; 1-128 characters" } ], "is_synchronous": false, @@ -12835,7 +14560,7 @@ { "name": "title", "type": "string", - "description": "Title of the new chat; 1-255 characters" + "description": "Title of the new chat; 1-128 characters" }, { "name": "is_channel", @@ -12892,7 +14617,7 @@ { "name": "title", "type": "string", - "description": "New title of the chat; 1-255 characters" + "description": "New title of the chat; 1-128 characters" } ], "is_synchronous": false, @@ -13031,6 +14756,44 @@ "is_synchronous": false, "type": 1 }, + { + "name": "pinChatMessage", + "description": "Pins a message in a chat; requires appropriate administrator rights in the group or channel", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat" + }, + { + "name": "message_id", + "type": "int53", + "description": "Identifier of the new pinned message" + }, + { + "name": "disable_notification", + "type": "Bool", + "description": "True, if there should be no notification about the pinned message" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "unpinChatMessage", + "description": "Removes the pinned message from a chat; requires appropriate administrator rights in the group or channel", + "class": "Ok", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Identifier of the chat" + } + ], + "is_synchronous": false, + "type": 1 + }, { "name": "joinChat", "description": "Adds current user as a new member to a chat. Private and secret chats can't be joined using this method", @@ -13043,7 +14806,7 @@ } ], "is_synchronous": false, - "type": 1 + "type": 2 }, { "name": "leaveChat", @@ -13077,7 +14840,7 @@ { "name": "forward_limit", "type": "int32", - "description": "The number of earlier messages from the chat to be forwarded to the new member; up to 300. Ignored for supergroups and channels" + "description": "The number of earlier messages from the chat to be forwarded to the new member; up to 100. Ignored for supergroups and channels" } ], "is_synchronous": false, @@ -13202,6 +14965,25 @@ "is_synchronous": false, "type": 2 }, + { + "name": "getChatNotificationSettingsExceptions", + "description": "Returns list of chats with non-default notification settings", + "class": "Chats", + "properties": [ + { + "name": "scope", + "type": "NotificationSettingsScope", + "description": "If specified, only chats from the specified scope will be returned" + }, + { + "name": "compare_sound", + "type": "Bool", + "description": "If true, also chats with non-default sound will be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, { "name": "getScopeNotificationSettings", "description": "Returns the notification settings for chats of a given type", @@ -13259,7 +15041,7 @@ }, { "name": "downloadFile", - "description": "Asynchronously downloads a file from the cloud. updateFile will be used to notify about the download progress and successful completion of the download. Returns file state just after the download has been started", + "description": "Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates", "class": "File", "properties": [ { @@ -13271,6 +15053,40 @@ "name": "priority", "type": "int32", "description": "Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first" + }, + { + "name": "offset", + "type": "int32", + "description": "The starting position from which the file should be downloaded" + }, + { + "name": "limit", + "type": "int32", + "description": "Number of bytes which should be downloaded starting from the \"offset\" position before the download will be automatically cancelled; use 0 to download without a limit" + }, + { + "name": "synchronous", + "type": "Bool", + "description": "If false, this request returns file state just after the download has been started. If true, this request returns file state only after the download has succeeded, has failed, has been cancelled or a new downloadFile request with different offset/limit parameters was sent" + } + ], + "is_synchronous": false, + "type": 1 + }, + { + "name": "getFileDownloadedPrefixSize", + "description": "Returns file downloaded prefix size from a given offset", + "class": "Count", + "properties": [ + { + "name": "file_id", + "type": "int32", + "description": "Identifier of the file" + }, + { + "name": "offset", + "type": "int32", + "description": "Offset from which downloaded prefix size should be calculated" } ], "is_synchronous": false, @@ -13333,9 +15149,33 @@ "is_synchronous": false, "type": 1 }, + { + "name": "writeGeneratedFilePart", + "description": "Writes a part of a generated file. This method is intended to be used only if the client has no direct access to TDLib's file system, because it is usually slower than a direct write to the destination file", + "class": "Ok", + "properties": [ + { + "name": "generation_id", + "type": "int64", + "description": "The identifier of the generation process" + }, + { + "name": "offset", + "type": "int32", + "description": "The offset from which to write the data to the file" + }, + { + "name": "data", + "type": "bytes", + "description": "The data to write" + } + ], + "is_synchronous": false, + "type": 1 + }, { "name": "setFileGenerationProgress", - "description": "The next part of a file was generated", + "description": "Informs TDLib on a file generation prograss", "class": "Ok", "properties": [ { @@ -13376,6 +15216,30 @@ "is_synchronous": false, "type": 1 }, + { + "name": "readFilePart", + "description": "Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the client has no direct access to TDLib's file system, because it is usually slower than a direct read from the file", + "class": "FilePart", + "properties": [ + { + "name": "file_id", + "type": "int32", + "description": "Identifier of the file. The file must be located in the TDLib file cache" + }, + { + "name": "offset", + "type": "int32", + "description": "The offset from which to read the file" + }, + { + "name": "count", + "type": "int32", + "description": "Number of bytes to read. An error will be returned if there are not enough bytes available in the file from the specified position. Pass 0 to read all available data from the specified position" + } + ], + "is_synchronous": false, + "type": 1 + }, { "name": "deleteFile", "description": "Deletes a file from the TDLib file cache", @@ -13619,7 +15483,7 @@ { "name": "query", "type": "string", - "description": "Query to search for; can be empty to return all contacts" + "description": "Query to search for; may be empty to return all contacts" }, { "name": "limit", @@ -13632,7 +15496,7 @@ }, { "name": "removeContacts", - "description": "Removes users from the contacts list", + "description": "Removes users from the contact list", "class": "Ok", "properties": [ { @@ -13668,7 +15532,7 @@ }, { "name": "clearImportedContacts", - "description": "Clears all imported contacts, contacts list remains unchanged", + "description": "Clears all imported contacts, contact list remains unchanged", "class": "Ok", "properties": [], "is_synchronous": false, @@ -14181,12 +16045,12 @@ { "name": "first_name", "type": "string", - "description": "The new value of the first name for the user; 1-255 characters" + "description": "The new value of the first name for the user; 1-64 characters" }, { "name": "last_name", "type": "string", - "description": "The new value of the optional last name for the user; 0-255 characters" + "description": "The new value of the optional last name for the user; 0-64 characters" } ], "is_synchronous": false, @@ -14459,44 +16323,6 @@ "is_synchronous": false, "type": 1 }, - { - "name": "pinSupergroupMessage", - "description": "Pins a message in a supergroup or channel; requires appropriate administrator rights in the supergroup or channel", - "class": "Ok", - "properties": [ - { - "name": "supergroup_id", - "type": "int32", - "description": "Identifier of the supergroup or channel" - }, - { - "name": "message_id", - "type": "int53", - "description": "Identifier of the new pinned message" - }, - { - "name": "disable_notification", - "type": "Bool", - "description": "True, if there should be no notification about the pinned message" - } - ], - "is_synchronous": false, - "type": 1 - }, - { - "name": "unpinSupergroupMessage", - "description": "Removes the pinned message from a supergroup or channel; requires appropriate administrator rights in the supergroup or channel", - "class": "Ok", - "properties": [ - { - "name": "supergroup_id", - "type": "int32", - "description": "Identifier of the supergroup or channel" - } - ], - "is_synchronous": false, - "type": 1 - }, { "name": "reportSupergroupSpam", "description": "Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup", @@ -14760,7 +16586,7 @@ }, { "name": "getLocalizationTargetInfo", - "description": "Returns information about the current localization target. This is an offline request if only_local is true", + "description": "Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization", "class": "LocalizationTargetInfo", "properties": [ { @@ -14772,9 +16598,23 @@ "is_synchronous": false, "type": 2 }, + { + "name": "getLanguagePackInfo", + "description": "Returns information about a language pack. Returned language pack identifier may be different from a provided one. Can be called before authorization", + "class": "LanguagePackInfo", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Language pack identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, { "name": "getLanguagePackStrings", - "description": "Returns strings from a language pack in the current localization target by their keys", + "description": "Returns strings from a language pack in the current localization target by their keys. Can be called before authorization", "class": "LanguagePackStrings", "properties": [ { @@ -14791,15 +16631,43 @@ "is_synchronous": false, "type": 2 }, + { + "name": "synchronizeLanguagePack", + "description": "Fetches the latest versions of all strings from a language pack in the current localization target from the server. This method doesn't need to be called explicitly for the current used/base language packs. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Language pack identifier" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "addCustomServerLanguagePack", + "description": "Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "language_pack_id", + "type": "string", + "description": "Identifier of a language pack to be added; may be different from a name that is used in an \"https://t.me/setlanguage/\" link" + } + ], + "is_synchronous": false, + "type": 2 + }, { "name": "setCustomLanguagePack", - "description": "Adds or changes a custom language pack to the current localization target", + "description": "Adds or changes a custom local 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" + "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. Can be called before authorization" }, { "name": "strings", @@ -14812,13 +16680,13 @@ }, { "name": "editCustomLanguagePackInfo", - "description": "Edits information about a custom language pack in the current localization target", + "description": "Edits information about a custom local language pack in the current localization target. Can be called before authorization", "class": "Ok", "properties": [ { "name": "info", "type": "languagePackInfo", - "description": "New information about the custom language pack" + "description": "New information about the custom local language pack" } ], "is_synchronous": false, @@ -14826,13 +16694,13 @@ }, { "name": "setCustomLanguagePackString", - "description": "Adds, edits or deletes a string in a custom language pack", + "description": "Adds, edits or deletes a string in a custom local language pack. Can be called before authorization", "class": "Ok", "properties": [ { "name": "language_pack_id", "type": "string", - "description": "Identifier of a previously added custom language pack in the current localization target" + "description": "Identifier of a previously added custom local language pack in the current localization target" }, { "name": "new_string", @@ -14845,7 +16713,7 @@ }, { "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", + "description": "Deletes all information about a language pack in the current localization target. The language pack which is currently in use (including base language pack) or is being synchronized can't be deleted. Can be called before authorization", "class": "Ok", "properties": [ { @@ -14859,8 +16727,8 @@ }, { "name": "registerDevice", - "description": "Registers the currently used device for receiving push notifications", - "class": "Ok", + "description": "Registers the currently used device for receiving push notifications. Returns a globally unique identifier of the push notification subscription", + "class": "PushReceiverId", "properties": [ { "name": "device_token", @@ -14870,12 +16738,40 @@ { "name": "other_user_ids", "type": "vector\u003cint32\u003e", - "description": "List of at most 100 user identifiers of other users currently using the client" + "description": "List of user identifiers of other users currently using the client" } ], "is_synchronous": false, "type": 2 }, + { + "name": "processPushNotification", + "description": "Handles a push notification. Returns error with code 406 if the push notification is not supported and connection to the server is required to fetch new data. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "payload", + "type": "string", + "description": "JSON-encoded push notification payload with all fields sent by the server, and \"google.sent_time\" and \"google.notification.sound\" fields added" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getPushReceiverId", + "description": "Returns a globally unique push notification subscription identifier for identification of an account, which has received a push notification. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "PushReceiverId", + "properties": [ + { + "name": "payload", + "type": "string", + "description": "JSON-encoded push notification payload" + } + ], + "is_synchronous": true, + "type": 1 + }, { "name": "getRecentlyVisitedTMeUrls", "description": "Returns t.me URLs recently visited by a newly registered user", @@ -15008,7 +16904,7 @@ }, { "name": "changeChatReportSpamState", - "description": "Used to let the server know whether a chat is spam or not. Can be used only if ChatReportSpamState.can_report_spam is true. After this request, ChatReportSpamState.can_report_spam becomes false forever", + "description": "Reports to the server whether a chat is a spam chat or not. Can be used only if ChatReportSpamState.can_report_spam is true. After this request, ChatReportSpamState.can_report_spam becomes false forever", "class": "Ok", "properties": [ { @@ -15049,9 +16945,33 @@ "is_synchronous": false, "type": 2 }, + { + "name": "getChatStatisticsUrl", + "description": "Returns URL with the chat statistics. Currently this method can be used only for channels", + "class": "HttpUrl", + "properties": [ + { + "name": "chat_id", + "type": "int53", + "description": "Chat identifier" + }, + { + "name": "parameters", + "type": "string", + "description": "Parameters from \"tg://statsrefresh?params=******\" link" + }, + { + "name": "is_dark", + "type": "Bool", + "description": "Pass true if a URL with the dark theme must be returned" + } + ], + "is_synchronous": false, + "type": 2 + }, { "name": "getStorageStatistics", - "description": "Returns storage usage statistics", + "description": "Returns storage usage statistics. Can be called before authorization", "class": "StorageStatistics", "properties": [ { @@ -15065,12 +16985,20 @@ }, { "name": "getStorageStatisticsFast", - "description": "Quickly returns approximate storage usage statistics", + "description": "Quickly returns approximate storage usage statistics. Can be called before authorization", "class": "StorageStatisticsFast", "properties": [], "is_synchronous": false, "type": 1 }, + { + "name": "getDatabaseStatistics", + "description": "Returns database statistics", + "class": "DatabaseStatistics", + "properties": [], + "is_synchronous": false, + "type": 1 + }, { "name": "optimizeStorage", "description": "Optimizes storage usage, i.e. deletes some files and returns new storage usage statistics. Secret thumbnails can't be deleted", @@ -15375,6 +17303,20 @@ "name": "nonce", "type": "string", "description": "Authorization form nonce provided by the service" + } + ], + "is_synchronous": false, + "type": 2 + }, + { + "name": "getPassportAuthorizationFormAvailableElements", + "description": "Returns already available Telegram Passport elements suitable for completing a Telegram Passport authorization form. Result can be received only once for each authorization form", + "class": "PassportElementsWithErrors", + "properties": [ + { + "name": "autorization_form_id", + "type": "int32", + "description": "Authorization form identifier" }, { "name": "password", @@ -15387,7 +17329,7 @@ }, { "name": "sendPassportAuthorizationForm", - "description": "Sends a Telegram Passport authorization form, effectively sharing data with the service", + "description": "Sends a Telegram Passport authorization form, effectively sharing data with the service. This method must be called after getPassportAuthorizationFormAvailableElements if some previously available elements need to be used", "class": "Ok", "properties": [ { @@ -15719,6 +17661,38 @@ "is_synchronous": false, "type": 1 }, + { + "name": "getApplicationConfig", + "description": "Returns application config, provided by the server. Can be called before authorization", + "class": "JsonValue", + "properties": [], + "is_synchronous": false, + "type": 2 + }, + { + "name": "saveApplicationLogEvent", + "description": "Saves application log event on the server. Can be called before authorization", + "class": "Ok", + "properties": [ + { + "name": "type", + "type": "string", + "description": "Event type" + }, + { + "name": "chat_id", + "type": "int53", + "description": "Optional chat identifier, associated with the event" + }, + { + "name": "data", + "type": "JsonValue", + "description": "The log event data" + } + ], + "is_synchronous": false, + "type": 2 + }, { "name": "addProxy", "description": "Adds a proxy server for network requests. Can be called before authorization", @@ -15854,9 +17828,113 @@ "is_synchronous": false, "type": 1 }, + { + "name": "setLogStream", + "description": "Sets new log stream for internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "Ok", + "properties": [ + { + "name": "log_stream", + "type": "LogStream", + "description": "New log stream" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getLogStream", + "description": "Returns information about currently used log stream for internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "LogStream", + "properties": [], + "is_synchronous": true, + "type": 1 + }, + { + "name": "setLogVerbosityLevel", + "description": "Sets the verbosity level of the internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "Ok", + "properties": [ + { + "name": "new_verbosity_level", + "type": "int32", + "description": "New value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1023 can be used to enable even more logging" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getLogVerbosityLevel", + "description": "Returns current verbosity level of the internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "LogVerbosityLevel", + "properties": [], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getLogTags", + "description": "Returns list of available TDLib internal log tags, for example, [\"actor\", \"binlog\", \"connections\", \"notifications\", \"proxy\"]. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "LogTags", + "properties": [], + "is_synchronous": true, + "type": 1 + }, + { + "name": "setLogTagVerbosityLevel", + "description": "Sets the verbosity level for a specified TDLib internal log tag. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "Ok", + "properties": [ + { + "name": "tag", + "type": "string", + "description": "Logging tag to change verbosity level" + }, + { + "name": "new_verbosity_level", + "type": "int32", + "description": "New verbosity level; 1-1024" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "getLogTagVerbosityLevel", + "description": "Returns current verbosity level for a specified TDLib internal log tag. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "LogVerbosityLevel", + "properties": [ + { + "name": "tag", + "type": "string", + "description": "Logging tag to change verbosity level" + } + ], + "is_synchronous": true, + "type": 1 + }, + { + "name": "addLogMessage", + "description": "Adds a message to TDLib internal log. This is an offline method. Can be called before authorization. Can be called synchronously", + "class": "Ok", + "properties": [ + { + "name": "verbosity_level", + "type": "int32", + "description": "Minimum verbosity level needed for the message to be logged, 0-1023" + }, + { + "name": "text", + "type": "string", + "description": "Text of a message to log" + } + ], + "is_synchronous": true, + "type": 1 + }, { "name": "testCallEmpty", - "description": "Does nothing; for testing only", + "description": "Does nothing; for testing only. This is an offline method. Can be called before authorization", "class": "Ok", "properties": [], "is_synchronous": false, @@ -15864,7 +17942,7 @@ }, { "name": "testCallString", - "description": "Returns the received string; for testing only", + "description": "Returns the received string; for testing only. This is an offline method. Can be called before authorization", "class": "TestString", "properties": [ { @@ -15878,7 +17956,7 @@ }, { "name": "testCallBytes", - "description": "Returns the received bytes; for testing only", + "description": "Returns the received bytes; for testing only. This is an offline method. Can be called before authorization", "class": "TestBytes", "properties": [ { @@ -15892,7 +17970,7 @@ }, { "name": "testCallVectorInt", - "description": "Returns the received vector of numbers; for testing only", + "description": "Returns the received vector of numbers; for testing only. This is an offline method. Can be called before authorization", "class": "TestVectorInt", "properties": [ { @@ -15906,7 +17984,7 @@ }, { "name": "testCallVectorIntObject", - "description": "Returns the received vector of objects containing a number; for testing only", + "description": "Returns the received vector of objects containing a number; for testing only. This is an offline method. Can be called before authorization", "class": "TestVectorIntObject", "properties": [ { @@ -15920,7 +17998,7 @@ }, { "name": "testCallVectorString", - "description": "For testing only request. Returns the received vector of strings; for testing only", + "description": "Returns the received vector of strings; for testing only. This is an offline method. Can be called before authorization", "class": "TestVectorString", "properties": [ { @@ -15934,7 +18012,7 @@ }, { "name": "testCallVectorStringObject", - "description": "Returns the received vector of objects containing a string; for testing only", + "description": "Returns the received vector of objects containing a string; for testing only. This is an offline method. Can be called before authorization", "class": "TestVectorStringObject", "properties": [ { @@ -15948,7 +18026,7 @@ }, { "name": "testSquareInt", - "description": "Returns the squared received number; for testing only", + "description": "Returns the squared received number; for testing only. This is an offline method. Can be called before authorization", "class": "TestInt", "properties": [ { @@ -15962,7 +18040,7 @@ }, { "name": "testNetwork", - "description": "Sends a simple network request to the Telegram servers; for testing only", + "description": "Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization", "class": "Ok", "properties": [], "is_synchronous": false, @@ -15978,7 +18056,7 @@ }, { "name": "testUseUpdate", - "description": "Does nothing and ensures that the Update object is used; for testing only", + "description": "Does nothing and ensures that the Update object is used; for testing only. This is an offline method. Can be called before authorization", "class": "Update", "properties": [], "is_synchronous": false, @@ -15986,7 +18064,7 @@ }, { "name": "testUseError", - "description": "Does nothing and ensures that the Error object is used; for testing only", + "description": "Does nothing and ensures that the Error object is used; for testing only. This is an offline method. Can be called before authorization", "class": "Error", "properties": [], "is_synchronous": false, diff --git a/data/td_api.tl b/data/td_api.tl index dcb1e0b..c758b8e 100644 --- a/data/td_api.tl +++ b/data/td_api.tl @@ -91,7 +91,7 @@ authorizationStateWaitPhoneNumber = 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 +//@description The user has been authorized, but needs to enter a password to start using the application @password_hint Hint for the password; may 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 authorizationStateWaitPassword password_hint:string has_recovery_email_address:Bool recovery_email_address_pattern:string = AuthorizationState; @@ -109,8 +109,10 @@ authorizationStateClosing = AuthorizationState; authorizationStateClosed = AuthorizationState; -//@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 Represents the current state of 2-step verification @has_password True, if a 2-step verification password is set @password_hint Hint for the password; may be empty +//@has_recovery_email_address True, if a recovery email is set @has_passport_data True, if some Telegram Passport elements were saved +//@recovery_email_address_code_info Information about the recovery email address to which the confirmation email was sent; may be null +passwordState has_password:Bool password_hint:string has_recovery_email_address:Bool has_passport_data:Bool recovery_email_address_code_info:emailAddressAuthenticationCodeInfo = PasswordState; //@description Contains information about the current recovery email address @recovery_email_address Recovery email address recoveryEmailAddress recovery_email_address:string = RecoveryEmailAddress; @@ -126,9 +128,10 @@ temporaryPasswordState has_password:Bool valid_for:int32 = TemporaryPasswordStat //@can_be_deleted True, if the file can be deleted //@is_downloading_active True, if the file is currently being downloaded (or a local copy is being generated by some other means) //@is_downloading_completed True, if the local copy is fully available -//@downloaded_prefix_size If is_downloading_completed is false, then only some prefix of the file is ready to be read. downloaded_prefix_size is the size of that prefix +//@download_offset Download will be started from this offset. downloaded_prefix_size is calculated from this offset +//@downloaded_prefix_size If is_downloading_completed is false, then only some prefix of the file starting from download_offset is ready to be read. downloaded_prefix_size is the size of that prefix //@downloaded_size Total downloaded file bytes. Should be used only for calculating download progress. The actual file size may be bigger, and some parts of it may contain garbage -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; +localFile path:string can_be_downloaded:Bool can_be_deleted:Bool is_downloading_active:Bool is_downloading_completed:Bool download_offset:int32 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. @@ -158,7 +161,9 @@ 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. Conversions beginning with '#' are reserved for internal TDLib usage +//@expected_size Expected size of the generated file; 0 if unknown inputFileGenerated original_path:string conversion:string expected_size:int32 = InputFile; @@ -187,6 +192,11 @@ maskPointChin = MaskPoint; maskPosition point:MaskPoint x_shift:double y_shift:double scale:double = MaskPosition; +//@description Describes one answer option of a poll @text Option text, 1-100 characters @voter_count Number of voters for this option, available only for closed or voted polls @vote_percentage The percentage of votes for this option, 0-100 +//@is_chosen True, if the option was chosen by the user @is_being_chosen True, if the option is being chosen by a pending setPollAnswer request +pollOption text:string voter_count:int32 vote_percentage:int32 is_chosen:Bool is_being_chosen:Bool = PollOption; + + //@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; @@ -199,8 +209,8 @@ audio duration:int32 title:string performer:string file_name:string mime_type:st //@thumbnail Document thumbnail; as defined by the sender; may be null @document File containing the document document file_name:string mime_type:string thumbnail:photoSize document:file = Document; -//@description Describes a photo @id Photo identifier; 0 for deleted photos @has_stickers True, if stickers were added to the photo @sizes Available variants of the photo, in different sizes -photo id:int64 has_stickers:Bool sizes:vector = Photo; +//@description Describes a photo @has_stickers True, if stickers were added to the photo @sizes Available variants of the photo, in different sizes +photo has_stickers:Bool sizes:vector = Photo; //@description Describes a sticker @set_id The identifier of the sticker set to which the sticker belongs; 0 if none @width Sticker width; as defined by the sender @height Sticker height; as defined by the sender //@emoji Emoji corresponding to the sticker @is_mask True, if the sticker is a mask @mask_position Position where the mask should be placed; may be null @thumbnail Sticker thumbnail in WEBP or JPEG format; may be null @sticker File containing the sticker @@ -232,6 +242,9 @@ venue location:location title:string address:string provider:string id:string ty //@param_description Game description @photo Game photo @animation Game animation; may be null game id:int64 short_name:string title:string text:formattedText description:string photo:photo animation:animation = Game; +//@description Describes a poll @id Unique poll identifier @question Poll question, 1-255 characters @options List of poll answer options @total_voter_count Total number of voters, participating in the poll @is_closed True, if the poll is closed +poll id:int64 question:string options:vector total_voter_count:int32 is_closed:Bool = Poll; + //@description Describes a user profile photo @id Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of userProfilePhotos //@small A small (160x160) user profile photo @big A big (640x640) user profile photo @@ -246,10 +259,10 @@ chatPhoto small:file big:file = ChatPhoto; //@description The phone number of user A is not known to user B linkStateNone = LinkState; -//@description The phone number of user A is known but that number has not been saved to the contacts list of user B +//@description The phone number of user A is known but that number has not been saved to the contact list of user B linkStateKnowsPhoneNumber = LinkState; -//@description The phone number of user A has been saved to the contacts list of user B +//@description The phone number of user A has been saved to the contact list of user B linkStateIsContact = LinkState; @@ -279,17 +292,22 @@ botInfo description:string commands:vector = BotInfo; //@description Represents a user @id User identifier @first_name First name of the user @last_name Last name of the user @username Username of the user //@phone_number Phone number of the user @status Current online status of the user @profile_photo Profile photo of the user; may be null -//@outgoing_link Relationship from the current user to the other user @incoming_link Relationship from the other user to the current user @is_verified True, if the user is verified @restriction_reason If non-empty, it contains the reason why access to this user must be restricted. The format of the string is "{type}: {description}". +//@outgoing_link Relationship from the current user to the other user @incoming_link Relationship from the other user to the current user +//@is_verified True, if the user is verified @is_support True, if the user is Telegram support account +//@restriction_reason If non-empty, it contains the reason why access to this user must be restricted. The format of the string is "{type}: {description}". //-{type} contains the type of the restriction and at least one of the suffixes "-all", "-ios", "-android", or "-wp", which describe the platforms on which access should be restricted. (For example, "terms-ios-android". {description} contains a human-readable description of the restriction, which can be shown to the user) //@have_access If false, the user is inaccessible, and the only information known about the user is inside this class. It can't be passed to any method except GetUser @type Type of the user @language_code IETF language tag of the user's language; only available to bots -user id:int32 first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto outgoing_link:LinkState incoming_link:LinkState is_verified:Bool restriction_reason:string have_access:Bool type:UserType language_code:string = User; +user id:int32 first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto outgoing_link:LinkState incoming_link:LinkState is_verified:Bool is_support:Bool restriction_reason:string have_access:Bool type:UserType language_code:string = User; //@description Contains full information about a user (except the full list of profile photos) @is_blocked True, if the user is blacklisted by the current user @can_be_called True, if the user can be called @has_private_calls True, if the user can't be called due to their privacy settings //@bio A short user bio @share_text For bots, the text that is included with the link when users share the bot @group_in_common_count Number of group chats where both the other user and the current user are a member; 0 for the current user @bot_info If the user is a bot, information about the bot; may be null userFullInfo is_blocked:Bool can_be_called:Bool has_private_calls:Bool bio:string share_text:string group_in_common_count:int32 bot_info:botInfo = UserFullInfo; +//@description Contains full information about a user profile photo @id Unique user profile photo identifier @added_date Point in time (Unix timestamp) when the photo has been added @sizes Available variants of the user photo, in different sizes +userProfilePhoto id:int64 added_date:int32 sizes:vector = UserProfilePhoto; + //@description Contains part of the list of user photos @total_count Total number of user profile photos @photos A list of photos -userProfilePhotos total_count:int32 photos:vector = UserProfilePhotos; +userProfilePhotos total_count:int32 photos:vector = UserProfilePhotos; //@description Represents a list of users @total_count Approximate total count of users found @user_ids A list of user identifiers users total_count:int32 user_ids:vector = Users; @@ -308,7 +326,7 @@ chatMemberStatusCreator is_member:Bool = ChatMemberStatus; //@can_delete_messages True, if the administrator can delete messages of other users //@can_invite_users True, if the administrator can invite new users to the chat //@can_restrict_members True, if the administrator can restrict, ban, or unban chat members -//@can_pin_messages True, if the administrator can pin messages; applicable to supergroups only +//@can_pin_messages True, if the administrator can pin messages; applicable to groups only //@can_promote_members True, if the administrator can add new administrators with a subset of his own privileges or demote administrators that were directly or indirectly promoted by him chatMemberStatusAdministrator can_be_edited:Bool can_change_info:Bool can_post_messages:Bool can_edit_messages:Bool can_delete_messages:Bool can_invite_users:Bool can_restrict_members:Bool can_pin_messages:Bool can_promote_members:Bool = ChatMemberStatus; @@ -415,13 +433,13 @@ supergroup id:int32 username:string date:int32 status:ChatMemberStatus member_co //@can_get_members True, if members of the chat can be retrieved //@can_set_username True, if the chat can be made public //@can_set_sticker_set True, if the supergroup sticker set can be changed +//@can_view_statistics True, if the channel statistics is available through getChatStatisticsUrl //@is_all_history_available True, if new chat members will have access to old messages. In public supergroups and both public and private channels, old messages are always available, so this option affects only private supergroups. The value of this field is only available for chat administrators //@sticker_set_id Identifier of the supergroup sticker set; 0 if none //@invite_link Invite link for this chat -//@pinned_message_id Identifier of the pinned message in the chat; 0 if none //@upgraded_from_basic_group_id Identifier of the basic group from which supergroup was upgraded; 0 if none //@upgraded_from_max_message_id Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none -supergroupFullInfo description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 can_get_members:Bool can_set_username:Bool can_set_sticker_set:Bool is_all_history_available:Bool sticker_set_id:int64 invite_link:string pinned_message_id:int53 upgraded_from_basic_group_id:int32 upgraded_from_max_message_id:int53 = SupergroupFullInfo; +supergroupFullInfo description:string member_count:int32 administrator_count:int32 restricted_count:int32 banned_count:int32 can_get_members:Bool can_set_username:Bool can_set_sticker_set:Bool can_view_statistics:Bool is_all_history_available:Bool sticker_set_id:int64 invite_link:string upgraded_from_basic_group_id:int32 upgraded_from_max_message_id:int53 = SupergroupFullInfo; //@class SecretChatState @description Describes the current secret chat state @@ -448,18 +466,27 @@ secretChatStateClosed = SecretChatState; secretChat id:int32 user_id:int32 state:SecretChatState is_outbound:Bool ttl:int32 key_hash:bytes layer:int32 = SecretChat; -//@class MessageForwardInfo @description Contains information about the initial sender of a forwarded message +//@class MessageForwardOrigin @description Contains information about the origin of a forwarded message -//@description The message was originally written by a known user @sender_user_id Identifier of the user that originally sent this message @date Point in time (Unix timestamp) when the message was originally sent -//@forwarded_from_chat_id For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown -//@forwarded_from_message_id For messages forwarded to the chat with the current user (saved messages) the identifier of the original message from which the new message was forwarded; 0 if unknown -messageForwardedFromUser sender_user_id:int32 date:int32 forwarded_from_chat_id:int53 forwarded_from_message_id:int53 = MessageForwardInfo; +//@description The message was originally written by a known user @sender_user_id Identifier of the user that originally sent the message +messageForwardOriginUser sender_user_id:int32 = MessageForwardOrigin; -//@description The message was originally a post in a channel @chat_id Identifier of the chat from which the message was forwarded @author_signature Post author signature -//@date Point in time (Unix timestamp) when the message was originally sent @message_id Message identifier of the original message from which the new message was forwarded; 0 if unknown -//@forwarded_from_chat_id For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded; 0 if unknown -//@forwarded_from_message_id For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded; 0 if unknown -messageForwardedPost chat_id:int53 author_signature:string date:int32 message_id:int53 forwarded_from_chat_id:int53 forwarded_from_message_id:int53 = MessageForwardInfo; +//@description The message was originally written by a user, which is hidden by his privacy settings @sender_name Name of the sender +messageForwardOriginHiddenUser sender_name:string = MessageForwardOrigin; + +//@description The message was originally a post in a channel +//@chat_id Identifier of the chat from which the message was originally forwarded +//@message_id Message identifier of the original message; 0 if unknown +//@author_signature Original post author signature +messageForwardOriginChannel chat_id:int53 message_id:int53 author_signature:string = MessageForwardOrigin; + + +//@description Contains information about a forwarded message +//@origin Origin of a forwarded message +//@date Point in time (Unix timestamp) when the message was originally sent +//@from_chat_id For messages forwarded to the chat with the current user (saved messages), the identifier of the chat from which the message was forwarded last time; 0 if unknown +//@from_message_id For messages forwarded to the chat with the current user (saved messages), the identifier of the original message from which the new message was forwarded last time; 0 if unknown +messageForwardInfo origin:MessageForwardOrigin date:int32 from_chat_id:int53 from_message_id:int53 = MessageForwardInfo; //@class MessageSendingState @description Contains information about the sending state of the message @@ -477,7 +504,7 @@ messageSendingStateFailed = MessageSendingState; //@chat_id Chat identifier //@sending_state Information about the sending state of the message; may be null //@is_outgoing True, if the message is outgoing -//@can_be_edited True, if the message can be edited +//@can_be_edited True, if the message can be edited. For live location and poll messages this fields shows, whether editMessageLiveLocation or stopPoll can be used with this message by the client //@can_be_forwarded True, if the message can be forwarded //@can_be_deleted_only_for_self True, if the message can be deleted only for the current user while other users will continue to see it //@can_be_deleted_for_all_users True, if the message can be deleted for all users @@ -495,7 +522,7 @@ messageSendingStateFailed = MessageSendingState; //@media_album_id Unique identifier of an album this message belongs to. Only photos and videos can be grouped together in albums //@content Content of the message //@reply_markup Reply markup for the message; may be null -message id:int53 sender_user_id:int32 chat_id:int53 sending_state:MessageSendingState is_outgoing:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:MessageForwardInfo reply_to_message_id:int53 ttl:int32 ttl_expires_in:double via_bot_user_id:int32 author_signature:string views:int32 media_album_id:int64 content:MessageContent reply_markup:ReplyMarkup = Message; +message id:int53 sender_user_id:int32 chat_id:int53 sending_state:MessageSendingState is_outgoing:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool is_channel_post:Bool contains_unread_mention:Bool date:int32 edit_date:int32 forward_info:messageForwardInfo reply_to_message_id:int53 ttl:int32 ttl_expires_in:double via_bot_user_id:int32 author_signature:string views:int32 media_album_id:int64 content:MessageContent reply_markup:ReplyMarkup = Message; //@description Contains a list of messages @total_count Approximate total count of messages found @messages List of messages; messages may be null messages total_count:int32 messages:vector = Messages; @@ -509,19 +536,28 @@ foundMessages messages:vector next_from_search_id:int64 = FoundMessages //@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, supergroups and channels when the corresponding chat setting has a default value +//@description Notification settings applied to all basic groups and supergroups when the corresponding chat setting has a default value notificationSettingsScopeGroupChats = NotificationSettingsScope; +//@description Notification settings applied to all channels when the corresponding chat setting has a default value +notificationSettingsScopeChannelChats = NotificationSettingsScope; + //@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; +//@use_default_disable_pinned_message_notifications If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat is used instead @disable_pinned_message_notifications If true, notifications for incoming pinned messages will be created as for an ordinary unread message +//@use_default_disable_mention_notifications If true, disable_mention_notifications is ignored and the value for the relevant type of chat is used instead @disable_mention_notifications If true, notifications for messages with mentions will be created as for an ordinary unread message +chatNotificationSettings use_default_mute_for:Bool mute_for:int32 use_default_sound:Bool sound:string use_default_show_preview:Bool show_preview:Bool use_default_disable_pinned_message_notifications:Bool disable_pinned_message_notifications:Bool use_default_disable_mention_notifications:Bool disable_mention_notifications: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 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 +//@disable_pinned_message_notifications True, if notifications for incoming pinned messages will be created as for an ordinary unread message +//@disable_mention_notifications True, if notifications for messages with mentions will be created as for an ordinary unread message +scopeNotificationSettings mute_for:int32 sound:string show_preview:Bool disable_pinned_message_notifications:Bool disable_mention_notifications: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 @@ -553,6 +589,8 @@ chatTypeSecret secret_chat_id:int32 user_id:int32 = ChatType; //@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_deleted_only_for_self True, if the chat messages can be deleted only for the current user while other users will continue to see the messages +//@can_be_deleted_for_all_users True, if the chat messages can be deleted for all users //@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 @@ -560,10 +598,11 @@ chatTypeSecret secret_chat_id:int32 user_id:int32 = ChatType; //@last_read_outbox_message_id Identifier of the last read outgoing message //@unread_mention_count Number of unread messages with a mention/reply in the chat //@notification_settings Notification settings for this chat +//@pinned_message_id Identifier of the pinned message in the chat; 0 if none //@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 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; +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_deleted_only_for_self:Bool can_be_deleted_for_all_users: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 pinned_message_id:int53 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; @@ -669,10 +708,68 @@ richTextUrl text:RichText url:string = RichText; //@description A rich text email link @text Text @email_address Email address richTextEmailAddress text:RichText email_address:string = RichText; +//@description A subscript rich text @text Text +richTextSubscript text:RichText = RichText; + +//@description A superscript rich text @text Text +richTextSuperscript text:RichText = RichText; + +//@description A marked rich text @text Text +richTextMarked text:RichText = RichText; + +//@description A rich text phone number @text Text @phone_number Phone number +richTextPhoneNumber text:RichText phone_number:string = RichText; + +//@description A small image inside the text @document The image represented as a document. The image can be in GIF, JPEG or PNG format +//@width Width of a bounding box in which the image should be shown, 0 if unknown +//@height Height of a bounding box in which the image should be shown, 0 if unknown +richTextIcon document:document width:int32 height:int32 = RichText; + +//@description A rich text anchor @text Text @name Anchor name +richTextAnchor text:RichText name:string = RichText; + //@description A concatenation of rich texts @texts Texts richTexts texts:vector = RichText; +//@description Contains a caption of an instant view web page block, consisting of a text and a trailing credit @text Content of the caption @credit Block credit (like HTML tag ) +pageBlockCaption text:RichText credit:RichText = PageBlockCaption; + +//@description Describes an item of a list page block @label Item label @page_blocks Item blocks +pageBlockListItem label:string page_blocks:vector = PageBlockListItem; + +//@class PageBlockHorizontalAlignment @description Describes a horizontal alignment of a table cell content + +//@description The content should be left-aligned +pageBlockHorizontalAlignmentLeft = PageBlockHorizontalAlignment; + +//@description The content should be center-aligned +pageBlockHorizontalAlignmentCenter = PageBlockHorizontalAlignment; + +//@description The content should be right-aligned +pageBlockHorizontalAlignmentRight = PageBlockHorizontalAlignment; + +//@class PageBlockVerticalAlignment @description Describes a Vertical alignment of a table cell content + +//@description The content should be top-aligned +pageBlockVerticalAlignmentTop = PageBlockVerticalAlignment; + +//@description The content should be middle-aligned +pageBlockVerticalAlignmentMiddle = PageBlockVerticalAlignment; + +//@description The content should be bottom-aligned +pageBlockVerticalAlignmentBottom = PageBlockVerticalAlignment; + +//@description Represents a cell of a table @text Cell text @is_header True, if it is a header cell +//@colspan The number of columns the cell should span @rowspan The number of rows the cell should span +//@align Horizontal cell content alignment @valign Vertical cell content alignment +pageBlockTableCell text:RichText is_header:Bool colspan:int32 rowspan:int32 align:PageBlockHorizontalAlignment valign:PageBlockVerticalAlignment = PageBlockTableCell; + +//@description Contains information about a related article @url Related article URL @title Article title; may be empty @param_description Article description; may be empty +//@photo Article photo; may be null @author Article author; may be empty @publish_date Point in time (Unix timestamp) when the article was published; 0 if unknown +pageBlockRelatedArticle url:string title:string description:string photo:photo author:string publish_date:int32 = PageBlockRelatedArticle; + + //@class PageBlock @description Describes a block of an instant view web page //@description The title of a page @title Title @@ -690,6 +787,9 @@ pageBlockHeader header:RichText = PageBlock; //@description A subheader @subheader Subheader pageBlockSubheader subheader:RichText = PageBlock; +//@description A kicker @kicker Kicker +pageBlockKicker kicker:RichText = PageBlock; + //@description A text paragraph @text Paragraph text pageBlockParagraph text:RichText = PageBlock; @@ -705,48 +805,64 @@ pageBlockDivider = PageBlock; //@description An invisible anchor on a page, which can be used in a URL to open the page from the specified anchor @name Name of the anchor pageBlockAnchor name:string = PageBlock; -//@description A list of texts @items Texts @is_ordered True, if the items should be marked with numbers -pageBlockList items:vector is_ordered:Bool = PageBlock; +//@description A list of data blocks @items The items of the list +pageBlockList items:vector = PageBlock; -//@description A block quote @text Quote text @caption Quote caption -pageBlockBlockQuote text:RichText caption:RichText = PageBlock; +//@description A block quote @text Quote text @credit Quote credit +pageBlockBlockQuote text:RichText credit:RichText = PageBlock; -//@description A pull quote @text Quote text @caption Quote caption -pageBlockPullQuote text:RichText caption:RichText = PageBlock; +//@description A pull quote @text Quote text @credit Quote credit +pageBlockPullQuote text:RichText credit:RichText = PageBlock; //@description An animation @animation Animation file; may be null @caption Animation caption @need_autoplay True, if the animation should be played automatically -pageBlockAnimation animation:animation caption:RichText need_autoplay:Bool = PageBlock; +pageBlockAnimation animation:animation caption:pageBlockCaption need_autoplay:Bool = PageBlock; //@description An audio file @audio Audio file; may be null @caption Audio file caption -pageBlockAudio audio:audio caption:RichText = PageBlock; +pageBlockAudio audio:audio caption:pageBlockCaption = PageBlock; -//@description A photo @photo Photo file; may be null @caption Photo caption -pageBlockPhoto photo:photo caption:RichText = PageBlock; +//@description A photo @photo Photo file; may be null @caption Photo caption @url URL that needs to be opened when the photo is clicked +pageBlockPhoto photo:photo caption:pageBlockCaption url:string = PageBlock; //@description A video @video Video file; may be null @caption Video caption @need_autoplay True, if the video should be played automatically @is_looped True, if the video should be looped -pageBlockVideo video:video caption:RichText need_autoplay:Bool is_looped:Bool = PageBlock; +pageBlockVideo video:video caption:pageBlockCaption need_autoplay:Bool is_looped:Bool = PageBlock; //@description A page cover @cover Cover pageBlockCover cover:PageBlock = PageBlock; -//@description An embedded web page @url Web page URL, if available @html HTML-markup of the embedded page @poster_photo Poster photo, if available; may be null @width Block width @height Block height @caption Block caption @is_full_width True, if the block should be full width @allow_scrolling True, if scrolling should be allowed -pageBlockEmbedded url:string html:string poster_photo:photo width:int32 height:int32 caption:RichText is_full_width:Bool allow_scrolling:Bool = PageBlock; +//@description An embedded web page @url Web page URL, if available @html HTML-markup of the embedded page @poster_photo Poster photo, if available; may be null @width Block width, 0 if unknown @height Block height, 0 if unknown @caption Block caption @is_full_width True, if the block should be full width @allow_scrolling True, if scrolling should be allowed +pageBlockEmbedded url:string html:string poster_photo:photo width:int32 height:int32 caption:pageBlockCaption is_full_width:Bool allow_scrolling:Bool = PageBlock; //@description An embedded post @url Web page URL @author Post author @author_photo Post author photo @date Point in time (Unix timestamp) when the post was created; 0 if unknown @page_blocks Post content @caption Post caption -pageBlockEmbeddedPost url:string author:string author_photo:photo date:int32 page_blocks:vector caption:RichText = PageBlock; +pageBlockEmbeddedPost url:string author:string author_photo:photo date:int32 page_blocks:vector caption:pageBlockCaption = PageBlock; //@description A collage @page_blocks Collage item contents @caption Block caption -pageBlockCollage page_blocks:vector caption:RichText = PageBlock; +pageBlockCollage page_blocks:vector caption:pageBlockCaption = PageBlock; //@description A slideshow @page_blocks Slideshow item contents @caption Block caption -pageBlockSlideshow page_blocks:vector caption:RichText = PageBlock; +pageBlockSlideshow page_blocks:vector caption:pageBlockCaption = PageBlock; //@description A link to a chat @title Chat title @photo Chat photo; may be null @username Chat username, by which all other information about the chat should be resolved pageBlockChatLink title:string photo:chatPhoto username:string = PageBlock; +//@description A table @caption Table caption @cells Table cells @is_bordered True, if the table is bordered @is_striped True, if the table is striped +pageBlockTable caption:RichText cells:vector> is_bordered:Bool is_striped:Bool = PageBlock; -//@description Describes an instant view page for a web page @page_blocks Content of the web page @is_full True, if the instant view contains the full page. A network request might be needed to get the full web page instant view -webPageInstantView page_blocks:vector is_full:Bool = WebPageInstantView; +//@description A collapsible block @header Always visible heading for the block @page_blocks Block contents @is_open True, if the block is open by default +pageBlockDetails header:RichText page_blocks:vector is_open:Bool = PageBlock; + +//@description Related articles @header Block header @articles List of related articles +pageBlockRelatedArticles header:RichText articles:vector = PageBlock; + +//@description A map @location Location of the map center @zoom Map zoom level @width Map width @height Map height @caption Block caption +pageBlockMap location:location zoom:int32 width:int32 height:int32 caption:pageBlockCaption = PageBlock; + + +//@description Describes an instant view page for a web page @page_blocks Content of the web page +//@version Version of the instant view, currently can be 1 or 2 +//@url Instant view URL; may be different from WebPage.url and must be used for the correct anchors handling +//@is_rtl True, if the instant view must be shown from right to left +//@is_full True, if the instant view contains the full page. A network request might be needed to get the full web page instant view +webPageInstantView page_blocks:vector version:int32 url:string is_rtl:Bool is_full:Bool = WebPageInstantView; //@description Describes a web page preview @url Original URL of the link @display_url URL to display @@ -766,8 +882,8 @@ webPageInstantView page_blocks:vector is_full:Bool = WebPageInstantVi //@video Preview of the content as a video, if available; may be null //@video_note Preview of the content as a video note, if available; may be null //@voice_note Preview of the content as a voice note, if available; may be null -//@has_instant_view True, if the web page has an instant view -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; +//@instant_view_version Version of instant view, available for the web page (currently can be 1 or 2), 0 if none +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 instant_view_version:int32 = 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 @@ -999,14 +1115,14 @@ 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 One of files with the translation of the document contains an error. The error will be considered resolved when the file changes @file_index Index of a file with the error +passportElementErrorSourceTranslationFile file_index:int32 = 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 file contains an error. The error will be considered resolved when the file changes @file_index Index of a file with the error +passportElementErrorSourceFile file_index:int32 = PassportElementErrorSource; //@description The list of attached files contains an error. The error will be considered resolved when the list of files changes passportElementErrorSourceFiles = PassportElementErrorSource; @@ -1024,9 +1140,12 @@ passportSuitableElement type:PassportElementType is_selfie_required:Bool is_tran 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; +//@required_elements Information about the Telegram Passport elements that need to be provided to complete the form +//@privacy_policy_url URL for the privacy policy of the service; may be empty +passportAuthorizationForm id:int32 required_elements:vector privacy_policy_url:string = PassportAuthorizationForm; + +//@description Contains information about a Telegram Passport elements and corresponding errors @elements Telegram Passport elements @errors Errors in the elements that are already available +passportElementsWithErrors elements:vector errors:vector = PassportElementsWithErrors; //@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 @@ -1119,6 +1238,9 @@ messageContact contact:contact = MessageContent; //@description A message with a game @game Game messageGame game:game = MessageContent; +//@description A message with a poll @poll Poll +messagePoll poll:poll = MessageContent; + //@description A message with an invoice from a bot @title Product title @param_description Product description @photo Product photo; may be null @currency Currency for the product price @total_amount Product total price in the minimal quantity of the currency //@start_parameter Unique invoice bot start_parameter. To share an invoice use the URL https://t.me/{bot_username}?start={start_parameter} @is_test True, if the invoice is a test invoice //@need_shipping_address True, if the shipping address should be specified @receipt_message_id The identifier of the message with the receipt, after the product has been purchased @@ -1157,7 +1279,7 @@ messageChatUpgradeTo supergroup_id:int32 = MessageContent; //@description A supergroup has been created from a basic group @title Title of the newly created supergroup @basic_group_id The identifier of the original basic group messageChatUpgradeFrom title:string basic_group_id:int32 = MessageContent; -//@description A message has been pinned @message_id Identifier of the pinned message, can be an identifier of a deleted message +//@description A message has been pinned @message_id Identifier of the pinned message, can be an identifier of a deleted message or 0 messagePinMessage message_id:int53 = MessageContent; //@description A screenshot of a message in the chat has been taken @@ -1169,7 +1291,7 @@ messageChatSetTtl ttl:int32 = MessageContent; //@description A non-standard action has happened in the chat @text Message text to be shown in the chat messageCustomServiceAction text:string = MessageContent; -//@description A new high score was achieved in a game @game_message_id Identifier of the message with the game, can be an identifier of a deleted message @game_id Identifier of the game, may be different from the games presented in the message with the game @score New score +//@description A new high score was achieved in a game @game_message_id Identifier of the message with the game, can be an identifier of a deleted message @game_id Identifier of the game; may be different from the games presented in the message with the game @score New score messageGameScore game_message_id:int53 game_id:int64 score:int32 = MessageContent; //@description A payment has been completed @invoice_message_id Identifier of the message with the corresponding invoice; can be an identifier of a deleted message @currency Currency for the price of the product @total_amount Total price for the product, in the minimal quantity of the currency @@ -1242,7 +1364,7 @@ textEntityTypePhoneNumber = TextEntityType; //@description A thumbnail to be sent along with a file; should be in JPEG or WEBP format for stickers, and less than 200 kB in size @thumbnail Thumbnail file to send. Sending thumbnails by file_id is currently not supported -//@width Thumbnail width, usually shouldn't exceed 90. Use 0 if unknown @height Thumbnail height, usually shouldn't exceed 90. Use 0 if unknown +//@width Thumbnail width, usually shouldn't exceed 320. Use 0 if unknown @height Thumbnail height, usually shouldn't exceed 320. Use 0 if unknown inputThumbnail thumbnail:InputFile width:int32 height:int32 = InputThumbnail; @@ -1296,6 +1418,9 @@ inputMessageGame bot_user_id:int32 game_short_name:string = InputMessageContent; //@payload The invoice payload @provider_token Payment provider token @provider_data JSON-encoded data about the invoice, which will be shared with the payment provider @start_parameter Unique invoice bot start_parameter for the generation of this invoice inputMessageInvoice invoice:invoice title:string description:string photo_url:string photo_size:int32 photo_width:int32 photo_height:int32 payload:bytes provider_token:string provider_data:string start_parameter:string = InputMessageContent; +//@description A message with a poll. Polls can't be sent to private or secret chats @question Poll question, 1-255 characters @options List of poll answer options, 2-10 strings 1-100 characters each +inputMessagePoll question:string options:vector = InputMessageContent; + //@description A forwarded message @from_chat_id Identifier for the chat this forwarded message came from @message_id Identifier of the message to forward @in_game_share True, if a game message should be shared within a launched game; applies only to game messages inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool = InputMessageContent; @@ -1347,7 +1472,7 @@ searchMessagesFilterVoiceAndVideoNote = SearchMessagesFilter; //@description Returns only messages with mentions of the current user, or messages that are replies to their messages searchMessagesFilterMention = SearchMessagesFilter; -//@description Returns only messages with unread mentions of the current user or messages that are replies to their messages. When using this filter the results can't be additionally filtered by a query or by the sending user +//@description Returns only messages with unread mentions of the current user, or messages that are replies to their messages. When using this filter the results can't be additionally filtered by a query or by the sending user searchMessagesFilterUnreadMention = SearchMessagesFilter; @@ -1459,8 +1584,8 @@ callStatePending is_created:Bool is_received:Bool = CallState; //@description The call has been answered and encryption keys are being exchanged callStateExchangingKeys = CallState; -//@description The call is ready to use @protocol Call protocols supported by the peer @connections Available UDP reflectors @config A JSON-encoded call config @encryption_key Call encryption key @emojis Encryption key emojis fingerprint -callStateReady protocol:callProtocol connections:vector config:string encryption_key:bytes emojis:vector = CallState; +//@description The call is ready to use @protocol Call protocols supported by the peer @connections Available UDP reflectors @config A JSON-encoded call config @encryption_key Call encryption key @emojis Encryption key emojis fingerprint @allow_p2p True, if peer-to-peer connection is allowed by users privacy settings +callStateReady protocol:callProtocol connections:vector config:string encryption_key:bytes emojis:vector allow_p2p:Bool = CallState; //@description The call is hanging up after discardCall has been called callStateHangingUp = CallState; @@ -1485,6 +1610,10 @@ animations animations:vector = Animations; importedContacts user_ids:vector importer_count:vector = ImportedContacts; +//@description Contains an HTTP URL @url The URL +httpUrl url:string = HttpUrl; + + //@class InputInlineQueryResult @description Represents a single result of an inline query; for bots only //@description Represents a link to an animated GIF @id Unique identifier of the query result @title Title of the query result @thumbnail_url URL of the static result thumbnail (JPEG or GIF), if it exists @@ -1708,7 +1837,8 @@ chatEventLogFilters message_edits:Bool message_deletions:Bool message_pins:Bool //@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 +//@description A language pack string which has different forms based on the number of some object it mentions. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more info +//@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; @@ -1722,23 +1852,30 @@ 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 a language pack @id Unique language pack identifier +//@base_language_pack_id Identifier of a base language pack; may be empty. If a string is missed in the language pack, then it should be fetched from base language pack. Unsupported in custom language packs +//@name Language name @native_name Name of the language in that language +//@plural_code A language code to be used to apply plural forms. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more info +//@is_official True, if the language pack is official @is_rtl True, if the language pack strings are RTL @is_beta True, if the language pack is a beta language pack +//@is_installed True, if the language pack is installed by the current user +//@total_string_count Total number of non-deleted strings from the language pack @translated_string_count Total number of translated strings from the language pack +//@local_string_count Total number of non-deleted strings from the language pack available locally @translation_url Link to language translation interface; empty for custom local language packs +languagePackInfo id:string base_language_pack_id:string name:string native_name:string plural_code:string is_official:Bool is_rtl:Bool is_beta:Bool is_installed:Bool total_string_count:int32 translated_string_count:int32 local_string_count:int32 translation_url:string = 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 +//@class DeviceToken @description Represents a data needed to subscribe for push notifications through registerDevice method. 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 -deviceTokenGoogleCloudMessaging token:string = DeviceToken; +//@description A token for Firebase Cloud Messaging @token Device registration token; may be empty to de-register a device @encrypt True, if push notifications should be additionally encrypted +deviceTokenFirebaseCloudMessaging token:string encrypt:Bool = 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 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 -deviceTokenApplePushVoIP 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 @encrypt True, if push notifications should be additionally encrypted +deviceTokenApplePushVoIP device_token:string is_app_sandbox:Bool encrypt: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 deviceTokenWindowsPush access_token:string = DeviceToken; @@ -1766,6 +1903,10 @@ deviceTokenBlackBerryPush token:string = DeviceToken; deviceTokenTizenPush reg_id:string = DeviceToken; +//@description Contains a globally unique push receiver identifier, which can be used to identify which account has received a push notification @id The globally unique identifier of push notification subscription +pushReceiverId id:int64 = PushReceiverId; + + //@description Contains information about a wallpaper @id Unique persistent wallpaper identifier @sizes Available variants of the wallpaper in different sizes. These photos can only be downloaded; they can't be sent in a message @color Main color of the wallpaper in RGB24 format; should be treated as background color if no photos are specified wallpaper id:int32 sizes:vector color:int32 = Wallpaper; @@ -1795,21 +1936,169 @@ checkChatUsernameResultPublicChatsTooMuch = CheckChatUsernameResult; checkChatUsernameResultPublicGroupsUnavailable = CheckChatUsernameResult; +//@class PushMessageContent @description Contains content of a push message notification + +//@description A general message with hidden content @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentHidden is_pinned:Bool = PushMessageContent; + +//@description An animation message (GIF-style) @animation Message content; may be null @caption Animation caption @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentAnimation animation:animation caption:string is_pinned:Bool = PushMessageContent; + +//@description An audio message @audio Message content; may be null @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentAudio audio:audio is_pinned:Bool = PushMessageContent; + +//@description A message with a user contact @name Contact's name @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentContact name:string is_pinned:Bool = PushMessageContent; + +//@description A contact has registered with Telegram +pushMessageContentContactRegistered = PushMessageContent; + +//@description A document message (a general file) @document Message content; may be null @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentDocument document:document is_pinned:Bool = PushMessageContent; + +//@description A message with a game @title Game title, empty for pinned game message @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentGame title:string is_pinned:Bool = PushMessageContent; + +//@description A new high score was achieved in a game @title Game title, empty for pinned message @score New score, 0 for pinned message @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentGameScore title:string score:int32 is_pinned:Bool = PushMessageContent; + +//@description A message with an invoice from a bot @price Product price @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentInvoice price:string is_pinned:Bool = PushMessageContent; + +//@description A message with a location @is_live True, if the location is live @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentLocation is_live:Bool is_pinned:Bool = PushMessageContent; + +//@description A photo message @photo Message content; may be null @caption Photo caption @is_secret True, if the photo is secret @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentPhoto photo:photo caption:string is_secret:Bool is_pinned:Bool = PushMessageContent; + +//@description A message with a poll @question Poll question @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentPoll question:string is_pinned:Bool = PushMessageContent; + +//@description A screenshot of a message in the chat has been taken +pushMessageContentScreenshotTaken = PushMessageContent; + +//@description A message with a sticker @sticker Message content; may be null @emoji Emoji corresponding to the sticker; may be empty @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentSticker sticker:sticker emoji:string is_pinned:Bool = PushMessageContent; + +//@description A text message @text Message text @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentText text:string is_pinned:Bool = PushMessageContent; + +//@description A video message @video Message content; may be null @caption Video caption @is_secret True, if the video is secret @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentVideo video:video caption:string is_secret:Bool is_pinned:Bool = PushMessageContent; + +//@description A video note message @video_note Message content; may be null @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentVideoNote video_note:videoNote is_pinned:Bool = PushMessageContent; + +//@description A voice note message @voice_note Message content; may be null @is_pinned True, if the message is a pinned message with the specified content +pushMessageContentVoiceNote voice_note:voiceNote is_pinned:Bool = PushMessageContent; + +//@description A newly created basic group +pushMessageContentBasicGroupChatCreate = PushMessageContent; + +//@description New chat members were invited to a group @member_name Name of the added member @is_current_user True, if the current user was added to the group +//@is_returned True, if the user has returned to the group himself +pushMessageContentChatAddMembers member_name:string is_current_user:Bool is_returned:Bool = PushMessageContent; + +//@description A chat photo was edited +pushMessageContentChatChangePhoto = PushMessageContent; + +//@description A chat title was edited @title New chat title +pushMessageContentChatChangeTitle title:string = PushMessageContent; + +//@description A chat member was deleted @member_name Name of the deleted member @is_current_user True, if the current user was deleted from the group +//@is_left True, if the user has left the group himself +pushMessageContentChatDeleteMember member_name:string is_current_user:Bool is_left:Bool = PushMessageContent; + +//@description A new member joined the chat by invite link +pushMessageContentChatJoinByLink = PushMessageContent; + +//@description A forwarded messages @total_count Number of forwarded messages +pushMessageContentMessageForwards total_count:int32 = PushMessageContent; + +//@description A media album @total_count Number of messages in the album @has_photos True, if the album has at least one photo @has_videos True, if the album has at least one video +pushMessageContentMediaAlbum total_count:int32 has_photos:Bool has_videos:Bool = PushMessageContent; + + +//@class NotificationType @description Contains detailed information about a notification + +//@description New message was received @message The message +notificationTypeNewMessage message:message = NotificationType; + +//@description New secret chat was created +notificationTypeNewSecretChat = NotificationType; + +//@description New call was received @call_id Call identifier +notificationTypeNewCall call_id:int32 = NotificationType; + +//@description New message was received through a push notification +//@message_id The message identifier. The message will not be available in the chat history, but the ID can be used in viewMessages and as reply_to_message_id +//@sender_user_id Sender of the message. Corresponding user may be inaccessible @content Push message content +notificationTypeNewPushMessage message_id:int53 sender_user_id:int32 content:PushMessageContent = NotificationType; + + +//@class NotificationGroupType @description Describes type of notifications in the group + +//@description A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with ordinary unread messages +notificationGroupTypeMessages = NotificationGroupType; + +//@description A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with unread mentions of the current user, replies to their messages, or a pinned message +notificationGroupTypeMentions = NotificationGroupType; + +//@description A group containing a notification of type notificationTypeNewSecretChat +notificationGroupTypeSecretChat = NotificationGroupType; + +//@description A group containing notifications of type notificationTypeNewCall +notificationGroupTypeCalls = NotificationGroupType; + + +//@description Contains information about a notification @id Unique persistent identifier of this notification @date Notification date @type Notification type +notification id:int32 date:int32 type:NotificationType = Notification; + +//@description Describes a group of notifications @id Unique persistent auto-incremented from 1 identifier of the notification group @type Type of the group +//@chat_id Identifier of a chat to which all notifications in the group belong +//@total_count Total number of active notifications in the group @notifications The list of active notifications +notificationGroup id:int32 type:NotificationGroupType chat_id:int53 total_count:int32 notifications:vector = NotificationGroup; + + //@class OptionValue @description Represents the value of an option -//@description Boolean option @value The value of the option +//@description Represents a boolean option @value The value of the option optionValueBoolean value:Bool = OptionValue; -//@description An unknown option or an option which has a default value +//@description Represents an unknown option or an option which has a default value optionValueEmpty = OptionValue; -//@description An integer option @value The value of the option +//@description Represents an integer option @value The value of the option optionValueInteger value:int32 = OptionValue; -//@description A string option @value The value of the option +//@description Represents a string option @value The value of the option optionValueString value:string = OptionValue; +//@description Represents one member of a JSON object @key Member's key @value Member's value +jsonObjectMember key:string value:JsonValue = JsonObjectMember; + +//@class JsonValue @description Represents a JSON value + +//@description Represents a null JSON value +jsonValueNull = JsonValue; + +//@description Represents a boolean JSON value @value The value +jsonValueBoolean value:Bool = JsonValue; + +//@description Represents a numeric JSON value @value The value +jsonValueNumber value:double = JsonValue; + +//@description Represents a string JSON value @value The value +jsonValueString value:string = JsonValue; + +//@description Represents a JSON array @values The list of array elements +jsonValueArray values:vector = JsonValue; + +//@description Represents a JSON object @members The list of object members +jsonValueObject members:vector = JsonValue; + + //@class UserPrivacySettingRule @description Represents a single rule for managing privacy settings //@description A rule to allow all users to do something @@ -1844,19 +2133,24 @@ userPrivacySettingAllowChatInvites = UserPrivacySetting; //@description A privacy setting for managing whether the user can be called userPrivacySettingAllowCalls = UserPrivacySetting; +//@description A privacy setting for managing whether peer-to-peer connections can be used for calls +userPrivacySettingAllowPeerToPeerCalls = UserPrivacySetting; + //@description Contains information about the period of inactivity after which the current user's account will automatically be deleted @days Number of days of inactivity before the account will be flagged for deletion; should range from 30-366 days accountTtl days:int32 = AccountTtl; -//@description Contains information about one session in a Telegram application used by the current user @id Session identifier @is_current True, if this session is the current session +//@description Contains information about one session in a Telegram application used by the current user. Sessions should be shown to the user in the returned order +//@id Session identifier @is_current True, if this session is the current session +//@is_password_pending True, if a password is needed to complete authorization of the session //@api_id Telegram API identifier, as provided by the application @application_name Name of the application, as provided by the application //@application_version The version of the application, as provided by the application @is_official_application True, if the application is an official application or uses the api_id of an official application //@device_model Model of the device the application has been run or is running on, as provided by the application @platform Operating system the application has been run or is running on, as provided by the application //@system_version Version of the operating system the application has been run or is running on, as provided by the application @log_in_date Point in time (Unix timestamp) when the user has logged in //@last_active_date Point in time (Unix timestamp) when the session was last used @ip IP address from which the session was created, in human-readable format //@country A two-letter country code for the country from which the session was created, based on the IP address @region Region code from which the session was created, based on the IP address -session id:int64 is_current:Bool api_id:int32 application_name:string application_version:string is_official_application:Bool device_model:string platform:string system_version:string log_in_date:int32 last_active_date:int32 ip:string country:string region:string = Session; +session id:int64 is_current:Bool is_password_pending:Bool api_id:int32 application_name:string application_version:string is_official_application:Bool device_model:string platform:string system_version:string log_in_date:int32 last_active_date:int32 ip:string country:string region:string = Session; //@description Contains a list of sessions @sessions List of sessions sessions sessions:vector = Sessions; @@ -1892,6 +2186,9 @@ chatReportReasonViolence = ChatReportReason; //@description The chat contains pornographic messages chatReportReasonPornography = ChatReportReason; +//@description The chat has child abuse related content +chatReportReasonChildAbuse = ChatReportReason; + //@description The chat contains copyrighted content chatReportReasonCopyright = ChatReportReason; @@ -1903,6 +2200,10 @@ chatReportReasonCustom text:string = ChatReportReason; publicMessageLink link:string html:string = PublicMessageLink; +//@description Contains a part of a file @data File bytes +filePart data:bytes = FilePart; + + //@class FileType @description Represents the type of a file //@description The data is not a file @@ -1963,8 +2264,13 @@ storageStatisticsByChat chat_id:int53 size:int53 count:int32 by_file_type:vector //@description Contains the exact storage usage statistics split by chats and file type @size Total size of files @count Total number of files @by_chat Statistics split by chats storageStatistics size:int53 count:int32 by_chat:vector = StorageStatistics; -//@description Contains approximate storage usage statistics, excluding files of unknown file type @files_size Approximate total size of files @file_count Approximate number of files @database_size Size of the database -storageStatisticsFast files_size:int53 file_count:int32 database_size:int53 = StorageStatisticsFast; +//@description Contains approximate storage usage statistics, excluding files of unknown file type @files_size Approximate total size of files @file_count Approximate number of files +//@database_size Size of the database @language_pack_database_size Size of the language pack database @log_size Size of the TDLib internal log +storageStatisticsFast files_size:int53 file_count:int32 database_size:int53 language_pack_database_size:int53 log_size:int53 = StorageStatisticsFast; + +//@description Contains database statistics +//@statistics Database statistics in an unspecified human-readable format +databaseStatistics statistics:string = DatabaseStatistics; //@class NetworkType @description Represents the type of a network @@ -2110,8 +2416,8 @@ inputSticker png_sticker:InputFile emojis:string mask_position:maskPosition = In //@description The user authorization state has changed @authorization_state New authorization state updateAuthorizationState authorization_state:AuthorizationState = Update; -//@description A new message was received; can also be an outgoing message @message The new message @disable_notification True, if this message must not generate a notification @contains_mention True, if the message contains a mention of the current user -updateNewMessage message:message disable_notification:Bool contains_mention:Bool = Update; +//@description A new message was received; can also be an outgoing message @message The new message +updateNewMessage message:message = Update; //@description A request to send a message has reached the Telegram server. This doesn't mean that the message will be sent successfully or even that the send message request will be processed. This update will be sent only if the option "use_quick_ack" is set to true. This update may be sent multiple times for the same message //@chat_id The chat identifier of the sent message @message_id A temporary message identifier @@ -2151,7 +2457,7 @@ updateChatPhoto chat_id:int53 photo:chatPhoto = Update; //@description The last message of a chat was changed. If last_message is null then the last message in the chat became unknown. Some new unknown messages might be added to the chat in this case @chat_id Chat identifier @last_message The new last message in the chat; may be null @order New value of the chat order updateChatLastMessage chat_id:int53 last_message:message order:int64 = Update; -//@description The order of the chat in the chats list has changed. Instead of this update updateChatLastMessage, updateChatIsPinned or updateChatDraftMessage might be sent @chat_id Chat identifier @order New value of the order +//@description The order of the chat in the chat list has changed. Instead of this update updateChatLastMessage, updateChatIsPinned or updateChatDraftMessage might be sent @chat_id Chat identifier @order New value of the order 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 @@ -2181,6 +2487,9 @@ updateChatNotificationSettings chat_id:int53 notification_settings:chatNotificat //@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 chat pinned message was changed @chat_id Chat identifier @pinned_message_id The new identifier of the pinned message; 0 if there is no pinned message in the chat +updateChatPinnedMessage chat_id:int53 pinned_message_id:int53 = 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; @@ -2188,8 +2497,32 @@ updateChatReplyMarkup chat_id:int53 reply_markup_message_id:int53 = Update; //@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 The number of online group members has changed. This update with non-zero count is sent only for currently opened chats. There is no guarantee that it will be sent just after the count has changed @chat_id Identifier of the chat @online_member_count New number of online members in the chat, or 0 if unknown +updateChatOnlineMemberCount chat_id:int53 online_member_count:int32 = Update; + +//@description A notification was changed @notification_group_id Unique notification group identifier @notification Changed notification +updateNotification notification_group_id:int32 notification:notification = Update; + +//@description A list of active notifications in a notification group has changed +//@notification_group_id Unique notification group identifier +//@type New type of the notification group +//@chat_id Identifier of a chat to which all notifications in the group belong +//@notification_settings_chat_id Chat identifier, which notification settings must be applied to the added notifications +//@is_silent True, if the notifications should be shown without sound +//@total_count Total number of unread notifications in the group, can be bigger than number of active notifications +//@added_notifications List of added group notifications, sorted by notification ID @removed_notification_ids Identifiers of removed group notifications, sorted by notification ID +updateNotificationGroup notification_group_id:int32 type:NotificationGroupType chat_id:int53 notification_settings_chat_id:int53 is_silent:Bool total_count:int32 added_notifications:vector removed_notification_ids:vector = Update; + +//@description Contains active notifications that was shown on previous application launches. This update is sent only if a message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update @groups Lists of active notification groups +updateActiveNotifications groups:vector = Update; + +//@description Describes, whether there are some pending notification updates. Can be used to prevent application from killing, while there are some pending notifications +//@have_delayed_notifications True, if there are some delayed notification updates, which will be sent soon +//@have_unreceived_notifications True, if there can be some yet unreceived notifications, which are being fetched from the server +updateHavePendingNotifications have_delayed_notifications:Bool have_unreceived_notifications:Bool = Update; + //@description Some messages were deleted @chat_id Chat identifier @message_ids Identifiers of the deleted messages -//@is_permanent True, if the messages are permanently deleted by a user (as opposed to just becoming unaccessible) +//@is_permanent True, if the messages are permanently deleted by a user (as opposed to just becoming inaccessible) //@from_cache True, if the messages are deleted only from the cache and can possibly be retrieved again in the future updateDeleteMessages chat_id:int53 message_ids:vector is_permanent:Bool from_cache:Bool = Update; @@ -2306,6 +2639,32 @@ updateNewCustomEvent event:string = Update; //@description A new incoming query; for bots only @id The query identifier @data JSON-serialized query data @timeout Query timeout updateNewCustomQuery id:int64 data:string timeout:int32 = Update; +//@description Information about a poll was updated; for bots only @poll New data about the poll +updatePoll poll:poll = Update; + + +//@description Contains a list of updates @updates List of updates +updates updates:vector = Updates; + + +//@class LogStream @description Describes a stream to which TDLib internal log is written + +//@description The log is written to stderr or an OS specific log +logStreamDefault = LogStream; + +//@description The log is written to a file @path Path to the file to where the internal TDLib log will be written @max_file_size Maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated +logStreamFile path:string max_file_size:int53 = LogStream; + +//@description The log is written nowhere +logStreamEmpty = LogStream; + + +//@description Contains a TDLib internal log verbosity level @verbosity_level Log verbosity level +logVerbosityLevel verbosity_level:int32 = LogVerbosityLevel; + +//@description Contains a list of available TDLib internal log tags @tags List of log tags +logTags tags:vector = LogTags; + //@description A simple object containing a number; for testing only @value Number testInt value:int32 = TestInt; @@ -2342,7 +2701,8 @@ setAuthenticationPhoneNumber phone_number:string allow_flash_call:Bool is_curren resendAuthenticationCode = Ok; //@description Checks the authentication code. Works only when the current authorization state is authorizationStateWaitCode @code The verification code received via SMS, Telegram message, phone call, or flash call -//@first_name If the user is not yet registered, the first name of the user; 1-255 characters @last_name If the user is not yet registered; the last name of the user; optional; 0-255 characters +//@first_name If the user is not yet registered, the first name of the user; 1-64 characters. You can also pass an empty string for unregistered user there to check verification code validness. In the latter case PHONE_NUMBER_UNOCCUPIED error will be returned for a valid code +//@last_name If the user is not yet registered; the last name of the user; optional; 0-64 characters checkAuthenticationCode code:string first_name:string last_name:string = Ok; //@description Checks the authentication password for correctness. Works only when the current authorization state is authorizationStateWaitPassword @password The password to check @@ -2367,6 +2727,10 @@ close = Ok; destroy = Ok; +//@description Returns all updates needed to restore current TDLib state, i.e. all actual UpdateAuthorizationState/UpdateUser/UpdateNewChat and others. This is especially usefull if TDLib is run in a separate process. This is an offline method. Can be called before authorization +getCurrentState = Updates; + + //@description Changes the database encryption key. Usually the encryption key is never changed and is stored in some OS keychain @new_encryption_key New encryption key setDatabaseEncryptionKey new_encryption_key:bytes = Ok; @@ -2374,17 +2738,23 @@ setDatabaseEncryptionKey new_encryption_key:bytes = Ok; //@description Returns the current state of 2-step verification getPasswordState = PasswordState; -//@description Changes the password for the user. If a new recovery email address is specified, then the error EMAIL_UNCONFIRMED is returned and the password change will not be applied until the new recovery email address has been confirmed. The application should periodically call getPasswordState to check whether the new email address has been confirmed +//@description Changes the password for the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed //@old_password Previous password of the user @new_password New password of the user; may be empty to remove the password @new_hint New password hint; may be empty @set_recovery_email_address Pass true if the recovery email address should be changed @new_recovery_email_address New recovery email address; may be empty setPassword old_password:string new_password:string new_hint:string set_recovery_email_address:Bool new_recovery_email_address:string = PasswordState; -//@description Returns a recovery email address that was previously set up. This method can be used to verify a password provided by the user @password The password for the current user +//@description Returns a 2-step verification recovery email address that was previously set up. This method can be used to verify a password provided by the user @password The password for the current user getRecoveryEmailAddress password:string = RecoveryEmailAddress; -//@description Changes the recovery email address of the user. If a new recovery email address is specified, then the error EMAIL_UNCONFIRMED is returned and the email address will not be changed until the new email has been confirmed. The application should periodically call getPasswordState to check whether the email address has been confirmed. +//@description Changes the 2-step verification recovery email address of the user. If a new recovery email address is specified, then the change will not be applied until the new recovery email address is confirmed //-If new_recovery_email_address is the same as the email address that is currently set up, this call succeeds immediately and aborts all other requests waiting for an email confirmation @password Password of the current user @new_recovery_email_address New recovery email address setRecoveryEmailAddress password:string new_recovery_email_address:string = PasswordState; +//@description Checks the 2-step verification recovery email address verification code @code Verification code +checkRecoveryEmailAddressCode code:string = PasswordState; + +//@description Resends the 2-step verification recovery email address verification code +resendRecoveryEmailAddressCode = PasswordState; + //@description Requests to send a password recovery code to an email address that was previously set up requestPasswordRecovery = EmailAddressAuthenticationCodeInfo; @@ -2398,10 +2768,6 @@ createTemporaryPassword password:string valid_for:int32 = TemporaryPasswordState getTemporaryPasswordState = TemporaryPasswordState; -//@description Handles a DC_UPDATE push service notification. Can be called before authorization @dc Value of the "dc" parameter of the notification @addr Value of the "addr" parameter of the notification -processDcUpdate dc:string addr:string = Ok; - - //@description Returns the current user getMe = User; @@ -2432,6 +2798,9 @@ getChat chat_id:int53 = Chat; //@description Returns information about a message @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get getMessage chat_id:int53 message_id:int53 = Message; +//@description Returns information about a message, if it is available locally without sending network request. This is an offline request @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message to get +getMessageLocally chat_id:int53 message_id:int53 = Message; + //@description Returns information about a message that is replied by given message @chat_id Identifier of the chat the message belongs to @message_id Identifier of the message reply to which get getRepliedMessage chat_id:int53 message_id:int53 = Message; @@ -2447,7 +2816,7 @@ getFile file_id:int32 = File; //@description Returns information about a file by its remote ID; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message @remote_file_id Remote identifier of the file to get @file_type File type, if known getRemoteFile remote_file_id:string file_type:FileType = File; -//@description Returns an ordered list of chats. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to 2^63 - 1). +//@description Returns an ordered list of chats. Chats are sorted by the pair (order, chat_id) in decreasing order. (For example, to get a list of chats from the beginning, the offset_order should be equal to a biggest signed 64-bit number 9223372036854775807 == 2^63 - 1). //-For optimal performance the number of returned chats is chosen by the library. @offset_order Chat order to return chats from @offset_chat_id Chat identifier to return chats from //@limit The maximum number of chats to be returned. It is possible that fewer chats than the limit are returned even if the end of the list is not reached getChats offset_order:int64 offset_chat_id:int53 limit:int32 = Chats; @@ -2480,13 +2849,13 @@ removeRecentlyFoundChat chat_id:int53 = Ok; clearRecentlyFoundChats = Ok; //@description Checks whether a username can be set for a chat @chat_id Chat identifier; should be identifier of a supergroup chat, or a channel chat, or a private chat with self, or zero if chat is being created @username Username to be checked -checkChatUsername chat_id:int64 username:string = CheckChatUsernameResult; +checkChatUsername chat_id:int53 username:string = CheckChatUsernameResult; //@description Returns a list of public chats created by the user getCreatedPublicChats = Chats; -//@description Returns a list of common chats with a given user. Chats are sorted by their type and creation date @user_id User identifier @offset_chat_id Chat identifier starting from which to return chats; use 0 for the first request @limit Maximum number of chats to be returned; up to 100 +//@description Returns a list of common group chats with a given user. Chats are sorted by their type and creation date @user_id User identifier @offset_chat_id Chat identifier starting from which to return chats; use 0 for the first request @limit Maximum number of chats to be returned; up to 100 getGroupsInCommon user_id:int32 offset_chat_id:int53 limit:int32 = Chats; @@ -2494,13 +2863,14 @@ getGroupsInCommon user_id:int32 offset_chat_id:int53 limit:int32 = Chats; //-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 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 +//@offset Specify 0 to get results from exactly the from_message_id or a negative offset up to 99 to get additionally 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 or equal to -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 getChatHistory chat_id:int53 from_message_id:int53 offset:int32 limit:int32 only_local:Bool = Messages; -//@description Deletes all messages in the chat only for the user. Cannot be used in channels and public supergroups @chat_id Chat identifier @remove_from_chat_list Pass true if the chat should be removed from the chats list -deleteChatHistory chat_id:int53 remove_from_chat_list:Bool = Ok; +//@description Deletes all messages in the chat. Use Chat.can_be_deleted_only_for_self and Chat.can_be_deleted_for_all_users fields to find whether and how the method can be applied to the chat +//@chat_id Chat identifier @remove_from_chat_list Pass true if the chat should be removed from the chat list @revoke Pass true to try to delete chat history for all users +deleteChatHistory chat_id:int53 remove_from_chat_list:Bool revoke:Bool = Ok; //@description Searches for messages with given words in the chat. Returns the results in reverse chronological order, i.e. in order of decreasing message_id. Cannot be used in secret chats with a non-empty query //-(searchSecretMessages should be used instead), or without an enabled message database. For optimal performance the number of returned messages is chosen by the library @@ -2547,12 +2917,24 @@ getChatMessageByDate chat_id:int53 date:int32 = Message; getChatMessageCount chat_id:int53 filter:SearchMessagesFilter return_local:Bool = Count; +//@description Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user @notification_group_id Identifier of notification group to which the notification belongs @notification_id Identifier of removed notification +removeNotification notification_group_id:int32 notification_id:int32 = Ok; + +//@description Removes a group of active notifications. Needs to be called only if the notification group is removed by the current user @notification_group_id Notification group identifier @max_notification_id Maximum identifier of removed notifications +removeNotificationGroup notification_group_id:int32 max_notification_id:int32 = Ok; + + //@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 //@message_id Identifier of the message //@for_album Pass true if a link for a whole media album should be returned getPublicMessageLink chat_id:int53 message_id:int53 for_album:Bool = PublicMessageLink; +//@description Returns a private HTTPS link to a message in a chat. Available only for already sent messages in supergroups and channels. The link will work only for members of the chat +//@chat_id Identifier of the chat to which the message belongs +//@message_id Identifier of the message +getMessageLink chat_id:int53 message_id:int53 = HttpUrl; + //@description Sends a message. Returns the sent message @chat_id Target chat @reply_to_message_id Identifier of the message to reply to or 0 //@disable_notification Pass true to disable notification for the message. Not supported in secret chats @from_background Pass true if the message is sent from the background @@ -2571,7 +2953,8 @@ sendBotStartMessage bot_user_id:int32 chat_id:int53 parameter:string = Message; //@description Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message @chat_id Target chat @reply_to_message_id Identifier of a message to reply to or 0 //@disable_notification Pass true to disable notification for the message. Not supported in secret chats @from_background Pass true if the message is sent from background //@query_id Identifier of the inline query @result_id Identifier of the inline result -sendInlineQueryResultMessage chat_id:int53 reply_to_message_id:int53 disable_notification:Bool from_background:Bool query_id:int64 result_id:string = Message; +//@hide_via_bot If true, there will be no mention of a bot, via which the message is sent. Can be used only for bots GetOption("animation_search_bot_username"), GetOption("photo_search_bot_username") and GetOption("venue_search_bot_username") +sendInlineQueryResultMessage chat_id:int53 reply_to_message_id:int53 disable_notification:Bool from_background:Bool query_id:int64 result_id:string hide_via_bot:Bool = Message; //@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message //@chat_id Identifier of the chat to which to forward messages @from_chat_id Identifier of the chat from which to forward messages @message_ids Identifiers of the messages to forward @@ -2589,7 +2972,7 @@ sendChatScreenshotTakenNotification chat_id:int53 = Ok; //@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 +//@description Deletes messages @chat_id Chat identifier @message_ids Identifiers of the messages to be deleted @revoke Pass true to try to delete messages for all chat members. Always true for supergroups, channels and secret chats deleteMessages chat_id:int53 message_ids:vector revoke:Bool = Ok; //@description Deletes all messages sent by the specified user to a chat. Supported only in supergroups; requires can_delete_messages administrator privileges @chat_id Chat identifier @user_id User identifier @@ -2652,6 +3035,21 @@ cleanFileName file_name:string = Text; //@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 Converts a JSON-serialized string to corresponding JsonValue object. This is an offline method. Can be called before authorization. Can be called synchronously @json The JSON-serialized string +getJsonValue json:string = JsonValue; + +//@description Converts a JsonValue object to corresponding JSON-serialized string. This is an offline method. Can be called before authorization. Can be called synchronously @json_value The JsonValue object +getJsonString json_value:JsonValue = Text; + + +//@description Changes user answer to a poll @chat_id Identifier of the chat to which the poll belongs @message_id Identifier of the message containing the poll +//@option_ids 0-based identifiers of options, chosen by the user. Currently user can't choose more than 1 option +setPollAnswer chat_id:int53 message_id:int53 option_ids:vector = Ok; + +//@description Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set +//@chat_id Identifier of the chat to which the poll belongs @message_id Identifier of the message containing the poll @reply_markup The new message reply markup; for bots only +stopPoll chat_id:int53 message_id:int53 reply_markup:ReplyMarkup = Ok; + //@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 @@ -2677,7 +3075,7 @@ answerShippingQuery shipping_query_id:int64 shipping_options:vector force_read:Bool = Ok; -//@description This method should be called if the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). An updateMessageContentOpened update will be generated if something has changed @chat_id Chat identifier of the message @message_id Identifier of the message with the opened content +//@description Informs TDLib that the message content has been opened (e.g., the user has opened a photo, video, document, location or venue, or has listened to an audio file or voice note message). An updateMessageContentOpened update will be generated if something has changed @chat_id Chat identifier of the message @message_id Identifier of the message with the opened content openMessageContent chat_id:int53 message_id:int53 = Ok; @@ -2731,10 +3129,10 @@ createSupergroupChat supergroup_id:int32 force:Bool = Chat; //@description Returns an existing chat corresponding to a known secret chat @secret_chat_id Secret chat identifier createSecretChat secret_chat_id:int32 = Chat; -//@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat @user_ids Identifiers of users to be added to the basic group @title Title of the new basic group; 1-255 characters +//@description Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat @user_ids Identifiers of users to be added to the basic group @title Title of the new basic group; 1-128 characters createNewBasicGroupChat user_ids:vector title:string = Chat; -//@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat @title Title of the new chat; 1-255 characters @is_channel True, if a channel chat should be created @param_description Chat description; 0-255 characters +//@description Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat @title Title of the new chat; 1-128 characters @is_channel True, if a channel chat should be created @param_description Chat description; 0-255 characters createNewSupergroupChat title:string is_channel:Bool description:string = Chat; //@description Creates a new secret chat. Returns the newly created chat @user_id Identifier of the target user @@ -2745,7 +3143,7 @@ upgradeBasicGroupChatToSupergroupChat chat_id:int53 = Chat; //@description Changes the chat title. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The title will not be changed until the request to the server has been completed -//@chat_id Chat identifier @title New title of the chat; 1-255 characters +//@chat_id Chat identifier @title New title of the chat; 1-128 characters setChatTitle chat_id:int53 title:string = Ok; //@description Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires administrator rights in basic groups and the appropriate administrator rights in supergroups and channels. The photo will not be changed before request to the server has been completed @@ -2770,6 +3168,12 @@ toggleChatDefaultDisableNotification chat_id:int53 default_disable_notification: //@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 Pins a message in a chat; requires appropriate administrator rights in the group or channel @chat_id Identifier of the chat @message_id Identifier of the new pinned message @disable_notification True, if there should be no notification about the pinned message +pinChatMessage chat_id:int53 message_id:int53 disable_notification:Bool = Ok; + +//@description Removes the pinned message from a chat; requires appropriate administrator rights in the group or channel @chat_id Identifier of the chat +unpinChatMessage chat_id:int53 = 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; @@ -2777,7 +3181,7 @@ joinChat chat_id:int53 = Ok; 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 +//@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 100. Ignored for supergroups and channels addChatMember chat_id:int53 user_id:int32 forward_limit:int32 = Ok; //@description Adds multiple new members to a chat. Currently this option is only available for supergroups and channels. This option can't be used to join a chat. Members can't be added to a channel if it has more than 200 members. Members will not be added until the chat state has been synchronized with the server @@ -2802,6 +3206,9 @@ getChatAdministrators chat_id:int53 = Users; clearAllDraftMessages exclude_secret_chats:Bool = Ok; +//@description Returns list of chats with non-default notification settings @scope If specified, only chats from the specified scope will be returned @compare_sound If true, also chats with non-default sound will be returned +getChatNotificationSettingsExceptions scope:NotificationSettingsScope compare_sound:Bool = Chats; + //@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; @@ -2816,10 +3223,17 @@ resetAllNotificationSettings = Ok; setPinnedChats chat_ids:vector = Ok; -//@description Asynchronously downloads a file from the cloud. updateFile will be used to notify about the download progress and successful completion of the download. Returns file state just after the download has been started +//@description Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates //@file_id Identifier of the file to download //@priority Priority of the download (1-32). The higher the priority, the earlier the file will be downloaded. If the priorities of two files are equal, then the last one for which downloadFile was called will be downloaded first -downloadFile file_id:int32 priority:int32 = File; +//@offset The starting position from which the file should be downloaded +//@limit Number of bytes which should be downloaded starting from the "offset" position before the download will be automatically cancelled; use 0 to download without a limit +//@synchronous If false, this request returns file state just after the download has been started. If true, this request returns file state only after +//-the download has succeeded, has failed, has been cancelled or a new downloadFile request with different offset/limit parameters was sent +downloadFile file_id:int32 priority:int32 offset:int32 limit:int32 synchronous:Bool = File; + +//@description Returns file downloaded prefix size from a given offset @file_id Identifier of the file @offset Offset from which downloaded prefix size should be calculated +getFileDownloadedPrefixSize file_id:int32 offset:int32 = Count; //@description Stops the downloading of a file. If a file has already been downloaded, does nothing @file_id Identifier of a file to stop downloading @only_if_pending Pass true to stop downloading only if it hasn't been started, i.e. request hasn't been sent to server cancelDownloadFile file_id:int32 only_if_pending:Bool = Ok; @@ -2831,7 +3245,11 @@ uploadFile file:InputFile file_type:FileType priority:int32 = File; //@description Stops the uploading of a file. Supported only for files uploaded by using uploadFile. For other files the behavior is undefined @file_id Identifier of the file to stop uploading cancelUploadFile file_id:int32 = Ok; -//@description The next part of a file was generated +//@description Writes a part of a generated file. This method is intended to be used only if the client has no direct access to TDLib's file system, because it is usually slower than a direct write to the destination file +//@generation_id The identifier of the generation process @offset The offset from which to write the data to the file @data The data to write +writeGeneratedFilePart generation_id:int64 offset:int32 data:bytes = Ok; + +//@description Informs TDLib on a file generation prograss //@generation_id The identifier of the generation process //@expected_size Expected size of the generated file, in bytes; 0 if unknown //@local_prefix_size The number of bytes already generated @@ -2842,6 +3260,12 @@ setFileGenerationProgress generation_id:int64 expected_size:int32 local_prefix_s //@error If set, means that file generation has failed and should be terminated finishFileGeneration generation_id:int64 error:error = Ok; +//@description Reads a part of a file from the TDLib file cache and returns read bytes. This method is intended to be used only if the client has no direct access to TDLib's file system, because it is usually slower than a direct read from the file +//@file_id Identifier of the file. The file must be located in the TDLib file cache +//@offset The offset from which to read the file +//@count Number of bytes to read. An error will be returned if there are not enough bytes available in the file from the specified position. Pass 0 to read all available data from the specified position +readFilePart file_id:int32 offset:int32 count:int32 = FilePart; + //@description Deletes a file from the TDLib file cache @file_id Identifier of the file to delete deleteFile file_id:int32 = Ok; @@ -2890,10 +3314,10 @@ 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 +//@description Searches for the specified query in the first names, last names and usernames of the known user contacts @query Query to search for; may be empty to return all contacts @limit Maximum number of users to be returned searchContacts query:string limit:int32 = Users; -//@description Removes users from the contacts list @user_ids Identifiers of users to be deleted +//@description Removes users from the contact list @user_ids Identifiers of users to be deleted removeContacts user_ids:vector = Ok; //@description Returns the total number of imported contacts @@ -2903,7 +3327,7 @@ getImportedContactCount = Count; //-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, contacts list remains unchanged +//@description Clears all imported contacts, contact list remains unchanged clearImportedContacts = Ok; @@ -3012,7 +3436,7 @@ setProfilePhoto photo:InputFile = Ok; //@description Deletes a profile photo. If something changes, updateUser will be sent @profile_photo_id Identifier of the profile photo to delete deleteProfilePhoto profile_photo_id:int64 = Ok; -//@description Changes the first and last name of the current user. If something changes, updateUser will be sent @first_name The new value of the first name for the user; 1-255 characters @last_name The new value of the optional last name for the user; 0-255 characters +//@description Changes the first and last name of the current user. If something changes, updateUser will be sent @first_name The new value of the first name for the user; 1-64 characters @last_name The new value of the optional last name for the user; 0-64 characters setName first_name:string last_name:string = Ok; //@description Changes the bio of the current user @bio The new value of the user bio; 0-70 characters without line feeds @@ -3074,12 +3498,6 @@ toggleSupergroupIsAllHistoryAvailable supergroup_id:int32 is_all_history_availab //@description Changes information about a supergroup or channel; requires appropriate administrator rights @supergroup_id Identifier of the supergroup or channel @param_description New supergroup or channel description; 0-255 characters setSupergroupDescription supergroup_id:int32 description:string = Ok; -//@description Pins a message in a supergroup or channel; requires appropriate administrator rights in the supergroup or channel @supergroup_id Identifier of the supergroup or channel @message_id Identifier of the new pinned message @disable_notification True, if there should be no notification about the pinned message -pinSupergroupMessage supergroup_id:int32 message_id:int53 disable_notification:Bool = Ok; - -//@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; 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; @@ -3131,27 +3549,43 @@ 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 +//@description Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization @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 +//@description Returns information about a language pack. Returned language pack identifier may be different from a provided one. Can be called before authorization @language_pack_id Language pack identifier +getLanguagePackInfo language_pack_id:string = LanguagePackInfo; + +//@description Returns strings from a language pack in the current localization target by their keys. Can be called before authorization @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 +//@description Fetches the latest versions of all strings from a language pack in the current localization target from the server. This method doesn't need to be called explicitly for the current used/base language packs. Can be called before authorization @language_pack_id Language pack identifier +synchronizeLanguagePack language_pack_id:string = Ok; + +//@description Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization @language_pack_id Identifier of a language pack to be added; may be different from a name that is used in an "https://t.me/setlanguage/" link +addCustomServerLanguagePack language_pack_id:string = Ok; + +//@description Adds or changes a custom local 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. Can be called before authorization @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 +//@description Edits information about a custom local language pack in the current localization target. Can be called before authorization @info New information about the custom local 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 +//@description Adds, edits or deletes a string in a custom local language pack. Can be called before authorization @language_pack_id Identifier of a previously added custom local 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 +//@description Deletes all information about a language pack in the current localization target. The language pack which is currently in use (including base language pack) or is being synchronized can't be deleted. Can be called before authorization @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; +//@description Registers the currently used device for receiving push notifications. Returns a globally unique identifier of the push notification subscription @device_token Device token @other_user_ids List of user identifiers of other users currently using the client +registerDevice device_token:DeviceToken other_user_ids:vector = PushReceiverId; + +//@description Handles a push notification. Returns error with code 406 if the push notification is not supported and connection to the server is required to fetch new data. Can be called before authorization +//@payload JSON-encoded push notification payload with all fields sent by the server, and "google.sent_time" and "google.notification.sound" fields added +processPushNotification payload:string = Ok; + +//@description Returns a globally unique push notification subscription identifier for identification of an account, which has received a push notification. This is an offline method. Can be called before authorization. Can be called synchronously @payload JSON-encoded push notification payload +getPushReceiverId payload:string = PushReceiverId; //@description Returns t.me URLs recently visited by a newly registered user @referrer Google Play referrer to identify the user @@ -3187,19 +3621,26 @@ deleteAccount reason:string = Ok; //@description Returns information on whether the current chat can be reported as spam @chat_id Chat identifier getChatReportSpamState chat_id:int53 = ChatReportSpamState; -//@description Used to let the server know whether a chat is spam or not. Can be used only if ChatReportSpamState.can_report_spam is true. After this request, ChatReportSpamState.can_report_spam becomes false forever @chat_id Chat identifier @is_spam_chat If true, the chat will be reported as spam; otherwise it will be marked as not spam +//@description Reports to the server whether a chat is a spam chat or not. Can be used only if ChatReportSpamState.can_report_spam is true. After this request, ChatReportSpamState.can_report_spam becomes false forever @chat_id Chat identifier @is_spam_chat If true, the chat will be reported as spam; otherwise it will be marked as not spam changeChatReportSpamState chat_id:int53 is_spam_chat:Bool = Ok; //@description Reports a chat to the Telegram moderators. Supported only for supergroups, channels, or private chats with bots, since other chats can't be checked by moderators @chat_id Chat identifier @reason The reason for reporting the chat @message_ids Identifiers of reported messages, if any reportChat chat_id:int53 reason:ChatReportReason message_ids:vector = Ok; -//@description Returns storage usage statistics @chat_limit Maximum number of chats with the largest storage usage for which separate statistics should be returned. All other chats will be grouped in entries with chat_id == 0. If the chat info database is not used, the chat_limit is ignored and is always set to 0 +//@description Returns URL with the chat statistics. Currently this method can be used only for channels @chat_id Chat identifier @parameters Parameters from "tg://statsrefresh?params=******" link @is_dark Pass true if a URL with the dark theme must be returned +getChatStatisticsUrl chat_id:int53 parameters:string is_dark:Bool = HttpUrl; + + +//@description Returns storage usage statistics. Can be called before authorization @chat_limit Maximum number of chats with the largest storage usage for which separate statistics should be returned. All other chats will be grouped in entries with chat_id == 0. If the chat info database is not used, the chat_limit is ignored and is always set to 0 getStorageStatistics chat_limit:int32 = StorageStatistics; -//@description Quickly returns approximate storage usage statistics +//@description Quickly returns approximate storage usage statistics. Can be called before authorization getStorageStatisticsFast = StorageStatisticsFast; +//@description Returns database statistics +getDatabaseStatistics = DatabaseStatistics; + //@description Optimizes storage usage, i.e. deletes some files and returns new storage usage statistics. Secret thumbnails can't be deleted //@size Limit on the total size of files after deletion. Pass -1 to use the default limit //@ttl Limit on the time that has passed since the last time a file was accessed (or creation time for some filesystems). Pass -1 to use the default limit @@ -3267,10 +3708,14 @@ resendEmailAddressVerificationCode = EmailAddressAuthenticationCodeInfo; 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 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 +getPassportAuthorizationForm bot_user_id:int32 scope:string public_key:string nonce: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 +//@description Returns already available Telegram Passport elements suitable for completing a Telegram Passport authorization form. Result can be received only once for each authorization form @autorization_form_id Authorization form identifier @password Password of the current user +getPassportAuthorizationFormAvailableElements autorization_form_id:int32 password:string = PassportElementsWithErrors; + +//@description Sends a Telegram Passport authorization form, effectively sharing data with the service. This method must be called after getPassportAuthorizationFormAvailableElements if some previously available elements need to be used +//@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; @@ -3335,6 +3780,13 @@ getInviteText = Text; getDeepLinkInfo link:string = DeepLinkInfo; +//@description Returns application config, provided by the server. Can be called before authorization +getApplicationConfig = JsonValue; + +//@description Saves application log event on the server. Can be called before authorization @type Event type @chat_id Optional chat identifier, associated with the event @data The log event data +saveApplicationLogEvent type:string chat_id:int53 data:JsonValue = 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; @@ -3360,27 +3812,55 @@ getProxyLink proxy_id:int32 = Text; pingProxy proxy_id:int32 = Seconds; -//@description Does nothing; for testing only +//@description Sets new log stream for internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously @log_stream New log stream +setLogStream log_stream:LogStream = Ok; + +//@description Returns information about currently used log stream for internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously +getLogStream = LogStream; + +//@description Sets the verbosity level of the internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously +//@new_verbosity_level New value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1023 can be used to enable even more logging +setLogVerbosityLevel new_verbosity_level:int32 = Ok; + +//@description Returns current verbosity level of the internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously +getLogVerbosityLevel = LogVerbosityLevel; + +//@description Returns list of available TDLib internal log tags, for example, ["actor", "binlog", "connections", "notifications", "proxy"]. This is an offline method. Can be called before authorization. Can be called synchronously +getLogTags = LogTags; + +//@description Sets the verbosity level for a specified TDLib internal log tag. This is an offline method. Can be called before authorization. Can be called synchronously +//@tag Logging tag to change verbosity level @new_verbosity_level New verbosity level; 1-1024 +setLogTagVerbosityLevel tag:string new_verbosity_level:int32 = Ok; + +//@description Returns current verbosity level for a specified TDLib internal log tag. This is an offline method. Can be called before authorization. Can be called synchronously @tag Logging tag to change verbosity level +getLogTagVerbosityLevel tag:string = LogVerbosityLevel; + +//@description Adds a message to TDLib internal log. This is an offline method. Can be called before authorization. Can be called synchronously +//@verbosity_level Minimum verbosity level needed for the message to be logged, 0-1023 @text Text of a message to log +addLogMessage verbosity_level:int32 text:string = Ok; + + +//@description Does nothing; for testing only. This is an offline method. Can be called before authorization testCallEmpty = Ok; -//@description Returns the received string; for testing only @x String to return +//@description Returns the received string; for testing only. This is an offline method. Can be called before authorization @x String to return testCallString x:string = TestString; -//@description Returns the received bytes; for testing only @x Bytes to return +//@description Returns the received bytes; for testing only. This is an offline method. Can be called before authorization @x Bytes to return testCallBytes x:bytes = TestBytes; -//@description Returns the received vector of numbers; for testing only @x Vector of numbers to return +//@description Returns the received vector of numbers; for testing only. This is an offline method. Can be called before authorization @x Vector of numbers to return testCallVectorInt x:vector = TestVectorInt; -//@description Returns the received vector of objects containing a number; for testing only @x Vector of objects to return +//@description Returns the received vector of objects containing a number; for testing only. This is an offline method. Can be called before authorization @x Vector of objects to return testCallVectorIntObject x:vector = TestVectorIntObject; -//@description For testing only request. Returns the received vector of strings; for testing only @x Vector of strings to return +//@description Returns the received vector of strings; for testing only. This is an offline method. Can be called before authorization @x Vector of strings to return testCallVectorString x:vector = TestVectorString; -//@description Returns the received vector of objects containing a string; for testing only @x Vector of objects to return +//@description Returns the received vector of objects containing a string; for testing only. This is an offline method. Can be called before authorization @x Vector of objects to return testCallVectorStringObject x:vector = TestVectorStringObject; -//@description Returns the squared received number; for testing only @x Number to square +//@description Returns the squared received number; for testing only. This is an offline method. Can be called before authorization @x Number to square testSquareInt x:int32 = TestInt; -//@description Sends a simple network request to the Telegram servers; for testing only +//@description Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization testNetwork = Ok; //@description Forces an updates.getDifference call to the Telegram servers; for testing only testGetDifference = Ok; -//@description Does nothing and ensures that the Update object is used; for testing only +//@description Does nothing and ensures that the Update object is used; for testing only. This is an offline method. Can be called before authorization testUseUpdate = Update; -//@description Does nothing and ensures that the Error object is used; for testing only +//@description Does nothing and ensures that the Error object is used; for testing only. This is an offline method. Can be called before authorization testUseError = Error;