Skip to content

Instantly share code, notes, and snippets.

@watzon
Last active June 3, 2020 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save watzon/52342bf739c0a6985fa1ddf40278c803 to your computer and use it in GitHub Desktop.
Save watzon/52342bf739c0a6985fa1ddf40278c803 to your computer and use it in GitHub Desktop.
Generated code for tdlib
# Copyright 2020 - Chris Watson <cawatson1993@gmail.com>
#
# You should have received with this program a copy of the MIT license. This code is
# subject to the terms and conditions outlined in said license. For more information,
# please see https://en.wikipedia.org/wiki/MIT_License.
#
# This file was auto generated. Please do not modify directly.
module Proton
module TL
extend self
class_property! client : Proton::Client?
# Returns the current authorization state; this is an offline request. For informational purposes only. Use updateAuthorizationState instead to maintain the current authorization state
def get_authorization_state : AuthorizationState
res = client.send({
"@type" => "getAuthorizationState",
}, true)
AuthorizationState.from_json(res.to_json)
end
# Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters
def set_tdlib_parameters(parameters : (TdlibParameters | NamedTuple)) : Ok?
parameters = parameters.is_a?(NamedTuple) ? TdlibParameters.new(**parameters) : parameters
res = client.send({
"@type" => "setTdlibParameters",
"parameters" => parameters,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Checks the database encryption key for correctness. Works only when the current authorization state is authorizationStateWaitEncryptionKey
def check_database_encryption_key(encryption_key : String) : Ok?
res = client.send({
"@type" => "checkDatabaseEncryptionKey",
"encryption_key" => encryption_key,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Sets the phone number of the user and sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitPhoneNumber,
# or if there is no pending authentication query and the current authorization state is authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword
#
# **Params:**
# `phone_number` - The phone number of the user, in international format
# `settings ` - Settings for the authentication of the user's phone number
def set_authentication_phone_number(phone_number : String, settings : (PhoneNumberAuthenticationSettings | NamedTuple)) : Ok?
settings = settings.is_a?(NamedTuple) ? PhoneNumberAuthenticationSettings.new(**settings) : settings
res = client.send({
"@type" => "setAuthenticationPhoneNumber",
"phone_number" => phone_number,
"settings" => settings,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Re-sends an authentication code to the user. Works only when the current authorization state is authorizationStateWaitCode and the next_code_type of the result is not null
def resend_authentication_code : Ok?
res = client.send({
"@type" => "resendAuthenticationCode",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Checks the authentication code. Works only when the current authorization state is authorizationStateWaitCode
def check_authentication_code(code : String) : Ok?
res = client.send({
"@type" => "checkAuthenticationCode",
"code" => code,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber
def request_qr_code_authentication(other_user_ids : Array(Int32)) : Ok?
res = client.send({
"@type" => "requestQrCodeAuthentication",
"other_user_ids" => other_user_ids,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Finishes user registration. Works only when the current authorization state is authorizationStateWaitRegistration
#
# **Params:**
# `first_name` - The first name of the user; 1-64 characters
# `last_name ` - The last name of the user; 0-64 characters
def register_user(first_name : String, last_name : String) : Ok?
res = client.send({
"@type" => "registerUser",
"first_name" => first_name,
"last_name" => last_name,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Checks the authentication password for correctness. Works only when the current authorization state is authorizationStateWaitPassword
def check_authentication_password(password : String) : Ok?
res = client.send({
"@type" => "checkAuthenticationPassword",
"password" => password,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Requests to send a password recovery code to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword
def request_authentication_password_recovery : Ok?
res = client.send({
"@type" => "requestAuthenticationPasswordRecovery",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Recovers the password with a password recovery code sent to an email address that was previously set up. Works only when the current authorization state is authorizationStateWaitPassword
def recover_authentication_password(recovery_code : String) : Ok?
res = client.send({
"@type" => "recoverAuthenticationPassword",
"recovery_code" => recovery_code,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Checks the authentication token of a bot; to log in as a bot. Works only when the current authorization state is authorizationStateWaitPhoneNumber. Can be used instead of setAuthenticationPhoneNumber and checkAuthenticationCode to log in
def check_authentication_bot_token(token : String) : Ok?
res = client.send({
"@type" => "checkAuthenticationBotToken",
"token" => token,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Closes the TDLib instance after a proper logout. Requires an available network connection. All local data will be destroyed. After the logout completes, updateAuthorizationState with authorizationStateClosed will be sent
def log_out : Ok?
res = client.send({
"@type" => "logOut",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Closes the TDLib instance. All databases will be flushed to disk and properly closed. After the close completes, updateAuthorizationState with authorizationStateClosed will be sent
def close : Ok?
res = client.send({
"@type" => "close",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Closes the TDLib instance, destroying all local data without a proper logout. The current user session will remain in the list of all active sessions. All local data will be destroyed. After the destruction completes updateAuthorizationState with authorizationStateClosed will be sent
def destroy : Ok?
res = client.send({
"@type" => "destroy",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Confirms QR code authentication on another device. Returns created session on success
def confirm_qr_code_authentication(link : String) : Session
res = client.send({
"@type" => "confirmQrCodeAuthentication",
"link" => link,
}, true)
Session.from_json(res.to_json)
end
# Returns all updates needed to restore current TDLib state, i.e. all actual UpdateAuthorizationState/UpdateUser/UpdateNewChat and others. This is especially useful if TDLib is run in a separate process. This is an offline method. Can be called before authorization
def get_current_state : Updates
res = client.send({
"@type" => "getCurrentState",
}, true)
Updates.from_json(res.to_json)
end
# Changes the database encryption key. Usually the encryption key is never changed and is stored in some OS keychain
def set_database_encryption_key(new_encryption_key : String) : Ok?
res = client.send({
"@type" => "setDatabaseEncryptionKey",
"new_encryption_key" => new_encryption_key,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns the current state of 2-step verification
def get_password_state : PasswordState
res = client.send({
"@type" => "getPasswordState",
}, true)
PasswordState.from_json(res.to_json)
end
# 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
#
# **Params:**
# `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
def set_password(old_password : String, set_recovery_email_address : (Bool | NamedTuple), new_password : String? = nil, new_hint : String? = nil, new_recovery_email_address : String? = nil) : PasswordState
set_recovery_email_address = set_recovery_email_address.is_a?(NamedTuple) ? Bool.new(**set_recovery_email_address) : set_recovery_email_address
res = client.send({
"@type" => "setPassword",
"old_password" => old_password,
"set_recovery_email_address" => set_recovery_email_address,
"new_password" => new_password,
"new_hint" => new_hint,
"new_recovery_email_address" => new_recovery_email_address,
}, true)
PasswordState.from_json(res.to_json)
end
# 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
def get_recovery_email_address(password : String) : RecoveryEmailAddress
res = client.send({
"@type" => "getRecoveryEmailAddress",
"password" => password,
}, true)
RecoveryEmailAddress.from_json(res.to_json)
end
# 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
#
# **Params:**
# `password ` - Password of the current user
# `new_recovery_email_address` - New recovery email address
def set_recovery_email_address(password : String, new_recovery_email_address : String) : PasswordState
res = client.send({
"@type" => "setRecoveryEmailAddress",
"password" => password,
"new_recovery_email_address" => new_recovery_email_address,
}, true)
PasswordState.from_json(res.to_json)
end
# Checks the 2-step verification recovery email address verification code
def check_recovery_email_address_code(code : String) : PasswordState
res = client.send({
"@type" => "checkRecoveryEmailAddressCode",
"code" => code,
}, true)
PasswordState.from_json(res.to_json)
end
# Resends the 2-step verification recovery email address verification code
def resend_recovery_email_address_code : PasswordState
res = client.send({
"@type" => "resendRecoveryEmailAddressCode",
}, true)
PasswordState.from_json(res.to_json)
end
# Requests to send a password recovery code to an email address that was previously set up
def request_password_recovery : EmailAddressAuthenticationCodeInfo
res = client.send({
"@type" => "requestPasswordRecovery",
}, true)
EmailAddressAuthenticationCodeInfo.from_json(res.to_json)
end
# Recovers the password using a recovery code sent to an email address that was previously set up
def recover_password(recovery_code : String) : PasswordState
res = client.send({
"@type" => "recoverPassword",
"recovery_code" => recovery_code,
}, true)
PasswordState.from_json(res.to_json)
end
# Creates a new temporary password for processing payments
#
# **Params:**
# `password ` - Persistent user password
# `valid_for` - Time during which the temporary password will be valid, in seconds; should be between 60 and 86400
def create_temporary_password(password : String, valid_for : (Int32 | NamedTuple)) : TemporaryPasswordState
valid_for = valid_for.is_a?(NamedTuple) ? Int32.new(**valid_for) : valid_for
res = client.send({
"@type" => "createTemporaryPassword",
"password" => password,
"valid_for" => valid_for,
}, true)
TemporaryPasswordState.from_json(res.to_json)
end
# Returns information about the current temporary password
def get_temporary_password_state : TemporaryPasswordState
res = client.send({
"@type" => "getTemporaryPasswordState",
}, true)
TemporaryPasswordState.from_json(res.to_json)
end
# Returns the current user
def get_me : User
res = client.send({
"@type" => "getMe",
}, true)
User.from_json(res.to_json)
end
# Returns information about a user by their identifier. This is an offline request if the current user is not a bot
def get_user(user_id : (Int32 | NamedTuple)) : User
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "getUser",
"user_id" => user_id,
}, true)
User.from_json(res.to_json)
end
# Returns full information about a user by their identifier
def get_user_full_info(user_id : (Int32 | NamedTuple)) : UserFullInfo
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "getUserFullInfo",
"user_id" => user_id,
}, true)
UserFullInfo.from_json(res.to_json)
end
# Returns information about a basic group by its identifier. This is an offline request if the current user is not a bot
def get_basic_group(basic_group_id : (Int32 | NamedTuple)) : BasicGroup
basic_group_id = basic_group_id.is_a?(NamedTuple) ? Int32.new(**basic_group_id) : basic_group_id
res = client.send({
"@type" => "getBasicGroup",
"basic_group_id" => basic_group_id,
}, true)
BasicGroup.from_json(res.to_json)
end
# Returns full information about a basic group by its identifier
def get_basic_group_full_info(basic_group_id : (Int32 | NamedTuple)) : BasicGroupFullInfo
basic_group_id = basic_group_id.is_a?(NamedTuple) ? Int32.new(**basic_group_id) : basic_group_id
res = client.send({
"@type" => "getBasicGroupFullInfo",
"basic_group_id" => basic_group_id,
}, true)
BasicGroupFullInfo.from_json(res.to_json)
end
# Returns information about a supergroup or a channel by its identifier. This is an offline request if the current user is not a bot
def get_supergroup(supergroup_id : (Int32 | NamedTuple)) : Supergroup
supergroup_id = supergroup_id.is_a?(NamedTuple) ? Int32.new(**supergroup_id) : supergroup_id
res = client.send({
"@type" => "getSupergroup",
"supergroup_id" => supergroup_id,
}, true)
Supergroup.from_json(res.to_json)
end
# Returns full information about a supergroup or a channel by its identifier, cached for up to 1 minute
def get_supergroup_full_info(supergroup_id : (Int32 | NamedTuple)) : SupergroupFullInfo
supergroup_id = supergroup_id.is_a?(NamedTuple) ? Int32.new(**supergroup_id) : supergroup_id
res = client.send({
"@type" => "getSupergroupFullInfo",
"supergroup_id" => supergroup_id,
}, true)
SupergroupFullInfo.from_json(res.to_json)
end
# Returns information about a secret chat by its identifier. This is an offline request
def get_secret_chat(secret_chat_id : (Int32 | NamedTuple)) : SecretChat
secret_chat_id = secret_chat_id.is_a?(NamedTuple) ? Int32.new(**secret_chat_id) : secret_chat_id
res = client.send({
"@type" => "getSecretChat",
"secret_chat_id" => secret_chat_id,
}, true)
SecretChat.from_json(res.to_json)
end
# Returns information about a chat by its identifier, this is an offline request if the current user is not a bot
def get_chat(chat_id : Int64) : Chat
res = client.send({
"@type" => "getChat",
"chat_id" => chat_id,
}, true)
Chat.from_json(res.to_json)
end
# Returns information about a message
#
# **Params:**
# `chat_id ` - Identifier of the chat the message belongs to
# `message_id` - Identifier of the message to get
def get_message(chat_id : Int64, message_id : Int64) : Message
res = client.send({
"@type" => "getMessage",
"chat_id" => chat_id,
"message_id" => message_id,
}, true)
Message.from_json(res.to_json)
end
# Returns information about a message, if it is available locally without sending network request. This is an offline request
#
# **Params:**
# `chat_id ` - Identifier of the chat the message belongs to
# `message_id` - Identifier of the message to get
def get_message_locally(chat_id : Int64, message_id : Int64) : Message
res = client.send({
"@type" => "getMessageLocally",
"chat_id" => chat_id,
"message_id" => message_id,
}, true)
Message.from_json(res.to_json)
end
# Returns information about a message that is replied by given message
#
# **Params:**
# `chat_id ` - Identifier of the chat the message belongs to
# `message_id` - Identifier of the message reply to which get
def get_replied_message(chat_id : Int64, message_id : Int64) : Message
res = client.send({
"@type" => "getRepliedMessage",
"chat_id" => chat_id,
"message_id" => message_id,
}, true)
Message.from_json(res.to_json)
end
# Returns information about a pinned chat message
def get_chat_pinned_message(chat_id : Int64) : Message
res = client.send({
"@type" => "getChatPinnedMessage",
"chat_id" => chat_id,
}, true)
Message.from_json(res.to_json)
end
# Returns information about messages. If a message is not found, returns null on the corresponding position of the result
#
# **Params:**
# `chat_id ` - Identifier of the chat the messages belong to
# `message_ids` - Identifiers of the messages to get
def get_messages(chat_id : Int64, message_ids : Array(Int64)) : Messages
res = client.send({
"@type" => "getMessages",
"chat_id" => chat_id,
"message_ids" => message_ids,
}, true)
Messages.from_json(res.to_json)
end
# Returns information about a file; this is an offline request
def get_file(file_id : (Int32 | NamedTuple)) : File
file_id = file_id.is_a?(NamedTuple) ? Int32.new(**file_id) : file_id
res = client.send({
"@type" => "getFile",
"file_id" => file_id,
}, true)
File.from_json(res.to_json)
end
# Returns information about a file by its remote ID; this is an offline request. Can be used to register a URL as a file for further uploading, or sending as a message. Even the request succeeds, the file can be used only if it is still accessible to the user.
# For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the client
#
# **Params:**
# `remote_file_id` - Remote identifier of the file to get
# `file_type ` - File type, if known
def get_remote_file(remote_file_id : String, file_type : (FileType | NamedTuple)) : File
file_type = file_type.is_a?(NamedTuple) ? FileType.new(**file_type) : file_type
res = client.send({
"@type" => "getRemoteFile",
"remote_file_id" => remote_file_id,
"file_type" => file_type,
}, true)
File.from_json(res.to_json)
end
# Returns an ordered list of chats in a chat list. 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
#
# **Params:**
# `chat_list ` - The chat list in which to return chats
# `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
def get_chats(chat_list : (ChatList | NamedTuple), offset_order : (String | NamedTuple), offset_chat_id : Int64, limit : (Int32 | NamedTuple)) : Chats
chat_list = chat_list.is_a?(NamedTuple) ? ChatList.new(**chat_list) : chat_list
offset_order = offset_order.is_a?(NamedTuple) ? String.new(**offset_order) : offset_order
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "getChats",
"chat_list" => chat_list,
"offset_order" => offset_order,
"offset_chat_id" => offset_chat_id,
"limit" => limit,
}, true)
Chats.from_json(res.to_json)
end
# Searches a public chat by its username. Currently only private chats, supergroups and channels can be public. Returns the chat if found; otherwise an error is returned
def search_public_chat(username : String) : Chat
res = client.send({
"@type" => "searchPublicChat",
"username" => username,
}, true)
Chat.from_json(res.to_json)
end
# Searches public chats by looking for specified query in their username and title. Currently only private chats, supergroups and channels can be public. Returns a meaningful number of results. Returns nothing if the length of the searched username prefix is less than 5. Excludes private chats with contacts and chats from the chat list from the results
def search_public_chats(query : String) : Chats
res = client.send({
"@type" => "searchPublicChats",
"query" => query,
}, true)
Chats.from_json(res.to_json)
end
# Searches for the specified query in the title and username of already known chats, this is an offline request. Returns chats in the order seen in the chat list
#
# **Params:**
# `query` - Query to search for. If the query is empty, returns up to 20 recently found chats
# `limit` - The maximum number of chats to be returned
def search_chats(query : String, limit : (Int32 | NamedTuple)) : Chats
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "searchChats",
"query" => query,
"limit" => limit,
}, true)
Chats.from_json(res.to_json)
end
# Searches for the specified query in the title and username of already known chats via request to the server. Returns chats in the order seen in the chat list
#
# **Params:**
# `query` - Query to search for
# `limit` - The maximum number of chats to be returned
def search_chats_on_server(query : String, limit : (Int32 | NamedTuple)) : Chats
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "searchChatsOnServer",
"query" => query,
"limit" => limit,
}, true)
Chats.from_json(res.to_json)
end
# Returns a list of users and location-based supergroups nearby. The list of users nearby will be updated for 60 seconds after the request by the updates updateUsersNearby. The request should be sent again every 25 seconds with adjusted location to not miss new chats
def search_chats_nearby(location : (Location | NamedTuple)) : ChatsNearby
location = location.is_a?(NamedTuple) ? Location.new(**location) : location
res = client.send({
"@type" => "searchChatsNearby",
"location" => location,
}, true)
ChatsNearby.from_json(res.to_json)
end
# Returns a list of frequently used chats. Supported only if the chat info database is enabled
#
# **Params:**
# `category` - Category of chats to be returned
# `limit ` - The maximum number of chats to be returned; up to 30
def get_top_chats(category : (TopChatCategory | NamedTuple), limit : (Int32 | NamedTuple)) : Chats
category = category.is_a?(NamedTuple) ? TopChatCategory.new(**category) : category
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "getTopChats",
"category" => category,
"limit" => limit,
}, true)
Chats.from_json(res.to_json)
end
# Removes a chat from the list of frequently used chats. Supported only if the chat info database is enabled
#
# **Params:**
# `category` - Category of frequently used chats
# `chat_id ` - Chat identifier
def remove_top_chat(category : (TopChatCategory | NamedTuple), chat_id : Int64) : Ok?
category = category.is_a?(NamedTuple) ? TopChatCategory.new(**category) : category
res = client.send({
"@type" => "removeTopChat",
"category" => category,
"chat_id" => chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Adds a 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, it will be removed from the list first
def add_recently_found_chat(chat_id : Int64) : Ok?
res = client.send({
"@type" => "addRecentlyFoundChat",
"chat_id" => chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Removes a chat from the list of recently found chats
def remove_recently_found_chat(chat_id : Int64) : Ok?
res = client.send({
"@type" => "removeRecentlyFoundChat",
"chat_id" => chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Clears the list of recently found chats
def clear_recently_found_chats : Ok?
res = client.send({
"@type" => "clearRecentlyFoundChats",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Checks whether a username can be set for a chat
#
# **Params:**
# `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
def check_chat_username(chat_id : Int64, username : String) : CheckChatUsernameResult
res = client.send({
"@type" => "checkChatUsername",
"chat_id" => chat_id,
"username" => username,
}, true)
CheckChatUsernameResult.from_json(res.to_json)
end
# Returns a list of public chats of the specified type, owned by the user
def get_created_public_chats(type : (PublicChatType | NamedTuple)) : Chats
type = type.is_a?(NamedTuple) ? PublicChatType.new(**type) : type
res = client.send({
"@type" => "getCreatedPublicChats",
"type" => type,
}, true)
Chats.from_json(res.to_json)
end
# Checks whether the maximum number of owned public chats has been reached. Returns corresponding error if the limit was reached
def check_created_public_chats_limit(type : (PublicChatType | NamedTuple)) : Ok?
type = type.is_a?(NamedTuple) ? PublicChatType.new(**type) : type
res = client.send({
"@type" => "checkCreatedPublicChatsLimit",
"type" => type,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns a list of basic group and supergroup chats, which can be used as a discussion group for a channel. Basic group chats need to be first upgraded to supergroups before they can be set as a discussion group
def get_suitable_discussion_chats : Chats
res = client.send({
"@type" => "getSuitableDiscussionChats",
}, true)
Chats.from_json(res.to_json)
end
# Returns a list of recently inactive supergroups and channels. Can be used when user reaches limit on the number of joined supergroups and channels and receives CHANNELS_TOO_MUCH error
def get_inactive_supergroup_chats : Chats
res = client.send({
"@type" => "getInactiveSupergroupChats",
}, true)
Chats.from_json(res.to_json)
end
# Returns a list of common group chats with a given user. Chats are sorted by their type and creation date
#
# **Params:**
# `user_id ` - User identifier
# `offset_chat_id` - Chat identifier starting from which to return chats; use 0 for the first request
# `limit ` - The maximum number of chats to be returned; up to 100
def get_groups_in_common(user_id : (Int32 | NamedTuple), offset_chat_id : Int64, limit : (Int32 | NamedTuple)) : Chats
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "getGroupsInCommon",
"user_id" => user_id,
"offset_chat_id" => offset_chat_id,
"limit" => limit,
}, true)
Chats.from_json(res.to_json)
end
# Returns messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id).
# For optimal performance the number of returned messages is chosen by the library. This is an offline request if only_local is true
#
# **Params:**
# `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 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
def get_chat_history(chat_id : Int64, from_message_id : Int64, offset : (Int32 | NamedTuple), limit : (Int32 | NamedTuple), only_local : (Bool | NamedTuple)) : Messages
offset = offset.is_a?(NamedTuple) ? Int32.new(**offset) : offset
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
only_local = only_local.is_a?(NamedTuple) ? Bool.new(**only_local) : only_local
res = client.send({
"@type" => "getChatHistory",
"chat_id" => chat_id,
"from_message_id" => from_message_id,
"offset" => offset,
"limit" => limit,
"only_local" => only_local,
}, true)
Messages.from_json(res.to_json)
end
# 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
#
# **Params:**
# `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
def delete_chat_history(chat_id : Int64, remove_from_chat_list : (Bool | NamedTuple), revoke : (Bool | NamedTuple)) : Ok?
remove_from_chat_list = remove_from_chat_list.is_a?(NamedTuple) ? Bool.new(**remove_from_chat_list) : remove_from_chat_list
revoke = revoke.is_a?(NamedTuple) ? Bool.new(**revoke) : revoke
res = client.send({
"@type" => "deleteChatHistory",
"chat_id" => chat_id,
"remove_from_chat_list" => remove_from_chat_list,
"revoke" => revoke,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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
#
# **Params:**
# `chat_id ` - Identifier of the chat in which to search messages
# `query ` - Query to search for
# `sender_user_id ` - If not 0, only messages sent by the specified user will be returned. Not supported in secret chats
# `from_message_id` - Identifier of the message starting from which history must be fetched; use 0 to get results from the last message
# `offset ` - Specify 0 to get results from exactly the from_message_id or a negative offset to get the specified message and some newer messages
# `limit ` - The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, the limit must be greater than -offset. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached
# `filter ` - Filter for message content in the search results
def search_chat_messages(chat_id : Int64, query : String, sender_user_id : (Int32 | NamedTuple), from_message_id : Int64, offset : (Int32 | NamedTuple), limit : (Int32 | NamedTuple), filter : (SearchMessagesFilter | NamedTuple)) : Messages
sender_user_id = sender_user_id.is_a?(NamedTuple) ? Int32.new(**sender_user_id) : sender_user_id
offset = offset.is_a?(NamedTuple) ? Int32.new(**offset) : offset
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
filter = filter.is_a?(NamedTuple) ? SearchMessagesFilter.new(**filter) : filter
res = client.send({
"@type" => "searchChatMessages",
"chat_id" => chat_id,
"query" => query,
"sender_user_id" => sender_user_id,
"from_message_id" => from_message_id,
"offset" => offset,
"limit" => limit,
"filter" => filter,
}, true)
Messages.from_json(res.to_json)
end
# Searches for messages in all chats except secret chats. Returns the results in reverse chronological order (i.e., in order of decreasing (date, chat_id, message_id)).
# For optimal performance the number of returned messages is chosen by the library
#
# **Params:**
# `chat_list ` - Chat list in which to search messages; pass null to search in all chats regardless of their chat list
# `query ` - Query to search for
# `offset_date ` - The date of the message starting from which the results should be fetched. Use 0 or any date in the future to get results from the last message
# `offset_chat_id ` - The chat identifier of the last found message, or 0 for the first request
# `offset_message_id` - The message identifier of the last found message, or 0 for the first request
# `limit ` - The maximum number of messages to be returned, up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached
def search_messages(chat_list : (ChatList | NamedTuple), query : String, offset_date : (Int32 | NamedTuple), offset_chat_id : Int64, offset_message_id : Int64, limit : (Int32 | NamedTuple)) : Messages
chat_list = chat_list.is_a?(NamedTuple) ? ChatList.new(**chat_list) : chat_list
offset_date = offset_date.is_a?(NamedTuple) ? Int32.new(**offset_date) : offset_date
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "searchMessages",
"chat_list" => chat_list,
"query" => query,
"offset_date" => offset_date,
"offset_chat_id" => offset_chat_id,
"offset_message_id" => offset_message_id,
"limit" => limit,
}, true)
Messages.from_json(res.to_json)
end
# Searches for messages in secret chats. Returns the results in reverse chronological order. For optimal performance the number of returned messages is chosen by the library
#
# **Params:**
# `chat_id ` - Identifier of the chat in which to search. Specify 0 to search in all secret chats
# `query ` - Query to search for. If empty, searchChatMessages should be used instead
# `from_search_id` - The identifier from the result of a previous request, use 0 to get results from the last message
# `limit ` - The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached
# `filter ` - A filter for the content of messages in the search results
def search_secret_messages(chat_id : Int64, query : String, from_search_id : (String | NamedTuple), limit : (Int32 | NamedTuple), filter : (SearchMessagesFilter | NamedTuple)) : FoundMessages
from_search_id = from_search_id.is_a?(NamedTuple) ? String.new(**from_search_id) : from_search_id
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
filter = filter.is_a?(NamedTuple) ? SearchMessagesFilter.new(**filter) : filter
res = client.send({
"@type" => "searchSecretMessages",
"chat_id" => chat_id,
"query" => query,
"from_search_id" => from_search_id,
"limit" => limit,
"filter" => filter,
}, true)
FoundMessages.from_json(res.to_json)
end
# Searches for call messages. Returns the results in reverse chronological order (i. e., in order of decreasing message_id). For optimal performance the number of returned messages is chosen by the library
#
# **Params:**
# `from_message_id` - Identifier of the message from which to search; use 0 to get results from the last message
# `limit ` - The maximum number of messages to be returned; up to 100. Fewer messages may be returned than specified by the limit, even if the end of the message history has not been reached
# `only_missed ` - If true, returns only messages with missed calls
def search_call_messages(from_message_id : Int64, limit : (Int32 | NamedTuple), only_missed : (Bool | NamedTuple)) : Messages
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
only_missed = only_missed.is_a?(NamedTuple) ? Bool.new(**only_missed) : only_missed
res = client.send({
"@type" => "searchCallMessages",
"from_message_id" => from_message_id,
"limit" => limit,
"only_missed" => only_missed,
}, true)
Messages.from_json(res.to_json)
end
# Returns information about the recent locations of chat members that were sent to the chat. Returns up to 1 location message per user
#
# **Params:**
# `chat_id` - Chat identifier
# `limit ` - The maximum number of messages to be returned
def search_chat_recent_location_messages(chat_id : Int64, limit : (Int32 | NamedTuple)) : Messages
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "searchChatRecentLocationMessages",
"chat_id" => chat_id,
"limit" => limit,
}, true)
Messages.from_json(res.to_json)
end
# Returns all active live locations that should be updated by the client. The list is persistent across application restarts only if the message database is used
def get_active_live_location_messages : Messages
res = client.send({
"@type" => "getActiveLiveLocationMessages",
}, true)
Messages.from_json(res.to_json)
end
# Returns the last message sent in a chat no later than the specified date
#
# **Params:**
# `chat_id` - Chat identifier
# `date ` - Point in time (Unix timestamp) relative to which to search for messages
def get_chat_message_by_date(chat_id : Int64, date : (Int32 | NamedTuple)) : Message
date = date.is_a?(NamedTuple) ? Int32.new(**date) : date
res = client.send({
"@type" => "getChatMessageByDate",
"chat_id" => chat_id,
"date" => date,
}, true)
Message.from_json(res.to_json)
end
# Returns approximate number of messages of the specified type in the chat
#
# **Params:**
# `chat_id ` - Identifier of the chat in which to count messages
# `filter ` - Filter for message content; searchMessagesFilterEmpty is unsupported in this function
# `return_local` - If true, returns count that is available locally without sending network requests, returning -1 if the number of messages is unknown
def get_chat_message_count(chat_id : Int64, filter : (SearchMessagesFilter | NamedTuple), return_local : (Bool | NamedTuple)) : Count
filter = filter.is_a?(NamedTuple) ? SearchMessagesFilter.new(**filter) : filter
return_local = return_local.is_a?(NamedTuple) ? Bool.new(**return_local) : return_local
res = client.send({
"@type" => "getChatMessageCount",
"chat_id" => chat_id,
"filter" => filter,
"return_local" => return_local,
}, true)
Count.from_json(res.to_json)
end
# Returns all scheduled messages in a chat. The messages are returned in a reverse chronological order (i.e., in order of decreasing message_id)
def get_chat_scheduled_messages(chat_id : Int64) : Messages
res = client.send({
"@type" => "getChatScheduledMessages",
"chat_id" => chat_id,
}, true)
Messages.from_json(res.to_json)
end
# Removes an active notification from notification list. Needs to be called only if the notification is removed by the current user
#
# **Params:**
# `notification_group_id` - Identifier of notification group to which the notification belongs
# `notification_id ` - Identifier of removed notification
def remove_notification(notification_group_id : (Int32 | NamedTuple), notification_id : (Int32 | NamedTuple)) : Ok?
notification_group_id = notification_group_id.is_a?(NamedTuple) ? Int32.new(**notification_group_id) : notification_group_id
notification_id = notification_id.is_a?(NamedTuple) ? Int32.new(**notification_id) : notification_id
res = client.send({
"@type" => "removeNotification",
"notification_group_id" => notification_group_id,
"notification_id" => notification_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Removes a group of active notifications. Needs to be called only if the notification group is removed by the current user
#
# **Params:**
# `notification_group_id` - Notification group identifier
# `max_notification_id ` - The maximum identifier of removed notifications
def remove_notification_group(notification_group_id : (Int32 | NamedTuple), max_notification_id : (Int32 | NamedTuple)) : Ok?
notification_group_id = notification_group_id.is_a?(NamedTuple) ? Int32.new(**notification_group_id) : notification_group_id
max_notification_id = max_notification_id.is_a?(NamedTuple) ? Int32.new(**max_notification_id) : max_notification_id
res = client.send({
"@type" => "removeNotificationGroup",
"notification_group_id" => notification_group_id,
"max_notification_id" => max_notification_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns a public HTTPS link to a message. Available only for messages in supergroups and channels with a username
#
# **Params:**
# `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
def get_public_message_link(chat_id : Int64, message_id : Int64, for_album : (Bool | NamedTuple)) : PublicMessageLink
for_album = for_album.is_a?(NamedTuple) ? Bool.new(**for_album) : for_album
res = client.send({
"@type" => "getPublicMessageLink",
"chat_id" => chat_id,
"message_id" => message_id,
"for_album" => for_album,
}, true)
PublicMessageLink.from_json(res.to_json)
end
# 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
#
# **Params:**
# `chat_id ` - Identifier of the chat to which the message belongs
# `message_id` - Identifier of the message
def get_message_link(chat_id : Int64, message_id : Int64) : HttpUrl
res = client.send({
"@type" => "getMessageLink",
"chat_id" => chat_id,
"message_id" => message_id,
}, true)
HttpUrl.from_json(res.to_json)
end
# Returns information about a public or private message link
def get_message_link_info(url : String) : MessageLinkInfo
res = client.send({
"@type" => "getMessageLinkInfo",
"url" => url,
}, true)
MessageLinkInfo.from_json(res.to_json)
end
# Sends a message. Returns the sent message
#
# **Params:**
# `chat_id ` - Target chat
# `reply_to_message_id ` - Identifier of the message to reply to or 0
# `options ` - Options to be used to send the message
# `reply_markup ` - Markup for replying to the message; for bots only
# `input_message_content` - The content of the message to be sent
def send_message(chat_id : Int64, reply_to_message_id : Int64, options : (SendMessageOptions | NamedTuple), input_message_content : (InputMessageContent | NamedTuple), reply_markup : (ReplyMarkup | NamedTuple)? = nil) : Message
options = options.is_a?(NamedTuple) ? SendMessageOptions.new(**options) : options
input_message_content = input_message_content.is_a?(NamedTuple) ? InputMessageContent.new(**input_message_content) : input_message_content
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
res = client.send({
"@type" => "sendMessage",
"chat_id" => chat_id,
"reply_to_message_id" => reply_to_message_id,
"options" => options,
"input_message_content" => input_message_content,
"reply_markup" => reply_markup,
}, true)
Message.from_json(res.to_json)
end
# Sends messages grouped together into an album. Currently only photo and video messages can be grouped into an album. Returns sent messages
#
# **Params:**
# `chat_id ` - Target chat
# `reply_to_message_id ` - Identifier of a message to reply to or 0
# `options ` - Options to be used to send the messages
# `input_message_contents` - Contents of messages to be sent
def send_message_album(chat_id : Int64, reply_to_message_id : Int64, options : (SendMessageOptions | NamedTuple), input_message_contents : Array(InputMessageContent)) : Messages
options = options.is_a?(NamedTuple) ? SendMessageOptions.new(**options) : options
res = client.send({
"@type" => "sendMessageAlbum",
"chat_id" => chat_id,
"reply_to_message_id" => reply_to_message_id,
"options" => options,
"input_message_contents" => input_message_contents,
}, true)
Messages.from_json(res.to_json)
end
# Invites a bot to a chat (if it is not yet a member) and sends it the /start command. Bots can't be invited to a private chat other than the chat with the bot. Bots can't be invited to channels (although they can be added as admins) and secret chats. Returns the sent message
#
# **Params:**
# `bot_user_id` - Identifier of the bot
# `chat_id ` - Identifier of the target chat
# `parameter ` - A hidden parameter sent to the bot for deep linking purposes (https://core.telegram.org/bots#deep-linking)
def send_bot_start_message(bot_user_id : (Int32 | NamedTuple), chat_id : Int64, parameter : String) : Message
bot_user_id = bot_user_id.is_a?(NamedTuple) ? Int32.new(**bot_user_id) : bot_user_id
res = client.send({
"@type" => "sendBotStartMessage",
"bot_user_id" => bot_user_id,
"chat_id" => chat_id,
"parameter" => parameter,
}, true)
Message.from_json(res.to_json)
end
# Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message
#
# **Params:**
# `chat_id ` - Target chat
# `reply_to_message_id` - Identifier of a message to reply to or 0
# `options ` - Options to be used to send the message
# `query_id ` - Identifier of the inline query
# `result_id ` - Identifier of the inline result
# `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")
def send_inline_query_result_message(chat_id : Int64, reply_to_message_id : Int64, options : (SendMessageOptions | NamedTuple), query_id : (String | NamedTuple), result_id : String, hide_via_bot : (Bool | NamedTuple)) : Message
options = options.is_a?(NamedTuple) ? SendMessageOptions.new(**options) : options
query_id = query_id.is_a?(NamedTuple) ? String.new(**query_id) : query_id
hide_via_bot = hide_via_bot.is_a?(NamedTuple) ? Bool.new(**hide_via_bot) : hide_via_bot
res = client.send({
"@type" => "sendInlineQueryResultMessage",
"chat_id" => chat_id,
"reply_to_message_id" => reply_to_message_id,
"options" => options,
"query_id" => query_id,
"result_id" => result_id,
"hide_via_bot" => hide_via_bot,
}, true)
Message.from_json(res.to_json)
end
# 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
#
# **Params:**
# `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
# `options ` - Options to be used to send the messages
# `as_album ` - True, if the messages should be grouped into an album after forwarding. For this to work, no more than 10 messages may be forwarded, and all of them must be photo or video messages
# `send_copy ` - True, if content of the messages needs to be copied without links to the original messages. Always true if the messages are forwarded to a secret chat
# `remove_caption` - True, if media captions of message copies needs to be removed. Ignored if send_copy is false
def forward_messages(chat_id : Int64, from_chat_id : Int64, message_ids : Array(Int64), options : (SendMessageOptions | NamedTuple), as_album : (Bool | NamedTuple), send_copy : (Bool | NamedTuple), remove_caption : (Bool | NamedTuple)) : Messages
options = options.is_a?(NamedTuple) ? SendMessageOptions.new(**options) : options
as_album = as_album.is_a?(NamedTuple) ? Bool.new(**as_album) : as_album
send_copy = send_copy.is_a?(NamedTuple) ? Bool.new(**send_copy) : send_copy
remove_caption = remove_caption.is_a?(NamedTuple) ? Bool.new(**remove_caption) : remove_caption
res = client.send({
"@type" => "forwardMessages",
"chat_id" => chat_id,
"from_chat_id" => from_chat_id,
"message_ids" => message_ids,
"options" => options,
"as_album" => as_album,
"send_copy" => send_copy,
"remove_caption" => remove_caption,
}, true)
Messages.from_json(res.to_json)
end
# Resends messages which failed to send. Can be called only for messages for which messageSendingStateFailed.can_retry is true and after specified in messageSendingStateFailed.retry_after time passed.
# If a message is re-sent, the corresponding failed to send message is deleted. Returns the sent messages in the same order as the message identifiers passed in message_ids. If a message can't be re-sent, null will be returned instead of the message
#
# **Params:**
# `chat_id ` - Identifier of the chat to send messages
# `message_ids` - Identifiers of the messages to resend. Message identifiers must be in a strictly increasing order
def resend_messages(chat_id : Int64, message_ids : Array(Int64)) : Messages
res = client.send({
"@type" => "resendMessages",
"chat_id" => chat_id,
"message_ids" => message_ids,
}, true)
Messages.from_json(res.to_json)
end
# Changes the current TTL setting (sets a new self-destruct timer) in a secret chat and sends the corresponding message
#
# **Params:**
# `chat_id` - Chat identifier
# `ttl ` - New TTL value, in seconds
def send_chat_set_ttl_message(chat_id : Int64, ttl : (Int32 | NamedTuple)) : Message
ttl = ttl.is_a?(NamedTuple) ? Int32.new(**ttl) : ttl
res = client.send({
"@type" => "sendChatSetTtlMessage",
"chat_id" => chat_id,
"ttl" => ttl,
}, true)
Message.from_json(res.to_json)
end
# Sends a notification about a screenshot taken in a chat. Supported only in private and secret chats
def send_chat_screenshot_taken_notification(chat_id : Int64) : Ok?
res = client.send({
"@type" => "sendChatScreenshotTakenNotification",
"chat_id" => chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Adds a local message to a chat. The message is persistent across application restarts only if the message database is used. Returns the added message
#
# **Params:**
# `chat_id ` - Target chat
# `sender_user_id ` - Identifier of the user who will be shown as the sender of the message; may be 0 for channel posts
# `reply_to_message_id ` - Identifier of the message to reply to or 0
# `disable_notification ` - Pass true to disable notification for the message
# `input_message_content` - The content of the message to be added
def add_local_message(chat_id : Int64, sender_user_id : (Int32 | NamedTuple), reply_to_message_id : Int64, disable_notification : (Bool | NamedTuple), input_message_content : (InputMessageContent | NamedTuple)) : Message
sender_user_id = sender_user_id.is_a?(NamedTuple) ? Int32.new(**sender_user_id) : sender_user_id
disable_notification = disable_notification.is_a?(NamedTuple) ? Bool.new(**disable_notification) : disable_notification
input_message_content = input_message_content.is_a?(NamedTuple) ? InputMessageContent.new(**input_message_content) : input_message_content
res = client.send({
"@type" => "addLocalMessage",
"chat_id" => chat_id,
"sender_user_id" => sender_user_id,
"reply_to_message_id" => reply_to_message_id,
"disable_notification" => disable_notification,
"input_message_content" => input_message_content,
}, true)
Message.from_json(res.to_json)
end
# Deletes messages
#
# **Params:**
# `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
def delete_messages(chat_id : Int64, message_ids : Array(Int64), revoke : (Bool | NamedTuple)) : Ok?
revoke = revoke.is_a?(NamedTuple) ? Bool.new(**revoke) : revoke
res = client.send({
"@type" => "deleteMessages",
"chat_id" => chat_id,
"message_ids" => message_ids,
"revoke" => revoke,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Deletes all messages sent by the specified user to a chat. Supported only for supergroups; requires can_delete_messages administrator privileges
#
# **Params:**
# `chat_id` - Chat identifier
# `user_id` - User identifier
def delete_chat_messages_from_user(chat_id : Int64, user_id : (Int32 | NamedTuple)) : Ok?
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "deleteChatMessagesFromUser",
"chat_id" => chat_id,
"user_id" => user_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Edits the text of a message (or a text of a game message). Returns the edited message after the edit is completed on the server side
#
# **Params:**
# `chat_id ` - The chat the message belongs to
# `message_id ` - Identifier of the message
# `reply_markup ` - The new message reply markup; for bots only
# `input_message_content` - New text content of the message. Should be of type InputMessageText
def edit_message_text(chat_id : Int64, message_id : Int64, input_message_content : (InputMessageContent | NamedTuple), reply_markup : (ReplyMarkup | NamedTuple)? = nil) : Message
input_message_content = input_message_content.is_a?(NamedTuple) ? InputMessageContent.new(**input_message_content) : input_message_content
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
res = client.send({
"@type" => "editMessageText",
"chat_id" => chat_id,
"message_id" => message_id,
"input_message_content" => input_message_content,
"reply_markup" => reply_markup,
}, true)
Message.from_json(res.to_json)
end
# Edits the message content of a live location. Messages can be edited for a limited period of time specified in the live location. Returns the edited message after the edit is completed on the server side
#
# **Params:**
# `chat_id ` - The chat the message belongs to
# `message_id ` - Identifier of the message
# `reply_markup` - The new message reply markup; for bots only
# `location ` - New location content of the message; may be null. Pass null to stop sharing the live location
def edit_message_live_location(chat_id : Int64, message_id : Int64, reply_markup : (ReplyMarkup | NamedTuple)? = nil, location : (Location | NamedTuple)? = nil) : Message
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
location = location.is_a?(NamedTuple) ? Location.new(**location) : location
res = client.send({
"@type" => "editMessageLiveLocation",
"chat_id" => chat_id,
"message_id" => message_id,
"reply_markup" => reply_markup,
"location" => location,
}, true)
Message.from_json(res.to_json)
end
# Edits the content of a message with an animation, an audio, a document, a photo or a video. The media in the message can't be replaced if the message was set to self-destruct. Media can't be replaced by self-destructing media. Media in an album can be edited only to contain a photo or a video. Returns the edited message after the edit is completed on the server side
#
# **Params:**
# `chat_id ` - The chat the message belongs to
# `message_id ` - Identifier of the message
# `reply_markup ` - The new message reply markup; for bots only
# `input_message_content` - New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo
def edit_message_media(chat_id : Int64, message_id : Int64, input_message_content : (InputMessageContent | NamedTuple), reply_markup : (ReplyMarkup | NamedTuple)? = nil) : Message
input_message_content = input_message_content.is_a?(NamedTuple) ? InputMessageContent.new(**input_message_content) : input_message_content
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
res = client.send({
"@type" => "editMessageMedia",
"chat_id" => chat_id,
"message_id" => message_id,
"input_message_content" => input_message_content,
"reply_markup" => reply_markup,
}, true)
Message.from_json(res.to_json)
end
# Edits the message content caption. Returns the edited message after the edit is completed on the server side
#
# **Params:**
# `chat_id ` - The chat the message belongs to
# `message_id ` - Identifier of the message
# `reply_markup` - The new message reply markup; for bots only
# `caption ` - New message content caption; 0-GetOption("message_caption_length_max") characters
def edit_message_caption(chat_id : Int64, message_id : Int64, caption : (FormattedText | NamedTuple), reply_markup : (ReplyMarkup | NamedTuple)? = nil) : Message
caption = caption.is_a?(NamedTuple) ? FormattedText.new(**caption) : caption
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
res = client.send({
"@type" => "editMessageCaption",
"chat_id" => chat_id,
"message_id" => message_id,
"caption" => caption,
"reply_markup" => reply_markup,
}, true)
Message.from_json(res.to_json)
end
# Edits the message reply markup; for bots only. Returns the edited message after the edit is completed on the server side
#
# **Params:**
# `chat_id ` - The chat the message belongs to
# `message_id ` - Identifier of the message
# `reply_markup` - The new message reply markup
def edit_message_reply_markup(chat_id : Int64, message_id : Int64, reply_markup : (ReplyMarkup | NamedTuple)) : Message
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
res = client.send({
"@type" => "editMessageReplyMarkup",
"chat_id" => chat_id,
"message_id" => message_id,
"reply_markup" => reply_markup,
}, true)
Message.from_json(res.to_json)
end
# Edits the text of an inline text or game message sent via a bot; for bots only
#
# **Params:**
# `inline_message_id ` - Inline message identifier
# `reply_markup ` - The new message reply markup
# `input_message_content` - New text content of the message. Should be of type InputMessageText
def edit_inline_message_text(inline_message_id : String, reply_markup : (ReplyMarkup | NamedTuple), input_message_content : (InputMessageContent | NamedTuple)) : Ok?
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
input_message_content = input_message_content.is_a?(NamedTuple) ? InputMessageContent.new(**input_message_content) : input_message_content
res = client.send({
"@type" => "editInlineMessageText",
"inline_message_id" => inline_message_id,
"reply_markup" => reply_markup,
"input_message_content" => input_message_content,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Edits the content of a live location in an inline message sent via a bot; for bots only
#
# **Params:**
# `inline_message_id` - Inline message identifier
# `reply_markup ` - The new message reply markup
# `location ` - New location content of the message; may be null. Pass null to stop sharing the live location
def edit_inline_message_live_location(inline_message_id : String, reply_markup : (ReplyMarkup | NamedTuple), location : (Location | NamedTuple)? = nil) : Ok?
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
location = location.is_a?(NamedTuple) ? Location.new(**location) : location
res = client.send({
"@type" => "editInlineMessageLiveLocation",
"inline_message_id" => inline_message_id,
"reply_markup" => reply_markup,
"location" => location,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Edits the content of a message with an animation, an audio, a document, a photo or a video in an inline message sent via a bot; for bots only
#
# **Params:**
# `inline_message_id ` - Inline message identifier
# `reply_markup ` - The new message reply markup; for bots only
# `input_message_content` - New content of the message. Must be one of the following types: InputMessageAnimation, InputMessageAudio, InputMessageDocument, InputMessagePhoto or InputMessageVideo
def edit_inline_message_media(inline_message_id : String, input_message_content : (InputMessageContent | NamedTuple), reply_markup : (ReplyMarkup | NamedTuple)? = nil) : Ok?
input_message_content = input_message_content.is_a?(NamedTuple) ? InputMessageContent.new(**input_message_content) : input_message_content
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
res = client.send({
"@type" => "editInlineMessageMedia",
"inline_message_id" => inline_message_id,
"input_message_content" => input_message_content,
"reply_markup" => reply_markup,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Edits the caption of an inline message sent via a bot; for bots only
#
# **Params:**
# `inline_message_id` - Inline message identifier
# `reply_markup ` - The new message reply markup
# `caption ` - New message content caption; 0-GetOption("message_caption_length_max") characters
def edit_inline_message_caption(inline_message_id : String, reply_markup : (ReplyMarkup | NamedTuple), caption : (FormattedText | NamedTuple)) : Ok?
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
caption = caption.is_a?(NamedTuple) ? FormattedText.new(**caption) : caption
res = client.send({
"@type" => "editInlineMessageCaption",
"inline_message_id" => inline_message_id,
"reply_markup" => reply_markup,
"caption" => caption,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Edits the reply markup of an inline message sent via a bot; for bots only
#
# **Params:**
# `inline_message_id` - Inline message identifier
# `reply_markup ` - The new message reply markup
def edit_inline_message_reply_markup(inline_message_id : String, reply_markup : (ReplyMarkup | NamedTuple)) : Ok?
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
res = client.send({
"@type" => "editInlineMessageReplyMarkup",
"inline_message_id" => inline_message_id,
"reply_markup" => reply_markup,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Edits the time when a scheduled message will be sent. Scheduling state of all messages in the same album or forwarded together with the message will be also changed
#
# **Params:**
# `chat_id ` - The chat the message belongs to
# `message_id ` - Identifier of the message
# `scheduling_state` - The new message scheduling state. Pass null to send the message immediately
def edit_message_scheduling_state(chat_id : Int64, message_id : Int64, scheduling_state : (MessageSchedulingState | NamedTuple)) : Ok?
scheduling_state = scheduling_state.is_a?(NamedTuple) ? MessageSchedulingState.new(**scheduling_state) : scheduling_state
res = client.send({
"@type" => "editMessageSchedulingState",
"chat_id" => chat_id,
"message_id" => message_id,
"scheduling_state" => scheduling_state,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns all entities (mentions, hashtags, cashtags, bot commands, URLs, and email addresses) contained in the text. This is an offline method. Can be called before authorization. Can be called synchronously
def get_text_entities(text : String) : TextEntities
res = client.send({
"@type" => "getTextEntities",
"text" => text,
}, true)
TextEntities.from_json(res.to_json)
end
# Parses Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities contained in the text. This is an offline method. Can be called before authorization. Can be called synchronously
#
# **Params:**
# `text ` - The text which should be parsed
# `parse_mode` - Text parse mode
def parse_text_entities(text : String, parse_mode : (TextParseMode | NamedTuple)) : FormattedText
parse_mode = parse_mode.is_a?(NamedTuple) ? TextParseMode.new(**parse_mode) : parse_mode
res = client.send({
"@type" => "parseTextEntities",
"text" => text,
"parse_mode" => parse_mode,
}, true)
FormattedText.from_json(res.to_json)
end
# Returns the MIME type of a file, guessed by its extension. Returns an empty string on failure. This is an offline method. Can be called before authorization. Can be called synchronously
def get_file_mime_type(file_name : String) : Text
res = client.send({
"@type" => "getFileMimeType",
"file_name" => file_name,
}, true)
Text.from_json(res.to_json)
end
# Returns the extension of a file, guessed by its MIME type. Returns an empty string on failure. This is an offline method. Can be called before authorization. Can be called synchronously
def get_file_extension(mime_type : String) : Text
res = client.send({
"@type" => "getFileExtension",
"mime_type" => mime_type,
}, true)
Text.from_json(res.to_json)
end
# Removes potentially dangerous characters from the name of a file. The encoding of the file name is supposed to be UTF-8. Returns an empty string on failure. This is an offline method. Can be called before authorization. Can be called synchronously
def clean_file_name(file_name : String) : Text
res = client.send({
"@type" => "cleanFileName",
"file_name" => file_name,
}, true)
Text.from_json(res.to_json)
end
# Returns a string stored in the local database from the specified localization target and language pack by its key. Returns a 404 error if the string is not found. This is an offline method. Can be called before authorization. Can be called synchronously
#
# **Params:**
# `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
def get_language_pack_string(language_pack_database_path : String, localization_target : String, language_pack_id : String, key : String) : LanguagePackStringValue
res = client.send({
"@type" => "getLanguagePackString",
"language_pack_database_path" => language_pack_database_path,
"localization_target" => localization_target,
"language_pack_id" => language_pack_id,
"key" => key,
}, true)
LanguagePackStringValue.from_json(res.to_json)
end
# Converts a JSON-serialized string to corresponding JsonValue object. This is an offline method. Can be called before authorization. Can be called synchronously
def get_json_value(json : String) : JsonValue
res = client.send({
"@type" => "getJsonValue",
"json" => json,
}, true)
JsonValue.from_json(res.to_json)
end
# Converts a JsonValue object to corresponding JSON-serialized string. This is an offline method. Can be called before authorization. Can be called synchronously
def get_json_string(json_value : (JsonValue | NamedTuple)) : Text
json_value = json_value.is_a?(NamedTuple) ? JsonValue.new(**json_value) : json_value
res = client.send({
"@type" => "getJsonString",
"json_value" => json_value,
}, true)
Text.from_json(res.to_json)
end
# Changes the user answer to a poll. A poll in quiz mode can be answered only once
#
# **Params:**
# `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 answer options, chosen by the user. User can choose more than 1 answer option only is the poll allows multiple answers
def set_poll_answer(chat_id : Int64, message_id : Int64, option_ids : Array(Int32)) : Ok?
res = client.send({
"@type" => "setPollAnswer",
"chat_id" => chat_id,
"message_id" => message_id,
"option_ids" => option_ids,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns users voted for the specified option in a non-anonymous polls. For the optimal performance the number of returned users is chosen by the library
#
# **Params:**
# `chat_id ` - Identifier of the chat to which the poll belongs
# `message_id` - Identifier of the message containing the poll
# `option_id ` - 0-based identifier of the answer option
# `offset ` - Number of users to skip in the result; must be non-negative
# `limit ` - The maximum number of users to be returned; must be positive and can't be greater than 50. Fewer users may be returned than specified by the limit, even if the end of the voter list has not been reached
def get_poll_voters(chat_id : Int64, message_id : Int64, option_id : (Int32 | NamedTuple), offset : (Int32 | NamedTuple), limit : (Int32 | NamedTuple)) : Users
option_id = option_id.is_a?(NamedTuple) ? Int32.new(**option_id) : option_id
offset = offset.is_a?(NamedTuple) ? Int32.new(**offset) : offset
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "getPollVoters",
"chat_id" => chat_id,
"message_id" => message_id,
"option_id" => option_id,
"offset" => offset,
"limit" => limit,
}, true)
Users.from_json(res.to_json)
end
# Stops a poll. A poll in a message can be stopped when the message has can_be_edited flag set
#
# **Params:**
# `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
def stop_poll(chat_id : Int64, message_id : Int64, reply_markup : (ReplyMarkup | NamedTuple)? = nil) : Ok?
reply_markup = reply_markup.is_a?(NamedTuple) ? ReplyMarkup.new(**reply_markup) : reply_markup
res = client.send({
"@type" => "stopPoll",
"chat_id" => chat_id,
"message_id" => message_id,
"reply_markup" => reply_markup,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns information about a button of type inlineKeyboardButtonTypeLoginUrl. The method needs to be called when the user presses the button
#
# **Params:**
# `chat_id ` - Chat identifier of the message with the button
# `message_id` - Message identifier of the message with the button
# `button_id ` - Button identifier
def get_login_url_info(chat_id : Int64, message_id : Int64, button_id : (Int32 | NamedTuple)) : LoginUrlInfo
button_id = button_id.is_a?(NamedTuple) ? Int32.new(**button_id) : button_id
res = client.send({
"@type" => "getLoginUrlInfo",
"chat_id" => chat_id,
"message_id" => message_id,
"button_id" => button_id,
}, true)
LoginUrlInfo.from_json(res.to_json)
end
# Returns an HTTP URL which can be used to automatically authorize the user on a website after clicking an inline button of type inlineKeyboardButtonTypeLoginUrl.
# Use the method getLoginUrlInfo to find whether a prior user confirmation is needed. If an error is returned, then the button must be handled as an ordinary URL button
#
# **Params:**
# `chat_id ` - Chat identifier of the message with the button
# `message_id ` - Message identifier of the message with the button
# `button_id ` - Button identifier
# `allow_write_access` - True, if the user allowed the bot to send them messages
def get_login_url(chat_id : Int64, message_id : Int64, button_id : (Int32 | NamedTuple), allow_write_access : (Bool | NamedTuple)) : HttpUrl
button_id = button_id.is_a?(NamedTuple) ? Int32.new(**button_id) : button_id
allow_write_access = allow_write_access.is_a?(NamedTuple) ? Bool.new(**allow_write_access) : allow_write_access
res = client.send({
"@type" => "getLoginUrl",
"chat_id" => chat_id,
"message_id" => message_id,
"button_id" => button_id,
"allow_write_access" => allow_write_access,
}, true)
HttpUrl.from_json(res.to_json)
end
# 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
#
# **Params:**
# `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
def get_inline_query_results(bot_user_id : (Int32 | NamedTuple), chat_id : Int64, user_location : (Location | NamedTuple), query : String, offset : String) : InlineQueryResults
bot_user_id = bot_user_id.is_a?(NamedTuple) ? Int32.new(**bot_user_id) : bot_user_id
user_location = user_location.is_a?(NamedTuple) ? Location.new(**user_location) : user_location
res = client.send({
"@type" => "getInlineQueryResults",
"bot_user_id" => bot_user_id,
"chat_id" => chat_id,
"user_location" => user_location,
"query" => query,
"offset" => offset,
}, true)
InlineQueryResults.from_json(res.to_json)
end
# Sets the result of an inline query; for bots only
#
# **Params:**
# `inline_query_id ` - Identifier of the inline query
# `is_personal ` - True, if the result of the query can be cached for the specified user
# `results ` - The results of the query
# `cache_time ` - Allowed time to cache the results of the query, in seconds
# `next_offset ` - Offset for the next inline query; pass an empty string if there are no more results
# `switch_pm_text ` - If non-empty, this text should be shown on the button that opens a private chat with the bot and sends a start message to the bot with the parameter switch_pm_parameter
# `switch_pm_parameter` - The parameter for the bot start message
def answer_inline_query(inline_query_id : (String | NamedTuple), is_personal : (Bool | NamedTuple), results : Array(InputInlineQueryResult), cache_time : (Int32 | NamedTuple), next_offset : String, switch_pm_text : String, switch_pm_parameter : String) : Ok?
inline_query_id = inline_query_id.is_a?(NamedTuple) ? String.new(**inline_query_id) : inline_query_id
is_personal = is_personal.is_a?(NamedTuple) ? Bool.new(**is_personal) : is_personal
cache_time = cache_time.is_a?(NamedTuple) ? Int32.new(**cache_time) : cache_time
res = client.send({
"@type" => "answerInlineQuery",
"inline_query_id" => inline_query_id,
"is_personal" => is_personal,
"results" => results,
"cache_time" => cache_time,
"next_offset" => next_offset,
"switch_pm_text" => switch_pm_text,
"switch_pm_parameter" => switch_pm_parameter,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Sends a callback query to a bot and returns an answer. Returns an error with code 502 if the bot fails to answer the query before the query timeout expires
#
# **Params:**
# `chat_id ` - Identifier of the chat with the message
# `message_id` - Identifier of the message from which the query originated
# `payload ` - Query payload
def get_callback_query_answer(chat_id : Int64, message_id : Int64, payload : (CallbackQueryPayload | NamedTuple)) : CallbackQueryAnswer
payload = payload.is_a?(NamedTuple) ? CallbackQueryPayload.new(**payload) : payload
res = client.send({
"@type" => "getCallbackQueryAnswer",
"chat_id" => chat_id,
"message_id" => message_id,
"payload" => payload,
}, true)
CallbackQueryAnswer.from_json(res.to_json)
end
# Sets the result of a callback query; for bots only
#
# **Params:**
# `callback_query_id` - Identifier of the callback query
# `text ` - Text of the answer
# `show_alert ` - If true, an alert should be shown to the user instead of a toast notification
# `url ` - URL to be opened
# `cache_time ` - Time during which the result of the query can be cached, in seconds
def answer_callback_query(callback_query_id : (String | NamedTuple), text : String, show_alert : (Bool | NamedTuple), url : String, cache_time : (Int32 | NamedTuple)) : Ok?
callback_query_id = callback_query_id.is_a?(NamedTuple) ? String.new(**callback_query_id) : callback_query_id
show_alert = show_alert.is_a?(NamedTuple) ? Bool.new(**show_alert) : show_alert
cache_time = cache_time.is_a?(NamedTuple) ? Int32.new(**cache_time) : cache_time
res = client.send({
"@type" => "answerCallbackQuery",
"callback_query_id" => callback_query_id,
"text" => text,
"show_alert" => show_alert,
"url" => url,
"cache_time" => cache_time,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Sets the result of a shipping query; for bots only
#
# **Params:**
# `shipping_query_id` - Identifier of the shipping query
# `shipping_options ` - Available shipping options
# `error_message ` - An error message, empty on success
def answer_shipping_query(shipping_query_id : (String | NamedTuple), shipping_options : Array(ShippingOption), error_message : String) : Ok?
shipping_query_id = shipping_query_id.is_a?(NamedTuple) ? String.new(**shipping_query_id) : shipping_query_id
res = client.send({
"@type" => "answerShippingQuery",
"shipping_query_id" => shipping_query_id,
"shipping_options" => shipping_options,
"error_message" => error_message,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Sets the result of a pre-checkout query; for bots only
#
# **Params:**
# `pre_checkout_query_id` - Identifier of the pre-checkout query
# `error_message ` - An error message, empty on success
def answer_pre_checkout_query(pre_checkout_query_id : (String | NamedTuple), error_message : String) : Ok?
pre_checkout_query_id = pre_checkout_query_id.is_a?(NamedTuple) ? String.new(**pre_checkout_query_id) : pre_checkout_query_id
res = client.send({
"@type" => "answerPreCheckoutQuery",
"pre_checkout_query_id" => pre_checkout_query_id,
"error_message" => error_message,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Updates the game score of the specified user in the game; for bots only
#
# **Params:**
# `chat_id ` - The chat to which the message with the game belongs
# `message_id ` - Identifier of the message
# `edit_message` - True, if the message should be edited
# `user_id ` - User identifier
# `score ` - The new score
# `force ` - Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table
def set_game_score(chat_id : Int64, message_id : Int64, edit_message : (Bool | NamedTuple), user_id : (Int32 | NamedTuple), score : (Int32 | NamedTuple), force : (Bool | NamedTuple)) : Message
edit_message = edit_message.is_a?(NamedTuple) ? Bool.new(**edit_message) : edit_message
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
score = score.is_a?(NamedTuple) ? Int32.new(**score) : score
force = force.is_a?(NamedTuple) ? Bool.new(**force) : force
res = client.send({
"@type" => "setGameScore",
"chat_id" => chat_id,
"message_id" => message_id,
"edit_message" => edit_message,
"user_id" => user_id,
"score" => score,
"force" => force,
}, true)
Message.from_json(res.to_json)
end
# Updates the game score of the specified user in a game; for bots only
#
# **Params:**
# `inline_message_id` - Inline message identifier
# `edit_message ` - True, if the message should be edited
# `user_id ` - User identifier
# `score ` - The new score
# `force ` - Pass true to update the score even if it decreases. If the score is 0, the user will be deleted from the high score table
def set_inline_game_score(inline_message_id : String, edit_message : (Bool | NamedTuple), user_id : (Int32 | NamedTuple), score : (Int32 | NamedTuple), force : (Bool | NamedTuple)) : Ok?
edit_message = edit_message.is_a?(NamedTuple) ? Bool.new(**edit_message) : edit_message
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
score = score.is_a?(NamedTuple) ? Int32.new(**score) : score
force = force.is_a?(NamedTuple) ? Bool.new(**force) : force
res = client.send({
"@type" => "setInlineGameScore",
"inline_message_id" => inline_message_id,
"edit_message" => edit_message,
"user_id" => user_id,
"score" => score,
"force" => force,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns the high scores for a game and some part of the high score table in the range of the specified user; for bots only
#
# **Params:**
# `chat_id ` - The chat that contains the message with the game
# `message_id` - Identifier of the message
# `user_id ` - User identifier
def get_game_high_scores(chat_id : Int64, message_id : Int64, user_id : (Int32 | NamedTuple)) : GameHighScores
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "getGameHighScores",
"chat_id" => chat_id,
"message_id" => message_id,
"user_id" => user_id,
}, true)
GameHighScores.from_json(res.to_json)
end
# Returns game high scores and some part of the high score table in the range of the specified user; for bots only
#
# **Params:**
# `inline_message_id` - Inline message identifier
# `user_id ` - User identifier
def get_inline_game_high_scores(inline_message_id : String, user_id : (Int32 | NamedTuple)) : GameHighScores
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "getInlineGameHighScores",
"inline_message_id" => inline_message_id,
"user_id" => user_id,
}, true)
GameHighScores.from_json(res.to_json)
end
# Deletes the default reply markup from a chat. Must be called after a one-time keyboard or a ForceReply reply markup has been used. UpdateChatReplyMarkup will be sent if the reply markup will be changed
#
# **Params:**
# `chat_id ` - Chat identifier
# `message_id` - The message identifier of the used keyboard
def delete_chat_reply_markup(chat_id : Int64, message_id : Int64) : Ok?
res = client.send({
"@type" => "deleteChatReplyMarkup",
"chat_id" => chat_id,
"message_id" => message_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Sends a notification about user activity in a chat
#
# **Params:**
# `chat_id` - Chat identifier
# `action ` - The action description
def send_chat_action(chat_id : Int64, action : (ChatAction | NamedTuple)) : Ok?
action = action.is_a?(NamedTuple) ? ChatAction.new(**action) : action
res = client.send({
"@type" => "sendChatAction",
"chat_id" => chat_id,
"action" => action,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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)
def open_chat(chat_id : Int64) : Ok?
res = client.send({
"@type" => "openChat",
"chat_id" => chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Informs TDLib that the chat is closed by the user. Many useful activities depend on the chat being opened or closed
def close_chat(chat_id : Int64) : Ok?
res = client.send({
"@type" => "closeChat",
"chat_id" => chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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)
#
# **Params:**
# `chat_id ` - Chat identifier
# `message_ids` - The identifiers of the messages being viewed
# `force_read ` - True, if messages in closed chats should be marked as read
def view_messages(chat_id : Int64, message_ids : Array(Int64), force_read : (Bool | NamedTuple)) : Ok?
force_read = force_read.is_a?(NamedTuple) ? Bool.new(**force_read) : force_read
res = client.send({
"@type" => "viewMessages",
"chat_id" => chat_id,
"message_ids" => message_ids,
"force_read" => force_read,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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
#
# **Params:**
# `chat_id ` - Chat identifier of the message
# `message_id` - Identifier of the message with the opened content
def open_message_content(chat_id : Int64, message_id : Int64) : Ok?
res = client.send({
"@type" => "openMessageContent",
"chat_id" => chat_id,
"message_id" => message_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Marks all mentions in a chat as read
def read_all_chat_mentions(chat_id : Int64) : Ok?
res = client.send({
"@type" => "readAllChatMentions",
"chat_id" => chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns an existing chat corresponding to a given user
#
# **Params:**
# `user_id` - User identifier
# `force ` - If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect
def create_private_chat(user_id : (Int32 | NamedTuple), force : (Bool | NamedTuple)) : Chat
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
force = force.is_a?(NamedTuple) ? Bool.new(**force) : force
res = client.send({
"@type" => "createPrivateChat",
"user_id" => user_id,
"force" => force,
}, true)
Chat.from_json(res.to_json)
end
# Returns an existing chat corresponding to a known basic group
#
# **Params:**
# `basic_group_id` - Basic group identifier
# `force ` - If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect
def create_basic_group_chat(basic_group_id : (Int32 | NamedTuple), force : (Bool | NamedTuple)) : Chat
basic_group_id = basic_group_id.is_a?(NamedTuple) ? Int32.new(**basic_group_id) : basic_group_id
force = force.is_a?(NamedTuple) ? Bool.new(**force) : force
res = client.send({
"@type" => "createBasicGroupChat",
"basic_group_id" => basic_group_id,
"force" => force,
}, true)
Chat.from_json(res.to_json)
end
# Returns an existing chat corresponding to a known supergroup or channel
#
# **Params:**
# `supergroup_id` - Supergroup or channel identifier
# `force ` - If true, the chat will be created without network request. In this case all information about the chat except its type, title and photo can be incorrect
def create_supergroup_chat(supergroup_id : (Int32 | NamedTuple), force : (Bool | NamedTuple)) : Chat
supergroup_id = supergroup_id.is_a?(NamedTuple) ? Int32.new(**supergroup_id) : supergroup_id
force = force.is_a?(NamedTuple) ? Bool.new(**force) : force
res = client.send({
"@type" => "createSupergroupChat",
"supergroup_id" => supergroup_id,
"force" => force,
}, true)
Chat.from_json(res.to_json)
end
# Returns an existing chat corresponding to a known secret chat
def create_secret_chat(secret_chat_id : (Int32 | NamedTuple)) : Chat
secret_chat_id = secret_chat_id.is_a?(NamedTuple) ? Int32.new(**secret_chat_id) : secret_chat_id
res = client.send({
"@type" => "createSecretChat",
"secret_chat_id" => secret_chat_id,
}, true)
Chat.from_json(res.to_json)
end
# Creates a new basic group and sends a corresponding messageBasicGroupChatCreate. Returns the newly created chat
#
# **Params:**
# `user_ids` - Identifiers of users to be added to the basic group
# `title ` - Title of the new basic group; 1-128 characters
def create_new_basic_group_chat(user_ids : Array(Int32), title : String) : Chat
res = client.send({
"@type" => "createNewBasicGroupChat",
"user_ids" => user_ids,
"title" => title,
}, true)
Chat.from_json(res.to_json)
end
# Creates a new supergroup or channel and sends a corresponding messageSupergroupChatCreate. Returns the newly created chat
#
# **Params:**
# `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
# `location ` - Chat location if a location-based supergroup is being created
def create_new_supergroup_chat(title : String, is_channel : (Bool | NamedTuple), description : String, location : (ChatLocation | NamedTuple)) : Chat
is_channel = is_channel.is_a?(NamedTuple) ? Bool.new(**is_channel) : is_channel
location = location.is_a?(NamedTuple) ? ChatLocation.new(**location) : location
res = client.send({
"@type" => "createNewSupergroupChat",
"title" => title,
"is_channel" => is_channel,
"description" => description,
"location" => location,
}, true)
Chat.from_json(res.to_json)
end
# Creates a new secret chat. Returns the newly created chat
def create_new_secret_chat(user_id : (Int32 | NamedTuple)) : Chat
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "createNewSecretChat",
"user_id" => user_id,
}, true)
Chat.from_json(res.to_json)
end
# Creates a new supergroup from an existing basic group and sends a corresponding messageChatUpgradeTo and messageChatUpgradeFrom; requires creator privileges. Deactivates the original basic group
def upgrade_basic_group_chat_to_supergroup_chat(chat_id : Int64) : Chat
res = client.send({
"@type" => "upgradeBasicGroupChatToSupergroupChat",
"chat_id" => chat_id,
}, true)
Chat.from_json(res.to_json)
end
# Moves a chat to a different chat list. Current chat list of the chat must ne non-null
#
# **Params:**
# `chat_id ` - Chat identifier
# `chat_list` - New chat list of the chat
def set_chat_chat_list(chat_id : Int64, chat_list : (ChatList | NamedTuple)) : Ok?
chat_list = chat_list.is_a?(NamedTuple) ? ChatList.new(**chat_list) : chat_list
res = client.send({
"@type" => "setChatChatList",
"chat_id" => chat_id,
"chat_list" => chat_list,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the chat title. Supported only for basic groups, supergroups and channels. Requires can_change_info rights. The title will not be changed until the request to the server has been completed
#
# **Params:**
# `chat_id` - Chat identifier
# `title ` - New title of the chat; 1-128 characters
def set_chat_title(chat_id : Int64, title : String) : Ok?
res = client.send({
"@type" => "setChatTitle",
"chat_id" => chat_id,
"title" => title,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the photo of a chat. Supported only for basic groups, supergroups and channels. Requires can_change_info rights. The photo will not be changed before request to the server has been completed
#
# **Params:**
# `chat_id` - Chat identifier
# `photo ` - New chat photo. You can use a zero InputFileId to delete the chat photo. Files that are accessible only by HTTP URL are not acceptable
def set_chat_photo(chat_id : Int64, photo : (InputFile | NamedTuple)) : Ok?
photo = photo.is_a?(NamedTuple) ? InputFile.new(**photo) : photo
res = client.send({
"@type" => "setChatPhoto",
"chat_id" => chat_id,
"photo" => photo,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the chat members permissions. Supported only for basic groups and supergroups. Requires can_restrict_members administrator right
#
# **Params:**
# `chat_id ` - Chat identifier
# `permissions` - New non-administrator members permissions in the chat
def set_chat_permissions(chat_id : Int64, permissions : (ChatPermissions | NamedTuple)) : Ok?
permissions = permissions.is_a?(NamedTuple) ? ChatPermissions.new(**permissions) : permissions
res = client.send({
"@type" => "setChatPermissions",
"chat_id" => chat_id,
"permissions" => permissions,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the draft message in a chat
#
# **Params:**
# `chat_id ` - Chat identifier
# `draft_message` - New draft message; may be null
def set_chat_draft_message(chat_id : Int64, draft_message : (DraftMessage | NamedTuple)? = nil) : Ok?
draft_message = draft_message.is_a?(NamedTuple) ? DraftMessage.new(**draft_message) : draft_message
res = client.send({
"@type" => "setChatDraftMessage",
"chat_id" => chat_id,
"draft_message" => draft_message,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the notification settings of a chat. Notification settings of a chat with the current user (Saved Messages) can't be changed
#
# **Params:**
# `chat_id ` - Chat identifier
# `notification_settings` - New notification settings for the chat. If the chat is muted for more than 1 week, it is considered to be muted forever
def set_chat_notification_settings(chat_id : Int64, notification_settings : (ChatNotificationSettings | NamedTuple)) : Ok?
notification_settings = notification_settings.is_a?(NamedTuple) ? ChatNotificationSettings.new(**notification_settings) : notification_settings
res = client.send({
"@type" => "setChatNotificationSettings",
"chat_id" => chat_id,
"notification_settings" => notification_settings,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the pinned state of a chat. You can pin up to GetOption("pinned_chat_count_max")/GetOption("pinned_archived_chat_count_max") non-secret chats and the same number of secret chats in the main/archive chat list
#
# **Params:**
# `chat_id ` - Chat identifier
# `is_pinned` - New value of is_pinned
def toggle_chat_is_pinned(chat_id : Int64, is_pinned : (Bool | NamedTuple)) : Ok?
is_pinned = is_pinned.is_a?(NamedTuple) ? Bool.new(**is_pinned) : is_pinned
res = client.send({
"@type" => "toggleChatIsPinned",
"chat_id" => chat_id,
"is_pinned" => is_pinned,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the marked as unread state of a chat
#
# **Params:**
# `chat_id ` - Chat identifier
# `is_marked_as_unread` - New value of is_marked_as_unread
def toggle_chat_is_marked_as_unread(chat_id : Int64, is_marked_as_unread : (Bool | NamedTuple)) : Ok?
is_marked_as_unread = is_marked_as_unread.is_a?(NamedTuple) ? Bool.new(**is_marked_as_unread) : is_marked_as_unread
res = client.send({
"@type" => "toggleChatIsMarkedAsUnread",
"chat_id" => chat_id,
"is_marked_as_unread" => is_marked_as_unread,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the value of the default disable_notification parameter, used when a message is sent to a chat
#
# **Params:**
# `chat_id ` - Chat identifier
# `default_disable_notification` - New value of default_disable_notification
def toggle_chat_default_disable_notification(chat_id : Int64, default_disable_notification : (Bool | NamedTuple)) : Ok?
default_disable_notification = default_disable_notification.is_a?(NamedTuple) ? Bool.new(**default_disable_notification) : default_disable_notification
res = client.send({
"@type" => "toggleChatDefaultDisableNotification",
"chat_id" => chat_id,
"default_disable_notification" => default_disable_notification,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes client data associated with a chat
#
# **Params:**
# `chat_id ` - Chat identifier
# `client_data` - New value of client_data
def set_chat_client_data(chat_id : Int64, client_data : String) : Ok?
res = client.send({
"@type" => "setChatClientData",
"chat_id" => chat_id,
"client_data" => client_data,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes information about a chat. Available for basic groups, supergroups, and channels. Requires can_change_info rights
#
# **Params:**
# `chat_id ` - Identifier of the chat
# `param_description` - New chat description; 0-255 characters
def set_chat_description(chat_id : Int64, description : String) : Ok?
res = client.send({
"@type" => "setChatDescription",
"chat_id" => chat_id,
"description" => description,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the discussion group of a channel chat; requires can_change_info rights in the channel if it is specified
#
# **Params:**
# `chat_id ` - Identifier of the channel chat. Pass 0 to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages rights in the supergroup)
# `discussion_chat_id` - Identifier of a new channel's discussion group. Use 0 to remove the discussion group.
# Use the method getSuitableDiscussionChats to find all suitable groups. Basic group chats needs to be first upgraded to supergroup chats. If new chat members don't have access to old messages in the supergroup, then toggleSupergroupIsAllHistoryAvailable needs to be used first to change that
def set_chat_discussion_group(chat_id : Int64, discussion_chat_id : Int64) : Ok?
res = client.send({
"@type" => "setChatDiscussionGroup",
"chat_id" => chat_id,
"discussion_chat_id" => discussion_chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the location of a chat. Available only for some location-based supergroups, use supergroupFullInfo.can_set_location to check whether the method is allowed to use
#
# **Params:**
# `chat_id ` - Chat identifier
# `location` - New location for the chat; must be valid and not null
def set_chat_location(chat_id : Int64, location : (ChatLocation | NamedTuple)) : Ok?
location = location.is_a?(NamedTuple) ? ChatLocation.new(**location) : location
res = client.send({
"@type" => "setChatLocation",
"chat_id" => chat_id,
"location" => location,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the slow mode delay of a chat. Available only for supergroups; requires can_restrict_members rights
#
# **Params:**
# `chat_id ` - Chat identifier
# `slow_mode_delay` - New slow mode delay for the chat; must be one of 0, 10, 30, 60, 300, 900, 3600
def set_chat_slow_mode_delay(chat_id : Int64, slow_mode_delay : (Int32 | NamedTuple)) : Ok?
slow_mode_delay = slow_mode_delay.is_a?(NamedTuple) ? Int32.new(**slow_mode_delay) : slow_mode_delay
res = client.send({
"@type" => "setChatSlowModeDelay",
"chat_id" => chat_id,
"slow_mode_delay" => slow_mode_delay,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Pins a message in a chat; requires can_pin_messages rights
#
# **Params:**
# `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
def pin_chat_message(chat_id : Int64, message_id : Int64, disable_notification : (Bool | NamedTuple)) : Ok?
disable_notification = disable_notification.is_a?(NamedTuple) ? Bool.new(**disable_notification) : disable_notification
res = client.send({
"@type" => "pinChatMessage",
"chat_id" => chat_id,
"message_id" => message_id,
"disable_notification" => disable_notification,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Removes the pinned message from a chat; requires can_pin_messages rights in the group or channel
def unpin_chat_message(chat_id : Int64) : Ok?
res = client.send({
"@type" => "unpinChatMessage",
"chat_id" => chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Adds current user as a new member to a chat. Private and secret chats can't be joined using this method
def join_chat(chat_id : Int64) : Ok?
res = client.send({
"@type" => "joinChat",
"chat_id" => chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Removes current user from chat members. Private and secret chats can't be left using this method
def leave_chat(chat_id : Int64) : Ok?
res = client.send({
"@type" => "leaveChat",
"chat_id" => chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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
#
# **Params:**
# `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
def add_chat_member(chat_id : Int64, user_id : (Int32 | NamedTuple), forward_limit : (Int32 | NamedTuple)) : Ok?
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
forward_limit = forward_limit.is_a?(NamedTuple) ? Int32.new(**forward_limit) : forward_limit
res = client.send({
"@type" => "addChatMember",
"chat_id" => chat_id,
"user_id" => user_id,
"forward_limit" => forward_limit,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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
#
# **Params:**
# `chat_id ` - Chat identifier
# `user_ids` - Identifiers of the users to be added to the chat
def add_chat_members(chat_id : Int64, user_ids : Array(Int32)) : Ok?
res = client.send({
"@type" => "addChatMembers",
"chat_id" => chat_id,
"user_ids" => user_ids,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the status of a chat member, needs appropriate privileges. This function is currently not suitable for adding new members to the chat and transferring chat ownership; instead, use addChatMember or transferChatOwnership. The chat member status will not be changed until it has been synchronized with the server
#
# **Params:**
# `chat_id` - Chat identifier
# `user_id` - User identifier
# `status ` - The new status of the member in the chat
def set_chat_member_status(chat_id : Int64, user_id : (Int32 | NamedTuple), status : (ChatMemberStatus | NamedTuple)) : Ok?
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
status = status.is_a?(NamedTuple) ? ChatMemberStatus.new(**status) : status
res = client.send({
"@type" => "setChatMemberStatus",
"chat_id" => chat_id,
"user_id" => user_id,
"status" => status,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Checks whether the current session can be used to transfer a chat ownership to another user
def can_transfer_ownership : CanTransferOwnershipResult
res = client.send({
"@type" => "canTransferOwnership",
}, true)
CanTransferOwnershipResult.from_json(res.to_json)
end
# Changes the owner of a chat. The current user must be a current owner of the chat. Use the method canTransferOwnership to check whether the ownership can be transferred from the current session. Available only for supergroups and channel chats
#
# **Params:**
# `chat_id ` - Chat identifier
# `user_id ` - Identifier of the user to which transfer the ownership. The ownership can't be transferred to a bot or to a deleted user
# `password` - The password of the current user
def transfer_chat_ownership(chat_id : Int64, user_id : (Int32 | NamedTuple), password : String) : Ok?
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "transferChatOwnership",
"chat_id" => chat_id,
"user_id" => user_id,
"password" => password,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns information about a single member of a chat
#
# **Params:**
# `chat_id` - Chat identifier
# `user_id` - User identifier
def get_chat_member(chat_id : Int64, user_id : (Int32 | NamedTuple)) : ChatMember
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "getChatMember",
"chat_id" => chat_id,
"user_id" => user_id,
}, true)
ChatMember.from_json(res.to_json)
end
# Searches for a specified query in the first name, last name and username of the members of a specified chat. Requires administrator rights in channels
#
# **Params:**
# `chat_id` - Chat identifier
# `query ` - Query to search for
# `limit ` - The maximum number of users to be returned
# `filter ` - The type of users to return. By default, chatMembersFilterMembers
def search_chat_members(chat_id : Int64, query : String, limit : (Int32 | NamedTuple), filter : (ChatMembersFilter | NamedTuple)) : ChatMembers
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
filter = filter.is_a?(NamedTuple) ? ChatMembersFilter.new(**filter) : filter
res = client.send({
"@type" => "searchChatMembers",
"chat_id" => chat_id,
"query" => query,
"limit" => limit,
"filter" => filter,
}, true)
ChatMembers.from_json(res.to_json)
end
# Returns a list of administrators of the chat with their custom titles
def get_chat_administrators(chat_id : Int64) : ChatAdministrators
res = client.send({
"@type" => "getChatAdministrators",
"chat_id" => chat_id,
}, true)
ChatAdministrators.from_json(res.to_json)
end
# Clears draft messages in all chats
def clear_all_draft_messages(exclude_secret_chats : (Bool | NamedTuple)) : Ok?
exclude_secret_chats = exclude_secret_chats.is_a?(NamedTuple) ? Bool.new(**exclude_secret_chats) : exclude_secret_chats
res = client.send({
"@type" => "clearAllDraftMessages",
"exclude_secret_chats" => exclude_secret_chats,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns list of chats with non-default notification settings
#
# **Params:**
# `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
def get_chat_notification_settings_exceptions(scope : (NotificationSettingsScope | NamedTuple), compare_sound : (Bool | NamedTuple)) : Chats
scope = scope.is_a?(NamedTuple) ? NotificationSettingsScope.new(**scope) : scope
compare_sound = compare_sound.is_a?(NamedTuple) ? Bool.new(**compare_sound) : compare_sound
res = client.send({
"@type" => "getChatNotificationSettingsExceptions",
"scope" => scope,
"compare_sound" => compare_sound,
}, true)
Chats.from_json(res.to_json)
end
# Returns the notification settings for chats of a given type
def get_scope_notification_settings(scope : (NotificationSettingsScope | NamedTuple)) : ScopeNotificationSettings
scope = scope.is_a?(NamedTuple) ? NotificationSettingsScope.new(**scope) : scope
res = client.send({
"@type" => "getScopeNotificationSettings",
"scope" => scope,
}, true)
ScopeNotificationSettings.from_json(res.to_json)
end
# Changes notification settings for chats of a given type
#
# **Params:**
# `scope ` - Types of chats for which to change the notification settings
# `notification_settings` - The new notification settings for the given scope
def set_scope_notification_settings(scope : (NotificationSettingsScope | NamedTuple), notification_settings : (ScopeNotificationSettings | NamedTuple)) : Ok?
scope = scope.is_a?(NamedTuple) ? NotificationSettingsScope.new(**scope) : scope
notification_settings = notification_settings.is_a?(NamedTuple) ? ScopeNotificationSettings.new(**notification_settings) : notification_settings
res = client.send({
"@type" => "setScopeNotificationSettings",
"scope" => scope,
"notification_settings" => notification_settings,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Resets all notification settings to their default values. By default, all chats are unmuted, the sound is set to "default" and message previews are shown
def reset_all_notification_settings : Ok?
res = client.send({
"@type" => "resetAllNotificationSettings",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the order of pinned chats
#
# **Params:**
# `chat_list` - Chat list in which to change the order of pinned chats
# `chat_ids ` - The new list of pinned chats
def set_pinned_chats(chat_list : (ChatList | NamedTuple), chat_ids : Array(Int64)) : Ok?
chat_list = chat_list.is_a?(NamedTuple) ? ChatList.new(**chat_list) : chat_list
res = client.send({
"@type" => "setPinnedChats",
"chat_list" => chat_list,
"chat_ids" => chat_ids,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates
#
# **Params:**
# `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
# `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
def download_file(file_id : (Int32 | NamedTuple), priority : (Int32 | NamedTuple), offset : (Int32 | NamedTuple), limit : (Int32 | NamedTuple), synchronous : (Bool | NamedTuple)) : File
file_id = file_id.is_a?(NamedTuple) ? Int32.new(**file_id) : file_id
priority = priority.is_a?(NamedTuple) ? Int32.new(**priority) : priority
offset = offset.is_a?(NamedTuple) ? Int32.new(**offset) : offset
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
synchronous = synchronous.is_a?(NamedTuple) ? Bool.new(**synchronous) : synchronous
res = client.send({
"@type" => "downloadFile",
"file_id" => file_id,
"priority" => priority,
"offset" => offset,
"limit" => limit,
"synchronous" => synchronous,
}, true)
File.from_json(res.to_json)
end
# Returns file downloaded prefix size from a given offset
#
# **Params:**
# `file_id` - Identifier of the file
# `offset ` - Offset from which downloaded prefix size should be calculated
def get_file_downloaded_prefix_size(file_id : (Int32 | NamedTuple), offset : (Int32 | NamedTuple)) : Count
file_id = file_id.is_a?(NamedTuple) ? Int32.new(**file_id) : file_id
offset = offset.is_a?(NamedTuple) ? Int32.new(**offset) : offset
res = client.send({
"@type" => "getFileDownloadedPrefixSize",
"file_id" => file_id,
"offset" => offset,
}, true)
Count.from_json(res.to_json)
end
# Stops the downloading of a file. If a file has already been downloaded, does nothing
#
# **Params:**
# `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
def cancel_download_file(file_id : (Int32 | NamedTuple), only_if_pending : (Bool | NamedTuple)) : Ok?
file_id = file_id.is_a?(NamedTuple) ? Int32.new(**file_id) : file_id
only_if_pending = only_if_pending.is_a?(NamedTuple) ? Bool.new(**only_if_pending) : only_if_pending
res = client.send({
"@type" => "cancelDownloadFile",
"file_id" => file_id,
"only_if_pending" => only_if_pending,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Asynchronously uploads a file to the cloud without sending it in a message. updateFile will be used to notify about upload progress and successful completion of the upload. The file will not have a persistent remote identifier until it will be sent in a message
#
# **Params:**
# `file ` - File to upload
# `file_type` - File type
# `priority ` - Priority of the upload (1-32). The higher the priority, the earlier the file will be uploaded. If the priorities of two files are equal, then the first one for which uploadFile was called will be uploaded first
def upload_file(file : (InputFile | NamedTuple), file_type : (FileType | NamedTuple), priority : (Int32 | NamedTuple)) : File
file = file.is_a?(NamedTuple) ? InputFile.new(**file) : file
file_type = file_type.is_a?(NamedTuple) ? FileType.new(**file_type) : file_type
priority = priority.is_a?(NamedTuple) ? Int32.new(**priority) : priority
res = client.send({
"@type" => "uploadFile",
"file" => file,
"file_type" => file_type,
"priority" => priority,
}, true)
File.from_json(res.to_json)
end
# Stops the uploading of a file. Supported only for files uploaded by using uploadFile. For other files the behavior is undefined
def cancel_upload_file(file_id : (Int32 | NamedTuple)) : Ok?
file_id = file_id.is_a?(NamedTuple) ? Int32.new(**file_id) : file_id
res = client.send({
"@type" => "cancelUploadFile",
"file_id" => file_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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
#
# **Params:**
# `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
def write_generated_file_part(generation_id : (String | NamedTuple), offset : (Int32 | NamedTuple), data : String) : Ok?
generation_id = generation_id.is_a?(NamedTuple) ? String.new(**generation_id) : generation_id
offset = offset.is_a?(NamedTuple) ? Int32.new(**offset) : offset
res = client.send({
"@type" => "writeGeneratedFilePart",
"generation_id" => generation_id,
"offset" => offset,
"data" => data,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Informs TDLib on a file generation progress
#
# **Params:**
# `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
def set_file_generation_progress(generation_id : (String | NamedTuple), expected_size : (Int32 | NamedTuple), local_prefix_size : (Int32 | NamedTuple)) : Ok?
generation_id = generation_id.is_a?(NamedTuple) ? String.new(**generation_id) : generation_id
expected_size = expected_size.is_a?(NamedTuple) ? Int32.new(**expected_size) : expected_size
local_prefix_size = local_prefix_size.is_a?(NamedTuple) ? Int32.new(**local_prefix_size) : local_prefix_size
res = client.send({
"@type" => "setFileGenerationProgress",
"generation_id" => generation_id,
"expected_size" => expected_size,
"local_prefix_size" => local_prefix_size,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Finishes the file generation
#
# **Params:**
# `generation_id` - The identifier of the generation process
# `error ` - If set, means that file generation has failed and should be terminated
def finish_file_generation(generation_id : (String | NamedTuple), error : (Error | NamedTuple)) : Ok?
generation_id = generation_id.is_a?(NamedTuple) ? String.new(**generation_id) : generation_id
error = error.is_a?(NamedTuple) ? Error.new(**error) : error
res = client.send({
"@type" => "finishFileGeneration",
"generation_id" => generation_id,
"error" => error,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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
#
# **Params:**
# `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
def read_file_part(file_id : (Int32 | NamedTuple), offset : (Int32 | NamedTuple), count : (Int32 | NamedTuple)) : FilePart
file_id = file_id.is_a?(NamedTuple) ? Int32.new(**file_id) : file_id
offset = offset.is_a?(NamedTuple) ? Int32.new(**offset) : offset
count = count.is_a?(NamedTuple) ? Int32.new(**count) : count
res = client.send({
"@type" => "readFilePart",
"file_id" => file_id,
"offset" => offset,
"count" => count,
}, true)
FilePart.from_json(res.to_json)
end
# Deletes a file from the TDLib file cache
def delete_file(file_id : (Int32 | NamedTuple)) : Ok?
file_id = file_id.is_a?(NamedTuple) ? Int32.new(**file_id) : file_id
res = client.send({
"@type" => "deleteFile",
"file_id" => file_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Generates a new invite link for a chat; the previously generated link is revoked. Available for basic groups, supergroups, and channels. Requires administrator privileges and can_invite_users right
def generate_chat_invite_link(chat_id : Int64) : ChatInviteLink
res = client.send({
"@type" => "generateChatInviteLink",
"chat_id" => chat_id,
}, true)
ChatInviteLink.from_json(res.to_json)
end
# Checks the validity of an invite link for a chat and returns information about the corresponding chat
def check_chat_invite_link(invite_link : String) : ChatInviteLinkInfo
res = client.send({
"@type" => "checkChatInviteLink",
"invite_link" => invite_link,
}, true)
ChatInviteLinkInfo.from_json(res.to_json)
end
# Uses an invite link to add the current user to the chat if possible. The new member will not be added until the chat state has been synchronized with the server
def join_chat_by_invite_link(invite_link : String) : Chat
res = client.send({
"@type" => "joinChatByInviteLink",
"invite_link" => invite_link,
}, true)
Chat.from_json(res.to_json)
end
# Creates a new call
#
# **Params:**
# `user_id ` - Identifier of the user to be called
# `protocol` - Description of the call protocols supported by the client
def create_call(user_id : (Int32 | NamedTuple), protocol : (CallProtocol | NamedTuple)) : CallId
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
protocol = protocol.is_a?(NamedTuple) ? CallProtocol.new(**protocol) : protocol
res = client.send({
"@type" => "createCall",
"user_id" => user_id,
"protocol" => protocol,
}, true)
CallId.from_json(res.to_json)
end
# Accepts an incoming call
#
# **Params:**
# `call_id ` - Call identifier
# `protocol` - Description of the call protocols supported by the client
def accept_call(call_id : (Int32 | NamedTuple), protocol : (CallProtocol | NamedTuple)) : Ok?
call_id = call_id.is_a?(NamedTuple) ? Int32.new(**call_id) : call_id
protocol = protocol.is_a?(NamedTuple) ? CallProtocol.new(**protocol) : protocol
res = client.send({
"@type" => "acceptCall",
"call_id" => call_id,
"protocol" => protocol,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Discards a call
#
# **Params:**
# `call_id ` - Call identifier
# `is_disconnected` - True, if the user was disconnected
# `duration ` - The call duration, in seconds
# `connection_id ` - Identifier of the connection used during the call
def discard_call(call_id : (Int32 | NamedTuple), is_disconnected : (Bool | NamedTuple), duration : (Int32 | NamedTuple), connection_id : (String | NamedTuple)) : Ok?
call_id = call_id.is_a?(NamedTuple) ? Int32.new(**call_id) : call_id
is_disconnected = is_disconnected.is_a?(NamedTuple) ? Bool.new(**is_disconnected) : is_disconnected
duration = duration.is_a?(NamedTuple) ? Int32.new(**duration) : duration
connection_id = connection_id.is_a?(NamedTuple) ? String.new(**connection_id) : connection_id
res = client.send({
"@type" => "discardCall",
"call_id" => call_id,
"is_disconnected" => is_disconnected,
"duration" => duration,
"connection_id" => connection_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Sends a call rating
#
# **Params:**
# `call_id ` - Call identifier
# `rating ` - Call rating; 1-5
# `comment ` - An optional user comment if the rating is less than 5
# `problems` - List of the exact types of problems with the call, specified by the user
def send_call_rating(call_id : (Int32 | NamedTuple), rating : (Int32 | NamedTuple), comment : String, problems : Array(CallProblem)) : Ok?
call_id = call_id.is_a?(NamedTuple) ? Int32.new(**call_id) : call_id
rating = rating.is_a?(NamedTuple) ? Int32.new(**rating) : rating
res = client.send({
"@type" => "sendCallRating",
"call_id" => call_id,
"rating" => rating,
"comment" => comment,
"problems" => problems,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Sends debug information for a call
#
# **Params:**
# `call_id ` - Call identifier
# `debug_information` - Debug information in application-specific format
def send_call_debug_information(call_id : (Int32 | NamedTuple), debug_information : String) : Ok?
call_id = call_id.is_a?(NamedTuple) ? Int32.new(**call_id) : call_id
res = client.send({
"@type" => "sendCallDebugInformation",
"call_id" => call_id,
"debug_information" => debug_information,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Adds a user to the blacklist
def block_user(user_id : (Int32 | NamedTuple)) : Ok?
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "blockUser",
"user_id" => user_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Removes a user from the blacklist
def unblock_user(user_id : (Int32 | NamedTuple)) : Ok?
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "unblockUser",
"user_id" => user_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns users that were blocked by the current user
#
# **Params:**
# `offset` - Number of users to skip in the result; must be non-negative
# `limit ` - The maximum number of users to return; up to 100
def get_blocked_users(offset : (Int32 | NamedTuple), limit : (Int32 | NamedTuple)) : Users
offset = offset.is_a?(NamedTuple) ? Int32.new(**offset) : offset
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "getBlockedUsers",
"offset" => offset,
"limit" => limit,
}, true)
Users.from_json(res.to_json)
end
# Adds a user to the contact list or edits an existing contact by their user identifier
#
# **Params:**
# `contact ` - The contact to add or edit; phone number can be empty and needs to be specified only if known, vCard is ignored
# `share_phone_number` - True, if the new contact needs to be allowed to see current user's phone number. A corresponding rule to userPrivacySettingShowPhoneNumber will be added if needed. Use the field UserFullInfo.need_phone_number_privacy_exception to check whether the current user needs to be asked to share their phone number
def add_contact(contact : (Contact | NamedTuple), share_phone_number : (Bool | NamedTuple)) : Ok?
contact = contact.is_a?(NamedTuple) ? Contact.new(**contact) : contact
share_phone_number = share_phone_number.is_a?(NamedTuple) ? Bool.new(**share_phone_number) : share_phone_number
res = client.send({
"@type" => "addContact",
"contact" => contact,
"share_phone_number" => share_phone_number,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Adds new contacts or edits existing contacts by their phone numbers; contacts' user identifiers are ignored
def import_contacts(contacts : Array(Contact)) : ImportedContacts
res = client.send({
"@type" => "importContacts",
"contacts" => contacts,
}, true)
ImportedContacts.from_json(res.to_json)
end
# Returns all user contacts
def get_contacts : Users
res = client.send({
"@type" => "getContacts",
}, true)
Users.from_json(res.to_json)
end
# Searches for the specified query in the first names, last names and usernames of the known user contacts
#
# **Params:**
# `query` - Query to search for; may be empty to return all contacts
# `limit` - The maximum number of users to be returned
def search_contacts(limit : (Int32 | NamedTuple), query : String? = nil) : Users
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "searchContacts",
"limit" => limit,
"query" => query,
}, true)
Users.from_json(res.to_json)
end
# Removes users from the contact list
def remove_contacts(user_ids : Array(Int32)) : Ok?
res = client.send({
"@type" => "removeContacts",
"user_ids" => user_ids,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns the total number of imported contacts
def get_imported_contact_count : Count
res = client.send({
"@type" => "getImportedContactCount",
}, true)
Count.from_json(res.to_json)
end
# Changes imported contacts using the list of current user contacts saved on the device. Imports newly added contacts and, if at least the file database is enabled, deletes recently deleted contacts.
# Query result depends on the result of the previous query, so only one query is possible at the same time
def change_imported_contacts(contacts : Array(Contact)) : ImportedContacts
res = client.send({
"@type" => "changeImportedContacts",
"contacts" => contacts,
}, true)
ImportedContacts.from_json(res.to_json)
end
# Clears all imported contacts, contact list remains unchanged
def clear_imported_contacts : Ok?
res = client.send({
"@type" => "clearImportedContacts",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Shares the phone number of the current user with a mutual contact. Supposed to be called when the user clicks on chatActionBarSharePhoneNumber
def share_phone_number(user_id : (Int32 | NamedTuple)) : Ok?
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "sharePhoneNumber",
"user_id" => user_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns the profile photos of a user. The result of this query may be outdated: some photos might have been deleted already
#
# **Params:**
# `user_id` - User identifier
# `offset ` - The number of photos to skip; must be non-negative
# `limit ` - The maximum number of photos to be returned; up to 100
def get_user_profile_photos(user_id : (Int32 | NamedTuple), offset : (Int32 | NamedTuple), limit : (Int32 | NamedTuple)) : UserProfilePhotos
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
offset = offset.is_a?(NamedTuple) ? Int32.new(**offset) : offset
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "getUserProfilePhotos",
"user_id" => user_id,
"offset" => offset,
"limit" => limit,
}, true)
UserProfilePhotos.from_json(res.to_json)
end
# Returns stickers from the installed sticker sets that correspond to a given emoji. If the emoji is not empty, favorite and recently used stickers may also be returned
#
# **Params:**
# `emoji` - String representation of emoji. If empty, returns all known installed stickers
# `limit` - The maximum number of stickers to be returned
def get_stickers(emoji : String, limit : (Int32 | NamedTuple)) : Stickers
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "getStickers",
"emoji" => emoji,
"limit" => limit,
}, true)
Stickers.from_json(res.to_json)
end
# Searches for stickers from public sticker sets that correspond to a given emoji
#
# **Params:**
# `emoji` - String representation of emoji; must be non-empty
# `limit` - The maximum number of stickers to be returned
def search_stickers(emoji : String, limit : (Int32 | NamedTuple)) : Stickers
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "searchStickers",
"emoji" => emoji,
"limit" => limit,
}, true)
Stickers.from_json(res.to_json)
end
# Returns a list of installed sticker sets
def get_installed_sticker_sets(is_masks : (Bool | NamedTuple)) : StickerSets
is_masks = is_masks.is_a?(NamedTuple) ? Bool.new(**is_masks) : is_masks
res = client.send({
"@type" => "getInstalledStickerSets",
"is_masks" => is_masks,
}, true)
StickerSets.from_json(res.to_json)
end
# Returns a list of archived sticker sets
#
# **Params:**
# `is_masks ` - Pass true to return mask stickers sets; pass false to return ordinary sticker sets
# `offset_sticker_set_id` - Identifier of the sticker set from which to return the result
# `limit ` - The maximum number of sticker sets to return
def get_archived_sticker_sets(is_masks : (Bool | NamedTuple), offset_sticker_set_id : (String | NamedTuple), limit : (Int32 | NamedTuple)) : StickerSets
is_masks = is_masks.is_a?(NamedTuple) ? Bool.new(**is_masks) : is_masks
offset_sticker_set_id = offset_sticker_set_id.is_a?(NamedTuple) ? String.new(**offset_sticker_set_id) : offset_sticker_set_id
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "getArchivedStickerSets",
"is_masks" => is_masks,
"offset_sticker_set_id" => offset_sticker_set_id,
"limit" => limit,
}, true)
StickerSets.from_json(res.to_json)
end
# Returns a list of trending sticker sets
def get_trending_sticker_sets : StickerSets
res = client.send({
"@type" => "getTrendingStickerSets",
}, true)
StickerSets.from_json(res.to_json)
end
# Returns a list of sticker sets attached to a file. Currently only photos and videos can have attached sticker sets
def get_attached_sticker_sets(file_id : (Int32 | NamedTuple)) : StickerSets
file_id = file_id.is_a?(NamedTuple) ? Int32.new(**file_id) : file_id
res = client.send({
"@type" => "getAttachedStickerSets",
"file_id" => file_id,
}, true)
StickerSets.from_json(res.to_json)
end
# Returns information about a sticker set by its identifier
def get_sticker_set(set_id : (String | NamedTuple)) : StickerSet
set_id = set_id.is_a?(NamedTuple) ? String.new(**set_id) : set_id
res = client.send({
"@type" => "getStickerSet",
"set_id" => set_id,
}, true)
StickerSet.from_json(res.to_json)
end
# Searches for a sticker set by its name
def search_sticker_set(name : String) : StickerSet
res = client.send({
"@type" => "searchStickerSet",
"name" => name,
}, true)
StickerSet.from_json(res.to_json)
end
# Searches for installed sticker sets by looking for specified query in their title and name
#
# **Params:**
# `is_masks` - Pass true to return mask sticker sets; pass false to return ordinary sticker sets
# `query ` - Query to search for
# `limit ` - The maximum number of sticker sets to return
def search_installed_sticker_sets(is_masks : (Bool | NamedTuple), query : String, limit : (Int32 | NamedTuple)) : StickerSets
is_masks = is_masks.is_a?(NamedTuple) ? Bool.new(**is_masks) : is_masks
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "searchInstalledStickerSets",
"is_masks" => is_masks,
"query" => query,
"limit" => limit,
}, true)
StickerSets.from_json(res.to_json)
end
# Searches for ordinary sticker sets by looking for specified query in their title and name. Excludes installed sticker sets from the results
def search_sticker_sets(query : String) : StickerSets
res = client.send({
"@type" => "searchStickerSets",
"query" => query,
}, true)
StickerSets.from_json(res.to_json)
end
# Installs/uninstalls or activates/archives a sticker set
#
# **Params:**
# `set_id ` - Identifier of the sticker set
# `is_installed` - The new value of is_installed
# `is_archived ` - The new value of is_archived. A sticker set can't be installed and archived simultaneously
def change_sticker_set(set_id : (String | NamedTuple), is_installed : (Bool | NamedTuple), is_archived : (Bool | NamedTuple)) : Ok?
set_id = set_id.is_a?(NamedTuple) ? String.new(**set_id) : set_id
is_installed = is_installed.is_a?(NamedTuple) ? Bool.new(**is_installed) : is_installed
is_archived = is_archived.is_a?(NamedTuple) ? Bool.new(**is_archived) : is_archived
res = client.send({
"@type" => "changeStickerSet",
"set_id" => set_id,
"is_installed" => is_installed,
"is_archived" => is_archived,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Informs the server that some trending sticker sets have been viewed by the user
def view_trending_sticker_sets(sticker_set_ids : Array(String)) : Ok?
res = client.send({
"@type" => "viewTrendingStickerSets",
"sticker_set_ids" => sticker_set_ids,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the order of installed sticker sets
#
# **Params:**
# `is_masks ` - Pass true to change the order of mask sticker sets; pass false to change the order of ordinary sticker sets
# `sticker_set_ids` - Identifiers of installed sticker sets in the new correct order
def reorder_installed_sticker_sets(is_masks : (Bool | NamedTuple), sticker_set_ids : Array(String)) : Ok?
is_masks = is_masks.is_a?(NamedTuple) ? Bool.new(**is_masks) : is_masks
res = client.send({
"@type" => "reorderInstalledStickerSets",
"is_masks" => is_masks,
"sticker_set_ids" => sticker_set_ids,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns a list of recently used stickers
def get_recent_stickers(is_attached : (Bool | NamedTuple)) : Stickers
is_attached = is_attached.is_a?(NamedTuple) ? Bool.new(**is_attached) : is_attached
res = client.send({
"@type" => "getRecentStickers",
"is_attached" => is_attached,
}, true)
Stickers.from_json(res.to_json)
end
# Manually adds a new sticker to the list of recently used stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list
#
# **Params:**
# `is_attached` - Pass true to add the sticker to the list of stickers recently attached to photo or video files; pass false to add the sticker to the list of recently sent stickers
# `sticker ` - Sticker file to add
def add_recent_sticker(is_attached : (Bool | NamedTuple), sticker : (InputFile | NamedTuple)) : Stickers
is_attached = is_attached.is_a?(NamedTuple) ? Bool.new(**is_attached) : is_attached
sticker = sticker.is_a?(NamedTuple) ? InputFile.new(**sticker) : sticker
res = client.send({
"@type" => "addRecentSticker",
"is_attached" => is_attached,
"sticker" => sticker,
}, true)
Stickers.from_json(res.to_json)
end
# Removes a sticker from the list of recently used stickers
#
# **Params:**
# `is_attached` - Pass true to remove the sticker from the list of stickers recently attached to photo or video files; pass false to remove the sticker from the list of recently sent stickers
# `sticker ` - Sticker file to delete
def remove_recent_sticker(is_attached : (Bool | NamedTuple), sticker : (InputFile | NamedTuple)) : Ok?
is_attached = is_attached.is_a?(NamedTuple) ? Bool.new(**is_attached) : is_attached
sticker = sticker.is_a?(NamedTuple) ? InputFile.new(**sticker) : sticker
res = client.send({
"@type" => "removeRecentSticker",
"is_attached" => is_attached,
"sticker" => sticker,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Clears the list of recently used stickers
def clear_recent_stickers(is_attached : (Bool | NamedTuple)) : Ok?
is_attached = is_attached.is_a?(NamedTuple) ? Bool.new(**is_attached) : is_attached
res = client.send({
"@type" => "clearRecentStickers",
"is_attached" => is_attached,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns favorite stickers
def get_favorite_stickers : Stickers
res = client.send({
"@type" => "getFavoriteStickers",
}, true)
Stickers.from_json(res.to_json)
end
# Adds a new sticker to the list of favorite stickers. The new sticker is added to the top of the list. If the sticker was already in the list, it is removed from the list first. Only stickers belonging to a sticker set can be added to this list
def add_favorite_sticker(sticker : (InputFile | NamedTuple)) : Ok?
sticker = sticker.is_a?(NamedTuple) ? InputFile.new(**sticker) : sticker
res = client.send({
"@type" => "addFavoriteSticker",
"sticker" => sticker,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Removes a sticker from the list of favorite stickers
def remove_favorite_sticker(sticker : (InputFile | NamedTuple)) : Ok?
sticker = sticker.is_a?(NamedTuple) ? InputFile.new(**sticker) : sticker
res = client.send({
"@type" => "removeFavoriteSticker",
"sticker" => sticker,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns emoji corresponding to a sticker. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object
def get_sticker_emojis(sticker : (InputFile | NamedTuple)) : Emojis
sticker = sticker.is_a?(NamedTuple) ? InputFile.new(**sticker) : sticker
res = client.send({
"@type" => "getStickerEmojis",
"sticker" => sticker,
}, true)
Emojis.from_json(res.to_json)
end
# Searches for emojis by keywords. Supported only if the file database is enabled
#
# **Params:**
# `text ` - Text to search for
# `exact_match ` - True, if only emojis, which exactly match text needs to be returned
# `input_language_code` - IETF language tag of the user's input language; may be empty if unknown
def search_emojis(text : String, exact_match : (Bool | NamedTuple), input_language_code : String? = nil) : Emojis
exact_match = exact_match.is_a?(NamedTuple) ? Bool.new(**exact_match) : exact_match
res = client.send({
"@type" => "searchEmojis",
"text" => text,
"exact_match" => exact_match,
"input_language_code" => input_language_code,
}, true)
Emojis.from_json(res.to_json)
end
# Returns an HTTP URL which can be used to automatically log in to the translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation
def get_emoji_suggestions_url(language_code : String) : HttpUrl
res = client.send({
"@type" => "getEmojiSuggestionsUrl",
"language_code" => language_code,
}, true)
HttpUrl.from_json(res.to_json)
end
# Returns saved animations
def get_saved_animations : Animations
res = client.send({
"@type" => "getSavedAnimations",
}, true)
Animations.from_json(res.to_json)
end
# Manually adds a new animation to the list of saved animations. The new animation is added to the beginning of the list. If the animation was already in the list, it is removed first. Only non-secret video animations with MIME type "video/mp4" can be added to the list
def add_saved_animation(animation : (InputFile | NamedTuple)) : Ok?
animation = animation.is_a?(NamedTuple) ? InputFile.new(**animation) : animation
res = client.send({
"@type" => "addSavedAnimation",
"animation" => animation,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Removes an animation from the list of saved animations
def remove_saved_animation(animation : (InputFile | NamedTuple)) : Ok?
animation = animation.is_a?(NamedTuple) ? InputFile.new(**animation) : animation
res = client.send({
"@type" => "removeSavedAnimation",
"animation" => animation,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns up to 20 recently used inline bots in the order of their last usage
def get_recent_inline_bots : Users
res = client.send({
"@type" => "getRecentInlineBots",
}, true)
Users.from_json(res.to_json)
end
# Searches for recently used hashtags by their prefix
#
# **Params:**
# `prefix` - Hashtag prefix to search for
# `limit ` - The maximum number of hashtags to be returned
def search_hashtags(prefix : String, limit : (Int32 | NamedTuple)) : Hashtags
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "searchHashtags",
"prefix" => prefix,
"limit" => limit,
}, true)
Hashtags.from_json(res.to_json)
end
# Removes a hashtag from the list of recently used hashtags
def remove_recent_hashtag(hashtag : String) : Ok?
res = client.send({
"@type" => "removeRecentHashtag",
"hashtag" => hashtag,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns a web page preview by the text of the message. Do not call this function too often. Returns a 404 error if the web page has no preview
def get_web_page_preview(text : (FormattedText | NamedTuple)) : WebPage
text = text.is_a?(NamedTuple) ? FormattedText.new(**text) : text
res = client.send({
"@type" => "getWebPagePreview",
"text" => text,
}, true)
WebPage.from_json(res.to_json)
end
# Returns an instant view version of a web page if available. Returns a 404 error if the web page has no instant view page
#
# **Params:**
# `url ` - The web page URL
# `force_full` - If true, the full instant view for the web page will be returned
def get_web_page_instant_view(url : String, force_full : (Bool | NamedTuple)) : WebPageInstantView
force_full = force_full.is_a?(NamedTuple) ? Bool.new(**force_full) : force_full
res = client.send({
"@type" => "getWebPageInstantView",
"url" => url,
"force_full" => force_full,
}, true)
WebPageInstantView.from_json(res.to_json)
end
# Uploads a new profile photo for the current user. If something changes, updateUser will be sent
def set_profile_photo(photo : (InputFile | NamedTuple)) : Ok?
photo = photo.is_a?(NamedTuple) ? InputFile.new(**photo) : photo
res = client.send({
"@type" => "setProfilePhoto",
"photo" => photo,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Deletes a profile photo. If something changes, updateUser will be sent
def delete_profile_photo(profile_photo_id : (String | NamedTuple)) : Ok?
profile_photo_id = profile_photo_id.is_a?(NamedTuple) ? String.new(**profile_photo_id) : profile_photo_id
res = client.send({
"@type" => "deleteProfilePhoto",
"profile_photo_id" => profile_photo_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the first and last name of the current user. If something changes, updateUser will be sent
#
# **Params:**
# `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
def set_name(first_name : String, last_name : String) : Ok?
res = client.send({
"@type" => "setName",
"first_name" => first_name,
"last_name" => last_name,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the bio of the current user
def set_bio(bio : String) : Ok?
res = client.send({
"@type" => "setBio",
"bio" => bio,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the username of the current user. If something changes, updateUser will be sent
def set_username(username : String) : Ok?
res = client.send({
"@type" => "setUsername",
"username" => username,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the phone number of the user and sends an authentication code to the user's new phone number. On success, returns information about the sent code
#
# **Params:**
# `phone_number` - The new phone number of the user in international format
# `settings ` - Settings for the authentication of the user's phone number
def change_phone_number(phone_number : String, settings : (PhoneNumberAuthenticationSettings | NamedTuple)) : AuthenticationCodeInfo
settings = settings.is_a?(NamedTuple) ? PhoneNumberAuthenticationSettings.new(**settings) : settings
res = client.send({
"@type" => "changePhoneNumber",
"phone_number" => phone_number,
"settings" => settings,
}, true)
AuthenticationCodeInfo.from_json(res.to_json)
end
# Re-sends the authentication code sent to confirm a new phone number for the user. Works only if the previously received authenticationCodeInfo next_code_type was not null
def resend_change_phone_number_code : AuthenticationCodeInfo
res = client.send({
"@type" => "resendChangePhoneNumberCode",
}, true)
AuthenticationCodeInfo.from_json(res.to_json)
end
# Checks the authentication code sent to confirm a new phone number of the user
def check_change_phone_number_code(code : String) : Ok?
res = client.send({
"@type" => "checkChangePhoneNumberCode",
"code" => code,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns all active sessions of the current user
def get_active_sessions : Sessions
res = client.send({
"@type" => "getActiveSessions",
}, true)
Sessions.from_json(res.to_json)
end
# Terminates a session of the current user
def terminate_session(session_id : (String | NamedTuple)) : Ok?
session_id = session_id.is_a?(NamedTuple) ? String.new(**session_id) : session_id
res = client.send({
"@type" => "terminateSession",
"session_id" => session_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Terminates all other sessions of the current user
def terminate_all_other_sessions : Ok?
res = client.send({
"@type" => "terminateAllOtherSessions",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns all website where the current user used Telegram to log in
def get_connected_websites : ConnectedWebsites
res = client.send({
"@type" => "getConnectedWebsites",
}, true)
ConnectedWebsites.from_json(res.to_json)
end
# Disconnects website from the current user's Telegram account
def disconnect_website(website_id : (String | NamedTuple)) : Ok?
website_id = website_id.is_a?(NamedTuple) ? String.new(**website_id) : website_id
res = client.send({
"@type" => "disconnectWebsite",
"website_id" => website_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Disconnects all websites from the current user's Telegram account
def disconnect_all_websites : Ok?
res = client.send({
"@type" => "disconnectAllWebsites",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the username of a supergroup or channel, requires owner privileges in the supergroup or channel
#
# **Params:**
# `supergroup_id` - Identifier of the supergroup or channel
# `username ` - New value of the username. Use an empty string to remove the username
def set_supergroup_username(supergroup_id : (Int32 | NamedTuple), username : String) : Ok?
supergroup_id = supergroup_id.is_a?(NamedTuple) ? Int32.new(**supergroup_id) : supergroup_id
res = client.send({
"@type" => "setSupergroupUsername",
"supergroup_id" => supergroup_id,
"username" => username,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the sticker set of a supergroup; requires can_change_info rights
#
# **Params:**
# `supergroup_id ` - Identifier of the supergroup
# `sticker_set_id` - New value of the supergroup sticker set identifier. Use 0 to remove the supergroup sticker set
def set_supergroup_sticker_set(supergroup_id : (Int32 | NamedTuple), sticker_set_id : (String | NamedTuple)) : Ok?
supergroup_id = supergroup_id.is_a?(NamedTuple) ? Int32.new(**supergroup_id) : supergroup_id
sticker_set_id = sticker_set_id.is_a?(NamedTuple) ? String.new(**sticker_set_id) : sticker_set_id
res = client.send({
"@type" => "setSupergroupStickerSet",
"supergroup_id" => supergroup_id,
"sticker_set_id" => sticker_set_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Toggles sender signatures messages sent in a channel; requires can_change_info rights
#
# **Params:**
# `supergroup_id` - Identifier of the channel
# `sign_messages` - New value of sign_messages
def toggle_supergroup_sign_messages(supergroup_id : (Int32 | NamedTuple), sign_messages : (Bool | NamedTuple)) : Ok?
supergroup_id = supergroup_id.is_a?(NamedTuple) ? Int32.new(**supergroup_id) : supergroup_id
sign_messages = sign_messages.is_a?(NamedTuple) ? Bool.new(**sign_messages) : sign_messages
res = client.send({
"@type" => "toggleSupergroupSignMessages",
"supergroup_id" => supergroup_id,
"sign_messages" => sign_messages,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Toggles whether the message history of a supergroup is available to new members; requires can_change_info rights
#
# **Params:**
# `supergroup_id ` - The identifier of the supergroup
# `is_all_history_available` - The new value of is_all_history_available
def toggle_supergroup_is_all_history_available(supergroup_id : (Int32 | NamedTuple), is_all_history_available : (Bool | NamedTuple)) : Ok?
supergroup_id = supergroup_id.is_a?(NamedTuple) ? Int32.new(**supergroup_id) : supergroup_id
is_all_history_available = is_all_history_available.is_a?(NamedTuple) ? Bool.new(**is_all_history_available) : is_all_history_available
res = client.send({
"@type" => "toggleSupergroupIsAllHistoryAvailable",
"supergroup_id" => supergroup_id,
"is_all_history_available" => is_all_history_available,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup
#
# **Params:**
# `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
def report_supergroup_spam(supergroup_id : (Int32 | NamedTuple), user_id : (Int32 | NamedTuple), message_ids : Array(Int64)) : Ok?
supergroup_id = supergroup_id.is_a?(NamedTuple) ? Int32.new(**supergroup_id) : supergroup_id
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "reportSupergroupSpam",
"supergroup_id" => supergroup_id,
"user_id" => user_id,
"message_ids" => message_ids,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns information about members or banned users in a supergroup or channel. Can be used only if SupergroupFullInfo.can_get_members == true; additionally, administrator privileges may be required for some filters
#
# **Params:**
# `supergroup_id` - Identifier of the supergroup or channel
# `filter ` - The type of users to return. By default, supergroupMembersRecent
# `offset ` - Number of users to skip
# `limit ` - The maximum number of users be returned; up to 200
def get_supergroup_members(supergroup_id : (Int32 | NamedTuple), filter : (SupergroupMembersFilter | NamedTuple), offset : (Int32 | NamedTuple), limit : (Int32 | NamedTuple)) : ChatMembers
supergroup_id = supergroup_id.is_a?(NamedTuple) ? Int32.new(**supergroup_id) : supergroup_id
filter = filter.is_a?(NamedTuple) ? SupergroupMembersFilter.new(**filter) : filter
offset = offset.is_a?(NamedTuple) ? Int32.new(**offset) : offset
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
res = client.send({
"@type" => "getSupergroupMembers",
"supergroup_id" => supergroup_id,
"filter" => filter,
"offset" => offset,
"limit" => limit,
}, true)
ChatMembers.from_json(res.to_json)
end
# Deletes a supergroup or channel along with all messages in the corresponding chat. This will release the supergroup or channel username and remove all members; requires owner privileges in the supergroup or channel. Chats with more than 1000 members can't be deleted using this method
def delete_supergroup(supergroup_id : (Int32 | NamedTuple)) : Ok?
supergroup_id = supergroup_id.is_a?(NamedTuple) ? Int32.new(**supergroup_id) : supergroup_id
res = client.send({
"@type" => "deleteSupergroup",
"supergroup_id" => supergroup_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Closes a secret chat, effectively transferring its state to secretChatStateClosed
def close_secret_chat(secret_chat_id : (Int32 | NamedTuple)) : Ok?
secret_chat_id = secret_chat_id.is_a?(NamedTuple) ? Int32.new(**secret_chat_id) : secret_chat_id
res = client.send({
"@type" => "closeSecretChat",
"secret_chat_id" => secret_chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns a list of service actions taken by chat members and administrators in the last 48 hours. Available only for supergroups and channels. Requires administrator rights. Returns results in reverse chronological order (i. e., in order of decreasing event_id)
#
# **Params:**
# `chat_id ` - Chat identifier
# `query ` - Search query by which to filter events
# `from_event_id` - Identifier of an event from which to return results. Use 0 to get results from the latest events
# `limit ` - The maximum number of events to return; up to 100
# `filters ` - The types of events to return. By default, all types will be returned
# `user_ids ` - User identifiers by which to filter events. By default, events relating to all users will be returned
def get_chat_event_log(chat_id : Int64, query : String, from_event_id : (String | NamedTuple), limit : (Int32 | NamedTuple), filters : (ChatEventLogFilters | NamedTuple), user_ids : Array(Int32)) : ChatEvents
from_event_id = from_event_id.is_a?(NamedTuple) ? String.new(**from_event_id) : from_event_id
limit = limit.is_a?(NamedTuple) ? Int32.new(**limit) : limit
filters = filters.is_a?(NamedTuple) ? ChatEventLogFilters.new(**filters) : filters
res = client.send({
"@type" => "getChatEventLog",
"chat_id" => chat_id,
"query" => query,
"from_event_id" => from_event_id,
"limit" => limit,
"filters" => filters,
"user_ids" => user_ids,
}, true)
ChatEvents.from_json(res.to_json)
end
# Returns an invoice payment form. This method should be called when the user presses inlineKeyboardButtonBuy
#
# **Params:**
# `chat_id ` - Chat identifier of the Invoice message
# `message_id` - Message identifier
def get_payment_form(chat_id : Int64, message_id : Int64) : PaymentForm
res = client.send({
"@type" => "getPaymentForm",
"chat_id" => chat_id,
"message_id" => message_id,
}, true)
PaymentForm.from_json(res.to_json)
end
# Validates the order information provided by a user and returns the available shipping options for a flexible invoice
#
# **Params:**
# `chat_id ` - Chat identifier of the Invoice message
# `message_id` - Message identifier
# `order_info` - The order information, provided by the user
# `allow_save` - True, if the order information can be saved
def validate_order_info(chat_id : Int64, message_id : Int64, order_info : (OrderInfo | NamedTuple), allow_save : (Bool | NamedTuple)) : ValidatedOrderInfo
order_info = order_info.is_a?(NamedTuple) ? OrderInfo.new(**order_info) : order_info
allow_save = allow_save.is_a?(NamedTuple) ? Bool.new(**allow_save) : allow_save
res = client.send({
"@type" => "validateOrderInfo",
"chat_id" => chat_id,
"message_id" => message_id,
"order_info" => order_info,
"allow_save" => allow_save,
}, true)
ValidatedOrderInfo.from_json(res.to_json)
end
# Sends a filled-out payment form to the bot for final verification
#
# **Params:**
# `chat_id ` - Chat identifier of the Invoice message
# `message_id ` - Message identifier
# `order_info_id ` - Identifier returned by ValidateOrderInfo, or an empty string
# `shipping_option_id` - Identifier of a chosen shipping option, if applicable
# `credentials ` - The credentials chosen by user for payment
def send_payment_form(chat_id : Int64, message_id : Int64, order_info_id : String, shipping_option_id : String, credentials : (InputCredentials | NamedTuple)) : PaymentResult
credentials = credentials.is_a?(NamedTuple) ? InputCredentials.new(**credentials) : credentials
res = client.send({
"@type" => "sendPaymentForm",
"chat_id" => chat_id,
"message_id" => message_id,
"order_info_id" => order_info_id,
"shipping_option_id" => shipping_option_id,
"credentials" => credentials,
}, true)
PaymentResult.from_json(res.to_json)
end
# Returns information about a successful payment
#
# **Params:**
# `chat_id ` - Chat identifier of the PaymentSuccessful message
# `message_id` - Message identifier
def get_payment_receipt(chat_id : Int64, message_id : Int64) : PaymentReceipt
res = client.send({
"@type" => "getPaymentReceipt",
"chat_id" => chat_id,
"message_id" => message_id,
}, true)
PaymentReceipt.from_json(res.to_json)
end
# Returns saved order info, if any
def get_saved_order_info : OrderInfo
res = client.send({
"@type" => "getSavedOrderInfo",
}, true)
OrderInfo.from_json(res.to_json)
end
# Deletes saved order info
def delete_saved_order_info : Ok?
res = client.send({
"@type" => "deleteSavedOrderInfo",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Deletes saved credentials for all payment provider bots
def delete_saved_credentials : Ok?
res = client.send({
"@type" => "deleteSavedCredentials",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns a user that can be contacted to get support
def get_support_user : User
res = client.send({
"@type" => "getSupportUser",
}, true)
User.from_json(res.to_json)
end
# Returns backgrounds installed by the user
def get_backgrounds(for_dark_theme : (Bool | NamedTuple)) : Backgrounds
for_dark_theme = for_dark_theme.is_a?(NamedTuple) ? Bool.new(**for_dark_theme) : for_dark_theme
res = client.send({
"@type" => "getBackgrounds",
"for_dark_theme" => for_dark_theme,
}, true)
Backgrounds.from_json(res.to_json)
end
# Constructs a persistent HTTP URL for a background
#
# **Params:**
# `name` - Background name
# `type` - Background type
def get_background_url(name : String, type : (BackgroundType | NamedTuple)) : HttpUrl
type = type.is_a?(NamedTuple) ? BackgroundType.new(**type) : type
res = client.send({
"@type" => "getBackgroundUrl",
"name" => name,
"type" => type,
}, true)
HttpUrl.from_json(res.to_json)
end
# Searches for a background by its name
def search_background(name : String) : Background
res = client.send({
"@type" => "searchBackground",
"name" => name,
}, true)
Background.from_json(res.to_json)
end
# Changes the background selected by the user; adds background to the list of installed backgrounds
#
# **Params:**
# `background ` - The input background to use, null for filled backgrounds
# `type ` - Background type; null for default background. The method will return error 404 if type is null
# `for_dark_theme` - True, if the background is chosen for dark theme
def set_background(background : (InputBackground | NamedTuple), type : (BackgroundType | NamedTuple), for_dark_theme : (Bool | NamedTuple)) : Background
background = background.is_a?(NamedTuple) ? InputBackground.new(**background) : background
type = type.is_a?(NamedTuple) ? BackgroundType.new(**type) : type
for_dark_theme = for_dark_theme.is_a?(NamedTuple) ? Bool.new(**for_dark_theme) : for_dark_theme
res = client.send({
"@type" => "setBackground",
"background" => background,
"type" => type,
"for_dark_theme" => for_dark_theme,
}, true)
Background.from_json(res.to_json)
end
# Removes background from the list of installed backgrounds
def remove_background(background_id : (String | NamedTuple)) : Ok?
background_id = background_id.is_a?(NamedTuple) ? String.new(**background_id) : background_id
res = client.send({
"@type" => "removeBackground",
"background_id" => background_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Resets list of installed backgrounds to its default value
def reset_backgrounds : Ok?
res = client.send({
"@type" => "resetBackgrounds",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns information about the current localization target. This is an offline request if only_local is true. Can be called before authorization
def get_localization_target_info(only_local : (Bool | NamedTuple)) : LocalizationTargetInfo
only_local = only_local.is_a?(NamedTuple) ? Bool.new(**only_local) : only_local
res = client.send({
"@type" => "getLocalizationTargetInfo",
"only_local" => only_local,
}, true)
LocalizationTargetInfo.from_json(res.to_json)
end
# Returns information about a language pack. Returned language pack identifier may be different from a provided one. Can be called before authorization
def get_language_pack_info(language_pack_id : String) : LanguagePackInfo
res = client.send({
"@type" => "getLanguagePackInfo",
"language_pack_id" => language_pack_id,
}, true)
LanguagePackInfo.from_json(res.to_json)
end
# Returns strings from a language pack in the current localization target by their keys. Can be called before authorization
#
# **Params:**
# `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
def get_language_pack_strings(language_pack_id : String, keys : Array(String)) : LanguagePackStrings
res = client.send({
"@type" => "getLanguagePackStrings",
"language_pack_id" => language_pack_id,
"keys" => keys,
}, true)
LanguagePackStrings.from_json(res.to_json)
end
# 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
def synchronize_language_pack(language_pack_id : String) : Ok?
res = client.send({
"@type" => "synchronizeLanguagePack",
"language_pack_id" => language_pack_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Adds a custom server language pack to the list of installed language packs in current localization target. Can be called before authorization
def add_custom_server_language_pack(language_pack_id : String) : Ok?
res = client.send({
"@type" => "addCustomServerLanguagePack",
"language_pack_id" => language_pack_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Adds or changes a custom local language pack to the current localization target
#
# **Params:**
# `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
def set_custom_language_pack(info : (LanguagePackInfo | NamedTuple), strings : Array(LanguagePackString)) : Ok?
info = info.is_a?(NamedTuple) ? LanguagePackInfo.new(**info) : info
res = client.send({
"@type" => "setCustomLanguagePack",
"info" => info,
"strings" => strings,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Edits information about a custom local language pack in the current localization target. Can be called before authorization
def edit_custom_language_pack_info(info : (LanguagePackInfo | NamedTuple)) : Ok?
info = info.is_a?(NamedTuple) ? LanguagePackInfo.new(**info) : info
res = client.send({
"@type" => "editCustomLanguagePackInfo",
"info" => info,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Adds, edits or deletes a string in a custom local language pack. Can be called before authorization
#
# **Params:**
# `language_pack_id` - Identifier of a previously added custom local language pack in the current localization target
# `new_string ` - New language pack string
def set_custom_language_pack_string(language_pack_id : String, new_string : (LanguagePackString | NamedTuple)) : Ok?
new_string = new_string.is_a?(NamedTuple) ? LanguagePackString.new(**new_string) : new_string
res = client.send({
"@type" => "setCustomLanguagePackString",
"language_pack_id" => language_pack_id,
"new_string" => new_string,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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
def delete_language_pack(language_pack_id : String) : Ok?
res = client.send({
"@type" => "deleteLanguagePack",
"language_pack_id" => language_pack_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Registers the currently used device for receiving push notifications. Returns a globally unique identifier of the push notification subscription
#
# **Params:**
# `device_token ` - Device token
# `other_user_ids` - List of user identifiers of other users currently using the client
def register_device(device_token : (DeviceToken | NamedTuple), other_user_ids : Array(Int32)) : PushReceiverId
device_token = device_token.is_a?(NamedTuple) ? DeviceToken.new(**device_token) : device_token
res = client.send({
"@type" => "registerDevice",
"device_token" => device_token,
"other_user_ids" => other_user_ids,
}, true)
PushReceiverId.from_json(res.to_json)
end
# 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
def process_push_notification(payload : String) : Ok?
res = client.send({
"@type" => "processPushNotification",
"payload" => payload,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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
def get_push_receiver_id(payload : String) : PushReceiverId
res = client.send({
"@type" => "getPushReceiverId",
"payload" => payload,
}, true)
PushReceiverId.from_json(res.to_json)
end
# Returns t.me URLs recently visited by a newly registered user
def get_recently_visited_t_me_urls(referrer : String) : TMeUrls
res = client.send({
"@type" => "getRecentlyVisitedTMeUrls",
"referrer" => referrer,
}, true)
TMeUrls.from_json(res.to_json)
end
# Changes user privacy settings
#
# **Params:**
# `setting` - The privacy setting
# `rules ` - The new privacy rules
def set_user_privacy_setting_rules(setting : (UserPrivacySetting | NamedTuple), rules : (UserPrivacySettingRules | NamedTuple)) : Ok?
setting = setting.is_a?(NamedTuple) ? UserPrivacySetting.new(**setting) : setting
rules = rules.is_a?(NamedTuple) ? UserPrivacySettingRules.new(**rules) : rules
res = client.send({
"@type" => "setUserPrivacySettingRules",
"setting" => setting,
"rules" => rules,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns the current privacy settings
def get_user_privacy_setting_rules(setting : (UserPrivacySetting | NamedTuple)) : UserPrivacySettingRules
setting = setting.is_a?(NamedTuple) ? UserPrivacySetting.new(**setting) : setting
res = client.send({
"@type" => "getUserPrivacySettingRules",
"setting" => setting,
}, true)
UserPrivacySettingRules.from_json(res.to_json)
end
# Returns the value of an option by its name. (Check the list of available options on https://core.telegram.org/tdlib/options.) Can be called before authorization
def get_option(name : String) : OptionValue
res = client.send({
"@type" => "getOption",
"name" => name,
}, true)
OptionValue.from_json(res.to_json)
end
# Sets the value of an option. (Check the list of available options on https://core.telegram.org/tdlib/options.) Only writable options can be set. Can be called before authorization
#
# **Params:**
# `name ` - The name of the option
# `value` - The new value of the option
def set_option(name : String, value : (OptionValue | NamedTuple)) : Ok?
value = value.is_a?(NamedTuple) ? OptionValue.new(**value) : value
res = client.send({
"@type" => "setOption",
"name" => name,
"value" => value,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Changes the period of inactivity after which the account of the current user will automatically be deleted
def set_account_ttl(ttl : (AccountTtl | NamedTuple)) : Ok?
ttl = ttl.is_a?(NamedTuple) ? AccountTtl.new(**ttl) : ttl
res = client.send({
"@type" => "setAccountTtl",
"ttl" => ttl,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns the period of inactivity after which the account of the current user will automatically be deleted
def get_account_ttl : AccountTtl
res = client.send({
"@type" => "getAccountTtl",
}, true)
AccountTtl.from_json(res.to_json)
end
# Deletes the account of the current user, deleting all information associated with the user from the server. The phone number of the account can be used to create a new account. Can be called before authorization when the current authorization state is authorizationStateWaitPassword
def delete_account(reason : String) : Ok?
res = client.send({
"@type" => "deleteAccount",
"reason" => reason,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Removes a chat action bar without any other action
def remove_chat_action_bar(chat_id : Int64) : Ok?
res = client.send({
"@type" => "removeChatActionBar",
"chat_id" => chat_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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, or when the report is done from the chat action bar
#
# **Params:**
# `chat_id ` - Chat identifier
# `reason ` - The reason for reporting the chat
# `message_ids` - Identifiers of reported messages, if any
def report_chat(chat_id : Int64, reason : (ChatReportReason | NamedTuple), message_ids : Array(Int64)) : Ok?
reason = reason.is_a?(NamedTuple) ? ChatReportReason.new(**reason) : reason
res = client.send({
"@type" => "reportChat",
"chat_id" => chat_id,
"reason" => reason,
"message_ids" => message_ids,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns an HTTP URL with the chat statistics. Currently this method can be used only for channels. Can be used only if SupergroupFullInfo.can_view_statistics == true
#
# **Params:**
# `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
def get_chat_statistics_url(chat_id : Int64, parameters : String, is_dark : (Bool | NamedTuple)) : HttpUrl
is_dark = is_dark.is_a?(NamedTuple) ? Bool.new(**is_dark) : is_dark
res = client.send({
"@type" => "getChatStatisticsUrl",
"chat_id" => chat_id,
"parameters" => parameters,
"is_dark" => is_dark,
}, true)
HttpUrl.from_json(res.to_json)
end
# Returns storage usage statistics. Can be called before authorization
def get_storage_statistics(chat_limit : (Int32 | NamedTuple)) : StorageStatistics
chat_limit = chat_limit.is_a?(NamedTuple) ? Int32.new(**chat_limit) : chat_limit
res = client.send({
"@type" => "getStorageStatistics",
"chat_limit" => chat_limit,
}, true)
StorageStatistics.from_json(res.to_json)
end
# Quickly returns approximate storage usage statistics. Can be called before authorization
def get_storage_statistics_fast : StorageStatisticsFast
res = client.send({
"@type" => "getStorageStatisticsFast",
}, true)
StorageStatisticsFast.from_json(res.to_json)
end
# Returns database statistics
def get_database_statistics : DatabaseStatistics
res = client.send({
"@type" => "getDatabaseStatistics",
}, true)
DatabaseStatistics.from_json(res.to_json)
end
# Optimizes storage usage, i.e. deletes some files and returns new storage usage statistics. Secret thumbnails can't be deleted
#
# **Params:**
# `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
# `count ` - Limit on the total count of files after deletion. Pass -1 to use the default limit
# `immunity_delay ` - The amount of time after the creation of a file during which it can't be deleted, in seconds. Pass -1 to use the default value
# `file_types ` - If not empty, only files with the given type(s) are considered. By default, all types except thumbnails, profile photos, stickers and wallpapers are deleted
# `chat_ids ` - If not empty, only files from the given chats are considered. Use 0 as chat identifier to delete files not belonging to any chat (e.g., profile photos)
# `exclude_chat_ids` - If not empty, files from the given chats are excluded. Use 0 as chat identifier to exclude all files not belonging to any chat (e.g., profile photos)
# `chat_limit ` - Same as in getStorageStatistics. Affects only returned statistics
def optimize_storage(size : Int64, ttl : (Int32 | NamedTuple), count : (Int32 | NamedTuple), immunity_delay : (Int32 | NamedTuple), file_types : Array(FileType), chat_ids : Array(Int64), exclude_chat_ids : Array(Int64), chat_limit : (Int32 | NamedTuple)) : StorageStatistics
ttl = ttl.is_a?(NamedTuple) ? Int32.new(**ttl) : ttl
count = count.is_a?(NamedTuple) ? Int32.new(**count) : count
immunity_delay = immunity_delay.is_a?(NamedTuple) ? Int32.new(**immunity_delay) : immunity_delay
chat_limit = chat_limit.is_a?(NamedTuple) ? Int32.new(**chat_limit) : chat_limit
res = client.send({
"@type" => "optimizeStorage",
"size" => size,
"ttl" => ttl,
"count" => count,
"immunity_delay" => immunity_delay,
"file_types" => file_types,
"chat_ids" => chat_ids,
"exclude_chat_ids" => exclude_chat_ids,
"chat_limit" => chat_limit,
}, true)
StorageStatistics.from_json(res.to_json)
end
# Sets the current network type. Can be called before authorization. Calling this method forces all network connections to reopen, mitigating the delay in switching between different networks, so it should be called whenever the network is changed, even if the network type remains the same.
# Network type is used to check whether the library can use the network at all and also for collecting detailed network data usage statistics
def set_network_type(type : (NetworkType | NamedTuple)) : Ok?
type = type.is_a?(NamedTuple) ? NetworkType.new(**type) : type
res = client.send({
"@type" => "setNetworkType",
"type" => type,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns network data usage statistics. Can be called before authorization
def get_network_statistics(only_current : (Bool | NamedTuple)) : NetworkStatistics
only_current = only_current.is_a?(NamedTuple) ? Bool.new(**only_current) : only_current
res = client.send({
"@type" => "getNetworkStatistics",
"only_current" => only_current,
}, true)
NetworkStatistics.from_json(res.to_json)
end
# Adds the specified data to data usage statistics. Can be called before authorization
def add_network_statistics(entry : (NetworkStatisticsEntry | NamedTuple)) : Ok?
entry = entry.is_a?(NamedTuple) ? NetworkStatisticsEntry.new(**entry) : entry
res = client.send({
"@type" => "addNetworkStatistics",
"entry" => entry,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Resets all network data usage statistics to zero. Can be called before authorization
def reset_network_statistics : Ok?
res = client.send({
"@type" => "resetNetworkStatistics",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns auto-download settings presets for the currently logged in user
def get_auto_download_settings_presets : AutoDownloadSettingsPresets
res = client.send({
"@type" => "getAutoDownloadSettingsPresets",
}, true)
AutoDownloadSettingsPresets.from_json(res.to_json)
end
# Sets auto-download settings
#
# **Params:**
# `settings` - New user auto-download settings
# `type ` - Type of the network for which the new settings are applied
def set_auto_download_settings(settings : (AutoDownloadSettings | NamedTuple), type : (NetworkType | NamedTuple)) : Ok?
settings = settings.is_a?(NamedTuple) ? AutoDownloadSettings.new(**settings) : settings
type = type.is_a?(NamedTuple) ? NetworkType.new(**type) : type
res = client.send({
"@type" => "setAutoDownloadSettings",
"settings" => settings,
"type" => type,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns one of the available Telegram Passport elements
#
# **Params:**
# `type ` - Telegram Passport element type
# `password` - Password of the current user
def get_passport_element(type : (PassportElementType | NamedTuple), password : String) : PassportElement
type = type.is_a?(NamedTuple) ? PassportElementType.new(**type) : type
res = client.send({
"@type" => "getPassportElement",
"type" => type,
"password" => password,
}, true)
PassportElement.from_json(res.to_json)
end
# Returns all available Telegram Passport elements
def get_all_passport_elements(password : String) : PassportElements
res = client.send({
"@type" => "getAllPassportElements",
"password" => password,
}, true)
PassportElements.from_json(res.to_json)
end
# Adds an element to the user's Telegram Passport. May return an error with a message "PHONE_VERIFICATION_NEEDED" or "EMAIL_VERIFICATION_NEEDED" if the chosen phone number or the chosen email address must be verified first
#
# **Params:**
# `element ` - Input Telegram Passport element
# `password` - Password of the current user
def set_passport_element(element : (InputPassportElement | NamedTuple), password : String) : PassportElement
element = element.is_a?(NamedTuple) ? InputPassportElement.new(**element) : element
res = client.send({
"@type" => "setPassportElement",
"element" => element,
"password" => password,
}, true)
PassportElement.from_json(res.to_json)
end
# Deletes a Telegram Passport element
def delete_passport_element(type : (PassportElementType | NamedTuple)) : Ok?
type = type.is_a?(NamedTuple) ? PassportElementType.new(**type) : type
res = client.send({
"@type" => "deletePassportElement",
"type" => type,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Informs the user that some of the elements in their Telegram Passport contain errors; for bots only. The user will not be able to resend the elements, until the errors are fixed
#
# **Params:**
# `user_id` - User identifier
# `errors ` - The errors
def set_passport_element_errors(user_id : (Int32 | NamedTuple), errors : Array(InputPassportElementError)) : Ok?
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
res = client.send({
"@type" => "setPassportElementErrors",
"user_id" => user_id,
"errors" => errors,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns an IETF language tag of the language preferred in the country, which should be used to fill native fields in Telegram Passport personal details. Returns a 404 error if unknown
def get_preferred_country_language(country_code : String) : Text
res = client.send({
"@type" => "getPreferredCountryLanguage",
"country_code" => country_code,
}, true)
Text.from_json(res.to_json)
end
# Sends a code to verify a phone number to be added to a user's Telegram Passport
#
# **Params:**
# `phone_number` - The phone number of the user, in international format
# `settings ` - Settings for the authentication of the user's phone number
def send_phone_number_verification_code(phone_number : String, settings : (PhoneNumberAuthenticationSettings | NamedTuple)) : AuthenticationCodeInfo
settings = settings.is_a?(NamedTuple) ? PhoneNumberAuthenticationSettings.new(**settings) : settings
res = client.send({
"@type" => "sendPhoneNumberVerificationCode",
"phone_number" => phone_number,
"settings" => settings,
}, true)
AuthenticationCodeInfo.from_json(res.to_json)
end
# Re-sends the code to verify a phone number to be added to a user's Telegram Passport
def resend_phone_number_verification_code : AuthenticationCodeInfo
res = client.send({
"@type" => "resendPhoneNumberVerificationCode",
}, true)
AuthenticationCodeInfo.from_json(res.to_json)
end
# Checks the phone number verification code for Telegram Passport
def check_phone_number_verification_code(code : String) : Ok?
res = client.send({
"@type" => "checkPhoneNumberVerificationCode",
"code" => code,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Sends a code to verify an email address to be added to a user's Telegram Passport
def send_email_address_verification_code(email_address : String) : EmailAddressAuthenticationCodeInfo
res = client.send({
"@type" => "sendEmailAddressVerificationCode",
"email_address" => email_address,
}, true)
EmailAddressAuthenticationCodeInfo.from_json(res.to_json)
end
# Re-sends the code to verify an email address to be added to a user's Telegram Passport
def resend_email_address_verification_code : EmailAddressAuthenticationCodeInfo
res = client.send({
"@type" => "resendEmailAddressVerificationCode",
}, true)
EmailAddressAuthenticationCodeInfo.from_json(res.to_json)
end
# Checks the email address verification code for Telegram Passport
def check_email_address_verification_code(code : String) : Ok?
res = client.send({
"@type" => "checkEmailAddressVerificationCode",
"code" => code,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns a Telegram Passport authorization form for sharing data with a service
#
# **Params:**
# `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
def get_passport_authorization_form(bot_user_id : (Int32 | NamedTuple), scope : String, public_key : String, nonce : String) : PassportAuthorizationForm
bot_user_id = bot_user_id.is_a?(NamedTuple) ? Int32.new(**bot_user_id) : bot_user_id
res = client.send({
"@type" => "getPassportAuthorizationForm",
"bot_user_id" => bot_user_id,
"scope" => scope,
"public_key" => public_key,
"nonce" => nonce,
}, true)
PassportAuthorizationForm.from_json(res.to_json)
end
# Returns already available Telegram Passport elements suitable for completing a Telegram Passport authorization form. Result can be received only once for each authorization form
#
# **Params:**
# `autorization_form_id` - Authorization form identifier
# `password ` - Password of the current user
def get_passport_authorization_form_available_elements(autorization_form_id : (Int32 | NamedTuple), password : String) : PassportElementsWithErrors
autorization_form_id = autorization_form_id.is_a?(NamedTuple) ? Int32.new(**autorization_form_id) : autorization_form_id
res = client.send({
"@type" => "getPassportAuthorizationFormAvailableElements",
"autorization_form_id" => autorization_form_id,
"password" => password,
}, true)
PassportElementsWithErrors.from_json(res.to_json)
end
# 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
#
# **Params:**
# `autorization_form_id` - Authorization form identifier
# `types ` - Types of Telegram Passport elements chosen by user to complete the authorization form
def send_passport_authorization_form(autorization_form_id : (Int32 | NamedTuple), types : Array(PassportElementType)) : Ok?
autorization_form_id = autorization_form_id.is_a?(NamedTuple) ? Int32.new(**autorization_form_id) : autorization_form_id
res = client.send({
"@type" => "sendPassportAuthorizationForm",
"autorization_form_id" => autorization_form_id,
"types" => types,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Sends phone number confirmation code. Should be called when user presses "https://t.me/confirmphone?phone=*******&hash=**********" or "tg://confirmphone?phone=*******&hash=**********" link
#
# **Params:**
# `hash ` - Value of the "hash" parameter from the link
# `phone_number` - Value of the "phone" parameter from the link
# `settings ` - Settings for the authentication of the user's phone number
def send_phone_number_confirmation_code(hash : String, phone_number : String, settings : (PhoneNumberAuthenticationSettings | NamedTuple)) : AuthenticationCodeInfo
settings = settings.is_a?(NamedTuple) ? PhoneNumberAuthenticationSettings.new(**settings) : settings
res = client.send({
"@type" => "sendPhoneNumberConfirmationCode",
"hash" => hash,
"phone_number" => phone_number,
"settings" => settings,
}, true)
AuthenticationCodeInfo.from_json(res.to_json)
end
# Resends phone number confirmation code
def resend_phone_number_confirmation_code : AuthenticationCodeInfo
res = client.send({
"@type" => "resendPhoneNumberConfirmationCode",
}, true)
AuthenticationCodeInfo.from_json(res.to_json)
end
# Checks phone number confirmation code
def check_phone_number_confirmation_code(code : String) : Ok?
res = client.send({
"@type" => "checkPhoneNumberConfirmationCode",
"code" => code,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only
#
# **Params:**
# `pending_update_count` - The number of pending updates
# `error_message ` - The last error message
def set_bot_updates_status(pending_update_count : (Int32 | NamedTuple), error_message : String) : Ok?
pending_update_count = pending_update_count.is_a?(NamedTuple) ? Int32.new(**pending_update_count) : pending_update_count
res = client.send({
"@type" => "setBotUpdatesStatus",
"pending_update_count" => pending_update_count,
"error_message" => error_message,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Uploads a PNG image with a sticker; for bots only; returns the uploaded file
#
# **Params:**
# `user_id ` - Sticker file owner
# `png_sticker` - PNG image with the sticker; must be up to 512 kB in size and fit in 512x512 square
def upload_sticker_file(user_id : (Int32 | NamedTuple), png_sticker : (InputFile | NamedTuple)) : File
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
png_sticker = png_sticker.is_a?(NamedTuple) ? InputFile.new(**png_sticker) : png_sticker
res = client.send({
"@type" => "uploadStickerFile",
"user_id" => user_id,
"png_sticker" => png_sticker,
}, true)
File.from_json(res.to_json)
end
# Creates a new sticker set; for bots only. Returns the newly created sticker set
#
# **Params:**
# `user_id ` - Sticker set owner
# `title ` - Sticker set title; 1-64 characters
# `name ` - Sticker set name. Can contain only English letters, digits and underscores. Must end with *"_by_<bot username>"* (*<bot_username>* is case insensitive); 1-64 characters
# `is_masks` - True, if stickers are masks
# `stickers` - List of stickers to be added to the set
def create_new_sticker_set(user_id : (Int32 | NamedTuple), title : String, name : String, is_masks : (Bool | NamedTuple), stickers : Array(InputSticker)) : StickerSet
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
is_masks = is_masks.is_a?(NamedTuple) ? Bool.new(**is_masks) : is_masks
res = client.send({
"@type" => "createNewStickerSet",
"user_id" => user_id,
"title" => title,
"name" => name,
"is_masks" => is_masks,
"stickers" => stickers,
}, true)
StickerSet.from_json(res.to_json)
end
# Adds a new sticker to a set; for bots only. Returns the sticker set
#
# **Params:**
# `user_id` - Sticker set owner
# `name ` - Sticker set name
# `sticker` - Sticker to add to the set
def add_sticker_to_set(user_id : (Int32 | NamedTuple), name : String, sticker : (InputSticker | NamedTuple)) : StickerSet
user_id = user_id.is_a?(NamedTuple) ? Int32.new(**user_id) : user_id
sticker = sticker.is_a?(NamedTuple) ? InputSticker.new(**sticker) : sticker
res = client.send({
"@type" => "addStickerToSet",
"user_id" => user_id,
"name" => name,
"sticker" => sticker,
}, true)
StickerSet.from_json(res.to_json)
end
# Changes the position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot
#
# **Params:**
# `sticker ` - Sticker
# `position` - New position of the sticker in the set, zero-based
def set_sticker_position_in_set(sticker : (InputFile | NamedTuple), position : (Int32 | NamedTuple)) : Ok?
sticker = sticker.is_a?(NamedTuple) ? InputFile.new(**sticker) : sticker
position = position.is_a?(NamedTuple) ? Int32.new(**position) : position
res = client.send({
"@type" => "setStickerPositionInSet",
"sticker" => sticker,
"position" => position,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Removes a sticker from the set to which it belongs; for bots only. The sticker set must have been created by the bot
def remove_sticker_from_set(sticker : (InputFile | NamedTuple)) : Ok?
sticker = sticker.is_a?(NamedTuple) ? InputFile.new(**sticker) : sticker
res = client.send({
"@type" => "removeStickerFromSet",
"sticker" => sticker,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns information about a file with a map thumbnail in PNG format. Only map thumbnail files with size less than 1MB can be downloaded
#
# **Params:**
# `location` - Location of the map center
# `zoom ` - Map zoom level; 13-20
# `width ` - Map width in pixels before applying scale; 16-1024
# `height ` - Map height in pixels before applying scale; 16-1024
# `scale ` - Map scale; 1-3
# `chat_id ` - Identifier of a chat, in which the thumbnail will be shown. Use 0 if unknown
def get_map_thumbnail_file(location : (Location | NamedTuple), zoom : (Int32 | NamedTuple), width : (Int32 | NamedTuple), height : (Int32 | NamedTuple), scale : (Int32 | NamedTuple), chat_id : Int64) : File
location = location.is_a?(NamedTuple) ? Location.new(**location) : location
zoom = zoom.is_a?(NamedTuple) ? Int32.new(**zoom) : zoom
width = width.is_a?(NamedTuple) ? Int32.new(**width) : width
height = height.is_a?(NamedTuple) ? Int32.new(**height) : height
scale = scale.is_a?(NamedTuple) ? Int32.new(**scale) : scale
res = client.send({
"@type" => "getMapThumbnailFile",
"location" => location,
"zoom" => zoom,
"width" => width,
"height" => height,
"scale" => scale,
"chat_id" => chat_id,
}, true)
File.from_json(res.to_json)
end
# Accepts Telegram terms of services
def accept_terms_of_service(terms_of_service_id : String) : Ok?
res = client.send({
"@type" => "acceptTermsOfService",
"terms_of_service_id" => terms_of_service_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Sends a custom request; for bots only
#
# **Params:**
# `method ` - The method name
# `parameters` - JSON-serialized method parameters
def send_custom_request(method : String, parameters : String) : CustomRequestResult
res = client.send({
"@type" => "sendCustomRequest",
"method" => method,
"parameters" => parameters,
}, true)
CustomRequestResult.from_json(res.to_json)
end
# Answers a custom query; for bots only
#
# **Params:**
# `custom_query_id` - Identifier of a custom query
# `data ` - JSON-serialized answer to the query
def answer_custom_query(custom_query_id : (String | NamedTuple), data : String) : Ok?
custom_query_id = custom_query_id.is_a?(NamedTuple) ? String.new(**custom_query_id) : custom_query_id
res = client.send({
"@type" => "answerCustomQuery",
"custom_query_id" => custom_query_id,
"data" => data,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Succeeds after a specified amount of time has passed. Can be called before authorization. Can be called before initialization
def set_alarm(seconds : Float64) : Ok?
res = client.send({
"@type" => "setAlarm",
"seconds" => seconds,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Uses current user IP to found their country. Returns two-letter ISO 3166-1 alpha-2 country code. Can be called before authorization
def get_country_code : Text
res = client.send({
"@type" => "getCountryCode",
}, true)
Text.from_json(res.to_json)
end
# Returns the default text for invitation messages to be used as a placeholder when the current user invites friends to Telegram
def get_invite_text : Text
res = client.send({
"@type" => "getInviteText",
}, true)
Text.from_json(res.to_json)
end
# Returns information about a tg:// deep link. Use "tg://need_update_for_some_feature" or "tg:some_unsupported_feature" for testing. Returns a 404 error for unknown links. Can be called before authorization
def get_deep_link_info(link : String) : DeepLinkInfo
res = client.send({
"@type" => "getDeepLinkInfo",
"link" => link,
}, true)
DeepLinkInfo.from_json(res.to_json)
end
# Returns application config, provided by the server. Can be called before authorization
def get_application_config : JsonValue
res = client.send({
"@type" => "getApplicationConfig",
}, true)
JsonValue.from_json(res.to_json)
end
# Saves application log event on the server. Can be called before authorization
#
# **Params:**
# `type ` - Event type
# `chat_id` - Optional chat identifier, associated with the event
# `data ` - The log event data
def save_application_log_event(type : String, chat_id : Int64, data : (JsonValue | NamedTuple)) : Ok?
data = data.is_a?(NamedTuple) ? JsonValue.new(**data) : data
res = client.send({
"@type" => "saveApplicationLogEvent",
"type" => type,
"chat_id" => chat_id,
"data" => data,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Adds a proxy server for network requests. Can be called before authorization
#
# **Params:**
# `server` - Proxy server IP address
# `port ` - Proxy server port
# `enable` - True, if the proxy should be enabled
# `type ` - Proxy type
def add_proxy(server : String, port : (Int32 | NamedTuple), enable : (Bool | NamedTuple), type : (ProxyType | NamedTuple)) : Proxy
port = port.is_a?(NamedTuple) ? Int32.new(**port) : port
enable = enable.is_a?(NamedTuple) ? Bool.new(**enable) : enable
type = type.is_a?(NamedTuple) ? ProxyType.new(**type) : type
res = client.send({
"@type" => "addProxy",
"server" => server,
"port" => port,
"enable" => enable,
"type" => type,
}, true)
Proxy.from_json(res.to_json)
end
# Edits an existing proxy server for network requests. Can be called before authorization
#
# **Params:**
# `proxy_id` - Proxy identifier
# `server ` - Proxy server IP address
# `port ` - Proxy server port
# `enable ` - True, if the proxy should be enabled
# `type ` - Proxy type
def edit_proxy(proxy_id : (Int32 | NamedTuple), server : String, port : (Int32 | NamedTuple), enable : (Bool | NamedTuple), type : (ProxyType | NamedTuple)) : Proxy
proxy_id = proxy_id.is_a?(NamedTuple) ? Int32.new(**proxy_id) : proxy_id
port = port.is_a?(NamedTuple) ? Int32.new(**port) : port
enable = enable.is_a?(NamedTuple) ? Bool.new(**enable) : enable
type = type.is_a?(NamedTuple) ? ProxyType.new(**type) : type
res = client.send({
"@type" => "editProxy",
"proxy_id" => proxy_id,
"server" => server,
"port" => port,
"enable" => enable,
"type" => type,
}, true)
Proxy.from_json(res.to_json)
end
# Enables a proxy. Only one proxy can be enabled at a time. Can be called before authorization
def enable_proxy(proxy_id : (Int32 | NamedTuple)) : Ok?
proxy_id = proxy_id.is_a?(NamedTuple) ? Int32.new(**proxy_id) : proxy_id
res = client.send({
"@type" => "enableProxy",
"proxy_id" => proxy_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Disables the currently enabled proxy. Can be called before authorization
def disable_proxy : Ok?
res = client.send({
"@type" => "disableProxy",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Removes a proxy server. Can be called before authorization
def remove_proxy(proxy_id : (Int32 | NamedTuple)) : Ok?
proxy_id = proxy_id.is_a?(NamedTuple) ? Int32.new(**proxy_id) : proxy_id
res = client.send({
"@type" => "removeProxy",
"proxy_id" => proxy_id,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns list of proxies that are currently set up. Can be called before authorization
def get_proxies : Proxies
res = client.send({
"@type" => "getProxies",
}, true)
Proxies.from_json(res.to_json)
end
# Returns an HTTPS link, which can be used to add a proxy. Available only for SOCKS5 and MTProto proxies. Can be called before authorization
def get_proxy_link(proxy_id : (Int32 | NamedTuple)) : Text
proxy_id = proxy_id.is_a?(NamedTuple) ? Int32.new(**proxy_id) : proxy_id
res = client.send({
"@type" => "getProxyLink",
"proxy_id" => proxy_id,
}, true)
Text.from_json(res.to_json)
end
# Computes time needed to receive a response from a Telegram server through a proxy. Can be called before authorization
def ping_proxy(proxy_id : (Int32 | NamedTuple)) : Seconds
proxy_id = proxy_id.is_a?(NamedTuple) ? Int32.new(**proxy_id) : proxy_id
res = client.send({
"@type" => "pingProxy",
"proxy_id" => proxy_id,
}, true)
Seconds.from_json(res.to_json)
end
# Sets new log stream for internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously
def set_log_stream(log_stream : (LogStream | NamedTuple)) : Ok?
log_stream = log_stream.is_a?(NamedTuple) ? LogStream.new(**log_stream) : log_stream
res = client.send({
"@type" => "setLogStream",
"log_stream" => log_stream,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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
def get_log_stream : LogStream
res = client.send({
"@type" => "getLogStream",
}, true)
LogStream.from_json(res.to_json)
end
# Sets the verbosity level of the internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously
def set_log_verbosity_level(new_verbosity_level : (Int32 | NamedTuple)) : Ok?
new_verbosity_level = new_verbosity_level.is_a?(NamedTuple) ? Int32.new(**new_verbosity_level) : new_verbosity_level
res = client.send({
"@type" => "setLogVerbosityLevel",
"new_verbosity_level" => new_verbosity_level,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns current verbosity level of the internal logging of TDLib. This is an offline method. Can be called before authorization. Can be called synchronously
def get_log_verbosity_level : LogVerbosityLevel
res = client.send({
"@type" => "getLogVerbosityLevel",
}, true)
LogVerbosityLevel.from_json(res.to_json)
end
# 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
def get_log_tags : LogTags
res = client.send({
"@type" => "getLogTags",
}, true)
LogTags.from_json(res.to_json)
end
# 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
#
# **Params:**
# `tag ` - Logging tag to change verbosity level
# `new_verbosity_level` - New verbosity level; 1-1024
def set_log_tag_verbosity_level(tag : String, new_verbosity_level : (Int32 | NamedTuple)) : Ok?
new_verbosity_level = new_verbosity_level.is_a?(NamedTuple) ? Int32.new(**new_verbosity_level) : new_verbosity_level
res = client.send({
"@type" => "setLogTagVerbosityLevel",
"tag" => tag,
"new_verbosity_level" => new_verbosity_level,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# 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
def get_log_tag_verbosity_level(tag : String) : LogVerbosityLevel
res = client.send({
"@type" => "getLogTagVerbosityLevel",
"tag" => tag,
}, true)
LogVerbosityLevel.from_json(res.to_json)
end
# Adds a message to TDLib internal log. This is an offline method. Can be called before authorization. Can be called synchronously
#
# **Params:**
# `verbosity_level` - The minimum verbosity level needed for the message to be logged, 0-1023
# `text ` - Text of a message to log
def add_log_message(verbosity_level : (Int32 | NamedTuple), text : String) : Ok?
verbosity_level = verbosity_level.is_a?(NamedTuple) ? Int32.new(**verbosity_level) : verbosity_level
res = client.send({
"@type" => "addLogMessage",
"verbosity_level" => verbosity_level,
"text" => text,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Does nothing; for testing only. This is an offline method. Can be called before authorization
def test_call_empty : Ok?
res = client.send({
"@type" => "testCallEmpty",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Returns the received string; for testing only. This is an offline method. Can be called before authorization
def test_call_string(x : String) : TestString
res = client.send({
"@type" => "testCallString",
"x" => x,
}, true)
TestString.from_json(res.to_json)
end
# Returns the received bytes; for testing only. This is an offline method. Can be called before authorization
def test_call_bytes(x : String) : TestBytes
res = client.send({
"@type" => "testCallBytes",
"x" => x,
}, true)
TestBytes.from_json(res.to_json)
end
# Returns the received vector of numbers; for testing only. This is an offline method. Can be called before authorization
def test_call_vector_int(x : Array(Int32)) : TestVectorInt
res = client.send({
"@type" => "testCallVectorInt",
"x" => x,
}, true)
TestVectorInt.from_json(res.to_json)
end
# Returns the received vector of objects containing a number; for testing only. This is an offline method. Can be called before authorization
def test_call_vector_int_object(x : Array(TestInt)) : TestVectorIntObject
res = client.send({
"@type" => "testCallVectorIntObject",
"x" => x,
}, true)
TestVectorIntObject.from_json(res.to_json)
end
# Returns the received vector of strings; for testing only. This is an offline method. Can be called before authorization
def test_call_vector_string(x : Array(String)) : TestVectorString
res = client.send({
"@type" => "testCallVectorString",
"x" => x,
}, true)
TestVectorString.from_json(res.to_json)
end
# Returns the received vector of objects containing a string; for testing only. This is an offline method. Can be called before authorization
def test_call_vector_string_object(x : Array(TestString)) : TestVectorStringObject
res = client.send({
"@type" => "testCallVectorStringObject",
"x" => x,
}, true)
TestVectorStringObject.from_json(res.to_json)
end
# Returns the squared received number; for testing only. This is an offline method. Can be called before authorization
def test_square_int(x : (Int32 | NamedTuple)) : TestInt
x = x.is_a?(NamedTuple) ? Int32.new(**x) : x
res = client.send({
"@type" => "testSquareInt",
"x" => x,
}, true)
TestInt.from_json(res.to_json)
end
# Sends a simple network request to the Telegram servers; for testing only. Can be called before authorization
def test_network : Ok?
res = client.send({
"@type" => "testNetwork",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Sends a simple network request to the Telegram servers via proxy; for testing only. Can be called before authorization
#
# **Params:**
# `server ` - Proxy server IP address
# `port ` - Proxy server port
# `type ` - Proxy type
# `dc_id ` - Identifier of a datacenter, with which to test connection
# `timeout` - The maximum overall timeout for the request
def test_proxy(server : String, port : (Int32 | NamedTuple), type : (ProxyType | NamedTuple), dc_id : (Int32 | NamedTuple), timeout : Float64) : Ok?
port = port.is_a?(NamedTuple) ? Int32.new(**port) : port
type = type.is_a?(NamedTuple) ? ProxyType.new(**type) : type
dc_id = dc_id.is_a?(NamedTuple) ? Int32.new(**dc_id) : dc_id
res = client.send({
"@type" => "testProxy",
"server" => server,
"port" => port,
"type" => type,
"dc_id" => dc_id,
"timeout" => timeout,
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Forces an updates.getDifference call to the Telegram servers; for testing only
def test_get_difference : Ok?
res = client.send({
"@type" => "testGetDifference",
}, true)
res.nil? ? nil : Ok.from_json(res.to_json)
end
# Does nothing and ensures that the Update object is used; for testing only. This is an offline method. Can be called before authorization
def test_use_update : Update
res = client.send({
"@type" => "testUseUpdate",
}, true)
Update.from_json(res.to_json)
end
# Returns the specified error and ensures that the Error object is used; for testing only. This is an offline method. Can be called before authorization. Can be called synchronously
def test_return_error(error : (Error | NamedTuple)) : Error
error = error.is_a?(NamedTuple) ? Error.new(**error) : error
res = client.send({
"@type" => "testReturnError",
"error" => error,
}, true)
Error.from_json(res.to_json)
end
end
end
# Copyright 2020 - Chris Watson <cawatson1993@gmail.com>
#
# You should have received with this program a copy of the MIT license. This code is
# subject to the terms and conditions outlined in said license. For more information,
# please see https://en.wikipedia.org/wiki/MIT_License.
#
# This file was auto generated. Please do not modify directly.
module Proton
module TL
abstract class TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"error" => Error,
"ok" => Ok,
"tdlibParameters" => TdlibParameters,
"authenticationCodeTypeTelegramMessage" => AuthenticationCodeTypeTelegramMessage,
"authenticationCodeTypeSms" => AuthenticationCodeTypeSms,
"authenticationCodeTypeCall" => AuthenticationCodeTypeCall,
"authenticationCodeTypeFlashCall" => AuthenticationCodeTypeFlashCall,
"authenticationCodeInfo" => AuthenticationCodeInfo,
"emailAddressAuthenticationCodeInfo" => EmailAddressAuthenticationCodeInfo,
"textEntity" => TextEntity,
"textEntities" => TextEntities,
"formattedText" => FormattedText,
"termsOfService" => TermsOfService,
"authorizationStateWaitTdlibParameters" => AuthorizationStateWaitTdlibParameters,
"authorizationStateWaitEncryptionKey" => AuthorizationStateWaitEncryptionKey,
"authorizationStateWaitPhoneNumber" => AuthorizationStateWaitPhoneNumber,
"authorizationStateWaitCode" => AuthorizationStateWaitCode,
"authorizationStateWaitOtherDeviceConfirmation" => AuthorizationStateWaitOtherDeviceConfirmation,
"authorizationStateWaitRegistration" => AuthorizationStateWaitRegistration,
"authorizationStateWaitPassword" => AuthorizationStateWaitPassword,
"authorizationStateReady" => AuthorizationStateReady,
"authorizationStateLoggingOut" => AuthorizationStateLoggingOut,
"authorizationStateClosing" => AuthorizationStateClosing,
"authorizationStateClosed" => AuthorizationStateClosed,
"passwordState" => PasswordState,
"recoveryEmailAddress" => RecoveryEmailAddress,
"temporaryPasswordState" => TemporaryPasswordState,
"localFile" => LocalFile,
"remoteFile" => RemoteFile,
"file" => File,
"inputFileId" => InputFileId,
"inputFileRemote" => InputFileRemote,
"inputFileLocal" => InputFileLocal,
"inputFileGenerated" => InputFileGenerated,
"photoSize" => PhotoSize,
"minithumbnail" => Minithumbnail,
"maskPointForehead" => MaskPointForehead,
"maskPointEyes" => MaskPointEyes,
"maskPointMouth" => MaskPointMouth,
"maskPointChin" => MaskPointChin,
"maskPosition" => MaskPosition,
"pollOption" => PollOption,
"pollTypeRegular" => PollTypeRegular,
"pollTypeQuiz" => PollTypeQuiz,
"animation" => Animation,
"audio" => Audio,
"document" => Document,
"photo" => Photo,
"sticker" => Sticker,
"video" => Video,
"videoNote" => VideoNote,
"voiceNote" => VoiceNote,
"contact" => Contact,
"location" => Location,
"venue" => Venue,
"game" => Game,
"poll" => Poll,
"profilePhoto" => ProfilePhoto,
"chatPhoto" => ChatPhoto,
"userTypeRegular" => UserTypeRegular,
"userTypeDeleted" => UserTypeDeleted,
"userTypeBot" => UserTypeBot,
"userTypeUnknown" => UserTypeUnknown,
"botCommand" => BotCommand,
"botInfo" => BotInfo,
"chatLocation" => ChatLocation,
"user" => User,
"userFullInfo" => UserFullInfo,
"userProfilePhoto" => UserProfilePhoto,
"userProfilePhotos" => UserProfilePhotos,
"users" => Users,
"chatAdministrator" => ChatAdministrator,
"chatAdministrators" => ChatAdministrators,
"chatPermissions" => ChatPermissions,
"chatMemberStatusCreator" => ChatMemberStatusCreator,
"chatMemberStatusAdministrator" => ChatMemberStatusAdministrator,
"chatMemberStatusMember" => ChatMemberStatusMember,
"chatMemberStatusRestricted" => ChatMemberStatusRestricted,
"chatMemberStatusLeft" => ChatMemberStatusLeft,
"chatMemberStatusBanned" => ChatMemberStatusBanned,
"chatMember" => ChatMember,
"chatMembers" => ChatMembers,
"chatMembersFilterContacts" => ChatMembersFilterContacts,
"chatMembersFilterAdministrators" => ChatMembersFilterAdministrators,
"chatMembersFilterMembers" => ChatMembersFilterMembers,
"chatMembersFilterRestricted" => ChatMembersFilterRestricted,
"chatMembersFilterBanned" => ChatMembersFilterBanned,
"chatMembersFilterBots" => ChatMembersFilterBots,
"supergroupMembersFilterRecent" => SupergroupMembersFilterRecent,
"supergroupMembersFilterContacts" => SupergroupMembersFilterContacts,
"supergroupMembersFilterAdministrators" => SupergroupMembersFilterAdministrators,
"supergroupMembersFilterSearch" => SupergroupMembersFilterSearch,
"supergroupMembersFilterRestricted" => SupergroupMembersFilterRestricted,
"supergroupMembersFilterBanned" => SupergroupMembersFilterBanned,
"supergroupMembersFilterBots" => SupergroupMembersFilterBots,
"basicGroup" => BasicGroup,
"basicGroupFullInfo" => BasicGroupFullInfo,
"supergroup" => Supergroup,
"supergroupFullInfo" => SupergroupFullInfo,
"secretChatStatePending" => SecretChatStatePending,
"secretChatStateReady" => SecretChatStateReady,
"secretChatStateClosed" => SecretChatStateClosed,
"secretChat" => SecretChat,
"messageForwardOriginUser" => MessageForwardOriginUser,
"messageForwardOriginHiddenUser" => MessageForwardOriginHiddenUser,
"messageForwardOriginChannel" => MessageForwardOriginChannel,
"messageForwardInfo" => MessageForwardInfo,
"messageSendingStatePending" => MessageSendingStatePending,
"messageSendingStateFailed" => MessageSendingStateFailed,
"message" => Message,
"messages" => Messages,
"foundMessages" => FoundMessages,
"notificationSettingsScopePrivateChats" => NotificationSettingsScopePrivateChats,
"notificationSettingsScopeGroupChats" => NotificationSettingsScopeGroupChats,
"notificationSettingsScopeChannelChats" => NotificationSettingsScopeChannelChats,
"chatNotificationSettings" => ChatNotificationSettings,
"scopeNotificationSettings" => ScopeNotificationSettings,
"draftMessage" => DraftMessage,
"chatTypePrivate" => ChatTypePrivate,
"chatTypeBasicGroup" => ChatTypeBasicGroup,
"chatTypeSupergroup" => ChatTypeSupergroup,
"chatTypeSecret" => ChatTypeSecret,
"chatListMain" => ChatListMain,
"chatListArchive" => ChatListArchive,
"chat" => Chat,
"chats" => Chats,
"chatNearby" => ChatNearby,
"chatsNearby" => ChatsNearby,
"chatInviteLink" => ChatInviteLink,
"chatInviteLinkInfo" => ChatInviteLinkInfo,
"publicChatTypeHasUsername" => PublicChatTypeHasUsername,
"publicChatTypeIsLocationBased" => PublicChatTypeIsLocationBased,
"chatActionBarReportSpam" => ChatActionBarReportSpam,
"chatActionBarReportUnrelatedLocation" => ChatActionBarReportUnrelatedLocation,
"chatActionBarReportAddBlock" => ChatActionBarReportAddBlock,
"chatActionBarAddContact" => ChatActionBarAddContact,
"chatActionBarSharePhoneNumber" => ChatActionBarSharePhoneNumber,
"keyboardButtonTypeText" => KeyboardButtonTypeText,
"keyboardButtonTypeRequestPhoneNumber" => KeyboardButtonTypeRequestPhoneNumber,
"keyboardButtonTypeRequestLocation" => KeyboardButtonTypeRequestLocation,
"keyboardButtonTypeRequestPoll" => KeyboardButtonTypeRequestPoll,
"keyboardButton" => KeyboardButton,
"inlineKeyboardButtonTypeUrl" => InlineKeyboardButtonTypeUrl,
"inlineKeyboardButtonTypeLoginUrl" => InlineKeyboardButtonTypeLoginUrl,
"inlineKeyboardButtonTypeCallback" => InlineKeyboardButtonTypeCallback,
"inlineKeyboardButtonTypeCallbackGame" => InlineKeyboardButtonTypeCallbackGame,
"inlineKeyboardButtonTypeSwitchInline" => InlineKeyboardButtonTypeSwitchInline,
"inlineKeyboardButtonTypeBuy" => InlineKeyboardButtonTypeBuy,
"inlineKeyboardButton" => InlineKeyboardButton,
"replyMarkupRemoveKeyboard" => ReplyMarkupRemoveKeyboard,
"replyMarkupForceReply" => ReplyMarkupForceReply,
"replyMarkupShowKeyboard" => ReplyMarkupShowKeyboard,
"replyMarkupInlineKeyboard" => ReplyMarkupInlineKeyboard,
"loginUrlInfoOpen" => LoginUrlInfoOpen,
"loginUrlInfoRequestConfirmation" => LoginUrlInfoRequestConfirmation,
"richTextPlain" => RichTextPlain,
"richTextBold" => RichTextBold,
"richTextItalic" => RichTextItalic,
"richTextUnderline" => RichTextUnderline,
"richTextStrikethrough" => RichTextStrikethrough,
"richTextFixed" => RichTextFixed,
"richTextUrl" => RichTextUrl,
"richTextEmailAddress" => RichTextEmailAddress,
"richTextSubscript" => RichTextSubscript,
"richTextSuperscript" => RichTextSuperscript,
"richTextMarked" => RichTextMarked,
"richTextPhoneNumber" => RichTextPhoneNumber,
"richTextIcon" => RichTextIcon,
"richTextAnchor" => RichTextAnchor,
"richTexts" => RichTexts,
"pageBlockCaption" => PageBlockCaption,
"pageBlockListItem" => PageBlockListItem,
"pageBlockHorizontalAlignmentLeft" => PageBlockHorizontalAlignmentLeft,
"pageBlockHorizontalAlignmentCenter" => PageBlockHorizontalAlignmentCenter,
"pageBlockHorizontalAlignmentRight" => PageBlockHorizontalAlignmentRight,
"pageBlockVerticalAlignmentTop" => PageBlockVerticalAlignmentTop,
"pageBlockVerticalAlignmentMiddle" => PageBlockVerticalAlignmentMiddle,
"pageBlockVerticalAlignmentBottom" => PageBlockVerticalAlignmentBottom,
"pageBlockTableCell" => PageBlockTableCell,
"pageBlockRelatedArticle" => PageBlockRelatedArticle,
"pageBlockTitle" => PageBlockTitle,
"pageBlockSubtitle" => PageBlockSubtitle,
"pageBlockAuthorDate" => PageBlockAuthorDate,
"pageBlockHeader" => PageBlockHeader,
"pageBlockSubheader" => PageBlockSubheader,
"pageBlockKicker" => PageBlockKicker,
"pageBlockParagraph" => PageBlockParagraph,
"pageBlockPreformatted" => PageBlockPreformatted,
"pageBlockFooter" => PageBlockFooter,
"pageBlockDivider" => PageBlockDivider,
"pageBlockAnchor" => PageBlockAnchor,
"pageBlockList" => PageBlockList,
"pageBlockBlockQuote" => PageBlockBlockQuote,
"pageBlockPullQuote" => PageBlockPullQuote,
"pageBlockAnimation" => PageBlockAnimation,
"pageBlockAudio" => PageBlockAudio,
"pageBlockPhoto" => PageBlockPhoto,
"pageBlockVideo" => PageBlockVideo,
"pageBlockVoiceNote" => PageBlockVoiceNote,
"pageBlockCover" => PageBlockCover,
"pageBlockEmbedded" => PageBlockEmbedded,
"pageBlockEmbeddedPost" => PageBlockEmbeddedPost,
"pageBlockCollage" => PageBlockCollage,
"pageBlockSlideshow" => PageBlockSlideshow,
"pageBlockChatLink" => PageBlockChatLink,
"pageBlockTable" => PageBlockTable,
"pageBlockDetails" => PageBlockDetails,
"pageBlockRelatedArticles" => PageBlockRelatedArticles,
"pageBlockMap" => PageBlockMap,
"webPageInstantView" => WebPageInstantView,
"webPage" => WebPage,
"address" => Address,
"labeledPricePart" => LabeledPricePart,
"invoice" => Invoice,
"orderInfo" => OrderInfo,
"shippingOption" => ShippingOption,
"savedCredentials" => SavedCredentials,
"inputCredentialsSaved" => InputCredentialsSaved,
"inputCredentialsNew" => InputCredentialsNew,
"inputCredentialsAndroidPay" => InputCredentialsAndroidPay,
"inputCredentialsApplePay" => InputCredentialsApplePay,
"paymentsProviderStripe" => PaymentsProviderStripe,
"paymentForm" => PaymentForm,
"validatedOrderInfo" => ValidatedOrderInfo,
"paymentResult" => PaymentResult,
"paymentReceipt" => PaymentReceipt,
"datedFile" => DatedFile,
"passportElementTypePersonalDetails" => PassportElementTypePersonalDetails,
"passportElementTypePassport" => PassportElementTypePassport,
"passportElementTypeDriverLicense" => PassportElementTypeDriverLicense,
"passportElementTypeIdentityCard" => PassportElementTypeIdentityCard,
"passportElementTypeInternalPassport" => PassportElementTypeInternalPassport,
"passportElementTypeAddress" => PassportElementTypeAddress,
"passportElementTypeUtilityBill" => PassportElementTypeUtilityBill,
"passportElementTypeBankStatement" => PassportElementTypeBankStatement,
"passportElementTypeRentalAgreement" => PassportElementTypeRentalAgreement,
"passportElementTypePassportRegistration" => PassportElementTypePassportRegistration,
"passportElementTypeTemporaryRegistration" => PassportElementTypeTemporaryRegistration,
"passportElementTypePhoneNumber" => PassportElementTypePhoneNumber,
"passportElementTypeEmailAddress" => PassportElementTypeEmailAddress,
"date" => Date,
"personalDetails" => PersonalDetails,
"identityDocument" => IdentityDocument,
"inputIdentityDocument" => InputIdentityDocument,
"personalDocument" => PersonalDocument,
"inputPersonalDocument" => InputPersonalDocument,
"passportElementPersonalDetails" => PassportElementPersonalDetails,
"passportElementPassport" => PassportElementPassport,
"passportElementDriverLicense" => PassportElementDriverLicense,
"passportElementIdentityCard" => PassportElementIdentityCard,
"passportElementInternalPassport" => PassportElementInternalPassport,
"passportElementAddress" => PassportElementAddress,
"passportElementUtilityBill" => PassportElementUtilityBill,
"passportElementBankStatement" => PassportElementBankStatement,
"passportElementRentalAgreement" => PassportElementRentalAgreement,
"passportElementPassportRegistration" => PassportElementPassportRegistration,
"passportElementTemporaryRegistration" => PassportElementTemporaryRegistration,
"passportElementPhoneNumber" => PassportElementPhoneNumber,
"passportElementEmailAddress" => PassportElementEmailAddress,
"inputPassportElementPersonalDetails" => InputPassportElementPersonalDetails,
"inputPassportElementPassport" => InputPassportElementPassport,
"inputPassportElementDriverLicense" => InputPassportElementDriverLicense,
"inputPassportElementIdentityCard" => InputPassportElementIdentityCard,
"inputPassportElementInternalPassport" => InputPassportElementInternalPassport,
"inputPassportElementAddress" => InputPassportElementAddress,
"inputPassportElementUtilityBill" => InputPassportElementUtilityBill,
"inputPassportElementBankStatement" => InputPassportElementBankStatement,
"inputPassportElementRentalAgreement" => InputPassportElementRentalAgreement,
"inputPassportElementPassportRegistration" => InputPassportElementPassportRegistration,
"inputPassportElementTemporaryRegistration" => InputPassportElementTemporaryRegistration,
"inputPassportElementPhoneNumber" => InputPassportElementPhoneNumber,
"inputPassportElementEmailAddress" => InputPassportElementEmailAddress,
"passportElements" => PassportElements,
"passportElementErrorSourceUnspecified" => PassportElementErrorSourceUnspecified,
"passportElementErrorSourceDataField" => PassportElementErrorSourceDataField,
"passportElementErrorSourceFrontSide" => PassportElementErrorSourceFrontSide,
"passportElementErrorSourceReverseSide" => PassportElementErrorSourceReverseSide,
"passportElementErrorSourceSelfie" => PassportElementErrorSourceSelfie,
"passportElementErrorSourceTranslationFile" => PassportElementErrorSourceTranslationFile,
"passportElementErrorSourceTranslationFiles" => PassportElementErrorSourceTranslationFiles,
"passportElementErrorSourceFile" => PassportElementErrorSourceFile,
"passportElementErrorSourceFiles" => PassportElementErrorSourceFiles,
"passportElementError" => PassportElementError,
"passportSuitableElement" => PassportSuitableElement,
"passportRequiredElement" => PassportRequiredElement,
"passportAuthorizationForm" => PassportAuthorizationForm,
"passportElementsWithErrors" => PassportElementsWithErrors,
"encryptedCredentials" => EncryptedCredentials,
"encryptedPassportElement" => EncryptedPassportElement,
"inputPassportElementErrorSourceUnspecified" => InputPassportElementErrorSourceUnspecified,
"inputPassportElementErrorSourceDataField" => InputPassportElementErrorSourceDataField,
"inputPassportElementErrorSourceFrontSide" => InputPassportElementErrorSourceFrontSide,
"inputPassportElementErrorSourceReverseSide" => InputPassportElementErrorSourceReverseSide,
"inputPassportElementErrorSourceSelfie" => InputPassportElementErrorSourceSelfie,
"inputPassportElementErrorSourceTranslationFile" => InputPassportElementErrorSourceTranslationFile,
"inputPassportElementErrorSourceTranslationFiles" => InputPassportElementErrorSourceTranslationFiles,
"inputPassportElementErrorSourceFile" => InputPassportElementErrorSourceFile,
"inputPassportElementErrorSourceFiles" => InputPassportElementErrorSourceFiles,
"inputPassportElementError" => InputPassportElementError,
"messageText" => MessageText,
"messageAnimation" => MessageAnimation,
"messageAudio" => MessageAudio,
"messageDocument" => MessageDocument,
"messagePhoto" => MessagePhoto,
"messageExpiredPhoto" => MessageExpiredPhoto,
"messageSticker" => MessageSticker,
"messageVideo" => MessageVideo,
"messageExpiredVideo" => MessageExpiredVideo,
"messageVideoNote" => MessageVideoNote,
"messageVoiceNote" => MessageVoiceNote,
"messageLocation" => MessageLocation,
"messageVenue" => MessageVenue,
"messageContact" => MessageContact,
"messageGame" => MessageGame,
"messagePoll" => MessagePoll,
"messageInvoice" => MessageInvoice,
"messageCall" => MessageCall,
"messageBasicGroupChatCreate" => MessageBasicGroupChatCreate,
"messageSupergroupChatCreate" => MessageSupergroupChatCreate,
"messageChatChangeTitle" => MessageChatChangeTitle,
"messageChatChangePhoto" => MessageChatChangePhoto,
"messageChatDeletePhoto" => MessageChatDeletePhoto,
"messageChatAddMembers" => MessageChatAddMembers,
"messageChatJoinByLink" => MessageChatJoinByLink,
"messageChatDeleteMember" => MessageChatDeleteMember,
"messageChatUpgradeTo" => MessageChatUpgradeTo,
"messageChatUpgradeFrom" => MessageChatUpgradeFrom,
"messagePinMessage" => MessagePinMessage,
"messageScreenshotTaken" => MessageScreenshotTaken,
"messageChatSetTtl" => MessageChatSetTtl,
"messageCustomServiceAction" => MessageCustomServiceAction,
"messageGameScore" => MessageGameScore,
"messagePaymentSuccessful" => MessagePaymentSuccessful,
"messagePaymentSuccessfulBot" => MessagePaymentSuccessfulBot,
"messageContactRegistered" => MessageContactRegistered,
"messageWebsiteConnected" => MessageWebsiteConnected,
"messagePassportDataSent" => MessagePassportDataSent,
"messagePassportDataReceived" => MessagePassportDataReceived,
"messageUnsupported" => MessageUnsupported,
"textEntityTypeMention" => TextEntityTypeMention,
"textEntityTypeHashtag" => TextEntityTypeHashtag,
"textEntityTypeCashtag" => TextEntityTypeCashtag,
"textEntityTypeBotCommand" => TextEntityTypeBotCommand,
"textEntityTypeUrl" => TextEntityTypeUrl,
"textEntityTypeEmailAddress" => TextEntityTypeEmailAddress,
"textEntityTypePhoneNumber" => TextEntityTypePhoneNumber,
"textEntityTypeBold" => TextEntityTypeBold,
"textEntityTypeItalic" => TextEntityTypeItalic,
"textEntityTypeUnderline" => TextEntityTypeUnderline,
"textEntityTypeStrikethrough" => TextEntityTypeStrikethrough,
"textEntityTypeCode" => TextEntityTypeCode,
"textEntityTypePre" => TextEntityTypePre,
"textEntityTypePreCode" => TextEntityTypePreCode,
"textEntityTypeTextUrl" => TextEntityTypeTextUrl,
"textEntityTypeMentionName" => TextEntityTypeMentionName,
"inputThumbnail" => InputThumbnail,
"messageSchedulingStateSendAtDate" => MessageSchedulingStateSendAtDate,
"messageSchedulingStateSendWhenOnline" => MessageSchedulingStateSendWhenOnline,
"sendMessageOptions" => SendMessageOptions,
"inputMessageText" => InputMessageText,
"inputMessageAnimation" => InputMessageAnimation,
"inputMessageAudio" => InputMessageAudio,
"inputMessageDocument" => InputMessageDocument,
"inputMessagePhoto" => InputMessagePhoto,
"inputMessageSticker" => InputMessageSticker,
"inputMessageVideo" => InputMessageVideo,
"inputMessageVideoNote" => InputMessageVideoNote,
"inputMessageVoiceNote" => InputMessageVoiceNote,
"inputMessageLocation" => InputMessageLocation,
"inputMessageVenue" => InputMessageVenue,
"inputMessageContact" => InputMessageContact,
"inputMessageGame" => InputMessageGame,
"inputMessageInvoice" => InputMessageInvoice,
"inputMessagePoll" => InputMessagePoll,
"inputMessageForwarded" => InputMessageForwarded,
"searchMessagesFilterEmpty" => SearchMessagesFilterEmpty,
"searchMessagesFilterAnimation" => SearchMessagesFilterAnimation,
"searchMessagesFilterAudio" => SearchMessagesFilterAudio,
"searchMessagesFilterDocument" => SearchMessagesFilterDocument,
"searchMessagesFilterPhoto" => SearchMessagesFilterPhoto,
"searchMessagesFilterVideo" => SearchMessagesFilterVideo,
"searchMessagesFilterVoiceNote" => SearchMessagesFilterVoiceNote,
"searchMessagesFilterPhotoAndVideo" => SearchMessagesFilterPhotoAndVideo,
"searchMessagesFilterUrl" => SearchMessagesFilterUrl,
"searchMessagesFilterChatPhoto" => SearchMessagesFilterChatPhoto,
"searchMessagesFilterCall" => SearchMessagesFilterCall,
"searchMessagesFilterMissedCall" => SearchMessagesFilterMissedCall,
"searchMessagesFilterVideoNote" => SearchMessagesFilterVideoNote,
"searchMessagesFilterVoiceAndVideoNote" => SearchMessagesFilterVoiceAndVideoNote,
"searchMessagesFilterMention" => SearchMessagesFilterMention,
"searchMessagesFilterUnreadMention" => SearchMessagesFilterUnreadMention,
"chatActionTyping" => ChatActionTyping,
"chatActionRecordingVideo" => ChatActionRecordingVideo,
"chatActionUploadingVideo" => ChatActionUploadingVideo,
"chatActionRecordingVoiceNote" => ChatActionRecordingVoiceNote,
"chatActionUploadingVoiceNote" => ChatActionUploadingVoiceNote,
"chatActionUploadingPhoto" => ChatActionUploadingPhoto,
"chatActionUploadingDocument" => ChatActionUploadingDocument,
"chatActionChoosingLocation" => ChatActionChoosingLocation,
"chatActionChoosingContact" => ChatActionChoosingContact,
"chatActionStartPlayingGame" => ChatActionStartPlayingGame,
"chatActionRecordingVideoNote" => ChatActionRecordingVideoNote,
"chatActionUploadingVideoNote" => ChatActionUploadingVideoNote,
"chatActionCancel" => ChatActionCancel,
"userStatusEmpty" => UserStatusEmpty,
"userStatusOnline" => UserStatusOnline,
"userStatusOffline" => UserStatusOffline,
"userStatusRecently" => UserStatusRecently,
"userStatusLastWeek" => UserStatusLastWeek,
"userStatusLastMonth" => UserStatusLastMonth,
"stickers" => Stickers,
"emojis" => Emojis,
"stickerSet" => StickerSet,
"stickerSetInfo" => StickerSetInfo,
"stickerSets" => StickerSets,
"callDiscardReasonEmpty" => CallDiscardReasonEmpty,
"callDiscardReasonMissed" => CallDiscardReasonMissed,
"callDiscardReasonDeclined" => CallDiscardReasonDeclined,
"callDiscardReasonDisconnected" => CallDiscardReasonDisconnected,
"callDiscardReasonHungUp" => CallDiscardReasonHungUp,
"callProtocol" => CallProtocol,
"callConnection" => CallConnection,
"callId" => CallId,
"callStatePending" => CallStatePending,
"callStateExchangingKeys" => CallStateExchangingKeys,
"callStateReady" => CallStateReady,
"callStateHangingUp" => CallStateHangingUp,
"callStateDiscarded" => CallStateDiscarded,
"callStateError" => CallStateError,
"callProblemEcho" => CallProblemEcho,
"callProblemNoise" => CallProblemNoise,
"callProblemInterruptions" => CallProblemInterruptions,
"callProblemDistortedSpeech" => CallProblemDistortedSpeech,
"callProblemSilentLocal" => CallProblemSilentLocal,
"callProblemSilentRemote" => CallProblemSilentRemote,
"callProblemDropped" => CallProblemDropped,
"call" => Call,
"phoneNumberAuthenticationSettings" => PhoneNumberAuthenticationSettings,
"animations" => Animations,
"importedContacts" => ImportedContacts,
"httpUrl" => HttpUrl,
"inputInlineQueryResultAnimatedGif" => InputInlineQueryResultAnimatedGif,
"inputInlineQueryResultAnimatedMpeg4" => InputInlineQueryResultAnimatedMpeg4,
"inputInlineQueryResultArticle" => InputInlineQueryResultArticle,
"inputInlineQueryResultAudio" => InputInlineQueryResultAudio,
"inputInlineQueryResultContact" => InputInlineQueryResultContact,
"inputInlineQueryResultDocument" => InputInlineQueryResultDocument,
"inputInlineQueryResultGame" => InputInlineQueryResultGame,
"inputInlineQueryResultLocation" => InputInlineQueryResultLocation,
"inputInlineQueryResultPhoto" => InputInlineQueryResultPhoto,
"inputInlineQueryResultSticker" => InputInlineQueryResultSticker,
"inputInlineQueryResultVenue" => InputInlineQueryResultVenue,
"inputInlineQueryResultVideo" => InputInlineQueryResultVideo,
"inputInlineQueryResultVoiceNote" => InputInlineQueryResultVoiceNote,
"inlineQueryResultArticle" => InlineQueryResultArticle,
"inlineQueryResultContact" => InlineQueryResultContact,
"inlineQueryResultLocation" => InlineQueryResultLocation,
"inlineQueryResultVenue" => InlineQueryResultVenue,
"inlineQueryResultGame" => InlineQueryResultGame,
"inlineQueryResultAnimation" => InlineQueryResultAnimation,
"inlineQueryResultAudio" => InlineQueryResultAudio,
"inlineQueryResultDocument" => InlineQueryResultDocument,
"inlineQueryResultPhoto" => InlineQueryResultPhoto,
"inlineQueryResultSticker" => InlineQueryResultSticker,
"inlineQueryResultVideo" => InlineQueryResultVideo,
"inlineQueryResultVoiceNote" => InlineQueryResultVoiceNote,
"inlineQueryResults" => InlineQueryResults,
"callbackQueryPayloadData" => CallbackQueryPayloadData,
"callbackQueryPayloadGame" => CallbackQueryPayloadGame,
"callbackQueryAnswer" => CallbackQueryAnswer,
"customRequestResult" => CustomRequestResult,
"gameHighScore" => GameHighScore,
"gameHighScores" => GameHighScores,
"chatEventMessageEdited" => ChatEventMessageEdited,
"chatEventMessageDeleted" => ChatEventMessageDeleted,
"chatEventPollStopped" => ChatEventPollStopped,
"chatEventMessagePinned" => ChatEventMessagePinned,
"chatEventMessageUnpinned" => ChatEventMessageUnpinned,
"chatEventMemberJoined" => ChatEventMemberJoined,
"chatEventMemberLeft" => ChatEventMemberLeft,
"chatEventMemberInvited" => ChatEventMemberInvited,
"chatEventMemberPromoted" => ChatEventMemberPromoted,
"chatEventMemberRestricted" => ChatEventMemberRestricted,
"chatEventTitleChanged" => ChatEventTitleChanged,
"chatEventPermissionsChanged" => ChatEventPermissionsChanged,
"chatEventDescriptionChanged" => ChatEventDescriptionChanged,
"chatEventUsernameChanged" => ChatEventUsernameChanged,
"chatEventPhotoChanged" => ChatEventPhotoChanged,
"chatEventInvitesToggled" => ChatEventInvitesToggled,
"chatEventLinkedChatChanged" => ChatEventLinkedChatChanged,
"chatEventSlowModeDelayChanged" => ChatEventSlowModeDelayChanged,
"chatEventSignMessagesToggled" => ChatEventSignMessagesToggled,
"chatEventStickerSetChanged" => ChatEventStickerSetChanged,
"chatEventLocationChanged" => ChatEventLocationChanged,
"chatEventIsAllHistoryAvailableToggled" => ChatEventIsAllHistoryAvailableToggled,
"chatEvent" => ChatEvent,
"chatEvents" => ChatEvents,
"chatEventLogFilters" => ChatEventLogFilters,
"languagePackStringValueOrdinary" => LanguagePackStringValueOrdinary,
"languagePackStringValuePluralized" => LanguagePackStringValuePluralized,
"languagePackStringValueDeleted" => LanguagePackStringValueDeleted,
"languagePackString" => LanguagePackString,
"languagePackStrings" => LanguagePackStrings,
"languagePackInfo" => LanguagePackInfo,
"localizationTargetInfo" => LocalizationTargetInfo,
"deviceTokenFirebaseCloudMessaging" => DeviceTokenFirebaseCloudMessaging,
"deviceTokenApplePush" => DeviceTokenApplePush,
"deviceTokenApplePushVoIP" => DeviceTokenApplePushVoIP,
"deviceTokenWindowsPush" => DeviceTokenWindowsPush,
"deviceTokenMicrosoftPush" => DeviceTokenMicrosoftPush,
"deviceTokenMicrosoftPushVoIP" => DeviceTokenMicrosoftPushVoIP,
"deviceTokenWebPush" => DeviceTokenWebPush,
"deviceTokenSimplePush" => DeviceTokenSimplePush,
"deviceTokenUbuntuPush" => DeviceTokenUbuntuPush,
"deviceTokenBlackBerryPush" => DeviceTokenBlackBerryPush,
"deviceTokenTizenPush" => DeviceTokenTizenPush,
"pushReceiverId" => PushReceiverId,
"backgroundFillSolid" => BackgroundFillSolid,
"backgroundFillGradient" => BackgroundFillGradient,
"backgroundTypeWallpaper" => BackgroundTypeWallpaper,
"backgroundTypePattern" => BackgroundTypePattern,
"backgroundTypeFill" => BackgroundTypeFill,
"background" => Background,
"backgrounds" => Backgrounds,
"inputBackgroundLocal" => InputBackgroundLocal,
"inputBackgroundRemote" => InputBackgroundRemote,
"hashtags" => Hashtags,
"canTransferOwnershipResultOk" => CanTransferOwnershipResultOk,
"canTransferOwnershipResultPasswordNeeded" => CanTransferOwnershipResultPasswordNeeded,
"canTransferOwnershipResultPasswordTooFresh" => CanTransferOwnershipResultPasswordTooFresh,
"canTransferOwnershipResultSessionTooFresh" => CanTransferOwnershipResultSessionTooFresh,
"checkChatUsernameResultOk" => CheckChatUsernameResultOk,
"checkChatUsernameResultUsernameInvalid" => CheckChatUsernameResultUsernameInvalid,
"checkChatUsernameResultUsernameOccupied" => CheckChatUsernameResultUsernameOccupied,
"checkChatUsernameResultPublicChatsTooMuch" => CheckChatUsernameResultPublicChatsTooMuch,
"checkChatUsernameResultPublicGroupsUnavailable" => CheckChatUsernameResultPublicGroupsUnavailable,
"pushMessageContentHidden" => PushMessageContentHidden,
"pushMessageContentAnimation" => PushMessageContentAnimation,
"pushMessageContentAudio" => PushMessageContentAudio,
"pushMessageContentContact" => PushMessageContentContact,
"pushMessageContentContactRegistered" => PushMessageContentContactRegistered,
"pushMessageContentDocument" => PushMessageContentDocument,
"pushMessageContentGame" => PushMessageContentGame,
"pushMessageContentGameScore" => PushMessageContentGameScore,
"pushMessageContentInvoice" => PushMessageContentInvoice,
"pushMessageContentLocation" => PushMessageContentLocation,
"pushMessageContentPhoto" => PushMessageContentPhoto,
"pushMessageContentPoll" => PushMessageContentPoll,
"pushMessageContentScreenshotTaken" => PushMessageContentScreenshotTaken,
"pushMessageContentSticker" => PushMessageContentSticker,
"pushMessageContentText" => PushMessageContentText,
"pushMessageContentVideo" => PushMessageContentVideo,
"pushMessageContentVideoNote" => PushMessageContentVideoNote,
"pushMessageContentVoiceNote" => PushMessageContentVoiceNote,
"pushMessageContentBasicGroupChatCreate" => PushMessageContentBasicGroupChatCreate,
"pushMessageContentChatAddMembers" => PushMessageContentChatAddMembers,
"pushMessageContentChatChangePhoto" => PushMessageContentChatChangePhoto,
"pushMessageContentChatChangeTitle" => PushMessageContentChatChangeTitle,
"pushMessageContentChatDeleteMember" => PushMessageContentChatDeleteMember,
"pushMessageContentChatJoinByLink" => PushMessageContentChatJoinByLink,
"pushMessageContentMessageForwards" => PushMessageContentMessageForwards,
"pushMessageContentMediaAlbum" => PushMessageContentMediaAlbum,
"notificationTypeNewMessage" => NotificationTypeNewMessage,
"notificationTypeNewSecretChat" => NotificationTypeNewSecretChat,
"notificationTypeNewCall" => NotificationTypeNewCall,
"notificationTypeNewPushMessage" => NotificationTypeNewPushMessage,
"notificationGroupTypeMessages" => NotificationGroupTypeMessages,
"notificationGroupTypeMentions" => NotificationGroupTypeMentions,
"notificationGroupTypeSecretChat" => NotificationGroupTypeSecretChat,
"notificationGroupTypeCalls" => NotificationGroupTypeCalls,
"notification" => Notification,
"notificationGroup" => NotificationGroup,
"optionValueBoolean" => OptionValueBoolean,
"optionValueEmpty" => OptionValueEmpty,
"optionValueInteger" => OptionValueInteger,
"optionValueString" => OptionValueString,
"jsonObjectMember" => JsonObjectMember,
"jsonValueNull" => JsonValueNull,
"jsonValueBoolean" => JsonValueBoolean,
"jsonValueNumber" => JsonValueNumber,
"jsonValueString" => JsonValueString,
"jsonValueArray" => JsonValueArray,
"jsonValueObject" => JsonValueObject,
"userPrivacySettingRuleAllowAll" => UserPrivacySettingRuleAllowAll,
"userPrivacySettingRuleAllowContacts" => UserPrivacySettingRuleAllowContacts,
"userPrivacySettingRuleAllowUsers" => UserPrivacySettingRuleAllowUsers,
"userPrivacySettingRuleAllowChatMembers" => UserPrivacySettingRuleAllowChatMembers,
"userPrivacySettingRuleRestrictAll" => UserPrivacySettingRuleRestrictAll,
"userPrivacySettingRuleRestrictContacts" => UserPrivacySettingRuleRestrictContacts,
"userPrivacySettingRuleRestrictUsers" => UserPrivacySettingRuleRestrictUsers,
"userPrivacySettingRuleRestrictChatMembers" => UserPrivacySettingRuleRestrictChatMembers,
"userPrivacySettingRules" => UserPrivacySettingRules,
"userPrivacySettingShowStatus" => UserPrivacySettingShowStatus,
"userPrivacySettingShowProfilePhoto" => UserPrivacySettingShowProfilePhoto,
"userPrivacySettingShowLinkInForwardedMessages" => UserPrivacySettingShowLinkInForwardedMessages,
"userPrivacySettingShowPhoneNumber" => UserPrivacySettingShowPhoneNumber,
"userPrivacySettingAllowChatInvites" => UserPrivacySettingAllowChatInvites,
"userPrivacySettingAllowCalls" => UserPrivacySettingAllowCalls,
"userPrivacySettingAllowPeerToPeerCalls" => UserPrivacySettingAllowPeerToPeerCalls,
"userPrivacySettingAllowFindingByPhoneNumber" => UserPrivacySettingAllowFindingByPhoneNumber,
"accountTtl" => AccountTtl,
"session" => Session,
"sessions" => Sessions,
"connectedWebsite" => ConnectedWebsite,
"connectedWebsites" => ConnectedWebsites,
"chatReportReasonSpam" => ChatReportReasonSpam,
"chatReportReasonViolence" => ChatReportReasonViolence,
"chatReportReasonPornography" => ChatReportReasonPornography,
"chatReportReasonChildAbuse" => ChatReportReasonChildAbuse,
"chatReportReasonCopyright" => ChatReportReasonCopyright,
"chatReportReasonUnrelatedLocation" => ChatReportReasonUnrelatedLocation,
"chatReportReasonCustom" => ChatReportReasonCustom,
"publicMessageLink" => PublicMessageLink,
"messageLinkInfo" => MessageLinkInfo,
"filePart" => FilePart,
"fileTypeNone" => FileTypeNone,
"fileTypeAnimation" => FileTypeAnimation,
"fileTypeAudio" => FileTypeAudio,
"fileTypeDocument" => FileTypeDocument,
"fileTypePhoto" => FileTypePhoto,
"fileTypeProfilePhoto" => FileTypeProfilePhoto,
"fileTypeSecret" => FileTypeSecret,
"fileTypeSecretThumbnail" => FileTypeSecretThumbnail,
"fileTypeSecure" => FileTypeSecure,
"fileTypeSticker" => FileTypeSticker,
"fileTypeThumbnail" => FileTypeThumbnail,
"fileTypeUnknown" => FileTypeUnknown,
"fileTypeVideo" => FileTypeVideo,
"fileTypeVideoNote" => FileTypeVideoNote,
"fileTypeVoiceNote" => FileTypeVoiceNote,
"fileTypeWallpaper" => FileTypeWallpaper,
"storageStatisticsByFileType" => StorageStatisticsByFileType,
"storageStatisticsByChat" => StorageStatisticsByChat,
"storageStatistics" => StorageStatistics,
"storageStatisticsFast" => StorageStatisticsFast,
"databaseStatistics" => DatabaseStatistics,
"networkTypeNone" => NetworkTypeNone,
"networkTypeMobile" => NetworkTypeMobile,
"networkTypeMobileRoaming" => NetworkTypeMobileRoaming,
"networkTypeWiFi" => NetworkTypeWiFi,
"networkTypeOther" => NetworkTypeOther,
"networkStatisticsEntryFile" => NetworkStatisticsEntryFile,
"networkStatisticsEntryCall" => NetworkStatisticsEntryCall,
"networkStatistics" => NetworkStatistics,
"autoDownloadSettings" => AutoDownloadSettings,
"autoDownloadSettingsPresets" => AutoDownloadSettingsPresets,
"connectionStateWaitingForNetwork" => ConnectionStateWaitingForNetwork,
"connectionStateConnectingToProxy" => ConnectionStateConnectingToProxy,
"connectionStateConnecting" => ConnectionStateConnecting,
"connectionStateUpdating" => ConnectionStateUpdating,
"connectionStateReady" => ConnectionStateReady,
"topChatCategoryUsers" => TopChatCategoryUsers,
"topChatCategoryBots" => TopChatCategoryBots,
"topChatCategoryGroups" => TopChatCategoryGroups,
"topChatCategoryChannels" => TopChatCategoryChannels,
"topChatCategoryInlineBots" => TopChatCategoryInlineBots,
"topChatCategoryCalls" => TopChatCategoryCalls,
"topChatCategoryForwardChats" => TopChatCategoryForwardChats,
"tMeUrlTypeUser" => TMeUrlTypeUser,
"tMeUrlTypeSupergroup" => TMeUrlTypeSupergroup,
"tMeUrlTypeChatInvite" => TMeUrlTypeChatInvite,
"tMeUrlTypeStickerSet" => TMeUrlTypeStickerSet,
"tMeUrl" => TMeUrl,
"tMeUrls" => TMeUrls,
"count" => Count,
"text" => Text,
"seconds" => Seconds,
"deepLinkInfo" => DeepLinkInfo,
"textParseModeMarkdown" => TextParseModeMarkdown,
"textParseModeHTML" => TextParseModeHTML,
"proxyTypeSocks5" => ProxyTypeSocks5,
"proxyTypeHttp" => ProxyTypeHttp,
"proxyTypeMtproto" => ProxyTypeMtproto,
"proxy" => Proxy,
"proxies" => Proxies,
"inputSticker" => InputSticker,
"updateAuthorizationState" => UpdateAuthorizationState,
"updateNewMessage" => UpdateNewMessage,
"updateMessageSendAcknowledged" => UpdateMessageSendAcknowledged,
"updateMessageSendSucceeded" => UpdateMessageSendSucceeded,
"updateMessageSendFailed" => UpdateMessageSendFailed,
"updateMessageContent" => UpdateMessageContent,
"updateMessageEdited" => UpdateMessageEdited,
"updateMessageViews" => UpdateMessageViews,
"updateMessageContentOpened" => UpdateMessageContentOpened,
"updateMessageMentionRead" => UpdateMessageMentionRead,
"updateMessageLiveLocationViewed" => UpdateMessageLiveLocationViewed,
"updateNewChat" => UpdateNewChat,
"updateChatChatList" => UpdateChatChatList,
"updateChatTitle" => UpdateChatTitle,
"updateChatPhoto" => UpdateChatPhoto,
"updateChatPermissions" => UpdateChatPermissions,
"updateChatLastMessage" => UpdateChatLastMessage,
"updateChatOrder" => UpdateChatOrder,
"updateChatIsPinned" => UpdateChatIsPinned,
"updateChatIsMarkedAsUnread" => UpdateChatIsMarkedAsUnread,
"updateChatIsSponsored" => UpdateChatIsSponsored,
"updateChatHasScheduledMessages" => UpdateChatHasScheduledMessages,
"updateChatDefaultDisableNotification" => UpdateChatDefaultDisableNotification,
"updateChatReadInbox" => UpdateChatReadInbox,
"updateChatReadOutbox" => UpdateChatReadOutbox,
"updateChatUnreadMentionCount" => UpdateChatUnreadMentionCount,
"updateChatNotificationSettings" => UpdateChatNotificationSettings,
"updateScopeNotificationSettings" => UpdateScopeNotificationSettings,
"updateChatActionBar" => UpdateChatActionBar,
"updateChatPinnedMessage" => UpdateChatPinnedMessage,
"updateChatReplyMarkup" => UpdateChatReplyMarkup,
"updateChatDraftMessage" => UpdateChatDraftMessage,
"updateChatOnlineMemberCount" => UpdateChatOnlineMemberCount,
"updateNotification" => UpdateNotification,
"updateNotificationGroup" => UpdateNotificationGroup,
"updateActiveNotifications" => UpdateActiveNotifications,
"updateHavePendingNotifications" => UpdateHavePendingNotifications,
"updateDeleteMessages" => UpdateDeleteMessages,
"updateUserChatAction" => UpdateUserChatAction,
"updateUserStatus" => UpdateUserStatus,
"updateUser" => UpdateUser,
"updateBasicGroup" => UpdateBasicGroup,
"updateSupergroup" => UpdateSupergroup,
"updateSecretChat" => UpdateSecretChat,
"updateUserFullInfo" => UpdateUserFullInfo,
"updateBasicGroupFullInfo" => UpdateBasicGroupFullInfo,
"updateSupergroupFullInfo" => UpdateSupergroupFullInfo,
"updateServiceNotification" => UpdateServiceNotification,
"updateFile" => UpdateFile,
"updateFileGenerationStart" => UpdateFileGenerationStart,
"updateFileGenerationStop" => UpdateFileGenerationStop,
"updateCall" => UpdateCall,
"updateUserPrivacySettingRules" => UpdateUserPrivacySettingRules,
"updateUnreadMessageCount" => UpdateUnreadMessageCount,
"updateUnreadChatCount" => UpdateUnreadChatCount,
"updateOption" => UpdateOption,
"updateInstalledStickerSets" => UpdateInstalledStickerSets,
"updateTrendingStickerSets" => UpdateTrendingStickerSets,
"updateRecentStickers" => UpdateRecentStickers,
"updateFavoriteStickers" => UpdateFavoriteStickers,
"updateSavedAnimations" => UpdateSavedAnimations,
"updateSelectedBackground" => UpdateSelectedBackground,
"updateLanguagePackStrings" => UpdateLanguagePackStrings,
"updateConnectionState" => UpdateConnectionState,
"updateTermsOfService" => UpdateTermsOfService,
"updateUsersNearby" => UpdateUsersNearby,
"updateNewInlineQuery" => UpdateNewInlineQuery,
"updateNewChosenInlineResult" => UpdateNewChosenInlineResult,
"updateNewCallbackQuery" => UpdateNewCallbackQuery,
"updateNewInlineCallbackQuery" => UpdateNewInlineCallbackQuery,
"updateNewShippingQuery" => UpdateNewShippingQuery,
"updateNewPreCheckoutQuery" => UpdateNewPreCheckoutQuery,
"updateNewCustomEvent" => UpdateNewCustomEvent,
"updateNewCustomQuery" => UpdateNewCustomQuery,
"updatePoll" => UpdatePoll,
"updatePollAnswer" => UpdatePollAnswer,
"updates" => Updates,
"logStreamDefault" => LogStreamDefault,
"logStreamFile" => LogStreamFile,
"logStreamEmpty" => LogStreamEmpty,
"logVerbosityLevel" => LogVerbosityLevel,
"logTags" => LogTags,
"testInt" => TestInt,
"testString" => TestString,
"testBytes" => TestBytes,
"testVectorInt" => TestVectorInt,
"testVectorIntObject" => TestVectorIntObject,
"testVectorString" => TestVectorString,
"testVectorStringObject" => TestVectorStringObject,
}
end
end
end
# Copyright 2020 - Chris Watson <cawatson1993@gmail.com>
#
# You should have received with this program a copy of the MIT license. This code is
# subject to the terms and conditions outlined in said license. For more information,
# please see https://en.wikipedia.org/wiki/MIT_License.
#
# This file was auto generated. Please do not modify directly.
module Proton
module TL
class AuthenticationCodeType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"authenticationCodeTypeTelegramMessage" => AuthenticationCodeTypeTelegramMessage,
"authenticationCodeTypeSms" => AuthenticationCodeTypeSms,
"authenticationCodeTypeCall" => AuthenticationCodeTypeCall,
"authenticationCodeTypeFlashCall" => AuthenticationCodeTypeFlashCall,
}
end
class AuthorizationState < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"authorizationStateWaitTdlibParameters" => AuthorizationStateWaitTdlibParameters,
"authorizationStateWaitEncryptionKey" => AuthorizationStateWaitEncryptionKey,
"authorizationStateWaitPhoneNumber" => AuthorizationStateWaitPhoneNumber,
"authorizationStateWaitCode" => AuthorizationStateWaitCode,
"authorizationStateWaitOtherDeviceConfirmation" => AuthorizationStateWaitOtherDeviceConfirmation,
"authorizationStateWaitRegistration" => AuthorizationStateWaitRegistration,
"authorizationStateWaitPassword" => AuthorizationStateWaitPassword,
"authorizationStateReady" => AuthorizationStateReady,
"authorizationStateLoggingOut" => AuthorizationStateLoggingOut,
"authorizationStateClosing" => AuthorizationStateClosing,
"authorizationStateClosed" => AuthorizationStateClosed,
}
end
class InputFile < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"inputFileId" => InputFileId,
"inputFileRemote" => InputFileRemote,
"inputFileLocal" => InputFileLocal,
"inputFileGenerated" => InputFileGenerated,
}
end
class MaskPoint < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"maskPointForehead" => MaskPointForehead,
"maskPointEyes" => MaskPointEyes,
"maskPointMouth" => MaskPointMouth,
"maskPointChin" => MaskPointChin,
}
end
class PollType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"pollTypeRegular" => PollTypeRegular,
"pollTypeQuiz" => PollTypeQuiz,
}
end
class UserType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"userTypeRegular" => UserTypeRegular,
"userTypeDeleted" => UserTypeDeleted,
"userTypeBot" => UserTypeBot,
"userTypeUnknown" => UserTypeUnknown,
}
end
class ChatMemberStatus < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"chatMemberStatusCreator" => ChatMemberStatusCreator,
"chatMemberStatusAdministrator" => ChatMemberStatusAdministrator,
"chatMemberStatusMember" => ChatMemberStatusMember,
"chatMemberStatusRestricted" => ChatMemberStatusRestricted,
"chatMemberStatusLeft" => ChatMemberStatusLeft,
"chatMemberStatusBanned" => ChatMemberStatusBanned,
}
end
class ChatMembersFilter < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"chatMembersFilterContacts" => ChatMembersFilterContacts,
"chatMembersFilterAdministrators" => ChatMembersFilterAdministrators,
"chatMembersFilterMembers" => ChatMembersFilterMembers,
"chatMembersFilterRestricted" => ChatMembersFilterRestricted,
"chatMembersFilterBanned" => ChatMembersFilterBanned,
"chatMembersFilterBots" => ChatMembersFilterBots,
}
end
class SupergroupMembersFilter < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"supergroupMembersFilterRecent" => SupergroupMembersFilterRecent,
"supergroupMembersFilterContacts" => SupergroupMembersFilterContacts,
"supergroupMembersFilterAdministrators" => SupergroupMembersFilterAdministrators,
"supergroupMembersFilterSearch" => SupergroupMembersFilterSearch,
"supergroupMembersFilterRestricted" => SupergroupMembersFilterRestricted,
"supergroupMembersFilterBanned" => SupergroupMembersFilterBanned,
"supergroupMembersFilterBots" => SupergroupMembersFilterBots,
}
end
class SecretChatState < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"secretChatStatePending" => SecretChatStatePending,
"secretChatStateReady" => SecretChatStateReady,
"secretChatStateClosed" => SecretChatStateClosed,
}
end
class MessageForwardOrigin < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"messageForwardOriginUser" => MessageForwardOriginUser,
"messageForwardOriginHiddenUser" => MessageForwardOriginHiddenUser,
"messageForwardOriginChannel" => MessageForwardOriginChannel,
}
end
class MessageSendingState < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"messageSendingStatePending" => MessageSendingStatePending,
"messageSendingStateFailed" => MessageSendingStateFailed,
}
end
class NotificationSettingsScope < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"notificationSettingsScopePrivateChats" => NotificationSettingsScopePrivateChats,
"notificationSettingsScopeGroupChats" => NotificationSettingsScopeGroupChats,
"notificationSettingsScopeChannelChats" => NotificationSettingsScopeChannelChats,
}
end
class ChatType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"chatTypePrivate" => ChatTypePrivate,
"chatTypeBasicGroup" => ChatTypeBasicGroup,
"chatTypeSupergroup" => ChatTypeSupergroup,
"chatTypeSecret" => ChatTypeSecret,
}
end
class ChatList < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"chatListMain" => ChatListMain,
"chatListArchive" => ChatListArchive,
}
end
class PublicChatType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"publicChatTypeHasUsername" => PublicChatTypeHasUsername,
"publicChatTypeIsLocationBased" => PublicChatTypeIsLocationBased,
}
end
class ChatActionBar < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"chatActionBarReportSpam" => ChatActionBarReportSpam,
"chatActionBarReportUnrelatedLocation" => ChatActionBarReportUnrelatedLocation,
"chatActionBarReportAddBlock" => ChatActionBarReportAddBlock,
"chatActionBarAddContact" => ChatActionBarAddContact,
"chatActionBarSharePhoneNumber" => ChatActionBarSharePhoneNumber,
}
end
class KeyboardButtonType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"keyboardButtonTypeText" => KeyboardButtonTypeText,
"keyboardButtonTypeRequestPhoneNumber" => KeyboardButtonTypeRequestPhoneNumber,
"keyboardButtonTypeRequestLocation" => KeyboardButtonTypeRequestLocation,
"keyboardButtonTypeRequestPoll" => KeyboardButtonTypeRequestPoll,
}
end
class InlineKeyboardButtonType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"inlineKeyboardButtonTypeUrl" => InlineKeyboardButtonTypeUrl,
"inlineKeyboardButtonTypeLoginUrl" => InlineKeyboardButtonTypeLoginUrl,
"inlineKeyboardButtonTypeCallback" => InlineKeyboardButtonTypeCallback,
"inlineKeyboardButtonTypeCallbackGame" => InlineKeyboardButtonTypeCallbackGame,
"inlineKeyboardButtonTypeSwitchInline" => InlineKeyboardButtonTypeSwitchInline,
"inlineKeyboardButtonTypeBuy" => InlineKeyboardButtonTypeBuy,
}
end
class ReplyMarkup < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"replyMarkupRemoveKeyboard" => ReplyMarkupRemoveKeyboard,
"replyMarkupForceReply" => ReplyMarkupForceReply,
"replyMarkupShowKeyboard" => ReplyMarkupShowKeyboard,
"replyMarkupInlineKeyboard" => ReplyMarkupInlineKeyboard,
}
end
class LoginUrlInfo < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"loginUrlInfoOpen" => LoginUrlInfoOpen,
"loginUrlInfoRequestConfirmation" => LoginUrlInfoRequestConfirmation,
}
end
class RichText < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"richTextPlain" => RichTextPlain,
"richTextBold" => RichTextBold,
"richTextItalic" => RichTextItalic,
"richTextUnderline" => RichTextUnderline,
"richTextStrikethrough" => RichTextStrikethrough,
"richTextFixed" => RichTextFixed,
"richTextUrl" => RichTextUrl,
"richTextEmailAddress" => RichTextEmailAddress,
"richTextSubscript" => RichTextSubscript,
"richTextSuperscript" => RichTextSuperscript,
"richTextMarked" => RichTextMarked,
"richTextPhoneNumber" => RichTextPhoneNumber,
"richTextIcon" => RichTextIcon,
"richTextAnchor" => RichTextAnchor,
"richTexts" => RichTexts,
}
end
class PageBlockHorizontalAlignment < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"pageBlockHorizontalAlignmentLeft" => PageBlockHorizontalAlignmentLeft,
"pageBlockHorizontalAlignmentCenter" => PageBlockHorizontalAlignmentCenter,
"pageBlockHorizontalAlignmentRight" => PageBlockHorizontalAlignmentRight,
}
end
class PageBlockVerticalAlignment < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"pageBlockVerticalAlignmentTop" => PageBlockVerticalAlignmentTop,
"pageBlockVerticalAlignmentMiddle" => PageBlockVerticalAlignmentMiddle,
"pageBlockVerticalAlignmentBottom" => PageBlockVerticalAlignmentBottom,
}
end
class PageBlock < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"pageBlockTitle" => PageBlockTitle,
"pageBlockSubtitle" => PageBlockSubtitle,
"pageBlockAuthorDate" => PageBlockAuthorDate,
"pageBlockHeader" => PageBlockHeader,
"pageBlockSubheader" => PageBlockSubheader,
"pageBlockKicker" => PageBlockKicker,
"pageBlockParagraph" => PageBlockParagraph,
"pageBlockPreformatted" => PageBlockPreformatted,
"pageBlockFooter" => PageBlockFooter,
"pageBlockDivider" => PageBlockDivider,
"pageBlockAnchor" => PageBlockAnchor,
"pageBlockList" => PageBlockList,
"pageBlockBlockQuote" => PageBlockBlockQuote,
"pageBlockPullQuote" => PageBlockPullQuote,
"pageBlockAnimation" => PageBlockAnimation,
"pageBlockAudio" => PageBlockAudio,
"pageBlockPhoto" => PageBlockPhoto,
"pageBlockVideo" => PageBlockVideo,
"pageBlockVoiceNote" => PageBlockVoiceNote,
"pageBlockCover" => PageBlockCover,
"pageBlockEmbedded" => PageBlockEmbedded,
"pageBlockEmbeddedPost" => PageBlockEmbeddedPost,
"pageBlockCollage" => PageBlockCollage,
"pageBlockSlideshow" => PageBlockSlideshow,
"pageBlockChatLink" => PageBlockChatLink,
"pageBlockTable" => PageBlockTable,
"pageBlockDetails" => PageBlockDetails,
"pageBlockRelatedArticles" => PageBlockRelatedArticles,
"pageBlockMap" => PageBlockMap,
}
end
class InputCredentials < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"inputCredentialsSaved" => InputCredentialsSaved,
"inputCredentialsNew" => InputCredentialsNew,
"inputCredentialsAndroidPay" => InputCredentialsAndroidPay,
"inputCredentialsApplePay" => InputCredentialsApplePay,
}
end
class PassportElementType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"passportElementTypePersonalDetails" => PassportElementTypePersonalDetails,
"passportElementTypePassport" => PassportElementTypePassport,
"passportElementTypeDriverLicense" => PassportElementTypeDriverLicense,
"passportElementTypeIdentityCard" => PassportElementTypeIdentityCard,
"passportElementTypeInternalPassport" => PassportElementTypeInternalPassport,
"passportElementTypeAddress" => PassportElementTypeAddress,
"passportElementTypeUtilityBill" => PassportElementTypeUtilityBill,
"passportElementTypeBankStatement" => PassportElementTypeBankStatement,
"passportElementTypeRentalAgreement" => PassportElementTypeRentalAgreement,
"passportElementTypePassportRegistration" => PassportElementTypePassportRegistration,
"passportElementTypeTemporaryRegistration" => PassportElementTypeTemporaryRegistration,
"passportElementTypePhoneNumber" => PassportElementTypePhoneNumber,
"passportElementTypeEmailAddress" => PassportElementTypeEmailAddress,
}
end
class PassportElement < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"passportElementPersonalDetails" => PassportElementPersonalDetails,
"passportElementPassport" => PassportElementPassport,
"passportElementDriverLicense" => PassportElementDriverLicense,
"passportElementIdentityCard" => PassportElementIdentityCard,
"passportElementInternalPassport" => PassportElementInternalPassport,
"passportElementAddress" => PassportElementAddress,
"passportElementUtilityBill" => PassportElementUtilityBill,
"passportElementBankStatement" => PassportElementBankStatement,
"passportElementRentalAgreement" => PassportElementRentalAgreement,
"passportElementPassportRegistration" => PassportElementPassportRegistration,
"passportElementTemporaryRegistration" => PassportElementTemporaryRegistration,
"passportElementPhoneNumber" => PassportElementPhoneNumber,
"passportElementEmailAddress" => PassportElementEmailAddress,
}
end
class InputPassportElement < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"inputPassportElementPersonalDetails" => InputPassportElementPersonalDetails,
"inputPassportElementPassport" => InputPassportElementPassport,
"inputPassportElementDriverLicense" => InputPassportElementDriverLicense,
"inputPassportElementIdentityCard" => InputPassportElementIdentityCard,
"inputPassportElementInternalPassport" => InputPassportElementInternalPassport,
"inputPassportElementAddress" => InputPassportElementAddress,
"inputPassportElementUtilityBill" => InputPassportElementUtilityBill,
"inputPassportElementBankStatement" => InputPassportElementBankStatement,
"inputPassportElementRentalAgreement" => InputPassportElementRentalAgreement,
"inputPassportElementPassportRegistration" => InputPassportElementPassportRegistration,
"inputPassportElementTemporaryRegistration" => InputPassportElementTemporaryRegistration,
"inputPassportElementPhoneNumber" => InputPassportElementPhoneNumber,
"inputPassportElementEmailAddress" => InputPassportElementEmailAddress,
}
end
class PassportElementErrorSource < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"passportElementErrorSourceUnspecified" => PassportElementErrorSourceUnspecified,
"passportElementErrorSourceDataField" => PassportElementErrorSourceDataField,
"passportElementErrorSourceFrontSide" => PassportElementErrorSourceFrontSide,
"passportElementErrorSourceReverseSide" => PassportElementErrorSourceReverseSide,
"passportElementErrorSourceSelfie" => PassportElementErrorSourceSelfie,
"passportElementErrorSourceTranslationFile" => PassportElementErrorSourceTranslationFile,
"passportElementErrorSourceTranslationFiles" => PassportElementErrorSourceTranslationFiles,
"passportElementErrorSourceFile" => PassportElementErrorSourceFile,
"passportElementErrorSourceFiles" => PassportElementErrorSourceFiles,
}
end
class InputPassportElementErrorSource < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"inputPassportElementErrorSourceUnspecified" => InputPassportElementErrorSourceUnspecified,
"inputPassportElementErrorSourceDataField" => InputPassportElementErrorSourceDataField,
"inputPassportElementErrorSourceFrontSide" => InputPassportElementErrorSourceFrontSide,
"inputPassportElementErrorSourceReverseSide" => InputPassportElementErrorSourceReverseSide,
"inputPassportElementErrorSourceSelfie" => InputPassportElementErrorSourceSelfie,
"inputPassportElementErrorSourceTranslationFile" => InputPassportElementErrorSourceTranslationFile,
"inputPassportElementErrorSourceTranslationFiles" => InputPassportElementErrorSourceTranslationFiles,
"inputPassportElementErrorSourceFile" => InputPassportElementErrorSourceFile,
"inputPassportElementErrorSourceFiles" => InputPassportElementErrorSourceFiles,
}
end
class MessageContent < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"messageText" => MessageText,
"messageAnimation" => MessageAnimation,
"messageAudio" => MessageAudio,
"messageDocument" => MessageDocument,
"messagePhoto" => MessagePhoto,
"messageExpiredPhoto" => MessageExpiredPhoto,
"messageSticker" => MessageSticker,
"messageVideo" => MessageVideo,
"messageExpiredVideo" => MessageExpiredVideo,
"messageVideoNote" => MessageVideoNote,
"messageVoiceNote" => MessageVoiceNote,
"messageLocation" => MessageLocation,
"messageVenue" => MessageVenue,
"messageContact" => MessageContact,
"messageGame" => MessageGame,
"messagePoll" => MessagePoll,
"messageInvoice" => MessageInvoice,
"messageCall" => MessageCall,
"messageBasicGroupChatCreate" => MessageBasicGroupChatCreate,
"messageSupergroupChatCreate" => MessageSupergroupChatCreate,
"messageChatChangeTitle" => MessageChatChangeTitle,
"messageChatChangePhoto" => MessageChatChangePhoto,
"messageChatDeletePhoto" => MessageChatDeletePhoto,
"messageChatAddMembers" => MessageChatAddMembers,
"messageChatJoinByLink" => MessageChatJoinByLink,
"messageChatDeleteMember" => MessageChatDeleteMember,
"messageChatUpgradeTo" => MessageChatUpgradeTo,
"messageChatUpgradeFrom" => MessageChatUpgradeFrom,
"messagePinMessage" => MessagePinMessage,
"messageScreenshotTaken" => MessageScreenshotTaken,
"messageChatSetTtl" => MessageChatSetTtl,
"messageCustomServiceAction" => MessageCustomServiceAction,
"messageGameScore" => MessageGameScore,
"messagePaymentSuccessful" => MessagePaymentSuccessful,
"messagePaymentSuccessfulBot" => MessagePaymentSuccessfulBot,
"messageContactRegistered" => MessageContactRegistered,
"messageWebsiteConnected" => MessageWebsiteConnected,
"messagePassportDataSent" => MessagePassportDataSent,
"messagePassportDataReceived" => MessagePassportDataReceived,
"messageUnsupported" => MessageUnsupported,
}
end
class TextEntityType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"textEntityTypeMention" => TextEntityTypeMention,
"textEntityTypeHashtag" => TextEntityTypeHashtag,
"textEntityTypeCashtag" => TextEntityTypeCashtag,
"textEntityTypeBotCommand" => TextEntityTypeBotCommand,
"textEntityTypeUrl" => TextEntityTypeUrl,
"textEntityTypeEmailAddress" => TextEntityTypeEmailAddress,
"textEntityTypePhoneNumber" => TextEntityTypePhoneNumber,
"textEntityTypeBold" => TextEntityTypeBold,
"textEntityTypeItalic" => TextEntityTypeItalic,
"textEntityTypeUnderline" => TextEntityTypeUnderline,
"textEntityTypeStrikethrough" => TextEntityTypeStrikethrough,
"textEntityTypeCode" => TextEntityTypeCode,
"textEntityTypePre" => TextEntityTypePre,
"textEntityTypePreCode" => TextEntityTypePreCode,
"textEntityTypeTextUrl" => TextEntityTypeTextUrl,
"textEntityTypeMentionName" => TextEntityTypeMentionName,
}
end
class MessageSchedulingState < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"messageSchedulingStateSendAtDate" => MessageSchedulingStateSendAtDate,
"messageSchedulingStateSendWhenOnline" => MessageSchedulingStateSendWhenOnline,
}
end
class InputMessageContent < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"inputMessageText" => InputMessageText,
"inputMessageAnimation" => InputMessageAnimation,
"inputMessageAudio" => InputMessageAudio,
"inputMessageDocument" => InputMessageDocument,
"inputMessagePhoto" => InputMessagePhoto,
"inputMessageSticker" => InputMessageSticker,
"inputMessageVideo" => InputMessageVideo,
"inputMessageVideoNote" => InputMessageVideoNote,
"inputMessageVoiceNote" => InputMessageVoiceNote,
"inputMessageLocation" => InputMessageLocation,
"inputMessageVenue" => InputMessageVenue,
"inputMessageContact" => InputMessageContact,
"inputMessageGame" => InputMessageGame,
"inputMessageInvoice" => InputMessageInvoice,
"inputMessagePoll" => InputMessagePoll,
"inputMessageForwarded" => InputMessageForwarded,
}
end
class SearchMessagesFilter < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"searchMessagesFilterEmpty" => SearchMessagesFilterEmpty,
"searchMessagesFilterAnimation" => SearchMessagesFilterAnimation,
"searchMessagesFilterAudio" => SearchMessagesFilterAudio,
"searchMessagesFilterDocument" => SearchMessagesFilterDocument,
"searchMessagesFilterPhoto" => SearchMessagesFilterPhoto,
"searchMessagesFilterVideo" => SearchMessagesFilterVideo,
"searchMessagesFilterVoiceNote" => SearchMessagesFilterVoiceNote,
"searchMessagesFilterPhotoAndVideo" => SearchMessagesFilterPhotoAndVideo,
"searchMessagesFilterUrl" => SearchMessagesFilterUrl,
"searchMessagesFilterChatPhoto" => SearchMessagesFilterChatPhoto,
"searchMessagesFilterCall" => SearchMessagesFilterCall,
"searchMessagesFilterMissedCall" => SearchMessagesFilterMissedCall,
"searchMessagesFilterVideoNote" => SearchMessagesFilterVideoNote,
"searchMessagesFilterVoiceAndVideoNote" => SearchMessagesFilterVoiceAndVideoNote,
"searchMessagesFilterMention" => SearchMessagesFilterMention,
"searchMessagesFilterUnreadMention" => SearchMessagesFilterUnreadMention,
}
end
class ChatAction < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"chatActionTyping" => ChatActionTyping,
"chatActionRecordingVideo" => ChatActionRecordingVideo,
"chatActionUploadingVideo" => ChatActionUploadingVideo,
"chatActionRecordingVoiceNote" => ChatActionRecordingVoiceNote,
"chatActionUploadingVoiceNote" => ChatActionUploadingVoiceNote,
"chatActionUploadingPhoto" => ChatActionUploadingPhoto,
"chatActionUploadingDocument" => ChatActionUploadingDocument,
"chatActionChoosingLocation" => ChatActionChoosingLocation,
"chatActionChoosingContact" => ChatActionChoosingContact,
"chatActionStartPlayingGame" => ChatActionStartPlayingGame,
"chatActionRecordingVideoNote" => ChatActionRecordingVideoNote,
"chatActionUploadingVideoNote" => ChatActionUploadingVideoNote,
"chatActionCancel" => ChatActionCancel,
}
end
class UserStatus < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"userStatusEmpty" => UserStatusEmpty,
"userStatusOnline" => UserStatusOnline,
"userStatusOffline" => UserStatusOffline,
"userStatusRecently" => UserStatusRecently,
"userStatusLastWeek" => UserStatusLastWeek,
"userStatusLastMonth" => UserStatusLastMonth,
}
end
class CallDiscardReason < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"callDiscardReasonEmpty" => CallDiscardReasonEmpty,
"callDiscardReasonMissed" => CallDiscardReasonMissed,
"callDiscardReasonDeclined" => CallDiscardReasonDeclined,
"callDiscardReasonDisconnected" => CallDiscardReasonDisconnected,
"callDiscardReasonHungUp" => CallDiscardReasonHungUp,
}
end
class CallState < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"callStatePending" => CallStatePending,
"callStateExchangingKeys" => CallStateExchangingKeys,
"callStateReady" => CallStateReady,
"callStateHangingUp" => CallStateHangingUp,
"callStateDiscarded" => CallStateDiscarded,
"callStateError" => CallStateError,
}
end
class CallProblem < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"callProblemEcho" => CallProblemEcho,
"callProblemNoise" => CallProblemNoise,
"callProblemInterruptions" => CallProblemInterruptions,
"callProblemDistortedSpeech" => CallProblemDistortedSpeech,
"callProblemSilentLocal" => CallProblemSilentLocal,
"callProblemSilentRemote" => CallProblemSilentRemote,
"callProblemDropped" => CallProblemDropped,
}
end
class InputInlineQueryResult < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"inputInlineQueryResultAnimatedGif" => InputInlineQueryResultAnimatedGif,
"inputInlineQueryResultAnimatedMpeg4" => InputInlineQueryResultAnimatedMpeg4,
"inputInlineQueryResultArticle" => InputInlineQueryResultArticle,
"inputInlineQueryResultAudio" => InputInlineQueryResultAudio,
"inputInlineQueryResultContact" => InputInlineQueryResultContact,
"inputInlineQueryResultDocument" => InputInlineQueryResultDocument,
"inputInlineQueryResultGame" => InputInlineQueryResultGame,
"inputInlineQueryResultLocation" => InputInlineQueryResultLocation,
"inputInlineQueryResultPhoto" => InputInlineQueryResultPhoto,
"inputInlineQueryResultSticker" => InputInlineQueryResultSticker,
"inputInlineQueryResultVenue" => InputInlineQueryResultVenue,
"inputInlineQueryResultVideo" => InputInlineQueryResultVideo,
"inputInlineQueryResultVoiceNote" => InputInlineQueryResultVoiceNote,
}
end
class InlineQueryResult < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"inlineQueryResultArticle" => InlineQueryResultArticle,
"inlineQueryResultContact" => InlineQueryResultContact,
"inlineQueryResultLocation" => InlineQueryResultLocation,
"inlineQueryResultVenue" => InlineQueryResultVenue,
"inlineQueryResultGame" => InlineQueryResultGame,
"inlineQueryResultAnimation" => InlineQueryResultAnimation,
"inlineQueryResultAudio" => InlineQueryResultAudio,
"inlineQueryResultDocument" => InlineQueryResultDocument,
"inlineQueryResultPhoto" => InlineQueryResultPhoto,
"inlineQueryResultSticker" => InlineQueryResultSticker,
"inlineQueryResultVideo" => InlineQueryResultVideo,
"inlineQueryResultVoiceNote" => InlineQueryResultVoiceNote,
}
end
class CallbackQueryPayload < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"callbackQueryPayloadData" => CallbackQueryPayloadData,
"callbackQueryPayloadGame" => CallbackQueryPayloadGame,
}
end
class ChatEventAction < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"chatEventMessageEdited" => ChatEventMessageEdited,
"chatEventMessageDeleted" => ChatEventMessageDeleted,
"chatEventPollStopped" => ChatEventPollStopped,
"chatEventMessagePinned" => ChatEventMessagePinned,
"chatEventMessageUnpinned" => ChatEventMessageUnpinned,
"chatEventMemberJoined" => ChatEventMemberJoined,
"chatEventMemberLeft" => ChatEventMemberLeft,
"chatEventMemberInvited" => ChatEventMemberInvited,
"chatEventMemberPromoted" => ChatEventMemberPromoted,
"chatEventMemberRestricted" => ChatEventMemberRestricted,
"chatEventTitleChanged" => ChatEventTitleChanged,
"chatEventPermissionsChanged" => ChatEventPermissionsChanged,
"chatEventDescriptionChanged" => ChatEventDescriptionChanged,
"chatEventUsernameChanged" => ChatEventUsernameChanged,
"chatEventPhotoChanged" => ChatEventPhotoChanged,
"chatEventInvitesToggled" => ChatEventInvitesToggled,
"chatEventLinkedChatChanged" => ChatEventLinkedChatChanged,
"chatEventSlowModeDelayChanged" => ChatEventSlowModeDelayChanged,
"chatEventSignMessagesToggled" => ChatEventSignMessagesToggled,
"chatEventStickerSetChanged" => ChatEventStickerSetChanged,
"chatEventLocationChanged" => ChatEventLocationChanged,
"chatEventIsAllHistoryAvailableToggled" => ChatEventIsAllHistoryAvailableToggled,
}
end
class LanguagePackStringValue < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"languagePackStringValueOrdinary" => LanguagePackStringValueOrdinary,
"languagePackStringValuePluralized" => LanguagePackStringValuePluralized,
"languagePackStringValueDeleted" => LanguagePackStringValueDeleted,
}
end
class DeviceToken < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"deviceTokenFirebaseCloudMessaging" => DeviceTokenFirebaseCloudMessaging,
"deviceTokenApplePush" => DeviceTokenApplePush,
"deviceTokenApplePushVoIP" => DeviceTokenApplePushVoIP,
"deviceTokenWindowsPush" => DeviceTokenWindowsPush,
"deviceTokenMicrosoftPush" => DeviceTokenMicrosoftPush,
"deviceTokenMicrosoftPushVoIP" => DeviceTokenMicrosoftPushVoIP,
"deviceTokenWebPush" => DeviceTokenWebPush,
"deviceTokenSimplePush" => DeviceTokenSimplePush,
"deviceTokenUbuntuPush" => DeviceTokenUbuntuPush,
"deviceTokenBlackBerryPush" => DeviceTokenBlackBerryPush,
"deviceTokenTizenPush" => DeviceTokenTizenPush,
}
end
class BackgroundFill < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"backgroundFillSolid" => BackgroundFillSolid,
"backgroundFillGradient" => BackgroundFillGradient,
}
end
class BackgroundType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"backgroundTypeWallpaper" => BackgroundTypeWallpaper,
"backgroundTypePattern" => BackgroundTypePattern,
"backgroundTypeFill" => BackgroundTypeFill,
}
end
class InputBackground < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"inputBackgroundLocal" => InputBackgroundLocal,
"inputBackgroundRemote" => InputBackgroundRemote,
}
end
class CanTransferOwnershipResult < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"canTransferOwnershipResultOk" => CanTransferOwnershipResultOk,
"canTransferOwnershipResultPasswordNeeded" => CanTransferOwnershipResultPasswordNeeded,
"canTransferOwnershipResultPasswordTooFresh" => CanTransferOwnershipResultPasswordTooFresh,
"canTransferOwnershipResultSessionTooFresh" => CanTransferOwnershipResultSessionTooFresh,
}
end
class CheckChatUsernameResult < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"checkChatUsernameResultOk" => CheckChatUsernameResultOk,
"checkChatUsernameResultUsernameInvalid" => CheckChatUsernameResultUsernameInvalid,
"checkChatUsernameResultUsernameOccupied" => CheckChatUsernameResultUsernameOccupied,
"checkChatUsernameResultPublicChatsTooMuch" => CheckChatUsernameResultPublicChatsTooMuch,
"checkChatUsernameResultPublicGroupsUnavailable" => CheckChatUsernameResultPublicGroupsUnavailable,
}
end
class PushMessageContent < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"pushMessageContentHidden" => PushMessageContentHidden,
"pushMessageContentAnimation" => PushMessageContentAnimation,
"pushMessageContentAudio" => PushMessageContentAudio,
"pushMessageContentContact" => PushMessageContentContact,
"pushMessageContentContactRegistered" => PushMessageContentContactRegistered,
"pushMessageContentDocument" => PushMessageContentDocument,
"pushMessageContentGame" => PushMessageContentGame,
"pushMessageContentGameScore" => PushMessageContentGameScore,
"pushMessageContentInvoice" => PushMessageContentInvoice,
"pushMessageContentLocation" => PushMessageContentLocation,
"pushMessageContentPhoto" => PushMessageContentPhoto,
"pushMessageContentPoll" => PushMessageContentPoll,
"pushMessageContentScreenshotTaken" => PushMessageContentScreenshotTaken,
"pushMessageContentSticker" => PushMessageContentSticker,
"pushMessageContentText" => PushMessageContentText,
"pushMessageContentVideo" => PushMessageContentVideo,
"pushMessageContentVideoNote" => PushMessageContentVideoNote,
"pushMessageContentVoiceNote" => PushMessageContentVoiceNote,
"pushMessageContentBasicGroupChatCreate" => PushMessageContentBasicGroupChatCreate,
"pushMessageContentChatAddMembers" => PushMessageContentChatAddMembers,
"pushMessageContentChatChangePhoto" => PushMessageContentChatChangePhoto,
"pushMessageContentChatChangeTitle" => PushMessageContentChatChangeTitle,
"pushMessageContentChatDeleteMember" => PushMessageContentChatDeleteMember,
"pushMessageContentChatJoinByLink" => PushMessageContentChatJoinByLink,
"pushMessageContentMessageForwards" => PushMessageContentMessageForwards,
"pushMessageContentMediaAlbum" => PushMessageContentMediaAlbum,
}
end
class NotificationType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"notificationTypeNewMessage" => NotificationTypeNewMessage,
"notificationTypeNewSecretChat" => NotificationTypeNewSecretChat,
"notificationTypeNewCall" => NotificationTypeNewCall,
"notificationTypeNewPushMessage" => NotificationTypeNewPushMessage,
}
end
class NotificationGroupType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"notificationGroupTypeMessages" => NotificationGroupTypeMessages,
"notificationGroupTypeMentions" => NotificationGroupTypeMentions,
"notificationGroupTypeSecretChat" => NotificationGroupTypeSecretChat,
"notificationGroupTypeCalls" => NotificationGroupTypeCalls,
}
end
class OptionValue < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"optionValueBoolean" => OptionValueBoolean,
"optionValueEmpty" => OptionValueEmpty,
"optionValueInteger" => OptionValueInteger,
"optionValueString" => OptionValueString,
}
end
class JsonValue < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"jsonValueNull" => JsonValueNull,
"jsonValueBoolean" => JsonValueBoolean,
"jsonValueNumber" => JsonValueNumber,
"jsonValueString" => JsonValueString,
"jsonValueArray" => JsonValueArray,
"jsonValueObject" => JsonValueObject,
}
end
class UserPrivacySettingRule < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"userPrivacySettingRuleAllowAll" => UserPrivacySettingRuleAllowAll,
"userPrivacySettingRuleAllowContacts" => UserPrivacySettingRuleAllowContacts,
"userPrivacySettingRuleAllowUsers" => UserPrivacySettingRuleAllowUsers,
"userPrivacySettingRuleAllowChatMembers" => UserPrivacySettingRuleAllowChatMembers,
"userPrivacySettingRuleRestrictAll" => UserPrivacySettingRuleRestrictAll,
"userPrivacySettingRuleRestrictContacts" => UserPrivacySettingRuleRestrictContacts,
"userPrivacySettingRuleRestrictUsers" => UserPrivacySettingRuleRestrictUsers,
"userPrivacySettingRuleRestrictChatMembers" => UserPrivacySettingRuleRestrictChatMembers,
}
end
class UserPrivacySetting < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"userPrivacySettingShowStatus" => UserPrivacySettingShowStatus,
"userPrivacySettingShowProfilePhoto" => UserPrivacySettingShowProfilePhoto,
"userPrivacySettingShowLinkInForwardedMessages" => UserPrivacySettingShowLinkInForwardedMessages,
"userPrivacySettingShowPhoneNumber" => UserPrivacySettingShowPhoneNumber,
"userPrivacySettingAllowChatInvites" => UserPrivacySettingAllowChatInvites,
"userPrivacySettingAllowCalls" => UserPrivacySettingAllowCalls,
"userPrivacySettingAllowPeerToPeerCalls" => UserPrivacySettingAllowPeerToPeerCalls,
"userPrivacySettingAllowFindingByPhoneNumber" => UserPrivacySettingAllowFindingByPhoneNumber,
}
end
class ChatReportReason < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"chatReportReasonSpam" => ChatReportReasonSpam,
"chatReportReasonViolence" => ChatReportReasonViolence,
"chatReportReasonPornography" => ChatReportReasonPornography,
"chatReportReasonChildAbuse" => ChatReportReasonChildAbuse,
"chatReportReasonCopyright" => ChatReportReasonCopyright,
"chatReportReasonUnrelatedLocation" => ChatReportReasonUnrelatedLocation,
"chatReportReasonCustom" => ChatReportReasonCustom,
}
end
class FileType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"fileTypeNone" => FileTypeNone,
"fileTypeAnimation" => FileTypeAnimation,
"fileTypeAudio" => FileTypeAudio,
"fileTypeDocument" => FileTypeDocument,
"fileTypePhoto" => FileTypePhoto,
"fileTypeProfilePhoto" => FileTypeProfilePhoto,
"fileTypeSecret" => FileTypeSecret,
"fileTypeSecretThumbnail" => FileTypeSecretThumbnail,
"fileTypeSecure" => FileTypeSecure,
"fileTypeSticker" => FileTypeSticker,
"fileTypeThumbnail" => FileTypeThumbnail,
"fileTypeUnknown" => FileTypeUnknown,
"fileTypeVideo" => FileTypeVideo,
"fileTypeVideoNote" => FileTypeVideoNote,
"fileTypeVoiceNote" => FileTypeVoiceNote,
"fileTypeWallpaper" => FileTypeWallpaper,
}
end
class NetworkType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"networkTypeNone" => NetworkTypeNone,
"networkTypeMobile" => NetworkTypeMobile,
"networkTypeMobileRoaming" => NetworkTypeMobileRoaming,
"networkTypeWiFi" => NetworkTypeWiFi,
"networkTypeOther" => NetworkTypeOther,
}
end
class NetworkStatisticsEntry < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"networkStatisticsEntryFile" => NetworkStatisticsEntryFile,
"networkStatisticsEntryCall" => NetworkStatisticsEntryCall,
}
end
class ConnectionState < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"connectionStateWaitingForNetwork" => ConnectionStateWaitingForNetwork,
"connectionStateConnectingToProxy" => ConnectionStateConnectingToProxy,
"connectionStateConnecting" => ConnectionStateConnecting,
"connectionStateUpdating" => ConnectionStateUpdating,
"connectionStateReady" => ConnectionStateReady,
}
end
class TopChatCategory < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"topChatCategoryUsers" => TopChatCategoryUsers,
"topChatCategoryBots" => TopChatCategoryBots,
"topChatCategoryGroups" => TopChatCategoryGroups,
"topChatCategoryChannels" => TopChatCategoryChannels,
"topChatCategoryInlineBots" => TopChatCategoryInlineBots,
"topChatCategoryCalls" => TopChatCategoryCalls,
"topChatCategoryForwardChats" => TopChatCategoryForwardChats,
}
end
class TMeUrlType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"tMeUrlTypeUser" => TMeUrlTypeUser,
"tMeUrlTypeSupergroup" => TMeUrlTypeSupergroup,
"tMeUrlTypeChatInvite" => TMeUrlTypeChatInvite,
"tMeUrlTypeStickerSet" => TMeUrlTypeStickerSet,
}
end
class TextParseMode < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"textParseModeMarkdown" => TextParseModeMarkdown,
"textParseModeHTML" => TextParseModeHTML,
}
end
class ProxyType < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"proxyTypeSocks5" => ProxyTypeSocks5,
"proxyTypeHttp" => ProxyTypeHttp,
"proxyTypeMtproto" => ProxyTypeMtproto,
}
end
class Update < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"updateAuthorizationState" => UpdateAuthorizationState,
"updateNewMessage" => UpdateNewMessage,
"updateMessageSendAcknowledged" => UpdateMessageSendAcknowledged,
"updateMessageSendSucceeded" => UpdateMessageSendSucceeded,
"updateMessageSendFailed" => UpdateMessageSendFailed,
"updateMessageContent" => UpdateMessageContent,
"updateMessageEdited" => UpdateMessageEdited,
"updateMessageViews" => UpdateMessageViews,
"updateMessageContentOpened" => UpdateMessageContentOpened,
"updateMessageMentionRead" => UpdateMessageMentionRead,
"updateMessageLiveLocationViewed" => UpdateMessageLiveLocationViewed,
"updateNewChat" => UpdateNewChat,
"updateChatChatList" => UpdateChatChatList,
"updateChatTitle" => UpdateChatTitle,
"updateChatPhoto" => UpdateChatPhoto,
"updateChatPermissions" => UpdateChatPermissions,
"updateChatLastMessage" => UpdateChatLastMessage,
"updateChatOrder" => UpdateChatOrder,
"updateChatIsPinned" => UpdateChatIsPinned,
"updateChatIsMarkedAsUnread" => UpdateChatIsMarkedAsUnread,
"updateChatIsSponsored" => UpdateChatIsSponsored,
"updateChatHasScheduledMessages" => UpdateChatHasScheduledMessages,
"updateChatDefaultDisableNotification" => UpdateChatDefaultDisableNotification,
"updateChatReadInbox" => UpdateChatReadInbox,
"updateChatReadOutbox" => UpdateChatReadOutbox,
"updateChatUnreadMentionCount" => UpdateChatUnreadMentionCount,
"updateChatNotificationSettings" => UpdateChatNotificationSettings,
"updateScopeNotificationSettings" => UpdateScopeNotificationSettings,
"updateChatActionBar" => UpdateChatActionBar,
"updateChatPinnedMessage" => UpdateChatPinnedMessage,
"updateChatReplyMarkup" => UpdateChatReplyMarkup,
"updateChatDraftMessage" => UpdateChatDraftMessage,
"updateChatOnlineMemberCount" => UpdateChatOnlineMemberCount,
"updateNotification" => UpdateNotification,
"updateNotificationGroup" => UpdateNotificationGroup,
"updateActiveNotifications" => UpdateActiveNotifications,
"updateHavePendingNotifications" => UpdateHavePendingNotifications,
"updateDeleteMessages" => UpdateDeleteMessages,
"updateUserChatAction" => UpdateUserChatAction,
"updateUserStatus" => UpdateUserStatus,
"updateUser" => UpdateUser,
"updateBasicGroup" => UpdateBasicGroup,
"updateSupergroup" => UpdateSupergroup,
"updateSecretChat" => UpdateSecretChat,
"updateUserFullInfo" => UpdateUserFullInfo,
"updateBasicGroupFullInfo" => UpdateBasicGroupFullInfo,
"updateSupergroupFullInfo" => UpdateSupergroupFullInfo,
"updateServiceNotification" => UpdateServiceNotification,
"updateFile" => UpdateFile,
"updateFileGenerationStart" => UpdateFileGenerationStart,
"updateFileGenerationStop" => UpdateFileGenerationStop,
"updateCall" => UpdateCall,
"updateUserPrivacySettingRules" => UpdateUserPrivacySettingRules,
"updateUnreadMessageCount" => UpdateUnreadMessageCount,
"updateUnreadChatCount" => UpdateUnreadChatCount,
"updateOption" => UpdateOption,
"updateInstalledStickerSets" => UpdateInstalledStickerSets,
"updateTrendingStickerSets" => UpdateTrendingStickerSets,
"updateRecentStickers" => UpdateRecentStickers,
"updateFavoriteStickers" => UpdateFavoriteStickers,
"updateSavedAnimations" => UpdateSavedAnimations,
"updateSelectedBackground" => UpdateSelectedBackground,
"updateLanguagePackStrings" => UpdateLanguagePackStrings,
"updateConnectionState" => UpdateConnectionState,
"updateTermsOfService" => UpdateTermsOfService,
"updateUsersNearby" => UpdateUsersNearby,
"updateNewInlineQuery" => UpdateNewInlineQuery,
"updateNewChosenInlineResult" => UpdateNewChosenInlineResult,
"updateNewCallbackQuery" => UpdateNewCallbackQuery,
"updateNewInlineCallbackQuery" => UpdateNewInlineCallbackQuery,
"updateNewShippingQuery" => UpdateNewShippingQuery,
"updateNewPreCheckoutQuery" => UpdateNewPreCheckoutQuery,
"updateNewCustomEvent" => UpdateNewCustomEvent,
"updateNewCustomQuery" => UpdateNewCustomQuery,
"updatePoll" => UpdatePoll,
"updatePollAnswer" => UpdatePollAnswer,
}
end
class LogStream < TLObject
include JSON::Serializable
use_json_discriminator "@type", {
"logStreamDefault" => LogStreamDefault,
"logStreamFile" => LogStreamFile,
"logStreamEmpty" => LogStreamEmpty,
}
end
# An object of this type can be returned on every function call, in case of an error
class Error < TLObject
@[JSON::Field(key: "@type")]
getter _type = "error"
# Error code; subject to future changes. If the error code is 406, the error message must not be processed in any way and must not be displayed to the user
property code : Int32
# Error message; subject to future changes
property message : String
def initialize(
@code : Int32,
@message : String
)
end
end
# An object of this type is returned on a successful function call for certain functions
class Ok < TLObject
@[JSON::Field(key: "@type")]
getter _type = "ok"
def initialize
end
end
# Contains parameters for TDLib initialization
class TdlibParameters < TLObject
@[JSON::Field(key: "@type")]
getter _type = "tdlibParameters"
# If set to true, the Telegram test environment will be used instead of the production environment
property use_test_dc : Bool
# The path to the directory for the persistent database; if empty, the current working directory will be used
property database_directory : String
# The path to the directory for storing files; if empty, database_directory will be used
property files_directory : String
# If set to true, information about downloaded and uploaded files will be saved between application restarts
property use_file_database : Bool
# If set to true, the library will maintain a cache of users, basic groups, supergroups, channels and secret chats. Implies use_file_database
property use_chat_info_database : Bool
# If set to true, the library will maintain a cache of chats and messages. Implies use_chat_info_database
property use_message_database : Bool
# If set to true, support for secret chats will be enabled
property use_secret_chats : Bool
# Application identifier for Telegram API access, which can be obtained at https://my.telegram.org
property api_id : Int32
# Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org
property api_hash : String
# IETF language tag of the user's operating system language; must be non-empty
property system_language_code : String
# Model of the device the application is being run on; must be non-empty
property device_model : String
# Version of the operating system the application is being run on; must be non-empty
property system_version : String
# Application version; must be non-empty
property application_version : String
# If set to true, old files will automatically be deleted
property enable_storage_optimizer : Bool
# If set to true, original file names will be ignored. Otherwise, downloaded files will be saved under names as close as possible to the original name
property ignore_file_names : Bool
def initialize(
@use_test_dc : Bool,
@database_directory : String,
@files_directory : String,
@use_file_database : Bool,
@use_chat_info_database : Bool,
@use_message_database : Bool,
@use_secret_chats : Bool,
@api_id : Int32,
@api_hash : String,
@system_language_code : String,
@device_model : String,
@system_version : String,
@application_version : String,
@enable_storage_optimizer : Bool,
@ignore_file_names : Bool
)
end
end
# An authentication code is delivered via a private Telegram message, which can be viewed in another client
class AuthenticationCodeTypeTelegramMessage < AuthenticationCodeType
@[JSON::Field(key: "@type")]
getter _type = "authenticationCodeTypeTelegramMessage"
# Length of the code
property length : Int32
def initialize(
@length : Int32
)
end
end
# An authentication code is delivered via an SMS message to the specified phone number
class AuthenticationCodeTypeSms < AuthenticationCodeType
@[JSON::Field(key: "@type")]
getter _type = "authenticationCodeTypeSms"
# Length of the code
property length : Int32
def initialize(
@length : Int32
)
end
end
# An authentication code is delivered via a phone call to the specified phone number
class AuthenticationCodeTypeCall < AuthenticationCodeType
@[JSON::Field(key: "@type")]
getter _type = "authenticationCodeTypeCall"
# Length of the code
property length : Int32
def initialize(
@length : Int32
)
end
end
# An authentication code is delivered by an immediately cancelled call to the specified phone number. The number from which the call was made is the code
class AuthenticationCodeTypeFlashCall < AuthenticationCodeType
@[JSON::Field(key: "@type")]
getter _type = "authenticationCodeTypeFlashCall"
# Pattern of the phone number from which the call will be made
property pattern : String
def initialize(
@pattern : String
)
end
end
# Information about the authentication code that was sent
class AuthenticationCodeInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "authenticationCodeInfo"
# A phone number that is being authenticated
property phone_number : String
# Describes the way the code was sent to the user
property type : AuthenticationCodeType
# Timeout before the code should be re-sent, in seconds
property timeout : Int32
# Describes the way the next code will be sent to the user; may be null
property next_type : AuthenticationCodeType?
def initialize(
@phone_number : String,
@type : AuthenticationCodeType,
@timeout : Int32,
@next_type : AuthenticationCodeType? = nil
)
end
end
# Information about the email address authentication code that was sent
class EmailAddressAuthenticationCodeInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "emailAddressAuthenticationCodeInfo"
# Pattern of the email address to which an authentication code was sent
property email_address_pattern : String
# Length of the code; 0 if unknown
property length : Int32
def initialize(
@email_address_pattern : String,
@length : Int32
)
end
end
# Represents a part of the text that needs to be formatted in some unusual way
class TextEntity < TLObject
@[JSON::Field(key: "@type")]
getter _type = "textEntity"
# Offset of the entity in UTF-16 code units
property offset : Int32
# Length of the entity, in UTF-16 code units
property length : Int32
# Type of the entity
property type : TextEntityType
def initialize(
@offset : Int32,
@length : Int32,
@type : TextEntityType
)
end
end
# Contains a list of text entities
class TextEntities < TLObject
@[JSON::Field(key: "@type")]
getter _type = "textEntities"
# List of text entities
property entities : Array(TextEntity)
def initialize(
@entities : Array(TextEntity)
)
end
end
# A text with some entities
class FormattedText < TLObject
@[JSON::Field(key: "@type")]
getter _type = "formattedText"
# The text
property text : String
# Entities contained in the text. Entities can be nested, but must not mutually intersect with each other.
# Pre, Code and PreCode entities can't contain other entities. Bold, Italic, Underline and Strikethrough entities can contain and to be contained in all other entities. All other entities can't contain each other
property entities : Array(TextEntity)
def initialize(
@text : String,
@entities : Array(TextEntity)
)
end
end
# Contains Telegram terms of service
class TermsOfService < TLObject
@[JSON::Field(key: "@type")]
getter _type = "termsOfService"
# Text of the terms of service
property text : FormattedText
# The minimum age of a user to be able to accept the terms; 0 if any
property min_user_age : Int32
# True, if a blocking popup with terms of service must be shown to the user
property show_popup : Bool
def initialize(
@text : FormattedText,
@min_user_age : Int32,
@show_popup : Bool
)
end
end
# TDLib needs TdlibParameters for initialization
class AuthorizationStateWaitTdlibParameters < AuthorizationState
@[JSON::Field(key: "@type")]
getter _type = "authorizationStateWaitTdlibParameters"
def initialize
end
end
# TDLib needs an encryption key to decrypt the local database
class AuthorizationStateWaitEncryptionKey < AuthorizationState
@[JSON::Field(key: "@type")]
getter _type = "authorizationStateWaitEncryptionKey"
# True, if the database is currently encrypted
property is_encrypted : Bool
def initialize(
@is_encrypted : Bool
)
end
end
# TDLib needs the user's phone number to authorize. Call `setAuthenticationPhoneNumber` to provide the phone number, or use `requestQrCodeAuthentication`, or `checkAuthenticationBotToken` for other authentication options
class AuthorizationStateWaitPhoneNumber < AuthorizationState
@[JSON::Field(key: "@type")]
getter _type = "authorizationStateWaitPhoneNumber"
def initialize
end
end
# TDLib needs the user's authentication code to authorize
class AuthorizationStateWaitCode < AuthorizationState
@[JSON::Field(key: "@type")]
getter _type = "authorizationStateWaitCode"
# Information about the authorization code that was sent
property code_info : AuthenticationCodeInfo
def initialize(
@code_info : AuthenticationCodeInfo
)
end
end
# The user needs to confirm authorization on another logged in device by scanning a QR code with the provided link
class AuthorizationStateWaitOtherDeviceConfirmation < AuthorizationState
@[JSON::Field(key: "@type")]
getter _type = "authorizationStateWaitOtherDeviceConfirmation"
# A tg:// URL for the QR code. The link will be updated frequently
property link : String
def initialize(
@link : String
)
end
end
# The user is unregistered and need to accept terms of service and enter their first name and last name to finish registration
class AuthorizationStateWaitRegistration < AuthorizationState
@[JSON::Field(key: "@type")]
getter _type = "authorizationStateWaitRegistration"
# Telegram terms of service
property terms_of_service : TermsOfService
def initialize(
@terms_of_service : TermsOfService
)
end
end
# The user has been authorized, but needs to enter a password to start using the application
class AuthorizationStateWaitPassword < AuthorizationState
@[JSON::Field(key: "@type")]
getter _type = "authorizationStateWaitPassword"
# True, if a recovery email address has been set up
property has_recovery_email_address : Bool
# Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent
property recovery_email_address_pattern : String
# Hint for the password; may be empty
property password_hint : String?
def initialize(
@has_recovery_email_address : Bool,
@recovery_email_address_pattern : String,
@password_hint : String? = nil
)
end
end
# The user has been successfully authorized. TDLib is now ready to answer queries
class AuthorizationStateReady < AuthorizationState
@[JSON::Field(key: "@type")]
getter _type = "authorizationStateReady"
def initialize
end
end
# The user is currently logging out
class AuthorizationStateLoggingOut < AuthorizationState
@[JSON::Field(key: "@type")]
getter _type = "authorizationStateLoggingOut"
def initialize
end
end
# TDLib is closing, all subsequent queries will be answered with the error 500. Note that closing TDLib can take a while. All resources will be freed only after authorizationStateClosed has been received
class AuthorizationStateClosing < AuthorizationState
@[JSON::Field(key: "@type")]
getter _type = "authorizationStateClosing"
def initialize
end
end
# TDLib client is in its final state. All databases are closed and all resources are released. No other updates will be received after this. All queries will be responded to
# with error code 500. To continue working, one should create a new instance of the TDLib client
class AuthorizationStateClosed < AuthorizationState
@[JSON::Field(key: "@type")]
getter _type = "authorizationStateClosed"
def initialize
end
end
# Represents the current state of 2-step verification
class PasswordState < TLObject
@[JSON::Field(key: "@type")]
getter _type = "passwordState"
# True, if a 2-step verification password is set
property has_password : Bool
# True, if a recovery email is set
property has_recovery_email_address : Bool
# True, if some Telegram Passport elements were saved
property has_passport_data : Bool
# Hint for the password; may be empty
property password_hint : String?
# Information about the recovery email address to which the confirmation email was sent; may be null
property recovery_email_address_code_info : EmailAddressAuthenticationCodeInfo?
def initialize(
@has_password : Bool,
@has_recovery_email_address : Bool,
@has_passport_data : Bool,
@password_hint : String? = nil,
@recovery_email_address_code_info : EmailAddressAuthenticationCodeInfo? = nil
)
end
end
# Contains information about the current recovery email address
class RecoveryEmailAddress < TLObject
@[JSON::Field(key: "@type")]
getter _type = "recoveryEmailAddress"
# Recovery email address
property recovery_email_address : String
def initialize(
@recovery_email_address : String
)
end
end
# Returns information about the availability of a temporary password, which can be used for payments
class TemporaryPasswordState < TLObject
@[JSON::Field(key: "@type")]
getter _type = "temporaryPasswordState"
# True, if a temporary password is available
property has_password : Bool
# Time left before the temporary password expires, in seconds
property valid_for : Int32
def initialize(
@has_password : Bool,
@valid_for : Int32
)
end
end
# Represents a local file
class LocalFile < TLObject
@[JSON::Field(key: "@type")]
getter _type = "localFile"
# True, if it is possible to try to download or generate the file
property can_be_downloaded : Bool
# True, if the file can be deleted
property can_be_deleted : Bool
# True, if the file is currently being downloaded (or a local copy is being generated by some other means)
property is_downloading_active : Bool
# True, if the local copy is fully available
property is_downloading_completed : Bool
# Download will be started from this offset. downloaded_prefix_size is calculated from this offset
property download_offset : Int32
# 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
property downloaded_prefix_size : Int32
# 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
property downloaded_size : Int32
# Local path to the locally available file part; may be empty
property path : String?
def initialize(
@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,
@path : String? = nil
)
end
end
# Represents a remote file
class RemoteFile < TLObject
@[JSON::Field(key: "@type")]
getter _type = "remoteFile"
# True, if the file is currently being uploaded (or a remote copy is being generated by some other means)
property is_uploading_active : Bool
# True, if a remote copy is fully available
property is_uploading_completed : Bool
# Size of the remote available part of the file; 0 if unknown
property uploaded_size : Int32
# Remote file identifier; may be empty. Can be used across application restarts or even from other devices for the current user. Uniquely identifies a file, but a file can have a lot of different valid identifiers.
# If the ID starts with "http://" or "https://", it represents the HTTP URL of the file. TDLib is currently unable to download files if only their URL is known.
# If downloadFile is called on such a file or if it is sent to a secret chat, TDLib starts a file generation process by sending updateFileGenerationStart to the client with the HTTP URL in the original_path and "#url#" as the conversion string. Clients should generate the file by downloading it to the specified location
property id : String?
# Unique file identifier; may be empty if unknown. The unique file identifier which is the same for the same file even for different users and is persistent over time
property unique_id : String?
def initialize(
@is_uploading_active : Bool,
@is_uploading_completed : Bool,
@uploaded_size : Int32,
@id : String? = nil,
@unique_id : String? = nil
)
end
end
# Represents a file
class File < TLObject
@[JSON::Field(key: "@type")]
getter _type = "file"
# Unique file identifier
property id : Int32
# File size; 0 if unknown
property size : Int32
# Expected file size in case the exact file size is unknown, but an approximate size is known. Can be used to show download/upload progress
property expected_size : Int32
# Information about the local copy of the file
property local : LocalFile
# Information about the remote copy of the file
property remote : RemoteFile
def initialize(
@id : Int32,
@size : Int32,
@expected_size : Int32,
@local : LocalFile,
@remote : RemoteFile
)
end
end
# A file defined by its unique ID
class InputFileId < InputFile
@[JSON::Field(key: "@type")]
getter _type = "inputFileId"
# Unique file identifier
property id : Int32
def initialize(
@id : Int32
)
end
end
# A file defined by its remote ID. The remote ID is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib.
# For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the client
class InputFileRemote < InputFile
@[JSON::Field(key: "@type")]
getter _type = "inputFileRemote"
# Remote file identifier
property id : String
def initialize(
@id : String
)
end
end
# A file defined by a local path
class InputFileLocal < InputFile
@[JSON::Field(key: "@type")]
getter _type = "inputFileLocal"
# Local path to the file
property path : String
def initialize(
@path : String
)
end
end
# A file generated by the client
class InputFileGenerated < InputFile
@[JSON::Field(key: "@type")]
getter _type = "inputFileGenerated"
# String specifying the conversion applied to the original file; should be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage
property conversion : String
# Expected size of the generated file; 0 if unknown
property expected_size : Int32
# Local path to a file from which the file is generated; may be empty if there is no such file
property original_path : String?
def initialize(
@conversion : String,
@expected_size : Int32,
@original_path : String? = nil
)
end
end
# Photo description
class PhotoSize < TLObject
@[JSON::Field(key: "@type")]
getter _type = "photoSize"
# Thumbnail type (see https://core.telegram.org/constructor/photoSize)
property type : String
# Information about the photo file
property photo : File
# Photo width
property width : Int32
# Photo height
property height : Int32
def initialize(
@type : String,
@photo : File,
@width : Int32,
@height : Int32
)
end
end
# Thumbnail image of a very poor quality and low resolution
class Minithumbnail < TLObject
@[JSON::Field(key: "@type")]
getter _type = "minithumbnail"
# Thumbnail width, usually doesn't exceed 40
property width : Int32
# Thumbnail height, usually doesn't exceed 40
property height : Int32
# The thumbnail in JPEG format
property data : String
def initialize(
@width : Int32,
@height : Int32,
@data : String
)
end
end
# A mask should be placed relatively to the forehead
class MaskPointForehead < MaskPoint
@[JSON::Field(key: "@type")]
getter _type = "maskPointForehead"
def initialize
end
end
# A mask should be placed relatively to the eyes
class MaskPointEyes < MaskPoint
@[JSON::Field(key: "@type")]
getter _type = "maskPointEyes"
def initialize
end
end
# A mask should be placed relatively to the mouth
class MaskPointMouth < MaskPoint
@[JSON::Field(key: "@type")]
getter _type = "maskPointMouth"
def initialize
end
end
# A mask should be placed relatively to the chin
class MaskPointChin < MaskPoint
@[JSON::Field(key: "@type")]
getter _type = "maskPointChin"
def initialize
end
end
# Position on a photo where a mask should be placed
class MaskPosition < TLObject
@[JSON::Field(key: "@type")]
getter _type = "maskPosition"
# Part of the face, relative to which the mask should be placed
property point : MaskPoint
# Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. (For example, -1.0 will place the mask just to the left of the default mask position)
property x_shift : Float64
# Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. (For example, 1.0 will place the mask just below the default mask position)
property y_shift : Float64
# Mask scaling coefficient. (For example, 2.0 means a doubled size)
property scale : Float64
def initialize(
@point : MaskPoint,
@x_shift : Float64,
@y_shift : Float64,
@scale : Float64
)
end
end
# Describes one answer option of a poll
class PollOption < TLObject
@[JSON::Field(key: "@type")]
getter _type = "pollOption"
# Option text, 1-100 characters
property text : String
# Number of voters for this option, available only for closed or voted polls
property voter_count : Int32
# The percentage of votes for this option, 0-100
property vote_percentage : Int32
# True, if the option was chosen by the user
property is_chosen : Bool
# True, if the option is being chosen by a pending setPollAnswer request
property is_being_chosen : Bool
def initialize(
@text : String,
@voter_count : Int32,
@vote_percentage : Int32,
@is_chosen : Bool,
@is_being_chosen : Bool
)
end
end
# A regular poll
class PollTypeRegular < PollType
@[JSON::Field(key: "@type")]
getter _type = "pollTypeRegular"
# True, if multiple answer options can be chosen simultaneously
property allow_multiple_answers : Bool
def initialize(
@allow_multiple_answers : Bool
)
end
end
# A poll in quiz mode, which has exactly one correct answer option and can be answered only once
class PollTypeQuiz < PollType
@[JSON::Field(key: "@type")]
getter _type = "pollTypeQuiz"
# 0-based identifier of the correct answer option; -1 for a yet unanswered poll
property correct_option_id : Int32
def initialize(
@correct_option_id : Int32
)
end
end
# Describes an animation file. The animation must be encoded in GIF or MPEG4 format
class Animation < TLObject
@[JSON::Field(key: "@type")]
getter _type = "animation"
# Duration of the animation, in seconds; as defined by the sender
property duration : Int32
# Width of the animation
property width : Int32
# Height of the animation
property height : Int32
# Original name of the file; as defined by the sender
property file_name : String
# MIME type of the file, usually "image/gif" or "video/mp4"
property mime_type : String
# File containing the animation
property animation : File
# Animation minithumbnail; may be null
property minithumbnail : Minithumbnail?
# Animation thumbnail; may be null
property thumbnail : PhotoSize?
def initialize(
@duration : Int32,
@width : Int32,
@height : Int32,
@file_name : String,
@mime_type : String,
@animation : File,
@minithumbnail : Minithumbnail? = nil,
@thumbnail : PhotoSize? = nil
)
end
end
# Describes an audio file. Audio is usually in MP3 or M4A format
class Audio < TLObject
@[JSON::Field(key: "@type")]
getter _type = "audio"
# Duration of the audio, in seconds; as defined by the sender
property duration : Int32
# Title of the audio; as defined by the sender
property title : String
# Performer of the audio; as defined by the sender
property performer : String
# Original name of the file; as defined by the sender
property file_name : String
# The MIME type of the file; as defined by the sender
property mime_type : String
# File containing the audio
property audio : File
# The minithumbnail of the album cover; may be null
property album_cover_minithumbnail : Minithumbnail?
# The thumbnail of the album cover; as defined by the sender. The full size thumbnail should be extracted from the downloaded file; may be null
property album_cover_thumbnail : PhotoSize?
def initialize(
@duration : Int32,
@title : String,
@performer : String,
@file_name : String,
@mime_type : String,
@audio : File,
@album_cover_minithumbnail : Minithumbnail? = nil,
@album_cover_thumbnail : PhotoSize? = nil
)
end
end
# Describes a document of any type
class Document < TLObject
@[JSON::Field(key: "@type")]
getter _type = "document"
# Original name of the file; as defined by the sender
property file_name : String
# MIME type of the file; as defined by the sender
property mime_type : String
# File containing the document
property document : File
# Document minithumbnail; may be null
property minithumbnail : Minithumbnail?
# Document thumbnail in JPEG or PNG format (PNG will be used only for background patterns); as defined by the sender; may be null
property thumbnail : PhotoSize?
def initialize(
@file_name : String,
@mime_type : String,
@document : File,
@minithumbnail : Minithumbnail? = nil,
@thumbnail : PhotoSize? = nil
)
end
end
# Describes a photo
class Photo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "photo"
# True, if stickers were added to the photo
property has_stickers : Bool
# Available variants of the photo, in different sizes
property sizes : Array(PhotoSize)
# Photo minithumbnail; may be null
property minithumbnail : Minithumbnail?
def initialize(
@has_stickers : Bool,
@sizes : Array(PhotoSize),
@minithumbnail : Minithumbnail? = nil
)
end
end
# Describes a sticker
class Sticker < TLObject
@[JSON::Field(key: "@type")]
getter _type = "sticker"
# The identifier of the sticker set to which the sticker belongs; 0 if none
property set_id : String
# Sticker width; as defined by the sender
property width : Int32
# Sticker height; as defined by the sender
property height : Int32
# Emoji corresponding to the sticker
property emoji : String
# True, if the sticker is an animated sticker in TGS format
property is_animated : Bool
# True, if the sticker is a mask
property is_mask : Bool
# File containing the sticker
property sticker : File
# Position where the mask should be placed; may be null
property mask_position : MaskPosition?
# Sticker thumbnail in WEBP or JPEG format; may be null
property thumbnail : PhotoSize?
def initialize(
@set_id : String,
@width : Int32,
@height : Int32,
@emoji : String,
@is_animated : Bool,
@is_mask : Bool,
@sticker : File,
@mask_position : MaskPosition? = nil,
@thumbnail : PhotoSize? = nil
)
end
end
# Describes a video file
class Video < TLObject
@[JSON::Field(key: "@type")]
getter _type = "video"
# Duration of the video, in seconds; as defined by the sender
property duration : Int32
# Video width; as defined by the sender
property width : Int32
# Video height; as defined by the sender
property height : Int32
# Original name of the file; as defined by the sender
property file_name : String
# MIME type of the file; as defined by the sender
property mime_type : String
# True, if stickers were added to the video
property has_stickers : Bool
# True, if the video should be tried to be streamed
property supports_streaming : Bool
# File containing the video
property video : File
# Video minithumbnail; may be null
property minithumbnail : Minithumbnail?
# Video thumbnail; as defined by the sender; may be null
property thumbnail : PhotoSize?
def initialize(
@duration : Int32,
@width : Int32,
@height : Int32,
@file_name : String,
@mime_type : String,
@has_stickers : Bool,
@supports_streaming : Bool,
@video : File,
@minithumbnail : Minithumbnail? = nil,
@thumbnail : PhotoSize? = nil
)
end
end
# Describes a video note. The video must be equal in width and height, cropped to a circle, and stored in MPEG4 format
class VideoNote < TLObject
@[JSON::Field(key: "@type")]
getter _type = "videoNote"
# Duration of the video, in seconds; as defined by the sender
property duration : Int32
# Video width and height; as defined by the sender
property length : Int32
# File containing the video
property video : File
# Video minithumbnail; may be null
property minithumbnail : Minithumbnail?
# Video thumbnail; as defined by the sender; may be null
property thumbnail : PhotoSize?
def initialize(
@duration : Int32,
@length : Int32,
@video : File,
@minithumbnail : Minithumbnail? = nil,
@thumbnail : PhotoSize? = nil
)
end
end
# Describes a voice note. The voice note must be encoded with the Opus codec, and stored inside an OGG container. Voice notes can have only a single audio channel
class VoiceNote < TLObject
@[JSON::Field(key: "@type")]
getter _type = "voiceNote"
# Duration of the voice note, in seconds; as defined by the sender
property duration : Int32
# A waveform representation of the voice note in 5-bit format
property waveform : String
# MIME type of the file; as defined by the sender
property mime_type : String
# File containing the voice note
property voice : File
def initialize(
@duration : Int32,
@waveform : String,
@mime_type : String,
@voice : File
)
end
end
# Describes a user contact
class Contact < TLObject
@[JSON::Field(key: "@type")]
getter _type = "contact"
# Phone number of the user
property phone_number : String
# First name of the user; 1-255 characters in length
property first_name : String
# Last name of the user
property last_name : String
# Additional data about the user in a form of vCard; 0-2048 bytes in length
property vcard : String
# Identifier of the user, if known; otherwise 0
property user_id : Int32
def initialize(
@phone_number : String,
@first_name : String,
@last_name : String,
@vcard : String,
@user_id : Int32
)
end
end
# Describes a location on planet Earth
class Location < TLObject
@[JSON::Field(key: "@type")]
getter _type = "location"
# Latitude of the location in degrees; as defined by the sender
property latitude : Float64
# Longitude of the location, in degrees; as defined by the sender
property longitude : Float64
def initialize(
@latitude : Float64,
@longitude : Float64
)
end
end
# Describes a venue
class Venue < TLObject
@[JSON::Field(key: "@type")]
getter _type = "venue"
# Venue location; as defined by the sender
property location : Location
# Venue name; as defined by the sender
property title : String
# Venue address; as defined by the sender
property address : String
# Provider of the venue database; as defined by the sender. Currently only "foursquare" needs to be supported
property provider : String
# Identifier of the venue in the provider database; as defined by the sender
property id : String
# Type of the venue in the provider database; as defined by the sender
property type : String
def initialize(
@location : Location,
@title : String,
@address : String,
@provider : String,
@id : String,
@type : String
)
end
end
# Describes a game
class Game < TLObject
@[JSON::Field(key: "@type")]
getter _type = "game"
# Game ID
property id : String
# Game short name. To share a game use the URL https://t.me/{bot_username}?game={game_short_name}
property short_name : String
# Game title
property title : String
# Game text, usually containing scoreboards for a game
property text : FormattedText
# Describes a game
property description : String
# Game photo
property photo : Photo
# Game animation; may be null
property animation : Animation?
def initialize(
@id : String,
@short_name : String,
@title : String,
@text : FormattedText,
@description : String,
@photo : Photo,
@animation : Animation? = nil
)
end
end
# Describes a poll
class Poll < TLObject
@[JSON::Field(key: "@type")]
getter _type = "poll"
# Unique poll identifier
property id : String
# Poll question, 1-255 characters
property question : String
# List of poll answer options
property options : Array(PollOption)
# Total number of voters, participating in the poll
property total_voter_count : Int32
# User identifiers of recent voters, if the poll is non-anonymous
property recent_voter_user_ids : Array(Int32)
# True, if the poll is anonymous
property is_anonymous : Bool
# Type of the poll
property type : PollType
# True, if the poll is closed
property is_closed : Bool
def initialize(
@id : String,
@question : String,
@options : Array(PollOption),
@total_voter_count : Int32,
@recent_voter_user_ids : Array(Int32),
@is_anonymous : Bool,
@type : PollType,
@is_closed : Bool
)
end
end
# Describes a user profile photo
class ProfilePhoto < TLObject
@[JSON::Field(key: "@type")]
getter _type = "profilePhoto"
# Photo identifier; 0 for an empty photo. Can be used to find a photo in a list of userProfilePhotos
property id : String
# A small (160x160) user profile photo. The file can be downloaded only before the photo is changed
property small : File
# A big (640x640) user profile photo. The file can be downloaded only before the photo is changed
property big : File
def initialize(
@id : String,
@small : File,
@big : File
)
end
end
# Describes the photo of a chat
class ChatPhoto < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatPhoto"
# A small (160x160) chat photo. The file can be downloaded only before the photo is changed
property small : File
# A big (640x640) chat photo. The file can be downloaded only before the photo is changed
property big : File
def initialize(
@small : File,
@big : File
)
end
end
# A regular user
class UserTypeRegular < UserType
@[JSON::Field(key: "@type")]
getter _type = "userTypeRegular"
def initialize
end
end
# A deleted user or deleted bot. No information on the user besides the user identifier is available. It is not possible to perform any active actions on this type of user
class UserTypeDeleted < UserType
@[JSON::Field(key: "@type")]
getter _type = "userTypeDeleted"
def initialize
end
end
# A bot (see https://core.telegram.org/bots)
class UserTypeBot < UserType
@[JSON::Field(key: "@type")]
getter _type = "userTypeBot"
# True, if the bot can be invited to basic group and supergroup chats
property can_join_groups : Bool
# True, if the bot can read all messages in basic group or supergroup chats and not just those addressed to the bot. In private and channel chats a bot can always read all messages
property can_read_all_group_messages : Bool
# True, if the bot supports inline queries
property is_inline : Bool
# Placeholder for inline queries (displayed on the client input field)
property inline_query_placeholder : String
# True, if the location of the user should be sent with every inline query to this bot
property need_location : Bool
def initialize(
@can_join_groups : Bool,
@can_read_all_group_messages : Bool,
@is_inline : Bool,
@inline_query_placeholder : String,
@need_location : Bool
)
end
end
# No information on the user besides the user identifier is available, yet this user has not been deleted. This object is extremely rare and must be handled like a deleted user. It is not possible to perform any actions on users of this type
class UserTypeUnknown < UserType
@[JSON::Field(key: "@type")]
getter _type = "userTypeUnknown"
def initialize
end
end
# Represents commands supported by a bot
class BotCommand < TLObject
@[JSON::Field(key: "@type")]
getter _type = "botCommand"
# Text of the bot command
property command : String
# Represents commands supported by a bot
property description : String
def initialize(
@command : String,
@description : String
)
end
end
# Provides information about a bot and its supported commands
class BotInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "botInfo"
# Provides information about a bot and its supported commands
property description : String
# A list of commands supported by the bot
property commands : Array(BotCommand)
def initialize(
@description : String,
@commands : Array(BotCommand)
)
end
end
# Represents a location to which a chat is connected
class ChatLocation < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatLocation"
# The location
property location : Location
# Location address; 1-64 characters, as defined by the chat owner
property address : String
def initialize(
@location : Location,
@address : String
)
end
end
# Represents a user
class User < TLObject
@[JSON::Field(key: "@type")]
getter _type = "user"
# User identifier
property id : Int32
# First name of the user
property first_name : String
# Last name of the user
property last_name : String
# Username of the user
property username : String
# Phone number of the user
property phone_number : String
# Current online status of the user
property status : UserStatus
# The user is a contact of the current user
property is_contact : Bool
# The user is a contact of the current user and the current user is a contact of the user
property is_mutual_contact : Bool
# True, if the user is verified
property is_verified : Bool
# True, if the user is Telegram support account
property is_support : Bool
# If non-empty, it contains a human-readable description of the reason why access to this user must be restricted
property restriction_reason : String
# True, if many users reported this user as a scam
property is_scam : Bool
# 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
property have_access : Bool
# Type of the user
property type : UserType
# IETF language tag of the user's language; only available to bots
property language_code : String
# Profile photo of the user; may be null
property profile_photo : ProfilePhoto?
def initialize(
@id : Int32,
@first_name : String,
@last_name : String,
@username : String,
@phone_number : String,
@status : UserStatus,
@is_contact : Bool,
@is_mutual_contact : Bool,
@is_verified : Bool,
@is_support : Bool,
@restriction_reason : String,
@is_scam : Bool,
@have_access : Bool,
@type : UserType,
@language_code : String,
@profile_photo : ProfilePhoto? = nil
)
end
end
# Contains full information about a user (except the full list of profile photos)
class UserFullInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "userFullInfo"
# True, if the user is blacklisted by the current user
property is_blocked : Bool
# True, if the user can be called
property can_be_called : Bool
# True, if the user can't be called due to their privacy settings
property has_private_calls : Bool
# True, if the current user needs to explicitly allow to share their phone number with the user when the method addContact is used
property need_phone_number_privacy_exception : Bool
# A short user bio
property bio : String
# For bots, the text that is included with the link when users share the bot
property share_text : String
# Number of group chats where both the other user and the current user are a member; 0 for the current user
property group_in_common_count : Int32
# If the user is a bot, information about the bot; may be null
property bot_info : BotInfo?
def initialize(
@is_blocked : Bool,
@can_be_called : Bool,
@has_private_calls : Bool,
@need_phone_number_privacy_exception : Bool,
@bio : String,
@share_text : String,
@group_in_common_count : Int32,
@bot_info : BotInfo? = nil
)
end
end
# Contains full information about a user profile photo
class UserProfilePhoto < TLObject
@[JSON::Field(key: "@type")]
getter _type = "userProfilePhoto"
# Unique user profile photo identifier
property id : String
# Point in time (Unix timestamp) when the photo has been added
property added_date : Int32
# Available variants of the user photo, in different sizes
property sizes : Array(PhotoSize)
def initialize(
@id : String,
@added_date : Int32,
@sizes : Array(PhotoSize)
)
end
end
# Contains part of the list of user photos
class UserProfilePhotos < TLObject
@[JSON::Field(key: "@type")]
getter _type = "userProfilePhotos"
# Total number of user profile photos
property total_count : Int32
# A list of photos
property photos : Array(UserProfilePhoto)
def initialize(
@total_count : Int32,
@photos : Array(UserProfilePhoto)
)
end
end
# Represents a list of users
class Users < TLObject
@[JSON::Field(key: "@type")]
getter _type = "users"
# Approximate total count of users found
property total_count : Int32
# A list of user identifiers
property user_ids : Array(Int32)
def initialize(
@total_count : Int32,
@user_ids : Array(Int32)
)
end
end
# Contains information about a chat administrator
class ChatAdministrator < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatAdministrator"
# User identifier of the administrator
property user_id : Int32
# Custom title of the administrator
property custom_title : String
# True, if the user is the owner of the chat
property is_owner : Bool
def initialize(
@user_id : Int32,
@custom_title : String,
@is_owner : Bool
)
end
end
# Represents a list of chat administrators
class ChatAdministrators < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatAdministrators"
# A list of chat administrators
property administrators : Array(ChatAdministrator)
def initialize(
@administrators : Array(ChatAdministrator)
)
end
end
# Describes actions that a user is allowed to take in a chat
class ChatPermissions < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatPermissions"
# True, if the user can send text messages, contacts, locations, and venues
property can_send_messages : Bool
# True, if the user can send audio files, documents, photos, videos, video notes, and voice notes. Implies can_send_messages permissions
property can_send_media_messages : Bool
# True, if the user can send polls. Implies can_send_messages permissions
property can_send_polls : Bool
# True, if the user can send animations, games, and stickers and use inline bots. Implies can_send_messages permissions
property can_send_other_messages : Bool
# True, if the user may add a web page preview to their messages. Implies can_send_messages permissions
property can_add_web_page_previews : Bool
# True, if the user can change the chat title, photo, and other settings
property can_change_info : Bool
# True, if the user can invite new users to the chat
property can_invite_users : Bool
# True, if the user can pin messages
property can_pin_messages : Bool
def initialize(
@can_send_messages : Bool,
@can_send_media_messages : Bool,
@can_send_polls : Bool,
@can_send_other_messages : Bool,
@can_add_web_page_previews : Bool,
@can_change_info : Bool,
@can_invite_users : Bool,
@can_pin_messages : Bool
)
end
end
# The user is the owner of a chat and has all the administrator privileges
class ChatMemberStatusCreator < ChatMemberStatus
@[JSON::Field(key: "@type")]
getter _type = "chatMemberStatusCreator"
# A custom title of the owner; 0-16 characters without emojis; applicable to supergroups only
property custom_title : String
# True, if the user is a member of the chat
property is_member : Bool
def initialize(
@custom_title : String,
@is_member : Bool
)
end
end
# The user is a member of a chat and has some additional privileges. In basic groups, administrators can edit and delete messages sent by others, add new members, and ban unprivileged members. In supergroups and channels, there are more detailed options for administrator privileges
class ChatMemberStatusAdministrator < ChatMemberStatus
@[JSON::Field(key: "@type")]
getter _type = "chatMemberStatusAdministrator"
# A custom title of the administrator; 0-16 characters without emojis; applicable to supergroups only
property custom_title : String
# True, if the current user can edit the administrator privileges for the called user
property can_be_edited : Bool
# True, if the administrator can change the chat title, photo, and other settings
property can_change_info : Bool
# True, if the administrator can create channel posts; applicable to channels only
property can_post_messages : Bool
# True, if the administrator can edit messages of other users and pin messages; applicable to channels only
property can_edit_messages : Bool
# True, if the administrator can delete messages of other users
property can_delete_messages : Bool
# True, if the administrator can invite new users to the chat
property can_invite_users : Bool
# True, if the administrator can restrict, ban, or unban chat members
property can_restrict_members : Bool
# True, if the administrator can pin messages; applicable to groups only
property can_pin_messages : Bool
# True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that were directly or indirectly promoted by them
property can_promote_members : Bool
def initialize(
@custom_title : String,
@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
)
end
end
# The user is a member of a chat, without any additional privileges or restrictions
class ChatMemberStatusMember < ChatMemberStatus
@[JSON::Field(key: "@type")]
getter _type = "chatMemberStatusMember"
def initialize
end
end
# The user is under certain restrictions in the chat. Not supported in basic groups and channels
class ChatMemberStatusRestricted < ChatMemberStatus
@[JSON::Field(key: "@type")]
getter _type = "chatMemberStatusRestricted"
# True, if the user is a member of the chat
property is_member : Bool
# Point in time (Unix timestamp) when restrictions will be lifted from the user; 0 if never. If the user is restricted for more than 366 days or for less than 30 seconds from the current time, the user is considered to be restricted forever
property restricted_until_date : Int32
# User permissions in the chat
property permissions : ChatPermissions
def initialize(
@is_member : Bool,
@restricted_until_date : Int32,
@permissions : ChatPermissions
)
end
end
# The user is not a chat member
class ChatMemberStatusLeft < ChatMemberStatus
@[JSON::Field(key: "@type")]
getter _type = "chatMemberStatusLeft"
def initialize
end
end
# The user was banned (and hence is not a member of the chat). Implies the user can't return to the chat or view messages
class ChatMemberStatusBanned < ChatMemberStatus
@[JSON::Field(key: "@type")]
getter _type = "chatMemberStatusBanned"
# Point in time (Unix timestamp) when the user will be unbanned; 0 if never. If the user is banned for more than 366 days or for less than 30 seconds from the current time, the user is considered to be banned forever
property banned_until_date : Int32
def initialize(
@banned_until_date : Int32
)
end
end
# A user with information about joining/leaving a chat
class ChatMember < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatMember"
# User identifier of the chat member
property user_id : Int32
# Identifier of a user that invited/promoted/banned this member in the chat; 0 if unknown
property inviter_user_id : Int32
# Point in time (Unix timestamp) when the user joined a chat
property joined_chat_date : Int32
# Status of the member in the chat
property status : ChatMemberStatus
# If the user is a bot, information about the bot; may be null. Can be null even for a bot if the bot is not a chat member
property bot_info : BotInfo?
def initialize(
@user_id : Int32,
@inviter_user_id : Int32,
@joined_chat_date : Int32,
@status : ChatMemberStatus,
@bot_info : BotInfo? = nil
)
end
end
# Contains a list of chat members
class ChatMembers < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatMembers"
# Approximate total count of chat members found
property total_count : Int32
# A list of chat members
property members : Array(ChatMember)
def initialize(
@total_count : Int32,
@members : Array(ChatMember)
)
end
end
# Returns contacts of the user
class ChatMembersFilterContacts < ChatMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "chatMembersFilterContacts"
def initialize
end
end
# Returns the owner and administrators
class ChatMembersFilterAdministrators < ChatMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "chatMembersFilterAdministrators"
def initialize
end
end
# Returns all chat members, including restricted chat members
class ChatMembersFilterMembers < ChatMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "chatMembersFilterMembers"
def initialize
end
end
# Returns users under certain restrictions in the chat; can be used only by administrators in a supergroup
class ChatMembersFilterRestricted < ChatMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "chatMembersFilterRestricted"
def initialize
end
end
# Returns users banned from the chat; can be used only by administrators in a supergroup or in a channel
class ChatMembersFilterBanned < ChatMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "chatMembersFilterBanned"
def initialize
end
end
# Returns bot members of the chat
class ChatMembersFilterBots < ChatMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "chatMembersFilterBots"
def initialize
end
end
# Returns recently active users in reverse chronological order
class SupergroupMembersFilterRecent < SupergroupMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "supergroupMembersFilterRecent"
def initialize
end
end
# Returns contacts of the user, which are members of the supergroup or channel
class SupergroupMembersFilterContacts < SupergroupMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "supergroupMembersFilterContacts"
# Query to search for
property query : String
def initialize(
@query : String
)
end
end
# Returns the owner and administrators
class SupergroupMembersFilterAdministrators < SupergroupMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "supergroupMembersFilterAdministrators"
def initialize
end
end
# Used to search for supergroup or channel members via a (string) query
class SupergroupMembersFilterSearch < SupergroupMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "supergroupMembersFilterSearch"
# Query to search for
property query : String
def initialize(
@query : String
)
end
end
# Returns restricted supergroup members; can be used only by administrators
class SupergroupMembersFilterRestricted < SupergroupMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "supergroupMembersFilterRestricted"
# Query to search for
property query : String
def initialize(
@query : String
)
end
end
# Returns users banned from the supergroup or channel; can be used only by administrators
class SupergroupMembersFilterBanned < SupergroupMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "supergroupMembersFilterBanned"
# Query to search for
property query : String
def initialize(
@query : String
)
end
end
# Returns bot members of the supergroup or channel
class SupergroupMembersFilterBots < SupergroupMembersFilter
@[JSON::Field(key: "@type")]
getter _type = "supergroupMembersFilterBots"
def initialize
end
end
# Represents a basic group of 0-200 users (must be upgraded to a supergroup to accommodate more than 200 users)
class BasicGroup < TLObject
@[JSON::Field(key: "@type")]
getter _type = "basicGroup"
# Group identifier
property id : Int32
# Number of members in the group
property member_count : Int32
# Status of the current user in the group
property status : ChatMemberStatus
# True, if the group is active
property is_active : Bool
# Identifier of the supergroup to which this group was upgraded; 0 if none
property upgraded_to_supergroup_id : Int32
def initialize(
@id : Int32,
@member_count : Int32,
@status : ChatMemberStatus,
@is_active : Bool,
@upgraded_to_supergroup_id : Int32
)
end
end
# Contains full information about a basic group
class BasicGroupFullInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "basicGroupFullInfo"
# Contains full information about a basic group
property description : String
# User identifier of the creator of the group; 0 if unknown
property creator_user_id : Int32
# Group members
property members : Array(ChatMember)
# Invite link for this group; available only after it has been generated at least once and only for the group creator
property invite_link : String
def initialize(
@description : String,
@creator_user_id : Int32,
@members : Array(ChatMember),
@invite_link : String
)
end
end
# Represents a supergroup or channel with zero or more members (subscribers in the case of channels). From the point of view of the system, a channel is a special kind of a supergroup: only administrators can post and see the list of members, and posts from all administrators use the name and photo of the channel instead of individual names and profile photos. Unlike supergroups, channels can have an unlimited number of subscribers
class Supergroup < TLObject
@[JSON::Field(key: "@type")]
getter _type = "supergroup"
# Supergroup or channel identifier
property id : Int32
# Username of the supergroup or channel; empty for private supergroups or channels
property username : String
# Point in time (Unix timestamp) when the current user joined, or the point in time when the supergroup or channel was created, in case the user is not a member
property date : Int32
# Status of the current user in the supergroup or channel; custom title will be always empty
property status : ChatMemberStatus
# Member count; 0 if unknown. Currently it is guaranteed to be known only if the supergroup or channel was found through SearchPublicChats
property member_count : Int32
# True, if the channel has a discussion group, or the supergroup is the designated discussion group for a channel
property has_linked_chat : Bool
# True, if the supergroup is connected to a location, i.e. the supergroup is a location-based supergroup
property has_location : Bool
# True, if messages sent to the channel should contain information about the sender. This field is only applicable to channels
property sign_messages : Bool
# True, if the slow mode is enabled in the supergroup
property is_slow_mode_enabled : Bool
# True, if the supergroup is a channel
property is_channel : Bool
# True, if the supergroup or channel is verified
property is_verified : Bool
# If non-empty, contains a human-readable description of the reason why access to this supergroup or channel must be restricted
property restriction_reason : String
# True, if many users reported this supergroup as a scam
property is_scam : Bool
def initialize(
@id : Int32,
@username : String,
@date : Int32,
@status : ChatMemberStatus,
@member_count : Int32,
@has_linked_chat : Bool,
@has_location : Bool,
@sign_messages : Bool,
@is_slow_mode_enabled : Bool,
@is_channel : Bool,
@is_verified : Bool,
@restriction_reason : String,
@is_scam : Bool
)
end
end
# Contains full information about a supergroup or channel
class SupergroupFullInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "supergroupFullInfo"
# Contains full information about a supergroup or channel
property description : String
# Identifier of the basic group from which supergroup was upgraded; 0 if none
property upgraded_from_basic_group_id : Int32
# Invite link for this chat
property invite_link : String
# Identifier of the supergroup sticker set; 0 if none
property sticker_set_id : String
# True, if new chat members will have access to old messages. In public or discussion groups and both public and private channels, old messages are always available, so this option affects only private supergroups without a linked chat. The value of this field is only available for chat administrators
property is_all_history_available : Bool
# True, if the channel statistics is available through getChatStatisticsUrl
property can_view_statistics : Bool
# True, if the supergroup location can be changed
property can_set_location : Bool
# True, if the supergroup sticker set can be changed
property can_set_sticker_set : Bool
# True, if the chat username can be changed
property can_set_username : Bool
# True, if members of the chat can be retrieved
property can_get_members : Bool
# Time left before next message can be sent in the supergroup, in seconds. An updateSupergroupFullInfo update is not triggered when value of this field changes, but both new and old values are non-zero
property slow_mode_delay_expires_in : Float64
# Delay between consecutive sent messages for non-administrator supergroup members, in seconds
property slow_mode_delay : Int32
# Chat identifier of a discussion group for the channel, or a channel, for which the supergroup is the designated discussion group; 0 if none or unknown
property linked_chat_id : Int64
# Number of users banned from chat; 0 if unknown
property banned_count : Int32
# Number of restricted users in the supergroup; 0 if unknown
property restricted_count : Int32
# Number of privileged users in the supergroup or channel; 0 if unknown
property administrator_count : Int32
# Number of members in the supergroup or channel; 0 if unknown
property member_count : Int32
# Identifier of the last message in the basic group from which supergroup was upgraded; 0 if none
property upgraded_from_max_message_id : Int64
# Location to which the supergroup is connected; may be null
property location : ChatLocation?
def initialize(
@description : String,
@upgraded_from_basic_group_id : Int32,
@invite_link : String,
@sticker_set_id : String,
@is_all_history_available : Bool,
@can_view_statistics : Bool,
@can_set_location : Bool,
@can_set_sticker_set : Bool,
@can_set_username : Bool,
@can_get_members : Bool,
@slow_mode_delay_expires_in : Float64,
@slow_mode_delay : Int32,
@linked_chat_id : Int64,
@banned_count : Int32,
@restricted_count : Int32,
@administrator_count : Int32,
@member_count : Int32,
@upgraded_from_max_message_id : Int64,
@location : ChatLocation? = nil
)
end
end
# The secret chat is not yet created; waiting for the other user to get online
class SecretChatStatePending < SecretChatState
@[JSON::Field(key: "@type")]
getter _type = "secretChatStatePending"
def initialize
end
end
# The secret chat is ready to use
class SecretChatStateReady < SecretChatState
@[JSON::Field(key: "@type")]
getter _type = "secretChatStateReady"
def initialize
end
end
# The secret chat is closed
class SecretChatStateClosed < SecretChatState
@[JSON::Field(key: "@type")]
getter _type = "secretChatStateClosed"
def initialize
end
end
# Represents a secret chat
class SecretChat < TLObject
@[JSON::Field(key: "@type")]
getter _type = "secretChat"
# Secret chat identifier
property id : Int32
# Identifier of the chat partner
property user_id : Int32
# State of the secret chat
property state : SecretChatState
# True, if the chat was created by the current user; otherwise false
property is_outbound : Bool
# Current message Time To Live setting (self-destruct timer) for the chat, in seconds
property ttl : Int32
# Hash of the currently used key for comparison with the hash of the chat partner's key. This is a string of 36 little-endian bytes, which must be split into groups of 2 bits, each denoting a pixel of one of 4 colors FFFFFF, D5E6F3, 2D5775, and 2F99C9.
# The pixels must be used to make a 12x12 square image filled from left to right, top to bottom. Alternatively, the first 32 bytes of the hash can be converted to the hexadecimal format and printed as 32 2-digit hex numbers
property key_hash : String
# Secret chat layer; determines features supported by the other client. Video notes are supported if the layer >= 66; nested text entities and underline and strikethrough entities are supported if the layer >= 101
property layer : Int32
def initialize(
@id : Int32,
@user_id : Int32,
@state : SecretChatState,
@is_outbound : Bool,
@ttl : Int32,
@key_hash : String,
@layer : Int32
)
end
end
# The message was originally written by a known user
class MessageForwardOriginUser < MessageForwardOrigin
@[JSON::Field(key: "@type")]
getter _type = "messageForwardOriginUser"
# Identifier of the user that originally sent the message
property sender_user_id : Int32
def initialize(
@sender_user_id : Int32
)
end
end
# The message was originally written by a user, which is hidden by their privacy settings
class MessageForwardOriginHiddenUser < MessageForwardOrigin
@[JSON::Field(key: "@type")]
getter _type = "messageForwardOriginHiddenUser"
# Name of the sender
property sender_name : String
def initialize(
@sender_name : String
)
end
end
# The message was originally a post in a channel
class MessageForwardOriginChannel < MessageForwardOrigin
@[JSON::Field(key: "@type")]
getter _type = "messageForwardOriginChannel"
# Identifier of the chat from which the message was originally forwarded
property chat_id : Int64
# Message identifier of the original message; 0 if unknown
property message_id : Int64
# Original post author signature
property author_signature : String
def initialize(
@chat_id : Int64,
@message_id : Int64,
@author_signature : String
)
end
end
# Contains information about a forwarded message
class MessageForwardInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "messageForwardInfo"
# Origin of a forwarded message
property origin : MessageForwardOrigin
# Point in time (Unix timestamp) when the message was originally sent
property date : Int32
# For messages forwarded to the chat with the current user (Saved Messages) or to the channel's discussion group, the identifier of the chat from which the message was forwarded last time; 0 if unknown
property from_chat_id : Int64
# For messages forwarded to the chat with the current user (Saved Messages) or to the channel's discussion group, the identifier of the original message from which the new message was forwarded last time; 0 if unknown
property from_message_id : Int64
def initialize(
@origin : MessageForwardOrigin,
@date : Int32,
@from_chat_id : Int64,
@from_message_id : Int64
)
end
end
# The message is being sent now, but has not yet been delivered to the server
class MessageSendingStatePending < MessageSendingState
@[JSON::Field(key: "@type")]
getter _type = "messageSendingStatePending"
def initialize
end
end
# The message failed to be sent
class MessageSendingStateFailed < MessageSendingState
@[JSON::Field(key: "@type")]
getter _type = "messageSendingStateFailed"
# An error code; 0 if unknown
property error_code : Int32
# Error message
property error_message : String
# True, if the message can be re-sent
property can_retry : Bool
# Time left before the message can be re-sent, in seconds. No update is sent when this field changes
property retry_after : Float64
def initialize(
@error_code : Int32,
@error_message : String,
@can_retry : Bool,
@retry_after : Float64
)
end
end
# Describes a message
class Message < TLObject
@[JSON::Field(key: "@type")]
getter _type = "message"
# Message identifier, unique for the chat to which the message belongs
property id : Int64
# Content of the message
property content : MessageContent
# If non-empty, contains a human-readable description of the reason why access to this message must be restricted
property restriction_reason : String
# Unique identifier of an album this message belongs to. Only photos and videos can be grouped together in albums
property media_album_id : String
# Number of times this message was viewed
property views : Int32
# For channel posts, optional author signature
property author_signature : String
# If non-zero, the user identifier of the bot through which this message was sent
property via_bot_user_id : Int32
# Time left before the message expires, in seconds
property ttl_expires_in : Float64
# 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
property ttl : Int32
# If non-zero, the identifier of the message this message is replying to; can be the identifier of a deleted message
property reply_to_message_id : Int64
# Point in time (Unix timestamp) when the message was last edited
property edit_date : Int32
# Point in time (Unix timestamp) when the message was sent
property date : Int32
# True, if the message contains an unread mention for the current user
property contains_unread_mention : Bool
# True, if the message is a channel post. All messages to channels are channel posts, all other messages are not channel posts
property is_channel_post : Bool
# True, if the message can be deleted for all users
property can_be_deleted_for_all_users : Bool
# True, if the message can be deleted only for the current user while other users will continue to see it
property can_be_deleted_only_for_self : Bool
# True, if the message can be forwarded
property can_be_forwarded : Bool
# 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
property can_be_edited : Bool
# True, if the message is outgoing
property is_outgoing : Bool
# Chat identifier
property chat_id : Int64
# Identifier of the user who sent the message; 0 if unknown. Currently, it is unknown for channel posts and for channel posts automatically forwarded to discussion group
property sender_user_id : Int32
# Information about the initial message sender; may be null
property forward_info : MessageForwardInfo?
# Information about the scheduling state of the message; may be null
property scheduling_state : MessageSchedulingState?
# Information about the sending state of the message; may be null
property sending_state : MessageSendingState?
# Reply markup for the message; may be null
property reply_markup : ReplyMarkup?
def initialize(
@id : Int64,
@content : MessageContent,
@restriction_reason : String,
@media_album_id : String,
@views : Int32,
@author_signature : String,
@via_bot_user_id : Int32,
@ttl_expires_in : Float64,
@ttl : Int32,
@reply_to_message_id : Int64,
@edit_date : Int32,
@date : Int32,
@contains_unread_mention : Bool,
@is_channel_post : Bool,
@can_be_deleted_for_all_users : Bool,
@can_be_deleted_only_for_self : Bool,
@can_be_forwarded : Bool,
@can_be_edited : Bool,
@is_outgoing : Bool,
@chat_id : Int64,
@sender_user_id : Int32,
@forward_info : MessageForwardInfo? = nil,
@scheduling_state : MessageSchedulingState? = nil,
@sending_state : MessageSendingState? = nil,
@reply_markup : ReplyMarkup? = nil
)
end
end
# Contains a list of messages
class Messages < TLObject
@[JSON::Field(key: "@type")]
getter _type = "messages"
# Approximate total count of messages found
property total_count : Int32
# List of messages; messages may be null
property messages : Array(Message)
def initialize(
@total_count : Int32,
@messages : Array(Message)
)
end
end
# Contains a list of messages found by a search
class FoundMessages < TLObject
@[JSON::Field(key: "@type")]
getter _type = "foundMessages"
# List of messages
property messages : Array(Message)
# Value to pass as from_search_id to get more results
property next_from_search_id : String
def initialize(
@messages : Array(Message),
@next_from_search_id : String
)
end
end
# Notification settings applied to all private and secret chats when the corresponding chat setting has a default value
class NotificationSettingsScopePrivateChats < NotificationSettingsScope
@[JSON::Field(key: "@type")]
getter _type = "notificationSettingsScopePrivateChats"
def initialize
end
end
# Notification settings applied to all basic groups and supergroups when the corresponding chat setting has a default value
class NotificationSettingsScopeGroupChats < NotificationSettingsScope
@[JSON::Field(key: "@type")]
getter _type = "notificationSettingsScopeGroupChats"
def initialize
end
end
# Notification settings applied to all channels when the corresponding chat setting has a default value
class NotificationSettingsScopeChannelChats < NotificationSettingsScope
@[JSON::Field(key: "@type")]
getter _type = "notificationSettingsScopeChannelChats"
def initialize
end
end
# Contains information about notification settings for a chat
class ChatNotificationSettings < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatNotificationSettings"
# If true, mute_for is ignored and the value for the relevant type of chat is used instead
property use_default_mute_for : Bool
# Time left before notifications will be unmuted, in seconds
property mute_for : Int32
# If true, sound is ignored and the value for the relevant type of chat is used instead
property use_default_sound : Bool
# The name of an audio file to be used for notification sounds; only applies to iOS applications
property sound : String
# If true, show_preview is ignored and the value for the relevant type of chat is used instead
property use_default_show_preview : Bool
# True, if message content should be displayed in notifications
property show_preview : Bool
# If true, disable_pinned_message_notifications is ignored and the value for the relevant type of chat is used instead
property use_default_disable_pinned_message_notifications : Bool
# If true, notifications for incoming pinned messages will be created as for an ordinary unread message
property disable_pinned_message_notifications : Bool
# If true, disable_mention_notifications is ignored and the value for the relevant type of chat is used instead
property use_default_disable_mention_notifications : Bool
# If true, notifications for messages with mentions will be created as for an ordinary unread message
property disable_mention_notifications : Bool
def initialize(
@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
)
end
end
# Contains information about notification settings for several chats
class ScopeNotificationSettings < TLObject
@[JSON::Field(key: "@type")]
getter _type = "scopeNotificationSettings"
# Time left before notifications will be unmuted, in seconds
property mute_for : Int32
# The name of an audio file to be used for notification sounds; only applies to iOS applications
property sound : String
# True, if message content should be displayed in notifications
property show_preview : Bool
# True, if notifications for incoming pinned messages will be created as for an ordinary unread message
property disable_pinned_message_notifications : Bool
# True, if notifications for messages with mentions will be created as for an ordinary unread message
property disable_mention_notifications : Bool
def initialize(
@mute_for : Int32,
@sound : String,
@show_preview : Bool,
@disable_pinned_message_notifications : Bool,
@disable_mention_notifications : Bool
)
end
end
# Contains information about a message draft
class DraftMessage < TLObject
@[JSON::Field(key: "@type")]
getter _type = "draftMessage"
# Identifier of the message to reply to; 0 if none
property reply_to_message_id : Int64
# Content of the message draft; this should always be of type inputMessageText
property input_message_text : InputMessageContent
def initialize(
@reply_to_message_id : Int64,
@input_message_text : InputMessageContent
)
end
end
# An ordinary chat with a user
class ChatTypePrivate < ChatType
@[JSON::Field(key: "@type")]
getter _type = "chatTypePrivate"
# User identifier
property user_id : Int32
def initialize(
@user_id : Int32
)
end
end
# A basic group (i.e., a chat with 0-200 other users)
class ChatTypeBasicGroup < ChatType
@[JSON::Field(key: "@type")]
getter _type = "chatTypeBasicGroup"
# Basic group identifier
property basic_group_id : Int32
def initialize(
@basic_group_id : Int32
)
end
end
# A supergroup (i.e. a chat with up to GetOption("supergroup_max_size") other users), or channel (with unlimited members)
class ChatTypeSupergroup < ChatType
@[JSON::Field(key: "@type")]
getter _type = "chatTypeSupergroup"
# Supergroup or channel identifier
property supergroup_id : Int32
# True, if the supergroup is a channel
property is_channel : Bool
def initialize(
@supergroup_id : Int32,
@is_channel : Bool
)
end
end
# A secret chat with a user
class ChatTypeSecret < ChatType
@[JSON::Field(key: "@type")]
getter _type = "chatTypeSecret"
# Secret chat identifier
property secret_chat_id : Int32
# User identifier of the secret chat peer
property user_id : Int32
def initialize(
@secret_chat_id : Int32,
@user_id : Int32
)
end
end
# A main list of chats
class ChatListMain < ChatList
@[JSON::Field(key: "@type")]
getter _type = "chatListMain"
def initialize
end
end
# A list of chats usually located at the top of the main chat list. Unmuted chats are automatically moved from the Archive to the Main chat list when a new message arrives
class ChatListArchive < ChatList
@[JSON::Field(key: "@type")]
getter _type = "chatListArchive"
def initialize
end
end
# A chat. (Can be a private chat, basic group, supergroup, or secret chat)
class Chat < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chat"
# Chat unique identifier
property id : Int64
# Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
property reply_markup_message_id : Int64
# Identifier of the pinned message in the chat; 0 if none
property pinned_message_id : Int64
# Notification settings for this chat
property notification_settings : ChatNotificationSettings
# Number of unread messages with a mention/reply in the chat
property unread_mention_count : Int32
# Identifier of the last read outgoing message
property last_read_outbox_message_id : Int64
# Identifier of the last read incoming message
property last_read_inbox_message_id : Int64
# Number of unread messages in the chat
property unread_count : Int32
# Default value of the disable_notification parameter, used when a message is sent to the chat
property default_disable_notification : Bool
# True, if the chat can be reported to Telegram moderators through reportChat
property can_be_reported : Bool
# True, if the chat messages can be deleted for all users
property can_be_deleted_for_all_users : Bool
# True, if the chat messages can be deleted only for the current user while other users will continue to see the messages
property can_be_deleted_only_for_self : Bool
# True, if the chat has scheduled messages
property has_scheduled_messages : Bool
# True, if the chat is sponsored by the user's MTProxy server
property is_sponsored : Bool
# True, if the chat is marked as unread
property is_marked_as_unread : Bool
# True, if the chat is pinned
property is_pinned : Bool
# Descending parameter by which chats are sorted in the main chat list. If the order number of two chats is the same, they must be sorted in descending order by ID. If 0, the position of the chat in the list is undetermined
property order : String
# Actions that non-administrator chat members are allowed to take in the chat
property permissions : ChatPermissions
# Chat title
property title : String
# Type of the chat
property type : ChatType
# Contains client-specific data associated with the chat. (For example, the chat position or local chat notification settings can be stored here.) Persistent if the message database is used
property client_data : String
# Last message in the chat; may be null
property last_message : Message?
# Chat photo; may be null
property photo : ChatPhoto?
# Describes actions which should be possible to do through a chat action bar; may be null
property action_bar : ChatActionBar?
# A chat list to which the chat belongs; may be null
property chat_list : ChatList?
# A draft of a message in the chat; may be null
property draft_message : DraftMessage?
def initialize(
@id : Int64,
@reply_markup_message_id : Int64,
@pinned_message_id : Int64,
@notification_settings : ChatNotificationSettings,
@unread_mention_count : Int32,
@last_read_outbox_message_id : Int64,
@last_read_inbox_message_id : Int64,
@unread_count : Int32,
@default_disable_notification : Bool,
@can_be_reported : Bool,
@can_be_deleted_for_all_users : Bool,
@can_be_deleted_only_for_self : Bool,
@has_scheduled_messages : Bool,
@is_sponsored : Bool,
@is_marked_as_unread : Bool,
@is_pinned : Bool,
@order : String,
@permissions : ChatPermissions,
@title : String,
@type : ChatType,
@client_data : String,
@last_message : Message? = nil,
@photo : ChatPhoto? = nil,
@action_bar : ChatActionBar? = nil,
@chat_list : ChatList? = nil,
@draft_message : DraftMessage? = nil
)
end
end
# Represents a list of chats
class Chats < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chats"
# List of chat identifiers
property chat_ids : Array(Int64)
def initialize(
@chat_ids : Array(Int64)
)
end
end
# Describes a chat located nearby
class ChatNearby < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatNearby"
# Chat identifier
property chat_id : Int64
# Distance to the chat location in meters
property distance : Int32
def initialize(
@chat_id : Int64,
@distance : Int32
)
end
end
# Represents a list of chats located nearby
class ChatsNearby < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatsNearby"
# List of users nearby
property users_nearby : Array(ChatNearby)
# List of location-based supergroups nearby
property supergroups_nearby : Array(ChatNearby)
def initialize(
@users_nearby : Array(ChatNearby),
@supergroups_nearby : Array(ChatNearby)
)
end
end
# Contains a chat invite link
class ChatInviteLink < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatInviteLink"
# Chat invite link
property invite_link : String
def initialize(
@invite_link : String
)
end
end
# Contains information about a chat invite link
class ChatInviteLinkInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatInviteLinkInfo"
# Chat identifier of the invite link; 0 if the user is not a member of this chat
property chat_id : Int64
# Contains information about the type of the chat
property type : ChatType
# Title of the chat
property title : String
# Number of members
property member_count : Int32
# User identifiers of some chat members that may be known to the current user
property member_user_ids : Array(Int32)
# True, if the chat is a public supergroup or channel, i.e. it has a username or it is a location-based supergroup
property is_public : Bool
# Chat photo; may be null
property photo : ChatPhoto?
def initialize(
@chat_id : Int64,
@type : ChatType,
@title : String,
@member_count : Int32,
@member_user_ids : Array(Int32),
@is_public : Bool,
@photo : ChatPhoto? = nil
)
end
end
# The chat is public, because it has username
class PublicChatTypeHasUsername < PublicChatType
@[JSON::Field(key: "@type")]
getter _type = "publicChatTypeHasUsername"
def initialize
end
end
# The chat is public, because it is a location-based supergroup
class PublicChatTypeIsLocationBased < PublicChatType
@[JSON::Field(key: "@type")]
getter _type = "publicChatTypeIsLocationBased"
def initialize
end
end
# The chat can be reported as spam using the method reportChat with the reason chatReportReasonSpam
class ChatActionBarReportSpam < ChatActionBar
@[JSON::Field(key: "@type")]
getter _type = "chatActionBarReportSpam"
def initialize
end
end
# The chat is a location-based supergroup, which can be reported as having unrelated location using the method reportChat with the reason chatReportReasonUnrelatedLocation
class ChatActionBarReportUnrelatedLocation < ChatActionBar
@[JSON::Field(key: "@type")]
getter _type = "chatActionBarReportUnrelatedLocation"
def initialize
end
end
# The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be added to the contact list using the method addContact, or the other user can be blocked using the method blockUser
class ChatActionBarReportAddBlock < ChatActionBar
@[JSON::Field(key: "@type")]
getter _type = "chatActionBarReportAddBlock"
def initialize
end
end
# The chat is a private or secret chat and the other user can be added to the contact list using the method addContact
class ChatActionBarAddContact < ChatActionBar
@[JSON::Field(key: "@type")]
getter _type = "chatActionBarAddContact"
def initialize
end
end
# The chat is a private or secret chat with a mutual contact and the user's phone number can be shared with the other user using the method sharePhoneNumber
class ChatActionBarSharePhoneNumber < ChatActionBar
@[JSON::Field(key: "@type")]
getter _type = "chatActionBarSharePhoneNumber"
def initialize
end
end
# A simple button, with text that should be sent when the button is pressed
class KeyboardButtonTypeText < KeyboardButtonType
@[JSON::Field(key: "@type")]
getter _type = "keyboardButtonTypeText"
def initialize
end
end
# A button that sends the user's phone number when pressed; available only in private chats
class KeyboardButtonTypeRequestPhoneNumber < KeyboardButtonType
@[JSON::Field(key: "@type")]
getter _type = "keyboardButtonTypeRequestPhoneNumber"
def initialize
end
end
# A button that sends the user's location when pressed; available only in private chats
class KeyboardButtonTypeRequestLocation < KeyboardButtonType
@[JSON::Field(key: "@type")]
getter _type = "keyboardButtonTypeRequestLocation"
def initialize
end
end
# A button that allows the user to create and send a poll when pressed; available only in private chats
class KeyboardButtonTypeRequestPoll < KeyboardButtonType
@[JSON::Field(key: "@type")]
getter _type = "keyboardButtonTypeRequestPoll"
# If true, only regular polls must be allowed to create
property force_regular : Bool
# If true, only polls in quiz mode must be allowed to create
property force_quiz : Bool
def initialize(
@force_regular : Bool,
@force_quiz : Bool
)
end
end
# Represents a single button in a bot keyboard
class KeyboardButton < TLObject
@[JSON::Field(key: "@type")]
getter _type = "keyboardButton"
# Text of the button
property text : String
# Type of the button
property type : KeyboardButtonType
def initialize(
@text : String,
@type : KeyboardButtonType
)
end
end
# A button that opens a specified URL
class InlineKeyboardButtonTypeUrl < InlineKeyboardButtonType
@[JSON::Field(key: "@type")]
getter _type = "inlineKeyboardButtonTypeUrl"
# HTTP or tg:// URL to open
property url : String
def initialize(
@url : String
)
end
end
# A button that opens a specified URL and automatically logs in in current user if they allowed to do that
class InlineKeyboardButtonTypeLoginUrl < InlineKeyboardButtonType
@[JSON::Field(key: "@type")]
getter _type = "inlineKeyboardButtonTypeLoginUrl"
# An HTTP URL to open
property url : String
# Unique button identifier
property id : Int32
# If non-empty, new text of the button in forwarded messages
property forward_text : String
def initialize(
@url : String,
@id : Int32,
@forward_text : String
)
end
end
# A button that sends a special callback query to a bot
class InlineKeyboardButtonTypeCallback < InlineKeyboardButtonType
@[JSON::Field(key: "@type")]
getter _type = "inlineKeyboardButtonTypeCallback"
# Data to be sent to the bot via a callback query
property data : String
def initialize(
@data : String
)
end
end
# A button with a game that sends a special callback query to a bot. This button must be in the first column and row of the keyboard and can be attached only to a message with content of the type messageGame
class InlineKeyboardButtonTypeCallbackGame < InlineKeyboardButtonType
@[JSON::Field(key: "@type")]
getter _type = "inlineKeyboardButtonTypeCallbackGame"
def initialize
end
end
# A button that forces an inline query to the bot to be inserted in the input field
class InlineKeyboardButtonTypeSwitchInline < InlineKeyboardButtonType
@[JSON::Field(key: "@type")]
getter _type = "inlineKeyboardButtonTypeSwitchInline"
# Inline query to be sent to the bot
property query : String
# True, if the inline query should be sent from the current chat
property in_current_chat : Bool
def initialize(
@query : String,
@in_current_chat : Bool
)
end
end
# A button to buy something. This button must be in the first column and row of the keyboard and can be attached only to a message with content of the type messageInvoice
class InlineKeyboardButtonTypeBuy < InlineKeyboardButtonType
@[JSON::Field(key: "@type")]
getter _type = "inlineKeyboardButtonTypeBuy"
def initialize
end
end
# Represents a single button in an inline keyboard
class InlineKeyboardButton < TLObject
@[JSON::Field(key: "@type")]
getter _type = "inlineKeyboardButton"
# Text of the button
property text : String
# Type of the button
property type : InlineKeyboardButtonType
def initialize(
@text : String,
@type : InlineKeyboardButtonType
)
end
end
# Instructs clients to remove the keyboard once this message has been received. This kind of keyboard can't be received in an incoming message; instead, UpdateChatReplyMarkup with message_id == 0 will be sent
class ReplyMarkupRemoveKeyboard < ReplyMarkup
@[JSON::Field(key: "@type")]
getter _type = "replyMarkupRemoveKeyboard"
# True, if the keyboard is removed only for the mentioned users or the target user of a reply
property is_personal : Bool
def initialize(
@is_personal : Bool
)
end
end
# Instructs clients to force a reply to this message
class ReplyMarkupForceReply < ReplyMarkup
@[JSON::Field(key: "@type")]
getter _type = "replyMarkupForceReply"
# True, if a forced reply must automatically be shown to the current user. For outgoing messages, specify true to show the forced reply only for the mentioned users and for the target user of a reply
property is_personal : Bool
def initialize(
@is_personal : Bool
)
end
end
# Contains a custom keyboard layout to quickly reply to bots
class ReplyMarkupShowKeyboard < ReplyMarkup
@[JSON::Field(key: "@type")]
getter _type = "replyMarkupShowKeyboard"
# A list of rows of bot keyboard buttons
property rows : Array(Array(KeyboardButton))
# True, if the client needs to resize the keyboard vertically
property resize_keyboard : Bool
# True, if the client needs to hide the keyboard after use
property one_time : Bool
# True, if the keyboard must automatically be shown to the current user. For outgoing messages, specify true to show the keyboard only for the mentioned users and for the target user of a reply
property is_personal : Bool
def initialize(
@rows : Array(Array(KeyboardButton)),
@resize_keyboard : Bool,
@one_time : Bool,
@is_personal : Bool
)
end
end
# Contains an inline keyboard layout
class ReplyMarkupInlineKeyboard < ReplyMarkup
@[JSON::Field(key: "@type")]
getter _type = "replyMarkupInlineKeyboard"
# A list of rows of inline keyboard buttons
property rows : Array(Array(InlineKeyboardButton))
def initialize(
@rows : Array(Array(InlineKeyboardButton))
)
end
end
# An HTTP url needs to be open
class LoginUrlInfoOpen < LoginUrlInfo
@[JSON::Field(key: "@type")]
getter _type = "loginUrlInfoOpen"
# The URL to open
property url : String
# True, if there is no need to show an ordinary open URL confirm
property skip_confirm : Bool
def initialize(
@url : String,
@skip_confirm : Bool
)
end
end
# An authorization confirmation dialog needs to be shown to the user
class LoginUrlInfoRequestConfirmation < LoginUrlInfo
@[JSON::Field(key: "@type")]
getter _type = "loginUrlInfoRequestConfirmation"
# An HTTP URL to be opened
property url : String
# A domain of the URL
property domain : String
# User identifier of a bot linked with the website
property bot_user_id : Int32
# True, if the user needs to be requested to give the permission to the bot to send them messages
property request_write_access : Bool
def initialize(
@url : String,
@domain : String,
@bot_user_id : Int32,
@request_write_access : Bool
)
end
end
# A plain text
class RichTextPlain < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextPlain"
# Text
property text : String
def initialize(
@text : String
)
end
end
# A bold rich text
class RichTextBold < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextBold"
# Text
property text : RichText
def initialize(
@text : RichText
)
end
end
# An italicized rich text
class RichTextItalic < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextItalic"
# Text
property text : RichText
def initialize(
@text : RichText
)
end
end
# An underlined rich text
class RichTextUnderline < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextUnderline"
# Text
property text : RichText
def initialize(
@text : RichText
)
end
end
# A strikethrough rich text
class RichTextStrikethrough < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextStrikethrough"
# Text
property text : RichText
def initialize(
@text : RichText
)
end
end
# A fixed-width rich text
class RichTextFixed < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextFixed"
# Text
property text : RichText
def initialize(
@text : RichText
)
end
end
# A rich text URL link
class RichTextUrl < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextUrl"
# Text
property text : RichText
# URL
property url : String
# True, if the URL has cached instant view server-side
property is_cached : Bool
def initialize(
@text : RichText,
@url : String,
@is_cached : Bool
)
end
end
# A rich text email link
class RichTextEmailAddress < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextEmailAddress"
# Text
property text : RichText
# Email address
property email_address : String
def initialize(
@text : RichText,
@email_address : String
)
end
end
# A subscript rich text
class RichTextSubscript < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextSubscript"
# Text
property text : RichText
def initialize(
@text : RichText
)
end
end
# A superscript rich text
class RichTextSuperscript < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextSuperscript"
# Text
property text : RichText
def initialize(
@text : RichText
)
end
end
# A marked rich text
class RichTextMarked < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextMarked"
# Text
property text : RichText
def initialize(
@text : RichText
)
end
end
# A rich text phone number
class RichTextPhoneNumber < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextPhoneNumber"
# Text
property text : RichText
# Phone number
property phone_number : String
def initialize(
@text : RichText,
@phone_number : String
)
end
end
# A small image inside the text
class RichTextIcon < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextIcon"
# The image represented as a document. The image can be in GIF, JPEG or PNG format
property document : Document
# Width of a bounding box in which the image should be shown; 0 if unknown
property width : Int32
# Height of a bounding box in which the image should be shown; 0 if unknown
property height : Int32
def initialize(
@document : Document,
@width : Int32,
@height : Int32
)
end
end
# A rich text anchor
class RichTextAnchor < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTextAnchor"
# Text
property text : RichText
# Anchor name
property name : String
def initialize(
@text : RichText,
@name : String
)
end
end
# A concatenation of rich texts
class RichTexts < RichText
@[JSON::Field(key: "@type")]
getter _type = "richTexts"
# Texts
property texts : Array(RichText)
def initialize(
@texts : Array(RichText)
)
end
end
# Contains a caption of an instant view web page block, consisting of a text and a trailing credit
class PageBlockCaption < TLObject
@[JSON::Field(key: "@type")]
getter _type = "pageBlockCaption"
# Content of the caption
property text : RichText
# Block credit (like HTML tag <cite>)
property credit : RichText
def initialize(
@text : RichText,
@credit : RichText
)
end
end
# Describes an item of a list page block
class PageBlockListItem < TLObject
@[JSON::Field(key: "@type")]
getter _type = "pageBlockListItem"
# Item label
property label : String
# Item blocks
property page_blocks : Array(PageBlock)
def initialize(
@label : String,
@page_blocks : Array(PageBlock)
)
end
end
# The content should be left-aligned
class PageBlockHorizontalAlignmentLeft < PageBlockHorizontalAlignment
@[JSON::Field(key: "@type")]
getter _type = "pageBlockHorizontalAlignmentLeft"
def initialize
end
end
# The content should be center-aligned
class PageBlockHorizontalAlignmentCenter < PageBlockHorizontalAlignment
@[JSON::Field(key: "@type")]
getter _type = "pageBlockHorizontalAlignmentCenter"
def initialize
end
end
# The content should be right-aligned
class PageBlockHorizontalAlignmentRight < PageBlockHorizontalAlignment
@[JSON::Field(key: "@type")]
getter _type = "pageBlockHorizontalAlignmentRight"
def initialize
end
end
# The content should be top-aligned
class PageBlockVerticalAlignmentTop < PageBlockVerticalAlignment
@[JSON::Field(key: "@type")]
getter _type = "pageBlockVerticalAlignmentTop"
def initialize
end
end
# The content should be middle-aligned
class PageBlockVerticalAlignmentMiddle < PageBlockVerticalAlignment
@[JSON::Field(key: "@type")]
getter _type = "pageBlockVerticalAlignmentMiddle"
def initialize
end
end
# The content should be bottom-aligned
class PageBlockVerticalAlignmentBottom < PageBlockVerticalAlignment
@[JSON::Field(key: "@type")]
getter _type = "pageBlockVerticalAlignmentBottom"
def initialize
end
end
# Represents a cell of a table
class PageBlockTableCell < TLObject
@[JSON::Field(key: "@type")]
getter _type = "pageBlockTableCell"
# True, if it is a header cell
property is_header : Bool
# The number of columns the cell should span
property colspan : Int32
# The number of rows the cell should span
property rowspan : Int32
# Horizontal cell content alignment
property align : PageBlockHorizontalAlignment
# Vertical cell content alignment
property valign : PageBlockVerticalAlignment
# Cell text; may be null. If the text is null, then the cell should be invisible
property text : RichText?
def initialize(
@is_header : Bool,
@colspan : Int32,
@rowspan : Int32,
@align : PageBlockHorizontalAlignment,
@valign : PageBlockVerticalAlignment,
@text : RichText? = nil
)
end
end
# Contains information about a related article
class PageBlockRelatedArticle < TLObject
@[JSON::Field(key: "@type")]
getter _type = "pageBlockRelatedArticle"
# Related article URL
property url : String
# Contains information about a related article
property description : String
# Point in time (Unix timestamp) when the article was published; 0 if unknown
property publish_date : Int32
# Article title; may be empty
property title : String?
# Article photo; may be null
property photo : Photo?
# Article author; may be empty
property author : String?
def initialize(
@url : String,
@description : String,
@publish_date : Int32,
@title : String? = nil,
@photo : Photo? = nil,
@author : String? = nil
)
end
end
# The title of a page
class PageBlockTitle < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockTitle"
# Title
property title : RichText
def initialize(
@title : RichText
)
end
end
# The subtitle of a page
class PageBlockSubtitle < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockSubtitle"
# Subtitle
property subtitle : RichText
def initialize(
@subtitle : RichText
)
end
end
# The author and publishing date of a page
class PageBlockAuthorDate < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockAuthorDate"
# Author
property author : RichText
# Point in time (Unix timestamp) when the article was published; 0 if unknown
property publish_date : Int32
def initialize(
@author : RichText,
@publish_date : Int32
)
end
end
# A header
class PageBlockHeader < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockHeader"
# Header
property header : RichText
def initialize(
@header : RichText
)
end
end
# A subheader
class PageBlockSubheader < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockSubheader"
# Subheader
property subheader : RichText
def initialize(
@subheader : RichText
)
end
end
# A kicker
class PageBlockKicker < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockKicker"
# Kicker
property kicker : RichText
def initialize(
@kicker : RichText
)
end
end
# A text paragraph
class PageBlockParagraph < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockParagraph"
# Paragraph text
property text : RichText
def initialize(
@text : RichText
)
end
end
# A preformatted text paragraph
class PageBlockPreformatted < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockPreformatted"
# Paragraph text
property text : RichText
# Programming language for which the text should be formatted
property language : String
def initialize(
@text : RichText,
@language : String
)
end
end
# The footer of a page
class PageBlockFooter < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockFooter"
# Footer
property footer : RichText
def initialize(
@footer : RichText
)
end
end
# An empty block separating a page
class PageBlockDivider < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockDivider"
def initialize
end
end
# An invisible anchor on a page, which can be used in a URL to open the page from the specified anchor
class PageBlockAnchor < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockAnchor"
# Name of the anchor
property name : String
def initialize(
@name : String
)
end
end
# A list of data blocks
class PageBlockList < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockList"
# The items of the list
property items : Array(PageBlockListItem)
def initialize(
@items : Array(PageBlockListItem)
)
end
end
# A block quote
class PageBlockBlockQuote < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockBlockQuote"
# Quote text
property text : RichText
# Quote credit
property credit : RichText
def initialize(
@text : RichText,
@credit : RichText
)
end
end
# A pull quote
class PageBlockPullQuote < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockPullQuote"
# Quote text
property text : RichText
# Quote credit
property credit : RichText
def initialize(
@text : RichText,
@credit : RichText
)
end
end
# An animation
class PageBlockAnimation < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockAnimation"
# Animation caption
property caption : PageBlockCaption
# True, if the animation should be played automatically
property need_autoplay : Bool
# Animation file; may be null
property animation : Animation?
def initialize(
@caption : PageBlockCaption,
@need_autoplay : Bool,
@animation : Animation? = nil
)
end
end
# An audio file
class PageBlockAudio < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockAudio"
# Audio file caption
property caption : PageBlockCaption
# Audio file; may be null
property audio : Audio?
def initialize(
@caption : PageBlockCaption,
@audio : Audio? = nil
)
end
end
# A photo
class PageBlockPhoto < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockPhoto"
# Photo caption
property caption : PageBlockCaption
# URL that needs to be opened when the photo is clicked
property url : String
# Photo file; may be null
property photo : Photo?
def initialize(
@caption : PageBlockCaption,
@url : String,
@photo : Photo? = nil
)
end
end
# A video
class PageBlockVideo < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockVideo"
# Video caption
property caption : PageBlockCaption
# True, if the video should be played automatically
property need_autoplay : Bool
# True, if the video should be looped
property is_looped : Bool
# Video file; may be null
property video : Video?
def initialize(
@caption : PageBlockCaption,
@need_autoplay : Bool,
@is_looped : Bool,
@video : Video? = nil
)
end
end
# A voice note
class PageBlockVoiceNote < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockVoiceNote"
# Voice note caption
property caption : PageBlockCaption
# Voice note; may be null
property voice_note : VoiceNote?
def initialize(
@caption : PageBlockCaption,
@voice_note : VoiceNote? = nil
)
end
end
# A page cover
class PageBlockCover < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockCover"
# Cover
property cover : PageBlock
def initialize(
@cover : PageBlock
)
end
end
# An embedded web page
class PageBlockEmbedded < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockEmbedded"
# Web page URL, if available
property url : String
# HTML-markup of the embedded page
property html : String
# Block width; 0 if unknown
property width : Int32
# Block height; 0 if unknown
property height : Int32
# Block caption
property caption : PageBlockCaption
# True, if the block should be full width
property is_full_width : Bool
# True, if scrolling should be allowed
property allow_scrolling : Bool
# Poster photo, if available; may be null
property poster_photo : Photo?
def initialize(
@url : String,
@html : String,
@width : Int32,
@height : Int32,
@caption : PageBlockCaption,
@is_full_width : Bool,
@allow_scrolling : Bool,
@poster_photo : Photo? = nil
)
end
end
# An embedded post
class PageBlockEmbeddedPost < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockEmbeddedPost"
# Web page URL
property url : String
# Post author
property author : String
# Point in time (Unix timestamp) when the post was created; 0 if unknown
property date : Int32
# Post content
property page_blocks : Array(PageBlock)
# Post caption
property caption : PageBlockCaption
# Post author photo; may be null
property author_photo : Photo?
def initialize(
@url : String,
@author : String,
@date : Int32,
@page_blocks : Array(PageBlock),
@caption : PageBlockCaption,
@author_photo : Photo? = nil
)
end
end
# A collage
class PageBlockCollage < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockCollage"
# Collage item contents
property page_blocks : Array(PageBlock)
# Block caption
property caption : PageBlockCaption
def initialize(
@page_blocks : Array(PageBlock),
@caption : PageBlockCaption
)
end
end
# A slideshow
class PageBlockSlideshow < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockSlideshow"
# Slideshow item contents
property page_blocks : Array(PageBlock)
# Block caption
property caption : PageBlockCaption
def initialize(
@page_blocks : Array(PageBlock),
@caption : PageBlockCaption
)
end
end
# A link to a chat
class PageBlockChatLink < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockChatLink"
# Chat title
property title : String
# Chat username, by which all other information about the chat should be resolved
property username : String
# Chat photo; may be null
property photo : ChatPhoto?
def initialize(
@title : String,
@username : String,
@photo : ChatPhoto? = nil
)
end
end
# A table
class PageBlockTable < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockTable"
# Table caption
property caption : RichText
# Table cells
property cells : Array(Array(PageBlockTableCell))
# True, if the table is bordered
property is_bordered : Bool
# True, if the table is striped
property is_striped : Bool
def initialize(
@caption : RichText,
@cells : Array(Array(PageBlockTableCell)),
@is_bordered : Bool,
@is_striped : Bool
)
end
end
# A collapsible block
class PageBlockDetails < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockDetails"
# Always visible heading for the block
property header : RichText
# Block contents
property page_blocks : Array(PageBlock)
# True, if the block is open by default
property is_open : Bool
def initialize(
@header : RichText,
@page_blocks : Array(PageBlock),
@is_open : Bool
)
end
end
# Related articles
class PageBlockRelatedArticles < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockRelatedArticles"
# Block header
property header : RichText
# List of related articles
property articles : Array(PageBlockRelatedArticle)
def initialize(
@header : RichText,
@articles : Array(PageBlockRelatedArticle)
)
end
end
# A map
class PageBlockMap < PageBlock
@[JSON::Field(key: "@type")]
getter _type = "pageBlockMap"
# Location of the map center
property location : Location
# Map zoom level
property zoom : Int32
# Map width
property width : Int32
# Map height
property height : Int32
# Block caption
property caption : PageBlockCaption
def initialize(
@location : Location,
@zoom : Int32,
@width : Int32,
@height : Int32,
@caption : PageBlockCaption
)
end
end
# Describes an instant view page for a web page
class WebPageInstantView < TLObject
@[JSON::Field(key: "@type")]
getter _type = "webPageInstantView"
# Content of the web page
property page_blocks : Array(PageBlock)
# Version of the instant view, currently can be 1 or 2
property version : Int32
# Instant view URL; may be different from WebPage.url and must be used for the correct anchors handling
property url : String
# True, if the instant view must be shown from right to left
property is_rtl : Bool
# True, if the instant view contains the full page. A network request might be needed to get the full web page instant view
property is_full : Bool
def initialize(
@page_blocks : Array(PageBlock),
@version : Int32,
@url : String,
@is_rtl : Bool,
@is_full : Bool
)
end
end
# Describes a web page preview
class WebPage < TLObject
@[JSON::Field(key: "@type")]
getter _type = "webPage"
# Original URL of the link
property url : String
# Author of the content
property author : String
# Duration of the content, in seconds
property duration : Int32
# Height of the embedded preview
property embed_height : Int32
# Width of the embedded preview
property embed_width : Int32
# MIME type of the embedded preview, (e.g., text/html or video/mp4)
property embed_type : String
# URL to show in the embedded preview
property embed_url : String
# Describes a web page preview
property description : String
# Title of the content
property title : String
# Short name of the site (e.g., Google Docs, App Store)
property site_name : String
# Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else
property type : String
# URL to display
property display_url : String
# Version of instant view, available for the web page (currently can be 1 or 2), 0 if none
property instant_view_version : Int32
# Image representing the content; may be null
property photo : Photo?
# Preview of the content as an animation, if available; may be null
property animation : Animation?
# Preview of the content as an audio file, if available; may be null
property audio : Audio?
# Preview of the content as a document, if available (currently only available for small PDF files and ZIP archives); may be null
property document : Document?
# Preview of the content as a sticker for small WEBP files, if available; may be null
property sticker : Sticker?
# Preview of the content as a video, if available; may be null
property video : Video?
# Preview of the content as a video note, if available; may be null
property video_note : VideoNote?
# Preview of the content as a voice note, if available; may be null
property voice_note : VoiceNote?
def initialize(
@url : String,
@author : String,
@duration : Int32,
@embed_height : Int32,
@embed_width : Int32,
@embed_type : String,
@embed_url : String,
@description : String,
@title : String,
@site_name : String,
@type : String,
@display_url : String,
@instant_view_version : Int32,
@photo : Photo? = nil,
@animation : Animation? = nil,
@audio : Audio? = nil,
@document : Document? = nil,
@sticker : Sticker? = nil,
@video : Video? = nil,
@video_note : VideoNote? = nil,
@voice_note : VoiceNote? = nil
)
end
end
# Describes an address
class Address < TLObject
@[JSON::Field(key: "@type")]
getter _type = "address"
# A two-letter ISO 3166-1 alpha-2 country code
property country_code : String
# State, if applicable
property state : String
# City
property city : String
# First line of the address
property street_line1 : String
# Second line of the address
property street_line2 : String
# Address postal code
property postal_code : String
def initialize(
@country_code : String,
@state : String,
@city : String,
@street_line1 : String,
@street_line2 : String,
@postal_code : String
)
end
end
# Portion of the price of a product (e.g., "delivery cost", "tax amount")
class LabeledPricePart < TLObject
@[JSON::Field(key: "@type")]
getter _type = "labeledPricePart"
# Label for this portion of the product price
property label : String
# Currency amount in minimal quantity of the currency
property amount : Int64
def initialize(
@label : String,
@amount : Int64
)
end
end
# Product invoice
class Invoice < TLObject
@[JSON::Field(key: "@type")]
getter _type = "invoice"
# ISO 4217 currency code
property currency : String
# A list of objects used to calculate the total price of the product
property price_parts : Array(LabeledPricePart)
# True, if the payment is a test payment
property is_test : Bool
# True, if the user's name is needed for payment
property need_name : Bool
# True, if the user's phone number is needed for payment
property need_phone_number : Bool
# True, if the user's email address is needed for payment
property need_email_address : Bool
# True, if the user's shipping address is needed for payment
property need_shipping_address : Bool
# True, if the user's phone number will be sent to the provider
property send_phone_number_to_provider : Bool
# True, if the user's email address will be sent to the provider
property send_email_address_to_provider : Bool
# True, if the total price depends on the shipping method
property is_flexible : Bool
def initialize(
@currency : String,
@price_parts : Array(LabeledPricePart),
@is_test : Bool,
@need_name : Bool,
@need_phone_number : Bool,
@need_email_address : Bool,
@need_shipping_address : Bool,
@send_phone_number_to_provider : Bool,
@send_email_address_to_provider : Bool,
@is_flexible : Bool
)
end
end
# Order information
class OrderInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "orderInfo"
# Name of the user
property name : String
# Phone number of the user
property phone_number : String
# Email address of the user
property email_address : String
# Shipping address for this order; may be null
property shipping_address : Address?
def initialize(
@name : String,
@phone_number : String,
@email_address : String,
@shipping_address : Address? = nil
)
end
end
# One shipping option
class ShippingOption < TLObject
@[JSON::Field(key: "@type")]
getter _type = "shippingOption"
# Shipping option identifier
property id : String
# Option title
property title : String
# A list of objects used to calculate the total shipping costs
property price_parts : Array(LabeledPricePart)
def initialize(
@id : String,
@title : String,
@price_parts : Array(LabeledPricePart)
)
end
end
# Contains information about saved card credentials
class SavedCredentials < TLObject
@[JSON::Field(key: "@type")]
getter _type = "savedCredentials"
# Unique identifier of the saved credentials
property id : String
# Title of the saved credentials
property title : String
def initialize(
@id : String,
@title : String
)
end
end
# Applies if a user chooses some previously saved payment credentials. To use their previously saved credentials, the user must have a valid temporary password
class InputCredentialsSaved < InputCredentials
@[JSON::Field(key: "@type")]
getter _type = "inputCredentialsSaved"
# Identifier of the saved credentials
property saved_credentials_id : String
def initialize(
@saved_credentials_id : String
)
end
end
# Applies if a user enters new credentials on a payment provider website
class InputCredentialsNew < InputCredentials
@[JSON::Field(key: "@type")]
getter _type = "inputCredentialsNew"
# Contains JSON-encoded data with a credential identifier from the payment provider
property data : String
# True, if the credential identifier can be saved on the server side
property allow_save : Bool
def initialize(
@data : String,
@allow_save : Bool
)
end
end
# Applies if a user enters new credentials using Android Pay
class InputCredentialsAndroidPay < InputCredentials
@[JSON::Field(key: "@type")]
getter _type = "inputCredentialsAndroidPay"
# JSON-encoded data with the credential identifier
property data : String
def initialize(
@data : String
)
end
end
# Applies if a user enters new credentials using Apple Pay
class InputCredentialsApplePay < InputCredentials
@[JSON::Field(key: "@type")]
getter _type = "inputCredentialsApplePay"
# JSON-encoded data with the credential identifier
property data : String
def initialize(
@data : String
)
end
end
# Stripe payment provider
class PaymentsProviderStripe < TLObject
@[JSON::Field(key: "@type")]
getter _type = "paymentsProviderStripe"
# Stripe API publishable key
property publishable_key : String
# True, if the user country must be provided
property need_country : Bool
# True, if the user ZIP/postal code must be provided
property need_postal_code : Bool
# True, if the cardholder name must be provided
property need_cardholder_name : Bool
def initialize(
@publishable_key : String,
@need_country : Bool,
@need_postal_code : Bool,
@need_cardholder_name : Bool
)
end
end
# Contains information about an invoice payment form
class PaymentForm < TLObject
@[JSON::Field(key: "@type")]
getter _type = "paymentForm"
# Full information of the invoice
property invoice : Invoice
# Payment form URL
property url : String
# True, if the user can choose to save credentials
property can_save_credentials : Bool
# True, if the user will be able to save credentials protected by a password they set up
property need_password : Bool
# Contains information about the payment provider, if available, to support it natively without the need for opening the URL; may be null
property payments_provider : PaymentsProviderStripe?
# Saved server-side order information; may be null
property saved_order_info : OrderInfo?
# Contains information about saved card credentials; may be null
property saved_credentials : SavedCredentials?
def initialize(
@invoice : Invoice,
@url : String,
@can_save_credentials : Bool,
@need_password : Bool,
@payments_provider : PaymentsProviderStripe? = nil,
@saved_order_info : OrderInfo? = nil,
@saved_credentials : SavedCredentials? = nil
)
end
end
# Contains a temporary identifier of validated order information, which is stored for one hour. Also contains the available shipping options
class ValidatedOrderInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "validatedOrderInfo"
# Temporary identifier of the order information
property order_info_id : String
# Available shipping options
property shipping_options : Array(ShippingOption)
def initialize(
@order_info_id : String,
@shipping_options : Array(ShippingOption)
)
end
end
# Contains the result of a payment request
class PaymentResult < TLObject
@[JSON::Field(key: "@type")]
getter _type = "paymentResult"
# True, if the payment request was successful; otherwise the verification_url will be not empty
property success : Bool
# URL for additional payment credentials verification
property verification_url : String
def initialize(
@success : Bool,
@verification_url : String
)
end
end
# Contains information about a successful payment
class PaymentReceipt < TLObject
@[JSON::Field(key: "@type")]
getter _type = "paymentReceipt"
# Point in time (Unix timestamp) when the payment was made
property date : Int32
# User identifier of the payment provider bot
property payments_provider_user_id : Int32
# Contains information about the invoice
property invoice : Invoice
# Title of the saved credentials
property credentials_title : String
# Contains order information; may be null
property order_info : OrderInfo?
# Chosen shipping option; may be null
property shipping_option : ShippingOption?
def initialize(
@date : Int32,
@payments_provider_user_id : Int32,
@invoice : Invoice,
@credentials_title : String,
@order_info : OrderInfo? = nil,
@shipping_option : ShippingOption? = nil
)
end
end
# File with the date it was uploaded
class DatedFile < TLObject
@[JSON::Field(key: "@type")]
getter _type = "datedFile"
# The file
property file : File
# Point in time (Unix timestamp) when the file was uploaded
property date : Int32
def initialize(
@file : File,
@date : Int32
)
end
end
# A Telegram Passport element containing the user's personal details
class PassportElementTypePersonalDetails < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypePersonalDetails"
def initialize
end
end
# A Telegram Passport element containing the user's passport
class PassportElementTypePassport < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypePassport"
def initialize
end
end
# A Telegram Passport element containing the user's driver license
class PassportElementTypeDriverLicense < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypeDriverLicense"
def initialize
end
end
# A Telegram Passport element containing the user's identity card
class PassportElementTypeIdentityCard < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypeIdentityCard"
def initialize
end
end
# A Telegram Passport element containing the user's internal passport
class PassportElementTypeInternalPassport < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypeInternalPassport"
def initialize
end
end
# A Telegram Passport element containing the user's address
class PassportElementTypeAddress < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypeAddress"
def initialize
end
end
# A Telegram Passport element containing the user's utility bill
class PassportElementTypeUtilityBill < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypeUtilityBill"
def initialize
end
end
# A Telegram Passport element containing the user's bank statement
class PassportElementTypeBankStatement < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypeBankStatement"
def initialize
end
end
# A Telegram Passport element containing the user's rental agreement
class PassportElementTypeRentalAgreement < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypeRentalAgreement"
def initialize
end
end
# A Telegram Passport element containing the registration page of the user's passport
class PassportElementTypePassportRegistration < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypePassportRegistration"
def initialize
end
end
# A Telegram Passport element containing the user's temporary registration
class PassportElementTypeTemporaryRegistration < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypeTemporaryRegistration"
def initialize
end
end
# A Telegram Passport element containing the user's phone number
class PassportElementTypePhoneNumber < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypePhoneNumber"
def initialize
end
end
# A Telegram Passport element containing the user's email address
class PassportElementTypeEmailAddress < PassportElementType
@[JSON::Field(key: "@type")]
getter _type = "passportElementTypeEmailAddress"
def initialize
end
end
# Represents a date according to the Gregorian calendar
class Date < TLObject
@[JSON::Field(key: "@type")]
getter _type = "date"
# Day of the month, 1-31
property day : Int32
# Month, 1-12
property month : Int32
# Year, 1-9999
property year : Int32
def initialize(
@day : Int32,
@month : Int32,
@year : Int32
)
end
end
# Contains the user's personal details
class PersonalDetails < TLObject
@[JSON::Field(key: "@type")]
getter _type = "personalDetails"
# First name of the user written in English; 1-255 characters
property first_name : String
# Middle name of the user written in English; 0-255 characters
property middle_name : String
# Last name of the user written in English; 1-255 characters
property last_name : String
# Native first name of the user; 1-255 characters
property native_first_name : String
# Native middle name of the user; 0-255 characters
property native_middle_name : String
# Native last name of the user; 1-255 characters
property native_last_name : String
# Birthdate of the user
property birthdate : Time
# Gender of the user, "male" or "female"
property gender : String
# A two-letter ISO 3166-1 alpha-2 country code of the user's country
property country_code : String
# A two-letter ISO 3166-1 alpha-2 country code of the user's residence country
property residence_country_code : String
def initialize(
@first_name : String,
@middle_name : String,
@last_name : String,
@native_first_name : String,
@native_middle_name : String,
@native_last_name : String,
@birthdate : Time,
@gender : String,
@country_code : String,
@residence_country_code : String
)
end
end
# An identity document
class IdentityDocument < TLObject
@[JSON::Field(key: "@type")]
getter _type = "identityDocument"
# Document number; 1-24 characters
property number : String
# Front side of the document
property front_side : DatedFile
# Reverse side of the document; only for driver license and identity card
property reverse_side : DatedFile
# List of files containing a certified English translation of the document
property translation : Array(DatedFile)
# Document expiry date; may be null
property expiry_date : Time?
# Selfie with the document; may be null
property selfie : DatedFile?
def initialize(
@number : String,
@front_side : DatedFile,
@reverse_side : DatedFile,
@translation : Array(DatedFile),
@expiry_date : Time? = nil,
@selfie : DatedFile? = nil
)
end
end
# An identity document to be saved to Telegram Passport
class InputIdentityDocument < TLObject
@[JSON::Field(key: "@type")]
getter _type = "inputIdentityDocument"
# Document number; 1-24 characters
property number : String
# Document expiry date, if available
property expiry_date : Time
# Front side of the document
property front_side : InputFile
# Reverse side of the document; only for driver license and identity card
property reverse_side : InputFile
# Selfie with the document, if available
property selfie : InputFile
# List of files containing a certified English translation of the document
property translation : Array(InputFile)
def initialize(
@number : String,
@expiry_date : Time,
@front_side : InputFile,
@reverse_side : InputFile,
@selfie : InputFile,
@translation : Array(InputFile)
)
end
end
# A personal document, containing some information about a user
class PersonalDocument < TLObject
@[JSON::Field(key: "@type")]
getter _type = "personalDocument"
# List of files containing the pages of the document
property files : Array(DatedFile)
# List of files containing a certified English translation of the document
property translation : Array(DatedFile)
def initialize(
@files : Array(DatedFile),
@translation : Array(DatedFile)
)
end
end
# A personal document to be saved to Telegram Passport
class InputPersonalDocument < TLObject
@[JSON::Field(key: "@type")]
getter _type = "inputPersonalDocument"
# List of files containing the pages of the document
property files : Array(InputFile)
# List of files containing a certified English translation of the document
property translation : Array(InputFile)
def initialize(
@files : Array(InputFile),
@translation : Array(InputFile)
)
end
end
# A Telegram Passport element containing the user's personal details
class PassportElementPersonalDetails < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementPersonalDetails"
# Personal details of the user
property personal_details : PersonalDetails
def initialize(
@personal_details : PersonalDetails
)
end
end
# A Telegram Passport element containing the user's passport
class PassportElementPassport < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementPassport"
# Passport
property passport : IdentityDocument
def initialize(
@passport : IdentityDocument
)
end
end
# A Telegram Passport element containing the user's driver license
class PassportElementDriverLicense < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementDriverLicense"
# Driver license
property driver_license : IdentityDocument
def initialize(
@driver_license : IdentityDocument
)
end
end
# A Telegram Passport element containing the user's identity card
class PassportElementIdentityCard < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementIdentityCard"
# Identity card
property identity_card : IdentityDocument
def initialize(
@identity_card : IdentityDocument
)
end
end
# A Telegram Passport element containing the user's internal passport
class PassportElementInternalPassport < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementInternalPassport"
# Internal passport
property internal_passport : IdentityDocument
def initialize(
@internal_passport : IdentityDocument
)
end
end
# A Telegram Passport element containing the user's address
class PassportElementAddress < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementAddress"
# Address
property address : Address
def initialize(
@address : Address
)
end
end
# A Telegram Passport element containing the user's utility bill
class PassportElementUtilityBill < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementUtilityBill"
# Utility bill
property utility_bill : PersonalDocument
def initialize(
@utility_bill : PersonalDocument
)
end
end
# A Telegram Passport element containing the user's bank statement
class PassportElementBankStatement < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementBankStatement"
# Bank statement
property bank_statement : PersonalDocument
def initialize(
@bank_statement : PersonalDocument
)
end
end
# A Telegram Passport element containing the user's rental agreement
class PassportElementRentalAgreement < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementRentalAgreement"
# Rental agreement
property rental_agreement : PersonalDocument
def initialize(
@rental_agreement : PersonalDocument
)
end
end
# A Telegram Passport element containing the user's passport registration pages
class PassportElementPassportRegistration < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementPassportRegistration"
# Passport registration pages
property passport_registration : PersonalDocument
def initialize(
@passport_registration : PersonalDocument
)
end
end
# A Telegram Passport element containing the user's temporary registration
class PassportElementTemporaryRegistration < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementTemporaryRegistration"
# Temporary registration
property temporary_registration : PersonalDocument
def initialize(
@temporary_registration : PersonalDocument
)
end
end
# A Telegram Passport element containing the user's phone number
class PassportElementPhoneNumber < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementPhoneNumber"
# Phone number
property phone_number : String
def initialize(
@phone_number : String
)
end
end
# A Telegram Passport element containing the user's email address
class PassportElementEmailAddress < PassportElement
@[JSON::Field(key: "@type")]
getter _type = "passportElementEmailAddress"
# Email address
property email_address : String
def initialize(
@email_address : String
)
end
end
# A Telegram Passport element to be saved containing the user's personal details
class InputPassportElementPersonalDetails < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementPersonalDetails"
# Personal details of the user
property personal_details : PersonalDetails
def initialize(
@personal_details : PersonalDetails
)
end
end
# A Telegram Passport element to be saved containing the user's passport
class InputPassportElementPassport < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementPassport"
# The passport to be saved
property passport : InputIdentityDocument
def initialize(
@passport : InputIdentityDocument
)
end
end
# A Telegram Passport element to be saved containing the user's driver license
class InputPassportElementDriverLicense < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementDriverLicense"
# The driver license to be saved
property driver_license : InputIdentityDocument
def initialize(
@driver_license : InputIdentityDocument
)
end
end
# A Telegram Passport element to be saved containing the user's identity card
class InputPassportElementIdentityCard < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementIdentityCard"
# The identity card to be saved
property identity_card : InputIdentityDocument
def initialize(
@identity_card : InputIdentityDocument
)
end
end
# A Telegram Passport element to be saved containing the user's internal passport
class InputPassportElementInternalPassport < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementInternalPassport"
# The internal passport to be saved
property internal_passport : InputIdentityDocument
def initialize(
@internal_passport : InputIdentityDocument
)
end
end
# A Telegram Passport element to be saved containing the user's address
class InputPassportElementAddress < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementAddress"
# The address to be saved
property address : Address
def initialize(
@address : Address
)
end
end
# A Telegram Passport element to be saved containing the user's utility bill
class InputPassportElementUtilityBill < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementUtilityBill"
# The utility bill to be saved
property utility_bill : InputPersonalDocument
def initialize(
@utility_bill : InputPersonalDocument
)
end
end
# A Telegram Passport element to be saved containing the user's bank statement
class InputPassportElementBankStatement < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementBankStatement"
# The bank statement to be saved
property bank_statement : InputPersonalDocument
def initialize(
@bank_statement : InputPersonalDocument
)
end
end
# A Telegram Passport element to be saved containing the user's rental agreement
class InputPassportElementRentalAgreement < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementRentalAgreement"
# The rental agreement to be saved
property rental_agreement : InputPersonalDocument
def initialize(
@rental_agreement : InputPersonalDocument
)
end
end
# A Telegram Passport element to be saved containing the user's passport registration
class InputPassportElementPassportRegistration < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementPassportRegistration"
# The passport registration page to be saved
property passport_registration : InputPersonalDocument
def initialize(
@passport_registration : InputPersonalDocument
)
end
end
# A Telegram Passport element to be saved containing the user's temporary registration
class InputPassportElementTemporaryRegistration < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementTemporaryRegistration"
# The temporary registration document to be saved
property temporary_registration : InputPersonalDocument
def initialize(
@temporary_registration : InputPersonalDocument
)
end
end
# A Telegram Passport element to be saved containing the user's phone number
class InputPassportElementPhoneNumber < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementPhoneNumber"
# The phone number to be saved
property phone_number : String
def initialize(
@phone_number : String
)
end
end
# A Telegram Passport element to be saved containing the user's email address
class InputPassportElementEmailAddress < InputPassportElement
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementEmailAddress"
# The email address to be saved
property email_address : String
def initialize(
@email_address : String
)
end
end
# Contains information about saved Telegram Passport elements
class PassportElements < TLObject
@[JSON::Field(key: "@type")]
getter _type = "passportElements"
# Telegram Passport elements
property elements : Array(PassportElement)
def initialize(
@elements : Array(PassportElement)
)
end
end
# The element contains an error in an unspecified place. The error will be considered resolved when new data is added
class PassportElementErrorSourceUnspecified < PassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "passportElementErrorSourceUnspecified"
def initialize
end
end
# One of the data fields contains an error. The error will be considered resolved when the value of the field changes
class PassportElementErrorSourceDataField < PassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "passportElementErrorSourceDataField"
# Field name
property field_name : String
def initialize(
@field_name : String
)
end
end
# The front side of the document contains an error. The error will be considered resolved when the file with the front side changes
class PassportElementErrorSourceFrontSide < PassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "passportElementErrorSourceFrontSide"
def initialize
end
end
# The reverse side of the document contains an error. The error will be considered resolved when the file with the reverse side changes
class PassportElementErrorSourceReverseSide < PassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "passportElementErrorSourceReverseSide"
def initialize
end
end
# The selfie with the document contains an error. The error will be considered resolved when the file with the selfie changes
class PassportElementErrorSourceSelfie < PassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "passportElementErrorSourceSelfie"
def initialize
end
end
# One of files with the translation of the document contains an error. The error will be considered resolved when the file changes
class PassportElementErrorSourceTranslationFile < PassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "passportElementErrorSourceTranslationFile"
# Index of a file with the error
property file_index : Int32
def initialize(
@file_index : Int32
)
end
end
# The translation of the document contains an error. The error will be considered resolved when the list of translation files changes
class PassportElementErrorSourceTranslationFiles < PassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "passportElementErrorSourceTranslationFiles"
def initialize
end
end
# The file contains an error. The error will be considered resolved when the file changes
class PassportElementErrorSourceFile < PassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "passportElementErrorSourceFile"
# Index of a file with the error
property file_index : Int32
def initialize(
@file_index : Int32
)
end
end
# The list of attached files contains an error. The error will be considered resolved when the list of files changes
class PassportElementErrorSourceFiles < PassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "passportElementErrorSourceFiles"
def initialize
end
end
# Contains the description of an error in a Telegram Passport element
class PassportElementError < TLObject
@[JSON::Field(key: "@type")]
getter _type = "passportElementError"
# Type of the Telegram Passport element which has the error
property type : PassportElementType
# Error message
property message : String
# Error source
property source : PassportElementErrorSource
def initialize(
@type : PassportElementType,
@message : String,
@source : PassportElementErrorSource
)
end
end
# Contains information about a Telegram Passport element that was requested by a service
class PassportSuitableElement < TLObject
@[JSON::Field(key: "@type")]
getter _type = "passportSuitableElement"
# Type of the element
property type : PassportElementType
# True, if a selfie is required with the identity document
property is_selfie_required : Bool
# True, if a certified English translation is required with the document
property is_translation_required : Bool
# True, if personal details must include the user's name in the language of their country of residence
property is_native_name_required : Bool
def initialize(
@type : PassportElementType,
@is_selfie_required : Bool,
@is_translation_required : Bool,
@is_native_name_required : Bool
)
end
end
# Contains a description of the required Telegram Passport element that was requested by a service
class PassportRequiredElement < TLObject
@[JSON::Field(key: "@type")]
getter _type = "passportRequiredElement"
# List of Telegram Passport elements any of which is enough to provide
property suitable_elements : Array(PassportSuitableElement)
def initialize(
@suitable_elements : Array(PassportSuitableElement)
)
end
end
# Contains information about a Telegram Passport authorization form that was requested
class PassportAuthorizationForm < TLObject
@[JSON::Field(key: "@type")]
getter _type = "passportAuthorizationForm"
# Unique identifier of the authorization form
property id : Int32
# Information about the Telegram Passport elements that need to be provided to complete the form
property required_elements : Array(PassportRequiredElement)
# URL for the privacy policy of the service; may be empty
property privacy_policy_url : String?
def initialize(
@id : Int32,
@required_elements : Array(PassportRequiredElement),
@privacy_policy_url : String? = nil
)
end
end
# Contains information about a Telegram Passport elements and corresponding errors
class PassportElementsWithErrors < TLObject
@[JSON::Field(key: "@type")]
getter _type = "passportElementsWithErrors"
# Telegram Passport elements
property elements : Array(PassportElement)
# Errors in the elements that are already available
property errors : Array(PassportElementError)
def initialize(
@elements : Array(PassportElement),
@errors : Array(PassportElementError)
)
end
end
# Contains encrypted Telegram Passport data credentials
class EncryptedCredentials < TLObject
@[JSON::Field(key: "@type")]
getter _type = "encryptedCredentials"
# The encrypted credentials
property data : String
# The decrypted data hash
property hash : String
# Secret for data decryption, encrypted with the service's public key
property secret : String
def initialize(
@data : String,
@hash : String,
@secret : String
)
end
end
# Contains information about an encrypted Telegram Passport element; for bots only
class EncryptedPassportElement < TLObject
@[JSON::Field(key: "@type")]
getter _type = "encryptedPassportElement"
# Type of Telegram Passport element
property type : PassportElementType
# Encrypted JSON-encoded data about the user
property data : String
# The front side of an identity document
property front_side : DatedFile
# List of files containing a certified English translation of the document
property translation : Array(DatedFile)
# List of attached files
property files : Array(DatedFile)
# Unencrypted data, phone number or email address
property value : String
# Hash of the entire element
property hash : String
# The reverse side of an identity document; may be null
property reverse_side : DatedFile?
# Selfie with the document; may be null
property selfie : DatedFile?
def initialize(
@type : PassportElementType,
@data : String,
@front_side : DatedFile,
@translation : Array(DatedFile),
@files : Array(DatedFile),
@value : String,
@hash : String,
@reverse_side : DatedFile? = nil,
@selfie : DatedFile? = nil
)
end
end
# The element contains an error in an unspecified place. The error will be considered resolved when new data is added
class InputPassportElementErrorSourceUnspecified < InputPassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementErrorSourceUnspecified"
# Current hash of the entire element
property element_hash : String
def initialize(
@element_hash : String
)
end
end
# A data field contains an error. The error is considered resolved when the field's value changes
class InputPassportElementErrorSourceDataField < InputPassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementErrorSourceDataField"
# Field name
property field_name : String
# Current data hash
property data_hash : String
def initialize(
@field_name : String,
@data_hash : String
)
end
end
# The front side of the document contains an error. The error is considered resolved when the file with the front side of the document changes
class InputPassportElementErrorSourceFrontSide < InputPassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementErrorSourceFrontSide"
# Current hash of the file containing the front side
property file_hash : String
def initialize(
@file_hash : String
)
end
end
# The reverse side of the document contains an error. The error is considered resolved when the file with the reverse side of the document changes
class InputPassportElementErrorSourceReverseSide < InputPassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementErrorSourceReverseSide"
# Current hash of the file containing the reverse side
property file_hash : String
def initialize(
@file_hash : String
)
end
end
# The selfie contains an error. The error is considered resolved when the file with the selfie changes
class InputPassportElementErrorSourceSelfie < InputPassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementErrorSourceSelfie"
# Current hash of the file containing the selfie
property file_hash : String
def initialize(
@file_hash : String
)
end
end
# One of the files containing the translation of the document contains an error. The error is considered resolved when the file with the translation changes
class InputPassportElementErrorSourceTranslationFile < InputPassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementErrorSourceTranslationFile"
# Current hash of the file containing the translation
property file_hash : String
def initialize(
@file_hash : String
)
end
end
# The translation of the document contains an error. The error is considered resolved when the list of files changes
class InputPassportElementErrorSourceTranslationFiles < InputPassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementErrorSourceTranslationFiles"
# Current hashes of all files with the translation
property file_hashes : Array(String)
def initialize(
@file_hashes : Array(String)
)
end
end
# The file contains an error. The error is considered resolved when the file changes
class InputPassportElementErrorSourceFile < InputPassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementErrorSourceFile"
# Current hash of the file which has the error
property file_hash : String
def initialize(
@file_hash : String
)
end
end
# The list of attached files contains an error. The error is considered resolved when the file list changes
class InputPassportElementErrorSourceFiles < InputPassportElementErrorSource
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementErrorSourceFiles"
# Current hashes of all attached files
property file_hashes : Array(String)
def initialize(
@file_hashes : Array(String)
)
end
end
# Contains the description of an error in a Telegram Passport element; for bots only
class InputPassportElementError < TLObject
@[JSON::Field(key: "@type")]
getter _type = "inputPassportElementError"
# Type of Telegram Passport element that has the error
property type : PassportElementType
# Error message
property message : String
# Error source
property source : InputPassportElementErrorSource
def initialize(
@type : PassportElementType,
@message : String,
@source : InputPassportElementErrorSource
)
end
end
# A text message
class MessageText < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageText"
# Text of the message
property text : FormattedText
# A preview of the web page that's mentioned in the text; may be null
property web_page : WebPage?
def initialize(
@text : FormattedText,
@web_page : WebPage? = nil
)
end
end
# An animation message (GIF-style).
class MessageAnimation < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageAnimation"
# The animation description
property animation : Animation
# Animation caption
property caption : FormattedText
# True, if the animation thumbnail must be blurred and the animation must be shown only while tapped
property is_secret : Bool
def initialize(
@animation : Animation,
@caption : FormattedText,
@is_secret : Bool
)
end
end
# An audio message
class MessageAudio < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageAudio"
# The audio description
property audio : Audio
# Audio caption
property caption : FormattedText
def initialize(
@audio : Audio,
@caption : FormattedText
)
end
end
# A document message (general file)
class MessageDocument < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageDocument"
# The document description
property document : Document
# Document caption
property caption : FormattedText
def initialize(
@document : Document,
@caption : FormattedText
)
end
end
# A photo message
class MessagePhoto < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messagePhoto"
# The photo description
property photo : Photo
# Photo caption
property caption : FormattedText
# True, if the photo must be blurred and must be shown only while tapped
property is_secret : Bool
def initialize(
@photo : Photo,
@caption : FormattedText,
@is_secret : Bool
)
end
end
# An expired photo message (self-destructed after TTL has elapsed)
class MessageExpiredPhoto < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageExpiredPhoto"
def initialize
end
end
# A sticker message
class MessageSticker < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageSticker"
# The sticker description
property sticker : Sticker
def initialize(
@sticker : Sticker
)
end
end
# A video message
class MessageVideo < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageVideo"
# The video description
property video : Video
# Video caption
property caption : FormattedText
# True, if the video thumbnail must be blurred and the video must be shown only while tapped
property is_secret : Bool
def initialize(
@video : Video,
@caption : FormattedText,
@is_secret : Bool
)
end
end
# An expired video message (self-destructed after TTL has elapsed)
class MessageExpiredVideo < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageExpiredVideo"
def initialize
end
end
# A video note message
class MessageVideoNote < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageVideoNote"
# The video note description
property video_note : VideoNote
# True, if at least one of the recipients has viewed the video note
property is_viewed : Bool
# True, if the video note thumbnail must be blurred and the video note must be shown only while tapped
property is_secret : Bool
def initialize(
@video_note : VideoNote,
@is_viewed : Bool,
@is_secret : Bool
)
end
end
# A voice note message
class MessageVoiceNote < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageVoiceNote"
# The voice note description
property voice_note : VoiceNote
# Voice note caption
property caption : FormattedText
# True, if at least one of the recipients has listened to the voice note
property is_listened : Bool
def initialize(
@voice_note : VoiceNote,
@caption : FormattedText,
@is_listened : Bool
)
end
end
# A message with a location
class MessageLocation < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageLocation"
# The location description
property location : Location
# Time relative to the message sent date until which the location can be updated, in seconds
property live_period : Int32
# Left time for which the location can be updated, in seconds. updateMessageContent is not sent when this field changes
property expires_in : Int32
def initialize(
@location : Location,
@live_period : Int32,
@expires_in : Int32
)
end
end
# A message with information about a venue
class MessageVenue < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageVenue"
# The venue description
property venue : Venue
def initialize(
@venue : Venue
)
end
end
# A message with a user contact
class MessageContact < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageContact"
# The contact description
property contact : Contact
def initialize(
@contact : Contact
)
end
end
# A message with a game
class MessageGame < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageGame"
# The game description
property game : Game
def initialize(
@game : Game
)
end
end
# A message with a poll
class MessagePoll < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messagePoll"
# The poll description
property poll : Poll
def initialize(
@poll : Poll
)
end
end
# A message with an invoice from a bot
class MessageInvoice < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageInvoice"
# Product title
property title : String
# A message with an invoice from a bot
property description : String
# Currency for the product price
property currency : String
# Product total price in the minimal quantity of the currency
property total_amount : Int64
# Unique invoice bot start_parameter. To share an invoice use the URL https://t.me/{bot_username}?start={start_parameter}
property start_parameter : String
# True, if the invoice is a test invoice
property is_test : Bool
# True, if the shipping address should be specified
property need_shipping_address : Bool
# The identifier of the message with the receipt, after the product has been purchased
property receipt_message_id : Int64
# Product photo; may be null
property photo : Photo?
def initialize(
@title : String,
@description : String,
@currency : String,
@total_amount : Int64,
@start_parameter : String,
@is_test : Bool,
@need_shipping_address : Bool,
@receipt_message_id : Int64,
@photo : Photo? = nil
)
end
end
# A message with information about an ended call
class MessageCall < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageCall"
# Reason why the call was discarded
property discard_reason : CallDiscardReason
# Call duration, in seconds
property duration : Int32
def initialize(
@discard_reason : CallDiscardReason,
@duration : Int32
)
end
end
# A newly created basic group
class MessageBasicGroupChatCreate < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageBasicGroupChatCreate"
# Title of the basic group
property title : String
# User identifiers of members in the basic group
property member_user_ids : Array(Int32)
def initialize(
@title : String,
@member_user_ids : Array(Int32)
)
end
end
# A newly created supergroup or channel
class MessageSupergroupChatCreate < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageSupergroupChatCreate"
# Title of the supergroup or channel
property title : String
def initialize(
@title : String
)
end
end
# An updated chat title
class MessageChatChangeTitle < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageChatChangeTitle"
# New chat title
property title : String
def initialize(
@title : String
)
end
end
# An updated chat photo
class MessageChatChangePhoto < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageChatChangePhoto"
# New chat photo
property photo : Photo
def initialize(
@photo : Photo
)
end
end
# A deleted chat photo
class MessageChatDeletePhoto < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageChatDeletePhoto"
def initialize
end
end
# New chat members were added
class MessageChatAddMembers < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageChatAddMembers"
# User identifiers of the new members
property member_user_ids : Array(Int32)
def initialize(
@member_user_ids : Array(Int32)
)
end
end
# A new member joined the chat by invite link
class MessageChatJoinByLink < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageChatJoinByLink"
def initialize
end
end
# A chat member was deleted
class MessageChatDeleteMember < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageChatDeleteMember"
# User identifier of the deleted chat member
property user_id : Int32
def initialize(
@user_id : Int32
)
end
end
# A basic group was upgraded to a supergroup and was deactivated as the result
class MessageChatUpgradeTo < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageChatUpgradeTo"
# Identifier of the supergroup to which the basic group was upgraded
property supergroup_id : Int32
def initialize(
@supergroup_id : Int32
)
end
end
# A supergroup has been created from a basic group
class MessageChatUpgradeFrom < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageChatUpgradeFrom"
# Title of the newly created supergroup
property title : String
# The identifier of the original basic group
property basic_group_id : Int32
def initialize(
@title : String,
@basic_group_id : Int32
)
end
end
# A message has been pinned
class MessagePinMessage < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messagePinMessage"
# Identifier of the pinned message, can be an identifier of a deleted message or 0
property message_id : Int64
def initialize(
@message_id : Int64
)
end
end
# A screenshot of a message in the chat has been taken
class MessageScreenshotTaken < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageScreenshotTaken"
def initialize
end
end
# The TTL (Time To Live) setting messages in a secret chat has been changed
class MessageChatSetTtl < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageChatSetTtl"
# New TTL
property ttl : Int32
def initialize(
@ttl : Int32
)
end
end
# A non-standard action has happened in the chat
class MessageCustomServiceAction < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageCustomServiceAction"
# Message text to be shown in the chat
property text : String
def initialize(
@text : String
)
end
end
# A new high score was achieved in a game
class MessageGameScore < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageGameScore"
# Identifier of the message with the game, can be an identifier of a deleted message
property game_message_id : Int64
# Identifier of the game; may be different from the games presented in the message with the game
property game_id : String
# New score
property score : Int32
def initialize(
@game_message_id : Int64,
@game_id : String,
@score : Int32
)
end
end
# A payment has been completed
class MessagePaymentSuccessful < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messagePaymentSuccessful"
# Identifier of the message with the corresponding invoice; can be an identifier of a deleted message
property invoice_message_id : Int64
# Currency for the price of the product
property currency : String
# Total price for the product, in the minimal quantity of the currency
property total_amount : Int64
def initialize(
@invoice_message_id : Int64,
@currency : String,
@total_amount : Int64
)
end
end
# A payment has been completed; for bots only
class MessagePaymentSuccessfulBot < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messagePaymentSuccessfulBot"
# Identifier of the message with the corresponding invoice; can be an identifier of a deleted message
property invoice_message_id : Int64
# Currency for price of the product
property currency : String
# Total price for the product, in the minimal quantity of the currency
property total_amount : Int64
# Invoice payload
property invoice_payload : String
# Telegram payment identifier
property telegram_payment_charge_id : String
# Provider payment identifier
property provider_payment_charge_id : String
# Identifier of the shipping option chosen by the user; may be empty if not applicable
property shipping_option_id : String?
# Information about the order; may be null
property order_info : OrderInfo?
def initialize(
@invoice_message_id : Int64,
@currency : String,
@total_amount : Int64,
@invoice_payload : String,
@telegram_payment_charge_id : String,
@provider_payment_charge_id : String,
@shipping_option_id : String? = nil,
@order_info : OrderInfo? = nil
)
end
end
# A contact has registered with Telegram
class MessageContactRegistered < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageContactRegistered"
def initialize
end
end
# The current user has connected a website by logging in using Telegram Login Widget on it
class MessageWebsiteConnected < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageWebsiteConnected"
# Domain name of the connected website
property domain_name : String
def initialize(
@domain_name : String
)
end
end
# Telegram Passport data has been sent
class MessagePassportDataSent < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messagePassportDataSent"
# List of Telegram Passport element types sent
property types : Array(PassportElementType)
def initialize(
@types : Array(PassportElementType)
)
end
end
# Telegram Passport data has been received; for bots only
class MessagePassportDataReceived < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messagePassportDataReceived"
# List of received Telegram Passport elements
property elements : Array(EncryptedPassportElement)
# Encrypted data credentials
property credentials : EncryptedCredentials
def initialize(
@elements : Array(EncryptedPassportElement),
@credentials : EncryptedCredentials
)
end
end
# Message content that is not supported by the client
class MessageUnsupported < MessageContent
@[JSON::Field(key: "@type")]
getter _type = "messageUnsupported"
def initialize
end
end
# A mention of a user by their username
class TextEntityTypeMention < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeMention"
def initialize
end
end
# A hashtag text, beginning with "#"
class TextEntityTypeHashtag < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeHashtag"
def initialize
end
end
# A cashtag text, beginning with "$" and consisting of capital english letters (i.e. "$USD")
class TextEntityTypeCashtag < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeCashtag"
def initialize
end
end
# A bot command, beginning with "/". This shouldn't be highlighted if there are no bots in the chat
class TextEntityTypeBotCommand < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeBotCommand"
def initialize
end
end
# An HTTP URL
class TextEntityTypeUrl < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeUrl"
def initialize
end
end
# An email address
class TextEntityTypeEmailAddress < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeEmailAddress"
def initialize
end
end
# A phone number
class TextEntityTypePhoneNumber < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypePhoneNumber"
def initialize
end
end
# A bold text
class TextEntityTypeBold < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeBold"
def initialize
end
end
# An italic text
class TextEntityTypeItalic < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeItalic"
def initialize
end
end
# An underlined text
class TextEntityTypeUnderline < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeUnderline"
def initialize
end
end
# A strikethrough text
class TextEntityTypeStrikethrough < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeStrikethrough"
def initialize
end
end
# Text that must be formatted as if inside a code HTML tag
class TextEntityTypeCode < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeCode"
def initialize
end
end
# Text that must be formatted as if inside a pre HTML tag
class TextEntityTypePre < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypePre"
def initialize
end
end
# Text that must be formatted as if inside pre, and code HTML tags
class TextEntityTypePreCode < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypePreCode"
# Programming language of the code; as defined by the sender
property language : String
def initialize(
@language : String
)
end
end
# A text description shown instead of a raw URL
class TextEntityTypeTextUrl < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeTextUrl"
# HTTP or tg:// URL to be opened when the link is clicked
property url : String
def initialize(
@url : String
)
end
end
# A text shows instead of a raw mention of the user (e.g., when the user has no username)
class TextEntityTypeMentionName < TextEntityType
@[JSON::Field(key: "@type")]
getter _type = "textEntityTypeMentionName"
# Identifier of the mentioned user
property user_id : Int32
def initialize(
@user_id : Int32
)
end
end
# 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
class InputThumbnail < TLObject
@[JSON::Field(key: "@type")]
getter _type = "inputThumbnail"
# Thumbnail file to send. Sending thumbnails by file_id is currently not supported
property thumbnail : InputFile
# Thumbnail width, usually shouldn't exceed 320. Use 0 if unknown
property width : Int32
# Thumbnail height, usually shouldn't exceed 320. Use 0 if unknown
property height : Int32
def initialize(
@thumbnail : InputFile,
@width : Int32,
@height : Int32
)
end
end
# The message will be sent at the specified date
class MessageSchedulingStateSendAtDate < MessageSchedulingState
@[JSON::Field(key: "@type")]
getter _type = "messageSchedulingStateSendAtDate"
# Date the message will be sent. The date must be within 367 days in the future
property send_date : Int32
def initialize(
@send_date : Int32
)
end
end
# The message will be sent when the peer will be online. Applicable to private chats only and when the exact online status of the peer is known
class MessageSchedulingStateSendWhenOnline < MessageSchedulingState
@[JSON::Field(key: "@type")]
getter _type = "messageSchedulingStateSendWhenOnline"
def initialize
end
end
# Options to be used when a message is send
class SendMessageOptions < TLObject
@[JSON::Field(key: "@type")]
getter _type = "sendMessageOptions"
# Pass true to disable notification for the message. Must be false if the message is sent to a secret chat
property disable_notification : Bool
# Pass true if the message is sent from the background
property from_background : Bool
# Message scheduling state. Messages sent to a secret chat, live location messages and self-destructing messages can't be scheduled; may be null
property scheduling_state : MessageSchedulingState?
def initialize(
@disable_notification : Bool,
@from_background : Bool,
@scheduling_state : MessageSchedulingState? = nil
)
end
end
# A text message
class InputMessageText < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageText"
# Formatted text to be sent; 1-GetOption("message_text_length_max") characters. Only Bold, Italic, Underline, Strikethrough, Code, Pre, PreCode, TextUrl and MentionName entities are allowed to be specified manually
property text : FormattedText
# True, if rich web page previews for URLs in the message text should be disabled
property disable_web_page_preview : Bool
# True, if a chat message draft should be deleted
property clear_draft : Bool
def initialize(
@text : FormattedText,
@disable_web_page_preview : Bool,
@clear_draft : Bool
)
end
end
# An animation message (GIF-style).
class InputMessageAnimation < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageAnimation"
# Animation file to be sent
property animation : InputFile
# Animation thumbnail, if available
property thumbnail : InputThumbnail
# Duration of the animation, in seconds
property duration : Int32
# Width of the animation; may be replaced by the server
property width : Int32
# Height of the animation; may be replaced by the server
property height : Int32
# Animation caption; 0-GetOption("message_caption_length_max") characters
property caption : FormattedText
def initialize(
@animation : InputFile,
@thumbnail : InputThumbnail,
@duration : Int32,
@width : Int32,
@height : Int32,
@caption : FormattedText
)
end
end
# An audio message
class InputMessageAudio < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageAudio"
# Audio file to be sent
property audio : InputFile
# Thumbnail of the cover for the album, if available
property album_cover_thumbnail : InputThumbnail
# Duration of the audio, in seconds; may be replaced by the server
property duration : Int32
# Title of the audio; 0-64 characters; may be replaced by the server
property title : String
# Performer of the audio; 0-64 characters, may be replaced by the server
property performer : String
# Audio caption; 0-GetOption("message_caption_length_max") characters
property caption : FormattedText
def initialize(
@audio : InputFile,
@album_cover_thumbnail : InputThumbnail,
@duration : Int32,
@title : String,
@performer : String,
@caption : FormattedText
)
end
end
# A document message (general file)
class InputMessageDocument < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageDocument"
# Document to be sent
property document : InputFile
# Document thumbnail, if available
property thumbnail : InputThumbnail
# Document caption; 0-GetOption("message_caption_length_max") characters
property caption : FormattedText
def initialize(
@document : InputFile,
@thumbnail : InputThumbnail,
@caption : FormattedText
)
end
end
# A photo message
class InputMessagePhoto < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessagePhoto"
# Photo to send
property photo : InputFile
# Photo thumbnail to be sent, this is sent to the other party in secret chats only
property thumbnail : InputThumbnail
# File identifiers of the stickers added to the photo, if applicable
property added_sticker_file_ids : Array(Int32)
# Photo width
property width : Int32
# Photo height
property height : Int32
# Photo caption; 0-GetOption("message_caption_length_max") characters
property caption : FormattedText
# Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
property ttl : Int32
def initialize(
@photo : InputFile,
@thumbnail : InputThumbnail,
@added_sticker_file_ids : Array(Int32),
@width : Int32,
@height : Int32,
@caption : FormattedText,
@ttl : Int32
)
end
end
# A sticker message
class InputMessageSticker < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageSticker"
# Sticker to be sent
property sticker : InputFile
# Sticker thumbnail, if available
property thumbnail : InputThumbnail
# Sticker width
property width : Int32
# Sticker height
property height : Int32
def initialize(
@sticker : InputFile,
@thumbnail : InputThumbnail,
@width : Int32,
@height : Int32
)
end
end
# A video message
class InputMessageVideo < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageVideo"
# Video to be sent
property video : InputFile
# Video thumbnail, if available
property thumbnail : InputThumbnail
# File identifiers of the stickers added to the video, if applicable
property added_sticker_file_ids : Array(Int32)
# Duration of the video, in seconds
property duration : Int32
# Video width
property width : Int32
# Video height
property height : Int32
# True, if the video should be tried to be streamed
property supports_streaming : Bool
# Video caption; 0-GetOption("message_caption_length_max") characters
property caption : FormattedText
# Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
property ttl : Int32
def initialize(
@video : InputFile,
@thumbnail : InputThumbnail,
@added_sticker_file_ids : Array(Int32),
@duration : Int32,
@width : Int32,
@height : Int32,
@supports_streaming : Bool,
@caption : FormattedText,
@ttl : Int32
)
end
end
# A video note message
class InputMessageVideoNote < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageVideoNote"
# Video note to be sent
property video_note : InputFile
# Video thumbnail, if available
property thumbnail : InputThumbnail
# Duration of the video, in seconds
property duration : Int32
# Video width and height; must be positive and not greater than 640
property length : Int32
def initialize(
@video_note : InputFile,
@thumbnail : InputThumbnail,
@duration : Int32,
@length : Int32
)
end
end
# A voice note message
class InputMessageVoiceNote < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageVoiceNote"
# Voice note to be sent
property voice_note : InputFile
# Duration of the voice note, in seconds
property duration : Int32
# Waveform representation of the voice note, in 5-bit format
property waveform : String
# Voice note caption; 0-GetOption("message_caption_length_max") characters
property caption : FormattedText
def initialize(
@voice_note : InputFile,
@duration : Int32,
@waveform : String,
@caption : FormattedText
)
end
end
# A message with a location
class InputMessageLocation < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageLocation"
# Location to be sent
property location : Location
# Period for which the location can be updated, in seconds; should be between 60 and 86400 for a live location and 0 otherwise
property live_period : Int32
def initialize(
@location : Location,
@live_period : Int32
)
end
end
# A message with information about a venue
class InputMessageVenue < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageVenue"
# Venue to send
property venue : Venue
def initialize(
@venue : Venue
)
end
end
# A message containing a user contact
class InputMessageContact < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageContact"
# Contact to send
property contact : Contact
def initialize(
@contact : Contact
)
end
end
# A message with a game; not supported for channels or secret chats
class InputMessageGame < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageGame"
# User identifier of the bot that owns the game
property bot_user_id : Int32
# Short name of the game
property game_short_name : String
def initialize(
@bot_user_id : Int32,
@game_short_name : String
)
end
end
# A message with an invoice; can be used only by bots and only in private chats
class InputMessageInvoice < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageInvoice"
# Invoice
property invoice : Invoice
# Product title; 1-32 characters
property title : String
# A message with an invoice; can be used only by bots and only in private chats
property description : String
# Product photo URL; optional
property photo_url : String
# Product photo size
property photo_size : Int32
# Product photo width
property photo_width : Int32
# Product photo height
property photo_height : Int32
# The invoice payload
property payload : String
# Payment provider token
property provider_token : String
# JSON-encoded data about the invoice, which will be shared with the payment provider
property provider_data : String
# Unique invoice bot start_parameter for the generation of this invoice
property start_parameter : String
def initialize(
@invoice : Invoice,
@title : String,
@description : String,
@photo_url : String,
@photo_size : Int32,
@photo_width : Int32,
@photo_height : Int32,
@payload : String,
@provider_token : String,
@provider_data : String,
@start_parameter : String
)
end
end
# A message with a poll. Polls can't be sent to secret chats. Polls can be sent only to a private chat with a bot
class InputMessagePoll < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessagePoll"
# Poll question, 1-255 characters
property question : String
# List of poll answer options, 2-10 strings 1-100 characters each
property options : Array(String)
# True, if the poll voters are anonymous. Non-anonymous polls can't be sent or forwarded to channels
property is_anonymous : Bool
# Type of the poll
property type : PollType
# True, if the poll needs to be sent already closed; for bots only
property is_closed : Bool?
def initialize(
@question : String,
@options : Array(String),
@is_anonymous : Bool,
@type : PollType,
@is_closed : Bool? = nil
)
end
end
# A forwarded message
class InputMessageForwarded < InputMessageContent
@[JSON::Field(key: "@type")]
getter _type = "inputMessageForwarded"
# Identifier for the chat this forwarded message came from
property from_chat_id : Int64
# Identifier of the message to forward
property message_id : Int64
# True, if a game message should be shared within a launched game; applies only to game messages
property in_game_share : Bool
# True, if content of the message needs to be copied without a link to the original message. Always true if the message is forwarded to a secret chat
property send_copy : Bool
# True, if media caption of the message copy needs to be removed. Ignored if send_copy is false
property remove_caption : Bool
def initialize(
@from_chat_id : Int64,
@message_id : Int64,
@in_game_share : Bool,
@send_copy : Bool,
@remove_caption : Bool
)
end
end
# Returns all found messages, no filter is applied
class SearchMessagesFilterEmpty < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterEmpty"
def initialize
end
end
# Returns only animation messages
class SearchMessagesFilterAnimation < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterAnimation"
def initialize
end
end
# Returns only audio messages
class SearchMessagesFilterAudio < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterAudio"
def initialize
end
end
# Returns only document messages
class SearchMessagesFilterDocument < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterDocument"
def initialize
end
end
# Returns only photo messages
class SearchMessagesFilterPhoto < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterPhoto"
def initialize
end
end
# Returns only video messages
class SearchMessagesFilterVideo < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterVideo"
def initialize
end
end
# Returns only voice note messages
class SearchMessagesFilterVoiceNote < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterVoiceNote"
def initialize
end
end
# Returns only photo and video messages
class SearchMessagesFilterPhotoAndVideo < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterPhotoAndVideo"
def initialize
end
end
# Returns only messages containing URLs
class SearchMessagesFilterUrl < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterUrl"
def initialize
end
end
# Returns only messages containing chat photos
class SearchMessagesFilterChatPhoto < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterChatPhoto"
def initialize
end
end
# Returns only call messages
class SearchMessagesFilterCall < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterCall"
def initialize
end
end
# Returns only incoming call messages with missed/declined discard reasons
class SearchMessagesFilterMissedCall < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterMissedCall"
def initialize
end
end
# Returns only video note messages
class SearchMessagesFilterVideoNote < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterVideoNote"
def initialize
end
end
# Returns only voice and video note messages
class SearchMessagesFilterVoiceAndVideoNote < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterVoiceAndVideoNote"
def initialize
end
end
# Returns only messages with mentions of the current user, or messages that are replies to their messages
class SearchMessagesFilterMention < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterMention"
def initialize
end
end
# 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 SearchMessagesFilterUnreadMention < SearchMessagesFilter
@[JSON::Field(key: "@type")]
getter _type = "searchMessagesFilterUnreadMention"
def initialize
end
end
# The user is typing a message
class ChatActionTyping < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionTyping"
def initialize
end
end
# The user is recording a video
class ChatActionRecordingVideo < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionRecordingVideo"
def initialize
end
end
# The user is uploading a video
class ChatActionUploadingVideo < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionUploadingVideo"
# Upload progress, as a percentage
property progress : Int32
def initialize(
@progress : Int32
)
end
end
# The user is recording a voice note
class ChatActionRecordingVoiceNote < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionRecordingVoiceNote"
def initialize
end
end
# The user is uploading a voice note
class ChatActionUploadingVoiceNote < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionUploadingVoiceNote"
# Upload progress, as a percentage
property progress : Int32
def initialize(
@progress : Int32
)
end
end
# The user is uploading a photo
class ChatActionUploadingPhoto < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionUploadingPhoto"
# Upload progress, as a percentage
property progress : Int32
def initialize(
@progress : Int32
)
end
end
# The user is uploading a document
class ChatActionUploadingDocument < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionUploadingDocument"
# Upload progress, as a percentage
property progress : Int32
def initialize(
@progress : Int32
)
end
end
# The user is picking a location or venue to send
class ChatActionChoosingLocation < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionChoosingLocation"
def initialize
end
end
# The user is picking a contact to send
class ChatActionChoosingContact < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionChoosingContact"
def initialize
end
end
# The user has started to play a game
class ChatActionStartPlayingGame < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionStartPlayingGame"
def initialize
end
end
# The user is recording a video note
class ChatActionRecordingVideoNote < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionRecordingVideoNote"
def initialize
end
end
# The user is uploading a video note
class ChatActionUploadingVideoNote < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionUploadingVideoNote"
# Upload progress, as a percentage
property progress : Int32
def initialize(
@progress : Int32
)
end
end
# The user has cancelled the previous action
class ChatActionCancel < ChatAction
@[JSON::Field(key: "@type")]
getter _type = "chatActionCancel"
def initialize
end
end
# The user status was never changed
class UserStatusEmpty < UserStatus
@[JSON::Field(key: "@type")]
getter _type = "userStatusEmpty"
def initialize
end
end
# The user is online
class UserStatusOnline < UserStatus
@[JSON::Field(key: "@type")]
getter _type = "userStatusOnline"
# Point in time (Unix timestamp) when the user's online status will expire
property expires : Int32
def initialize(
@expires : Int32
)
end
end
# The user is offline
class UserStatusOffline < UserStatus
@[JSON::Field(key: "@type")]
getter _type = "userStatusOffline"
# Point in time (Unix timestamp) when the user was last online
property was_online : Int32
def initialize(
@was_online : Int32
)
end
end
# The user was online recently
class UserStatusRecently < UserStatus
@[JSON::Field(key: "@type")]
getter _type = "userStatusRecently"
def initialize
end
end
# The user is offline, but was online last week
class UserStatusLastWeek < UserStatus
@[JSON::Field(key: "@type")]
getter _type = "userStatusLastWeek"
def initialize
end
end
# The user is offline, but was online last month
class UserStatusLastMonth < UserStatus
@[JSON::Field(key: "@type")]
getter _type = "userStatusLastMonth"
def initialize
end
end
# Represents a list of stickers
class Stickers < TLObject
@[JSON::Field(key: "@type")]
getter _type = "stickers"
# List of stickers
property stickers : Array(Sticker)
def initialize(
@stickers : Array(Sticker)
)
end
end
# Represents a list of emoji
class Emojis < TLObject
@[JSON::Field(key: "@type")]
getter _type = "emojis"
# List of emojis
property emojis : Array(String)
def initialize(
@emojis : Array(String)
)
end
end
# Represents a sticker set
class StickerSet < TLObject
@[JSON::Field(key: "@type")]
getter _type = "stickerSet"
# Identifier of the sticker set
property id : String
# Title of the sticker set
property title : String
# Name of the sticker set
property name : String
# True, if the sticker set has been installed by the current user
property is_installed : Bool
# True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously
property is_archived : Bool
# True, if the sticker set is official
property is_official : Bool
# True, is the stickers in the set are animated
property is_animated : Bool
# True, if the stickers in the set are masks
property is_masks : Bool
# True for already viewed trending sticker sets
property is_viewed : Bool
# List of stickers in this set
property stickers : Array(Sticker)
# A list of emoji corresponding to the stickers in the same order. The list is only for informational purposes, because a sticker is always sent with a fixed emoji from the corresponding Sticker object
property emojis : Array(Emojis)
# Sticker set thumbnail in WEBP format with width and height 100; may be null. The file can be downloaded only before the thumbnail is changed
property thumbnail : PhotoSize?
def initialize(
@id : String,
@title : String,
@name : String,
@is_installed : Bool,
@is_archived : Bool,
@is_official : Bool,
@is_animated : Bool,
@is_masks : Bool,
@is_viewed : Bool,
@stickers : Array(Sticker),
@emojis : Array(Emojis),
@thumbnail : PhotoSize? = nil
)
end
end
# Represents short information about a sticker set
class StickerSetInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "stickerSetInfo"
# Identifier of the sticker set
property id : String
# Title of the sticker set
property title : String
# Name of the sticker set
property name : String
# True, if the sticker set has been installed by current user
property is_installed : Bool
# True, if the sticker set has been archived. A sticker set can't be installed and archived simultaneously
property is_archived : Bool
# True, if the sticker set is official
property is_official : Bool
# True, is the stickers in the set are animated
property is_animated : Bool
# True, if the stickers in the set are masks
property is_masks : Bool
# True for already viewed trending sticker sets
property is_viewed : Bool
# Total number of stickers in the set
property size : Int32
# Contains up to the first 5 stickers from the set, depending on the context. If the client needs more stickers the full set should be requested
property covers : Array(Sticker)
# Sticker set thumbnail in WEBP format with width and height 100; may be null
property thumbnail : PhotoSize?
def initialize(
@id : String,
@title : String,
@name : String,
@is_installed : Bool,
@is_archived : Bool,
@is_official : Bool,
@is_animated : Bool,
@is_masks : Bool,
@is_viewed : Bool,
@size : Int32,
@covers : Array(Sticker),
@thumbnail : PhotoSize? = nil
)
end
end
# Represents a list of sticker sets
class StickerSets < TLObject
@[JSON::Field(key: "@type")]
getter _type = "stickerSets"
# Approximate total number of sticker sets found
property total_count : Int32
# List of sticker sets
property sets : Array(StickerSetInfo)
def initialize(
@total_count : Int32,
@sets : Array(StickerSetInfo)
)
end
end
# The call wasn't discarded, or the reason is unknown
class CallDiscardReasonEmpty < CallDiscardReason
@[JSON::Field(key: "@type")]
getter _type = "callDiscardReasonEmpty"
def initialize
end
end
# The call was ended before the conversation started. It was cancelled by the caller or missed by the other party
class CallDiscardReasonMissed < CallDiscardReason
@[JSON::Field(key: "@type")]
getter _type = "callDiscardReasonMissed"
def initialize
end
end
# The call was ended before the conversation started. It was declined by the other party
class CallDiscardReasonDeclined < CallDiscardReason
@[JSON::Field(key: "@type")]
getter _type = "callDiscardReasonDeclined"
def initialize
end
end
# The call was ended during the conversation because the users were disconnected
class CallDiscardReasonDisconnected < CallDiscardReason
@[JSON::Field(key: "@type")]
getter _type = "callDiscardReasonDisconnected"
def initialize
end
end
# The call was ended because one of the parties hung up
class CallDiscardReasonHungUp < CallDiscardReason
@[JSON::Field(key: "@type")]
getter _type = "callDiscardReasonHungUp"
def initialize
end
end
# Specifies the supported call protocols
class CallProtocol < TLObject
@[JSON::Field(key: "@type")]
getter _type = "callProtocol"
# True, if UDP peer-to-peer connections are supported
property udp_p2p : Bool
# True, if connection through UDP reflectors is supported
property udp_reflector : Bool
# The minimum supported API layer; use 65
property min_layer : Int32
# The maximum supported API layer; use 65
property max_layer : Int32
def initialize(
@udp_p2p : Bool,
@udp_reflector : Bool,
@min_layer : Int32,
@max_layer : Int32
)
end
end
# Describes the address of UDP reflectors
class CallConnection < TLObject
@[JSON::Field(key: "@type")]
getter _type = "callConnection"
# Reflector identifier
property id : String
# IPv4 reflector address
property ip : String
# IPv6 reflector address
property ipv6 : String
# Reflector port number
property port : Int32
# Connection peer tag
property peer_tag : String
def initialize(
@id : String,
@ip : String,
@ipv6 : String,
@port : Int32,
@peer_tag : String
)
end
end
# Contains the call identifier
class CallId < TLObject
@[JSON::Field(key: "@type")]
getter _type = "callId"
# Call identifier
property id : Int32
def initialize(
@id : Int32
)
end
end
# The call is pending, waiting to be accepted by a user
class CallStatePending < CallState
@[JSON::Field(key: "@type")]
getter _type = "callStatePending"
# True, if the call has already been created by the server
property is_created : Bool
# True, if the call has already been received by the other party
property is_received : Bool
def initialize(
@is_created : Bool,
@is_received : Bool
)
end
end
# The call has been answered and encryption keys are being exchanged
class CallStateExchangingKeys < CallState
@[JSON::Field(key: "@type")]
getter _type = "callStateExchangingKeys"
def initialize
end
end
# The call is ready to use
class CallStateReady < CallState
@[JSON::Field(key: "@type")]
getter _type = "callStateReady"
# Call protocols supported by the peer
property protocol : CallProtocol
# Available UDP reflectors
property connections : Array(CallConnection)
# A JSON-encoded call config
property config : String
# Call encryption key
property encryption_key : String
# Encryption key emojis fingerprint
property emojis : Array(String)
# True, if peer-to-peer connection is allowed by users privacy settings
property allow_p2p : Bool
def initialize(
@protocol : CallProtocol,
@connections : Array(CallConnection),
@config : String,
@encryption_key : String,
@emojis : Array(String),
@allow_p2p : Bool
)
end
end
# The call is hanging up after discardCall has been called
class CallStateHangingUp < CallState
@[JSON::Field(key: "@type")]
getter _type = "callStateHangingUp"
def initialize
end
end
# The call has ended successfully
class CallStateDiscarded < CallState
@[JSON::Field(key: "@type")]
getter _type = "callStateDiscarded"
# The reason, why the call has ended
property reason : CallDiscardReason
# True, if the call rating should be sent to the server
property need_rating : Bool
# True, if the call debug information should be sent to the server
property need_debug_information : Bool
def initialize(
@reason : CallDiscardReason,
@need_rating : Bool,
@need_debug_information : Bool
)
end
end
# The call has ended with an error
class CallStateError < CallState
@[JSON::Field(key: "@type")]
getter _type = "callStateError"
# Error. An error with the code 4005000 will be returned if an outgoing call is missed because of an expired timeout
property error : Error
def initialize(
@error : Error
)
end
end
# The user heard their own voice
class CallProblemEcho < CallProblem
@[JSON::Field(key: "@type")]
getter _type = "callProblemEcho"
def initialize
end
end
# The user heard background noise
class CallProblemNoise < CallProblem
@[JSON::Field(key: "@type")]
getter _type = "callProblemNoise"
def initialize
end
end
# The other side kept disappearing
class CallProblemInterruptions < CallProblem
@[JSON::Field(key: "@type")]
getter _type = "callProblemInterruptions"
def initialize
end
end
# The speech was distorted
class CallProblemDistortedSpeech < CallProblem
@[JSON::Field(key: "@type")]
getter _type = "callProblemDistortedSpeech"
def initialize
end
end
# The user couldn't hear the other side
class CallProblemSilentLocal < CallProblem
@[JSON::Field(key: "@type")]
getter _type = "callProblemSilentLocal"
def initialize
end
end
# The other side couldn't hear the user
class CallProblemSilentRemote < CallProblem
@[JSON::Field(key: "@type")]
getter _type = "callProblemSilentRemote"
def initialize
end
end
# The call ended unexpectedly
class CallProblemDropped < CallProblem
@[JSON::Field(key: "@type")]
getter _type = "callProblemDropped"
def initialize
end
end
# Describes a call
class Call < TLObject
@[JSON::Field(key: "@type")]
getter _type = "call"
# Call identifier, not persistent
property id : Int32
# Peer user identifier
property user_id : Int32
# True, if the call is outgoing
property is_outgoing : Bool
# Call state
property state : CallState
def initialize(
@id : Int32,
@user_id : Int32,
@is_outgoing : Bool,
@state : CallState
)
end
end
# Contains settings for the authentication of the user's phone number
class PhoneNumberAuthenticationSettings < TLObject
@[JSON::Field(key: "@type")]
getter _type = "phoneNumberAuthenticationSettings"
# Pass true if the authentication code may be sent via flash call to the specified phone number
property allow_flash_call : Bool
# Pass true if the authenticated phone number is used on the current device
property is_current_phone_number : Bool
# For official applications only. True, if the app can use Android SMS Retriever API (requires Google Play Services >= 10.2) to automatically receive the authentication code from the SMS. See https://developers.google.com/identity/sms-retriever/ for more details
property allow_sms_retriever_api : Bool
def initialize(
@allow_flash_call : Bool,
@is_current_phone_number : Bool,
@allow_sms_retriever_api : Bool
)
end
end
# Represents a list of animations
class Animations < TLObject
@[JSON::Field(key: "@type")]
getter _type = "animations"
# List of animations
property animations : Array(Animation)
def initialize(
@animations : Array(Animation)
)
end
end
# Represents the result of an ImportContacts request
class ImportedContacts < TLObject
@[JSON::Field(key: "@type")]
getter _type = "importedContacts"
# User identifiers of the imported contacts in the same order as they were specified in the request; 0 if the contact is not yet a registered user
property user_ids : Array(Int32)
# The number of users that imported the corresponding contact; 0 for already registered users or if unavailable
property importer_count : Array(Int32)
def initialize(
@user_ids : Array(Int32),
@importer_count : Array(Int32)
)
end
end
# Contains an HTTP URL
class HttpUrl < TLObject
@[JSON::Field(key: "@type")]
getter _type = "httpUrl"
# The URL
property url : String
def initialize(
@url : String
)
end
end
# Represents a link to an animated GIF
class InputInlineQueryResultAnimatedGif < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultAnimatedGif"
# Unique identifier of the query result
property id : String
# Title of the query result
property title : String
# URL of the static result thumbnail (JPEG or GIF), if it exists
property thumbnail_url : String
# The URL of the GIF-file (file size must not exceed 1MB)
property gif_url : String
# Duration of the GIF, in seconds
property gif_duration : Int32
# Width of the GIF
property gif_width : Int32
# Height of the GIF
property gif_height : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAnimation, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@title : String,
@thumbnail_url : String,
@gif_url : String,
@gif_duration : Int32,
@gif_width : Int32,
@gif_height : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents a link to an animated (i.e. without sound) H.264/MPEG-4 AVC video
class InputInlineQueryResultAnimatedMpeg4 < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultAnimatedMpeg4"
# Unique identifier of the query result
property id : String
# Title of the result
property title : String
# URL of the static result thumbnail (JPEG or GIF), if it exists
property thumbnail_url : String
# The URL of the MPEG4-file (file size must not exceed 1MB)
property mpeg4_url : String
# Duration of the video, in seconds
property mpeg4_duration : Int32
# Width of the video
property mpeg4_width : Int32
# Height of the video
property mpeg4_height : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAnimation, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@title : String,
@thumbnail_url : String,
@mpeg4_url : String,
@mpeg4_duration : Int32,
@mpeg4_width : Int32,
@mpeg4_height : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents a link to an article or web page
class InputInlineQueryResultArticle < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultArticle"
# Unique identifier of the query result
property id : String
# URL of the result, if it exists
property url : String
# True, if the URL must be not shown
property hide_url : Bool
# Title of the result
property title : String
# Represents a link to an article or web page
property description : String
# URL of the result thumbnail, if it exists
property thumbnail_url : String
# Thumbnail width, if known
property thumbnail_width : Int32
# Thumbnail height, if known
property thumbnail_height : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@url : String,
@hide_url : Bool,
@title : String,
@description : String,
@thumbnail_url : String,
@thumbnail_width : Int32,
@thumbnail_height : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents a link to an MP3 audio file
class InputInlineQueryResultAudio < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultAudio"
# Unique identifier of the query result
property id : String
# Title of the audio file
property title : String
# Performer of the audio file
property performer : String
# The URL of the audio file
property audio_url : String
# Audio file duration, in seconds
property audio_duration : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageAudio, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@title : String,
@performer : String,
@audio_url : String,
@audio_duration : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents a user contact
class InputInlineQueryResultContact < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultContact"
# Unique identifier of the query result
property id : String
# User contact
property contact : Contact
# URL of the result thumbnail, if it exists
property thumbnail_url : String
# Thumbnail width, if known
property thumbnail_width : Int32
# Thumbnail height, if known
property thumbnail_height : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@contact : Contact,
@thumbnail_url : String,
@thumbnail_width : Int32,
@thumbnail_height : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents a link to a file
class InputInlineQueryResultDocument < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultDocument"
# Unique identifier of the query result
property id : String
# Title of the resulting file
property title : String
# Represents a link to a file
property description : String
# URL of the file
property document_url : String
# MIME type of the file content; only "application/pdf" and "application/zip" are currently allowed
property mime_type : String
# The URL of the file thumbnail, if it exists
property thumbnail_url : String
# Width of the thumbnail
property thumbnail_width : Int32
# Height of the thumbnail
property thumbnail_height : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageDocument, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@title : String,
@description : String,
@document_url : String,
@mime_type : String,
@thumbnail_url : String,
@thumbnail_width : Int32,
@thumbnail_height : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents a game
class InputInlineQueryResultGame < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultGame"
# Unique identifier of the query result
property id : String
# Short name of the game
property game_short_name : String
# Message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
def initialize(
@id : String,
@game_short_name : String,
@reply_markup : ReplyMarkup
)
end
end
# Represents a point on the map
class InputInlineQueryResultLocation < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultLocation"
# Unique identifier of the query result
property id : String
# Location result
property location : Location
# Amount of time relative to the message sent time until the location can be updated, in seconds
property live_period : Int32
# Title of the result
property title : String
# URL of the result thumbnail, if it exists
property thumbnail_url : String
# Thumbnail width, if known
property thumbnail_width : Int32
# Thumbnail height, if known
property thumbnail_height : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@location : Location,
@live_period : Int32,
@title : String,
@thumbnail_url : String,
@thumbnail_width : Int32,
@thumbnail_height : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents link to a JPEG image
class InputInlineQueryResultPhoto < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultPhoto"
# Unique identifier of the query result
property id : String
# Title of the result, if known
property title : String
# Represents link to a JPEG image
property description : String
# URL of the photo thumbnail, if it exists
property thumbnail_url : String
# The URL of the JPEG photo (photo size must not exceed 5MB)
property photo_url : String
# Width of the photo
property photo_width : Int32
# Height of the photo
property photo_height : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessagePhoto, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@title : String,
@description : String,
@thumbnail_url : String,
@photo_url : String,
@photo_width : Int32,
@photo_height : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents a link to a WEBP or TGS sticker
class InputInlineQueryResultSticker < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultSticker"
# Unique identifier of the query result
property id : String
# URL of the sticker thumbnail, if it exists
property thumbnail_url : String
# The URL of the WEBP or TGS sticker (sticker file size must not exceed 5MB)
property sticker_url : String
# Width of the sticker
property sticker_width : Int32
# Height of the sticker
property sticker_height : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, inputMessageSticker, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@thumbnail_url : String,
@sticker_url : String,
@sticker_width : Int32,
@sticker_height : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents information about a venue
class InputInlineQueryResultVenue < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultVenue"
# Unique identifier of the query result
property id : String
# Venue result
property venue : Venue
# URL of the result thumbnail, if it exists
property thumbnail_url : String
# Thumbnail width, if known
property thumbnail_width : Int32
# Thumbnail height, if known
property thumbnail_height : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@venue : Venue,
@thumbnail_url : String,
@thumbnail_width : Int32,
@thumbnail_height : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents a link to a page containing an embedded video player or a video file
class InputInlineQueryResultVideo < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultVideo"
# Unique identifier of the query result
property id : String
# Title of the result
property title : String
# Represents a link to a page containing an embedded video player or a video file
property description : String
# The URL of the video thumbnail (JPEG), if it exists
property thumbnail_url : String
# URL of the embedded video player or video file
property video_url : String
# MIME type of the content of the video URL, only "text/html" or "video/mp4" are currently supported
property mime_type : String
# Width of the video
property video_width : Int32
# Height of the video
property video_height : Int32
# Video duration, in seconds
property video_duration : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageVideo, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@title : String,
@description : String,
@thumbnail_url : String,
@video_url : String,
@mime_type : String,
@video_width : Int32,
@video_height : Int32,
@video_duration : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents a link to an opus-encoded audio file within an OGG container, single channel audio
class InputInlineQueryResultVoiceNote < InputInlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inputInlineQueryResultVoiceNote"
# Unique identifier of the query result
property id : String
# Title of the voice note
property title : String
# The URL of the voice note file
property voice_note_url : String
# Duration of the voice note, in seconds
property voice_note_duration : Int32
# The message reply markup. Must be of type replyMarkupInlineKeyboard or null
property reply_markup : ReplyMarkup
# The content of the message to be sent. Must be one of the following types: InputMessageText, InputMessageVoiceNote, InputMessageLocation, InputMessageVenue or InputMessageContact
property input_message_content : InputMessageContent
def initialize(
@id : String,
@title : String,
@voice_note_url : String,
@voice_note_duration : Int32,
@reply_markup : ReplyMarkup,
@input_message_content : InputMessageContent
)
end
end
# Represents a link to an article or web page
class InlineQueryResultArticle < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultArticle"
# Unique identifier of the query result
property id : String
# URL of the result, if it exists
property url : String
# True, if the URL must be not shown
property hide_url : Bool
# Title of the result
property title : String
# Represents a link to an article or web page
property description : String
# Result thumbnail; may be null
property thumbnail : PhotoSize?
def initialize(
@id : String,
@url : String,
@hide_url : Bool,
@title : String,
@description : String,
@thumbnail : PhotoSize? = nil
)
end
end
# Represents a user contact
class InlineQueryResultContact < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultContact"
# Unique identifier of the query result
property id : String
# A user contact
property contact : Contact
# Result thumbnail; may be null
property thumbnail : PhotoSize?
def initialize(
@id : String,
@contact : Contact,
@thumbnail : PhotoSize? = nil
)
end
end
# Represents a point on the map
class InlineQueryResultLocation < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultLocation"
# Unique identifier of the query result
property id : String
# Location result
property location : Location
# Title of the result
property title : String
# Result thumbnail; may be null
property thumbnail : PhotoSize?
def initialize(
@id : String,
@location : Location,
@title : String,
@thumbnail : PhotoSize? = nil
)
end
end
# Represents information about a venue
class InlineQueryResultVenue < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultVenue"
# Unique identifier of the query result
property id : String
# Venue result
property venue : Venue
# Result thumbnail; may be null
property thumbnail : PhotoSize?
def initialize(
@id : String,
@venue : Venue,
@thumbnail : PhotoSize? = nil
)
end
end
# Represents information about a game
class InlineQueryResultGame < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultGame"
# Unique identifier of the query result
property id : String
# Game result
property game : Game
def initialize(
@id : String,
@game : Game
)
end
end
# Represents an animation file
class InlineQueryResultAnimation < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultAnimation"
# Unique identifier of the query result
property id : String
# Animation file
property animation : Animation
# Animation title
property title : String
def initialize(
@id : String,
@animation : Animation,
@title : String
)
end
end
# Represents an audio file
class InlineQueryResultAudio < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultAudio"
# Unique identifier of the query result
property id : String
# Audio file
property audio : Audio
def initialize(
@id : String,
@audio : Audio
)
end
end
# Represents a document
class InlineQueryResultDocument < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultDocument"
# Unique identifier of the query result
property id : String
# Document
property document : Document
# Document title
property title : String
# Represents a document
property description : String
def initialize(
@id : String,
@document : Document,
@title : String,
@description : String
)
end
end
# Represents a photo
class InlineQueryResultPhoto < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultPhoto"
# Unique identifier of the query result
property id : String
# Photo
property photo : Photo
# Title of the result, if known
property title : String
# Represents a photo
property description : String
def initialize(
@id : String,
@photo : Photo,
@title : String,
@description : String
)
end
end
# Represents a sticker
class InlineQueryResultSticker < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultSticker"
# Unique identifier of the query result
property id : String
# Sticker
property sticker : Sticker
def initialize(
@id : String,
@sticker : Sticker
)
end
end
# Represents a video
class InlineQueryResultVideo < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultVideo"
# Unique identifier of the query result
property id : String
# Video
property video : Video
# Title of the video
property title : String
# Represents a video
property description : String
def initialize(
@id : String,
@video : Video,
@title : String,
@description : String
)
end
end
# Represents a voice note
class InlineQueryResultVoiceNote < InlineQueryResult
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResultVoiceNote"
# Unique identifier of the query result
property id : String
# Voice note
property voice_note : VoiceNote
# Title of the voice note
property title : String
def initialize(
@id : String,
@voice_note : VoiceNote,
@title : String
)
end
end
# Represents the results of the inline query. Use sendInlineQueryResultMessage to send the result of the query
class InlineQueryResults < TLObject
@[JSON::Field(key: "@type")]
getter _type = "inlineQueryResults"
# Unique identifier of the inline query
property inline_query_id : String
# The offset for the next request. If empty, there are no more results
property next_offset : String
# Results of the query
property results : Array(InlineQueryResult)
# If non-empty, this text should be shown on the button, which opens a private chat with the bot and sends the bot a start message with the switch_pm_parameter
property switch_pm_text : String
# Parameter for the bot start message
property switch_pm_parameter : String
def initialize(
@inline_query_id : String,
@next_offset : String,
@results : Array(InlineQueryResult),
@switch_pm_text : String,
@switch_pm_parameter : String
)
end
end
# The payload from a general callback button
class CallbackQueryPayloadData < CallbackQueryPayload
@[JSON::Field(key: "@type")]
getter _type = "callbackQueryPayloadData"
# Data that was attached to the callback button
property data : String
def initialize(
@data : String
)
end
end
# The payload from a game callback button
class CallbackQueryPayloadGame < CallbackQueryPayload
@[JSON::Field(key: "@type")]
getter _type = "callbackQueryPayloadGame"
# A short name of the game that was attached to the callback button
property game_short_name : String
def initialize(
@game_short_name : String
)
end
end
# Contains a bot's answer to a callback query
class CallbackQueryAnswer < TLObject
@[JSON::Field(key: "@type")]
getter _type = "callbackQueryAnswer"
# Text of the answer
property text : String
# True, if an alert should be shown to the user instead of a toast notification
property show_alert : Bool
# URL to be opened
property url : String
def initialize(
@text : String,
@show_alert : Bool,
@url : String
)
end
end
# Contains the result of a custom request
class CustomRequestResult < TLObject
@[JSON::Field(key: "@type")]
getter _type = "customRequestResult"
# A JSON-serialized result
property result : String
def initialize(
@result : String
)
end
end
# Contains one row of the game high score table
class GameHighScore < TLObject
@[JSON::Field(key: "@type")]
getter _type = "gameHighScore"
# Position in the high score table
property position : Int32
# User identifier
property user_id : Int32
# User score
property score : Int32
def initialize(
@position : Int32,
@user_id : Int32,
@score : Int32
)
end
end
# Contains a list of game high scores
class GameHighScores < TLObject
@[JSON::Field(key: "@type")]
getter _type = "gameHighScores"
# A list of game high scores
property scores : Array(GameHighScore)
def initialize(
@scores : Array(GameHighScore)
)
end
end
# A message was edited
class ChatEventMessageEdited < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventMessageEdited"
# The original message before the edit
property old_message : Message
# The message after it was edited
property new_message : Message
def initialize(
@old_message : Message,
@new_message : Message
)
end
end
# A message was deleted
class ChatEventMessageDeleted < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventMessageDeleted"
# Deleted message
property message : Message
def initialize(
@message : Message
)
end
end
# A poll in a message was stopped
class ChatEventPollStopped < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventPollStopped"
# The message with the poll
property message : Message
def initialize(
@message : Message
)
end
end
# A message was pinned
class ChatEventMessagePinned < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventMessagePinned"
# Pinned message
property message : Message
def initialize(
@message : Message
)
end
end
# A message was unpinned
class ChatEventMessageUnpinned < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventMessageUnpinned"
def initialize
end
end
# A new member joined the chat
class ChatEventMemberJoined < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventMemberJoined"
def initialize
end
end
# A member left the chat
class ChatEventMemberLeft < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventMemberLeft"
def initialize
end
end
# A new chat member was invited
class ChatEventMemberInvited < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventMemberInvited"
# New member user identifier
property user_id : Int32
# New member status
property status : ChatMemberStatus
def initialize(
@user_id : Int32,
@status : ChatMemberStatus
)
end
end
# A chat member has gained/lost administrator status, or the list of their administrator privileges has changed
class ChatEventMemberPromoted < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventMemberPromoted"
# Chat member user identifier
property user_id : Int32
# Previous status of the chat member
property old_status : ChatMemberStatus
# New status of the chat member
property new_status : ChatMemberStatus
def initialize(
@user_id : Int32,
@old_status : ChatMemberStatus,
@new_status : ChatMemberStatus
)
end
end
# A chat member was restricted/unrestricted or banned/unbanned, or the list of their restrictions has changed
class ChatEventMemberRestricted < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventMemberRestricted"
# Chat member user identifier
property user_id : Int32
# Previous status of the chat member
property old_status : ChatMemberStatus
# New status of the chat member
property new_status : ChatMemberStatus
def initialize(
@user_id : Int32,
@old_status : ChatMemberStatus,
@new_status : ChatMemberStatus
)
end
end
# The chat title was changed
class ChatEventTitleChanged < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventTitleChanged"
# Previous chat title
property old_title : String
# New chat title
property new_title : String
def initialize(
@old_title : String,
@new_title : String
)
end
end
# The chat permissions was changed
class ChatEventPermissionsChanged < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventPermissionsChanged"
# Previous chat permissions
property old_permissions : ChatPermissions
# New chat permissions
property new_permissions : ChatPermissions
def initialize(
@old_permissions : ChatPermissions,
@new_permissions : ChatPermissions
)
end
end
# The chat description was changed
class ChatEventDescriptionChanged < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventDescriptionChanged"
# Previous chat description
property old_description : String
# New chat description
property new_description : String
def initialize(
@old_description : String,
@new_description : String
)
end
end
# The chat username was changed
class ChatEventUsernameChanged < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventUsernameChanged"
# Previous chat username
property old_username : String
# New chat username
property new_username : String
def initialize(
@old_username : String,
@new_username : String
)
end
end
# The chat photo was changed
class ChatEventPhotoChanged < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventPhotoChanged"
# Previous chat photo value; may be null
property old_photo : Photo?
# New chat photo value; may be null
property new_photo : Photo?
def initialize(
@old_photo : Photo? = nil,
@new_photo : Photo? = nil
)
end
end
# The can_invite_users permission of a supergroup chat was toggled
class ChatEventInvitesToggled < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventInvitesToggled"
# New value of can_invite_users permission
property can_invite_users : Bool
def initialize(
@can_invite_users : Bool
)
end
end
# The linked chat of a supergroup was changed
class ChatEventLinkedChatChanged < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventLinkedChatChanged"
# Previous supergroup linked chat identifier
property old_linked_chat_id : Int64
# New supergroup linked chat identifier
property new_linked_chat_id : Int64
def initialize(
@old_linked_chat_id : Int64,
@new_linked_chat_id : Int64
)
end
end
# The slow_mode_delay setting of a supergroup was changed
class ChatEventSlowModeDelayChanged < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventSlowModeDelayChanged"
# Previous value of slow_mode_delay
property old_slow_mode_delay : Int32
# New value of slow_mode_delay
property new_slow_mode_delay : Int32
def initialize(
@old_slow_mode_delay : Int32,
@new_slow_mode_delay : Int32
)
end
end
# The sign_messages setting of a channel was toggled
class ChatEventSignMessagesToggled < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventSignMessagesToggled"
# New value of sign_messages
property sign_messages : Bool
def initialize(
@sign_messages : Bool
)
end
end
# The supergroup sticker set was changed
class ChatEventStickerSetChanged < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventStickerSetChanged"
# Previous identifier of the chat sticker set; 0 if none
property old_sticker_set_id : String
# New identifier of the chat sticker set; 0 if none
property new_sticker_set_id : String
def initialize(
@old_sticker_set_id : String,
@new_sticker_set_id : String
)
end
end
# The supergroup location was changed
class ChatEventLocationChanged < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventLocationChanged"
# Previous location; may be null
property old_location : ChatLocation?
# New location; may be null
property new_location : ChatLocation?
def initialize(
@old_location : ChatLocation? = nil,
@new_location : ChatLocation? = nil
)
end
end
# The is_all_history_available setting of a supergroup was toggled
class ChatEventIsAllHistoryAvailableToggled < ChatEventAction
@[JSON::Field(key: "@type")]
getter _type = "chatEventIsAllHistoryAvailableToggled"
# New value of is_all_history_available
property is_all_history_available : Bool
def initialize(
@is_all_history_available : Bool
)
end
end
# Represents a chat event
class ChatEvent < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatEvent"
# Chat event identifier
property id : String
# Point in time (Unix timestamp) when the event happened
property date : Int32
# Identifier of the user who performed the action that triggered the event
property user_id : Int32
# Action performed by the user
property action : ChatEventAction
def initialize(
@id : String,
@date : Int32,
@user_id : Int32,
@action : ChatEventAction
)
end
end
# Contains a list of chat events
class ChatEvents < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatEvents"
# List of events
property events : Array(ChatEvent)
def initialize(
@events : Array(ChatEvent)
)
end
end
# Represents a set of filters used to obtain a chat event log
class ChatEventLogFilters < TLObject
@[JSON::Field(key: "@type")]
getter _type = "chatEventLogFilters"
# True, if message edits should be returned
property message_edits : Bool
# True, if message deletions should be returned
property message_deletions : Bool
# True, if pin/unpin events should be returned
property message_pins : Bool
# True, if members joining events should be returned
property member_joins : Bool
# True, if members leaving events should be returned
property member_leaves : Bool
# True, if invited member events should be returned
property member_invites : Bool
# True, if member promotion/demotion events should be returned
property member_promotions : Bool
# True, if member restricted/unrestricted/banned/unbanned events should be returned
property member_restrictions : Bool
# True, if changes in chat information should be returned
property info_changes : Bool
# True, if changes in chat settings should be returned
property setting_changes : Bool
def initialize(
@message_edits : Bool,
@message_deletions : Bool,
@message_pins : Bool,
@member_joins : Bool,
@member_leaves : Bool,
@member_invites : Bool,
@member_promotions : Bool,
@member_restrictions : Bool,
@info_changes : Bool,
@setting_changes : Bool
)
end
end
# An ordinary language pack string
class LanguagePackStringValueOrdinary < LanguagePackStringValue
@[JSON::Field(key: "@type")]
getter _type = "languagePackStringValueOrdinary"
# String value
property value : String
def initialize(
@value : String
)
end
end
# 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 LanguagePackStringValuePluralized < LanguagePackStringValue
@[JSON::Field(key: "@type")]
getter _type = "languagePackStringValuePluralized"
# Value for zero objects
property zero_value : String
# Value for one object
property one_value : String
# Value for two objects
property two_value : String
# Value for few objects
property few_value : String
# Value for many objects
property many_value : String
# Default value
property other_value : String
def initialize(
@zero_value : String,
@one_value : String,
@two_value : String,
@few_value : String,
@many_value : String,
@other_value : String
)
end
end
# A deleted language pack string, the value should be taken from the built-in english language pack
class LanguagePackStringValueDeleted < LanguagePackStringValue
@[JSON::Field(key: "@type")]
getter _type = "languagePackStringValueDeleted"
def initialize
end
end
# Represents one language pack string
class LanguagePackString < TLObject
@[JSON::Field(key: "@type")]
getter _type = "languagePackString"
# String key
property key : String
# String value
property value : LanguagePackStringValue
def initialize(
@key : String,
@value : LanguagePackStringValue
)
end
end
# Contains a list of language pack strings
class LanguagePackStrings < TLObject
@[JSON::Field(key: "@type")]
getter _type = "languagePackStrings"
# A list of language pack strings
property strings : Array(LanguagePackString)
def initialize(
@strings : Array(LanguagePackString)
)
end
end
# Contains information about a language pack
class LanguagePackInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "languagePackInfo"
# Unique language pack identifier
property id : String
# Language name
property name : String
# Name of the language in that language
property native_name : String
# 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
property plural_code : String
# True, if the language pack is official
property is_official : Bool
# True, if the language pack strings are RTL
property is_rtl : Bool
# True, if the language pack is a beta language pack
property is_beta : Bool
# True, if the language pack is installed by the current user
property is_installed : Bool
# Total number of non-deleted strings from the language pack
property total_string_count : Int32
# Total number of translated strings from the language pack
property translated_string_count : Int32
# Total number of non-deleted strings from the language pack available locally
property local_string_count : Int32
# Link to language translation interface; empty for custom local language packs
property translation_url : String
# 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
property base_language_pack_id : String?
def initialize(
@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,
@base_language_pack_id : String? = nil
)
end
end
# Contains information about the current localization target
class LocalizationTargetInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "localizationTargetInfo"
# List of available language packs for this application
property language_packs : Array(LanguagePackInfo)
def initialize(
@language_packs : Array(LanguagePackInfo)
)
end
end
# A token for Firebase Cloud Messaging
class DeviceTokenFirebaseCloudMessaging < DeviceToken
@[JSON::Field(key: "@type")]
getter _type = "deviceTokenFirebaseCloudMessaging"
# True, if push notifications should be additionally encrypted
property encrypt : Bool
# Device registration token; may be empty to de-register a device
property token : String?
def initialize(
@encrypt : Bool,
@token : String? = nil
)
end
end
# A token for Apple Push Notification service
class DeviceTokenApplePush < DeviceToken
@[JSON::Field(key: "@type")]
getter _type = "deviceTokenApplePush"
# True, if App Sandbox is enabled
property is_app_sandbox : Bool
# Device token; may be empty to de-register a device
property device_token : String?
def initialize(
@is_app_sandbox : Bool,
@device_token : String? = nil
)
end
end
# A token for Apple Push Notification service VoIP notifications
class DeviceTokenApplePushVoIP < DeviceToken
@[JSON::Field(key: "@type")]
getter _type = "deviceTokenApplePushVoIP"
# True, if App Sandbox is enabled
property is_app_sandbox : Bool
# True, if push notifications should be additionally encrypted
property encrypt : Bool
# Device token; may be empty to de-register a device
property device_token : String?
def initialize(
@is_app_sandbox : Bool,
@encrypt : Bool,
@device_token : String? = nil
)
end
end
# A token for Windows Push Notification Services
class DeviceTokenWindowsPush < DeviceToken
@[JSON::Field(key: "@type")]
getter _type = "deviceTokenWindowsPush"
# The access token that will be used to send notifications; may be empty to de-register a device
property access_token : String?
def initialize(
@access_token : String? = nil
)
end
end
# A token for Microsoft Push Notification Service
class DeviceTokenMicrosoftPush < DeviceToken
@[JSON::Field(key: "@type")]
getter _type = "deviceTokenMicrosoftPush"
# Push notification channel URI; may be empty to de-register a device
property channel_uri : String?
def initialize(
@channel_uri : String? = nil
)
end
end
# A token for Microsoft Push Notification Service VoIP channel
class DeviceTokenMicrosoftPushVoIP < DeviceToken
@[JSON::Field(key: "@type")]
getter _type = "deviceTokenMicrosoftPushVoIP"
# Push notification channel URI; may be empty to de-register a device
property channel_uri : String?
def initialize(
@channel_uri : String? = nil
)
end
end
# A token for web Push API
class DeviceTokenWebPush < DeviceToken
@[JSON::Field(key: "@type")]
getter _type = "deviceTokenWebPush"
# Base64url-encoded P-256 elliptic curve Diffie-Hellman public key
property p256dh_base64url : String
# Base64url-encoded authentication secret
property auth_base64url : String
# Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device
property endpoint : String?
def initialize(
@p256dh_base64url : String,
@auth_base64url : String,
@endpoint : String? = nil
)
end
end
# A token for Simple Push API for Firefox OS
class DeviceTokenSimplePush < DeviceToken
@[JSON::Field(key: "@type")]
getter _type = "deviceTokenSimplePush"
# Absolute URL exposed by the push service where the application server can send push messages; may be empty to de-register a device
property endpoint : String?
def initialize(
@endpoint : String? = nil
)
end
end
# A token for Ubuntu Push Client service
class DeviceTokenUbuntuPush < DeviceToken
@[JSON::Field(key: "@type")]
getter _type = "deviceTokenUbuntuPush"
# Token; may be empty to de-register a device
property token : String?
def initialize(
@token : String? = nil
)
end
end
# A token for BlackBerry Push Service
class DeviceTokenBlackBerryPush < DeviceToken
@[JSON::Field(key: "@type")]
getter _type = "deviceTokenBlackBerryPush"
# Token; may be empty to de-register a device
property token : String?
def initialize(
@token : String? = nil
)
end
end
# A token for Tizen Push Service
class DeviceTokenTizenPush < DeviceToken
@[JSON::Field(key: "@type")]
getter _type = "deviceTokenTizenPush"
# Push service registration identifier; may be empty to de-register a device
property reg_id : String?
def initialize(
@reg_id : String? = nil
)
end
end
# Contains a globally unique push receiver identifier, which can be used to identify which account has received a push notification
class PushReceiverId < TLObject
@[JSON::Field(key: "@type")]
getter _type = "pushReceiverId"
# The globally unique identifier of push notification subscription
property id : String
def initialize(
@id : String
)
end
end
# Describes a solid fill of a background
class BackgroundFillSolid < BackgroundFill
@[JSON::Field(key: "@type")]
getter _type = "backgroundFillSolid"
# A color of the background in the RGB24 format
property color : Int32
def initialize(
@color : Int32
)
end
end
# Describes a gradient fill of a background
class BackgroundFillGradient < BackgroundFill
@[JSON::Field(key: "@type")]
getter _type = "backgroundFillGradient"
# A top color of the background in the RGB24 format
property top_color : Int32
# A bottom color of the background in the RGB24 format
property bottom_color : Int32
# Clockwise rotation angle of the gradient, in degrees; 0-359. Should be always divisible by 45
property rotation_angle : Int32
def initialize(
@top_color : Int32,
@bottom_color : Int32,
@rotation_angle : Int32
)
end
end
# A wallpaper in JPEG format
class BackgroundTypeWallpaper < BackgroundType
@[JSON::Field(key: "@type")]
getter _type = "backgroundTypeWallpaper"
# True, if the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12
property is_blurred : Bool
# True, if the background needs to be slightly moved when device is tilted
property is_moving : Bool
def initialize(
@is_blurred : Bool,
@is_moving : Bool
)
end
end
# A PNG or TGV (gzipped subset of SVG with MIME type "application/x-tgwallpattern") pattern to be combined with the background fill chosen by the user
class BackgroundTypePattern < BackgroundType
@[JSON::Field(key: "@type")]
getter _type = "backgroundTypePattern"
# Description of the background fill
property fill : BackgroundFill
# Intensity of the pattern when it is shown above the filled background, 0-100
property intensity : Int32
# True, if the background needs to be slightly moved when device is tilted
property is_moving : Bool
def initialize(
@fill : BackgroundFill,
@intensity : Int32,
@is_moving : Bool
)
end
end
# A filled background
class BackgroundTypeFill < BackgroundType
@[JSON::Field(key: "@type")]
getter _type = "backgroundTypeFill"
# Description of the background fill
property fill : BackgroundFill
def initialize(
@fill : BackgroundFill
)
end
end
# Describes a chat background
class Background < TLObject
@[JSON::Field(key: "@type")]
getter _type = "background"
# Unique background identifier
property id : String
# True, if this is one of default backgrounds
property is_default : Bool
# True, if the background is dark and is recommended to be used with dark theme
property is_dark : Bool
# Unique background name
property name : String
# Type of the background
property type : BackgroundType
# Document with the background; may be null. Null only for filled backgrounds
property document : Document?
def initialize(
@id : String,
@is_default : Bool,
@is_dark : Bool,
@name : String,
@type : BackgroundType,
@document : Document? = nil
)
end
end
# Contains a list of backgrounds
class Backgrounds < TLObject
@[JSON::Field(key: "@type")]
getter _type = "backgrounds"
# A list of backgrounds
property backgrounds : Array(Background)
def initialize(
@backgrounds : Array(Background)
)
end
end
# A background from a local file
class InputBackgroundLocal < InputBackground
@[JSON::Field(key: "@type")]
getter _type = "inputBackgroundLocal"
# Background file to use. Only inputFileLocal and inputFileGenerated are supported. The file must be in JPEG format for wallpapers and in PNG format for patterns
property background : InputFile
def initialize(
@background : InputFile
)
end
end
# A background from the server
class InputBackgroundRemote < InputBackground
@[JSON::Field(key: "@type")]
getter _type = "inputBackgroundRemote"
# The background identifier
property background_id : String
def initialize(
@background_id : String
)
end
end
# Contains a list of hashtags
class Hashtags < TLObject
@[JSON::Field(key: "@type")]
getter _type = "hashtags"
# A list of hashtags
property hashtags : Array(String)
def initialize(
@hashtags : Array(String)
)
end
end
# The session can be used
class CanTransferOwnershipResultOk < CanTransferOwnershipResult
@[JSON::Field(key: "@type")]
getter _type = "canTransferOwnershipResultOk"
def initialize
end
end
# The 2-step verification needs to be enabled first
class CanTransferOwnershipResultPasswordNeeded < CanTransferOwnershipResult
@[JSON::Field(key: "@type")]
getter _type = "canTransferOwnershipResultPasswordNeeded"
def initialize
end
end
# The 2-step verification was enabled recently, user needs to wait
class CanTransferOwnershipResultPasswordTooFresh < CanTransferOwnershipResult
@[JSON::Field(key: "@type")]
getter _type = "canTransferOwnershipResultPasswordTooFresh"
# Time left before the session can be used to transfer ownership of a chat, in seconds
property retry_after : Int32
def initialize(
@retry_after : Int32
)
end
end
# The session was created recently, user needs to wait
class CanTransferOwnershipResultSessionTooFresh < CanTransferOwnershipResult
@[JSON::Field(key: "@type")]
getter _type = "canTransferOwnershipResultSessionTooFresh"
# Time left before the session can be used to transfer ownership of a chat, in seconds
property retry_after : Int32
def initialize(
@retry_after : Int32
)
end
end
# The username can be set
class CheckChatUsernameResultOk < CheckChatUsernameResult
@[JSON::Field(key: "@type")]
getter _type = "checkChatUsernameResultOk"
def initialize
end
end
# The username is invalid
class CheckChatUsernameResultUsernameInvalid < CheckChatUsernameResult
@[JSON::Field(key: "@type")]
getter _type = "checkChatUsernameResultUsernameInvalid"
def initialize
end
end
# The username is occupied
class CheckChatUsernameResultUsernameOccupied < CheckChatUsernameResult
@[JSON::Field(key: "@type")]
getter _type = "checkChatUsernameResultUsernameOccupied"
def initialize
end
end
# The user has too much chats with username, one of them should be made private first
class CheckChatUsernameResultPublicChatsTooMuch < CheckChatUsernameResult
@[JSON::Field(key: "@type")]
getter _type = "checkChatUsernameResultPublicChatsTooMuch"
def initialize
end
end
# The user can't be a member of a public supergroup
class CheckChatUsernameResultPublicGroupsUnavailable < CheckChatUsernameResult
@[JSON::Field(key: "@type")]
getter _type = "checkChatUsernameResultPublicGroupsUnavailable"
def initialize
end
end
# A general message with hidden content
class PushMessageContentHidden < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentHidden"
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
def initialize(
@is_pinned : Bool
)
end
end
# An animation message (GIF-style).
class PushMessageContentAnimation < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentAnimation"
# Animation caption
property caption : String
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
# Message content; may be null
property animation : Animation?
def initialize(
@caption : String,
@is_pinned : Bool,
@animation : Animation? = nil
)
end
end
# An audio message
class PushMessageContentAudio < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentAudio"
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
# Message content; may be null
property audio : Audio?
def initialize(
@is_pinned : Bool,
@audio : Audio? = nil
)
end
end
# A message with a user contact
class PushMessageContentContact < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentContact"
# Contact's name
property name : String
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
def initialize(
@name : String,
@is_pinned : Bool
)
end
end
# A contact has registered with Telegram
class PushMessageContentContactRegistered < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentContactRegistered"
def initialize
end
end
# A document message (a general file)
class PushMessageContentDocument < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentDocument"
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
# Message content; may be null
property document : Document?
def initialize(
@is_pinned : Bool,
@document : Document? = nil
)
end
end
# A message with a game
class PushMessageContentGame < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentGame"
# Game title, empty for pinned game message
property title : String
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
def initialize(
@title : String,
@is_pinned : Bool
)
end
end
# A new high score was achieved in a game
class PushMessageContentGameScore < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentGameScore"
# Game title, empty for pinned message
property title : String
# New score, 0 for pinned message
property score : Int32
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
def initialize(
@title : String,
@score : Int32,
@is_pinned : Bool
)
end
end
# A message with an invoice from a bot
class PushMessageContentInvoice < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentInvoice"
# Product price
property price : String
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
def initialize(
@price : String,
@is_pinned : Bool
)
end
end
# A message with a location
class PushMessageContentLocation < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentLocation"
# True, if the location is live
property is_live : Bool
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
def initialize(
@is_live : Bool,
@is_pinned : Bool
)
end
end
# A photo message
class PushMessageContentPhoto < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentPhoto"
# Photo caption
property caption : String
# True, if the photo is secret
property is_secret : Bool
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
# Message content; may be null
property photo : Photo?
def initialize(
@caption : String,
@is_secret : Bool,
@is_pinned : Bool,
@photo : Photo? = nil
)
end
end
# A message with a poll
class PushMessageContentPoll < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentPoll"
# Poll question
property question : String
# True, if the poll is regular and not in quiz mode
property is_regular : Bool
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
def initialize(
@question : String,
@is_regular : Bool,
@is_pinned : Bool
)
end
end
# A screenshot of a message in the chat has been taken
class PushMessageContentScreenshotTaken < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentScreenshotTaken"
def initialize
end
end
# A message with a sticker
class PushMessageContentSticker < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentSticker"
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
# Message content; may be null
property sticker : Sticker?
# Emoji corresponding to the sticker; may be empty
property emoji : String?
def initialize(
@is_pinned : Bool,
@sticker : Sticker? = nil,
@emoji : String? = nil
)
end
end
# A text message
class PushMessageContentText < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentText"
# Message text
property text : String
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
def initialize(
@text : String,
@is_pinned : Bool
)
end
end
# A video message
class PushMessageContentVideo < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentVideo"
# Video caption
property caption : String
# True, if the video is secret
property is_secret : Bool
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
# Message content; may be null
property video : Video?
def initialize(
@caption : String,
@is_secret : Bool,
@is_pinned : Bool,
@video : Video? = nil
)
end
end
# A video note message
class PushMessageContentVideoNote < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentVideoNote"
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
# Message content; may be null
property video_note : VideoNote?
def initialize(
@is_pinned : Bool,
@video_note : VideoNote? = nil
)
end
end
# A voice note message
class PushMessageContentVoiceNote < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentVoiceNote"
# True, if the message is a pinned message with the specified content
property is_pinned : Bool
# Message content; may be null
property voice_note : VoiceNote?
def initialize(
@is_pinned : Bool,
@voice_note : VoiceNote? = nil
)
end
end
# A newly created basic group
class PushMessageContentBasicGroupChatCreate < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentBasicGroupChatCreate"
def initialize
end
end
# New chat members were invited to a group
class PushMessageContentChatAddMembers < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentChatAddMembers"
# Name of the added member
property member_name : String
# True, if the current user was added to the group
property is_current_user : Bool
# True, if the user has returned to the group themself
property is_returned : Bool
def initialize(
@member_name : String,
@is_current_user : Bool,
@is_returned : Bool
)
end
end
# A chat photo was edited
class PushMessageContentChatChangePhoto < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentChatChangePhoto"
def initialize
end
end
# A chat title was edited
class PushMessageContentChatChangeTitle < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentChatChangeTitle"
# New chat title
property title : String
def initialize(
@title : String
)
end
end
# A chat member was deleted
class PushMessageContentChatDeleteMember < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentChatDeleteMember"
# Name of the deleted member
property member_name : String
# True, if the current user was deleted from the group
property is_current_user : Bool
# True, if the user has left the group themself
property is_left : Bool
def initialize(
@member_name : String,
@is_current_user : Bool,
@is_left : Bool
)
end
end
# A new member joined the chat by invite link
class PushMessageContentChatJoinByLink < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentChatJoinByLink"
def initialize
end
end
# A forwarded messages
class PushMessageContentMessageForwards < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentMessageForwards"
# Number of forwarded messages
property total_count : Int32
def initialize(
@total_count : Int32
)
end
end
# A media album
class PushMessageContentMediaAlbum < PushMessageContent
@[JSON::Field(key: "@type")]
getter _type = "pushMessageContentMediaAlbum"
# Number of messages in the album
property total_count : Int32
# True, if the album has at least one photo
property has_photos : Bool
# True, if the album has at least one video
property has_videos : Bool
def initialize(
@total_count : Int32,
@has_photos : Bool,
@has_videos : Bool
)
end
end
# New message was received
class NotificationTypeNewMessage < NotificationType
@[JSON::Field(key: "@type")]
getter _type = "notificationTypeNewMessage"
# The message
property message : Message
def initialize(
@message : Message
)
end
end
# New secret chat was created
class NotificationTypeNewSecretChat < NotificationType
@[JSON::Field(key: "@type")]
getter _type = "notificationTypeNewSecretChat"
def initialize
end
end
# New call was received
class NotificationTypeNewCall < NotificationType
@[JSON::Field(key: "@type")]
getter _type = "notificationTypeNewCall"
# Call identifier
property call_id : Int32
def initialize(
@call_id : Int32
)
end
end
# New message was received through a push notification
class NotificationTypeNewPushMessage < NotificationType
@[JSON::Field(key: "@type")]
getter _type = "notificationTypeNewPushMessage"
# 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
property message_id : Int64
# Sender of the message. Corresponding user may be inaccessible
property sender_user_id : Int32
# Push message content
property content : PushMessageContent
def initialize(
@message_id : Int64,
@sender_user_id : Int32,
@content : PushMessageContent
)
end
end
# A group containing notifications of type notificationTypeNewMessage and notificationTypeNewPushMessage with ordinary unread messages
class NotificationGroupTypeMessages < NotificationGroupType
@[JSON::Field(key: "@type")]
getter _type = "notificationGroupTypeMessages"
def initialize
end
end
# 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 NotificationGroupTypeMentions < NotificationGroupType
@[JSON::Field(key: "@type")]
getter _type = "notificationGroupTypeMentions"
def initialize
end
end
# A group containing a notification of type notificationTypeNewSecretChat
class NotificationGroupTypeSecretChat < NotificationGroupType
@[JSON::Field(key: "@type")]
getter _type = "notificationGroupTypeSecretChat"
def initialize
end
end
# A group containing notifications of type notificationTypeNewCall
class NotificationGroupTypeCalls < NotificationGroupType
@[JSON::Field(key: "@type")]
getter _type = "notificationGroupTypeCalls"
def initialize
end
end
# Contains information about a notification
class Notification < TLObject
@[JSON::Field(key: "@type")]
getter _type = "notification"
# Unique persistent identifier of this notification
property id : Int32
# Notification date
property date : Int32
# True, if the notification was initially silent
property is_silent : Bool
# Notification type
property type : NotificationType
def initialize(
@id : Int32,
@date : Int32,
@is_silent : Bool,
@type : NotificationType
)
end
end
# Describes a group of notifications
class NotificationGroup < TLObject
@[JSON::Field(key: "@type")]
getter _type = "notificationGroup"
# Unique persistent auto-incremented from 1 identifier of the notification group
property id : Int32
# Type of the group
property type : NotificationGroupType
# Identifier of a chat to which all notifications in the group belong
property chat_id : Int64
# Total number of active notifications in the group
property total_count : Int32
# The list of active notifications
property notifications : Array(Notification)
def initialize(
@id : Int32,
@type : NotificationGroupType,
@chat_id : Int64,
@total_count : Int32,
@notifications : Array(Notification)
)
end
end
# Represents a boolean option
class OptionValueBoolean < OptionValue
@[JSON::Field(key: "@type")]
getter _type = "optionValueBoolean"
# The value of the option
property value : Bool
def initialize(
@value : Bool
)
end
end
# Represents an unknown option or an option which has a default value
class OptionValueEmpty < OptionValue
@[JSON::Field(key: "@type")]
getter _type = "optionValueEmpty"
def initialize
end
end
# Represents an integer option
class OptionValueInteger < OptionValue
@[JSON::Field(key: "@type")]
getter _type = "optionValueInteger"
# The value of the option
property value : Int32
def initialize(
@value : Int32
)
end
end
# Represents a string option
class OptionValueString < OptionValue
@[JSON::Field(key: "@type")]
getter _type = "optionValueString"
# The value of the option
property value : String
def initialize(
@value : String
)
end
end
# Represents one member of a JSON object
class JsonObjectMember < TLObject
@[JSON::Field(key: "@type")]
getter _type = "jsonObjectMember"
# Member's key
property key : String
# Member's value
property value : JsonValue
def initialize(
@key : String,
@value : JsonValue
)
end
end
# Represents a null JSON value
class JsonValueNull < JsonValue
@[JSON::Field(key: "@type")]
getter _type = "jsonValueNull"
def initialize
end
end
# Represents a boolean JSON value
class JsonValueBoolean < JsonValue
@[JSON::Field(key: "@type")]
getter _type = "jsonValueBoolean"
# The value
property value : Bool
def initialize(
@value : Bool
)
end
end
# Represents a numeric JSON value
class JsonValueNumber < JsonValue
@[JSON::Field(key: "@type")]
getter _type = "jsonValueNumber"
# The value
property value : Float64
def initialize(
@value : Float64
)
end
end
# Represents a string JSON value
class JsonValueString < JsonValue
@[JSON::Field(key: "@type")]
getter _type = "jsonValueString"
# The value
property value : String
def initialize(
@value : String
)
end
end
# Represents a JSON array
class JsonValueArray < JsonValue
@[JSON::Field(key: "@type")]
getter _type = "jsonValueArray"
# The list of array elements
property values : Array(JsonValue)
def initialize(
@values : Array(JsonValue)
)
end
end
# Represents a JSON object
class JsonValueObject < JsonValue
@[JSON::Field(key: "@type")]
getter _type = "jsonValueObject"
# The list of object members
property members : Array(JsonObjectMember)
def initialize(
@members : Array(JsonObjectMember)
)
end
end
# A rule to allow all users to do something
class UserPrivacySettingRuleAllowAll < UserPrivacySettingRule
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingRuleAllowAll"
def initialize
end
end
# A rule to allow all of a user's contacts to do something
class UserPrivacySettingRuleAllowContacts < UserPrivacySettingRule
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingRuleAllowContacts"
def initialize
end
end
# A rule to allow certain specified users to do something
class UserPrivacySettingRuleAllowUsers < UserPrivacySettingRule
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingRuleAllowUsers"
# The user identifiers, total number of users in all rules must not exceed 1000
property user_ids : Array(Int32)
def initialize(
@user_ids : Array(Int32)
)
end
end
# A rule to allow all members of certain specified basic groups and supergroups to doing something
class UserPrivacySettingRuleAllowChatMembers < UserPrivacySettingRule
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingRuleAllowChatMembers"
# The chat identifiers, total number of chats in all rules must not exceed 20
property chat_ids : Array(Int64)
def initialize(
@chat_ids : Array(Int64)
)
end
end
# A rule to restrict all users from doing something
class UserPrivacySettingRuleRestrictAll < UserPrivacySettingRule
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingRuleRestrictAll"
def initialize
end
end
# A rule to restrict all contacts of a user from doing something
class UserPrivacySettingRuleRestrictContacts < UserPrivacySettingRule
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingRuleRestrictContacts"
def initialize
end
end
# A rule to restrict all specified users from doing something
class UserPrivacySettingRuleRestrictUsers < UserPrivacySettingRule
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingRuleRestrictUsers"
# The user identifiers, total number of users in all rules must not exceed 1000
property user_ids : Array(Int32)
def initialize(
@user_ids : Array(Int32)
)
end
end
# A rule to restrict all members of specified basic groups and supergroups from doing something
class UserPrivacySettingRuleRestrictChatMembers < UserPrivacySettingRule
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingRuleRestrictChatMembers"
# The chat identifiers, total number of chats in all rules must not exceed 20
property chat_ids : Array(Int64)
def initialize(
@chat_ids : Array(Int64)
)
end
end
# A list of privacy rules. Rules are matched in the specified order. The first matched rule defines the privacy setting for a given user. If no rule matches, the action is not allowed
class UserPrivacySettingRules < TLObject
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingRules"
# A list of rules
property rules : Array(UserPrivacySettingRule)
def initialize(
@rules : Array(UserPrivacySettingRule)
)
end
end
# A privacy setting for managing whether the user's online status is visible
class UserPrivacySettingShowStatus < UserPrivacySetting
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingShowStatus"
def initialize
end
end
# A privacy setting for managing whether the user's profile photo is visible
class UserPrivacySettingShowProfilePhoto < UserPrivacySetting
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingShowProfilePhoto"
def initialize
end
end
# A privacy setting for managing whether a link to the user's account is included in forwarded messages
class UserPrivacySettingShowLinkInForwardedMessages < UserPrivacySetting
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingShowLinkInForwardedMessages"
def initialize
end
end
# A privacy setting for managing whether the user's phone number is visible
class UserPrivacySettingShowPhoneNumber < UserPrivacySetting
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingShowPhoneNumber"
def initialize
end
end
# A privacy setting for managing whether the user can be invited to chats
class UserPrivacySettingAllowChatInvites < UserPrivacySetting
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingAllowChatInvites"
def initialize
end
end
# A privacy setting for managing whether the user can be called
class UserPrivacySettingAllowCalls < UserPrivacySetting
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingAllowCalls"
def initialize
end
end
# A privacy setting for managing whether peer-to-peer connections can be used for calls
class UserPrivacySettingAllowPeerToPeerCalls < UserPrivacySetting
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingAllowPeerToPeerCalls"
def initialize
end
end
# A privacy setting for managing whether the user can be found by their phone number. Checked only if the phone number is not known to the other user. Can be set only to "Allow contacts" or "Allow all"
class UserPrivacySettingAllowFindingByPhoneNumber < UserPrivacySetting
@[JSON::Field(key: "@type")]
getter _type = "userPrivacySettingAllowFindingByPhoneNumber"
def initialize
end
end
# Contains information about the period of inactivity after which the current user's account will automatically be deleted
class AccountTtl < TLObject
@[JSON::Field(key: "@type")]
getter _type = "accountTtl"
# Number of days of inactivity before the account will be flagged for deletion; should range from 30-366 days
property days : Int32
def initialize(
@days : Int32
)
end
end
# 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 < TLObject
@[JSON::Field(key: "@type")]
getter _type = "session"
# Session identifier
property id : String
# True, if this session is the current session
property is_current : Bool
# True, if a password is needed to complete authorization of the session
property is_password_pending : Bool
# Telegram API identifier, as provided by the application
property api_id : Int32
# Name of the application, as provided by the application
property application_name : String
# The version of the application, as provided by the application
property application_version : String
# True, if the application is an official application or uses the api_id of an official application
property is_official_application : Bool
# Model of the device the application has been run or is running on, as provided by the application
property device_model : String
# Operating system the application has been run or is running on, as provided by the application
property platform : String
# Version of the operating system the application has been run or is running on, as provided by the application
property system_version : String
# Point in time (Unix timestamp) when the user has logged in
property log_in_date : Int32
# Point in time (Unix timestamp) when the session was last used
property last_active_date : Int32
# IP address from which the session was created, in human-readable format
property ip : String
# A two-letter country code for the country from which the session was created, based on the IP address
property country : String
# Region code from which the session was created, based on the IP address
property region : String
def initialize(
@id : String,
@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
)
end
end
# Contains a list of sessions
class Sessions < TLObject
@[JSON::Field(key: "@type")]
getter _type = "sessions"
# List of sessions
property sessions : Array(Session)
def initialize(
@sessions : Array(Session)
)
end
end
# Contains information about one website the current user is logged in with Telegram
class ConnectedWebsite < TLObject
@[JSON::Field(key: "@type")]
getter _type = "connectedWebsite"
# Website identifier
property id : String
# The domain name of the website
property domain_name : String
# User identifier of a bot linked with the website
property bot_user_id : Int32
# The version of a browser used to log in
property browser : String
# Operating system the browser is running on
property platform : String
# Point in time (Unix timestamp) when the user was logged in
property log_in_date : Int32
# Point in time (Unix timestamp) when obtained authorization was last used
property last_active_date : Int32
# IP address from which the user was logged in, in human-readable format
property ip : String
# Human-readable description of a country and a region, from which the user was logged in, based on the IP address
property location : String
def initialize(
@id : String,
@domain_name : String,
@bot_user_id : Int32,
@browser : String,
@platform : String,
@log_in_date : Int32,
@last_active_date : Int32,
@ip : String,
@location : String
)
end
end
# Contains a list of websites the current user is logged in with Telegram
class ConnectedWebsites < TLObject
@[JSON::Field(key: "@type")]
getter _type = "connectedWebsites"
# List of connected websites
property websites : Array(ConnectedWebsite)
def initialize(
@websites : Array(ConnectedWebsite)
)
end
end
# The chat contains spam messages
class ChatReportReasonSpam < ChatReportReason
@[JSON::Field(key: "@type")]
getter _type = "chatReportReasonSpam"
def initialize
end
end
# The chat promotes violence
class ChatReportReasonViolence < ChatReportReason
@[JSON::Field(key: "@type")]
getter _type = "chatReportReasonViolence"
def initialize
end
end
# The chat contains pornographic messages
class ChatReportReasonPornography < ChatReportReason
@[JSON::Field(key: "@type")]
getter _type = "chatReportReasonPornography"
def initialize
end
end
# The chat has child abuse related content
class ChatReportReasonChildAbuse < ChatReportReason
@[JSON::Field(key: "@type")]
getter _type = "chatReportReasonChildAbuse"
def initialize
end
end
# The chat contains copyrighted content
class ChatReportReasonCopyright < ChatReportReason
@[JSON::Field(key: "@type")]
getter _type = "chatReportReasonCopyright"
def initialize
end
end
# The location-based chat is unrelated to its stated location
class ChatReportReasonUnrelatedLocation < ChatReportReason
@[JSON::Field(key: "@type")]
getter _type = "chatReportReasonUnrelatedLocation"
def initialize
end
end
# A custom reason provided by the user
class ChatReportReasonCustom < ChatReportReason
@[JSON::Field(key: "@type")]
getter _type = "chatReportReasonCustom"
# Report text
property text : String
def initialize(
@text : String
)
end
end
# Contains a public HTTPS link to a message in a supergroup or channel with a username
class PublicMessageLink < TLObject
@[JSON::Field(key: "@type")]
getter _type = "publicMessageLink"
# Message link
property link : String
# HTML-code for embedding the message
property html : String
def initialize(
@link : String,
@html : String
)
end
end
# Contains information about a link to a message in a chat
class MessageLinkInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "messageLinkInfo"
# True, if the link is a public link for a message in a chat
property is_public : Bool
# If found, identifier of the chat to which the message belongs, 0 otherwise
property chat_id : Int64
# True, if the whole media album to which the message belongs is linked
property for_album : Bool
# If found, the linked message; may be null
property message : Message?
def initialize(
@is_public : Bool,
@chat_id : Int64,
@for_album : Bool,
@message : Message? = nil
)
end
end
# Contains a part of a file
class FilePart < TLObject
@[JSON::Field(key: "@type")]
getter _type = "filePart"
# File bytes
property data : String
def initialize(
@data : String
)
end
end
# The data is not a file
class FileTypeNone < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeNone"
def initialize
end
end
# The file is an animation
class FileTypeAnimation < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeAnimation"
def initialize
end
end
# The file is an audio file
class FileTypeAudio < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeAudio"
def initialize
end
end
# The file is a document
class FileTypeDocument < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeDocument"
def initialize
end
end
# The file is a photo
class FileTypePhoto < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypePhoto"
def initialize
end
end
# The file is a profile photo
class FileTypeProfilePhoto < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeProfilePhoto"
def initialize
end
end
# The file was sent to a secret chat (the file type is not known to the server)
class FileTypeSecret < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeSecret"
def initialize
end
end
# The file is a thumbnail of a file from a secret chat
class FileTypeSecretThumbnail < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeSecretThumbnail"
def initialize
end
end
# The file is a file from Secure storage used for storing Telegram Passport files
class FileTypeSecure < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeSecure"
def initialize
end
end
# The file is a sticker
class FileTypeSticker < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeSticker"
def initialize
end
end
# The file is a thumbnail of another file
class FileTypeThumbnail < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeThumbnail"
def initialize
end
end
# The file type is not yet known
class FileTypeUnknown < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeUnknown"
def initialize
end
end
# The file is a video
class FileTypeVideo < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeVideo"
def initialize
end
end
# The file is a video note
class FileTypeVideoNote < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeVideoNote"
def initialize
end
end
# The file is a voice note
class FileTypeVoiceNote < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeVoiceNote"
def initialize
end
end
# The file is a wallpaper or a background pattern
class FileTypeWallpaper < FileType
@[JSON::Field(key: "@type")]
getter _type = "fileTypeWallpaper"
def initialize
end
end
# Contains the storage usage statistics for a specific file type
class StorageStatisticsByFileType < TLObject
@[JSON::Field(key: "@type")]
getter _type = "storageStatisticsByFileType"
# File type
property file_type : FileType
# Total size of the files
property size : Int64
# Total number of files
property count : Int32
def initialize(
@file_type : FileType,
@size : Int64,
@count : Int32
)
end
end
# Contains the storage usage statistics for a specific chat
class StorageStatisticsByChat < TLObject
@[JSON::Field(key: "@type")]
getter _type = "storageStatisticsByChat"
# Chat identifier; 0 if none
property chat_id : Int64
# Total size of the files in the chat
property size : Int64
# Total number of files in the chat
property count : Int32
# Statistics split by file types
property by_file_type : Array(StorageStatisticsByFileType)
def initialize(
@chat_id : Int64,
@size : Int64,
@count : Int32,
@by_file_type : Array(StorageStatisticsByFileType)
)
end
end
# Contains the exact storage usage statistics split by chats and file type
class StorageStatistics < TLObject
@[JSON::Field(key: "@type")]
getter _type = "storageStatistics"
# Total size of files
property size : Int64
# Total number of files
property count : Int32
# Statistics split by chats
property by_chat : Array(StorageStatisticsByChat)
def initialize(
@size : Int64,
@count : Int32,
@by_chat : Array(StorageStatisticsByChat)
)
end
end
# Contains approximate storage usage statistics, excluding files of unknown file type
class StorageStatisticsFast < TLObject
@[JSON::Field(key: "@type")]
getter _type = "storageStatisticsFast"
# Approximate total size of files
property files_size : Int64
# Approximate number of files
property file_count : Int32
# Size of the database
property database_size : Int64
# Size of the language pack database
property language_pack_database_size : Int64
# Size of the TDLib internal log
property log_size : Int64
def initialize(
@files_size : Int64,
@file_count : Int32,
@database_size : Int64,
@language_pack_database_size : Int64,
@log_size : Int64
)
end
end
# Contains database statistics
class DatabaseStatistics < TLObject
@[JSON::Field(key: "@type")]
getter _type = "databaseStatistics"
# Database statistics in an unspecified human-readable format
property statistics : String
def initialize(
@statistics : String
)
end
end
# The network is not available
class NetworkTypeNone < NetworkType
@[JSON::Field(key: "@type")]
getter _type = "networkTypeNone"
def initialize
end
end
# A mobile network
class NetworkTypeMobile < NetworkType
@[JSON::Field(key: "@type")]
getter _type = "networkTypeMobile"
def initialize
end
end
# A mobile roaming network
class NetworkTypeMobileRoaming < NetworkType
@[JSON::Field(key: "@type")]
getter _type = "networkTypeMobileRoaming"
def initialize
end
end
# A Wi-Fi network
class NetworkTypeWiFi < NetworkType
@[JSON::Field(key: "@type")]
getter _type = "networkTypeWiFi"
def initialize
end
end
# A different network type (e.g., Ethernet network)
class NetworkTypeOther < NetworkType
@[JSON::Field(key: "@type")]
getter _type = "networkTypeOther"
def initialize
end
end
# Contains information about the total amount of data that was used to send and receive files
class NetworkStatisticsEntryFile < NetworkStatisticsEntry
@[JSON::Field(key: "@type")]
getter _type = "networkStatisticsEntryFile"
# Type of the file the data is part of
property file_type : FileType
# Type of the network the data was sent through. Call setNetworkType to maintain the actual network type
property network_type : NetworkType
# Total number of bytes sent
property sent_bytes : Int64
# Total number of bytes received
property received_bytes : Int64
def initialize(
@file_type : FileType,
@network_type : NetworkType,
@sent_bytes : Int64,
@received_bytes : Int64
)
end
end
# Contains information about the total amount of data that was used for calls
class NetworkStatisticsEntryCall < NetworkStatisticsEntry
@[JSON::Field(key: "@type")]
getter _type = "networkStatisticsEntryCall"
# Type of the network the data was sent through. Call setNetworkType to maintain the actual network type
property network_type : NetworkType
# Total number of bytes sent
property sent_bytes : Int64
# Total number of bytes received
property received_bytes : Int64
# Total call duration, in seconds
property duration : Float64
def initialize(
@network_type : NetworkType,
@sent_bytes : Int64,
@received_bytes : Int64,
@duration : Float64
)
end
end
# A full list of available network statistic entries
class NetworkStatistics < TLObject
@[JSON::Field(key: "@type")]
getter _type = "networkStatistics"
# Point in time (Unix timestamp) when the app began collecting statistics
property since_date : Int32
# Network statistics entries
property entries : Array(NetworkStatisticsEntry)
def initialize(
@since_date : Int32,
@entries : Array(NetworkStatisticsEntry)
)
end
end
# Contains auto-download settings
class AutoDownloadSettings < TLObject
@[JSON::Field(key: "@type")]
getter _type = "autoDownloadSettings"
# True, if the auto-download is enabled
property is_auto_download_enabled : Bool
# The maximum size of a photo file to be auto-downloaded
property max_photo_file_size : Int32
# The maximum size of a video file to be auto-downloaded
property max_video_file_size : Int32
# The maximum size of other file types to be auto-downloaded
property max_other_file_size : Int32
# The maximum suggested bitrate for uploaded videos
property video_upload_bitrate : Int32
# True, if the beginning of videos needs to be preloaded for instant playback
property preload_large_videos : Bool
# True, if the next audio track needs to be preloaded while the user is listening to an audio file
property preload_next_audio : Bool
# True, if "use less data for calls" option needs to be enabled
property use_less_data_for_calls : Bool
def initialize(
@is_auto_download_enabled : Bool,
@max_photo_file_size : Int32,
@max_video_file_size : Int32,
@max_other_file_size : Int32,
@video_upload_bitrate : Int32,
@preload_large_videos : Bool,
@preload_next_audio : Bool,
@use_less_data_for_calls : Bool
)
end
end
# Contains auto-download settings presets for the user
class AutoDownloadSettingsPresets < TLObject
@[JSON::Field(key: "@type")]
getter _type = "autoDownloadSettingsPresets"
# Preset with lowest settings; supposed to be used by default when roaming
property low : AutoDownloadSettings
# Preset with medium settings; supposed to be used by default when using mobile data
property medium : AutoDownloadSettings
# Preset with highest settings; supposed to be used by default when connected on Wi-Fi
property high : AutoDownloadSettings
def initialize(
@low : AutoDownloadSettings,
@medium : AutoDownloadSettings,
@high : AutoDownloadSettings
)
end
end
# Currently waiting for the network to become available. Use setNetworkType to change the available network type
class ConnectionStateWaitingForNetwork < ConnectionState
@[JSON::Field(key: "@type")]
getter _type = "connectionStateWaitingForNetwork"
def initialize
end
end
# Currently establishing a connection with a proxy server
class ConnectionStateConnectingToProxy < ConnectionState
@[JSON::Field(key: "@type")]
getter _type = "connectionStateConnectingToProxy"
def initialize
end
end
# Currently establishing a connection to the Telegram servers
class ConnectionStateConnecting < ConnectionState
@[JSON::Field(key: "@type")]
getter _type = "connectionStateConnecting"
def initialize
end
end
# Downloading data received while the client was offline
class ConnectionStateUpdating < ConnectionState
@[JSON::Field(key: "@type")]
getter _type = "connectionStateUpdating"
def initialize
end
end
# There is a working connection to the Telegram servers
class ConnectionStateReady < ConnectionState
@[JSON::Field(key: "@type")]
getter _type = "connectionStateReady"
def initialize
end
end
# A category containing frequently used private chats with non-bot users
class TopChatCategoryUsers < TopChatCategory
@[JSON::Field(key: "@type")]
getter _type = "topChatCategoryUsers"
def initialize
end
end
# A category containing frequently used private chats with bot users
class TopChatCategoryBots < TopChatCategory
@[JSON::Field(key: "@type")]
getter _type = "topChatCategoryBots"
def initialize
end
end
# A category containing frequently used basic groups and supergroups
class TopChatCategoryGroups < TopChatCategory
@[JSON::Field(key: "@type")]
getter _type = "topChatCategoryGroups"
def initialize
end
end
# A category containing frequently used channels
class TopChatCategoryChannels < TopChatCategory
@[JSON::Field(key: "@type")]
getter _type = "topChatCategoryChannels"
def initialize
end
end
# A category containing frequently used chats with inline bots sorted by their usage in inline mode
class TopChatCategoryInlineBots < TopChatCategory
@[JSON::Field(key: "@type")]
getter _type = "topChatCategoryInlineBots"
def initialize
end
end
# A category containing frequently used chats used for calls
class TopChatCategoryCalls < TopChatCategory
@[JSON::Field(key: "@type")]
getter _type = "topChatCategoryCalls"
def initialize
end
end
# A category containing frequently used chats used to forward messages
class TopChatCategoryForwardChats < TopChatCategory
@[JSON::Field(key: "@type")]
getter _type = "topChatCategoryForwardChats"
def initialize
end
end
# A URL linking to a user
class TMeUrlTypeUser < TMeUrlType
@[JSON::Field(key: "@type")]
getter _type = "tMeUrlTypeUser"
# Identifier of the user
property user_id : Int32
def initialize(
@user_id : Int32
)
end
end
# A URL linking to a public supergroup or channel
class TMeUrlTypeSupergroup < TMeUrlType
@[JSON::Field(key: "@type")]
getter _type = "tMeUrlTypeSupergroup"
# Identifier of the supergroup or channel
property supergroup_id : Int64
def initialize(
@supergroup_id : Int64
)
end
end
# A chat invite link
class TMeUrlTypeChatInvite < TMeUrlType
@[JSON::Field(key: "@type")]
getter _type = "tMeUrlTypeChatInvite"
# Chat invite link info
property info : ChatInviteLinkInfo
def initialize(
@info : ChatInviteLinkInfo
)
end
end
# A URL linking to a sticker set
class TMeUrlTypeStickerSet < TMeUrlType
@[JSON::Field(key: "@type")]
getter _type = "tMeUrlTypeStickerSet"
# Identifier of the sticker set
property sticker_set_id : String
def initialize(
@sticker_set_id : String
)
end
end
# Represents a URL linking to an internal Telegram entity
class TMeUrl < TLObject
@[JSON::Field(key: "@type")]
getter _type = "tMeUrl"
# URL
property url : String
# Type of the URL
property type : TMeUrlType
def initialize(
@url : String,
@type : TMeUrlType
)
end
end
# Contains a list of t.me URLs
class TMeUrls < TLObject
@[JSON::Field(key: "@type")]
getter _type = "tMeUrls"
# List of URLs
property urls : Array(TMeUrl)
def initialize(
@urls : Array(TMeUrl)
)
end
end
# Contains a counter
class Count < TLObject
@[JSON::Field(key: "@type")]
getter _type = "count"
# Count
property count : Int32
def initialize(
@count : Int32
)
end
end
# Contains some text
class Text < TLObject
@[JSON::Field(key: "@type")]
getter _type = "text"
# Text
property text : String
def initialize(
@text : String
)
end
end
# Contains a value representing a number of seconds
class Seconds < TLObject
@[JSON::Field(key: "@type")]
getter _type = "seconds"
# Number of seconds
property seconds : Float64
def initialize(
@seconds : Float64
)
end
end
# Contains information about a tg:// deep link
class DeepLinkInfo < TLObject
@[JSON::Field(key: "@type")]
getter _type = "deepLinkInfo"
# Text to be shown to the user
property text : FormattedText
# True, if user should be asked to update the application
property need_update_application : Bool
def initialize(
@text : FormattedText,
@need_update_application : Bool
)
end
end
# The text should be parsed in markdown-style
class TextParseModeMarkdown < TextParseMode
@[JSON::Field(key: "@type")]
getter _type = "textParseModeMarkdown"
# Version of the parser: 0 or 1 - Bot API Markdown parse mode, 2 - Bot API MarkdownV2 parse mode
property version : Int32
def initialize(
@version : Int32
)
end
end
# The text should be parsed in HTML-style
class TextParseModeHTML < TextParseMode
@[JSON::Field(key: "@type")]
getter _type = "textParseModeHTML"
def initialize
end
end
# A SOCKS5 proxy server
class ProxyTypeSocks5 < ProxyType
@[JSON::Field(key: "@type")]
getter _type = "proxyTypeSocks5"
# Username for logging in; may be empty
property username : String?
# Password for logging in; may be empty
property password : String?
def initialize(
@username : String? = nil,
@password : String? = nil
)
end
end
# A HTTP transparent proxy server
class ProxyTypeHttp < ProxyType
@[JSON::Field(key: "@type")]
getter _type = "proxyTypeHttp"
# Pass true, if the proxy supports only HTTP requests and doesn't support transparent TCP connections via HTTP CONNECT method
property http_only : Bool
# Username for logging in; may be empty
property username : String?
# Password for logging in; may be empty
property password : String?
def initialize(
@http_only : Bool,
@username : String? = nil,
@password : String? = nil
)
end
end
# An MTProto proxy server
class ProxyTypeMtproto < ProxyType
@[JSON::Field(key: "@type")]
getter _type = "proxyTypeMtproto"
# The proxy's secret in hexadecimal encoding
property secret : String
def initialize(
@secret : String
)
end
end
# Contains information about a proxy server
class Proxy < TLObject
@[JSON::Field(key: "@type")]
getter _type = "proxy"
# Unique identifier of the proxy
property id : Int32
# Proxy server IP address
property server : String
# Proxy server port
property port : Int32
# Point in time (Unix timestamp) when the proxy was last used; 0 if never
property last_used_date : Int32
# True, if the proxy is enabled now
property is_enabled : Bool
# Type of the proxy
property type : ProxyType
def initialize(
@id : Int32,
@server : String,
@port : Int32,
@last_used_date : Int32,
@is_enabled : Bool,
@type : ProxyType
)
end
end
# Represents a list of proxy servers
class Proxies < TLObject
@[JSON::Field(key: "@type")]
getter _type = "proxies"
# List of proxy servers
property proxies : Array(Proxy)
def initialize(
@proxies : Array(Proxy)
)
end
end
# Describes a sticker that should be added to a sticker set
class InputSticker < TLObject
@[JSON::Field(key: "@type")]
getter _type = "inputSticker"
# PNG image with the sticker; must be up to 512 kB in size and fit in a 512x512 square
property png_sticker : InputFile
# Emoji corresponding to the sticker
property emojis : String
# For masks, position where the mask should be placed; may be null
property mask_position : MaskPosition?
def initialize(
@png_sticker : InputFile,
@emojis : String,
@mask_position : MaskPosition? = nil
)
end
end
# The user authorization state has changed
class UpdateAuthorizationState < Update
@[JSON::Field(key: "@type")]
getter _type = "updateAuthorizationState"
# New authorization state
property authorization_state : AuthorizationState
def initialize(
@authorization_state : AuthorizationState
)
end
end
# A new message was received; can also be an outgoing message
class UpdateNewMessage < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNewMessage"
# The new message
property message : Message
def initialize(
@message : Message
)
end
end
# 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
class UpdateMessageSendAcknowledged < Update
@[JSON::Field(key: "@type")]
getter _type = "updateMessageSendAcknowledged"
# The chat identifier of the sent message
property chat_id : Int64
# A temporary message identifier
property message_id : Int64
def initialize(
@chat_id : Int64,
@message_id : Int64
)
end
end
# A message has been successfully sent
class UpdateMessageSendSucceeded < Update
@[JSON::Field(key: "@type")]
getter _type = "updateMessageSendSucceeded"
# Information about the sent message. Usually only the message identifier, date, and content are changed, but almost all other fields can also change
property message : Message
# The previous temporary message identifier
property old_message_id : Int64
def initialize(
@message : Message,
@old_message_id : Int64
)
end
end
# A message failed to send. Be aware that some messages being sent can be irrecoverably deleted, in which case updateDeleteMessages will be received instead of this update
class UpdateMessageSendFailed < Update
@[JSON::Field(key: "@type")]
getter _type = "updateMessageSendFailed"
# Contains information about the message which failed to send
property message : Message
# The previous temporary message identifier
property old_message_id : Int64
# An error code
property error_code : Int32
# Error message
property error_message : String
def initialize(
@message : Message,
@old_message_id : Int64,
@error_code : Int32,
@error_message : String
)
end
end
# The message content has changed
class UpdateMessageContent < Update
@[JSON::Field(key: "@type")]
getter _type = "updateMessageContent"
# Chat identifier
property chat_id : Int64
# Message identifier
property message_id : Int64
# New message content
property new_content : MessageContent
def initialize(
@chat_id : Int64,
@message_id : Int64,
@new_content : MessageContent
)
end
end
# A message was edited. Changes in the message content will come in a separate updateMessageContent
class UpdateMessageEdited < Update
@[JSON::Field(key: "@type")]
getter _type = "updateMessageEdited"
# Chat identifier
property chat_id : Int64
# Message identifier
property message_id : Int64
# Point in time (Unix timestamp) when the message was edited
property edit_date : Int32
# New message reply markup; may be null
property reply_markup : ReplyMarkup?
def initialize(
@chat_id : Int64,
@message_id : Int64,
@edit_date : Int32,
@reply_markup : ReplyMarkup? = nil
)
end
end
# The view count of the message has changed
class UpdateMessageViews < Update
@[JSON::Field(key: "@type")]
getter _type = "updateMessageViews"
# Chat identifier
property chat_id : Int64
# Message identifier
property message_id : Int64
# New value of the view count
property views : Int32
def initialize(
@chat_id : Int64,
@message_id : Int64,
@views : Int32
)
end
end
# The message content was opened. Updates voice note messages to "listened", video note messages to "viewed" and starts the TTL timer for self-destructing messages
class UpdateMessageContentOpened < Update
@[JSON::Field(key: "@type")]
getter _type = "updateMessageContentOpened"
# Chat identifier
property chat_id : Int64
# Message identifier
property message_id : Int64
def initialize(
@chat_id : Int64,
@message_id : Int64
)
end
end
# A message with an unread mention was read
class UpdateMessageMentionRead < Update
@[JSON::Field(key: "@type")]
getter _type = "updateMessageMentionRead"
# Chat identifier
property chat_id : Int64
# Message identifier
property message_id : Int64
# The new number of unread mention messages left in the chat
property unread_mention_count : Int32
def initialize(
@chat_id : Int64,
@message_id : Int64,
@unread_mention_count : Int32
)
end
end
# A message with a live location was viewed. When the update is received, the client is supposed to update the live location
class UpdateMessageLiveLocationViewed < Update
@[JSON::Field(key: "@type")]
getter _type = "updateMessageLiveLocationViewed"
# Identifier of the chat with the live location message
property chat_id : Int64
# Identifier of the message with live location
property message_id : Int64
def initialize(
@chat_id : Int64,
@message_id : Int64
)
end
end
# A new chat has been loaded/created. This update is guaranteed to come before the chat identifier is returned to the client. The chat field changes will be reported through separate updates
class UpdateNewChat < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNewChat"
# The chat
property chat : Chat
def initialize(
@chat : Chat
)
end
end
# The list to which the chat belongs was changed. This update is guaranteed to be sent only when chat.order == 0 and the current or the new chat list is null
class UpdateChatChatList < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatChatList"
# Chat identifier
property chat_id : Int64
# The new chat's chat list; may be null
property chat_list : ChatList?
def initialize(
@chat_id : Int64,
@chat_list : ChatList? = nil
)
end
end
# The title of a chat was changed
class UpdateChatTitle < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatTitle"
# Chat identifier
property chat_id : Int64
# The new chat title
property title : String
def initialize(
@chat_id : Int64,
@title : String
)
end
end
# A chat photo was changed
class UpdateChatPhoto < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatPhoto"
# Chat identifier
property chat_id : Int64
# The new chat photo; may be null
property photo : ChatPhoto?
def initialize(
@chat_id : Int64,
@photo : ChatPhoto? = nil
)
end
end
# Chat permissions was changed
class UpdateChatPermissions < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatPermissions"
# Chat identifier
property chat_id : Int64
# The new chat permissions
property permissions : ChatPermissions
def initialize(
@chat_id : Int64,
@permissions : ChatPermissions
)
end
end
# 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
class UpdateChatLastMessage < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatLastMessage"
# Chat identifier
property chat_id : Int64
# New value of the chat order
property order : String
# The new last message in the chat; may be null
property last_message : Message?
def initialize(
@chat_id : Int64,
@order : String,
@last_message : Message? = nil
)
end
end
# The order of the chat in the chat list has changed. Instead of this update updateChatLastMessage, updateChatIsPinned, updateChatDraftMessage, or updateChatIsSponsored might be sent
class UpdateChatOrder < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatOrder"
# Chat identifier
property chat_id : Int64
# New value of the order
property order : String
def initialize(
@chat_id : Int64,
@order : String
)
end
end
# A chat was pinned or unpinned
class UpdateChatIsPinned < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatIsPinned"
# Chat identifier
property chat_id : Int64
# New value of is_pinned
property is_pinned : Bool
# New value of the chat order
property order : String
def initialize(
@chat_id : Int64,
@is_pinned : Bool,
@order : String
)
end
end
# A chat was marked as unread or was read
class UpdateChatIsMarkedAsUnread < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatIsMarkedAsUnread"
# Chat identifier
property chat_id : Int64
# New value of is_marked_as_unread
property is_marked_as_unread : Bool
def initialize(
@chat_id : Int64,
@is_marked_as_unread : Bool
)
end
end
# A chat's is_sponsored field has changed
class UpdateChatIsSponsored < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatIsSponsored"
# Chat identifier
property chat_id : Int64
# New value of is_sponsored
property is_sponsored : Bool
# New value of chat order
property order : String
def initialize(
@chat_id : Int64,
@is_sponsored : Bool,
@order : String
)
end
end
# A chat's has_scheduled_messages field has changed
class UpdateChatHasScheduledMessages < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatHasScheduledMessages"
# Chat identifier
property chat_id : Int64
# New value of has_scheduled_messages
property has_scheduled_messages : Bool
def initialize(
@chat_id : Int64,
@has_scheduled_messages : Bool
)
end
end
# The value of the default disable_notification parameter, used when a message is sent to the chat, was changed
class UpdateChatDefaultDisableNotification < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatDefaultDisableNotification"
# Chat identifier
property chat_id : Int64
# The new default_disable_notification value
property default_disable_notification : Bool
def initialize(
@chat_id : Int64,
@default_disable_notification : Bool
)
end
end
# Incoming messages were read or number of unread messages has been changed
class UpdateChatReadInbox < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatReadInbox"
# Chat identifier
property chat_id : Int64
# Identifier of the last read incoming message
property last_read_inbox_message_id : Int64
# The number of unread messages left in the chat
property unread_count : Int32
def initialize(
@chat_id : Int64,
@last_read_inbox_message_id : Int64,
@unread_count : Int32
)
end
end
# Outgoing messages were read
class UpdateChatReadOutbox < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatReadOutbox"
# Chat identifier
property chat_id : Int64
# Identifier of last read outgoing message
property last_read_outbox_message_id : Int64
def initialize(
@chat_id : Int64,
@last_read_outbox_message_id : Int64
)
end
end
# The chat unread_mention_count has changed
class UpdateChatUnreadMentionCount < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatUnreadMentionCount"
# Chat identifier
property chat_id : Int64
# The number of unread mention messages left in the chat
property unread_mention_count : Int32
def initialize(
@chat_id : Int64,
@unread_mention_count : Int32
)
end
end
# Notification settings for a chat were changed
class UpdateChatNotificationSettings < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatNotificationSettings"
# Chat identifier
property chat_id : Int64
# The new notification settings
property notification_settings : ChatNotificationSettings
def initialize(
@chat_id : Int64,
@notification_settings : ChatNotificationSettings
)
end
end
# Notification settings for some type of chats were updated
class UpdateScopeNotificationSettings < Update
@[JSON::Field(key: "@type")]
getter _type = "updateScopeNotificationSettings"
# Types of chats for which notification settings were updated
property scope : NotificationSettingsScope
# The new notification settings
property notification_settings : ScopeNotificationSettings
def initialize(
@scope : NotificationSettingsScope,
@notification_settings : ScopeNotificationSettings
)
end
end
# The chat action bar was changed
class UpdateChatActionBar < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatActionBar"
# Chat identifier
property chat_id : Int64
# The new value of the action bar; may be null
property action_bar : ChatActionBar?
def initialize(
@chat_id : Int64,
@action_bar : ChatActionBar? = nil
)
end
end
# The chat pinned message was changed
class UpdateChatPinnedMessage < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatPinnedMessage"
# Chat identifier
property chat_id : Int64
# The new identifier of the pinned message; 0 if there is no pinned message in the chat
property pinned_message_id : Int64
def initialize(
@chat_id : Int64,
@pinned_message_id : Int64
)
end
end
# 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
class UpdateChatReplyMarkup < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatReplyMarkup"
# Chat identifier
property chat_id : Int64
# Identifier of the message from which reply markup needs to be used; 0 if there is no default custom reply markup in the chat
property reply_markup_message_id : Int64
def initialize(
@chat_id : Int64,
@reply_markup_message_id : Int64
)
end
end
# A chat draft has changed. Be aware that the update may come in the currently opened chat but with old content of the draft. If the user has changed the content of the draft, this update shouldn't be applied
class UpdateChatDraftMessage < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatDraftMessage"
# Chat identifier
property chat_id : Int64
# New value of the chat order
property order : String
# The new draft message; may be null
property draft_message : DraftMessage?
def initialize(
@chat_id : Int64,
@order : String,
@draft_message : DraftMessage? = nil
)
end
end
# 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 UpdateChatOnlineMemberCount < Update
@[JSON::Field(key: "@type")]
getter _type = "updateChatOnlineMemberCount"
# Identifier of the chat
property chat_id : Int64
# New number of online members in the chat, or 0 if unknown
property online_member_count : Int32
def initialize(
@chat_id : Int64,
@online_member_count : Int32
)
end
end
# A notification was changed
class UpdateNotification < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNotification"
# Unique notification group identifier
property notification_group_id : Int32
# Changed notification
property notification : Notification
def initialize(
@notification_group_id : Int32,
@notification : Notification
)
end
end
# A list of active notifications in a notification group has changed
class UpdateNotificationGroup < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNotificationGroup"
# Unique notification group identifier
property notification_group_id : Int32
# New type of the notification group
property type : NotificationGroupType
# Identifier of a chat to which all notifications in the group belong
property chat_id : Int64
# Chat identifier, which notification settings must be applied to the added notifications
property notification_settings_chat_id : Int64
# True, if the notifications should be shown without sound
property is_silent : Bool
# Total number of unread notifications in the group, can be bigger than number of active notifications
property total_count : Int32
# List of added group notifications, sorted by notification ID
property added_notifications : Array(Notification)
# Identifiers of removed group notifications, sorted by notification ID
property removed_notification_ids : Array(Int32)
def initialize(
@notification_group_id : Int32,
@type : NotificationGroupType,
@chat_id : Int64,
@notification_settings_chat_id : Int64,
@is_silent : Bool,
@total_count : Int32,
@added_notifications : Array(Notification),
@removed_notification_ids : Array(Int32)
)
end
end
# Contains active notifications that was shown on previous application launches. This update is sent only if the message database is used. In that case it comes once before any updateNotification and updateNotificationGroup update
class UpdateActiveNotifications < Update
@[JSON::Field(key: "@type")]
getter _type = "updateActiveNotifications"
# Lists of active notification groups
property groups : Array(NotificationGroup)
def initialize(
@groups : Array(NotificationGroup)
)
end
end
# Describes whether there are some pending notification updates. Can be used to prevent application from killing, while there are some pending notifications
class UpdateHavePendingNotifications < Update
@[JSON::Field(key: "@type")]
getter _type = "updateHavePendingNotifications"
# True, if there are some delayed notification updates, which will be sent soon
property have_delayed_notifications : Bool
# True, if there can be some yet unreceived notifications, which are being fetched from the server
property have_unreceived_notifications : Bool
def initialize(
@have_delayed_notifications : Bool,
@have_unreceived_notifications : Bool
)
end
end
# Some messages were deleted
class UpdateDeleteMessages < Update
@[JSON::Field(key: "@type")]
getter _type = "updateDeleteMessages"
# Chat identifier
property chat_id : Int64
# Identifiers of the deleted messages
property message_ids : Array(Int64)
# True, if the messages are permanently deleted by a user (as opposed to just becoming inaccessible)
property is_permanent : Bool
# True, if the messages are deleted only from the cache and can possibly be retrieved again in the future
property from_cache : Bool
def initialize(
@chat_id : Int64,
@message_ids : Array(Int64),
@is_permanent : Bool,
@from_cache : Bool
)
end
end
# User activity in the chat has changed
class UpdateUserChatAction < Update
@[JSON::Field(key: "@type")]
getter _type = "updateUserChatAction"
# Chat identifier
property chat_id : Int64
# Identifier of a user performing an action
property user_id : Int32
# The action description
property action : ChatAction
def initialize(
@chat_id : Int64,
@user_id : Int32,
@action : ChatAction
)
end
end
# The user went online or offline
class UpdateUserStatus < Update
@[JSON::Field(key: "@type")]
getter _type = "updateUserStatus"
# User identifier
property user_id : Int32
# New status of the user
property status : UserStatus
def initialize(
@user_id : Int32,
@status : UserStatus
)
end
end
# Some data of a user has changed. This update is guaranteed to come before the user identifier is returned to the client
class UpdateUser < Update
@[JSON::Field(key: "@type")]
getter _type = "updateUser"
# New data about the user
property user : User
def initialize(
@user : User
)
end
end
# Some data of a basic group has changed. This update is guaranteed to come before the basic group identifier is returned to the client
class UpdateBasicGroup < Update
@[JSON::Field(key: "@type")]
getter _type = "updateBasicGroup"
# New data about the group
property basic_group : BasicGroup
def initialize(
@basic_group : BasicGroup
)
end
end
# Some data of a supergroup or a channel has changed. This update is guaranteed to come before the supergroup identifier is returned to the client
class UpdateSupergroup < Update
@[JSON::Field(key: "@type")]
getter _type = "updateSupergroup"
# New data about the supergroup
property supergroup : Supergroup
def initialize(
@supergroup : Supergroup
)
end
end
# Some data of a secret chat has changed. This update is guaranteed to come before the secret chat identifier is returned to the client
class UpdateSecretChat < Update
@[JSON::Field(key: "@type")]
getter _type = "updateSecretChat"
# New data about the secret chat
property secret_chat : SecretChat
def initialize(
@secret_chat : SecretChat
)
end
end
# Some data from userFullInfo has been changed
class UpdateUserFullInfo < Update
@[JSON::Field(key: "@type")]
getter _type = "updateUserFullInfo"
# User identifier
property user_id : Int32
# New full information about the user
property user_full_info : UserFullInfo
def initialize(
@user_id : Int32,
@user_full_info : UserFullInfo
)
end
end
# Some data from basicGroupFullInfo has been changed
class UpdateBasicGroupFullInfo < Update
@[JSON::Field(key: "@type")]
getter _type = "updateBasicGroupFullInfo"
# Identifier of a basic group
property basic_group_id : Int32
# New full information about the group
property basic_group_full_info : BasicGroupFullInfo
def initialize(
@basic_group_id : Int32,
@basic_group_full_info : BasicGroupFullInfo
)
end
end
# Some data from supergroupFullInfo has been changed
class UpdateSupergroupFullInfo < Update
@[JSON::Field(key: "@type")]
getter _type = "updateSupergroupFullInfo"
# Identifier of the supergroup or channel
property supergroup_id : Int32
# New full information about the supergroup
property supergroup_full_info : SupergroupFullInfo
def initialize(
@supergroup_id : Int32,
@supergroup_full_info : SupergroupFullInfo
)
end
end
# Service notification from the server. Upon receiving this the client must show a popup with the content of the notification
class UpdateServiceNotification < Update
@[JSON::Field(key: "@type")]
getter _type = "updateServiceNotification"
# Notification type. If type begins with "AUTH_KEY_DROP_", then two buttons "Cancel" and "Log out" should be shown under notification; if user presses the second, all local data should be destroyed using Destroy method
property type : String
# Notification content
property content : MessageContent
def initialize(
@type : String,
@content : MessageContent
)
end
end
# Information about a file was updated
class UpdateFile < Update
@[JSON::Field(key: "@type")]
getter _type = "updateFile"
# New data about the file
property file : File
def initialize(
@file : File
)
end
end
# The file generation process needs to be started by the client
class UpdateFileGenerationStart < Update
@[JSON::Field(key: "@type")]
getter _type = "updateFileGenerationStart"
# Unique identifier for the generation process
property generation_id : String
# The path to a file that should be created and where the new file should be generated
property destination_path : String
# String specifying the conversion applied to the original file. If conversion is "#url#" than original_path contains an HTTP/HTTPS URL of a file, which should be downloaded by the client
property conversion : String
# The path to a file from which a new file is generated; may be empty
property original_path : String?
def initialize(
@generation_id : String,
@destination_path : String,
@conversion : String,
@original_path : String? = nil
)
end
end
# File generation is no longer needed
class UpdateFileGenerationStop < Update
@[JSON::Field(key: "@type")]
getter _type = "updateFileGenerationStop"
# Unique identifier for the generation process
property generation_id : String
def initialize(
@generation_id : String
)
end
end
# New call was created or information about a call was updated
class UpdateCall < Update
@[JSON::Field(key: "@type")]
getter _type = "updateCall"
# New data about a call
property call : Call
def initialize(
@call : Call
)
end
end
# Some privacy setting rules have been changed
class UpdateUserPrivacySettingRules < Update
@[JSON::Field(key: "@type")]
getter _type = "updateUserPrivacySettingRules"
# The privacy setting
property setting : UserPrivacySetting
# New privacy rules
property rules : UserPrivacySettingRules
def initialize(
@setting : UserPrivacySetting,
@rules : UserPrivacySettingRules
)
end
end
# Number of unread messages in a chat list has changed. This update is sent only if the message database is used
class UpdateUnreadMessageCount < Update
@[JSON::Field(key: "@type")]
getter _type = "updateUnreadMessageCount"
# The chat list with changed number of unread messages
property chat_list : ChatList
# Total number of unread messages
property unread_count : Int32
# Total number of unread messages in unmuted chats
property unread_unmuted_count : Int32
def initialize(
@chat_list : ChatList,
@unread_count : Int32,
@unread_unmuted_count : Int32
)
end
end
# Number of unread chats, i.e. with unread messages or marked as unread, has changed. This update is sent only if the message database is used
class UpdateUnreadChatCount < Update
@[JSON::Field(key: "@type")]
getter _type = "updateUnreadChatCount"
# The chat list with changed number of unread messages
property chat_list : ChatList
# Approximate total number of chats in the chat list
property total_count : Int32
# Total number of unread chats
property unread_count : Int32
# Total number of unread unmuted chats
property unread_unmuted_count : Int32
# Total number of chats marked as unread
property marked_as_unread_count : Int32
# Total number of unmuted chats marked as unread
property marked_as_unread_unmuted_count : Int32
def initialize(
@chat_list : ChatList,
@total_count : Int32,
@unread_count : Int32,
@unread_unmuted_count : Int32,
@marked_as_unread_count : Int32,
@marked_as_unread_unmuted_count : Int32
)
end
end
# An option changed its value
class UpdateOption < Update
@[JSON::Field(key: "@type")]
getter _type = "updateOption"
# The option name
property name : String
# The new option value
property value : OptionValue
def initialize(
@name : String,
@value : OptionValue
)
end
end
# The list of installed sticker sets was updated
class UpdateInstalledStickerSets < Update
@[JSON::Field(key: "@type")]
getter _type = "updateInstalledStickerSets"
# True, if the list of installed mask sticker sets was updated
property is_masks : Bool
# The new list of installed ordinary sticker sets
property sticker_set_ids : Array(String)
def initialize(
@is_masks : Bool,
@sticker_set_ids : Array(String)
)
end
end
# The list of trending sticker sets was updated or some of them were viewed
class UpdateTrendingStickerSets < Update
@[JSON::Field(key: "@type")]
getter _type = "updateTrendingStickerSets"
# The new list of trending sticker sets
property sticker_sets : StickerSets
def initialize(
@sticker_sets : StickerSets
)
end
end
# The list of recently used stickers was updated
class UpdateRecentStickers < Update
@[JSON::Field(key: "@type")]
getter _type = "updateRecentStickers"
# True, if the list of stickers attached to photo or video files was updated, otherwise the list of sent stickers is updated
property is_attached : Bool
# The new list of file identifiers of recently used stickers
property sticker_ids : Array(Int32)
def initialize(
@is_attached : Bool,
@sticker_ids : Array(Int32)
)
end
end
# The list of favorite stickers was updated
class UpdateFavoriteStickers < Update
@[JSON::Field(key: "@type")]
getter _type = "updateFavoriteStickers"
# The new list of file identifiers of favorite stickers
property sticker_ids : Array(Int32)
def initialize(
@sticker_ids : Array(Int32)
)
end
end
# The list of saved animations was updated
class UpdateSavedAnimations < Update
@[JSON::Field(key: "@type")]
getter _type = "updateSavedAnimations"
# The new list of file identifiers of saved animations
property animation_ids : Array(Int32)
def initialize(
@animation_ids : Array(Int32)
)
end
end
# The selected background has changed
class UpdateSelectedBackground < Update
@[JSON::Field(key: "@type")]
getter _type = "updateSelectedBackground"
# True, if background for dark theme has changed
property for_dark_theme : Bool
# The new selected background; may be null
property background : Background?
def initialize(
@for_dark_theme : Bool,
@background : Background? = nil
)
end
end
# Some language pack strings have been updated
class UpdateLanguagePackStrings < Update
@[JSON::Field(key: "@type")]
getter _type = "updateLanguagePackStrings"
# Localization target to which the language pack belongs
property localization_target : String
# Identifier of the updated language pack
property language_pack_id : String
# List of changed language pack strings
property strings : Array(LanguagePackString)
def initialize(
@localization_target : String,
@language_pack_id : String,
@strings : Array(LanguagePackString)
)
end
end
# The connection state has changed
class UpdateConnectionState < Update
@[JSON::Field(key: "@type")]
getter _type = "updateConnectionState"
# The new connection state
property state : ConnectionState
def initialize(
@state : ConnectionState
)
end
end
# New terms of service must be accepted by the user. If the terms of service are declined, then the deleteAccount method should be called with the reason "Decline ToS update"
class UpdateTermsOfService < Update
@[JSON::Field(key: "@type")]
getter _type = "updateTermsOfService"
# Identifier of the terms of service
property terms_of_service_id : String
# The new terms of service
property terms_of_service : TermsOfService
def initialize(
@terms_of_service_id : String,
@terms_of_service : TermsOfService
)
end
end
# List of users nearby has changed. The update is sent only 60 seconds after a successful searchChatsNearby request
class UpdateUsersNearby < Update
@[JSON::Field(key: "@type")]
getter _type = "updateUsersNearby"
# The new list of users nearby
property users_nearby : Array(ChatNearby)
def initialize(
@users_nearby : Array(ChatNearby)
)
end
end
# A new incoming inline query; for bots only
class UpdateNewInlineQuery < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNewInlineQuery"
# Unique query identifier
property id : String
# Identifier of the user who sent the query
property sender_user_id : Int32
# Text of the query
property query : String
# Offset of the first entry to return
property offset : String
# User location, provided by the client; may be null
property user_location : Location?
def initialize(
@id : String,
@sender_user_id : Int32,
@query : String,
@offset : String,
@user_location : Location? = nil
)
end
end
# The user has chosen a result of an inline query; for bots only
class UpdateNewChosenInlineResult < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNewChosenInlineResult"
# Identifier of the user who sent the query
property sender_user_id : Int32
# Text of the query
property query : String
# Identifier of the chosen result
property result_id : String
# Identifier of the sent inline message, if known
property inline_message_id : String
# User location, provided by the client; may be null
property user_location : Location?
def initialize(
@sender_user_id : Int32,
@query : String,
@result_id : String,
@inline_message_id : String,
@user_location : Location? = nil
)
end
end
# A new incoming callback query; for bots only
class UpdateNewCallbackQuery < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNewCallbackQuery"
# Unique query identifier
property id : String
# Identifier of the user who sent the query
property sender_user_id : Int32
# Identifier of the chat where the query was sent
property chat_id : Int64
# Identifier of the message, from which the query originated
property message_id : Int64
# Identifier that uniquely corresponds to the chat to which the message was sent
property chat_instance : String
# Query payload
property payload : CallbackQueryPayload
def initialize(
@id : String,
@sender_user_id : Int32,
@chat_id : Int64,
@message_id : Int64,
@chat_instance : String,
@payload : CallbackQueryPayload
)
end
end
# A new incoming callback query from a message sent via a bot; for bots only
class UpdateNewInlineCallbackQuery < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNewInlineCallbackQuery"
# Unique query identifier
property id : String
# Identifier of the user who sent the query
property sender_user_id : Int32
# Identifier of the inline message, from which the query originated
property inline_message_id : String
# An identifier uniquely corresponding to the chat a message was sent to
property chat_instance : String
# Query payload
property payload : CallbackQueryPayload
def initialize(
@id : String,
@sender_user_id : Int32,
@inline_message_id : String,
@chat_instance : String,
@payload : CallbackQueryPayload
)
end
end
# A new incoming shipping query; for bots only. Only for invoices with flexible price
class UpdateNewShippingQuery < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNewShippingQuery"
# Unique query identifier
property id : String
# Identifier of the user who sent the query
property sender_user_id : Int32
# Invoice payload
property invoice_payload : String
# User shipping address
property shipping_address : Address
def initialize(
@id : String,
@sender_user_id : Int32,
@invoice_payload : String,
@shipping_address : Address
)
end
end
# A new incoming pre-checkout query; for bots only. Contains full information about a checkout
class UpdateNewPreCheckoutQuery < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNewPreCheckoutQuery"
# Unique query identifier
property id : String
# Identifier of the user who sent the query
property sender_user_id : Int32
# Currency for the product price
property currency : String
# Total price for the product, in the minimal quantity of the currency
property total_amount : Int64
# Invoice payload
property invoice_payload : String
# Identifier of a shipping option chosen by the user; may be empty if not applicable
property shipping_option_id : String?
# Information about the order; may be null
property order_info : OrderInfo?
def initialize(
@id : String,
@sender_user_id : Int32,
@currency : String,
@total_amount : Int64,
@invoice_payload : String,
@shipping_option_id : String? = nil,
@order_info : OrderInfo? = nil
)
end
end
# A new incoming event; for bots only
class UpdateNewCustomEvent < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNewCustomEvent"
# A JSON-serialized event
property event : String
def initialize(
@event : String
)
end
end
# A new incoming query; for bots only
class UpdateNewCustomQuery < Update
@[JSON::Field(key: "@type")]
getter _type = "updateNewCustomQuery"
# The query identifier
property id : String
# JSON-serialized query data
property data : String
# Query timeout
property timeout : Int32
def initialize(
@id : String,
@data : String,
@timeout : Int32
)
end
end
# A poll was updated; for bots only
class UpdatePoll < Update
@[JSON::Field(key: "@type")]
getter _type = "updatePoll"
# New data about the poll
property poll : Poll
def initialize(
@poll : Poll
)
end
end
# A user changed the answer to a poll; for bots only
class UpdatePollAnswer < Update
@[JSON::Field(key: "@type")]
getter _type = "updatePollAnswer"
# Unique poll identifier
property poll_id : String
# The user, who changed the answer to the poll
property user_id : Int32
# 0-based identifiers of answer options, chosen by the user
property option_ids : Array(Int32)
def initialize(
@poll_id : String,
@user_id : Int32,
@option_ids : Array(Int32)
)
end
end
# Contains a list of updates
class Updates < TLObject
@[JSON::Field(key: "@type")]
getter _type = "updates"
# List of updates
property updates : Array(Update)
def initialize(
@updates : Array(Update)
)
end
end
# The log is written to stderr or an OS specific log
class LogStreamDefault < LogStream
@[JSON::Field(key: "@type")]
getter _type = "logStreamDefault"
def initialize
end
end
# The log is written to a file
class LogStreamFile < LogStream
@[JSON::Field(key: "@type")]
getter _type = "logStreamFile"
# Path to the file to where the internal TDLib log will be written
property path : String
# The maximum size of the file to where the internal TDLib log is written before the file will be auto-rotated
property max_file_size : Int64
def initialize(
@path : String,
@max_file_size : Int64
)
end
end
# The log is written nowhere
class LogStreamEmpty < LogStream
@[JSON::Field(key: "@type")]
getter _type = "logStreamEmpty"
def initialize
end
end
# Contains a TDLib internal log verbosity level
class LogVerbosityLevel < TLObject
@[JSON::Field(key: "@type")]
getter _type = "logVerbosityLevel"
# Log verbosity level
property verbosity_level : Int32
def initialize(
@verbosity_level : Int32
)
end
end
# Contains a list of available TDLib internal log tags
class LogTags < TLObject
@[JSON::Field(key: "@type")]
getter _type = "logTags"
# List of log tags
property tags : Array(String)
def initialize(
@tags : Array(String)
)
end
end
# A simple object containing a number; for testing only
class TestInt < TLObject
@[JSON::Field(key: "@type")]
getter _type = "testInt"
# Number
property value : Int32
def initialize(
@value : Int32
)
end
end
# A simple object containing a string; for testing only
class TestString < TLObject
@[JSON::Field(key: "@type")]
getter _type = "testString"
# String
property value : String
def initialize(
@value : String
)
end
end
# A simple object containing a sequence of bytes; for testing only
class TestBytes < TLObject
@[JSON::Field(key: "@type")]
getter _type = "testBytes"
# Bytes
property value : String
def initialize(
@value : String
)
end
end
# A simple object containing a vector of numbers; for testing only
class TestVectorInt < TLObject
@[JSON::Field(key: "@type")]
getter _type = "testVectorInt"
# Vector of numbers
property value : Array(Int32)
def initialize(
@value : Array(Int32)
)
end
end
# A simple object containing a vector of objects that hold a number; for testing only
class TestVectorIntObject < TLObject
@[JSON::Field(key: "@type")]
getter _type = "testVectorIntObject"
# Vector of objects
property value : Array(TestInt)
def initialize(
@value : Array(TestInt)
)
end
end
# A simple object containing a vector of strings; for testing only
class TestVectorString < TLObject
@[JSON::Field(key: "@type")]
getter _type = "testVectorString"
# Vector of strings
property value : Array(String)
def initialize(
@value : Array(String)
)
end
end
# A simple object containing a vector of objects that hold a string; for testing only
class TestVectorStringObject < TLObject
@[JSON::Field(key: "@type")]
getter _type = "testVectorStringObject"
# Vector of objects
property value : Array(TestString)
def initialize(
@value : Array(TestString)
)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment