TD Java API

Предупреждение

Эта страница сохранена только в исторических целях. Информация на ней, скорее всего, уже не актуальна.

Описание интерфейса TD API производится с помощью TL-схемы со специальным образом сформированными комментариями, которая приведена ниже. Для Java-интерфейса доступны javadoc:

Документация класса

Описание интерфейса

---types---
//@description Object of this type returns on successful function call for some functions
ok = Ok;


//@class AuthState @description Represents current authorization state of the Client

//@description TDLib needs user's phone number to authorize
authStateWaitPhoneNumber = AuthState;
//@description TDLib needs user authentication code to finish authorization
authStateWaitCode = AuthState;
//@description User is authorized first time. TDLib needs its first and last names to complete autorization
authStateWaitName = AuthState;
//@description User is authorized but he needs to enter its password to begin to use application @hint Hint on password, can be empty @has_recovery Is recovery email set up
//@email_unconfirmed_pattern Pattern of email to which recovery mail was sent, empty before recovery email was sent
authStateWaitPassword hint:string has_recovery:Bool email_unconfirmed_pattern:string = AuthState;
//@description User is successfully authorized. TDLib can answer queries
authStateOk = AuthState;
//@description User is currently logging out
authStateLoggingOut = AuthState;


//@description Represents a file @id Unique file identifier, 0 for empty file @persistent_id Persistent file identifier, if exists. Can be used across application restarts or even other devices for current logged user
//@size File size, 0 if unknown @path Local path to file, empty for nondownloaded cloud file
file id:int persistent_id:string size:int path:string = File;


//@class InputFile @description Points to some file

//@description File defined by its id @id Unique file identifier
inputFileId id:int = InputFile;

//@description File defined by its persistent id @persistent_id Persistent file identifier
inputFilePersistentId persistent_id:string = InputFile;

//@description File deifned by local path @path Local path to the file
inputFileLocal path:string = InputFile;


//@description Photo description @type Thumbnail type (see https://core.telegram.org/constructor/photoSize)
//@photo Information about photo file @width Photo width @height Photo height
photoSize type:string photo:file width:int height:int = PhotoSize;

//@description Describes animation file. Animation should be in gif or mp4 format @width Width of the animation @height Height of the animation 
//@file_name Original name of a file as defined by sender @mime_type MIME type of a file, usually "image/gif" or "video/mp4" @thumb Animation thumb @animation File with the animation
animation width:int height:int file_name:string mime_type:string thumb:photoSize animation:file = Animation;

//@description Describes audio file. Audio is usually in mp3 format @duration Duration of the audio in seconds as defined by sender @title Title of the audio as defined by sender @performer Performer of the audio as defined by sender
//@file_name Original name of a file as defined by sender @mime_type MIME type of a file as defined by sender @album_cover_thumb Thumb of the album's cover as defined by sender. Full size thumb should be extracted from the downloaded file @audio File with the audio
audio duration:int title:string performer:string file_name:string mime_type:string album_cover_thumb:photoSize audio:file = Audio;

//@description Describes document of any type @file_name Original name of a file as defined by sender @mime_type MIME type of file as defined by sender
//@thumb Document thumb as defined by sender @document File with document
document file_name:string mime_type:string thumb:photoSize document:file = Document;

//@description Describes sticker @set_id Identifier of sticker set to which the sticker belongs or 0 if none @width Sticker width as defined by sender @height Sticker height as defined by sender
//@emoji Emoji corresponding to sticker @rating Rating of the sticker, non-negative. The rating is higher for often used stickers @thumb Sticker thumb in webp or jpeg format @sticker File with sticker
sticker set_id:long width:int height:int emoji:string rating:double thumb:photoSize sticker:file = Sticker;

//@description Describes photo @id Photo identifier, 0 for deleted photo @photos Available variants of photo of different sizes
photo id:long photos:vector<photoSize> = Photo;

//@description Describes video file @duration Duration of the video in seconds as defined by sender @width Video width as defined by sender @height Video height as defined by sender 
//@file_name Original name of a file as defined by sender @mime_type MIME type of a file as defined by sender @thumb Video thumb as defined by sender @video File with the video
video duration:int width:int height:int file_name:string mime_type:string thumb:photoSize video:file = Video;

//@description Describes voice record. Voice must be encoded with Opus codec and must be stored inside Ogg container @duration Duration of the voice record in seconds as defined by sender
//@waveform Waveform representation of the voice in 5-bit format @mime_type MIME type of a file as defined by sender @voice File with the voice record
voice duration:int waveform:bytes mime_type:string voice:file = Voice;

//@description Describes web page preview @url Original URL of link @display_url URL to display
//@type Type of web page: article, photo, audio, video, document, profile, app or something other
//@site_name Short name of the site (i.e. Google Docs or App Store) @title Title of the content @param_description Description of the content
//@photo Image representing the content @embed_url Url to show embedded preview @embed_type MIME type of embedded preview, i.e. text/html or video/mp4 @embed_width Width of embedded preview
//@embed_height Height of embedded preview @duration Duration of the content @author Author of the content
//@animation Preview as Animation if available
//@document Preview as Document if available (currently only for small pdf files)
//@sticker Preview as Sticker for small .webp files if available
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:int embed_height:int duration:int author:string animation:animation document:document sticker:sticker = WebPage;

//@description Describes location on Earth @longitude Longitude of location as defined by sender @latitude Latitude of location as defined by sender
location longitude:double latitude:double = Location;


//@description Describes user profile photo @id Photo identifier, 0 for empty photo. Can be used to find photo in list of userProfilePhotos
//@small Small (160x160) user profile photo @big Big (640x640) user profile photo
profilePhoto id:long small:file big:file = ProfilePhoto;

//@description Describes chat photo @small Small (160x160) chat photo @big Big (640x640) chat photo
chatPhoto small:file big:file = ChatPhoto;

//@description Specify crop settings for square preview of uploaded profile photo or chat photo @left X-coordinate for the upper left corner of the square, in percent from photo width @top Y-coordinate for the upper left corner of the square, in percent from photo height
//@width Width of the square, in percent from photo width
photoCrop left:double top:double width:double = PhotoCrop;


//@class LinkState @description Represents ordered relationship between two users

//@description Other user's phone number doesn't known
linkStateNone = LinkState;

//@description Other user's phone number is known but user not in contacts list
linkStateKnowsPhoneNumber = LinkState;

//@description Other user is in contacts list, particularly its phone number is known
linkStateContact = LinkState;


//@class UserType @description Allows to distinguish different kinds of users: general users, deleted users and bots

//@description General user
userTypeGeneral = UserType;

//@description Deleted user or deleted bot. There is no any information about it except user_id. None of active action can be performed with deleted user
userTypeDeleted = UserType;

//@description Bot (see https://core.telegram.org/bots) @can_join_group_chats If true, bot can be invited to group and supergroup chats
//@can_read_all_group_chat_messages If true, bot can read all group or supergroup chat messages, not only addressed to him. In private chats bot always can read all messages
//@is_inline True, if bot supports inline queries @inline_query_placeholder Placeholder for inline query
userTypeBot can_join_group_chats:Bool can_read_all_group_chat_messages:Bool is_inline:Bool inline_query_placeholder:string = UserType;

//@description Currently there is no any information about user except user_id. It can happens very-very rarely. None of active action can be performed with unknown user
userTypeUnknown = UserType;


//@description Represents command supported by bot @command Text of the bot command @param_description Description of the bot command
botCommand command:string description:string = BotCommand;

//@class BotInfo @description Provides information about bot and command supported by him

//@description User is not a bot or information is not known
botInfoEmpty = BotInfo;

//@description User is a bot @share_text Small bot description shown when sharing bot @param_description Big description shown in user info page @commands List of commands cupported by bot
botInfoGeneral share_text:string description:string commands:vector<botCommand> = BotInfo;


//@description Represents user @id User identifier @first_name User first name @last_name User last name @username User username
//@phone_number User's phone number @status User's online status @profile_photo User profile photo
//@my_link Relationships from me to other user @foreign_link Relationships from other user to me @is_verified True, if user is verified @restriction_reason If non-empty, contains the reason, why access to this user must be restricted, for example, "explicit"
//@have_access If false, the user is inaccessible and the only known information about it is inside this class. It can't be passed to any method except GetUser. Currently it can be false only for inaccessible authors of the channel posts @type Type of the user
user id:int first_name:string last_name:string username:string phone_number:string status:UserStatus profile_photo:profilePhoto my_link:LinkState foreign_link:LinkState is_verified:Bool restriction_reason:string have_access:Bool type:UserType = User;

//@description Gives full information about user (except full list of profile photos) @user General info about user @is_blocked Is user blacklisted by current user @bot_info Information about bot if user is a bot
userFull user:user is_blocked:Bool bot_info:BotInfo = UserFull;

//@description Contains part of the list of user photos @total_count Total number of user profile photos @photos List of photos
userProfilePhotos total_count:int photos:vector<photo> = UserProfilePhotos;


//@class ChatParticipantRole @description Provides information about priveleges of participant in the chat

//@description Creator of the chat, can delete any message, kick any user and add editors and moderators in channels
chatParticipantRoleAdmin = ChatParticipantRole;

//@description In channels, participant that can post messages on behalf of the channel and have moderator rights. In groups and supergroups, participant that can add new participants to the chat/kick unpriviledged participants
chatParticipantRoleEditor = ChatParticipantRole;

//@description Only for channels, participant that can delete messages of unprivileged participants and kick them
chatParticipantRoleModerator = ChatParticipantRole;

//@description User have no any additional privileges
chatParticipantRoleGeneral = ChatParticipantRole;

//@description User is not a chat participant
chatParticipantRoleLeft = ChatParticipantRole;

//@description User was kicked from the chat (and obviously is not a chat participant)
chatParticipantRoleKicked = ChatParticipantRole;


//@description User with information about its chat joining/kicking @user Participant of a chat @inviter_id Identifier of a user invited this participant to/kicked this participant from the chat, 0 if unknown
//@join_date Date the user has joined a chat @role Privileges of user in the chat @bot_info Information about bot if user is a bot
chatParticipant user:user inviter_id:int join_date:int role:ChatParticipantRole bot_info:BotInfo = ChatParticipant;

//@description Contains list of chat participants @total_count Approximate total count of found chat participants @participants List of participants
chatParticipants total_count:int participants:vector<chatParticipant> = ChatParticipants;


//@class ChannelParticipantsFilter @description Specifies kind of chat users to return in getChannelParticipants

//@description Return recently joined users in reverse chronological order
channelParticipantsRecent = ChannelParticipantsFilter;

//@description Return privileged participants
channelParticipantsAdmins = ChannelParticipantsFilter;

//@description Return kicked from the channel
channelParticipantsKicked = ChannelParticipantsFilter;

//@description Return bots in the channel
channelParticipantsBots = ChannelParticipantsFilter;


//@description Represents a group of zero or more other users @id Group identifier
//@participants_count Group participants count
//@role Role of current user in the group
//@anyone_can_edit True, if all participants granted editor rights in the group
//@is_active True, if group is active
//@migrated_to_channel_id Identifier of channel (supergroup) to which this group was migrated or 0 if none
group id:int participants_count:int role:ChatParticipantRole anyone_can_edit:Bool is_active:Bool migrated_to_channel_id:int = Group;

//@description Gives full information about group @group General info about group
//@admin_id Identifier of group creator, 0 if unknown @participants Group participants
//@invite_link Invite link for this group, available only for group admin and only after it is generated at least once
groupFull group:group admin_id:int participants:vector<chatParticipant> invite_link:string = GroupFull;


//@description Represents a channel with zero or more subscribers
//@id Channel identifier
//@username Channel username, empty for private channels
//@date Date when current user has joined the channel or date when channel was created, if user is not a participant. Unix time
//@role Role of current user in the channel
//@anyone_can_invite True, if any participant of the supergroup can invite other participants. If the channel is not a supergroup, the field is meaningless
//@sign_messages True, if messages sent to the channel should content information about the sender. If the channel is a supergroup, the field is meaningless
//@is_broadcast True, if only messages from admin and editors allowed in the channel
//@is_supergroup True, if channel is supergroup
//@is_verified True for verified channels
//@restriction_reason If non-empty, contains the reason, why access to this channel must be restricted, for example, "explicit"
channel id:int username:string date:int role:ChatParticipantRole anyone_can_invite:Bool sign_messages:Bool is_broadcast:Bool is_supergroup:Bool is_verified:Bool restriction_reason:string = Channel;

//@description Gives full information about a channel @channel General info about the channel @about Information about the channel @participants_count Channel participants count, 0 if unknown @admins_count Channel admins count, 0 if unknown
//@kicked_count Number of users kicked from the channel, 0 if unknown @can_get_participants True, if participants of the channel can be retrieved @invite_link Invite link for this channel
//@migrated_from_group_id Identifier of the group, this supergroup migrated from, or 0 if none @migrated_from_max_message_id Identifier of last message in the group chat migrated from, or 0 if none
channelFull channel:channel about:string participants_count:int admins_count:int kicked_count:int can_get_participants:Bool invite_link:string migrated_from_group_id:int migrated_from_max_message_id:int = ChannelFull;


//@description Represents a secret chat
secretChat user_id:int state:int ttl:int = SecretChat;

//@description Gives full information about a secret chat
secretChatFull secret_chat:secretChat key_hash:string = SecretChatFull;


//@description Contains chat invite link @invite_link Chat invite link
chatInviteLink invite_link:string = ChatInviteLink;

//@description Contains information about chat invite link @chat_id Chat identifier of the invite link or 0 if user is not a participant of the chat @title Title of the chat @is_group True, if the chat is group chat @is_channel True, if the chat is channel chat
//@is_broadcast_channel True, if the chat is channel chat with comments disabled @is_public_channel True, if the chat is channel chat with set up username @is_supergroup_channel True, if the chat is channel supergroup chat
chatInviteLinkInfo chat_id:long title:string is_group:Bool is_channel:Bool is_broadcast_channel:Bool is_public_channel:Bool is_supergroup_channel:Bool = ChatInviteLinkInfo;


//@description User contacts @users List of users
contacts users:vector<user> = Contacts;

//@description User contact to be imported/edited @phone_number Contact's phone number @first_name Contact first name, can be empty if unknown @last_name Contact last name
inputContact phone_number:string first_name:string last_name:string = InputContact;


//@description Contains list of users @users List of users
users users:vector<user> = Users;


//@class MessageForwardInfo @description Contains information about initial sender of forwarded message

//@description Message is not forwarded
messageNotForwarded = MessageForwardInfo;

//@description Message is originally written by known user @user_id Identifier of user, who originally sent this message @date Date when message was originally sent
messageForwardedFromUser user_id:int date:int = MessageForwardInfo;

//@description Message is written on behalf of the channel @channel_id Identifier of the channel from which message is forwarded @date Date when message was originally sent
//@user_id User identifier of the original message author, 0 if unknown @message_id Message identifier of the message from which the message is forwarded, 0 if unknown
messageForwardedFromChannel channel_id:int date:int user_id:int message_id:int = MessageForwardInfo;


//@class MessageSendState @description Contains information about sending state of the message

//@description Message is incoming
messageIsIncoming = MessageSendState;

//@description Message is outgoing but is yet not delivered to the server
messageIsBeingSent = MessageSendState;

//@description Message was synchronized with the server
messageIsSuccessfullySent = MessageSendState;

//@description Message is failed to send
messageIsFailedToSend = MessageSendState;


//@description Describes message
//@id Unique message identifier
//@from_id User which sent the message, 0 if unknown. It can be unknown for channel posts which are not signed by the author
//@chat_id Chat identifier
//@send_state Information about sending state of the message
//@can_be_deleted True, if message can be deleted
//@is_post True, if message is channel post. All messages to broadcasts are posts, all messages to supergroup are not posts
//@date Date when message was sent, unix time
//@edit_date Date when message was edited last time, unix time
//@forward_info Information about initial message sender
//@reply_to_message_id If non-zero, identifier of the message this message replies to
//@via_bot_id If non-zero, identifier of the bot this message is sent via
//@views Number of times this message was viewed
//@content Content of the message
//@reply_markup Reply markup for the message
message id:int from_id:int chat_id:long send_state:MessageSendState can_be_deleted:Bool is_post:Bool date:int edit_date:int forward_info:MessageForwardInfo reply_to_message_id:int via_bot_id:int views:int content:MessageContent reply_markup:ReplyMarkup = Message;

//@description Contains list of messages @total_count Approximate total count of found messages @messages List of messages
messages total_count:int messages:vector<message> = Messages;


//@class NotificationSettingsScope @description Describes kinds of chat for which notification settings are applied

//@description Notification settings applied to particular chat @chat_id Chat identifier
notificationSettingsForChat chat_id:long = NotificationSettingsScope;

//@description Notification settings applied to all private chats
notificationSettingsForPrivateChats = NotificationSettingsScope;

//@description Notification settings applied to all group chats
notificationSettingsForGroupChats = NotificationSettingsScope;

//@description Notification settings applied to all chats
notificationSettingsForAllChats = NotificationSettingsScope;


//@description Contains information about notification settings for chat or chats @mute_for Time left before notifications will be unmuted @sound Audio file name for notifications
//@show_previews Display text in notification
notificationSettings mute_for:int sound:string show_previews:Bool = NotificationSettings;


//@class ChatInfo @description Describes type of a chat

//@description Ordinary chat with one user @user Information about interlocutor
privateChatInfo user:user = ChatInfo;

//@description Chat with zero or more other users @group Information about the chat
groupChatInfo group:group = ChatInfo;

//@description Chat with unlimited number of participants @channel Information about the chat
channelChatInfo channel:channel = ChatInfo;

//@description Secret chat with one user @user Information about interlocutor
secretChatInfo secretChat:secretChat = ChatInfo;

//@description Chat (private chat or group chat or channel chat)
//@id Chat unique identifier
//@title Chat title
//@photo Chat photo
//@top_message Last message in the chat
//@order Parameter by descending of which chats are sorted in the chat list. If order of two chats is equal, then they need to be sorted by id also in descending order. If order == 0, position of the chat in the list is undetermined.
//@unread_count Count of unread messages in the chat
//@last_read_inbox_message_id Identifier of last read incoming message
//@last_read_outbox_message_id Identifier of last read outgoing message
//@notification_settings Notification settings for this chat
//@reply_markup_message_id Identifier of message from which reply markup need to be used or 0 if there is no default custom reply markup in the chat
//@type Information about type of the chat
chat id:long title:string photo:chatPhoto top_message:message order:long unread_count:int last_read_inbox_message_id:int last_read_outbox_message_id:int notification_settings:notificationSettings reply_markup_message_id:int type:ChatInfo = Chat;

//@description Contains list of chats @chats List of chats
chats chats:vector<chat> = Chats;


//@class ReplyMarkup @description Contains description of custom keyboard and actions with it for fast reply to bots

//@description Absent reply markup
replyMarkupNone = ReplyMarkup;

//@description Instruct clients to hide keyboard after receiving this message. This kind of keyboard can't be received. Instead UpdateChatReplyMarkup with message_id == 0 will be send
//@personal Keyboard is showed automatically only for mentioned users or replied to chat user, for incoming messages it is true if and only if keyboard needs to be automatically showed to current user
replyMarkupHideKeyboard personal:Bool = ReplyMarkup;

//@description Instruct clients to force reply to this message @personal Keyboard is showed automatically only for mentioned users or replied to chat user, for incoming messages it is true if and only if keyboard needs to be automatically showed to current user
replyMarkupForceReply personal:Bool = ReplyMarkup;

//@description Contains custom keyboard layout for fast reply to bot @rows List of rows of bot commands
//@resize_keyboard Do clients need to resize keyboard
//@one_time Do clients need to hide keyboard after use
//@personal Keyboard is showed automatically only for mentioned users or replied to chat user, for incoming messages it is true if and only if keyboard needs to be automatically showed to current user
replyMarkupShowKeyboard rows:vector<vector<string>> resize_keyboard:Bool one_time:Bool personal:Bool = ReplyMarkup;


//@class MessageContent @description Content of a message

//@description Text message @text Text of the message @entities Entities contained in the text
messageText text:string entities:vector<MessageEntity> = MessageContent;

//@description Animation message @animation Message content @caption Animation caption
messageAnimation animation:animation caption:string = MessageContent;

//@description Audio message @audio Message content @is_listened True, if the audio message was listened to
messageAudio audio:audio is_listened:Bool = MessageContent;

//@description Document message @document Message content @caption Document caption
messageDocument document:document caption:string = MessageContent;

//@description Photo message @photo Message content @caption Photo caption
messagePhoto photo:photo caption:string = MessageContent;

//@description Sticker message @sticker Message content
messageSticker sticker:sticker = MessageContent;

//@description Video message @video Message content @caption Video caption
messageVideo video:video caption:string = MessageContent;

//@description Voice message @voice Message content @is_listened True, if the voice message was listened to
messageVoice voice:voice is_listened:Bool = MessageContent;

//@description Text message with web page preview @text Text of the message @entities Entities contained in the text @web_page Preview of web page mentioned in text
messageWebPage text:string entities:vector<MessageEntity> web_page:webPage = MessageContent;

//@description Message with location @location Message content
messageLocation location:location = MessageContent;

//@description Message with information about venue @location Venue location as defined by sender @title Venue name as defined by sender @address Venue address as defined by sender
//@provider Provider of venue database as defined by sender. Only "foursquare" need to be supported currently @venue_id Identifier of the venue in provider database as defined by sender
messageVenue location:location title:string address:string provider:string venue_id:string = MessageContent;

//@description User contact message @phone_number User's phone number @first_name User first name @last_name User last name @user_id User identifier, 0 if none
messageContact phone_number:string first_name:string last_name:string user_id:int = MessageContent;

//@description New group chat created @title Title of created group chat @participants Parcticipants of created group chat
messageGroupChatCreate title:string participants:vector<user> = MessageContent;

//@description New channel chat created @title Title of created channel chat
messageChannelChatCreate title:string = MessageContent;

//@description Chat title changed @title New chat title
messageChatChangeTitle title:string = MessageContent;

//@description Chat photo changed @photo New chat photo
messageChatChangePhoto photo:photo = MessageContent;

//@description Chat photo deleted
messageChatDeletePhoto = MessageContent;

//@description Chat participants added @participants New chat participant
messageChatAddParticipants participants:vector<user> = MessageContent;

//@description Chat participant joined by invite link @inviter_id Inviter of participant
messageChatJoinByLink inviter_id:int = MessageContent;

//@description Chat participant deleted @user Left or kicked chat participant
messageChatDeleteParticipant user:user = MessageContent;

//@description Group chat is migrated to supergroup channel and deactivated @channel_id Identifier of the channel it is migrated to
messageChatMigrateTo channel_id:int = MessageContent;

//@description Supergroup channel is created from group chat @title Title of created channel chat @group_id Identifier of the group it is migrated from
messageChatMigrateFrom title:string group_id:int = MessageContent;

//@description Message was deleted or was never existed
messageDeleted = MessageContent;

//@description Unsupported message content
messageUnsupported = MessageContent;


//@class MessageEntity @description Represent part of the message text which needs to be formatted in some unusual way

//@description Mention of the user beginning with ampersand @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points
messageEntityMention offset:int length:int = MessageEntity;

//@description Hashtag beginning with # @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points
messageEntityHashtag offset:int length:int = MessageEntity;

//@description Bot command beginning with / @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points
messageEntityBotCommand offset:int length:int = MessageEntity;

//@description Url beginning with http @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points
messageEntityUrl offset:int length:int = MessageEntity;

//@description Email @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points
messageEntityEmail offset:int length:int = MessageEntity;

//@description Bold text @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points
messageEntityBold offset:int length:int = MessageEntity;

//@description Italic text @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points
messageEntityItalic offset:int length:int = MessageEntity;

//@description Text needs to be formatted as inside of code HTML tag @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points
messageEntityCode offset:int length:int = MessageEntity;

//@description Text needs to be formatted as inside of pre HTML tag @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points
messageEntityPre offset:int length:int = MessageEntity;

//@description Text needs to be formatted as inside of pre and code HTML tags @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points @language Language of code as defined by sender
messageEntityPreCode offset:int length:int language:string = MessageEntity;

//@description Text description showed instead of the url @offset Offset of the entity in UTF-16 code points @length Length of the entity in UTF-16 code points @url Url to be opened after link will be clicked
messageEntityTextUrl offset:int length:int url:string = MessageEntity;


//@class InputMessageContent @description Content of a message to send

//@description Text message @text Text to send @disable_web_page_preview Pass true to disable rich preview for link in the message text @entities Bold, Italic, Code, Pre, PreCode and TextUrl entities contained in the text. General users can specify only Pre entities
inputMessageText text:string disable_web_page_preview:Bool entities:vector<MessageEntity> = InputMessageContent;

//@description Animation message @animation Animation file to send @width Width of the animation, may be replaced by the server @height Height of the animation, may be replaced by the server @caption Animation caption
inputMessageAnimation animation:InputFile width:int height:int caption:string = InputMessageContent;

//@description Audio message @audio Audio file to send @duration Duration of audio in seconds, may be replaced by the server @title Title of the audio, may be replaced by the server @performer Performer of the audio, may be replaced by the server
inputMessageAudio audio:InputFile duration:int title:string performer:string = InputMessageContent;

//@description Document message @document Document to send @caption Document caption
inputMessageDocument document:InputFile caption:string = InputMessageContent;

//@description Photo message @photo Photo to send @caption Photo caption
inputMessagePhoto photo:InputFile caption:string = InputMessageContent;

//@description Sticker message @sticker Sticker to send
inputMessageSticker sticker:InputFile = InputMessageContent;

//@description Video message @video Video to send @caption Video caption @duration Duration of video in seconds @width Video width @height Video height
inputMessageVideo video:InputFile caption:string duration:int width:int height:int = InputMessageContent;

//@description Voice message @voice Voice file to send @duration Duration of voice in seconds @waveform Waveform representation of the voice in 5-bit format
inputMessageVoice voice:InputFile duration:int waveform:bytes = InputMessageContent;

//@description Message with location @longitude Longitude of location @latitude Latitude of location
inputMessageLocation longitude:double latitude:double = InputMessageContent;

//@description Message with information about venue @longitude Longitude of location @latitude Latitude of location @title Venue name @address Venue address
//@provider Provider of venue database. Only "foursquare" need to be supported currently @venue_id Identifier of the venue in provider database
inputMessageVenue longitude:double latitude:double title:string address:string provider:string venue_id:string = InputMessageContent;

//@description User contact message @phone_number User's phone number @first_name User first name @last_name User last name @user_id User identifier if known. Will be replaced by the server
inputMessageContact phone_number:string first_name:string last_name:string user_id:int = InputMessageContent;

//@description Forwarded message @from_chat_id Chat identifier of message to forward @message_id Identifier of message to forward
inputMessageForwarded from_chat_id:long message_id:int = InputMessageContent;


//@class SearchMessagesFilter @description Represents filter for content of searched messages

//@description Return all found messages
searchMessagesFilterEmpty = SearchMessagesFilter;

//@description Return only animation messages
searchMessagesFilterAnimation = SearchMessagesFilter;

//@description Return only audio messages
searchMessagesFilterAudio = SearchMessagesFilter;

//@description Return only document messages
searchMessagesFilterDocument = SearchMessagesFilter;

//@description Return only photo messages
searchMessagesFilterPhoto = SearchMessagesFilter;

//@description Return only video messages
searchMessagesFilterVideo = SearchMessagesFilter;

//@description Return only voice messages
searchMessagesFilterVoice = SearchMessagesFilter;

//@description Return only photo and video messages
searchMessagesFilterPhotoAndVideo = SearchMessagesFilter;

//@description Return only messages containing url
searchMessagesFilterUrl = SearchMessagesFilter;


//@class SendMessageAction @description Notifies about activity in chat

//@description User typing message
sendMessageTypingAction = SendMessageAction;
//@description User cancels typing
sendMessageCancelAction = SendMessageAction;
//@description User records a video
sendMessageRecordVideoAction = SendMessageAction;
//@description User uploads a video @progress Upload progress in percents
sendMessageUploadVideoAction progress:int = SendMessageAction;
//@description User records voice message
sendMessageRecordVoiceAction = SendMessageAction;
//@description User uploads voice message @progress Upload progress in percents
sendMessageUploadVoiceAction progress:int = SendMessageAction;
//@description User uploads a photo @progress Upload progress in percents
sendMessageUploadPhotoAction progress:int = SendMessageAction;
//@description User uploads a document @progress Upload progress in percents
sendMessageUploadDocumentAction progress:int = SendMessageAction;
//@description User sends geolocation
sendMessageGeoLocationAction = SendMessageAction;
//@description User chooses contact to send
sendMessageChooseContactAction = SendMessageAction;


//@class UserStatus @description Describes last time user was online

//@description User status was newer changed
userStatusEmpty = UserStatus;

//@description User is online @expires Unix time when user's online status will expire
userStatusOnline expires:int = UserStatus;

//@description User is offline @was_online Unix time user was online last time
userStatusOffline was_online:int = UserStatus;

//@description User was online recently
userStatusRecently = UserStatus;

//@description User is offline, but was online last week
userStatusLastWeek = UserStatus;

//@description User is offline, but was online last month
userStatusLastMonth = UserStatus;


//@description Represents list of stickers @stickers Stickers
stickers stickers:vector<sticker> = Stickers;

//@description Represents sticker set @id Sticker set identifier @title Title of the sticker set @name Name of the sticker set @rating Rating of the sticker, non-negative. The rating is higher for often used stickers
//@is_installed True if sticker set is installed by logged in user @is_enabled True if sticker set is enabled @is_official True if sticker set is official and can't be uninstalled @stickers List of stickers in this set
stickerSet id:long title:string name:string rating:double is_installed:Bool is_enabled:Bool is_official:Bool stickers:vector<sticker> = StickerSet;

//@description Represents short information about sticker set @id Sticker set identifier @title Title of the sticker set @name Name of the sticker set @rating Rating of the sticker, non-negative. The rating is higher for often used stickers
//@is_installed True if sticker set is installed by logged in user @is_enabled True if sticker set is enabled @is_official True if sticker set is official and can't be uninstalled @size Number of stickers in the set
stickerSetInfo id:long title:string name:string rating:double is_installed:Bool is_enabled:Bool is_official:Bool size:int = StickerSetInfo;

//@description Represents list of sticker sets @sets List of sticker sets
stickerSets sets:vector<stickerSetInfo> = StickerSets;


//@description Represents list of animations @animations Animations
animations animations:vector<animation> = Animations;


//@class InlineQueryResult @description Represents one result of the inline query

//@description Represents link to an article or web page @id Unique identifier of this result @url Url of the result, if exists @hide_url True, if url must be not shown @title Title of the result
//@param_description Short description of the result @thumb_url Url of the result thumb, if exists @thumb_width Thumb width, if known @thumb_height Thumb height, if known
//@message Message to be sent, should be of type inputMessageText
inlineQueryResultArticle id:string url:string hide_url:Bool title:string description:string thumb_url:string thumb_width:int thumb_height:int message:InputMessageContent = InlineQueryResult;

//@description Represents link to a jpeg photo @id Unique identifier of this result @title Title of the result, if known @param_description Short description of the result, if known @thumb_url Url of the photo thumb, if exists
//@photo_url Url of the jpeg photo (photo must not exceed 5MB) @photo_width Width of the photo @photo_height Height of the photo
//@message Message to be sent, should be of type inputMessageText or inputMessagePhoto
inlineQueryResultPhoto id:string title:string description:string thumb_url:string photo_url:string photo_width:int photo_height:int message:InputMessageContent = InlineQueryResult;

//@description Represents link to an animated gif @id Unique identifier of this result @title Title of the result @thumb_url Url of the static result thumb (jpeg or gif), if exists
//@gif_url Url of the gif-file (file size must not exceed 1MB) @gif_width Width of the gif @gif_height Height of the gif
//@message Message to be sent, should be of type inputMessageText or inputMessageAnimation
inlineQueryResultAnimatedGif id:string title:string thumb_url:string gif_url:string gif_width:int gif_height:int message:InputMessageContent = InlineQueryResult;

//@description Represents link to an animated (i.e. without sound) H.264/MPEG-4 AVC video @id Unique identifier of this result @title Title of the result @thumb_url Url of the static result thumb (jpeg or gif), if exists
//@mpeg4_url Url of the mp4-file (file size must not exceed 1MB) @mpeg4_width Width of the video @mpeg4_height Height of the video
//@message Message to be sent, should be of type inputMessageText or inputMessageAnimation
inlineQueryResultAnimatedMpeg4 id:string title:string thumb_url:string mpeg4_url:string mpeg4_width:int mpeg4_height:int message:InputMessageContent = InlineQueryResult;

//@description Represents link to a page containing an embedded video player or a video file @id Unique identifier of this result @title Title of the result @param_description Short description of the result, if known
//@thumb_url Url of the video thumb (jpeg), if exists @video_url Url of the embedded video player or video file @mime_type MIME type of the content of video url, i.e. "text/html" or "video/mp4"
//@video_width Video width @video_height Video height @video_duration Video duration in seconds
//@message Message to be sent, should be of type inputMessageText
inlineQueryResultVideo id:string title:string description:string thumb_url:string video_url:string mime_type:string video_width:int video_height:int video_duration:int message:InputMessageContent = InlineQueryResult;

//@description Represents photo cached on the telegram server @id Unique identifier of this result @photo The photo @message Message to be sent, should be of type inputMessageText or inputMessagePhoto
inlineQueryResultCachedPhoto id:string photo:photo message:InputMessageContent = InlineQueryResult;

//@description Represents animation cached on the telegram server @id Unique identifier of this result @animation The animation @message Message to be sent, should be of type inputMessageText or inputMessageAnimation
inlineQueryResultCachedAnimation id:string animation:animation message:InputMessageContent = InlineQueryResult;

//@description Represents results of the inline query. Use sendInlineQueryResultMessage to send the result of the query @inline_query_id Unique identifier of the inline query @next_offset Offset for the next request. If it is empty, there is no more results @results Results of the query
inlineQueryResults inline_query_id:long next_offset:string results:vector<InlineQueryResult> = InlineQueryResults;


//@class OptionValue @description Represents value of an option

//@description Boolean option @value Value of an option
optionBoolean value:Bool = OptionValue;

//@description Unknown option or option having default value
optionEmpty = OptionValue;

//@description Integer option @value Value of an option
optionInteger value:int = OptionValue;

//@description String option @value Value of an option
optionString value:string = OptionValue;


//@class Update @description Contains notifications about data changes

//@description New message received, maybe outcoming message sent from other device @message New message
updateNewMessage message:message = Update;

//@description Sent message gets persistent unique identifier @chat_id Chat identifier @old_id Temporary message identifier returned by sendMessage
//@new_id New persistent unique message identifier
updateMessageId chat_id:long old_id:int new_id:int = Update;

//@description Sent message gets new date @chat_id Chat identifier @message_id Message identifier @new_date New date
updateMessageDate chat_id:long message_id:int new_date:int = Update;

//@description Sent message gets new content @chat_id Chat identifier @message_id Message identifier @new_content New message content
updateMessageContent chat_id:long message_id:int new_content:MessageContent = Update;

//@description Message fails to send. Be aware that some being sent messages can be irrecoverably deleted and updateDeleteMessages will come instead of this update (or doesn't come at all if deletion was done by call to deleteMessages) @chat_id Chat identifier @message_id Message identifier @error_code Error code @error_description Error description
updateMessageSendFailed chat_id:long message_id:int error_code:int error_description:string = Update;

//@description Views count of the message has changed @chat_id Chat identifier @message_id Message identifier @views New value of views count
updateMessageViews chat_id:long message_id:int views:int = Update;

//@description Some date about chat has been changed @chat New data about the chat
updateChat chat:chat = Update;

//@description Position of the chat in the chat list need to be updated @chat_id Chat identifier @order New value of the order 
updateChatOrder chat_id:long order:long = Update;

//@description Title of chat was changed @chat_id Chat identifier @title New chat title
updateChatTitle chat_id:long title:string = Update;

//@description Chat photo was changed @chat_id Chat identifier @photo New chat photo
updateChatPhoto chat_id:long photo:chatPhoto = Update;

//@description User reads incoming messages from some other device @chat_id Chat identifier @last_read_inbox_message_id Identifier of last read incoming message
//@unread_count Number of unread messages left in chat
updateChatReadInbox chat_id:long last_read_inbox_message_id:int unread_count:int = Update;

//@description Some outcoming messages was read @chat_id Chat identifier @last_read_outbox_message_id Identifier of last read outgoing message
updateChatReadOutbox chat_id:long last_read_outbox_message_id:int = Update;

//@description Default chat reply markup has changed. It can happen because new message with reply markup has come or old reply markup was hidden by user
//@chat_id Chat identifier @reply_markup_message_id Identifier of message from which reply markup need to be used or 0 if there is no default custom reply markup in the chat
updateChatReplyMarkup chat_id:long reply_markup_message_id:int = Update;

//@description Notification settings for some chats was updated @scope Kinds of chats for which notification settings was updated
//@notification_settings New notification settings
updateNotificationSettings scope:NotificationSettingsScope notification_settings:notificationSettings = Update;

//@description Some messages was deleted @chat_id Chat identifier @message_ids Identifiers of deleted message
updateDeleteMessages chat_id:long message_ids:vector<int> = Update;

//@description Some chat activity @chat_id Chat identifier @user_id Identifier of user doing action @action Action description
updateUserAction chat_id:long user_id:int action:SendMessageAction = Update;

//@description User went online/offline @user_id User identifier @status New user status
updateUserStatus user_id:int status:UserStatus = Update;

//@description Some data about user has been changed @user New data about the user
updateUser user:user = Update;

//@description Some data about group has been changed @group New data about the group
updateGroup group:group = Update;

//@description Some data about channel has been changed @channel New data about the channel
updateChannel channel:channel = Update;

//@description Some data about secret chat has been changed @secret_chat New data about the secret chat
updateSecretChat secret_chat:SecretChat = Update;

//@description User blocked/unblocked @user_id User identifier @is_blocked Is user blacklisted by current user
updateUserBlocked user_id:int is_blocked:Bool = Update;

//@description User has logged in from another device @date Date of logging in @device Device used to log in @location Location from where user logged in
updateNewAuthorization date:int device:string location:string = Update;

//@description File is partly downloaded/uploaded @file_id File identifier @size Total file size (0 means unknown) @ready Bytes downloaded/uploaded. Negative number means that download/upload has failed and was terminated
updateFileProgress file_id:int size:int ready:int = Update;

//@description File is downloaded/uploaded @file Synced file
updateFile file:file = Update;

//@description Some option changed its value @name Option name @value New option value
updateOption name:string value:OptionValue = Update;

//@description Some stickers was updated. Need to drop stickers cache if have some
updateStickers = Update;

//@description List of saved animations was updated. Need to drop saved animations cache if have some
updateSavedAnimations = Update;

//@description New incoming inline query. Bots only @id Unique query identifier @from_id Identifier of the user sent the query @query Text of the the query @offset Offset of the first entry to return
updateNewInlineQuery id:long from_id:int query:string offset:string = Update;

//@description User has chosen a result of the inline query. Bots only @from_id Identifier of the user sent the query @query Text of the the query @result_id Identifier of the chosen result
updateNewChosenInlineResult from_id:int query:string result_id:string = Update;

---functions---

//@description Returns current authorization state, offline request
getAuthState = AuthState;

//@description Sets user's phone number and sends authentication code to the user. Works only when authGetState returns authStateWaitPhoneNumber or returns authStateWaitCode and checkAuthCode was not yet called.
//- If phone number is invalid or doesn't recognized or another error has happened, returns error. Otherwise if user is already registered returns authStateWaitCode. Otherwise returns authStateWaitName
//@phone_number User's phone number in any reasonable format
setAuthPhoneNumber phone_number:string = AuthState;
//@description Sets user first_name and last_name. Works only when authGetState returns authStateWaitName. Returns authStateWaitCode on success @first_name User first name @last_name User last name
setAuthName first_name:string last_name:string = AuthState;
//@description Checks authorization code. Works only when authGetState returns authStateWaitCode. Returns authStateWaitPassword or authStateOk on success @code Verification code from SMS, Telegram message or voice call
checkAuthCode code:string = AuthState;
//@description Checks password for correctness. Works only when authGetState returns authStateWaitPassword. Returns authStateOk on success @password Password to check
checkAuthPassword password:string = AuthState;
//@description Requests to send recover code to email. Works only when authGetState returns authStateWaitPassword. Returns authStateWaitPassword on success
requestAuthPasswordRecovery = AuthState;
//@description Recovers password with recover code sent to email. Works only when authGetState returns authStateWaitPassword. Returns authStateOk on success @recover_code Recover code to check
recoverAuthPassword recover_code:string = AuthState;
//@description Logs out user. If force == false, begins to perform soft log out, returns authStateLoggingOut after completion. If force == true then succeeds almost immediately without cleaning anything at the server, but returns error with description "No auth"
//@force If true, just delete all local data. Session will remain in list of active sessions
resetAuth force:Bool = AuthState;

//@description Check bot's authentication token to log in as a bot. Can be used instead of setAuthPhoneNumber and checkAuthCode to log in @token Bot token
checkAuthBotToken token:string = AuthState;


//@description Returns current logged in user
getMe = User;

//@description Returns information about user by its identifier, offline request @user_id User identifier
getUser user_id:int = User;

//@description Returns full information about user by its identifier @user_id User identifier
getUserFull user_id:int = UserFull;

//@description Returns information about group by its identifier, offline request @group_id Group identifier
getGroup group_id:int = Group;

//@description Returns full information about group by its identifier @group_id Group identifier
getGroupFull group_id:int = GroupFull;

//@description Returns information about channel by its identifier, offline request @channel_id Channel identifier
getChannel channel_id:int = Channel;

//@description Returns full information about channel by its identifier, cached for at most 1 minute @channel_id Channel identifier
getChannelFull channel_id:int = ChannelFull;

//@description Returns information about chat by its identifier, offline request @chat_id Chat identifier
getChat chat_id:long = Chat;

//@description Returns information about message @chat_id Identifier of chat message belongs to @message_id Identifier of message to get
getMessage chat_id:long message_id:int = Message;

//@description Returns information about file, offline request @file_id Identifier of file to get
getFile file_id:int = File;

//@description Returns information about file by its persistent id, offline request @persistent_file_id Persistent identifier of file to get
getFilePersistent persistent_file_id:string = File;


//@description Returns list of chats in the right order, chats are sorted by (order, chat_id) in decreasing order. For example, to get list of chats from the beginning, the offset_order should be equal 2^63 - 1 @offset_order Chat order to return chats from @offset_chat_id Chat identifier to return chats from @limit Maximum number of chats to be returned
getChats offset_order:long offset_chat_id:long limit:int = Chats;

//@description Searches public chats by prefix of their username. Currently only private and channel (including supergroup) chats can be public. Returns meaningful number of results. Returns nothing if length of the searched username prefix is less than 5. Excludes private chats with contacts from the results @username_prefix Prefix of the username to search
searchPublicChats username_prefix:string = Chats;

//@description Searches for specified query in the title and username of known chats, offline request. Returns chats in the order of them in the chat list @query Query to search for, if query is empty, returns up to 20 recently found chats @limit Maximum number of chats to be returned
searchChats query:string limit:int = Chats;

//@description Adds chat to the list of recently found chats. The chat is added to the beginning of the list. If the chat is already in the list, at first it is removed from the list @chat_id Identifier of the chat to add
addRecentlyFoundChat chat_id:long = Ok;

//@description Clears list of recently found chats
deleteRecentlyFoundChats = Ok;


//@description Returns messages in a chat. Automatically calls openChat. Returns result in reverse chronological order, i.e. in order of decreasing message.id @chat_id Chat identifier @from_id Identifier of the message near which we need a history, you can use 0 to get results from beginning
//@offset Messages to skip, can be negative to get specified message and newer messages @limit Maximum number of messages to be returned, can't be greater than 100
getChatHistory chat_id:long from_id:int offset:int limit:int = Messages;

//@description Deletes all messages in the chat. Can't be used for channel chats @chat_id Chat identifier
deleteChatHistory chat_id:long = Ok;

//@description Searches for messages with given words in the chat. Returns result in reverse chronological order, i. e. in order of decreasimg message_id @chat_id Chat identifier to search in
//@query Query to search for @from_message_id Identifier of the message near which we need a history, you can use 0 to get results from beginning @limit Maximum number of messages to be returned, can't be greater than 100
//@important_only Search for important messages only, currently all messages except messages in supergroups are important @filter Filter for content of searched messages
searchChatMessages chat_id:long query:string from_message_id:int limit:int important_only:Bool filter:SearchMessagesFilter = Messages;

//@description Searches for messages globally. Returns result in reverse chronological order, i. e. in order of decreasing (date, chat_id, message_id) @query Query to search for @offset_date Date of the message to search from, you can use 0 or any date in the future to get results from beginning @offset_chat_id Chat identifier of last found message
//@offset_message_id Message identifier of last found message @limit Maximum number of messages to be returned, can't be greater than 100
searchMessages query:string offset_date:int offset_chat_id:long offset_message_id:int limit:int = Messages;


//@description Sends message @chat_id Chat to send message @reply_to_message_id Identifier of message reply to or 0
//@is_post Sends channel post, only for channels that are not supergroups. The sender of the messagasde will not be shown, only the signature can be present if it is enabled in channel settings. Needs appropriate privileges
//@disable_notification Pass true, to disable notification about the message in up to date clients, bots only @from_background Pass true, if the message is sent from background
//@reply_markup Markup for replying to message, available only for bots @message Content of a message to send
sendMessage chat_id:long reply_to_message_id:int is_post:Bool disable_notification:Bool from_background:Bool reply_markup:ReplyMarkup message:InputMessageContent = Message;

//@description Invites bot to a chat (if it is not in the chat) and send /start to it. Bot can't be invited to a private chat other than chat with the bot @bot_user_id Identifier of the bot @chat_id Identifier of the chat @parameter Hidden parameter sent to bot for deep linking (https://api.telegram.org/bots#deep-linking)
sendBotStartMessage bot_user_id:int chat_id:long parameter:string = Message;

//@description Sends result of the inline query as a message @chat_id Chat to send message @reply_to_message_id Identifier of message reply to or 0
//@is_post Sends channel post, only for channels that are not supergroups. The sender of the message will not be shown, only the signature can be present if it is enabled in channel settings. Needs appropriate privileges
//@disable_notification Pass true, to disable notification about the message in up to date clients, bots only @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:long reply_to_message_id:int is_post:Bool disable_notification:Bool from_background:Bool query_id:long result_id:string = Message;

//@description Forwards previously sent messages @chat_id Identifier of a chat to forward messages @from_chat_id Identifier of a chat to forward from @message_ids Identifiers of messages to forward
//@is_post Sends channel post, only for channels that are not supergroups. The sender of the message will not be shown, only the signature can be present if it is enabled in channel settings. Needs appropriate privileges
//@disable_notification Pass true, to disable notification about the message in up to date clients, bots only @from_background Pass true, if the message is sent from background
forwardMessages chat_id:long from_chat_id:long message_ids:vector<int> is_post:Bool disable_notification:Bool from_background:Bool = Messages;

//@description Deletes messages @chat_id Chat identifier @message_ids Identifiers of messages to delete
deleteMessages chat_id:long message_ids:vector<int> = Ok;


//@description Send inline query to bot and returns its results. Unavailable for bots @bot_user_id Identifier of the bot send query to @query Text of the query @offset Offset of the first entry to return
getInlineQueryResults bot_user_id:int query:string offset:string = InlineQueryResults;

//@description Set result of the inline query. Bots only @inline_query_id Identifier of the inline query @is_personal Does result of the query can be cached only for specified user
//@results Results of the query @cache_time Allowed time to cache results of the query, defaults to 300 @next_offset Offset for the next inline query, pass empty string if there is no more results
answerInlineQuery inline_query_id:long is_personal:Bool results:vector<InlineQueryResult> cache_time:int next_offset:string = Ok;


//@description Deletes default reply markup from chat. This method needs to be called after one-time keyboard or ForceReply reply markup has been used. UpdateChatReplyMarkup will be send if reply markup will be changed @chat_id Chat identifier
//@message_id Message identifier of used keyboard
deleteChatReplyMarkup chat_id:long message_id:int = Ok;


//@description Sends notification about user activity in chat @chat_id Chat identifier @action Action description
sendChatAction chat_id:long action:SendMessageAction = Ok;


//@description Chat is opened by the user. Many useful activities depends on chat being opened or closed. For example, in channels all updates are received only for opened chats @chat_id Chat identifier
openChat chat_id:long = Ok;

//@description Chat is closed by the user. Many useful activities depends on chat being opened or closed. @chat_id Chat identifier
closeChat chat_id:long = Ok;

//@description Messages is viewed by the user. Many useful activities depends on message being viewed. For example, marking messages as read, incrementing of views counter, updating of views counter, removing of deleted messages in channels @chat_id Chat identifier @message_ids Identifiers of viewed messages
viewMessages chat_id:long message_ids:vector<int> = Ok;

//@description Message content is opened, for example the user has opened a photo, a video, a document, a location or a venue or have listened to an audio or a voice message @chat_id Chat identifier of the message @message_id Identifier of the message with opened content
openMessageContent chat_id:long message_id:int = Ok;


//@description Returns existing chat corresponding to the given user @user_id User identifier
createPrivateChat user_id:int = Chat;

//@description Returns existing chat corresponding to the known group @group_id Group identifier
createGroupChat group_id:int = Chat;

//@description Returns existing chat corresponding to the known channel @channel_id Channel identifier
createChannelChat channel_id:int = Chat;

//@description Creates new group chat and send corresponding messageGroupChatCreate, returns created chat @participant_ids Identifiers of users to add to the group @title Title of new group chat
createNewGroupChat participant_ids:vector<int> title:string = Chat;

//@description Creates new channel chat and send corresponding messageChannelChatCreate, returns created chat @title Title of new channel chat @is_broadcast True, if comments are disabled @is_supergroup True, if channel chat need to be as much closer as it can to group chat @about Information about the channel
createNewChannelChat title:string is_broadcast:Bool is_supergroup:Bool about:string = Chat;

//@description Creates new secret chat, returns created chat @user_id Identifier of a user to create secret chat with
createNewSecretChat user_id:int = Chat;

//@description Creates new channel supergroup chat from existing group chat and send corresponding messageChatMigrateTo and messageChatMigrateFrom. Available only if member limit for group was reached. Deactivates group @chat_id Group chat identifier
migrateGroupChatToChannelChat chat_id:long = Chat;


//@description Changes chat title. Title can't be changed for private chats. Title will not change until change will be synchronized with the server. Title will not be changed if application is killed before it can send request to the server.
//- There will be update about change of the title on success. Otherwise error will be returned
//@chat_id Chat identifier @title New title of a chat
changeChatTitle chat_id:long title:string = Ok;

//@description Changes chat photo. Photo can't be changed for private chats. Photo will not change until change will be synchronized with the server. Photo will not be changed if application is killed before it can send request to the server.
//- There will be update about change of the photo on success. Otherwise error will be returned
//@chat_id Chat identifier @photo New chat photo. You can use zero InputFileId to delete photo @crop Crop settings for photo. You can use null/default constructor to get automatic crop
changeChatPhoto chat_id:long photo:InputFile crop:photoCrop = Ok;

//@description Adds new participant to chat. Participants can't be added to private or secret chats. Participant will not be added until chat state will be synchronized with the server. Participant will not be added if application is killed before it can send request to the server
//@chat_id Chat identifier @user_id Identifier of the user to add @forward_limit Number of previous messages from chat to forward to new participant, ignored for channel chats
addChatParticipant chat_id:long user_id:int forward_limit:int = Ok;

//@description Adds many new participants to the chat. Currently, available only for channels. Can't be used to join the channel. Participant will not be added until chat state will be synchronized with the server. Participant will not be added if application is killed before it can send request to the server
//@chat_id Chat identifier @user_ids Identifiers of the users to add
addChatParticipants chat_id:long user_ids:vector<int> = Ok;

//@description Changes role of chat participant, need appropriate privileges. In channel chats, user will be added to chat participants if he is yet not participant and there is less than 200 participants in the channel.
//- Role will not be changed until chat state will be synchronized with the server. Role will not be changed if application is killed before it can send request to the server
//@chat_id Chat identifier @user_id Identifier of user to edit role, bots can be editors in the channel chats @role Participant role in the chat
changeChatParticipantRole chat_id:long user_id:int role:ChatParticipantRole = Ok;

//@description Asynchronously downloads file from cloud. Updates updateFileProgress will notify about download progress. Update updateFile will notify about successful download @file_id Identifier of file to download
downloadFile file_id:int = Ok;

//@description Stops file downloading. If file already downloaded do nothing. @file_id Identifier of file to cancel download
cancelDownloadFile file_id:int = Ok;


//@description Generates new chat invite link, previously generated link is revoked. Available for group and channel chats. Only creator of the chat can export chat invite link @chat_id Chat identifier
exportChatInviteLink chat_id:long = ChatInviteLink;

//@description Checks chat invite link for validness and returns information about the corresponding chat @invite_link Invite link to check. Should begin with "https://telegram.me/joinchat/"
checkChatInviteLink invite_link:string = ChatInviteLinkInfo;

//@description Imports chat invite link, adds current user to a chat if possible. Participant will not be added until chat state will be synchronized with the server. Participant will not be added if application is killed before it can send request to the server
//@invite_link Invite link to import. Should begin with "https://telegram.me/joinchat/"
importChatInviteLink invite_link:string = Ok;


//@description Adds user to black list @user_id User identifier
blockUser user_id:int = Ok;

//@description Removes user from black list @user_id User identifier
unblockUser user_id:int = Ok;


//@description Searches user by its username. Returns user if found, otherwise some error is returned @username Username to be resolved
searchUser username:string = User;

//@description Searches channel by its username. Returns channel if found, otherwise some error is returned @username Username to be resolved
searchChannel username:string = Channel;


//@description Returns user contacts list
getContacts = Contacts;

//@description Adds new contacts/edits existing contacts. Returns list of corresponding users in the same order as input contacts. If contact doesn't registered in Telegram, user with id == 0 will be returned @input_contacts List of contacts to import/edit
importContacts input_contacts:vector<inputContact> = Contacts;

//@description Deletes users from contacts list @user_ids Identifiers of users to be deleted
deleteContacts user_ids:vector<int> = Ok;

//@description Searches for specified query in the first name, last name and username of the known user contacts. Returns users in the order of increasing id @query Query to search for @limit Maximum number of users to be returned
searchContacts query:string limit:int = Contacts;


//@description Returns profile photos of the user. Result of this query can't be invalidated, so it must be used with care @user_id User identifier @offset Photos to skip, must be non-negative @limit Maximum number of photos to be returned, can't be greater than 100
getUserProfilePhotos user_id:int offset:int limit:int = UserProfilePhotos;


//@description Returns stickers corresponding to given emoji @emoji String representation of emoji. If empty, returns all known stickers
getStickers emoji:string = Stickers;

//@description Returns list of installed sticker sets @only_enabled If true, return only enabled sticker sets
getStickerSets only_enabled:Bool = StickerSets;

//@description Returns information about sticker set by its identifier @set_id Identifier of the sticker set
getStickerSet set_id:long = StickerSet;

//@description Searches sticker set by its short name @name Name of the sticker set
searchStickerSet name:string = StickerSet;

//@description Installs/uninstalls or enables/disables sticker set. Official sticker set can't be uninstalled, but it can be disabled @set_id Identifier of the sticker set @is_installed New value of is_installed @is_enabled New value of is_enabled
updateStickerSet set_id:long is_installed:Bool is_enabled:Bool = Ok;


//@description Returns saved animations
getSavedAnimations = Animations;

//@description Manually adds new animation to the list of saved animations. New animation is added to the beginning of the list. If the animation is already in the list, at first it is removed from the list. Only video animations with MIME type "video/mp4" can be added to the list
//@animation Animation file to add. Only known to server animations (i. e. successfully sent via message) can be added to the list
addSavedAnimation animation:InputFile = Ok;

//@description Removes animation from the list of saved animations @animation Animation file to delete
deleteSavedAnimation animation:InputFile = Ok;


//@description Returns up to 20 recently used inline bots in the order of the last usage
getRecentInlineBots = Users;


//@description Get web page preview by text of the message. Do not call this function to often @message_text Message text
getWebPagePreview message_text:string = WebPage;


//@description Returns notification settings for given scope @scope Scope to return information about notification settings
getNotificationSettings scope:NotificationSettingsScope = NotificationSettings;

//@description Changes notification settings for given scope @scope Scope to change notification settings
//@notification_settings New notification settings for given scope
setNotificationSettings scope:NotificationSettingsScope notification_settings:notificationSettings = Ok;


//@description Uploads new profile photo for logged in user. Photo will not change until change will be synchronized with the server. Photo will not be changed if application is killed before it can send request to the server. If something changes, updateUser will be sent
//@photo_path Path to new profile photo @crop Crop settings for photo. You can use null/default constructor to get automatic crop
setProfilePhoto photo_path:string crop:photoCrop = Ok;

//@description Deletes profile photo. If something changes, updateUser will be sent @profile_photo_id Identifier of profile photo to delete
deleteProfilePhoto profile_photo_id:long = Ok;

//@description Changes first and last names of logged in user. If something changes, updateUser will be sent @first_name New value of user first name, must not be empty @last_name New value of user last name
changeName first_name:string last_name:string = Ok;

//@description Changes username of logged in user. If something changes, updateUser will be sent @username New value of username. Use empty string to remove username
changeUsername username:string = Ok;


//@description Gives or revokes all participants of the group editor rights. Needs admin privileges in the group @group_id Identifier of the group @anyone_can_edit New value of anyone_can_edit
toggleGroupEditors group_id:int anyone_can_edit:Bool = Group;


//@description Changes username of the channel. Needs admin privileges in the channel @channel_id Identifier of the channel @username New value of username. Use empty string to remove username
changeChannelUsername channel_id:int username:string = Channel;

//@description Enables/disables comments in the channel. Needs admin privileges in the channel. Not available for supergroups @channel_id Identifier of the channel @is_broadcast New value of is_broadcast
toggleChannelComments channel_id:int is_broadcast:Bool = Channel;

//@description Gives or revokes right to invite new participants to all current participants of the channel. Needs admin privileges in the channel. Available only for supergroups @channel_id Identifier of the channel @anyone_can_invite New value of anyone_can_invite
toggleChannelInvites channel_id:int anyone_can_invite:Bool = Channel;

//@description Enables or disables sender signature on sent messages in the channel. Needs admin privileges in the channel. Not available for supergroups @channel_id Identifier of the channel @sign_messages New value of sign_messages
toggleChannelSignMessages channel_id:int sign_messages:Bool = Channel;

//@description Changes information about the channel. Needs admin privileges in the channel @channel_id Identifier of the channel @about New value of about
changeChannelAbout channel_id:int about:string = Ok;

//@description Returns information about channel participants or kicked from channel users. Can be used only if channel_full->can_get_participants == true @channel_id Identifier of the channel
//@filter Kind of channel users to return, defaults to channelParticipantsRecent @offset Number of channel users to skip @limit Maximum number of users be returned, can't be greater than 200
getChannelParticipants channel_id:int filter:ChannelParticipantsFilter offset:int limit:int = ChatParticipants;

//@description Deletes channel along with all messages in corresponding chat. Releases channel username and removes all participants. Needs admin privileges in the channel @channel_id Identifier of the channel
deleteChannel channel_id:int = Ok;


//@description Returns value of an option by its name. See list of available options on https://core.telegram.org/tdlib/options
//@name Name of an option
getOption name:string = OptionValue;

//@description Sets value of an option. See list of available options on https://core.telegram.org/tdlib/options. Only writable options can be set
//@name Name of an option @value New value of an option
setOption name:string value:OptionValue = Ok;