mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-05 19:28:46 +02:00
temp
This commit is contained in:
parent
bf2f6eb560
commit
7e531ca57b
278 changed files with 24095 additions and 105 deletions
14
Telegram/WatchApp/Packages/TDShim/Package.resolved
Normal file
14
Telegram/WatchApp/Packages/TDShim/Package.resolved
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"pins" : [
|
||||
{
|
||||
"identity" : "tdlibframework",
|
||||
"kind" : "remoteSourceControl",
|
||||
"location" : "https://github.com/Swiftgram/TDLibFramework",
|
||||
"state" : {
|
||||
"revision" : "0fbc375942d5af2effd42699664cd04045b2b754",
|
||||
"version" : "1.8.64-49b3bcbb"
|
||||
}
|
||||
}
|
||||
],
|
||||
"version" : 2
|
||||
}
|
||||
29
Telegram/WatchApp/Packages/TDShim/Package.swift
Normal file
29
Telegram/WatchApp/Packages/TDShim/Package.swift
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// swift-tools-version:5.9
|
||||
import PackageDescription
|
||||
|
||||
let package = Package(
|
||||
name: "TDShim",
|
||||
platforms: [
|
||||
.iOS(.v17),
|
||||
.macOS(.v12),
|
||||
.watchOS(.v9),
|
||||
],
|
||||
products: [
|
||||
.library(name: "TDShim", targets: ["TDShim"]),
|
||||
],
|
||||
dependencies: [
|
||||
.package(url: "https://github.com/Swiftgram/TDLibFramework", .exact("1.8.64-49b3bcbb")),
|
||||
],
|
||||
targets: [
|
||||
.target(
|
||||
name: "TDShim",
|
||||
dependencies: [
|
||||
.product(name: "TDLibFramework", package: "TDLibFramework"),
|
||||
]
|
||||
),
|
||||
.testTarget(
|
||||
name: "TDShimTests",
|
||||
dependencies: ["TDShim"]
|
||||
),
|
||||
]
|
||||
)
|
||||
|
|
@ -0,0 +1,835 @@
|
|||
//
|
||||
// TDLibApi.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Must be subclassed with `send` and `execute` TDLib functions implementation
|
||||
public class TDLibApi {
|
||||
|
||||
public let encoder = JSONEncoder()
|
||||
public let decoder = JSONDecoder()
|
||||
|
||||
public init() {
|
||||
self.encoder.keyEncodingStrategy = .convertToSnakeCase
|
||||
self.decoder.keyDecodingStrategy = .convertFromSnakeCase
|
||||
}
|
||||
|
||||
|
||||
/// Sends request to the TDLib client.
|
||||
public func send(query: TdQuery, completion: ((Data) -> Void)? = nil) throws {
|
||||
fatalError("send() not implemented")
|
||||
}
|
||||
|
||||
/// Synchronously executes TDLib request.
|
||||
public func execute(query: TdQuery) throws -> [String:Any]? {
|
||||
fatalError("execute() not implemented")
|
||||
}
|
||||
|
||||
|
||||
/// Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters
|
||||
/// - Parameter apiHash: Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org
|
||||
/// - Parameter apiId: Application identifier for Telegram API access, which can be obtained at https://my.telegram.org
|
||||
/// - Parameter applicationVersion: Application version; must be non-empty
|
||||
/// - Parameter databaseDirectory: The path to the directory for the persistent database; if empty, the current working directory will be used
|
||||
/// - Parameter databaseEncryptionKey: Encryption key for the database. If the encryption key is invalid, then an error with code 401 will be returned
|
||||
/// - Parameter deviceModel: Model of the device the application is being run on; must be non-empty
|
||||
/// - Parameter filesDirectory: The path to the directory for storing files; if empty, database_directory will be used
|
||||
/// - Parameter systemLanguageCode: IETF language tag of the user's operating system language; must be non-empty
|
||||
/// - Parameter systemVersion: Version of the operating system the application is being run on. If empty, the version is automatically detected by TDLib
|
||||
/// - Parameter useChatInfoDatabase: Pass true to keep cache of users, basic groups, supergroups, channels and secret chats between restarts. Implies use_file_database
|
||||
/// - Parameter useFileDatabase: Pass true to keep information about downloaded and uploaded files between application restarts
|
||||
/// - Parameter useMessageDatabase: Pass true to keep cache of chats and messages between restarts. Implies use_chat_info_database
|
||||
/// - Parameter useSecretChats: Pass true to enable support for secret chats
|
||||
/// - Parameter useTestDc: Pass true to use Telegram test environment instead of the production environment
|
||||
public final func setTdlibParameters(
|
||||
apiHash: String?,
|
||||
apiId: Int?,
|
||||
applicationVersion: String?,
|
||||
databaseDirectory: String?,
|
||||
databaseEncryptionKey: Data?,
|
||||
deviceModel: String?,
|
||||
filesDirectory: String?,
|
||||
systemLanguageCode: String?,
|
||||
systemVersion: String?,
|
||||
useChatInfoDatabase: Bool?,
|
||||
useFileDatabase: Bool?,
|
||||
useMessageDatabase: Bool?,
|
||||
useSecretChats: Bool?,
|
||||
useTestDc: Bool?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = SetTdlibParameters(
|
||||
apiHash: apiHash,
|
||||
apiId: apiId,
|
||||
applicationVersion: applicationVersion,
|
||||
databaseDirectory: databaseDirectory,
|
||||
databaseEncryptionKey: databaseEncryptionKey,
|
||||
deviceModel: deviceModel,
|
||||
filesDirectory: filesDirectory,
|
||||
systemLanguageCode: systemLanguageCode,
|
||||
systemVersion: systemVersion,
|
||||
useChatInfoDatabase: useChatInfoDatabase,
|
||||
useFileDatabase: useFileDatabase,
|
||||
useMessageDatabase: useMessageDatabase,
|
||||
useSecretChats: useSecretChats,
|
||||
useTestDc: useTestDc
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Sets the parameters for TDLib initialization. Works only when the current authorization state is authorizationStateWaitTdlibParameters
|
||||
/// - Parameter apiHash: Application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org
|
||||
/// - Parameter apiId: Application identifier for Telegram API access, which can be obtained at https://my.telegram.org
|
||||
/// - Parameter applicationVersion: Application version; must be non-empty
|
||||
/// - Parameter databaseDirectory: The path to the directory for the persistent database; if empty, the current working directory will be used
|
||||
/// - Parameter databaseEncryptionKey: Encryption key for the database. If the encryption key is invalid, then an error with code 401 will be returned
|
||||
/// - Parameter deviceModel: Model of the device the application is being run on; must be non-empty
|
||||
/// - Parameter filesDirectory: The path to the directory for storing files; if empty, database_directory will be used
|
||||
/// - Parameter systemLanguageCode: IETF language tag of the user's operating system language; must be non-empty
|
||||
/// - Parameter systemVersion: Version of the operating system the application is being run on. If empty, the version is automatically detected by TDLib
|
||||
/// - Parameter useChatInfoDatabase: Pass true to keep cache of users, basic groups, supergroups, channels and secret chats between restarts. Implies use_file_database
|
||||
/// - Parameter useFileDatabase: Pass true to keep information about downloaded and uploaded files between application restarts
|
||||
/// - Parameter useMessageDatabase: Pass true to keep cache of chats and messages between restarts. Implies use_chat_info_database
|
||||
/// - Parameter useSecretChats: Pass true to enable support for secret chats
|
||||
/// - Parameter useTestDc: Pass true to use Telegram test environment instead of the production environment
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func setTdlibParameters(
|
||||
apiHash: String?,
|
||||
apiId: Int?,
|
||||
applicationVersion: String?,
|
||||
databaseDirectory: String?,
|
||||
databaseEncryptionKey: Data?,
|
||||
deviceModel: String?,
|
||||
filesDirectory: String?,
|
||||
systemLanguageCode: String?,
|
||||
systemVersion: String?,
|
||||
useChatInfoDatabase: Bool?,
|
||||
useFileDatabase: Bool?,
|
||||
useMessageDatabase: Bool?,
|
||||
useSecretChats: Bool?,
|
||||
useTestDc: Bool?
|
||||
) async throws -> Ok {
|
||||
let query = SetTdlibParameters(
|
||||
apiHash: apiHash,
|
||||
apiId: apiId,
|
||||
applicationVersion: applicationVersion,
|
||||
databaseDirectory: databaseDirectory,
|
||||
databaseEncryptionKey: databaseEncryptionKey,
|
||||
deviceModel: deviceModel,
|
||||
filesDirectory: filesDirectory,
|
||||
systemLanguageCode: systemLanguageCode,
|
||||
systemVersion: systemVersion,
|
||||
useChatInfoDatabase: useChatInfoDatabase,
|
||||
useFileDatabase: useFileDatabase,
|
||||
useMessageDatabase: useMessageDatabase,
|
||||
useSecretChats: useSecretChats,
|
||||
useTestDc: useTestDc
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword
|
||||
/// - Parameter otherUserIds: List of user identifiers of other users currently using the application
|
||||
public final func requestQrCodeAuthentication(
|
||||
otherUserIds: [Int64]?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = RequestQrCodeAuthentication(
|
||||
otherUserIds: otherUserIds
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Requests QR code authentication by scanning a QR code on another logged in device. Works only when the current authorization state is authorizationStateWaitPhoneNumber, or if there is no pending authentication query and the current authorization state is authorizationStateWaitPremiumPurchase, authorizationStateWaitEmailAddress, authorizationStateWaitEmailCode, authorizationStateWaitCode, authorizationStateWaitRegistration, or authorizationStateWaitPassword
|
||||
/// - Parameter otherUserIds: List of user identifiers of other users currently using the application
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func requestQrCodeAuthentication(otherUserIds: [Int64]?) async throws -> Ok {
|
||||
let query = RequestQrCodeAuthentication(
|
||||
otherUserIds: otherUserIds
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Checks the 2-step verification password for correctness. Works only when the current authorization state is authorizationStateWaitPassword
|
||||
/// - Parameter password: The 2-step verification password to check
|
||||
public final func checkAuthenticationPassword(
|
||||
password: String?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = CheckAuthenticationPassword(
|
||||
password: password
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Checks the 2-step verification password for correctness. Works only when the current authorization state is authorizationStateWaitPassword
|
||||
/// - Parameter password: The 2-step verification password to check
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func checkAuthenticationPassword(password: String?) async throws -> Ok {
|
||||
let query = CheckAuthenticationPassword(
|
||||
password: password
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// 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
|
||||
public final func logOut(completion: @escaping (Result<Ok, Swift.Error>) -> Void) throws {
|
||||
let query = LogOut()
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// 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
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func logOut() async throws -> Ok {
|
||||
let query = LogOut()
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Closes the TDLib instance. All databases will be flushed to disk and properly closed. After the close completes, updateAuthorizationState with authorizationStateClosed will be sent. Can be called before initialization
|
||||
public final func close(completion: @escaping (Result<Ok, Swift.Error>) -> Void) throws {
|
||||
let query = Close()
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Closes the TDLib instance. All databases will be flushed to disk and properly closed. After the close completes, updateAuthorizationState with authorizationStateClosed will be sent. Can be called before initialization
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func close() async throws -> Ok {
|
||||
let query = Close()
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// 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. Can be called before authorization
|
||||
public final func destroy(completion: @escaping (Result<Ok, Swift.Error>) -> Void) throws {
|
||||
let query = Destroy()
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// 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. Can be called before authorization
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func destroy() async throws -> Ok {
|
||||
let query = Destroy()
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Returns the current user
|
||||
/// - Returns: The current user
|
||||
public final func getMe(completion: @escaping (Result<User, Swift.Error>) -> Void) throws {
|
||||
let query = GetMe()
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Returns the current user
|
||||
/// - Returns: The current user
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
public final func getMe() async throws -> User {
|
||||
let query = GetMe()
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Loads more chats from a chat list. The loaded chats and their positions in the chat list will be sent through updates. Chats are sorted by the pair (chat.position.order, chat.id) in descending order. Returns a 404 error if all chats have been loaded
|
||||
/// - Parameter chatList: The chat list in which to load chats; pass null to load chats from the main chat list
|
||||
/// - Parameter limit: The maximum number of chats to be loaded. For optimal performance, the number of loaded chats is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached
|
||||
/// - Returns: A 404 error if all chats have been loaded
|
||||
public final func loadChats(
|
||||
chatList: ChatList?,
|
||||
limit: Int?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = LoadChats(
|
||||
chatList: chatList,
|
||||
limit: limit
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Loads more chats from a chat list. The loaded chats and their positions in the chat list will be sent through updates. Chats are sorted by the pair (chat.position.order, chat.id) in descending order. Returns a 404 error if all chats have been loaded
|
||||
/// - Parameter chatList: The chat list in which to load chats; pass null to load chats from the main chat list
|
||||
/// - Parameter limit: The maximum number of chats to be loaded. For optimal performance, the number of loaded chats is chosen by TDLib and can be smaller than the specified limit, even if the end of the list is not reached
|
||||
/// - Returns: A 404 error if all chats have been loaded
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func loadChats(
|
||||
chatList: ChatList?,
|
||||
limit: Int?
|
||||
) async throws -> Ok {
|
||||
let query = LoadChats(
|
||||
chatList: chatList,
|
||||
limit: limit
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib. This is an offline method if only_local is true
|
||||
/// - Parameter chatId: Chat identifier
|
||||
/// - Parameter fromMessageId: Identifier of the message starting from which history must be fetched; use 0 to get results from the last message
|
||||
/// - Parameter limit: The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
|
||||
/// - Parameter offset: Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages
|
||||
/// - Parameter onlyLocal: Pass true to get only messages that are available without sending network requests
|
||||
/// - Returns: Messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib
|
||||
public final func getChatHistory(
|
||||
chatId: Int64?,
|
||||
fromMessageId: Int64?,
|
||||
limit: Int?,
|
||||
offset: Int?,
|
||||
onlyLocal: Bool?,
|
||||
completion: @escaping (Result<Messages, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = GetChatHistory(
|
||||
chatId: chatId,
|
||||
fromMessageId: fromMessageId,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
onlyLocal: onlyLocal
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib. This is an offline method if only_local is true
|
||||
/// - Parameter chatId: Chat identifier
|
||||
/// - Parameter fromMessageId: Identifier of the message starting from which history must be fetched; use 0 to get results from the last message
|
||||
/// - Parameter limit: The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
|
||||
/// - Parameter offset: Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages
|
||||
/// - Parameter onlyLocal: Pass true to get only messages that are available without sending network requests
|
||||
/// - Returns: Messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
public final func getChatHistory(
|
||||
chatId: Int64?,
|
||||
fromMessageId: Int64?,
|
||||
limit: Int?,
|
||||
offset: Int?,
|
||||
onlyLocal: Bool?
|
||||
) async throws -> Messages {
|
||||
let query = GetChatHistory(
|
||||
chatId: chatId,
|
||||
fromMessageId: fromMessageId,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
onlyLocal: onlyLocal
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Sends a message. Returns the sent message
|
||||
/// - Parameter chatId: Target chat
|
||||
/// - Parameter inputMessageContent: The content of the message to be sent
|
||||
/// - Parameter options: Options to be used to send the message; pass null to use default options
|
||||
/// - Parameter replyMarkup: Markup for replying to the message; pass null if none; for bots only
|
||||
/// - Parameter replyTo: Information about the message or story to be replied; pass null if none
|
||||
/// - Parameter topicId: Topic in which the message will be sent; pass null if none
|
||||
/// - Returns: The sent message
|
||||
public final func sendMessage(
|
||||
chatId: Int64?,
|
||||
inputMessageContent: InputMessageContent?,
|
||||
options: MessageSendOptions?,
|
||||
replyMarkup: ReplyMarkup?,
|
||||
replyTo: InputMessageReplyTo?,
|
||||
topicId: MessageTopic?,
|
||||
completion: @escaping (Result<Message, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = SendMessage(
|
||||
chatId: chatId,
|
||||
inputMessageContent: inputMessageContent,
|
||||
options: options,
|
||||
replyMarkup: replyMarkup,
|
||||
replyTo: replyTo,
|
||||
topicId: topicId
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Sends a message. Returns the sent message
|
||||
/// - Parameter chatId: Target chat
|
||||
/// - Parameter inputMessageContent: The content of the message to be sent
|
||||
/// - Parameter options: Options to be used to send the message; pass null to use default options
|
||||
/// - Parameter replyMarkup: Markup for replying to the message; pass null if none; for bots only
|
||||
/// - Parameter replyTo: Information about the message or story to be replied; pass null if none
|
||||
/// - Parameter topicId: Topic in which the message will be sent; pass null if none
|
||||
/// - Returns: The sent message
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
public final func sendMessage(
|
||||
chatId: Int64?,
|
||||
inputMessageContent: InputMessageContent?,
|
||||
options: MessageSendOptions?,
|
||||
replyMarkup: ReplyMarkup?,
|
||||
replyTo: InputMessageReplyTo?,
|
||||
topicId: MessageTopic?
|
||||
) async throws -> Message {
|
||||
let query = SendMessage(
|
||||
chatId: chatId,
|
||||
inputMessageContent: inputMessageContent,
|
||||
options: options,
|
||||
replyMarkup: replyMarkup,
|
||||
replyTo: replyTo,
|
||||
topicId: topicId
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Changes the user answer to a poll
|
||||
/// - Parameter chatId: Identifier of the chat to which the poll belongs
|
||||
/// - Parameter messageId: Identifier of the message containing the poll
|
||||
/// - Parameter optionIds: 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
|
||||
public final func setPollAnswer(
|
||||
chatId: Int64?,
|
||||
messageId: Int64?,
|
||||
optionIds: [Int]?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = SetPollAnswer(
|
||||
chatId: chatId,
|
||||
messageId: messageId,
|
||||
optionIds: optionIds
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Changes the user answer to a poll
|
||||
/// - Parameter chatId: Identifier of the chat to which the poll belongs
|
||||
/// - Parameter messageId: Identifier of the message containing the poll
|
||||
/// - Parameter optionIds: 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
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func setPollAnswer(
|
||||
chatId: Int64?,
|
||||
messageId: Int64?,
|
||||
optionIds: [Int]?
|
||||
) async throws -> Ok {
|
||||
let query = SetPollAnswer(
|
||||
chatId: chatId,
|
||||
messageId: messageId,
|
||||
optionIds: optionIds
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// 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)
|
||||
/// - Parameter chatId: Chat identifier
|
||||
public final func openChat(
|
||||
chatId: Int64?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = OpenChat(
|
||||
chatId: chatId
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// 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)
|
||||
/// - Parameter chatId: Chat identifier
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func openChat(chatId: Int64?) async throws -> Ok {
|
||||
let query = OpenChat(
|
||||
chatId: chatId
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Informs TDLib that the chat is closed by the user. Many useful activities depend on the chat being opened or closed
|
||||
/// - Parameter chatId: Chat identifier
|
||||
public final func closeChat(
|
||||
chatId: Int64?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = CloseChat(
|
||||
chatId: chatId
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Informs TDLib that the chat is closed by the user. Many useful activities depend on the chat being opened or closed
|
||||
/// - Parameter chatId: Chat identifier
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func closeChat(chatId: Int64?) async throws -> Ok {
|
||||
let query = CloseChat(
|
||||
chatId: chatId
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Informs TDLib that messages are being viewed by the user. Sponsored messages must be marked as viewed only when the entire text of the message is shown on the screen (excluding the button). 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)
|
||||
/// - Parameter chatId: Chat identifier
|
||||
/// - Parameter forceRead: Pass true to mark as read the specified messages even if the chat is closed
|
||||
/// - Parameter messageIds: The identifiers of the messages being viewed
|
||||
/// - Parameter source: Source of the message view; pass null to guess the source based on chat open state
|
||||
public final func viewMessages(
|
||||
chatId: Int64?,
|
||||
forceRead: Bool?,
|
||||
messageIds: [Int64]?,
|
||||
source: MessageSource?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = ViewMessages(
|
||||
chatId: chatId,
|
||||
forceRead: forceRead,
|
||||
messageIds: messageIds,
|
||||
source: source
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Informs TDLib that messages are being viewed by the user. Sponsored messages must be marked as viewed only when the entire text of the message is shown on the screen (excluding the button). 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)
|
||||
/// - Parameter chatId: Chat identifier
|
||||
/// - Parameter forceRead: Pass true to mark as read the specified messages even if the chat is closed
|
||||
/// - Parameter messageIds: The identifiers of the messages being viewed
|
||||
/// - Parameter source: Source of the message view; pass null to guess the source based on chat open state
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func viewMessages(
|
||||
chatId: Int64?,
|
||||
forceRead: Bool?,
|
||||
messageIds: [Int64]?,
|
||||
source: MessageSource?
|
||||
) async throws -> Ok {
|
||||
let query = ViewMessages(
|
||||
chatId: chatId,
|
||||
forceRead: forceRead,
|
||||
messageIds: messageIds,
|
||||
source: source
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Changes the draft message in a chat or a topic
|
||||
/// - Parameter chatId: Chat identifier
|
||||
/// - Parameter draftMessage: New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored
|
||||
/// - Parameter topicId: Topic in which the draft will be changed; pass null to change the draft for the chat itself
|
||||
public final func setChatDraftMessage(
|
||||
chatId: Int64?,
|
||||
draftMessage: DraftMessage?,
|
||||
topicId: MessageTopic?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = SetChatDraftMessage(
|
||||
chatId: chatId,
|
||||
draftMessage: draftMessage,
|
||||
topicId: topicId
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Changes the draft message in a chat or a topic
|
||||
/// - Parameter chatId: Chat identifier
|
||||
/// - Parameter draftMessage: New draft message; pass null to remove the draft. All files in draft message content must be of the type inputFileLocal. Media thumbnails and captions are ignored
|
||||
/// - Parameter topicId: Topic in which the draft will be changed; pass null to change the draft for the chat itself
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func setChatDraftMessage(
|
||||
chatId: Int64?,
|
||||
draftMessage: DraftMessage?,
|
||||
topicId: MessageTopic?
|
||||
) async throws -> Ok {
|
||||
let query = SetChatDraftMessage(
|
||||
chatId: chatId,
|
||||
draftMessage: draftMessage,
|
||||
topicId: topicId
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates
|
||||
/// - Parameter fileId: Identifier of the file to download
|
||||
/// - Parameter limit: Number of bytes which need to be downloaded starting from the "offset" position before the download will automatically be canceled; use 0 to download without a limit
|
||||
/// - Parameter offset: The starting position from which the file needs to be downloaded
|
||||
/// - Parameter 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/addFileToDownloads was called will be downloaded first
|
||||
/// - Parameter synchronous: Pass true to return response only after the file download has succeeded, has failed, has been canceled, or a new downloadFile request with different offset/limit parameters was sent; pass false to return file state immediately, just after the download has been started
|
||||
public final func downloadFile(
|
||||
fileId: Int?,
|
||||
limit: Int64?,
|
||||
offset: Int64?,
|
||||
priority: Int?,
|
||||
synchronous: Bool?,
|
||||
completion: @escaping (Result<File, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = DownloadFile(
|
||||
fileId: fileId,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
priority: priority,
|
||||
synchronous: synchronous
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates
|
||||
/// - Parameter fileId: Identifier of the file to download
|
||||
/// - Parameter limit: Number of bytes which need to be downloaded starting from the "offset" position before the download will automatically be canceled; use 0 to download without a limit
|
||||
/// - Parameter offset: The starting position from which the file needs to be downloaded
|
||||
/// - Parameter 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/addFileToDownloads was called will be downloaded first
|
||||
/// - Parameter synchronous: Pass true to return response only after the file download has succeeded, has failed, has been canceled, or a new downloadFile request with different offset/limit parameters was sent; pass false to return file state immediately, just after the download has been started
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
public final func downloadFile(
|
||||
fileId: Int?,
|
||||
limit: Int64?,
|
||||
offset: Int64?,
|
||||
priority: Int?,
|
||||
synchronous: Bool?
|
||||
) async throws -> File {
|
||||
let query = DownloadFile(
|
||||
fileId: fileId,
|
||||
limit: limit,
|
||||
offset: offset,
|
||||
priority: priority,
|
||||
synchronous: synchronous
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Stops the downloading of a file. If a file has already been downloaded, does nothing
|
||||
/// - Parameter fileId: Identifier of a file to stop downloading
|
||||
/// - Parameter onlyIfPending: Pass true to stop downloading only if it hasn't been started, i.e. request hasn't been sent to server
|
||||
public final func cancelDownloadFile(
|
||||
fileId: Int?,
|
||||
onlyIfPending: Bool?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = CancelDownloadFile(
|
||||
fileId: fileId,
|
||||
onlyIfPending: onlyIfPending
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Stops the downloading of a file. If a file has already been downloaded, does nothing
|
||||
/// - Parameter fileId: Identifier of a file to stop downloading
|
||||
/// - Parameter onlyIfPending: Pass true to stop downloading only if it hasn't been started, i.e. request hasn't been sent to server
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func cancelDownloadFile(
|
||||
fileId: Int?,
|
||||
onlyIfPending: Bool?
|
||||
) async throws -> Ok {
|
||||
let query = CancelDownloadFile(
|
||||
fileId: fileId,
|
||||
onlyIfPending: onlyIfPending
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Returns a list of installed sticker sets
|
||||
/// - Parameter stickerType: Type of the sticker sets to return
|
||||
/// - Returns: A list of installed sticker sets
|
||||
public final func getInstalledStickerSets(
|
||||
stickerType: StickerType?,
|
||||
completion: @escaping (Result<StickerSets, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = GetInstalledStickerSets(
|
||||
stickerType: stickerType
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Returns a list of installed sticker sets
|
||||
/// - Parameter stickerType: Type of the sticker sets to return
|
||||
/// - Returns: A list of installed sticker sets
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
public final func getInstalledStickerSets(stickerType: StickerType?) async throws -> StickerSets {
|
||||
let query = GetInstalledStickerSets(
|
||||
stickerType: stickerType
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Returns information about a sticker set by its identifier
|
||||
/// - Parameter setId: Identifier of the sticker set
|
||||
/// - Returns: Information about a sticker set by its identifier
|
||||
public final func getStickerSet(
|
||||
setId: TdInt64?,
|
||||
completion: @escaping (Result<StickerSet, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = GetStickerSet(
|
||||
setId: setId
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Returns information about a sticker set by its identifier
|
||||
/// - Parameter setId: Identifier of the sticker set
|
||||
/// - Returns: Information about a sticker set by its identifier
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
public final func getStickerSet(setId: TdInt64?) async throws -> StickerSet {
|
||||
let query = GetStickerSet(
|
||||
setId: setId
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Returns a list of recently used stickers
|
||||
/// - Parameter isAttached: Pass true to return stickers and masks that were recently attached to photos or video files; pass false to return recently sent stickers
|
||||
/// - Returns: A list of recently used stickers
|
||||
public final func getRecentStickers(
|
||||
isAttached: Bool?,
|
||||
completion: @escaping (Result<Stickers, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = GetRecentStickers(
|
||||
isAttached: isAttached
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Returns a list of recently used stickers
|
||||
/// - Parameter isAttached: Pass true to return stickers and masks that were recently attached to photos or video files; pass false to return recently sent stickers
|
||||
/// - Returns: A list of recently used stickers
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
public final func getRecentStickers(isAttached: Bool?) async throws -> Stickers {
|
||||
let query = GetRecentStickers(
|
||||
isAttached: isAttached
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Returns favorite stickers
|
||||
/// - Returns: Favorite stickers
|
||||
public final func getFavoriteStickers(completion: @escaping (Result<Stickers, Swift.Error>) -> Void) throws {
|
||||
let query = GetFavoriteStickers()
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Returns favorite stickers
|
||||
/// - Returns: Favorite stickers
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
public final func getFavoriteStickers() async throws -> Stickers {
|
||||
let query = GetFavoriteStickers()
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// 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. Can be called synchronously for options "version" and "commit_hash"
|
||||
/// - Parameter name: The name of the option
|
||||
/// - Returns: The value of an option by its name
|
||||
public final func getOption(
|
||||
name: String?,
|
||||
completion: @escaping (Result<OptionValue, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = GetOption(
|
||||
name: name
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// 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. Can be called synchronously for options "version" and "commit_hash"
|
||||
/// - Parameter name: The name of the option
|
||||
/// - Returns: The value of an option by its name
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
public final func getOption(name: String?) async throws -> OptionValue {
|
||||
let query = GetOption(
|
||||
name: name
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// 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
|
||||
/// - Parameter name: The name of the option
|
||||
/// - Parameter value: The new value of the option; pass null to reset option value to a default value
|
||||
public final func setOption(
|
||||
name: String?,
|
||||
value: OptionValue?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = SetOption(
|
||||
name: name,
|
||||
value: value
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// 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
|
||||
/// - Parameter name: The name of the option
|
||||
/// - Parameter value: The new value of the option; pass null to reset option value to a default value
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func setOption(
|
||||
name: String?,
|
||||
value: OptionValue?
|
||||
) async throws -> Ok {
|
||||
let query = SetOption(
|
||||
name: name,
|
||||
value: value
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
/// Sets the verbosity level of the internal logging of TDLib. Can be called synchronously
|
||||
/// - Parameter newVerbosityLevel: New value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1023 can be used to enable even more logging
|
||||
public final func setLogVerbosityLevel(
|
||||
newVerbosityLevel: Int?,
|
||||
completion: @escaping (Result<Ok, Swift.Error>) -> Void
|
||||
) throws {
|
||||
let query = SetLogVerbosityLevel(
|
||||
newVerbosityLevel: newVerbosityLevel
|
||||
)
|
||||
self.run(query: query, completion: completion)
|
||||
}
|
||||
|
||||
/// Sets the verbosity level of the internal logging of TDLib. Can be called synchronously
|
||||
/// - Parameter newVerbosityLevel: New value of the verbosity level for logging. Value 0 corresponds to fatal errors, value 1 corresponds to errors, value 2 corresponds to warnings and debug warnings, value 3 corresponds to informational, value 4 corresponds to debug, value 5 corresponds to verbose debug, value greater than 5 and up to 1023 can be used to enable even more logging
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
@discardableResult
|
||||
public final func setLogVerbosityLevel(newVerbosityLevel: Int?) async throws -> Ok {
|
||||
let query = SetLogVerbosityLevel(
|
||||
newVerbosityLevel: newVerbosityLevel
|
||||
)
|
||||
return try await self.run(query: query)
|
||||
}
|
||||
|
||||
|
||||
private final func run<Q, R>(
|
||||
query: Q,
|
||||
completion: @escaping (Result<R, Swift.Error>) -> Void)
|
||||
where Q: Codable, R: Codable {
|
||||
|
||||
let dto = DTO(query, encoder: self.encoder)
|
||||
do {
|
||||
try self.send(query: dto) { [weak self] result in
|
||||
guard let strongSelf = self else { return }
|
||||
if let error = try? strongSelf.decoder.decode(DTO<TDError>.self, from: result) {
|
||||
completion(.failure(error.payload))
|
||||
} else {
|
||||
let response = strongSelf.decoder.tryDecode(DTO<R>.self, from: result)
|
||||
completion(response.map { $0.payload })
|
||||
}
|
||||
}
|
||||
} catch let err as TDError {
|
||||
completion( .failure(err))
|
||||
} catch let any {
|
||||
let err = TDError(code: 500, message: any.localizedDescription)
|
||||
completion( .failure(err))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@available(iOS 13.0, macOS 10.15, watchOS 6.0, tvOS 13.0, *)
|
||||
private final func run<Q, R>(query: Q) async throws -> R where Q: Codable, R: Codable {
|
||||
let dto = DTO(query, encoder: self.encoder)
|
||||
return try await withCheckedThrowingContinuation { continuation in
|
||||
do {
|
||||
try self.send(query: dto) { result in
|
||||
if let error = try? self.decoder.decode(DTO<TDError>.self, from: result) {
|
||||
continuation.resume(with: .failure(error.payload))
|
||||
} else {
|
||||
let response = self.decoder.tryDecode(DTO<R>.self, from: result)
|
||||
continuation.resume(with: response.map { $0.payload })
|
||||
}
|
||||
}
|
||||
} catch let err as TDError {
|
||||
continuation.resume(with: .failure(err))
|
||||
} catch let any {
|
||||
let err = TDError(code: 500, message: any.localizedDescription)
|
||||
continuation.resume(with: .failure(err))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
//
|
||||
// TdClient.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Basic protocol for communicate with TdLib.
|
||||
public protocol TdClient {
|
||||
|
||||
/// Receives incoming updates and request responses from the TDLib client
|
||||
func run(updateHandler: @escaping (Data) -> Void)
|
||||
|
||||
/// Sends request to the TDLib client.
|
||||
func send(query: TdQuery, completion: ((Data) -> Void)?) throws
|
||||
|
||||
/// Synchronously executes TDLib request. Only a few requests can be executed synchronously.
|
||||
func execute(query: TdQuery) throws -> [String:Any]?
|
||||
|
||||
/// Close connection with TDLib.
|
||||
func close()
|
||||
|
||||
}
|
||||
|
||||
|
||||
public protocol TdQuery {
|
||||
|
||||
func make(with extra: String?) throws -> Data
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// AccountInfo.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Contains basic information about another user who started a chat with the current user
|
||||
public struct AccountInfo: Codable, Equatable, Hashable {
|
||||
|
||||
/// Point in time (Unix timestamp) when the user changed name last time; 0 if unknown
|
||||
public let lastNameChangeDate: Int
|
||||
|
||||
/// Point in time (Unix timestamp) when the user changed photo last time; 0 if unknown
|
||||
public let lastPhotoChangeDate: Int
|
||||
|
||||
/// A two-letter ISO 3166-1 alpha-2 country code based on the phone number of the user; may be empty if unknown
|
||||
public let phoneNumberCountryCode: String
|
||||
|
||||
/// Month when the user was registered in Telegram; 0-12; may be 0 if unknown
|
||||
public let registrationMonth: Int
|
||||
|
||||
/// Year when the user was registered in Telegram; 0-9999; may be 0 if unknown
|
||||
public let registrationYear: Int
|
||||
|
||||
|
||||
public init(
|
||||
lastNameChangeDate: Int,
|
||||
lastPhotoChangeDate: Int,
|
||||
phoneNumberCountryCode: String,
|
||||
registrationMonth: Int,
|
||||
registrationYear: Int
|
||||
) {
|
||||
self.lastNameChangeDate = lastNameChangeDate
|
||||
self.lastPhotoChangeDate = lastPhotoChangeDate
|
||||
self.phoneNumberCountryCode = phoneNumberCountryCode
|
||||
self.registrationMonth = registrationMonth
|
||||
self.registrationYear = registrationYear
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
//
|
||||
// ActiveStoryState.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes state of active stories posted by a chat
|
||||
public indirect enum ActiveStoryState: Codable, Equatable, Hashable {
|
||||
|
||||
/// The chat has an active live story
|
||||
case activeStoryStateLive(ActiveStoryStateLive)
|
||||
|
||||
/// The chat has some unread active stories
|
||||
case activeStoryStateUnread
|
||||
|
||||
/// The chat has active stories, all of which were read
|
||||
case activeStoryStateRead
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case activeStoryStateLive
|
||||
case activeStoryStateUnread
|
||||
case activeStoryStateRead
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .activeStoryStateLive:
|
||||
let value = try ActiveStoryStateLive(from: decoder)
|
||||
self = .activeStoryStateLive(value)
|
||||
case .activeStoryStateUnread:
|
||||
self = .activeStoryStateUnread
|
||||
case .activeStoryStateRead:
|
||||
self = .activeStoryStateRead
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .activeStoryStateLive(let value):
|
||||
try container.encode(Kind.activeStoryStateLive, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .activeStoryStateUnread:
|
||||
try container.encode(Kind.activeStoryStateUnread, forKey: .type)
|
||||
case .activeStoryStateRead:
|
||||
try container.encode(Kind.activeStoryStateRead, forKey: .type)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The chat has an active live story
|
||||
public struct ActiveStoryStateLive: Codable, Equatable, Hashable {
|
||||
|
||||
/// Identifier of the active live story
|
||||
public let storyId: Int
|
||||
|
||||
|
||||
public init(storyId: Int) {
|
||||
self.storyId = storyId
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// Address.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes an address
|
||||
public struct Address: Codable, Equatable, Hashable {
|
||||
|
||||
/// City
|
||||
public let city: String
|
||||
|
||||
/// A two-letter ISO 3166-1 alpha-2 country code
|
||||
public let countryCode: String
|
||||
|
||||
/// Address postal code
|
||||
public let postalCode: String
|
||||
|
||||
/// State, if applicable
|
||||
public let state: String
|
||||
|
||||
/// First line of the address
|
||||
public let streetLine1: String
|
||||
|
||||
/// Second line of the address
|
||||
public let streetLine2: String
|
||||
|
||||
|
||||
public init(
|
||||
city: String,
|
||||
countryCode: String,
|
||||
postalCode: String,
|
||||
state: String,
|
||||
streetLine1: String,
|
||||
streetLine2: String
|
||||
) {
|
||||
self.city = city
|
||||
self.countryCode = countryCode
|
||||
self.postalCode = postalCode
|
||||
self.state = state
|
||||
self.streetLine1 = streetLine1
|
||||
self.streetLine2 = streetLine2
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// AlternativeVideo.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes an alternative re-encoded quality of a video file
|
||||
public struct AlternativeVideo: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Codec used for video file encoding, for example, "h264", "h265", "av1", or "av01"
|
||||
public let codec: String
|
||||
|
||||
/// Video height
|
||||
public let height: Int
|
||||
|
||||
/// HLS file describing the video
|
||||
public let hlsFile: File
|
||||
|
||||
/// Unique identifier of the alternative video, which is used in the HLS file
|
||||
public let id: TdInt64
|
||||
|
||||
/// File containing the video
|
||||
public let video: File
|
||||
|
||||
/// Video width
|
||||
public let width: Int
|
||||
|
||||
|
||||
public init(
|
||||
codec: String,
|
||||
height: Int,
|
||||
hlsFile: File,
|
||||
id: TdInt64,
|
||||
video: File,
|
||||
width: Int
|
||||
) {
|
||||
self.codec = codec
|
||||
self.height = height
|
||||
self.hlsFile = hlsFile
|
||||
self.id = id
|
||||
self.video = video
|
||||
self.width = width
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// AnimatedChatPhoto.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Animated variant of a chat photo in MPEG4 format
|
||||
public struct AnimatedChatPhoto: Codable, Equatable, Hashable {
|
||||
|
||||
/// Information about the animation file
|
||||
public let file: File
|
||||
|
||||
/// Animation width and height
|
||||
public let length: Int
|
||||
|
||||
/// Timestamp of the frame, used as a static chat photo
|
||||
public let mainFrameTimestamp: Double
|
||||
|
||||
|
||||
public init(
|
||||
file: File,
|
||||
length: Int,
|
||||
mainFrameTimestamp: Double
|
||||
) {
|
||||
self.file = file
|
||||
self.length = length
|
||||
self.mainFrameTimestamp = mainFrameTimestamp
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// AnimatedEmoji.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes an animated or custom representation of an emoji
|
||||
public struct AnimatedEmoji: Codable, Equatable, Hashable {
|
||||
|
||||
/// Emoji modifier fitzpatrick type; 0-6; 0 if none
|
||||
public let fitzpatrickType: Int
|
||||
|
||||
/// File containing the sound to be played when the sticker is clicked; may be null. The sound is encoded with the Opus codec, and stored inside an OGG container
|
||||
public let sound: File?
|
||||
|
||||
/// Sticker for the emoji; may be null if yet unknown for a custom emoji. If the sticker is a custom emoji, then it can have arbitrary format
|
||||
public let sticker: Sticker?
|
||||
|
||||
/// Expected height of the sticker, which can be used if the sticker is null
|
||||
public let stickerHeight: Int
|
||||
|
||||
/// Expected width of the sticker, which can be used if the sticker is null
|
||||
public let stickerWidth: Int
|
||||
|
||||
|
||||
public init(
|
||||
fitzpatrickType: Int,
|
||||
sound: File?,
|
||||
sticker: Sticker?,
|
||||
stickerHeight: Int,
|
||||
stickerWidth: Int
|
||||
) {
|
||||
self.fitzpatrickType = fitzpatrickType
|
||||
self.sound = sound
|
||||
self.sticker = sticker
|
||||
self.stickerHeight = stickerHeight
|
||||
self.stickerWidth = stickerWidth
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
//
|
||||
// Animation.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes an animation file. The animation must be encoded in GIF or MPEG4 format
|
||||
public struct Animation: Codable, Equatable, Hashable {
|
||||
|
||||
/// File containing the animation
|
||||
public let animation: File
|
||||
|
||||
/// Duration of the animation, in seconds; as defined by the sender
|
||||
public let duration: Int
|
||||
|
||||
/// Original name of the file; as defined by the sender
|
||||
public let fileName: String
|
||||
|
||||
/// True, if stickers were added to the animation. The list of corresponding sticker set can be received using getAttachedStickerSets
|
||||
public let hasStickers: Bool
|
||||
|
||||
/// Height of the animation
|
||||
public let height: Int
|
||||
|
||||
/// MIME type of the file, usually "image/gif" or "video/mp4"
|
||||
public let mimeType: String
|
||||
|
||||
/// Animation minithumbnail; may be null
|
||||
public let minithumbnail: Minithumbnail?
|
||||
|
||||
/// Animation thumbnail in JPEG or MPEG4 format; may be null
|
||||
public let thumbnail: Thumbnail?
|
||||
|
||||
/// Width of the animation
|
||||
public let width: Int
|
||||
|
||||
|
||||
public init(
|
||||
animation: File,
|
||||
duration: Int,
|
||||
fileName: String,
|
||||
hasStickers: Bool,
|
||||
height: Int,
|
||||
mimeType: String,
|
||||
minithumbnail: Minithumbnail?,
|
||||
thumbnail: Thumbnail?,
|
||||
width: Int
|
||||
) {
|
||||
self.animation = animation
|
||||
self.duration = duration
|
||||
self.fileName = fileName
|
||||
self.hasStickers = hasStickers
|
||||
self.height = height
|
||||
self.mimeType = mimeType
|
||||
self.minithumbnail = minithumbnail
|
||||
self.thumbnail = thumbnail
|
||||
self.width = width
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,66 @@
|
|||
//
|
||||
// Audio.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes an audio file. Audio is usually in MP3 or M4A format
|
||||
public struct Audio: Codable, Equatable, Hashable {
|
||||
|
||||
/// The minithumbnail of the album cover; may be null
|
||||
public let albumCoverMinithumbnail: Minithumbnail?
|
||||
|
||||
/// The thumbnail of the album cover in JPEG format; as defined by the sender. The full size thumbnail is expected to be extracted from the downloaded audio file; may be null
|
||||
public let albumCoverThumbnail: Thumbnail?
|
||||
|
||||
/// File containing the audio
|
||||
public let audio: File
|
||||
|
||||
/// Duration of the audio, in seconds; as defined by the sender
|
||||
public let duration: Int
|
||||
|
||||
/// Album cover variants to use if the downloaded audio file contains no album cover. Provided thumbnail dimensions are approximate
|
||||
public let externalAlbumCovers: [Thumbnail]
|
||||
|
||||
/// Original name of the file; as defined by the sender
|
||||
public let fileName: String
|
||||
|
||||
/// The MIME type of the file; as defined by the sender
|
||||
public let mimeType: String
|
||||
|
||||
/// Performer of the audio; as defined by the sender
|
||||
public let performer: String
|
||||
|
||||
/// Title of the audio; as defined by the sender
|
||||
public let title: String
|
||||
|
||||
|
||||
public init(
|
||||
albumCoverMinithumbnail: Minithumbnail?,
|
||||
albumCoverThumbnail: Thumbnail?,
|
||||
audio: File,
|
||||
duration: Int,
|
||||
externalAlbumCovers: [Thumbnail],
|
||||
fileName: String,
|
||||
mimeType: String,
|
||||
performer: String,
|
||||
title: String
|
||||
) {
|
||||
self.albumCoverMinithumbnail = albumCoverMinithumbnail
|
||||
self.albumCoverThumbnail = albumCoverThumbnail
|
||||
self.audio = audio
|
||||
self.duration = duration
|
||||
self.externalAlbumCovers = externalAlbumCovers
|
||||
self.fileName = fileName
|
||||
self.mimeType = mimeType
|
||||
self.performer = performer
|
||||
self.title = title
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// AuthenticationCodeInfo.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Information about the authentication code that was sent
|
||||
public struct AuthenticationCodeInfo: Codable, Equatable, Hashable {
|
||||
|
||||
/// The way the next code will be sent to the user; may be null
|
||||
public let nextType: AuthenticationCodeType?
|
||||
|
||||
/// A phone number that is being authenticated
|
||||
public let phoneNumber: String
|
||||
|
||||
/// Timeout before the code can be re-sent, in seconds
|
||||
public let timeout: Int
|
||||
|
||||
/// The way the code was sent to the user
|
||||
public let type: AuthenticationCodeType
|
||||
|
||||
|
||||
public init(
|
||||
nextType: AuthenticationCodeType?,
|
||||
phoneNumber: String,
|
||||
timeout: Int,
|
||||
type: AuthenticationCodeType
|
||||
) {
|
||||
self.nextType = nextType
|
||||
self.phoneNumber = phoneNumber
|
||||
self.timeout = timeout
|
||||
self.type = type
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,294 @@
|
|||
//
|
||||
// AuthenticationCodeType.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Provides information about the method by which an authentication code is delivered to the user
|
||||
public indirect enum AuthenticationCodeType: Codable, Equatable, Hashable {
|
||||
|
||||
/// A digit-only authentication code is delivered via a private Telegram message, which can be viewed from another active session
|
||||
case authenticationCodeTypeTelegramMessage(AuthenticationCodeTypeTelegramMessage)
|
||||
|
||||
/// A digit-only authentication code is delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
|
||||
case authenticationCodeTypeSms(AuthenticationCodeTypeSms)
|
||||
|
||||
/// An authentication code is a word delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
|
||||
case authenticationCodeTypeSmsWord(AuthenticationCodeTypeSmsWord)
|
||||
|
||||
/// An authentication code is a phrase from multiple words delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
|
||||
case authenticationCodeTypeSmsPhrase(AuthenticationCodeTypeSmsPhrase)
|
||||
|
||||
/// A digit-only authentication code is delivered via a phone call to the specified phone number
|
||||
case authenticationCodeTypeCall(AuthenticationCodeTypeCall)
|
||||
|
||||
/// An authentication code is delivered by an immediately canceled call to the specified phone number. The phone number that calls is the code that must be entered automatically
|
||||
case authenticationCodeTypeFlashCall(AuthenticationCodeTypeFlashCall)
|
||||
|
||||
/// An authentication code is delivered by an immediately canceled call to the specified phone number. The last digits of the phone number that calls are the code that must be entered manually by the user
|
||||
case authenticationCodeTypeMissedCall(AuthenticationCodeTypeMissedCall)
|
||||
|
||||
/// A digit-only authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT
|
||||
case authenticationCodeTypeFragment(AuthenticationCodeTypeFragment)
|
||||
|
||||
/// A digit-only authentication code is delivered via Firebase Authentication to the official Android application
|
||||
case authenticationCodeTypeFirebaseAndroid(AuthenticationCodeTypeFirebaseAndroid)
|
||||
|
||||
/// A digit-only authentication code is delivered via Firebase Authentication to the official iOS application
|
||||
case authenticationCodeTypeFirebaseIos(AuthenticationCodeTypeFirebaseIos)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case authenticationCodeTypeTelegramMessage
|
||||
case authenticationCodeTypeSms
|
||||
case authenticationCodeTypeSmsWord
|
||||
case authenticationCodeTypeSmsPhrase
|
||||
case authenticationCodeTypeCall
|
||||
case authenticationCodeTypeFlashCall
|
||||
case authenticationCodeTypeMissedCall
|
||||
case authenticationCodeTypeFragment
|
||||
case authenticationCodeTypeFirebaseAndroid
|
||||
case authenticationCodeTypeFirebaseIos
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .authenticationCodeTypeTelegramMessage:
|
||||
let value = try AuthenticationCodeTypeTelegramMessage(from: decoder)
|
||||
self = .authenticationCodeTypeTelegramMessage(value)
|
||||
case .authenticationCodeTypeSms:
|
||||
let value = try AuthenticationCodeTypeSms(from: decoder)
|
||||
self = .authenticationCodeTypeSms(value)
|
||||
case .authenticationCodeTypeSmsWord:
|
||||
let value = try AuthenticationCodeTypeSmsWord(from: decoder)
|
||||
self = .authenticationCodeTypeSmsWord(value)
|
||||
case .authenticationCodeTypeSmsPhrase:
|
||||
let value = try AuthenticationCodeTypeSmsPhrase(from: decoder)
|
||||
self = .authenticationCodeTypeSmsPhrase(value)
|
||||
case .authenticationCodeTypeCall:
|
||||
let value = try AuthenticationCodeTypeCall(from: decoder)
|
||||
self = .authenticationCodeTypeCall(value)
|
||||
case .authenticationCodeTypeFlashCall:
|
||||
let value = try AuthenticationCodeTypeFlashCall(from: decoder)
|
||||
self = .authenticationCodeTypeFlashCall(value)
|
||||
case .authenticationCodeTypeMissedCall:
|
||||
let value = try AuthenticationCodeTypeMissedCall(from: decoder)
|
||||
self = .authenticationCodeTypeMissedCall(value)
|
||||
case .authenticationCodeTypeFragment:
|
||||
let value = try AuthenticationCodeTypeFragment(from: decoder)
|
||||
self = .authenticationCodeTypeFragment(value)
|
||||
case .authenticationCodeTypeFirebaseAndroid:
|
||||
let value = try AuthenticationCodeTypeFirebaseAndroid(from: decoder)
|
||||
self = .authenticationCodeTypeFirebaseAndroid(value)
|
||||
case .authenticationCodeTypeFirebaseIos:
|
||||
let value = try AuthenticationCodeTypeFirebaseIos(from: decoder)
|
||||
self = .authenticationCodeTypeFirebaseIos(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .authenticationCodeTypeTelegramMessage(let value):
|
||||
try container.encode(Kind.authenticationCodeTypeTelegramMessage, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authenticationCodeTypeSms(let value):
|
||||
try container.encode(Kind.authenticationCodeTypeSms, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authenticationCodeTypeSmsWord(let value):
|
||||
try container.encode(Kind.authenticationCodeTypeSmsWord, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authenticationCodeTypeSmsPhrase(let value):
|
||||
try container.encode(Kind.authenticationCodeTypeSmsPhrase, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authenticationCodeTypeCall(let value):
|
||||
try container.encode(Kind.authenticationCodeTypeCall, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authenticationCodeTypeFlashCall(let value):
|
||||
try container.encode(Kind.authenticationCodeTypeFlashCall, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authenticationCodeTypeMissedCall(let value):
|
||||
try container.encode(Kind.authenticationCodeTypeMissedCall, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authenticationCodeTypeFragment(let value):
|
||||
try container.encode(Kind.authenticationCodeTypeFragment, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authenticationCodeTypeFirebaseAndroid(let value):
|
||||
try container.encode(Kind.authenticationCodeTypeFirebaseAndroid, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authenticationCodeTypeFirebaseIos(let value):
|
||||
try container.encode(Kind.authenticationCodeTypeFirebaseIos, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A digit-only authentication code is delivered via a private Telegram message, which can be viewed from another active session
|
||||
public struct AuthenticationCodeTypeTelegramMessage: Codable, Equatable, Hashable {
|
||||
|
||||
/// Length of the code
|
||||
public let length: Int
|
||||
|
||||
|
||||
public init(length: Int) {
|
||||
self.length = length
|
||||
}
|
||||
}
|
||||
|
||||
/// A digit-only authentication code is delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
|
||||
public struct AuthenticationCodeTypeSms: Codable, Equatable, Hashable {
|
||||
|
||||
/// Length of the code
|
||||
public let length: Int
|
||||
|
||||
|
||||
public init(length: Int) {
|
||||
self.length = length
|
||||
}
|
||||
}
|
||||
|
||||
/// An authentication code is a word delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
|
||||
public struct AuthenticationCodeTypeSmsWord: Codable, Equatable, Hashable {
|
||||
|
||||
/// The first letters of the word if known
|
||||
public let firstLetter: String
|
||||
|
||||
|
||||
public init(firstLetter: String) {
|
||||
self.firstLetter = firstLetter
|
||||
}
|
||||
}
|
||||
|
||||
/// An authentication code is a phrase from multiple words delivered via an SMS message to the specified phone number; non-official applications may not receive this type of code
|
||||
public struct AuthenticationCodeTypeSmsPhrase: Codable, Equatable, Hashable {
|
||||
|
||||
/// The first word of the phrase if known
|
||||
public let firstWord: String
|
||||
|
||||
|
||||
public init(firstWord: String) {
|
||||
self.firstWord = firstWord
|
||||
}
|
||||
}
|
||||
|
||||
/// A digit-only authentication code is delivered via a phone call to the specified phone number
|
||||
public struct AuthenticationCodeTypeCall: Codable, Equatable, Hashable {
|
||||
|
||||
/// Length of the code
|
||||
public let length: Int
|
||||
|
||||
|
||||
public init(length: Int) {
|
||||
self.length = length
|
||||
}
|
||||
}
|
||||
|
||||
/// An authentication code is delivered by an immediately canceled call to the specified phone number. The phone number that calls is the code that must be entered automatically
|
||||
public struct AuthenticationCodeTypeFlashCall: Codable, Equatable, Hashable {
|
||||
|
||||
/// Pattern of the phone number from which the call will be made
|
||||
public let pattern: String
|
||||
|
||||
|
||||
public init(pattern: String) {
|
||||
self.pattern = pattern
|
||||
}
|
||||
}
|
||||
|
||||
/// An authentication code is delivered by an immediately canceled call to the specified phone number. The last digits of the phone number that calls are the code that must be entered manually by the user
|
||||
public struct AuthenticationCodeTypeMissedCall: Codable, Equatable, Hashable {
|
||||
|
||||
/// Number of digits in the code, excluding the prefix
|
||||
public let length: Int
|
||||
|
||||
/// Prefix of the phone number from which the call will be made
|
||||
public let phoneNumberPrefix: String
|
||||
|
||||
|
||||
public init(
|
||||
length: Int,
|
||||
phoneNumberPrefix: String
|
||||
) {
|
||||
self.length = length
|
||||
self.phoneNumberPrefix = phoneNumberPrefix
|
||||
}
|
||||
}
|
||||
|
||||
/// A digit-only authentication code is delivered to https://fragment.com. The user must be logged in there via a wallet owning the phone number's NFT
|
||||
public struct AuthenticationCodeTypeFragment: Codable, Equatable, Hashable {
|
||||
|
||||
/// Length of the code
|
||||
public let length: Int
|
||||
|
||||
/// URL to open to receive the code
|
||||
public let url: String
|
||||
|
||||
|
||||
public init(
|
||||
length: Int,
|
||||
url: String
|
||||
) {
|
||||
self.length = length
|
||||
self.url = url
|
||||
}
|
||||
}
|
||||
|
||||
/// A digit-only authentication code is delivered via Firebase Authentication to the official Android application
|
||||
public struct AuthenticationCodeTypeFirebaseAndroid: Codable, Equatable, Hashable {
|
||||
|
||||
/// Parameters to be used for device verification
|
||||
public let deviceVerificationParameters: FirebaseDeviceVerificationParameters
|
||||
|
||||
/// Length of the code
|
||||
public let length: Int
|
||||
|
||||
|
||||
public init(
|
||||
deviceVerificationParameters: FirebaseDeviceVerificationParameters,
|
||||
length: Int
|
||||
) {
|
||||
self.deviceVerificationParameters = deviceVerificationParameters
|
||||
self.length = length
|
||||
}
|
||||
}
|
||||
|
||||
/// A digit-only authentication code is delivered via Firebase Authentication to the official iOS application
|
||||
public struct AuthenticationCodeTypeFirebaseIos: Codable, Equatable, Hashable {
|
||||
|
||||
/// Length of the code
|
||||
public let length: Int
|
||||
|
||||
/// Time after the next authentication method is expected to be used if verification push notification isn't received, in seconds
|
||||
public let pushTimeout: Int
|
||||
|
||||
/// Receipt of successful application token validation to compare with receipt from push notification
|
||||
public let receipt: String
|
||||
|
||||
|
||||
public init(
|
||||
length: Int,
|
||||
pushTimeout: Int,
|
||||
receipt: String
|
||||
) {
|
||||
self.length = length
|
||||
self.pushTimeout = pushTimeout
|
||||
self.receipt = receipt
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,301 @@
|
|||
//
|
||||
// AuthorizationState.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Represents the current authorization state of the TDLib client
|
||||
public indirect enum AuthorizationState: Codable, Equatable, Hashable {
|
||||
|
||||
/// Initialization parameters are needed. Call setTdlibParameters to provide them
|
||||
case authorizationStateWaitTdlibParameters
|
||||
|
||||
/// TDLib needs the user's phone number to authorize. Call setAuthenticationPhoneNumber to provide the phone number, or use requestQrCodeAuthentication, getAuthenticationPasskeyParameters, or checkAuthenticationBotToken for other authentication options
|
||||
case authorizationStateWaitPhoneNumber
|
||||
|
||||
/// The user must buy Telegram Premium as an in-store purchase to log in. Call checkAuthenticationPremiumPurchase and then setAuthenticationPremiumPurchaseTransaction
|
||||
case authorizationStateWaitPremiumPurchase(AuthorizationStateWaitPremiumPurchase)
|
||||
|
||||
/// TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed
|
||||
case authorizationStateWaitEmailAddress(AuthorizationStateWaitEmailAddress)
|
||||
|
||||
/// TDLib needs the user's authentication code sent to an email address to authorize. Call checkAuthenticationEmailCode to provide the code
|
||||
case authorizationStateWaitEmailCode(AuthorizationStateWaitEmailCode)
|
||||
|
||||
/// TDLib needs the user's authentication code to authorize. Call checkAuthenticationCode to check the code
|
||||
case authorizationStateWaitCode(AuthorizationStateWaitCode)
|
||||
|
||||
/// The user needs to confirm authorization on another logged in device by scanning a QR code with the provided link
|
||||
case authorizationStateWaitOtherDeviceConfirmation(AuthorizationStateWaitOtherDeviceConfirmation)
|
||||
|
||||
/// The user is unregistered and needs to accept terms of service and enter their first name and last name to finish registration. Call registerUser to accept the terms of service and provide the data
|
||||
case authorizationStateWaitRegistration(AuthorizationStateWaitRegistration)
|
||||
|
||||
/// The user has been authorized, but needs to enter a 2-step verification password to start using the application. Call checkAuthenticationPassword to provide the password, or requestAuthenticationPasswordRecovery to recover the password, or deleteAccount to delete the account after a week
|
||||
case authorizationStateWaitPassword(AuthorizationStateWaitPassword)
|
||||
|
||||
/// The user has been successfully authorized. TDLib is now ready to answer general requests
|
||||
case authorizationStateReady
|
||||
|
||||
/// The user is currently logging out
|
||||
case authorizationStateLoggingOut
|
||||
|
||||
/// 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
|
||||
case authorizationStateClosing
|
||||
|
||||
/// TDLib client is in its final state. All databases are closed and all resources are released. No other updates will be received after this. All queries will be responded to with error code 500. To continue working, one must create a new instance of the TDLib client
|
||||
case authorizationStateClosed
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case authorizationStateWaitTdlibParameters
|
||||
case authorizationStateWaitPhoneNumber
|
||||
case authorizationStateWaitPremiumPurchase
|
||||
case authorizationStateWaitEmailAddress
|
||||
case authorizationStateWaitEmailCode
|
||||
case authorizationStateWaitCode
|
||||
case authorizationStateWaitOtherDeviceConfirmation
|
||||
case authorizationStateWaitRegistration
|
||||
case authorizationStateWaitPassword
|
||||
case authorizationStateReady
|
||||
case authorizationStateLoggingOut
|
||||
case authorizationStateClosing
|
||||
case authorizationStateClosed
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .authorizationStateWaitTdlibParameters:
|
||||
self = .authorizationStateWaitTdlibParameters
|
||||
case .authorizationStateWaitPhoneNumber:
|
||||
self = .authorizationStateWaitPhoneNumber
|
||||
case .authorizationStateWaitPremiumPurchase:
|
||||
let value = try AuthorizationStateWaitPremiumPurchase(from: decoder)
|
||||
self = .authorizationStateWaitPremiumPurchase(value)
|
||||
case .authorizationStateWaitEmailAddress:
|
||||
let value = try AuthorizationStateWaitEmailAddress(from: decoder)
|
||||
self = .authorizationStateWaitEmailAddress(value)
|
||||
case .authorizationStateWaitEmailCode:
|
||||
let value = try AuthorizationStateWaitEmailCode(from: decoder)
|
||||
self = .authorizationStateWaitEmailCode(value)
|
||||
case .authorizationStateWaitCode:
|
||||
let value = try AuthorizationStateWaitCode(from: decoder)
|
||||
self = .authorizationStateWaitCode(value)
|
||||
case .authorizationStateWaitOtherDeviceConfirmation:
|
||||
let value = try AuthorizationStateWaitOtherDeviceConfirmation(from: decoder)
|
||||
self = .authorizationStateWaitOtherDeviceConfirmation(value)
|
||||
case .authorizationStateWaitRegistration:
|
||||
let value = try AuthorizationStateWaitRegistration(from: decoder)
|
||||
self = .authorizationStateWaitRegistration(value)
|
||||
case .authorizationStateWaitPassword:
|
||||
let value = try AuthorizationStateWaitPassword(from: decoder)
|
||||
self = .authorizationStateWaitPassword(value)
|
||||
case .authorizationStateReady:
|
||||
self = .authorizationStateReady
|
||||
case .authorizationStateLoggingOut:
|
||||
self = .authorizationStateLoggingOut
|
||||
case .authorizationStateClosing:
|
||||
self = .authorizationStateClosing
|
||||
case .authorizationStateClosed:
|
||||
self = .authorizationStateClosed
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .authorizationStateWaitTdlibParameters:
|
||||
try container.encode(Kind.authorizationStateWaitTdlibParameters, forKey: .type)
|
||||
case .authorizationStateWaitPhoneNumber:
|
||||
try container.encode(Kind.authorizationStateWaitPhoneNumber, forKey: .type)
|
||||
case .authorizationStateWaitPremiumPurchase(let value):
|
||||
try container.encode(Kind.authorizationStateWaitPremiumPurchase, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authorizationStateWaitEmailAddress(let value):
|
||||
try container.encode(Kind.authorizationStateWaitEmailAddress, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authorizationStateWaitEmailCode(let value):
|
||||
try container.encode(Kind.authorizationStateWaitEmailCode, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authorizationStateWaitCode(let value):
|
||||
try container.encode(Kind.authorizationStateWaitCode, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authorizationStateWaitOtherDeviceConfirmation(let value):
|
||||
try container.encode(Kind.authorizationStateWaitOtherDeviceConfirmation, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authorizationStateWaitRegistration(let value):
|
||||
try container.encode(Kind.authorizationStateWaitRegistration, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authorizationStateWaitPassword(let value):
|
||||
try container.encode(Kind.authorizationStateWaitPassword, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .authorizationStateReady:
|
||||
try container.encode(Kind.authorizationStateReady, forKey: .type)
|
||||
case .authorizationStateLoggingOut:
|
||||
try container.encode(Kind.authorizationStateLoggingOut, forKey: .type)
|
||||
case .authorizationStateClosing:
|
||||
try container.encode(Kind.authorizationStateClosing, forKey: .type)
|
||||
case .authorizationStateClosed:
|
||||
try container.encode(Kind.authorizationStateClosed, forKey: .type)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The user must buy Telegram Premium as an in-store purchase to log in. Call checkAuthenticationPremiumPurchase and then setAuthenticationPremiumPurchaseTransaction
|
||||
public struct AuthorizationStateWaitPremiumPurchase: Codable, Equatable, Hashable {
|
||||
|
||||
/// Duration of the Telegram Premium subscription after the purchase; may be 0 if Telegram Premium subscription will not be granted
|
||||
public let premiumDayCount: Int
|
||||
|
||||
/// Identifier of the store product that must be bought
|
||||
public let storeProductId: String
|
||||
|
||||
/// Email address to use for support if the user has issues with Telegram Premium purchase
|
||||
public let supportEmailAddress: String
|
||||
|
||||
/// Subject for the email sent to the support email address
|
||||
public let supportEmailSubject: String
|
||||
|
||||
|
||||
public init(
|
||||
premiumDayCount: Int,
|
||||
storeProductId: String,
|
||||
supportEmailAddress: String,
|
||||
supportEmailSubject: String
|
||||
) {
|
||||
self.premiumDayCount = premiumDayCount
|
||||
self.storeProductId = storeProductId
|
||||
self.supportEmailAddress = supportEmailAddress
|
||||
self.supportEmailSubject = supportEmailSubject
|
||||
}
|
||||
}
|
||||
|
||||
/// TDLib needs the user's email address to authorize. Call setAuthenticationEmailAddress to provide the email address, or directly call checkAuthenticationEmailCode with Apple ID/Google ID token if allowed
|
||||
public struct AuthorizationStateWaitEmailAddress: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if authorization through Apple ID is allowed
|
||||
public let allowAppleId: Bool
|
||||
|
||||
/// True, if authorization through Google ID is allowed
|
||||
public let allowGoogleId: Bool
|
||||
|
||||
|
||||
public init(
|
||||
allowAppleId: Bool,
|
||||
allowGoogleId: Bool
|
||||
) {
|
||||
self.allowAppleId = allowAppleId
|
||||
self.allowGoogleId = allowGoogleId
|
||||
}
|
||||
}
|
||||
|
||||
/// TDLib needs the user's authentication code sent to an email address to authorize. Call checkAuthenticationEmailCode to provide the code
|
||||
public struct AuthorizationStateWaitEmailCode: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if authorization through Apple ID is allowed
|
||||
public let allowAppleId: Bool
|
||||
|
||||
/// True, if authorization through Google ID is allowed
|
||||
public let allowGoogleId: Bool
|
||||
|
||||
/// Information about the sent authentication code
|
||||
public let codeInfo: EmailAddressAuthenticationCodeInfo
|
||||
|
||||
/// Reset state of the email address; may be null if the email address can't be reset
|
||||
public let emailAddressResetState: EmailAddressResetState?
|
||||
|
||||
|
||||
public init(
|
||||
allowAppleId: Bool,
|
||||
allowGoogleId: Bool,
|
||||
codeInfo: EmailAddressAuthenticationCodeInfo,
|
||||
emailAddressResetState: EmailAddressResetState?
|
||||
) {
|
||||
self.allowAppleId = allowAppleId
|
||||
self.allowGoogleId = allowGoogleId
|
||||
self.codeInfo = codeInfo
|
||||
self.emailAddressResetState = emailAddressResetState
|
||||
}
|
||||
}
|
||||
|
||||
/// TDLib needs the user's authentication code to authorize. Call checkAuthenticationCode to check the code
|
||||
public struct AuthorizationStateWaitCode: Codable, Equatable, Hashable {
|
||||
|
||||
/// Information about the authorization code that was sent
|
||||
public let codeInfo: AuthenticationCodeInfo
|
||||
|
||||
|
||||
public init(codeInfo: AuthenticationCodeInfo) {
|
||||
self.codeInfo = codeInfo
|
||||
}
|
||||
}
|
||||
|
||||
/// The user needs to confirm authorization on another logged in device by scanning a QR code with the provided link
|
||||
public struct AuthorizationStateWaitOtherDeviceConfirmation: Codable, Equatable, Hashable {
|
||||
|
||||
/// A tg:// URL for the QR code. The link will be updated frequently
|
||||
public let link: String
|
||||
|
||||
|
||||
public init(link: String) {
|
||||
self.link = link
|
||||
}
|
||||
}
|
||||
|
||||
/// The user is unregistered and needs to accept terms of service and enter their first name and last name to finish registration. Call registerUser to accept the terms of service and provide the data
|
||||
public struct AuthorizationStateWaitRegistration: Codable, Equatable, Hashable {
|
||||
|
||||
/// Telegram terms of service
|
||||
public let termsOfService: TermsOfService
|
||||
|
||||
|
||||
public init(termsOfService: TermsOfService) {
|
||||
self.termsOfService = termsOfService
|
||||
}
|
||||
}
|
||||
|
||||
/// The user has been authorized, but needs to enter a 2-step verification password to start using the application. Call checkAuthenticationPassword to provide the password, or requestAuthenticationPasswordRecovery to recover the password, or deleteAccount to delete the account after a week
|
||||
public struct AuthorizationStateWaitPassword: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if some Telegram Passport elements were saved
|
||||
public let hasPassportData: Bool
|
||||
|
||||
/// True, if a recovery email address has been set up
|
||||
public let hasRecoveryEmailAddress: Bool
|
||||
|
||||
/// Hint for the password; may be empty
|
||||
public let passwordHint: String
|
||||
|
||||
/// Pattern of the email address to which the recovery email was sent; empty until a recovery email has been sent
|
||||
public let recoveryEmailAddressPattern: String
|
||||
|
||||
|
||||
public init(
|
||||
hasPassportData: Bool,
|
||||
hasRecoveryEmailAddress: Bool,
|
||||
passwordHint: String,
|
||||
recoveryEmailAddressPattern: String
|
||||
) {
|
||||
self.hasPassportData = hasPassportData
|
||||
self.hasRecoveryEmailAddress = hasRecoveryEmailAddress
|
||||
self.passwordHint = passwordHint
|
||||
self.recoveryEmailAddressPattern = recoveryEmailAddressPattern
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// Background.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a chat background
|
||||
public struct Background: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Document with the background; may be null. Null only for filled and chat theme backgrounds
|
||||
public let document: Document?
|
||||
|
||||
/// Unique background identifier
|
||||
public let id: TdInt64
|
||||
|
||||
/// True, if the background is dark and is recommended to be used with dark theme
|
||||
public let isDark: Bool
|
||||
|
||||
/// True, if this is one of default backgrounds
|
||||
public let isDefault: Bool
|
||||
|
||||
/// Unique background name
|
||||
public let name: String
|
||||
|
||||
/// Type of the background
|
||||
public let type: BackgroundType
|
||||
|
||||
|
||||
public init(
|
||||
document: Document?,
|
||||
id: TdInt64,
|
||||
isDark: Bool,
|
||||
isDefault: Bool,
|
||||
name: String,
|
||||
type: BackgroundType
|
||||
) {
|
||||
self.document = document
|
||||
self.id = id
|
||||
self.isDark = isDark
|
||||
self.isDefault = isDefault
|
||||
self.name = name
|
||||
self.type = type
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,119 @@
|
|||
//
|
||||
// BackgroundFill.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a fill of a background
|
||||
public indirect enum BackgroundFill: Codable, Equatable, Hashable {
|
||||
|
||||
/// Describes a solid fill of a background
|
||||
case backgroundFillSolid(BackgroundFillSolid)
|
||||
|
||||
/// Describes a gradient fill of a background
|
||||
case backgroundFillGradient(BackgroundFillGradient)
|
||||
|
||||
/// Describes a freeform gradient fill of a background
|
||||
case backgroundFillFreeformGradient(BackgroundFillFreeformGradient)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case backgroundFillSolid
|
||||
case backgroundFillGradient
|
||||
case backgroundFillFreeformGradient
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .backgroundFillSolid:
|
||||
let value = try BackgroundFillSolid(from: decoder)
|
||||
self = .backgroundFillSolid(value)
|
||||
case .backgroundFillGradient:
|
||||
let value = try BackgroundFillGradient(from: decoder)
|
||||
self = .backgroundFillGradient(value)
|
||||
case .backgroundFillFreeformGradient:
|
||||
let value = try BackgroundFillFreeformGradient(from: decoder)
|
||||
self = .backgroundFillFreeformGradient(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .backgroundFillSolid(let value):
|
||||
try container.encode(Kind.backgroundFillSolid, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .backgroundFillGradient(let value):
|
||||
try container.encode(Kind.backgroundFillGradient, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .backgroundFillFreeformGradient(let value):
|
||||
try container.encode(Kind.backgroundFillFreeformGradient, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes a solid fill of a background
|
||||
public struct BackgroundFillSolid: Codable, Equatable, Hashable {
|
||||
|
||||
/// A color of the background in the RGB format
|
||||
public let color: Int
|
||||
|
||||
|
||||
public init(color: Int) {
|
||||
self.color = color
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes a gradient fill of a background
|
||||
public struct BackgroundFillGradient: Codable, Equatable, Hashable {
|
||||
|
||||
/// A bottom color of the background in the RGB format
|
||||
public let bottomColor: Int
|
||||
|
||||
/// Clockwise rotation angle of the gradient, in degrees; 0-359. Must always be divisible by 45
|
||||
public let rotationAngle: Int
|
||||
|
||||
/// A top color of the background in the RGB format
|
||||
public let topColor: Int
|
||||
|
||||
|
||||
public init(
|
||||
bottomColor: Int,
|
||||
rotationAngle: Int,
|
||||
topColor: Int
|
||||
) {
|
||||
self.bottomColor = bottomColor
|
||||
self.rotationAngle = rotationAngle
|
||||
self.topColor = topColor
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes a freeform gradient fill of a background
|
||||
public struct BackgroundFillFreeformGradient: Codable, Equatable, Hashable {
|
||||
|
||||
/// A list of 3 or 4 colors of the freeform gradient in the RGB format
|
||||
public let colors: [Int]
|
||||
|
||||
|
||||
public init(colors: [Int]) {
|
||||
self.colors = colors
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,153 @@
|
|||
//
|
||||
// BackgroundType.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes the type of background
|
||||
public indirect enum BackgroundType: Codable, Equatable, Hashable {
|
||||
|
||||
/// A wallpaper in JPEG format
|
||||
case backgroundTypeWallpaper(BackgroundTypeWallpaper)
|
||||
|
||||
/// 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
|
||||
case backgroundTypePattern(BackgroundTypePattern)
|
||||
|
||||
/// A filled background
|
||||
case backgroundTypeFill(BackgroundTypeFill)
|
||||
|
||||
/// A background from a chat theme based on an emoji; can be used only as a chat background in channels
|
||||
case backgroundTypeChatTheme(BackgroundTypeChatTheme)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case backgroundTypeWallpaper
|
||||
case backgroundTypePattern
|
||||
case backgroundTypeFill
|
||||
case backgroundTypeChatTheme
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .backgroundTypeWallpaper:
|
||||
let value = try BackgroundTypeWallpaper(from: decoder)
|
||||
self = .backgroundTypeWallpaper(value)
|
||||
case .backgroundTypePattern:
|
||||
let value = try BackgroundTypePattern(from: decoder)
|
||||
self = .backgroundTypePattern(value)
|
||||
case .backgroundTypeFill:
|
||||
let value = try BackgroundTypeFill(from: decoder)
|
||||
self = .backgroundTypeFill(value)
|
||||
case .backgroundTypeChatTheme:
|
||||
let value = try BackgroundTypeChatTheme(from: decoder)
|
||||
self = .backgroundTypeChatTheme(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .backgroundTypeWallpaper(let value):
|
||||
try container.encode(Kind.backgroundTypeWallpaper, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .backgroundTypePattern(let value):
|
||||
try container.encode(Kind.backgroundTypePattern, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .backgroundTypeFill(let value):
|
||||
try container.encode(Kind.backgroundTypeFill, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .backgroundTypeChatTheme(let value):
|
||||
try container.encode(Kind.backgroundTypeChatTheme, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A wallpaper in JPEG format
|
||||
public struct BackgroundTypeWallpaper: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if the wallpaper must be downscaled to fit in 450x450 square and then box-blurred with radius 12
|
||||
public let isBlurred: Bool
|
||||
|
||||
/// True, if the background needs to be slightly moved when device is tilted
|
||||
public let isMoving: Bool
|
||||
|
||||
|
||||
public init(
|
||||
isBlurred: Bool,
|
||||
isMoving: Bool
|
||||
) {
|
||||
self.isBlurred = isBlurred
|
||||
self.isMoving = isMoving
|
||||
}
|
||||
}
|
||||
|
||||
/// 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
|
||||
public struct BackgroundTypePattern: Codable, Equatable, Hashable {
|
||||
|
||||
/// Fill of the background
|
||||
public let fill: BackgroundFill
|
||||
|
||||
/// Intensity of the pattern when it is shown above the filled background; 0-100
|
||||
public let intensity: Int
|
||||
|
||||
/// True, if the background fill must be applied only to the pattern itself. All other pixels are black in this case. For dark themes only
|
||||
public let isInverted: Bool
|
||||
|
||||
/// True, if the background needs to be slightly moved when device is tilted
|
||||
public let isMoving: Bool
|
||||
|
||||
|
||||
public init(
|
||||
fill: BackgroundFill,
|
||||
intensity: Int,
|
||||
isInverted: Bool,
|
||||
isMoving: Bool
|
||||
) {
|
||||
self.fill = fill
|
||||
self.intensity = intensity
|
||||
self.isInverted = isInverted
|
||||
self.isMoving = isMoving
|
||||
}
|
||||
}
|
||||
|
||||
/// A filled background
|
||||
public struct BackgroundTypeFill: Codable, Equatable, Hashable {
|
||||
|
||||
/// The background fill
|
||||
public let fill: BackgroundFill
|
||||
|
||||
|
||||
public init(fill: BackgroundFill) {
|
||||
self.fill = fill
|
||||
}
|
||||
}
|
||||
|
||||
/// A background from a chat theme based on an emoji; can be used only as a chat background in channels
|
||||
public struct BackgroundTypeChatTheme: Codable, Equatable, Hashable {
|
||||
|
||||
/// Name of the emoji chat theme
|
||||
public let themeName: String
|
||||
|
||||
|
||||
public init(themeName: String) {
|
||||
self.themeName = themeName
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// Birthdate.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Represents a birthdate of a user
|
||||
public struct Birthdate: Codable, Equatable, Hashable {
|
||||
|
||||
/// Day of the month; 1-31
|
||||
public let day: Int
|
||||
|
||||
/// Month of the year; 1-12
|
||||
public let month: Int
|
||||
|
||||
/// Birth year; 0 if unknown
|
||||
public let year: Int
|
||||
|
||||
|
||||
public init(
|
||||
day: Int,
|
||||
month: Int,
|
||||
year: Int
|
||||
) {
|
||||
self.day = day
|
||||
self.month = month
|
||||
self.year = year
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
//
|
||||
// BlockList.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes type of block list
|
||||
public indirect enum BlockList: Codable, Equatable, Hashable {
|
||||
|
||||
/// The main block list that disallows writing messages to the current user, receiving their status and photo, viewing of stories, and some other actions
|
||||
case blockListMain
|
||||
|
||||
/// The block list that disallows viewing of stories of the current user
|
||||
case blockListStories
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case blockListMain
|
||||
case blockListStories
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .blockListMain:
|
||||
self = .blockListMain
|
||||
case .blockListStories:
|
||||
self = .blockListStories
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .blockListMain:
|
||||
try container.encode(Kind.blockListMain, forKey: .type)
|
||||
case .blockListStories:
|
||||
try container.encode(Kind.blockListStories, forKey: .type)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
//
|
||||
// BotWriteAccessAllowReason.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a reason why a bot was allowed to write messages to the current user
|
||||
public indirect enum BotWriteAccessAllowReason: Codable, Equatable, Hashable {
|
||||
|
||||
/// The user connected a website by logging in using Telegram Login Widget on it
|
||||
case botWriteAccessAllowReasonConnectedWebsite(BotWriteAccessAllowReasonConnectedWebsite)
|
||||
|
||||
/// The user added the bot to attachment or side menu using toggleBotIsAddedToAttachmentMenu
|
||||
case botWriteAccessAllowReasonAddedToAttachmentMenu
|
||||
|
||||
/// The user launched a Web App using getWebAppLinkUrl
|
||||
case botWriteAccessAllowReasonLaunchedWebApp(BotWriteAccessAllowReasonLaunchedWebApp)
|
||||
|
||||
/// The user accepted bot's request to send messages with allowBotToSendMessages
|
||||
case botWriteAccessAllowReasonAcceptedRequest
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case botWriteAccessAllowReasonConnectedWebsite
|
||||
case botWriteAccessAllowReasonAddedToAttachmentMenu
|
||||
case botWriteAccessAllowReasonLaunchedWebApp
|
||||
case botWriteAccessAllowReasonAcceptedRequest
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .botWriteAccessAllowReasonConnectedWebsite:
|
||||
let value = try BotWriteAccessAllowReasonConnectedWebsite(from: decoder)
|
||||
self = .botWriteAccessAllowReasonConnectedWebsite(value)
|
||||
case .botWriteAccessAllowReasonAddedToAttachmentMenu:
|
||||
self = .botWriteAccessAllowReasonAddedToAttachmentMenu
|
||||
case .botWriteAccessAllowReasonLaunchedWebApp:
|
||||
let value = try BotWriteAccessAllowReasonLaunchedWebApp(from: decoder)
|
||||
self = .botWriteAccessAllowReasonLaunchedWebApp(value)
|
||||
case .botWriteAccessAllowReasonAcceptedRequest:
|
||||
self = .botWriteAccessAllowReasonAcceptedRequest
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .botWriteAccessAllowReasonConnectedWebsite(let value):
|
||||
try container.encode(Kind.botWriteAccessAllowReasonConnectedWebsite, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .botWriteAccessAllowReasonAddedToAttachmentMenu:
|
||||
try container.encode(Kind.botWriteAccessAllowReasonAddedToAttachmentMenu, forKey: .type)
|
||||
case .botWriteAccessAllowReasonLaunchedWebApp(let value):
|
||||
try container.encode(Kind.botWriteAccessAllowReasonLaunchedWebApp, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .botWriteAccessAllowReasonAcceptedRequest:
|
||||
try container.encode(Kind.botWriteAccessAllowReasonAcceptedRequest, forKey: .type)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The user connected a website by logging in using Telegram Login Widget on it
|
||||
public struct BotWriteAccessAllowReasonConnectedWebsite: Codable, Equatable, Hashable {
|
||||
|
||||
/// Domain name of the connected website
|
||||
public let domainName: String
|
||||
|
||||
|
||||
public init(domainName: String) {
|
||||
self.domainName = domainName
|
||||
}
|
||||
}
|
||||
|
||||
/// The user launched a Web App using getWebAppLinkUrl
|
||||
public struct BotWriteAccessAllowReasonLaunchedWebApp: Codable, Equatable, Hashable {
|
||||
|
||||
/// Information about the Web App
|
||||
public let webApp: WebApp
|
||||
|
||||
|
||||
public init(webApp: WebApp) {
|
||||
self.webApp = webApp
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
//
|
||||
// BuiltInTheme.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a built-in theme of an official application
|
||||
public indirect enum BuiltInTheme: Codable, Equatable, Hashable {
|
||||
|
||||
/// Classic light theme
|
||||
case builtInThemeClassic
|
||||
|
||||
/// Regular light theme
|
||||
case builtInThemeDay
|
||||
|
||||
/// Regular dark theme
|
||||
case builtInThemeNight
|
||||
|
||||
/// Tinted dark theme
|
||||
case builtInThemeTinted
|
||||
|
||||
/// Arctic light theme
|
||||
case builtInThemeArctic
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case builtInThemeClassic
|
||||
case builtInThemeDay
|
||||
case builtInThemeNight
|
||||
case builtInThemeTinted
|
||||
case builtInThemeArctic
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .builtInThemeClassic:
|
||||
self = .builtInThemeClassic
|
||||
case .builtInThemeDay:
|
||||
self = .builtInThemeDay
|
||||
case .builtInThemeNight:
|
||||
self = .builtInThemeNight
|
||||
case .builtInThemeTinted:
|
||||
self = .builtInThemeTinted
|
||||
case .builtInThemeArctic:
|
||||
self = .builtInThemeArctic
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .builtInThemeClassic:
|
||||
try container.encode(Kind.builtInThemeClassic, forKey: .type)
|
||||
case .builtInThemeDay:
|
||||
try container.encode(Kind.builtInThemeDay, forKey: .type)
|
||||
case .builtInThemeNight:
|
||||
try container.encode(Kind.builtInThemeNight, forKey: .type)
|
||||
case .builtInThemeTinted:
|
||||
try container.encode(Kind.builtInThemeTinted, forKey: .type)
|
||||
case .builtInThemeArctic:
|
||||
try container.encode(Kind.builtInThemeArctic, forKey: .type)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// BusinessBotManageBar.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Contains information about a business bot that manages the chat
|
||||
public struct BusinessBotManageBar: Codable, Equatable, Hashable {
|
||||
|
||||
/// User identifier of the bot
|
||||
public let botUserId: Int64
|
||||
|
||||
/// True, if the bot can reply
|
||||
public let canBotReply: Bool
|
||||
|
||||
/// True, if the bot is paused. Use toggleBusinessConnectedBotChatIsPaused to change the value of the field
|
||||
public let isBotPaused: Bool
|
||||
|
||||
/// URL to be opened to manage the bot
|
||||
public let manageUrl: String
|
||||
|
||||
|
||||
public init(
|
||||
botUserId: Int64,
|
||||
canBotReply: Bool,
|
||||
isBotPaused: Bool,
|
||||
manageUrl: String
|
||||
) {
|
||||
self.botUserId = botUserId
|
||||
self.canBotReply = canBotReply
|
||||
self.isBotPaused = isBotPaused
|
||||
self.manageUrl = manageUrl
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
//
|
||||
// ButtonStyle.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes style of a button
|
||||
public indirect enum ButtonStyle: Codable, Equatable, Hashable {
|
||||
|
||||
/// The button has default style
|
||||
case buttonStyleDefault
|
||||
|
||||
/// The button has dark blue color
|
||||
case buttonStylePrimary
|
||||
|
||||
/// The button has red color
|
||||
case buttonStyleDanger
|
||||
|
||||
/// The button has green color
|
||||
case buttonStyleSuccess
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case buttonStyleDefault
|
||||
case buttonStylePrimary
|
||||
case buttonStyleDanger
|
||||
case buttonStyleSuccess
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .buttonStyleDefault:
|
||||
self = .buttonStyleDefault
|
||||
case .buttonStylePrimary:
|
||||
self = .buttonStylePrimary
|
||||
case .buttonStyleDanger:
|
||||
self = .buttonStyleDanger
|
||||
case .buttonStyleSuccess:
|
||||
self = .buttonStyleSuccess
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .buttonStyleDefault:
|
||||
try container.encode(Kind.buttonStyleDefault, forKey: .type)
|
||||
case .buttonStylePrimary:
|
||||
try container.encode(Kind.buttonStylePrimary, forKey: .type)
|
||||
case .buttonStyleDanger:
|
||||
try container.encode(Kind.buttonStyleDanger, forKey: .type)
|
||||
case .buttonStyleSuccess:
|
||||
try container.encode(Kind.buttonStyleSuccess, forKey: .type)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,103 @@
|
|||
//
|
||||
// CallDiscardReason.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes the reason why a call was discarded
|
||||
public indirect enum CallDiscardReason: Codable, Equatable, Hashable {
|
||||
|
||||
/// The call wasn't discarded, or the reason is unknown
|
||||
case callDiscardReasonEmpty
|
||||
|
||||
/// The call was ended before the conversation started. It was canceled by the caller or missed by the other party
|
||||
case callDiscardReasonMissed
|
||||
|
||||
/// The call was ended before the conversation started. It was declined by the other party
|
||||
case callDiscardReasonDeclined
|
||||
|
||||
/// The call was ended during the conversation because the users were disconnected
|
||||
case callDiscardReasonDisconnected
|
||||
|
||||
/// The call was ended because one of the parties hung up
|
||||
case callDiscardReasonHungUp
|
||||
|
||||
/// The call was ended because it has been upgraded to a group call
|
||||
case callDiscardReasonUpgradeToGroupCall(CallDiscardReasonUpgradeToGroupCall)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case callDiscardReasonEmpty
|
||||
case callDiscardReasonMissed
|
||||
case callDiscardReasonDeclined
|
||||
case callDiscardReasonDisconnected
|
||||
case callDiscardReasonHungUp
|
||||
case callDiscardReasonUpgradeToGroupCall
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .callDiscardReasonEmpty:
|
||||
self = .callDiscardReasonEmpty
|
||||
case .callDiscardReasonMissed:
|
||||
self = .callDiscardReasonMissed
|
||||
case .callDiscardReasonDeclined:
|
||||
self = .callDiscardReasonDeclined
|
||||
case .callDiscardReasonDisconnected:
|
||||
self = .callDiscardReasonDisconnected
|
||||
case .callDiscardReasonHungUp:
|
||||
self = .callDiscardReasonHungUp
|
||||
case .callDiscardReasonUpgradeToGroupCall:
|
||||
let value = try CallDiscardReasonUpgradeToGroupCall(from: decoder)
|
||||
self = .callDiscardReasonUpgradeToGroupCall(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .callDiscardReasonEmpty:
|
||||
try container.encode(Kind.callDiscardReasonEmpty, forKey: .type)
|
||||
case .callDiscardReasonMissed:
|
||||
try container.encode(Kind.callDiscardReasonMissed, forKey: .type)
|
||||
case .callDiscardReasonDeclined:
|
||||
try container.encode(Kind.callDiscardReasonDeclined, forKey: .type)
|
||||
case .callDiscardReasonDisconnected:
|
||||
try container.encode(Kind.callDiscardReasonDisconnected, forKey: .type)
|
||||
case .callDiscardReasonHungUp:
|
||||
try container.encode(Kind.callDiscardReasonHungUp, forKey: .type)
|
||||
case .callDiscardReasonUpgradeToGroupCall(let value):
|
||||
try container.encode(Kind.callDiscardReasonUpgradeToGroupCall, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The call was ended because it has been upgraded to a group call
|
||||
public struct CallDiscardReasonUpgradeToGroupCall: Codable, Equatable, Hashable {
|
||||
|
||||
/// Invite link for the group call
|
||||
public let inviteLink: String
|
||||
|
||||
|
||||
public init(inviteLink: String) {
|
||||
self.inviteLink = inviteLink
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// CancelDownloadFile.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Stops the downloading of a file. If a file has already been downloaded, does nothing
|
||||
public struct CancelDownloadFile: Codable, Equatable, Hashable {
|
||||
|
||||
/// Identifier of a file to stop downloading
|
||||
public let fileId: Int?
|
||||
|
||||
/// Pass true to stop downloading only if it hasn't been started, i.e. request hasn't been sent to server
|
||||
public let onlyIfPending: Bool?
|
||||
|
||||
|
||||
public init(
|
||||
fileId: Int?,
|
||||
onlyIfPending: Bool?
|
||||
) {
|
||||
self.fileId = fileId
|
||||
self.onlyIfPending = onlyIfPending
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,236 @@
|
|||
//
|
||||
// Chat.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// A chat. (Can be a private chat, basic group, supergroup, or secret chat)
|
||||
public struct Chat: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Identifier of the accent color for message sender name, and backgrounds of chat photo, reply header, and link preview
|
||||
public let accentColorId: Int
|
||||
|
||||
/// Information about actions which must be possible to do through the chat action bar; may be null if none
|
||||
public let actionBar: ChatActionBar?
|
||||
|
||||
/// Types of reaction, available in the chat
|
||||
public let availableReactions: ChatAvailableReactions
|
||||
|
||||
/// Background set for the chat; may be null if none
|
||||
public let background: ChatBackground?
|
||||
|
||||
/// Identifier of a custom emoji to be shown on the reply header and link preview background for messages sent by the chat; 0 if none
|
||||
public let backgroundCustomEmojiId: TdInt64
|
||||
|
||||
/// Block list to which the chat is added; may be null if none
|
||||
public let blockList: BlockList?
|
||||
|
||||
/// Information about bar for managing a business bot in the chat; may be null if none
|
||||
public let businessBotManageBar: BusinessBotManageBar?
|
||||
|
||||
/// True, if the chat messages can be deleted for all users
|
||||
public let canBeDeletedForAllUsers: Bool
|
||||
|
||||
/// True, if the chat messages can be deleted only for the current user while other users will continue to see the messages
|
||||
public let canBeDeletedOnlyForSelf: Bool
|
||||
|
||||
/// True, if the chat can be reported to Telegram moderators through reportChat or reportChatPhoto
|
||||
public let canBeReported: Bool
|
||||
|
||||
/// Chat lists to which the chat belongs. A chat can have a non-zero position in a chat list even if it doesn't belong to the chat list and have no position in a chat list even if it belongs to the chat list
|
||||
public let chatLists: [ChatList]
|
||||
|
||||
/// Application-specific data associated with the chat. (For example, the chat scroll position or local chat notification settings can be stored here.) Persistent if the message database is used
|
||||
public let clientData: String
|
||||
|
||||
/// Default value of the disable_notification parameter, used when a message is sent to the chat
|
||||
public let defaultDisableNotification: Bool
|
||||
|
||||
/// A draft of a message in the chat; may be null if none
|
||||
public let draftMessage: DraftMessage?
|
||||
|
||||
/// Emoji status to be shown along with chat title; may be null
|
||||
public let emojiStatus: EmojiStatus?
|
||||
|
||||
/// True, if chat content can't be saved locally, forwarded, or copied
|
||||
public let hasProtectedContent: Bool
|
||||
|
||||
/// True, if the chat has scheduled messages
|
||||
public let hasScheduledMessages: Bool
|
||||
|
||||
/// Chat unique identifier
|
||||
public let id: Int64
|
||||
|
||||
/// True, if the chat is marked as unread
|
||||
public let isMarkedAsUnread: Bool
|
||||
|
||||
/// True, if translation of all messages in the chat must be suggested to the user
|
||||
public let isTranslatable: Bool
|
||||
|
||||
/// Last message in the chat; may be null if none or unknown
|
||||
public let lastMessage: Message?
|
||||
|
||||
/// Identifier of the last read incoming message
|
||||
public let lastReadInboxMessageId: Int64
|
||||
|
||||
/// Identifier of the last read outgoing message
|
||||
public let lastReadOutboxMessageId: Int64
|
||||
|
||||
/// Current message auto-delete or self-destruct timer setting for the chat, in seconds; 0 if disabled. Self-destruct timer in secret chats starts after the message or its content is viewed. Auto-delete timer in other chats starts from the send date
|
||||
public let messageAutoDeleteTime: Int
|
||||
|
||||
/// Identifier of a user or chat that is selected to send messages in the chat; may be null if the user can't change message sender
|
||||
public let messageSenderId: MessageSender?
|
||||
|
||||
/// Notification settings for the chat
|
||||
public let notificationSettings: ChatNotificationSettings
|
||||
|
||||
/// Information about pending join requests; may be null if none
|
||||
public let pendingJoinRequests: ChatJoinRequestsInfo?
|
||||
|
||||
/// Actions that non-administrator chat members are allowed to take in the chat
|
||||
public let permissions: ChatPermissions
|
||||
|
||||
/// Chat photo; may be null
|
||||
public let photo: ChatPhotoInfo?
|
||||
|
||||
/// Positions of the chat in chat lists
|
||||
public let positions: [ChatPosition]
|
||||
|
||||
/// Identifier of the profile accent color for the chat's profile; -1 if none
|
||||
public let profileAccentColorId: Int
|
||||
|
||||
/// Identifier of a custom emoji to be shown on the background of the chat's profile; 0 if none
|
||||
public let profileBackgroundCustomEmojiId: TdInt64
|
||||
|
||||
/// Identifier of the message from which reply markup needs to be used; 0 if there is no reply markup in the chat
|
||||
public let replyMarkupMessageId: Int64
|
||||
|
||||
/// Theme set for the chat; may be null if none
|
||||
public let theme: ChatTheme?
|
||||
|
||||
/// Chat title
|
||||
public let title: String
|
||||
|
||||
/// Type of the chat
|
||||
public let type: ChatType
|
||||
|
||||
/// Number of unread messages in the chat
|
||||
public let unreadCount: Int
|
||||
|
||||
/// Number of unread messages with a mention/reply in the chat
|
||||
public let unreadMentionCount: Int
|
||||
|
||||
/// Number of messages with unread poll votes in the chat
|
||||
public let unreadPollVoteCount: Int
|
||||
|
||||
/// Number of messages with unread reactions in the chat
|
||||
public let unreadReactionCount: Int
|
||||
|
||||
/// Color scheme based on an upgraded gift to be used for the chat instead of accent_color_id and background_custom_emoji_id; may be null if none
|
||||
public let upgradedGiftColors: UpgradedGiftColors?
|
||||
|
||||
/// Information about video chat of the chat
|
||||
public let videoChat: VideoChat
|
||||
|
||||
/// True, if the chat is a forum supergroup that must be shown in the "View as topics" mode, or Saved Messages chat that must be shown in the "View as chats"
|
||||
public let viewAsTopics: Bool
|
||||
|
||||
|
||||
public init(
|
||||
accentColorId: Int,
|
||||
actionBar: ChatActionBar?,
|
||||
availableReactions: ChatAvailableReactions,
|
||||
background: ChatBackground?,
|
||||
backgroundCustomEmojiId: TdInt64,
|
||||
blockList: BlockList?,
|
||||
businessBotManageBar: BusinessBotManageBar?,
|
||||
canBeDeletedForAllUsers: Bool,
|
||||
canBeDeletedOnlyForSelf: Bool,
|
||||
canBeReported: Bool,
|
||||
chatLists: [ChatList],
|
||||
clientData: String,
|
||||
defaultDisableNotification: Bool,
|
||||
draftMessage: DraftMessage?,
|
||||
emojiStatus: EmojiStatus?,
|
||||
hasProtectedContent: Bool,
|
||||
hasScheduledMessages: Bool,
|
||||
id: Int64,
|
||||
isMarkedAsUnread: Bool,
|
||||
isTranslatable: Bool,
|
||||
lastMessage: Message?,
|
||||
lastReadInboxMessageId: Int64,
|
||||
lastReadOutboxMessageId: Int64,
|
||||
messageAutoDeleteTime: Int,
|
||||
messageSenderId: MessageSender?,
|
||||
notificationSettings: ChatNotificationSettings,
|
||||
pendingJoinRequests: ChatJoinRequestsInfo?,
|
||||
permissions: ChatPermissions,
|
||||
photo: ChatPhotoInfo?,
|
||||
positions: [ChatPosition],
|
||||
profileAccentColorId: Int,
|
||||
profileBackgroundCustomEmojiId: TdInt64,
|
||||
replyMarkupMessageId: Int64,
|
||||
theme: ChatTheme?,
|
||||
title: String,
|
||||
type: ChatType,
|
||||
unreadCount: Int,
|
||||
unreadMentionCount: Int,
|
||||
unreadPollVoteCount: Int,
|
||||
unreadReactionCount: Int,
|
||||
upgradedGiftColors: UpgradedGiftColors?,
|
||||
videoChat: VideoChat,
|
||||
viewAsTopics: Bool
|
||||
) {
|
||||
self.accentColorId = accentColorId
|
||||
self.actionBar = actionBar
|
||||
self.availableReactions = availableReactions
|
||||
self.background = background
|
||||
self.backgroundCustomEmojiId = backgroundCustomEmojiId
|
||||
self.blockList = blockList
|
||||
self.businessBotManageBar = businessBotManageBar
|
||||
self.canBeDeletedForAllUsers = canBeDeletedForAllUsers
|
||||
self.canBeDeletedOnlyForSelf = canBeDeletedOnlyForSelf
|
||||
self.canBeReported = canBeReported
|
||||
self.chatLists = chatLists
|
||||
self.clientData = clientData
|
||||
self.defaultDisableNotification = defaultDisableNotification
|
||||
self.draftMessage = draftMessage
|
||||
self.emojiStatus = emojiStatus
|
||||
self.hasProtectedContent = hasProtectedContent
|
||||
self.hasScheduledMessages = hasScheduledMessages
|
||||
self.id = id
|
||||
self.isMarkedAsUnread = isMarkedAsUnread
|
||||
self.isTranslatable = isTranslatable
|
||||
self.lastMessage = lastMessage
|
||||
self.lastReadInboxMessageId = lastReadInboxMessageId
|
||||
self.lastReadOutboxMessageId = lastReadOutboxMessageId
|
||||
self.messageAutoDeleteTime = messageAutoDeleteTime
|
||||
self.messageSenderId = messageSenderId
|
||||
self.notificationSettings = notificationSettings
|
||||
self.pendingJoinRequests = pendingJoinRequests
|
||||
self.permissions = permissions
|
||||
self.photo = photo
|
||||
self.positions = positions
|
||||
self.profileAccentColorId = profileAccentColorId
|
||||
self.profileBackgroundCustomEmojiId = profileBackgroundCustomEmojiId
|
||||
self.replyMarkupMessageId = replyMarkupMessageId
|
||||
self.theme = theme
|
||||
self.title = title
|
||||
self.type = type
|
||||
self.unreadCount = unreadCount
|
||||
self.unreadMentionCount = unreadMentionCount
|
||||
self.unreadPollVoteCount = unreadPollVoteCount
|
||||
self.unreadReactionCount = unreadReactionCount
|
||||
self.upgradedGiftColors = upgradedGiftColors
|
||||
self.videoChat = videoChat
|
||||
self.viewAsTopics = viewAsTopics
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
//
|
||||
// ChatActionBar.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes actions which must be possible to do through a chat action bar
|
||||
public indirect enum ChatActionBar: Codable, Equatable, Hashable {
|
||||
|
||||
/// The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown
|
||||
case chatActionBarReportSpam(ChatActionBarReportSpam)
|
||||
|
||||
/// The chat is a recently created group chat to which new members can be invited
|
||||
case chatActionBarInviteMembers
|
||||
|
||||
/// The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method setMessageSenderBlockList, or the other user can be added to the contact list using the method addContact. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown
|
||||
case chatActionBarReportAddBlock(ChatActionBarReportAddBlock)
|
||||
|
||||
/// The chat is a private or secret chat and the other user can be added to the contact list using the method addContact
|
||||
case chatActionBarAddContact
|
||||
|
||||
/// 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
|
||||
case chatActionBarSharePhoneNumber
|
||||
|
||||
/// The chat is a private chat with an administrator of a chat to which the user sent join request
|
||||
case chatActionBarJoinRequest(ChatActionBarJoinRequest)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case chatActionBarReportSpam
|
||||
case chatActionBarInviteMembers
|
||||
case chatActionBarReportAddBlock
|
||||
case chatActionBarAddContact
|
||||
case chatActionBarSharePhoneNumber
|
||||
case chatActionBarJoinRequest
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .chatActionBarReportSpam:
|
||||
let value = try ChatActionBarReportSpam(from: decoder)
|
||||
self = .chatActionBarReportSpam(value)
|
||||
case .chatActionBarInviteMembers:
|
||||
self = .chatActionBarInviteMembers
|
||||
case .chatActionBarReportAddBlock:
|
||||
let value = try ChatActionBarReportAddBlock(from: decoder)
|
||||
self = .chatActionBarReportAddBlock(value)
|
||||
case .chatActionBarAddContact:
|
||||
self = .chatActionBarAddContact
|
||||
case .chatActionBarSharePhoneNumber:
|
||||
self = .chatActionBarSharePhoneNumber
|
||||
case .chatActionBarJoinRequest:
|
||||
let value = try ChatActionBarJoinRequest(from: decoder)
|
||||
self = .chatActionBarJoinRequest(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .chatActionBarReportSpam(let value):
|
||||
try container.encode(Kind.chatActionBarReportSpam, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .chatActionBarInviteMembers:
|
||||
try container.encode(Kind.chatActionBarInviteMembers, forKey: .type)
|
||||
case .chatActionBarReportAddBlock(let value):
|
||||
try container.encode(Kind.chatActionBarReportAddBlock, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .chatActionBarAddContact:
|
||||
try container.encode(Kind.chatActionBarAddContact, forKey: .type)
|
||||
case .chatActionBarSharePhoneNumber:
|
||||
try container.encode(Kind.chatActionBarSharePhoneNumber, forKey: .type)
|
||||
case .chatActionBarJoinRequest(let value):
|
||||
try container.encode(Kind.chatActionBarJoinRequest, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The chat can be reported as spam using the method reportChat with an empty option_id and message_ids. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown
|
||||
public struct ChatActionBarReportSpam: Codable, Equatable, Hashable {
|
||||
|
||||
/// If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings
|
||||
public let canUnarchive: Bool
|
||||
|
||||
|
||||
public init(canUnarchive: Bool) {
|
||||
self.canUnarchive = canUnarchive
|
||||
}
|
||||
}
|
||||
|
||||
/// The chat is a private or secret chat, which can be reported using the method reportChat, or the other user can be blocked using the method setMessageSenderBlockList, or the other user can be added to the contact list using the method addContact. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown
|
||||
public struct ChatActionBarReportAddBlock: Codable, Equatable, Hashable {
|
||||
|
||||
/// Basic information about the other user in the chat; may be null if unknown
|
||||
public let accountInfo: AccountInfo?
|
||||
|
||||
/// If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings
|
||||
public let canUnarchive: Bool
|
||||
|
||||
|
||||
public init(
|
||||
accountInfo: AccountInfo?,
|
||||
canUnarchive: Bool
|
||||
) {
|
||||
self.accountInfo = accountInfo
|
||||
self.canUnarchive = canUnarchive
|
||||
}
|
||||
}
|
||||
|
||||
/// The chat is a private chat with an administrator of a chat to which the user sent join request
|
||||
public struct ChatActionBarJoinRequest: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if the join request was sent to a channel chat
|
||||
public let isChannel: Bool
|
||||
|
||||
/// Point in time (Unix timestamp) when the join request was sent
|
||||
public let requestDate: Int
|
||||
|
||||
/// Title of the chat to which the join request was sent
|
||||
public let title: String
|
||||
|
||||
|
||||
public init(
|
||||
isChannel: Bool,
|
||||
requestDate: Int,
|
||||
title: String
|
||||
) {
|
||||
self.isChannel = isChannel
|
||||
self.requestDate = requestDate
|
||||
self.title = title
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
//
|
||||
// ChatAdministratorRights.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes rights of the administrator
|
||||
public struct ChatAdministratorRights: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if the administrator can change the chat title, photo, and other settings
|
||||
public let canChangeInfo: Bool
|
||||
|
||||
/// True, if the administrator can delete messages of other users
|
||||
public let canDeleteMessages: Bool
|
||||
|
||||
/// True, if the administrator can delete stories posted by other users; applicable to supergroups and channels only
|
||||
public let canDeleteStories: Bool
|
||||
|
||||
/// True, if the administrator can edit messages of other users and pin messages; applicable to channels only
|
||||
public let canEditMessages: Bool
|
||||
|
||||
/// True, if the administrator can edit stories posted by other users, post stories to the chat page, pin chat stories, and access story archive; applicable to supergroups and channels only
|
||||
public let canEditStories: Bool
|
||||
|
||||
/// True, if the administrator can invite new users to the chat
|
||||
public let canInviteUsers: Bool
|
||||
|
||||
/// True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report supergroup spam messages, ignore slow mode, and send messages to the chat without paying Telegram Stars. Implied by any other privilege; applicable to supergroups and channels only
|
||||
public let canManageChat: Bool
|
||||
|
||||
/// True, if the administrator can answer to channel direct messages; applicable to channels only
|
||||
public let canManageDirectMessages: Bool
|
||||
|
||||
/// True, if the administrator can change tags of other users; applicable to basic groups and supergroups only
|
||||
public let canManageTags: Bool
|
||||
|
||||
/// True, if the administrator can create, rename, close, reopen, hide, and unhide forum topics; applicable to forum supergroups only
|
||||
public let canManageTopics: Bool
|
||||
|
||||
/// True, if the administrator can manage video chats
|
||||
public let canManageVideoChats: Bool
|
||||
|
||||
/// True, if the administrator can pin messages; applicable to basic groups and supergroups only
|
||||
public let canPinMessages: Bool
|
||||
|
||||
/// True, if the administrator can create channel posts, approve suggested channel posts, or view channel statistics; applicable to channels only
|
||||
public let canPostMessages: Bool
|
||||
|
||||
/// True, if the administrator can create new chat stories, or edit and delete posted stories; applicable to supergroups and channels only
|
||||
public let canPostStories: 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
|
||||
public let canPromoteMembers: Bool
|
||||
|
||||
/// True, if the administrator can restrict, ban, or unban chat members or view supergroup statistics
|
||||
public let canRestrictMembers: Bool
|
||||
|
||||
/// True, if the administrator isn't shown in the chat member list and sends messages anonymously; applicable to supergroups only
|
||||
public let isAnonymous: Bool
|
||||
|
||||
|
||||
public init(
|
||||
canChangeInfo: Bool,
|
||||
canDeleteMessages: Bool,
|
||||
canDeleteStories: Bool,
|
||||
canEditMessages: Bool,
|
||||
canEditStories: Bool,
|
||||
canInviteUsers: Bool,
|
||||
canManageChat: Bool,
|
||||
canManageDirectMessages: Bool,
|
||||
canManageTags: Bool,
|
||||
canManageTopics: Bool,
|
||||
canManageVideoChats: Bool,
|
||||
canPinMessages: Bool,
|
||||
canPostMessages: Bool,
|
||||
canPostStories: Bool,
|
||||
canPromoteMembers: Bool,
|
||||
canRestrictMembers: Bool,
|
||||
isAnonymous: Bool
|
||||
) {
|
||||
self.canChangeInfo = canChangeInfo
|
||||
self.canDeleteMessages = canDeleteMessages
|
||||
self.canDeleteStories = canDeleteStories
|
||||
self.canEditMessages = canEditMessages
|
||||
self.canEditStories = canEditStories
|
||||
self.canInviteUsers = canInviteUsers
|
||||
self.canManageChat = canManageChat
|
||||
self.canManageDirectMessages = canManageDirectMessages
|
||||
self.canManageTags = canManageTags
|
||||
self.canManageTopics = canManageTopics
|
||||
self.canManageVideoChats = canManageVideoChats
|
||||
self.canPinMessages = canPinMessages
|
||||
self.canPostMessages = canPostMessages
|
||||
self.canPostStories = canPostStories
|
||||
self.canPromoteMembers = canPromoteMembers
|
||||
self.canRestrictMembers = canRestrictMembers
|
||||
self.isAnonymous = isAnonymous
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
//
|
||||
// ChatAvailableReactions.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes reactions available in the chat
|
||||
public indirect enum ChatAvailableReactions: Codable, Equatable, Hashable {
|
||||
|
||||
/// All reactions are available in the chat, excluding the paid reaction and custom reactions in channel chats
|
||||
case chatAvailableReactionsAll(ChatAvailableReactionsAll)
|
||||
|
||||
/// Only specific reactions are available in the chat
|
||||
case chatAvailableReactionsSome(ChatAvailableReactionsSome)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case chatAvailableReactionsAll
|
||||
case chatAvailableReactionsSome
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .chatAvailableReactionsAll:
|
||||
let value = try ChatAvailableReactionsAll(from: decoder)
|
||||
self = .chatAvailableReactionsAll(value)
|
||||
case .chatAvailableReactionsSome:
|
||||
let value = try ChatAvailableReactionsSome(from: decoder)
|
||||
self = .chatAvailableReactionsSome(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .chatAvailableReactionsAll(let value):
|
||||
try container.encode(Kind.chatAvailableReactionsAll, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .chatAvailableReactionsSome(let value):
|
||||
try container.encode(Kind.chatAvailableReactionsSome, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// All reactions are available in the chat, excluding the paid reaction and custom reactions in channel chats
|
||||
public struct ChatAvailableReactionsAll: Codable, Equatable, Hashable {
|
||||
|
||||
/// The maximum allowed number of reactions per message; 1-11
|
||||
public let maxReactionCount: Int
|
||||
|
||||
|
||||
public init(maxReactionCount: Int) {
|
||||
self.maxReactionCount = maxReactionCount
|
||||
}
|
||||
}
|
||||
|
||||
/// Only specific reactions are available in the chat
|
||||
public struct ChatAvailableReactionsSome: Codable, Equatable, Hashable {
|
||||
|
||||
/// The maximum allowed number of reactions per message; 1-11
|
||||
public let maxReactionCount: Int
|
||||
|
||||
/// The list of reactions
|
||||
public let reactions: [ReactionType]
|
||||
|
||||
|
||||
public init(
|
||||
maxReactionCount: Int,
|
||||
reactions: [ReactionType]
|
||||
) {
|
||||
self.maxReactionCount = maxReactionCount
|
||||
self.reactions = reactions
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// ChatBackground.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a background set for a specific chat
|
||||
public struct ChatBackground: Codable, Equatable, Hashable {
|
||||
|
||||
/// The background
|
||||
public let background: Background
|
||||
|
||||
/// Dimming of the background in dark themes, as a percentage; 0-100. Applied only to Wallpaper and Fill types of background
|
||||
public let darkThemeDimming: Int
|
||||
|
||||
|
||||
public init(
|
||||
background: Background,
|
||||
darkThemeDimming: Int
|
||||
) {
|
||||
self.background = background
|
||||
self.darkThemeDimming = darkThemeDimming
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// ChatFolderIcon.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Represents an icon for a chat folder
|
||||
public struct ChatFolderIcon: Codable, Equatable, Hashable {
|
||||
|
||||
/// The chosen icon name for short folder representation; one of "All", "Unread", "Unmuted", "Bots", "Channels", "Groups", "Private", "Custom", "Setup", "Cat", "Crown", "Favorite", "Flower", "Game", "Home", "Love", "Mask", "Party", "Sport", "Study", "Trade", "Travel", "Work", "Airplane", "Book", "Light", "Like", "Money", "Note", "Palette"
|
||||
public let name: String
|
||||
|
||||
|
||||
public init(name: String) {
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// ChatFolderInfo.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Contains basic information about a chat folder
|
||||
public struct ChatFolderInfo: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// The identifier of the chosen color for the chat folder icon; from -1 to 6. If -1, then color is disabled
|
||||
public let colorId: Int
|
||||
|
||||
/// True, if the chat folder has invite links created by the current user
|
||||
public let hasMyInviteLinks: Bool
|
||||
|
||||
/// The chosen or default icon for the chat folder
|
||||
public let icon: ChatFolderIcon
|
||||
|
||||
/// Unique chat folder identifier
|
||||
public let id: Int
|
||||
|
||||
/// True, if at least one link has been created for the folder
|
||||
public let isShareable: Bool
|
||||
|
||||
/// The name of the folder
|
||||
public let name: ChatFolderName
|
||||
|
||||
|
||||
public init(
|
||||
colorId: Int,
|
||||
hasMyInviteLinks: Bool,
|
||||
icon: ChatFolderIcon,
|
||||
id: Int,
|
||||
isShareable: Bool,
|
||||
name: ChatFolderName
|
||||
) {
|
||||
self.colorId = colorId
|
||||
self.hasMyInviteLinks = hasMyInviteLinks
|
||||
self.icon = icon
|
||||
self.id = id
|
||||
self.isShareable = isShareable
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// ChatFolderName.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes name of a chat folder
|
||||
public struct ChatFolderName: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if custom emoji in the name must be animated
|
||||
public let animateCustomEmoji: Bool
|
||||
|
||||
/// The text of the chat folder name; 1-12 characters without line feeds. May contain only CustomEmoji entities
|
||||
public let text: FormattedText
|
||||
|
||||
|
||||
public init(
|
||||
animateCustomEmoji: Bool,
|
||||
text: FormattedText
|
||||
) {
|
||||
self.animateCustomEmoji = animateCustomEmoji
|
||||
self.text = text
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// ChatJoinRequestsInfo.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Contains information about pending join requests for a chat
|
||||
public struct ChatJoinRequestsInfo: Codable, Equatable, Hashable {
|
||||
|
||||
/// Total number of pending join requests
|
||||
public let totalCount: Int
|
||||
|
||||
/// Identifiers of at most 3 users sent the newest pending join requests
|
||||
public let userIds: [Int64]
|
||||
|
||||
|
||||
public init(
|
||||
totalCount: Int,
|
||||
userIds: [Int64]
|
||||
) {
|
||||
self.totalCount = totalCount
|
||||
self.userIds = userIds
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
//
|
||||
// ChatList.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a list of chats
|
||||
public indirect enum ChatList: Codable, Equatable, Hashable {
|
||||
|
||||
/// A main list of chats
|
||||
case chatListMain
|
||||
|
||||
/// 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
|
||||
case chatListArchive
|
||||
|
||||
/// A list of chats added to a chat folder
|
||||
case chatListFolder(ChatListFolder)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case chatListMain
|
||||
case chatListArchive
|
||||
case chatListFolder
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .chatListMain:
|
||||
self = .chatListMain
|
||||
case .chatListArchive:
|
||||
self = .chatListArchive
|
||||
case .chatListFolder:
|
||||
let value = try ChatListFolder(from: decoder)
|
||||
self = .chatListFolder(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .chatListMain:
|
||||
try container.encode(Kind.chatListMain, forKey: .type)
|
||||
case .chatListArchive:
|
||||
try container.encode(Kind.chatListArchive, forKey: .type)
|
||||
case .chatListFolder(let value):
|
||||
try container.encode(Kind.chatListFolder, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A list of chats added to a chat folder
|
||||
public struct ChatListFolder: Codable, Equatable, Hashable {
|
||||
|
||||
/// Chat folder identifier
|
||||
public let chatFolderId: Int
|
||||
|
||||
|
||||
public init(chatFolderId: Int) {
|
||||
self.chatFolderId = chatFolderId
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
//
|
||||
// ChatNotificationSettings.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Contains information about notification settings for a chat or a forum topic
|
||||
public struct ChatNotificationSettings: Codable, Equatable, Hashable {
|
||||
|
||||
/// If true, notifications for messages with mentions will be created as for an ordinary unread message
|
||||
public let disableMentionNotifications: Bool
|
||||
|
||||
/// If true, notifications for incoming pinned messages will be created as for an ordinary unread message
|
||||
public let disablePinnedMessageNotifications: Bool
|
||||
|
||||
/// Time left before notifications will be unmuted, in seconds
|
||||
public let muteFor: Int
|
||||
|
||||
/// True, if story notifications are disabled for the chat
|
||||
public let muteStories: Bool
|
||||
|
||||
/// True, if message content must be displayed in notifications
|
||||
public let showPreview: Bool
|
||||
|
||||
/// True, if the chat that posted a story must be displayed in notifications
|
||||
public let showStoryPoster: Bool
|
||||
|
||||
/// Identifier of the notification sound to be played for messages; 0 if sound is disabled
|
||||
public let soundId: TdInt64
|
||||
|
||||
/// Identifier of the notification sound to be played for stories; 0 if sound is disabled
|
||||
public let storySoundId: TdInt64
|
||||
|
||||
/// If true, the value for the relevant type of chat or the forum chat is used instead of disable_mention_notifications
|
||||
public let useDefaultDisableMentionNotifications: Bool
|
||||
|
||||
/// If true, the value for the relevant type of chat or the forum chat is used instead of disable_pinned_message_notifications
|
||||
public let useDefaultDisablePinnedMessageNotifications: Bool
|
||||
|
||||
/// If true, the value for the relevant type of chat or the forum chat is used instead of mute_for
|
||||
public let useDefaultMuteFor: Bool
|
||||
|
||||
/// If true, the value for the relevant type of chat is used instead of mute_stories
|
||||
public let useDefaultMuteStories: Bool
|
||||
|
||||
/// If true, the value for the relevant type of chat or the forum chat is used instead of show_preview
|
||||
public let useDefaultShowPreview: Bool
|
||||
|
||||
/// If true, the value for the relevant type of chat is used instead of show_story_poster
|
||||
public let useDefaultShowStoryPoster: Bool
|
||||
|
||||
/// If true, the value for the relevant type of chat or the forum chat is used instead of sound_id
|
||||
public let useDefaultSound: Bool
|
||||
|
||||
/// If true, the value for the relevant type of chat is used instead of story_sound_id
|
||||
public let useDefaultStorySound: Bool
|
||||
|
||||
|
||||
public init(
|
||||
disableMentionNotifications: Bool,
|
||||
disablePinnedMessageNotifications: Bool,
|
||||
muteFor: Int,
|
||||
muteStories: Bool,
|
||||
showPreview: Bool,
|
||||
showStoryPoster: Bool,
|
||||
soundId: TdInt64,
|
||||
storySoundId: TdInt64,
|
||||
useDefaultDisableMentionNotifications: Bool,
|
||||
useDefaultDisablePinnedMessageNotifications: Bool,
|
||||
useDefaultMuteFor: Bool,
|
||||
useDefaultMuteStories: Bool,
|
||||
useDefaultShowPreview: Bool,
|
||||
useDefaultShowStoryPoster: Bool,
|
||||
useDefaultSound: Bool,
|
||||
useDefaultStorySound: Bool
|
||||
) {
|
||||
self.disableMentionNotifications = disableMentionNotifications
|
||||
self.disablePinnedMessageNotifications = disablePinnedMessageNotifications
|
||||
self.muteFor = muteFor
|
||||
self.muteStories = muteStories
|
||||
self.showPreview = showPreview
|
||||
self.showStoryPoster = showStoryPoster
|
||||
self.soundId = soundId
|
||||
self.storySoundId = storySoundId
|
||||
self.useDefaultDisableMentionNotifications = useDefaultDisableMentionNotifications
|
||||
self.useDefaultDisablePinnedMessageNotifications = useDefaultDisablePinnedMessageNotifications
|
||||
self.useDefaultMuteFor = useDefaultMuteFor
|
||||
self.useDefaultMuteStories = useDefaultMuteStories
|
||||
self.useDefaultShowPreview = useDefaultShowPreview
|
||||
self.useDefaultShowStoryPoster = useDefaultShowStoryPoster
|
||||
self.useDefaultSound = useDefaultSound
|
||||
self.useDefaultStorySound = useDefaultStorySound
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
//
|
||||
// ChatPermissions.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes actions that a user is allowed to take in a chat
|
||||
public struct ChatPermissions: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if the user may add a link preview to their messages
|
||||
public let canAddLinkPreviews: Bool
|
||||
|
||||
/// True, if the user can change the chat title, photo, and other settings
|
||||
public let canChangeInfo: Bool
|
||||
|
||||
/// True, if the user can create topics
|
||||
public let canCreateTopics: Bool
|
||||
|
||||
/// True, if the user may change the tag of self
|
||||
public let canEditTag: Bool
|
||||
|
||||
/// True, if the user can invite new users to the chat
|
||||
public let canInviteUsers: Bool
|
||||
|
||||
/// True, if the user can pin messages
|
||||
public let canPinMessages: Bool
|
||||
|
||||
/// True, if the user can react to messages
|
||||
public let canReactToMessages: Bool
|
||||
|
||||
/// True, if the user can send music files
|
||||
public let canSendAudios: Bool
|
||||
|
||||
/// True, if the user can send text messages, contacts, giveaways, giveaway winners, invoices, locations, and venues
|
||||
public let canSendBasicMessages: Bool
|
||||
|
||||
/// True, if the user can send documents
|
||||
public let canSendDocuments: Bool
|
||||
|
||||
/// True, if the user can send animations, games, stickers, and dice and use inline bots
|
||||
public let canSendOtherMessages: Bool
|
||||
|
||||
/// True, if the user can send photos
|
||||
public let canSendPhotos: Bool
|
||||
|
||||
/// True, if the user can send polls and checklists
|
||||
public let canSendPolls: Bool
|
||||
|
||||
/// True, if the user can send video notes
|
||||
public let canSendVideoNotes: Bool
|
||||
|
||||
/// True, if the user can send videos
|
||||
public let canSendVideos: Bool
|
||||
|
||||
/// True, if the user can send voice notes
|
||||
public let canSendVoiceNotes: Bool
|
||||
|
||||
|
||||
public init(
|
||||
canAddLinkPreviews: Bool,
|
||||
canChangeInfo: Bool,
|
||||
canCreateTopics: Bool,
|
||||
canEditTag: Bool,
|
||||
canInviteUsers: Bool,
|
||||
canPinMessages: Bool,
|
||||
canReactToMessages: Bool,
|
||||
canSendAudios: Bool,
|
||||
canSendBasicMessages: Bool,
|
||||
canSendDocuments: Bool,
|
||||
canSendOtherMessages: Bool,
|
||||
canSendPhotos: Bool,
|
||||
canSendPolls: Bool,
|
||||
canSendVideoNotes: Bool,
|
||||
canSendVideos: Bool,
|
||||
canSendVoiceNotes: Bool
|
||||
) {
|
||||
self.canAddLinkPreviews = canAddLinkPreviews
|
||||
self.canChangeInfo = canChangeInfo
|
||||
self.canCreateTopics = canCreateTopics
|
||||
self.canEditTag = canEditTag
|
||||
self.canInviteUsers = canInviteUsers
|
||||
self.canPinMessages = canPinMessages
|
||||
self.canReactToMessages = canReactToMessages
|
||||
self.canSendAudios = canSendAudios
|
||||
self.canSendBasicMessages = canSendBasicMessages
|
||||
self.canSendDocuments = canSendDocuments
|
||||
self.canSendOtherMessages = canSendOtherMessages
|
||||
self.canSendPhotos = canSendPhotos
|
||||
self.canSendPolls = canSendPolls
|
||||
self.canSendVideoNotes = canSendVideoNotes
|
||||
self.canSendVideos = canSendVideos
|
||||
self.canSendVoiceNotes = canSendVoiceNotes
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
//
|
||||
// ChatPhoto.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a chat or user profile photo
|
||||
public struct ChatPhoto: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Point in time (Unix timestamp) when the photo has been added
|
||||
public let addedDate: Int
|
||||
|
||||
/// A big (up to 1280x1280) animated variant of the photo in MPEG4 format; may be null
|
||||
public let animation: AnimatedChatPhoto?
|
||||
|
||||
/// Unique photo identifier
|
||||
public let id: TdInt64
|
||||
|
||||
/// Photo minithumbnail; may be null
|
||||
public let minithumbnail: Minithumbnail?
|
||||
|
||||
/// Available variants of the photo in JPEG format, in different size
|
||||
public let sizes: [PhotoSize]
|
||||
|
||||
/// A small (160x160) animated variant of the photo in MPEG4 format; may be null even if the big animation is available
|
||||
public let smallAnimation: AnimatedChatPhoto?
|
||||
|
||||
/// Sticker-based version of the chat photo; may be null
|
||||
public let sticker: ChatPhotoSticker?
|
||||
|
||||
|
||||
public init(
|
||||
addedDate: Int,
|
||||
animation: AnimatedChatPhoto?,
|
||||
id: TdInt64,
|
||||
minithumbnail: Minithumbnail?,
|
||||
sizes: [PhotoSize],
|
||||
smallAnimation: AnimatedChatPhoto?,
|
||||
sticker: ChatPhotoSticker?
|
||||
) {
|
||||
self.addedDate = addedDate
|
||||
self.animation = animation
|
||||
self.id = id
|
||||
self.minithumbnail = minithumbnail
|
||||
self.sizes = sizes
|
||||
self.smallAnimation = smallAnimation
|
||||
self.sticker = sticker
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// ChatPhotoInfo.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Contains basic information about the photo of a chat
|
||||
public struct ChatPhotoInfo: Codable, Equatable, Hashable {
|
||||
|
||||
/// A big (640x640) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed
|
||||
public let big: File
|
||||
|
||||
/// True, if the photo has animated variant
|
||||
public let hasAnimation: Bool
|
||||
|
||||
/// True, if the photo is visible only for the current user
|
||||
public let isPersonal: Bool
|
||||
|
||||
/// Chat photo minithumbnail; may be null
|
||||
public let minithumbnail: Minithumbnail?
|
||||
|
||||
/// A small (160x160) chat photo variant in JPEG format. The file can be downloaded only before the photo is changed
|
||||
public let small: File
|
||||
|
||||
|
||||
public init(
|
||||
big: File,
|
||||
hasAnimation: Bool,
|
||||
isPersonal: Bool,
|
||||
minithumbnail: Minithumbnail?,
|
||||
small: File
|
||||
) {
|
||||
self.big = big
|
||||
self.hasAnimation = hasAnimation
|
||||
self.isPersonal = isPersonal
|
||||
self.minithumbnail = minithumbnail
|
||||
self.small = small
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// ChatPhotoSticker.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Information about the sticker, which was used to create the chat photo. The sticker is shown at the center of the photo and occupies at most 67% of it
|
||||
public struct ChatPhotoSticker: Codable, Equatable, Hashable {
|
||||
|
||||
/// The fill to be used as background for the sticker; rotation angle in backgroundFillGradient isn't supported
|
||||
public let backgroundFill: BackgroundFill
|
||||
|
||||
/// Type of the sticker
|
||||
public let type: ChatPhotoStickerType
|
||||
|
||||
|
||||
public init(
|
||||
backgroundFill: BackgroundFill,
|
||||
type: ChatPhotoStickerType
|
||||
) {
|
||||
self.backgroundFill = backgroundFill
|
||||
self.type = type
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
//
|
||||
// ChatPhotoStickerType.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes type of sticker, which was used to create a chat photo
|
||||
public indirect enum ChatPhotoStickerType: Codable, Equatable, Hashable {
|
||||
|
||||
/// Information about the sticker, which was used to create the chat photo
|
||||
case chatPhotoStickerTypeRegularOrMask(ChatPhotoStickerTypeRegularOrMask)
|
||||
|
||||
/// Information about the custom emoji, which was used to create the chat photo
|
||||
case chatPhotoStickerTypeCustomEmoji(ChatPhotoStickerTypeCustomEmoji)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case chatPhotoStickerTypeRegularOrMask
|
||||
case chatPhotoStickerTypeCustomEmoji
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .chatPhotoStickerTypeRegularOrMask:
|
||||
let value = try ChatPhotoStickerTypeRegularOrMask(from: decoder)
|
||||
self = .chatPhotoStickerTypeRegularOrMask(value)
|
||||
case .chatPhotoStickerTypeCustomEmoji:
|
||||
let value = try ChatPhotoStickerTypeCustomEmoji(from: decoder)
|
||||
self = .chatPhotoStickerTypeCustomEmoji(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .chatPhotoStickerTypeRegularOrMask(let value):
|
||||
try container.encode(Kind.chatPhotoStickerTypeRegularOrMask, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .chatPhotoStickerTypeCustomEmoji(let value):
|
||||
try container.encode(Kind.chatPhotoStickerTypeCustomEmoji, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Information about the sticker, which was used to create the chat photo
|
||||
public struct ChatPhotoStickerTypeRegularOrMask: Codable, Equatable, Hashable {
|
||||
|
||||
/// Identifier of the sticker in the set
|
||||
public let stickerId: TdInt64
|
||||
|
||||
/// Sticker set identifier
|
||||
public let stickerSetId: TdInt64
|
||||
|
||||
|
||||
public init(
|
||||
stickerId: TdInt64,
|
||||
stickerSetId: TdInt64
|
||||
) {
|
||||
self.stickerId = stickerId
|
||||
self.stickerSetId = stickerSetId
|
||||
}
|
||||
}
|
||||
|
||||
/// Information about the custom emoji, which was used to create the chat photo
|
||||
public struct ChatPhotoStickerTypeCustomEmoji: Codable, Equatable, Hashable {
|
||||
|
||||
/// Identifier of the custom emoji
|
||||
public let customEmojiId: TdInt64
|
||||
|
||||
|
||||
public init(customEmojiId: TdInt64) {
|
||||
self.customEmojiId = customEmojiId
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// ChatPosition.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a position of a chat in a chat list
|
||||
public struct ChatPosition: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if the chat is pinned in the chat list
|
||||
public let isPinned: Bool
|
||||
|
||||
/// The chat list
|
||||
public let list: ChatList
|
||||
|
||||
/// A parameter used to determine order of the chat in the chat list. Chats must be sorted by the pair (order, chat.id) in descending order
|
||||
public let order: TdInt64
|
||||
|
||||
/// Source of the chat in the chat list; may be null
|
||||
public let source: ChatSource?
|
||||
|
||||
|
||||
public init(
|
||||
isPinned: Bool,
|
||||
list: ChatList,
|
||||
order: TdInt64,
|
||||
source: ChatSource?
|
||||
) {
|
||||
self.isPinned = isPinned
|
||||
self.list = list
|
||||
self.order = order
|
||||
self.source = source
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
//
|
||||
// ChatSource.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a reason why an external chat is shown in a chat list
|
||||
public indirect enum ChatSource: Codable, Equatable, Hashable {
|
||||
|
||||
/// The chat is sponsored by the user's MTProxy server
|
||||
case chatSourceMtprotoProxy
|
||||
|
||||
/// The chat contains a public service announcement
|
||||
case chatSourcePublicServiceAnnouncement(ChatSourcePublicServiceAnnouncement)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case chatSourceMtprotoProxy
|
||||
case chatSourcePublicServiceAnnouncement
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .chatSourceMtprotoProxy:
|
||||
self = .chatSourceMtprotoProxy
|
||||
case .chatSourcePublicServiceAnnouncement:
|
||||
let value = try ChatSourcePublicServiceAnnouncement(from: decoder)
|
||||
self = .chatSourcePublicServiceAnnouncement(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .chatSourceMtprotoProxy:
|
||||
try container.encode(Kind.chatSourceMtprotoProxy, forKey: .type)
|
||||
case .chatSourcePublicServiceAnnouncement(let value):
|
||||
try container.encode(Kind.chatSourcePublicServiceAnnouncement, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The chat contains a public service announcement
|
||||
public struct ChatSourcePublicServiceAnnouncement: Codable, Equatable, Hashable {
|
||||
|
||||
/// The text of the announcement
|
||||
public let text: String
|
||||
|
||||
/// The type of the announcement
|
||||
public let type: String
|
||||
|
||||
|
||||
public init(
|
||||
text: String,
|
||||
type: String
|
||||
) {
|
||||
self.text = text
|
||||
self.type = type
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
//
|
||||
// ChatTheme.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a chat theme
|
||||
public indirect enum ChatTheme: Codable, Equatable, Hashable {
|
||||
|
||||
/// A chat theme based on an emoji
|
||||
case chatThemeEmoji(ChatThemeEmoji)
|
||||
|
||||
/// A chat theme based on an upgraded gift
|
||||
case chatThemeGift(ChatThemeGift)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case chatThemeEmoji
|
||||
case chatThemeGift
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .chatThemeEmoji:
|
||||
let value = try ChatThemeEmoji(from: decoder)
|
||||
self = .chatThemeEmoji(value)
|
||||
case .chatThemeGift:
|
||||
let value = try ChatThemeGift(from: decoder)
|
||||
self = .chatThemeGift(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .chatThemeEmoji(let value):
|
||||
try container.encode(Kind.chatThemeEmoji, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .chatThemeGift(let value):
|
||||
try container.encode(Kind.chatThemeGift, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A chat theme based on an emoji
|
||||
public struct ChatThemeEmoji: Codable, Equatable, Hashable {
|
||||
|
||||
/// Name of the theme; full theme description is received through updateEmojiChatThemes
|
||||
public let name: String
|
||||
|
||||
|
||||
public init(name: String) {
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
|
||||
/// A chat theme based on an upgraded gift
|
||||
public struct ChatThemeGift: Codable, Equatable, Hashable {
|
||||
|
||||
/// The chat theme
|
||||
public let giftTheme: GiftChatTheme
|
||||
|
||||
|
||||
public init(giftTheme: GiftChatTheme) {
|
||||
self.giftTheme = giftTheme
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,143 @@
|
|||
//
|
||||
// ChatType.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes the type of chat
|
||||
public indirect enum ChatType: Codable, Equatable, Hashable {
|
||||
|
||||
/// An ordinary chat with a user
|
||||
case chatTypePrivate(ChatTypePrivate)
|
||||
|
||||
/// A basic group (a chat with 0-200 other users)
|
||||
case chatTypeBasicGroup(ChatTypeBasicGroup)
|
||||
|
||||
/// A supergroup or channel (with unlimited members)
|
||||
case chatTypeSupergroup(ChatTypeSupergroup)
|
||||
|
||||
/// A secret chat with a user
|
||||
case chatTypeSecret(ChatTypeSecret)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case chatTypePrivate
|
||||
case chatTypeBasicGroup
|
||||
case chatTypeSupergroup
|
||||
case chatTypeSecret
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .chatTypePrivate:
|
||||
let value = try ChatTypePrivate(from: decoder)
|
||||
self = .chatTypePrivate(value)
|
||||
case .chatTypeBasicGroup:
|
||||
let value = try ChatTypeBasicGroup(from: decoder)
|
||||
self = .chatTypeBasicGroup(value)
|
||||
case .chatTypeSupergroup:
|
||||
let value = try ChatTypeSupergroup(from: decoder)
|
||||
self = .chatTypeSupergroup(value)
|
||||
case .chatTypeSecret:
|
||||
let value = try ChatTypeSecret(from: decoder)
|
||||
self = .chatTypeSecret(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .chatTypePrivate(let value):
|
||||
try container.encode(Kind.chatTypePrivate, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .chatTypeBasicGroup(let value):
|
||||
try container.encode(Kind.chatTypeBasicGroup, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .chatTypeSupergroup(let value):
|
||||
try container.encode(Kind.chatTypeSupergroup, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .chatTypeSecret(let value):
|
||||
try container.encode(Kind.chatTypeSecret, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// An ordinary chat with a user
|
||||
public struct ChatTypePrivate: Codable, Equatable, Hashable {
|
||||
|
||||
/// User identifier
|
||||
public let userId: Int64
|
||||
|
||||
|
||||
public init(userId: Int64) {
|
||||
self.userId = userId
|
||||
}
|
||||
}
|
||||
|
||||
/// A basic group (a chat with 0-200 other users)
|
||||
public struct ChatTypeBasicGroup: Codable, Equatable, Hashable {
|
||||
|
||||
/// Basic group identifier
|
||||
public let basicGroupId: Int64
|
||||
|
||||
|
||||
public init(basicGroupId: Int64) {
|
||||
self.basicGroupId = basicGroupId
|
||||
}
|
||||
}
|
||||
|
||||
/// A supergroup or channel (with unlimited members)
|
||||
public struct ChatTypeSupergroup: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if the supergroup is a channel
|
||||
public let isChannel: Bool
|
||||
|
||||
/// Supergroup or channel identifier
|
||||
public let supergroupId: Int64
|
||||
|
||||
|
||||
public init(
|
||||
isChannel: Bool,
|
||||
supergroupId: Int64
|
||||
) {
|
||||
self.isChannel = isChannel
|
||||
self.supergroupId = supergroupId
|
||||
}
|
||||
}
|
||||
|
||||
/// A secret chat with a user
|
||||
public struct ChatTypeSecret: Codable, Equatable, Hashable {
|
||||
|
||||
/// Secret chat identifier
|
||||
public let secretChatId: Int
|
||||
|
||||
/// User identifier of the other user in the secret chat
|
||||
public let userId: Int64
|
||||
|
||||
|
||||
public init(
|
||||
secretChatId: Int,
|
||||
userId: Int64
|
||||
) {
|
||||
self.secretChatId = secretChatId
|
||||
self.userId = userId
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// CheckAuthenticationPassword.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Checks the 2-step verification password for correctness. Works only when the current authorization state is authorizationStateWaitPassword
|
||||
public struct CheckAuthenticationPassword: Codable, Equatable, Hashable {
|
||||
|
||||
/// The 2-step verification password to check
|
||||
public let password: String?
|
||||
|
||||
|
||||
public init(password: String?) {
|
||||
self.password = password
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// Checklist.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a checklist
|
||||
public struct Checklist: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if the current user can add tasks to the list if they have Telegram Premium subscription
|
||||
public let canAddTasks: Bool
|
||||
|
||||
/// True, if the current user can mark tasks as done or not done if they have Telegram Premium subscription
|
||||
public let canMarkTasksAsDone: Bool
|
||||
|
||||
/// True, if users other than creator of the list can add tasks to the list
|
||||
public let othersCanAddTasks: Bool
|
||||
|
||||
/// True, if users other than creator of the list can mark tasks as done or not done. If true, then the checklist is called "group checklist"
|
||||
public let othersCanMarkTasksAsDone: Bool
|
||||
|
||||
/// List of tasks in the checklist
|
||||
public let tasks: [ChecklistTask]
|
||||
|
||||
/// Title of the checklist; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, and DateTime entities
|
||||
public let title: FormattedText
|
||||
|
||||
|
||||
public init(
|
||||
canAddTasks: Bool,
|
||||
canMarkTasksAsDone: Bool,
|
||||
othersCanAddTasks: Bool,
|
||||
othersCanMarkTasksAsDone: Bool,
|
||||
tasks: [ChecklistTask],
|
||||
title: FormattedText
|
||||
) {
|
||||
self.canAddTasks = canAddTasks
|
||||
self.canMarkTasksAsDone = canMarkTasksAsDone
|
||||
self.othersCanAddTasks = othersCanAddTasks
|
||||
self.othersCanMarkTasksAsDone = othersCanMarkTasksAsDone
|
||||
self.tasks = tasks
|
||||
self.title = title
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// ChecklistTask.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a task in a checklist
|
||||
public struct ChecklistTask: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Identifier of the user or chat that completed the task; may be null if the task isn't completed yet
|
||||
public let completedBy: MessageSender?
|
||||
|
||||
/// Point in time (Unix timestamp) when the task was completed; 0 if the task isn't completed
|
||||
public let completionDate: Int
|
||||
|
||||
/// Unique identifier of the task
|
||||
public let id: Int
|
||||
|
||||
/// Text of the task; may contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, DateTime and automatically found entities
|
||||
public let text: FormattedText
|
||||
|
||||
|
||||
public init(
|
||||
completedBy: MessageSender?,
|
||||
completionDate: Int,
|
||||
id: Int,
|
||||
text: FormattedText
|
||||
) {
|
||||
self.completedBy = completedBy
|
||||
self.completionDate = completionDate
|
||||
self.id = id
|
||||
self.text = text
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// Close.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Closes the TDLib instance. All databases will be flushed to disk and properly closed. After the close completes, updateAuthorizationState with authorizationStateClosed will be sent. Can be called before initialization
|
||||
public struct Close: Codable, Equatable, Hashable {
|
||||
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// CloseChat.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Informs TDLib that the chat is closed by the user. Many useful activities depend on the chat being opened or closed
|
||||
public struct CloseChat: Codable, Equatable, Hashable {
|
||||
|
||||
/// Chat identifier
|
||||
public let chatId: Int64?
|
||||
|
||||
|
||||
public init(chatId: Int64?) {
|
||||
self.chatId = chatId
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// ClosedVectorPath.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Represents a closed vector path. The path begins at the end point of the last command. The coordinate system origin is in the upper-left corner
|
||||
public struct ClosedVectorPath: Codable, Equatable, Hashable {
|
||||
|
||||
/// List of vector path commands
|
||||
public let commands: [VectorPathCommand]
|
||||
|
||||
|
||||
public init(commands: [VectorPathCommand]) {
|
||||
self.commands = commands
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// Contact.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a contact of a user
|
||||
public struct Contact: Codable, Equatable, Hashable {
|
||||
|
||||
/// First name of the user; 1-64 characters
|
||||
public let firstName: String
|
||||
|
||||
/// Last name of the user; 0-64 characters
|
||||
public let lastName: String
|
||||
|
||||
/// Phone number of the user
|
||||
public let phoneNumber: String
|
||||
|
||||
/// Identifier of the user, if known; 0 otherwise
|
||||
public let userId: Int64
|
||||
|
||||
/// Additional data about the user in a form of vCard; 0-2048 bytes in length
|
||||
public let vcard: String
|
||||
|
||||
|
||||
public init(
|
||||
firstName: String,
|
||||
lastName: String,
|
||||
phoneNumber: String,
|
||||
userId: Int64,
|
||||
vcard: String
|
||||
) {
|
||||
self.firstName = firstName
|
||||
self.lastName = lastName
|
||||
self.phoneNumber = phoneNumber
|
||||
self.userId = userId
|
||||
self.vcard = vcard
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
//
|
||||
// DateTimeFormattingType.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes date and time formatting
|
||||
public indirect enum DateTimeFormattingType: Codable, Equatable, Hashable {
|
||||
|
||||
/// The time must be shown relative to the current time ([in ] X seconds, minutes, hours, days, months, years [ago])
|
||||
case dateTimeFormattingTypeRelative
|
||||
|
||||
/// The date and time must be shown as absolute timestamps
|
||||
case dateTimeFormattingTypeAbsolute(DateTimeFormattingTypeAbsolute)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case dateTimeFormattingTypeRelative
|
||||
case dateTimeFormattingTypeAbsolute
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .dateTimeFormattingTypeRelative:
|
||||
self = .dateTimeFormattingTypeRelative
|
||||
case .dateTimeFormattingTypeAbsolute:
|
||||
let value = try DateTimeFormattingTypeAbsolute(from: decoder)
|
||||
self = .dateTimeFormattingTypeAbsolute(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .dateTimeFormattingTypeRelative:
|
||||
try container.encode(Kind.dateTimeFormattingTypeRelative, forKey: .type)
|
||||
case .dateTimeFormattingTypeAbsolute(let value):
|
||||
try container.encode(Kind.dateTimeFormattingTypeAbsolute, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The date and time must be shown as absolute timestamps
|
||||
public struct DateTimeFormattingTypeAbsolute: Codable, Equatable, Hashable {
|
||||
|
||||
/// The precision with which the date is shown
|
||||
public let datePrecision: DateTimePartPrecision
|
||||
|
||||
/// True, if the day of week must be shown
|
||||
public let showDayOfWeek: Bool
|
||||
|
||||
/// The precision with which hours, minutes and seconds are shown
|
||||
public let timePrecision: DateTimePartPrecision
|
||||
|
||||
|
||||
public init(
|
||||
datePrecision: DateTimePartPrecision,
|
||||
showDayOfWeek: Bool,
|
||||
timePrecision: DateTimePartPrecision
|
||||
) {
|
||||
self.datePrecision = datePrecision
|
||||
self.showDayOfWeek = showDayOfWeek
|
||||
self.timePrecision = timePrecision
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
//
|
||||
// DateTimePartPrecision.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes precision with which to show a date or a time
|
||||
public indirect enum DateTimePartPrecision: Codable, Equatable, Hashable {
|
||||
|
||||
/// Don't show the date or time
|
||||
case dateTimePartPrecisionNone
|
||||
|
||||
/// Show the date or time in a short way (17.03.22 or 22:45)
|
||||
case dateTimePartPrecisionShort
|
||||
|
||||
/// Show the date or time in a long way (March 17, 2022 or 22:45:00)
|
||||
case dateTimePartPrecisionLong
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case dateTimePartPrecisionNone
|
||||
case dateTimePartPrecisionShort
|
||||
case dateTimePartPrecisionLong
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .dateTimePartPrecisionNone:
|
||||
self = .dateTimePartPrecisionNone
|
||||
case .dateTimePartPrecisionShort:
|
||||
self = .dateTimePartPrecisionShort
|
||||
case .dateTimePartPrecisionLong:
|
||||
self = .dateTimePartPrecisionLong
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .dateTimePartPrecisionNone:
|
||||
try container.encode(Kind.dateTimePartPrecisionNone, forKey: .type)
|
||||
case .dateTimePartPrecisionShort:
|
||||
try container.encode(Kind.dateTimePartPrecisionShort, forKey: .type)
|
||||
case .dateTimePartPrecisionLong:
|
||||
try container.encode(Kind.dateTimePartPrecisionLong, forKey: .type)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// Destroy.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// 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. Can be called before authorization
|
||||
public struct Destroy: Codable, Equatable, Hashable {
|
||||
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,107 @@
|
|||
//
|
||||
// DiceStickers.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Contains animated stickers which must be used for dice animation rendering
|
||||
public indirect enum DiceStickers: Codable, Equatable, Hashable {
|
||||
|
||||
/// A regular animated sticker
|
||||
case diceStickersRegular(DiceStickersRegular)
|
||||
|
||||
/// Animated stickers to be combined into a slot machine
|
||||
case diceStickersSlotMachine(DiceStickersSlotMachine)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case diceStickersRegular
|
||||
case diceStickersSlotMachine
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .diceStickersRegular:
|
||||
let value = try DiceStickersRegular(from: decoder)
|
||||
self = .diceStickersRegular(value)
|
||||
case .diceStickersSlotMachine:
|
||||
let value = try DiceStickersSlotMachine(from: decoder)
|
||||
self = .diceStickersSlotMachine(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .diceStickersRegular(let value):
|
||||
try container.encode(Kind.diceStickersRegular, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .diceStickersSlotMachine(let value):
|
||||
try container.encode(Kind.diceStickersSlotMachine, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A regular animated sticker
|
||||
public struct DiceStickersRegular: Codable, Equatable, Hashable {
|
||||
|
||||
/// The animated sticker with the dice animation
|
||||
public let sticker: Sticker
|
||||
|
||||
|
||||
public init(sticker: Sticker) {
|
||||
self.sticker = sticker
|
||||
}
|
||||
}
|
||||
|
||||
/// Animated stickers to be combined into a slot machine
|
||||
public struct DiceStickersSlotMachine: Codable, Equatable, Hashable {
|
||||
|
||||
/// The animated sticker with the slot machine background. The background animation must start playing after all reel animations finish
|
||||
public let background: Sticker
|
||||
|
||||
/// The animated sticker with the center reel
|
||||
public let centerReel: Sticker
|
||||
|
||||
/// The animated sticker with the left reel
|
||||
public let leftReel: Sticker
|
||||
|
||||
/// The animated sticker with the lever animation. The lever animation must play once in the initial dice state
|
||||
public let lever: Sticker
|
||||
|
||||
/// The animated sticker with the right reel
|
||||
public let rightReel: Sticker
|
||||
|
||||
|
||||
public init(
|
||||
background: Sticker,
|
||||
centerReel: Sticker,
|
||||
leftReel: Sticker,
|
||||
lever: Sticker,
|
||||
rightReel: Sticker
|
||||
) {
|
||||
self.background = background
|
||||
self.centerReel = centerReel
|
||||
self.leftReel = leftReel
|
||||
self.lever = lever
|
||||
self.rightReel = rightReel
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// Document.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a document of any type
|
||||
public struct Document: Codable, Equatable, Hashable {
|
||||
|
||||
/// File containing the document
|
||||
public let document: File
|
||||
|
||||
/// Original name of the file; as defined by the sender
|
||||
public let fileName: String
|
||||
|
||||
/// MIME type of the file; as defined by the sender
|
||||
public let mimeType: String
|
||||
|
||||
/// Document minithumbnail; may be null
|
||||
public let 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
|
||||
public let thumbnail: Thumbnail?
|
||||
|
||||
|
||||
public init(
|
||||
document: File,
|
||||
fileName: String,
|
||||
mimeType: String,
|
||||
minithumbnail: Minithumbnail?,
|
||||
thumbnail: Thumbnail?
|
||||
) {
|
||||
self.document = document
|
||||
self.fileName = fileName
|
||||
self.mimeType = mimeType
|
||||
self.minithumbnail = minithumbnail
|
||||
self.thumbnail = thumbnail
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// DownloadFile.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Downloads a file from the cloud. Download progress and completion of the download will be notified through updateFile updates
|
||||
public struct DownloadFile: Codable, Equatable, Hashable {
|
||||
|
||||
/// Identifier of the file to download
|
||||
public let fileId: Int?
|
||||
|
||||
/// Number of bytes which need to be downloaded starting from the "offset" position before the download will automatically be canceled; use 0 to download without a limit
|
||||
public let limit: Int64?
|
||||
|
||||
/// The starting position from which the file needs to be downloaded
|
||||
public let offset: Int64?
|
||||
|
||||
/// 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/addFileToDownloads was called will be downloaded first
|
||||
public let priority: Int?
|
||||
|
||||
/// Pass true to return response only after the file download has succeeded, has failed, has been canceled, or a new downloadFile request with different offset/limit parameters was sent; pass false to return file state immediately, just after the download has been started
|
||||
public let synchronous: Bool?
|
||||
|
||||
|
||||
public init(
|
||||
fileId: Int?,
|
||||
limit: Int64?,
|
||||
offset: Int64?,
|
||||
priority: Int?,
|
||||
synchronous: Bool?
|
||||
) {
|
||||
self.fileId = fileId
|
||||
self.limit = limit
|
||||
self.offset = offset
|
||||
self.priority = priority
|
||||
self.synchronous = synchronous
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// DraftMessage.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Contains information about a message draft
|
||||
public struct DraftMessage: Codable, Equatable, Hashable {
|
||||
|
||||
/// Point in time (Unix timestamp) when the draft was created
|
||||
public let date: Int
|
||||
|
||||
/// Identifier of the effect to apply to the message when it is sent; 0 if none
|
||||
public let effectId: TdInt64
|
||||
|
||||
/// Content of the message draft; must be of the type inputMessageText, inputMessageVideoNote, or inputMessageVoiceNote
|
||||
public let inputMessageText: InputMessageContent
|
||||
|
||||
/// Information about the message to be replied; inputMessageReplyToStory is unsupported; may be null if none
|
||||
public let replyTo: InputMessageReplyTo?
|
||||
|
||||
/// Information about the suggested post; may be null if none
|
||||
public let suggestedPostInfo: InputSuggestedPostInfo?
|
||||
|
||||
|
||||
public init(
|
||||
date: Int,
|
||||
effectId: TdInt64,
|
||||
inputMessageText: InputMessageContent,
|
||||
replyTo: InputMessageReplyTo?,
|
||||
suggestedPostInfo: InputSuggestedPostInfo?
|
||||
) {
|
||||
self.date = date
|
||||
self.effectId = effectId
|
||||
self.inputMessageText = inputMessageText
|
||||
self.replyTo = replyTo
|
||||
self.suggestedPostInfo = suggestedPostInfo
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// EmailAddressAuthenticationCodeInfo.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Information about the email address authentication code that was sent
|
||||
public struct EmailAddressAuthenticationCodeInfo: Codable, Equatable, Hashable {
|
||||
|
||||
/// Pattern of the email address to which an authentication code was sent
|
||||
public let emailAddressPattern: String
|
||||
|
||||
/// Length of the code; 0 if unknown
|
||||
public let length: Int
|
||||
|
||||
|
||||
public init(
|
||||
emailAddressPattern: String,
|
||||
length: Int
|
||||
) {
|
||||
self.emailAddressPattern = emailAddressPattern
|
||||
self.length = length
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
//
|
||||
// EmailAddressResetState.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes reset state of an email address
|
||||
public indirect enum EmailAddressResetState: Codable, Equatable, Hashable {
|
||||
|
||||
/// Email address can be reset after the given period. Call resetAuthenticationEmailAddress to reset it and allow the user to authorize with a code sent to the user's phone number
|
||||
case emailAddressResetStateAvailable(EmailAddressResetStateAvailable)
|
||||
|
||||
/// Email address reset has already been requested. Call resetAuthenticationEmailAddress to check whether immediate reset is possible
|
||||
case emailAddressResetStatePending(EmailAddressResetStatePending)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case emailAddressResetStateAvailable
|
||||
case emailAddressResetStatePending
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .emailAddressResetStateAvailable:
|
||||
let value = try EmailAddressResetStateAvailable(from: decoder)
|
||||
self = .emailAddressResetStateAvailable(value)
|
||||
case .emailAddressResetStatePending:
|
||||
let value = try EmailAddressResetStatePending(from: decoder)
|
||||
self = .emailAddressResetStatePending(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .emailAddressResetStateAvailable(let value):
|
||||
try container.encode(Kind.emailAddressResetStateAvailable, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .emailAddressResetStatePending(let value):
|
||||
try container.encode(Kind.emailAddressResetStatePending, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Email address can be reset after the given period. Call resetAuthenticationEmailAddress to reset it and allow the user to authorize with a code sent to the user's phone number
|
||||
public struct EmailAddressResetStateAvailable: Codable, Equatable, Hashable {
|
||||
|
||||
/// Time required to wait before the email address can be reset; 0 if the user is subscribed to Telegram Premium
|
||||
public let waitPeriod: Int
|
||||
|
||||
|
||||
public init(waitPeriod: Int) {
|
||||
self.waitPeriod = waitPeriod
|
||||
}
|
||||
}
|
||||
|
||||
/// Email address reset has already been requested. Call resetAuthenticationEmailAddress to check whether immediate reset is possible
|
||||
public struct EmailAddressResetStatePending: Codable, Equatable, Hashable {
|
||||
|
||||
/// Left time before the email address will be reset, in seconds. updateAuthorizationState is not sent when this field changes
|
||||
public let resetIn: Int
|
||||
|
||||
|
||||
public init(resetIn: Int) {
|
||||
self.resetIn = resetIn
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// EmojiStatus.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes an emoji to be shown instead of the Telegram Premium badge
|
||||
public struct EmojiStatus: Codable, Equatable, Hashable {
|
||||
|
||||
/// Point in time (Unix timestamp) when the status will expire; 0 if never
|
||||
public let expirationDate: Int
|
||||
|
||||
/// Type of the emoji status
|
||||
public let type: EmojiStatusType
|
||||
|
||||
|
||||
public init(
|
||||
expirationDate: Int,
|
||||
type: EmojiStatusType
|
||||
) {
|
||||
self.expirationDate = expirationDate
|
||||
self.type = type
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,112 @@
|
|||
//
|
||||
// EmojiStatusType.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes type of emoji status
|
||||
public indirect enum EmojiStatusType: Codable, Equatable, Hashable {
|
||||
|
||||
/// A custom emoji set as emoji status
|
||||
case emojiStatusTypeCustomEmoji(EmojiStatusTypeCustomEmoji)
|
||||
|
||||
/// An upgraded gift set as emoji status
|
||||
case emojiStatusTypeUpgradedGift(EmojiStatusTypeUpgradedGift)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case emojiStatusTypeCustomEmoji
|
||||
case emojiStatusTypeUpgradedGift
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .emojiStatusTypeCustomEmoji:
|
||||
let value = try EmojiStatusTypeCustomEmoji(from: decoder)
|
||||
self = .emojiStatusTypeCustomEmoji(value)
|
||||
case .emojiStatusTypeUpgradedGift:
|
||||
let value = try EmojiStatusTypeUpgradedGift(from: decoder)
|
||||
self = .emojiStatusTypeUpgradedGift(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .emojiStatusTypeCustomEmoji(let value):
|
||||
try container.encode(Kind.emojiStatusTypeCustomEmoji, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .emojiStatusTypeUpgradedGift(let value):
|
||||
try container.encode(Kind.emojiStatusTypeUpgradedGift, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A custom emoji set as emoji status
|
||||
public struct EmojiStatusTypeCustomEmoji: Codable, Equatable, Hashable {
|
||||
|
||||
/// Identifier of the custom emoji in stickerFormatTgs format
|
||||
public let customEmojiId: TdInt64
|
||||
|
||||
|
||||
public init(customEmojiId: TdInt64) {
|
||||
self.customEmojiId = customEmojiId
|
||||
}
|
||||
}
|
||||
|
||||
/// An upgraded gift set as emoji status
|
||||
public struct EmojiStatusTypeUpgradedGift: Codable, Equatable, Hashable {
|
||||
|
||||
/// Colors of the backdrop of the upgraded gift
|
||||
public let backdropColors: UpgradedGiftBackdropColors
|
||||
|
||||
/// Unique name of the upgraded gift that can be used with internalLinkTypeUpgradedGift
|
||||
public let giftName: String
|
||||
|
||||
/// The title of the upgraded gift
|
||||
public let giftTitle: String
|
||||
|
||||
/// Custom emoji identifier of the model of the upgraded gift
|
||||
public let modelCustomEmojiId: TdInt64
|
||||
|
||||
/// Custom emoji identifier of the symbol of the upgraded gift
|
||||
public let symbolCustomEmojiId: TdInt64
|
||||
|
||||
/// Identifier of the upgraded gift
|
||||
public let upgradedGiftId: TdInt64
|
||||
|
||||
|
||||
public init(
|
||||
backdropColors: UpgradedGiftBackdropColors,
|
||||
giftName: String,
|
||||
giftTitle: String,
|
||||
modelCustomEmojiId: TdInt64,
|
||||
symbolCustomEmojiId: TdInt64,
|
||||
upgradedGiftId: TdInt64
|
||||
) {
|
||||
self.backdropColors = backdropColors
|
||||
self.giftName = giftName
|
||||
self.giftTitle = giftTitle
|
||||
self.modelCustomEmojiId = modelCustomEmojiId
|
||||
self.symbolCustomEmojiId = symbolCustomEmojiId
|
||||
self.upgradedGiftId = upgradedGiftId
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// Emojis.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Represents a list of emojis
|
||||
public struct Emojis: Codable, Equatable, Hashable {
|
||||
|
||||
/// List of emojis
|
||||
public let emojis: [String]
|
||||
|
||||
|
||||
public init(emojis: [String]) {
|
||||
self.emojis = emojis
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// FactCheck.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a fact-check added to the message by an independent checker
|
||||
public struct FactCheck: Codable, Equatable, Hashable {
|
||||
|
||||
/// A two-letter ISO 3166-1 alpha-2 country code of the country for which the fact-check is shown
|
||||
public let countryCode: String
|
||||
|
||||
/// Text of the fact-check
|
||||
public let text: FormattedText
|
||||
|
||||
|
||||
public init(
|
||||
countryCode: String,
|
||||
text: FormattedText
|
||||
) {
|
||||
self.countryCode = countryCode
|
||||
self.text = text
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// File.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Represents a file
|
||||
public struct File: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Approximate file size in bytes in case the exact file size is unknown. Can be used to show download/upload progress
|
||||
public let expectedSize: Int64
|
||||
|
||||
/// Unique file identifier
|
||||
public let id: Int
|
||||
|
||||
/// Information about the local copy of the file
|
||||
public let local: LocalFile
|
||||
|
||||
/// Information about the remote copy of the file
|
||||
public let remote: RemoteFile
|
||||
|
||||
/// File size, in bytes; 0 if unknown
|
||||
public let size: Int64
|
||||
|
||||
|
||||
public init(
|
||||
expectedSize: Int64,
|
||||
id: Int,
|
||||
local: LocalFile,
|
||||
remote: RemoteFile,
|
||||
size: Int64
|
||||
) {
|
||||
self.expectedSize = expectedSize
|
||||
self.id = id
|
||||
self.local = local
|
||||
self.remote = remote
|
||||
self.size = size
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,92 @@
|
|||
//
|
||||
// FirebaseDeviceVerificationParameters.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes parameters to be used for device verification
|
||||
public indirect enum FirebaseDeviceVerificationParameters: Codable, Equatable, Hashable {
|
||||
|
||||
/// Device verification must be performed with the SafetyNet Attestation API
|
||||
case firebaseDeviceVerificationParametersSafetyNet(FirebaseDeviceVerificationParametersSafetyNet)
|
||||
|
||||
/// Device verification must be performed with the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic)
|
||||
case firebaseDeviceVerificationParametersPlayIntegrity(FirebaseDeviceVerificationParametersPlayIntegrity)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case firebaseDeviceVerificationParametersSafetyNet
|
||||
case firebaseDeviceVerificationParametersPlayIntegrity
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .firebaseDeviceVerificationParametersSafetyNet:
|
||||
let value = try FirebaseDeviceVerificationParametersSafetyNet(from: decoder)
|
||||
self = .firebaseDeviceVerificationParametersSafetyNet(value)
|
||||
case .firebaseDeviceVerificationParametersPlayIntegrity:
|
||||
let value = try FirebaseDeviceVerificationParametersPlayIntegrity(from: decoder)
|
||||
self = .firebaseDeviceVerificationParametersPlayIntegrity(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .firebaseDeviceVerificationParametersSafetyNet(let value):
|
||||
try container.encode(Kind.firebaseDeviceVerificationParametersSafetyNet, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .firebaseDeviceVerificationParametersPlayIntegrity(let value):
|
||||
try container.encode(Kind.firebaseDeviceVerificationParametersPlayIntegrity, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Device verification must be performed with the SafetyNet Attestation API
|
||||
public struct FirebaseDeviceVerificationParametersSafetyNet: Codable, Equatable, Hashable {
|
||||
|
||||
/// Nonce to pass to the SafetyNet Attestation API
|
||||
public let nonce: Data
|
||||
|
||||
|
||||
public init(nonce: Data) {
|
||||
self.nonce = nonce
|
||||
}
|
||||
}
|
||||
|
||||
/// Device verification must be performed with the classic Play Integrity verification (https://developer.android.com/google/play/integrity/classic)
|
||||
public struct FirebaseDeviceVerificationParametersPlayIntegrity: Codable, Equatable, Hashable {
|
||||
|
||||
/// Cloud project number to pass to the Play Integrity API
|
||||
public let cloudProjectNumber: TdInt64
|
||||
|
||||
/// Base64url-encoded nonce to pass to the Play Integrity API
|
||||
public let nonce: String
|
||||
|
||||
|
||||
public init(
|
||||
cloudProjectNumber: TdInt64,
|
||||
nonce: String
|
||||
) {
|
||||
self.cloudProjectNumber = cloudProjectNumber
|
||||
self.nonce = nonce
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// FormattedText.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// A text with some entities
|
||||
public struct FormattedText: Codable, Equatable, Hashable {
|
||||
|
||||
/// Entities contained in the text. Entities can be nested, but must not mutually intersect with each other. Pre, Code, PreCode, and DateTime entities can't contain other entities. BlockQuote entities can't contain other BlockQuote entities. Bold, Italic, Underline, Strikethrough, and Spoiler entities can contain and can be part of any other entities. All other entities can't contain each other
|
||||
public let entities: [TextEntity]
|
||||
|
||||
/// The text
|
||||
public let text: String
|
||||
|
||||
|
||||
public init(
|
||||
entities: [TextEntity],
|
||||
text: String
|
||||
) {
|
||||
self.entities = entities
|
||||
self.text = text
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// ForumTopicIcon.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a forum topic icon
|
||||
public struct ForumTopicIcon: Codable, Equatable, Hashable {
|
||||
|
||||
/// Color of the topic icon in RGB format
|
||||
public let color: Int
|
||||
|
||||
/// Unique identifier of the custom emoji shown on the topic icon; 0 if none
|
||||
public let customEmojiId: TdInt64
|
||||
|
||||
|
||||
public init(
|
||||
color: Int,
|
||||
customEmojiId: TdInt64
|
||||
) {
|
||||
self.color = color
|
||||
self.customEmojiId = customEmojiId
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// ForwardSource.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Contains information about the last message from which a new message was forwarded last time
|
||||
public struct ForwardSource: Codable, Equatable, Hashable {
|
||||
|
||||
/// Identifier of the chat to which the message that was forwarded belonged; may be 0 if unknown
|
||||
public let chatId: Int64
|
||||
|
||||
/// Point in time (Unix timestamp) when the message is sent; 0 if unknown
|
||||
public let date: Int
|
||||
|
||||
/// True, if the message that was forwarded is outgoing; always false if sender is unknown
|
||||
public let isOutgoing: Bool
|
||||
|
||||
/// Identifier of the message; may be 0 if unknown
|
||||
public let messageId: Int64
|
||||
|
||||
/// Identifier of the sender of the message; may be null if unknown or the new message was forwarded not to Saved Messages
|
||||
public let senderId: MessageSender?
|
||||
|
||||
/// Name of the sender of the message if the sender is hidden by their privacy settings
|
||||
public let senderName: String
|
||||
|
||||
|
||||
public init(
|
||||
chatId: Int64,
|
||||
date: Int,
|
||||
isOutgoing: Bool,
|
||||
messageId: Int64,
|
||||
senderId: MessageSender?,
|
||||
senderName: String
|
||||
) {
|
||||
self.chatId = chatId
|
||||
self.date = date
|
||||
self.isOutgoing = isOutgoing
|
||||
self.messageId = messageId
|
||||
self.senderId = senderId
|
||||
self.senderName = senderName
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
//
|
||||
// Game.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a game. Use getInternalLink with internalLinkTypeGame to share the game
|
||||
public struct Game: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Game animation; may be null
|
||||
public let animation: Animation?
|
||||
|
||||
public let description: String
|
||||
|
||||
/// Unique game identifier
|
||||
public let id: TdInt64
|
||||
|
||||
/// Game photo
|
||||
public let photo: Photo
|
||||
|
||||
/// Game short name
|
||||
public let shortName: String
|
||||
|
||||
/// Game text, usually containing scoreboards for a game
|
||||
public let text: FormattedText
|
||||
|
||||
/// Game title
|
||||
public let title: String
|
||||
|
||||
|
||||
public init(
|
||||
animation: Animation?,
|
||||
description: String,
|
||||
id: TdInt64,
|
||||
photo: Photo,
|
||||
shortName: String,
|
||||
text: FormattedText,
|
||||
title: String
|
||||
) {
|
||||
self.animation = animation
|
||||
self.description = description
|
||||
self.id = id
|
||||
self.photo = photo
|
||||
self.shortName = shortName
|
||||
self.text = text
|
||||
self.title = title
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
//
|
||||
// GetChatHistory.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Returns messages in a chat. The messages are returned in reverse chronological order (i.e., in order of decreasing message_id). For optimal performance, the number of returned messages is chosen by TDLib. This is an offline method if only_local is true
|
||||
public struct GetChatHistory: Codable, Equatable, Hashable {
|
||||
|
||||
/// Chat identifier
|
||||
public let chatId: Int64?
|
||||
|
||||
/// Identifier of the message starting from which history must be fetched; use 0 to get results from the last message
|
||||
public let fromMessageId: Int64?
|
||||
|
||||
/// The maximum number of messages to be returned; must be positive and can't be greater than 100. If the offset is negative, then the limit must be greater than or equal to -offset. For optimal performance, the number of returned messages is chosen by TDLib and can be smaller than the specified limit
|
||||
public let limit: Int?
|
||||
|
||||
/// Specify 0 to get results from exactly the message from_message_id or a negative number from -99 to -1 to get additionally -offset newer messages
|
||||
public let offset: Int?
|
||||
|
||||
/// Pass true to get only messages that are available without sending network requests
|
||||
public let onlyLocal: Bool?
|
||||
|
||||
|
||||
public init(
|
||||
chatId: Int64?,
|
||||
fromMessageId: Int64?,
|
||||
limit: Int?,
|
||||
offset: Int?,
|
||||
onlyLocal: Bool?
|
||||
) {
|
||||
self.chatId = chatId
|
||||
self.fromMessageId = fromMessageId
|
||||
self.limit = limit
|
||||
self.offset = offset
|
||||
self.onlyLocal = onlyLocal
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// GetFavoriteStickers.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Returns favorite stickers
|
||||
public struct GetFavoriteStickers: Codable, Equatable, Hashable {
|
||||
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// GetInstalledStickerSets.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Returns a list of installed sticker sets
|
||||
public struct GetInstalledStickerSets: Codable, Equatable, Hashable {
|
||||
|
||||
/// Type of the sticker sets to return
|
||||
public let stickerType: StickerType?
|
||||
|
||||
|
||||
public init(stickerType: StickerType?) {
|
||||
self.stickerType = stickerType
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
//
|
||||
// GetMe.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Returns the current user
|
||||
public struct GetMe: Codable, Equatable, Hashable {
|
||||
|
||||
|
||||
public init() {}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// GetOption.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// 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. Can be called synchronously for options "version" and "commit_hash"
|
||||
public struct GetOption: Codable, Equatable, Hashable {
|
||||
|
||||
/// The name of the option
|
||||
public let name: String?
|
||||
|
||||
|
||||
public init(name: String?) {
|
||||
self.name = name
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// GetRecentStickers.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Returns a list of recently used stickers
|
||||
public struct GetRecentStickers: Codable, Equatable, Hashable {
|
||||
|
||||
/// Pass true to return stickers and masks that were recently attached to photos or video files; pass false to return recently sent stickers
|
||||
public let isAttached: Bool?
|
||||
|
||||
|
||||
public init(isAttached: Bool?) {
|
||||
self.isAttached = isAttached
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
//
|
||||
// GetStickerSet.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Returns information about a sticker set by its identifier
|
||||
public struct GetStickerSet: Codable, Equatable, Hashable {
|
||||
|
||||
/// Identifier of the sticker set
|
||||
public let setId: TdInt64?
|
||||
|
||||
|
||||
public init(setId: TdInt64?) {
|
||||
self.setId = setId
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,106 @@
|
|||
//
|
||||
// Gift.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a gift that can be sent to another user or channel chat
|
||||
public struct Gift: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Information about the auction on which the gift can be purchased; may be null if the gift can be purchased directly
|
||||
public let auctionInfo: GiftAuction?
|
||||
|
||||
/// Background of the gift
|
||||
public let background: GiftBackground
|
||||
|
||||
/// Number of Telegram Stars that can be claimed by the receiver instead of the regular gift by default. If the gift was paid with just bought Telegram Stars, then full value can be claimed
|
||||
public let defaultSellStarCount: Int64
|
||||
|
||||
/// Point in time (Unix timestamp) when the gift was send for the first time; for sold out gifts only
|
||||
public let firstSendDate: Int
|
||||
|
||||
/// True, if the gift can be used to customize the user's name, and backgrounds of profile photo, reply header, and link preview
|
||||
public let hasColors: Bool
|
||||
|
||||
/// Unique identifier of the gift
|
||||
public let id: TdInt64
|
||||
|
||||
/// True, if the gift is a birthday gift
|
||||
public let isForBirthday: Bool
|
||||
|
||||
/// True, if the gift can be bought only by Telegram Premium subscribers
|
||||
public let isPremium: Bool
|
||||
|
||||
/// Point in time (Unix timestamp) when the gift was send for the last time; for sold out gifts only
|
||||
public let lastSendDate: Int
|
||||
|
||||
/// Point in time (Unix timestamp) when the gift can be sent next time by the current user; may be 0 or a date in the past. If the date is in the future, then call canSendGift to get the reason, why the gift can't be sent now
|
||||
public let nextSendDate: Int
|
||||
|
||||
/// Number of times the gift can be purchased all users; may be null if not limited
|
||||
public let overallLimits: GiftPurchaseLimits?
|
||||
|
||||
/// Identifier of the chat that published the gift; 0 if none
|
||||
public let publisherChatId: Int64
|
||||
|
||||
/// Number of Telegram Stars that must be paid for the gift
|
||||
public let starCount: Int64
|
||||
|
||||
/// The sticker representing the gift
|
||||
public let sticker: Sticker
|
||||
|
||||
/// Number of Telegram Stars that must be paid to upgrade the gift; 0 if upgrade isn't possible
|
||||
public let upgradeStarCount: Int64
|
||||
|
||||
/// Number of unique gift variants that are available for the upgraded gift; 0 if unknown
|
||||
public let upgradeVariantCount: Int
|
||||
|
||||
/// Number of times the gift can be purchased by the current user; may be null if not limited
|
||||
public let userLimits: GiftPurchaseLimits?
|
||||
|
||||
|
||||
public init(
|
||||
auctionInfo: GiftAuction?,
|
||||
background: GiftBackground,
|
||||
defaultSellStarCount: Int64,
|
||||
firstSendDate: Int,
|
||||
hasColors: Bool,
|
||||
id: TdInt64,
|
||||
isForBirthday: Bool,
|
||||
isPremium: Bool,
|
||||
lastSendDate: Int,
|
||||
nextSendDate: Int,
|
||||
overallLimits: GiftPurchaseLimits?,
|
||||
publisherChatId: Int64,
|
||||
starCount: Int64,
|
||||
sticker: Sticker,
|
||||
upgradeStarCount: Int64,
|
||||
upgradeVariantCount: Int,
|
||||
userLimits: GiftPurchaseLimits?
|
||||
) {
|
||||
self.auctionInfo = auctionInfo
|
||||
self.background = background
|
||||
self.defaultSellStarCount = defaultSellStarCount
|
||||
self.firstSendDate = firstSendDate
|
||||
self.hasColors = hasColors
|
||||
self.id = id
|
||||
self.isForBirthday = isForBirthday
|
||||
self.isPremium = isPremium
|
||||
self.lastSendDate = lastSendDate
|
||||
self.nextSendDate = nextSendDate
|
||||
self.overallLimits = overallLimits
|
||||
self.publisherChatId = publisherChatId
|
||||
self.starCount = starCount
|
||||
self.sticker = sticker
|
||||
self.upgradeStarCount = upgradeStarCount
|
||||
self.upgradeVariantCount = upgradeVariantCount
|
||||
self.userLimits = userLimits
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// GiftAuction.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes an auction on which a gift can be purchased
|
||||
public struct GiftAuction: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Number of gifts distributed in each round
|
||||
public let giftsPerRound: Int
|
||||
|
||||
/// Identifier of the auction
|
||||
public let id: String
|
||||
|
||||
/// Point in time (Unix timestamp) when the auction will start
|
||||
public let startDate: Int
|
||||
|
||||
|
||||
public init(
|
||||
giftsPerRound: Int,
|
||||
id: String,
|
||||
startDate: Int
|
||||
) {
|
||||
self.giftsPerRound = giftsPerRound
|
||||
self.id = id
|
||||
self.startDate = startDate
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// GiftBackground.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes background of a gift
|
||||
public struct GiftBackground: Codable, Equatable, Hashable {
|
||||
|
||||
/// Center color in RGB format
|
||||
public let centerColor: Int
|
||||
|
||||
/// Edge color in RGB format
|
||||
public let edgeColor: Int
|
||||
|
||||
/// Text color in RGB format
|
||||
public let textColor: Int
|
||||
|
||||
|
||||
public init(
|
||||
centerColor: Int,
|
||||
edgeColor: Int,
|
||||
textColor: Int
|
||||
) {
|
||||
self.centerColor = centerColor
|
||||
self.edgeColor = edgeColor
|
||||
self.textColor = textColor
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// GiftChatTheme.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a chat theme based on an upgraded gift
|
||||
public struct GiftChatTheme: Codable, Equatable, Hashable {
|
||||
|
||||
/// Theme settings for a dark chat theme
|
||||
public let darkSettings: ThemeSettings
|
||||
|
||||
/// The gift
|
||||
public let gift: UpgradedGift
|
||||
|
||||
/// Theme settings for a light chat theme
|
||||
public let lightSettings: ThemeSettings
|
||||
|
||||
|
||||
public init(
|
||||
darkSettings: ThemeSettings,
|
||||
gift: UpgradedGift,
|
||||
lightSettings: ThemeSettings
|
||||
) {
|
||||
self.darkSettings = darkSettings
|
||||
self.gift = gift
|
||||
self.lightSettings = lightSettings
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// GiftPurchaseLimits.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes the maximum number of times that a specific gift can be purchased
|
||||
public struct GiftPurchaseLimits: Codable, Equatable, Hashable {
|
||||
|
||||
/// Number of remaining times the gift can be purchased
|
||||
public let remainingCount: Int
|
||||
|
||||
/// The maximum number of times the gifts can be purchased
|
||||
public let totalCount: Int
|
||||
|
||||
|
||||
public init(
|
||||
remainingCount: Int,
|
||||
totalCount: Int
|
||||
) {
|
||||
self.remainingCount = remainingCount
|
||||
self.totalCount = totalCount
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
//
|
||||
// GiftPurchaseOfferState.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes state of a gift purchase offer
|
||||
public indirect enum GiftPurchaseOfferState: Codable, Equatable, Hashable {
|
||||
|
||||
/// The offer must be accepted or rejected
|
||||
case giftPurchaseOfferStatePending
|
||||
|
||||
/// The offer was accepted
|
||||
case giftPurchaseOfferStateAccepted
|
||||
|
||||
/// The offer was rejected
|
||||
case giftPurchaseOfferStateRejected
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case giftPurchaseOfferStatePending
|
||||
case giftPurchaseOfferStateAccepted
|
||||
case giftPurchaseOfferStateRejected
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .giftPurchaseOfferStatePending:
|
||||
self = .giftPurchaseOfferStatePending
|
||||
case .giftPurchaseOfferStateAccepted:
|
||||
self = .giftPurchaseOfferStateAccepted
|
||||
case .giftPurchaseOfferStateRejected:
|
||||
self = .giftPurchaseOfferStateRejected
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .giftPurchaseOfferStatePending:
|
||||
try container.encode(Kind.giftPurchaseOfferStatePending, forKey: .type)
|
||||
case .giftPurchaseOfferStateAccepted:
|
||||
try container.encode(Kind.giftPurchaseOfferStateAccepted, forKey: .type)
|
||||
case .giftPurchaseOfferStateRejected:
|
||||
try container.encode(Kind.giftPurchaseOfferStateRejected, forKey: .type)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
//
|
||||
// GiftResaleParameters.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes parameters of a unique gift available for resale
|
||||
public struct GiftResaleParameters: Codable, Equatable, Hashable {
|
||||
|
||||
/// Resale price of the gift in Telegram Stars
|
||||
public let starCount: Int64
|
||||
|
||||
/// Resale price of the gift in 1/100 of Toncoin
|
||||
public let toncoinCentCount: Int64
|
||||
|
||||
/// True, if the gift can be bought only using Toncoins
|
||||
public let toncoinOnly: Bool
|
||||
|
||||
|
||||
public init(
|
||||
starCount: Int64,
|
||||
toncoinCentCount: Int64,
|
||||
toncoinOnly: Bool
|
||||
) {
|
||||
self.starCount = starCount
|
||||
self.toncoinCentCount = toncoinCentCount
|
||||
self.toncoinOnly = toncoinOnly
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
//
|
||||
// GiftResalePrice.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes price of a resold gift
|
||||
public indirect enum GiftResalePrice: Codable, Equatable, Hashable {
|
||||
|
||||
/// Describes price of a resold gift in Telegram Stars
|
||||
case giftResalePriceStar(GiftResalePriceStar)
|
||||
|
||||
/// Describes price of a resold gift in Toncoins
|
||||
case giftResalePriceTon(GiftResalePriceTon)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case giftResalePriceStar
|
||||
case giftResalePriceTon
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .giftResalePriceStar:
|
||||
let value = try GiftResalePriceStar(from: decoder)
|
||||
self = .giftResalePriceStar(value)
|
||||
case .giftResalePriceTon:
|
||||
let value = try GiftResalePriceTon(from: decoder)
|
||||
self = .giftResalePriceTon(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .giftResalePriceStar(let value):
|
||||
try container.encode(Kind.giftResalePriceStar, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .giftResalePriceTon(let value):
|
||||
try container.encode(Kind.giftResalePriceTon, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes price of a resold gift in Telegram Stars
|
||||
public struct GiftResalePriceStar: Codable, Equatable, Hashable {
|
||||
|
||||
/// The Telegram Star amount expected to be paid for the gift. Must be in the range getOption("gift_resale_star_count_min")-getOption("gift_resale_star_count_max") for gifts put for resale
|
||||
public let starCount: Int64
|
||||
|
||||
|
||||
public init(starCount: Int64) {
|
||||
self.starCount = starCount
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes price of a resold gift in Toncoins
|
||||
public struct GiftResalePriceTon: Codable, Equatable, Hashable {
|
||||
|
||||
/// The amount of 1/100 of Toncoin expected to be paid for the gift. Must be in the range getOption("gift_resale_toncoin_cent_count_min")-getOption("gift_resale_toncoin_cent_count_max")
|
||||
public let toncoinCentCount: Int64
|
||||
|
||||
|
||||
public init(toncoinCentCount: Int64) {
|
||||
self.toncoinCentCount = toncoinCentCount
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
//
|
||||
// GiveawayParameters.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes parameters of a giveaway
|
||||
public struct GiveawayParameters: Codable, Equatable, Hashable {
|
||||
|
||||
/// Identifiers of other supergroup or channel chats that must be subscribed by the users to be eligible for the giveaway. There can be up to getOption("giveaway_additional_chat_count_max") additional chats
|
||||
public let additionalChatIds: [Int64]
|
||||
|
||||
/// Identifier of the supergroup or channel chat, which will be automatically boosted by the winners of the giveaway for duration of the Telegram Premium subscription, or for the specified time. If the chat is a channel, then can_post_messages administrator right is required in the channel, otherwise, the user must be an administrator in the supergroup
|
||||
public let boostedChatId: Int64
|
||||
|
||||
/// The list of two-letter ISO 3166-1 alpha-2 codes of countries, users from which will be eligible for the giveaway. If empty, then all users can participate in the giveaway. There can be up to getOption("giveaway_country_count_max") chosen countries. Users with phone number that was bought at https://fragment.com can participate in any giveaway and the country code "FT" must not be specified in the list
|
||||
public let countryCodes: [String]
|
||||
|
||||
/// True, if the list of winners of the giveaway will be available to everyone
|
||||
public let hasPublicWinners: Bool
|
||||
|
||||
/// True, if only new members of the chats will be eligible for the giveaway
|
||||
public let onlyNewMembers: Bool
|
||||
|
||||
/// Additional description of the giveaway prize; 0-128 characters
|
||||
public let prizeDescription: String
|
||||
|
||||
/// Point in time (Unix timestamp) when the giveaway is expected to be performed; must be 60-getOption("giveaway_duration_max") seconds in the future in scheduled giveaways
|
||||
public let winnersSelectionDate: Int
|
||||
|
||||
|
||||
public init(
|
||||
additionalChatIds: [Int64],
|
||||
boostedChatId: Int64,
|
||||
countryCodes: [String],
|
||||
hasPublicWinners: Bool,
|
||||
onlyNewMembers: Bool,
|
||||
prizeDescription: String,
|
||||
winnersSelectionDate: Int
|
||||
) {
|
||||
self.additionalChatIds = additionalChatIds
|
||||
self.boostedChatId = boostedChatId
|
||||
self.countryCodes = countryCodes
|
||||
self.hasPublicWinners = hasPublicWinners
|
||||
self.onlyNewMembers = onlyNewMembers
|
||||
self.prizeDescription = prizeDescription
|
||||
self.winnersSelectionDate = winnersSelectionDate
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
//
|
||||
// GiveawayPrize.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Contains information about a giveaway prize
|
||||
public indirect enum GiveawayPrize: Codable, Equatable, Hashable {
|
||||
|
||||
/// The giveaway sends Telegram Premium subscriptions to the winners
|
||||
case giveawayPrizePremium(GiveawayPrizePremium)
|
||||
|
||||
/// The giveaway sends Telegram Stars to the winners
|
||||
case giveawayPrizeStars(GiveawayPrizeStars)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case giveawayPrizePremium
|
||||
case giveawayPrizeStars
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .giveawayPrizePremium:
|
||||
let value = try GiveawayPrizePremium(from: decoder)
|
||||
self = .giveawayPrizePremium(value)
|
||||
case .giveawayPrizeStars:
|
||||
let value = try GiveawayPrizeStars(from: decoder)
|
||||
self = .giveawayPrizeStars(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .giveawayPrizePremium(let value):
|
||||
try container.encode(Kind.giveawayPrizePremium, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .giveawayPrizeStars(let value):
|
||||
try container.encode(Kind.giveawayPrizeStars, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The giveaway sends Telegram Premium subscriptions to the winners
|
||||
public struct GiveawayPrizePremium: Codable, Equatable, Hashable {
|
||||
|
||||
/// Number of months the Telegram Premium subscription will be active after code activation
|
||||
public let monthCount: Int
|
||||
|
||||
|
||||
public init(monthCount: Int) {
|
||||
self.monthCount = monthCount
|
||||
}
|
||||
}
|
||||
|
||||
/// The giveaway sends Telegram Stars to the winners
|
||||
public struct GiveawayPrizeStars: Codable, Equatable, Hashable {
|
||||
|
||||
/// Number of Telegram Stars that will be shared by all winners
|
||||
public let starCount: Int64
|
||||
|
||||
|
||||
public init(starCount: Int64) {
|
||||
self.starCount = starCount
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// InlineKeyboardButton.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Represents a single button in an inline keyboard
|
||||
public struct InlineKeyboardButton: Codable, Equatable, Hashable {
|
||||
|
||||
/// Identifier of the custom emoji that must be shown on the button; 0 if none
|
||||
public let iconCustomEmojiId: TdInt64
|
||||
|
||||
/// Style of the button
|
||||
public let style: ButtonStyle
|
||||
|
||||
/// Text of the button
|
||||
public let text: String
|
||||
|
||||
/// Type of the button
|
||||
public let type: InlineKeyboardButtonType
|
||||
|
||||
|
||||
public init(
|
||||
iconCustomEmojiId: TdInt64,
|
||||
style: ButtonStyle,
|
||||
text: String,
|
||||
type: InlineKeyboardButtonType
|
||||
) {
|
||||
self.iconCustomEmojiId = iconCustomEmojiId
|
||||
self.style = style
|
||||
self.text = text
|
||||
self.type = type
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,252 @@
|
|||
//
|
||||
// InlineKeyboardButtonType.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes the type of inline keyboard button
|
||||
public indirect enum InlineKeyboardButtonType: Codable, Equatable, Hashable {
|
||||
|
||||
/// A button that opens a specified URL
|
||||
case inlineKeyboardButtonTypeUrl(InlineKeyboardButtonTypeUrl)
|
||||
|
||||
/// A button that opens a specified URL and automatically authorize the current user by calling getLoginUrlInfo
|
||||
case inlineKeyboardButtonTypeLoginUrl(InlineKeyboardButtonTypeLoginUrl)
|
||||
|
||||
/// A button that opens a Web App by calling openWebApp
|
||||
case inlineKeyboardButtonTypeWebApp(InlineKeyboardButtonTypeWebApp)
|
||||
|
||||
/// A button that sends a callback query to a bot
|
||||
case inlineKeyboardButtonTypeCallback(InlineKeyboardButtonTypeCallback)
|
||||
|
||||
/// A button that asks for the 2-step verification password of the current user and then sends a callback query to a bot
|
||||
case inlineKeyboardButtonTypeCallbackWithPassword(InlineKeyboardButtonTypeCallbackWithPassword)
|
||||
|
||||
/// A button with a game that sends a callback query to a bot. This button must be in the first column and row of the keyboard and can be attached only to a message with content of the type messageGame
|
||||
case inlineKeyboardButtonTypeCallbackGame
|
||||
|
||||
/// A button that forces an inline query to the bot to be inserted in the input field
|
||||
case inlineKeyboardButtonTypeSwitchInline(InlineKeyboardButtonTypeSwitchInline)
|
||||
|
||||
/// 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
|
||||
case inlineKeyboardButtonTypeBuy
|
||||
|
||||
/// A button with a user reference to be handled in the same way as textEntityTypeMentionName entities
|
||||
case inlineKeyboardButtonTypeUser(InlineKeyboardButtonTypeUser)
|
||||
|
||||
/// A button that copies specified text to clipboard
|
||||
case inlineKeyboardButtonTypeCopyText(InlineKeyboardButtonTypeCopyText)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case inlineKeyboardButtonTypeUrl
|
||||
case inlineKeyboardButtonTypeLoginUrl
|
||||
case inlineKeyboardButtonTypeWebApp
|
||||
case inlineKeyboardButtonTypeCallback
|
||||
case inlineKeyboardButtonTypeCallbackWithPassword
|
||||
case inlineKeyboardButtonTypeCallbackGame
|
||||
case inlineKeyboardButtonTypeSwitchInline
|
||||
case inlineKeyboardButtonTypeBuy
|
||||
case inlineKeyboardButtonTypeUser
|
||||
case inlineKeyboardButtonTypeCopyText
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .inlineKeyboardButtonTypeUrl:
|
||||
let value = try InlineKeyboardButtonTypeUrl(from: decoder)
|
||||
self = .inlineKeyboardButtonTypeUrl(value)
|
||||
case .inlineKeyboardButtonTypeLoginUrl:
|
||||
let value = try InlineKeyboardButtonTypeLoginUrl(from: decoder)
|
||||
self = .inlineKeyboardButtonTypeLoginUrl(value)
|
||||
case .inlineKeyboardButtonTypeWebApp:
|
||||
let value = try InlineKeyboardButtonTypeWebApp(from: decoder)
|
||||
self = .inlineKeyboardButtonTypeWebApp(value)
|
||||
case .inlineKeyboardButtonTypeCallback:
|
||||
let value = try InlineKeyboardButtonTypeCallback(from: decoder)
|
||||
self = .inlineKeyboardButtonTypeCallback(value)
|
||||
case .inlineKeyboardButtonTypeCallbackWithPassword:
|
||||
let value = try InlineKeyboardButtonTypeCallbackWithPassword(from: decoder)
|
||||
self = .inlineKeyboardButtonTypeCallbackWithPassword(value)
|
||||
case .inlineKeyboardButtonTypeCallbackGame:
|
||||
self = .inlineKeyboardButtonTypeCallbackGame
|
||||
case .inlineKeyboardButtonTypeSwitchInline:
|
||||
let value = try InlineKeyboardButtonTypeSwitchInline(from: decoder)
|
||||
self = .inlineKeyboardButtonTypeSwitchInline(value)
|
||||
case .inlineKeyboardButtonTypeBuy:
|
||||
self = .inlineKeyboardButtonTypeBuy
|
||||
case .inlineKeyboardButtonTypeUser:
|
||||
let value = try InlineKeyboardButtonTypeUser(from: decoder)
|
||||
self = .inlineKeyboardButtonTypeUser(value)
|
||||
case .inlineKeyboardButtonTypeCopyText:
|
||||
let value = try InlineKeyboardButtonTypeCopyText(from: decoder)
|
||||
self = .inlineKeyboardButtonTypeCopyText(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .inlineKeyboardButtonTypeUrl(let value):
|
||||
try container.encode(Kind.inlineKeyboardButtonTypeUrl, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inlineKeyboardButtonTypeLoginUrl(let value):
|
||||
try container.encode(Kind.inlineKeyboardButtonTypeLoginUrl, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inlineKeyboardButtonTypeWebApp(let value):
|
||||
try container.encode(Kind.inlineKeyboardButtonTypeWebApp, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inlineKeyboardButtonTypeCallback(let value):
|
||||
try container.encode(Kind.inlineKeyboardButtonTypeCallback, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inlineKeyboardButtonTypeCallbackWithPassword(let value):
|
||||
try container.encode(Kind.inlineKeyboardButtonTypeCallbackWithPassword, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inlineKeyboardButtonTypeCallbackGame:
|
||||
try container.encode(Kind.inlineKeyboardButtonTypeCallbackGame, forKey: .type)
|
||||
case .inlineKeyboardButtonTypeSwitchInline(let value):
|
||||
try container.encode(Kind.inlineKeyboardButtonTypeSwitchInline, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inlineKeyboardButtonTypeBuy:
|
||||
try container.encode(Kind.inlineKeyboardButtonTypeBuy, forKey: .type)
|
||||
case .inlineKeyboardButtonTypeUser(let value):
|
||||
try container.encode(Kind.inlineKeyboardButtonTypeUser, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inlineKeyboardButtonTypeCopyText(let value):
|
||||
try container.encode(Kind.inlineKeyboardButtonTypeCopyText, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A button that opens a specified URL
|
||||
public struct InlineKeyboardButtonTypeUrl: Codable, Equatable, Hashable {
|
||||
|
||||
/// HTTP or tg:// URL to open. If the link is of the type internalLinkTypeWebApp, then the button must be marked as a Web App button
|
||||
public let url: String
|
||||
|
||||
|
||||
public init(url: String) {
|
||||
self.url = url
|
||||
}
|
||||
}
|
||||
|
||||
/// A button that opens a specified URL and automatically authorize the current user by calling getLoginUrlInfo
|
||||
public struct InlineKeyboardButtonTypeLoginUrl: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// If non-empty, new text of the button in forwarded messages
|
||||
public let forwardText: String
|
||||
|
||||
/// Unique button identifier
|
||||
public let id: Int64
|
||||
|
||||
/// An HTTP URL to pass to getLoginUrlInfo
|
||||
public let url: String
|
||||
|
||||
|
||||
public init(
|
||||
forwardText: String,
|
||||
id: Int64,
|
||||
url: String
|
||||
) {
|
||||
self.forwardText = forwardText
|
||||
self.id = id
|
||||
self.url = url
|
||||
}
|
||||
}
|
||||
|
||||
/// A button that opens a Web App by calling openWebApp
|
||||
public struct InlineKeyboardButtonTypeWebApp: Codable, Equatable, Hashable {
|
||||
|
||||
/// An HTTP URL to pass to openWebApp
|
||||
public let url: String
|
||||
|
||||
|
||||
public init(url: String) {
|
||||
self.url = url
|
||||
}
|
||||
}
|
||||
|
||||
/// A button that sends a callback query to a bot
|
||||
public struct InlineKeyboardButtonTypeCallback: Codable, Equatable, Hashable {
|
||||
|
||||
/// Data to be sent to the bot via a callback query
|
||||
public let data: Data
|
||||
|
||||
|
||||
public init(data: Data) {
|
||||
self.data = data
|
||||
}
|
||||
}
|
||||
|
||||
/// A button that asks for the 2-step verification password of the current user and then sends a callback query to a bot
|
||||
public struct InlineKeyboardButtonTypeCallbackWithPassword: Codable, Equatable, Hashable {
|
||||
|
||||
/// Data to be sent to the bot via a callback query
|
||||
public let data: Data
|
||||
|
||||
|
||||
public init(data: Data) {
|
||||
self.data = data
|
||||
}
|
||||
}
|
||||
|
||||
/// A button that forces an inline query to the bot to be inserted in the input field
|
||||
public struct InlineKeyboardButtonTypeSwitchInline: Codable, Equatable, Hashable {
|
||||
|
||||
/// Inline query to be sent to the bot
|
||||
public let query: String
|
||||
|
||||
/// Target chat from which to send the inline query
|
||||
public let targetChat: TargetChat
|
||||
|
||||
|
||||
public init(
|
||||
query: String,
|
||||
targetChat: TargetChat
|
||||
) {
|
||||
self.query = query
|
||||
self.targetChat = targetChat
|
||||
}
|
||||
}
|
||||
|
||||
/// A button with a user reference to be handled in the same way as textEntityTypeMentionName entities
|
||||
public struct InlineKeyboardButtonTypeUser: Codable, Equatable, Hashable {
|
||||
|
||||
/// User identifier
|
||||
public let userId: Int64
|
||||
|
||||
|
||||
public init(userId: Int64) {
|
||||
self.userId = userId
|
||||
}
|
||||
}
|
||||
|
||||
/// A button that copies specified text to clipboard
|
||||
public struct InlineKeyboardButtonTypeCopyText: Codable, Equatable, Hashable {
|
||||
|
||||
/// The text to copy to clipboard
|
||||
public let text: String
|
||||
|
||||
|
||||
public init(text: String) {
|
||||
self.text = text
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
//
|
||||
// InputChecklist.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a checklist to be sent
|
||||
public struct InputChecklist: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if other users can add tasks to the list
|
||||
public let othersCanAddTasks: Bool
|
||||
|
||||
/// True, if other users can mark tasks as done or not done
|
||||
public let othersCanMarkTasksAsDone: Bool
|
||||
|
||||
/// List of tasks in the checklist; 1-getOption("checklist_task_count_max") tasks
|
||||
public let tasks: [InputChecklistTask]
|
||||
|
||||
/// Title of the checklist; 1-getOption("checklist_title_length_max") characters. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, and DateTime entities
|
||||
public let title: FormattedText
|
||||
|
||||
|
||||
public init(
|
||||
othersCanAddTasks: Bool,
|
||||
othersCanMarkTasksAsDone: Bool,
|
||||
tasks: [InputChecklistTask],
|
||||
title: FormattedText
|
||||
) {
|
||||
self.othersCanAddTasks = othersCanAddTasks
|
||||
self.othersCanMarkTasksAsDone = othersCanMarkTasksAsDone
|
||||
self.tasks = tasks
|
||||
self.title = title
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// InputChecklistTask.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a task in a checklist to be sent
|
||||
public struct InputChecklistTask: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Unique identifier of the task; must be positive
|
||||
public let id: Int
|
||||
|
||||
/// Text of the task; 1-getOption("checklist_task_text_length_max") characters without line feeds. May contain only Bold, Italic, Underline, Strikethrough, Spoiler, CustomEmoji, and DateTime entities
|
||||
public let text: FormattedText
|
||||
|
||||
|
||||
public init(
|
||||
id: Int,
|
||||
text: FormattedText
|
||||
) {
|
||||
self.id = id
|
||||
self.text = text
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,141 @@
|
|||
//
|
||||
// InputFile.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Points to a file
|
||||
public indirect enum InputFile: Codable, Equatable, Hashable {
|
||||
|
||||
/// A file defined by its unique identifier
|
||||
case inputFileId(InputFileId)
|
||||
|
||||
/// A file defined by its remote identifier. The remote identifier is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application
|
||||
case inputFileRemote(InputFileRemote)
|
||||
|
||||
/// A file defined by a local path
|
||||
case inputFileLocal(InputFileLocal)
|
||||
|
||||
/// A file generated by the application. The application must handle updates updateFileGenerationStart and updateFileGenerationStop to generate the file when asked by TDLib
|
||||
case inputFileGenerated(InputFileGenerated)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case inputFileId
|
||||
case inputFileRemote
|
||||
case inputFileLocal
|
||||
case inputFileGenerated
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .inputFileId:
|
||||
let value = try InputFileId(from: decoder)
|
||||
self = .inputFileId(value)
|
||||
case .inputFileRemote:
|
||||
let value = try InputFileRemote(from: decoder)
|
||||
self = .inputFileRemote(value)
|
||||
case .inputFileLocal:
|
||||
let value = try InputFileLocal(from: decoder)
|
||||
self = .inputFileLocal(value)
|
||||
case .inputFileGenerated:
|
||||
let value = try InputFileGenerated(from: decoder)
|
||||
self = .inputFileGenerated(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .inputFileId(let value):
|
||||
try container.encode(Kind.inputFileId, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inputFileRemote(let value):
|
||||
try container.encode(Kind.inputFileRemote, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inputFileLocal(let value):
|
||||
try container.encode(Kind.inputFileLocal, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inputFileGenerated(let value):
|
||||
try container.encode(Kind.inputFileGenerated, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A file defined by its unique identifier
|
||||
public struct InputFileId: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Unique file identifier
|
||||
public let id: Int
|
||||
|
||||
|
||||
public init(id: Int) {
|
||||
self.id = id
|
||||
}
|
||||
}
|
||||
|
||||
/// A file defined by its remote identifier. The remote identifier is guaranteed to be usable only if the corresponding file is still accessible to the user and known to TDLib. For example, if the file is from a message, then the message must be not deleted and accessible to the user. If the file database is disabled, then the corresponding object with the file must be preloaded by the application
|
||||
public struct InputFileRemote: Codable, Equatable, Hashable, Identifiable {
|
||||
|
||||
/// Remote file identifier
|
||||
public let id: String
|
||||
|
||||
|
||||
public init(id: String) {
|
||||
self.id = id
|
||||
}
|
||||
}
|
||||
|
||||
/// A file defined by a local path
|
||||
public struct InputFileLocal: Codable, Equatable, Hashable {
|
||||
|
||||
/// Local path to the file
|
||||
public let path: String
|
||||
|
||||
|
||||
public init(path: String) {
|
||||
self.path = path
|
||||
}
|
||||
}
|
||||
|
||||
/// A file generated by the application. The application must handle updates updateFileGenerationStart and updateFileGenerationStop to generate the file when asked by TDLib
|
||||
public struct InputFileGenerated: Codable, Equatable, Hashable {
|
||||
|
||||
/// String specifying the conversion applied to the original file; must be persistent across application restarts. Conversions beginning with '#' are reserved for internal TDLib usage
|
||||
public let conversion: String
|
||||
|
||||
/// Expected size of the generated file, in bytes; pass 0 if unknown
|
||||
public let expectedSize: Int64
|
||||
|
||||
/// Local path to a file from which the file is generated. The path doesn't have to be a valid path and is used by TDLib only to detect name and MIME type of the generated file
|
||||
public let originalPath: String
|
||||
|
||||
|
||||
public init(
|
||||
conversion: String,
|
||||
expectedSize: Int64,
|
||||
originalPath: String
|
||||
) {
|
||||
self.conversion = conversion
|
||||
self.expectedSize = expectedSize
|
||||
self.originalPath = originalPath
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -0,0 +1,153 @@
|
|||
//
|
||||
// InputMessageReplyTo.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Contains information about the message or the story to be replied
|
||||
public indirect enum InputMessageReplyTo: Codable, Equatable, Hashable {
|
||||
|
||||
/// Describes a message to be replied in the same chat and forum topic
|
||||
case inputMessageReplyToMessage(InputMessageReplyToMessage)
|
||||
|
||||
/// Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats
|
||||
case inputMessageReplyToExternalMessage(InputMessageReplyToExternalMessage)
|
||||
|
||||
/// Describes a story to be replied
|
||||
case inputMessageReplyToStory(InputMessageReplyToStory)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case inputMessageReplyToMessage
|
||||
case inputMessageReplyToExternalMessage
|
||||
case inputMessageReplyToStory
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .inputMessageReplyToMessage:
|
||||
let value = try InputMessageReplyToMessage(from: decoder)
|
||||
self = .inputMessageReplyToMessage(value)
|
||||
case .inputMessageReplyToExternalMessage:
|
||||
let value = try InputMessageReplyToExternalMessage(from: decoder)
|
||||
self = .inputMessageReplyToExternalMessage(value)
|
||||
case .inputMessageReplyToStory:
|
||||
let value = try InputMessageReplyToStory(from: decoder)
|
||||
self = .inputMessageReplyToStory(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .inputMessageReplyToMessage(let value):
|
||||
try container.encode(Kind.inputMessageReplyToMessage, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inputMessageReplyToExternalMessage(let value):
|
||||
try container.encode(Kind.inputMessageReplyToExternalMessage, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inputMessageReplyToStory(let value):
|
||||
try container.encode(Kind.inputMessageReplyToStory, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes a message to be replied in the same chat and forum topic
|
||||
public struct InputMessageReplyToMessage: Codable, Equatable, Hashable {
|
||||
|
||||
/// Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message
|
||||
public let checklistTaskId: Int
|
||||
|
||||
/// The identifier of the message to be replied in the same chat and forum topic. A message can be replied in the same chat and forum topic only if messageProperties.can_be_replied
|
||||
public let messageId: Int64
|
||||
|
||||
/// Identifier of the poll option in the message to be replied; pass an empty string if none
|
||||
public let pollOptionId: String
|
||||
|
||||
/// Quote from the message to be replied; pass null if none. Must always be null for replies in secret chats
|
||||
public let quote: InputTextQuote?
|
||||
|
||||
|
||||
public init(
|
||||
checklistTaskId: Int,
|
||||
messageId: Int64,
|
||||
pollOptionId: String,
|
||||
quote: InputTextQuote?
|
||||
) {
|
||||
self.checklistTaskId = checklistTaskId
|
||||
self.messageId = messageId
|
||||
self.pollOptionId = pollOptionId
|
||||
self.quote = quote
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes a message to be replied that is from a different chat or a forum topic; not supported in secret chats
|
||||
public struct InputMessageReplyToExternalMessage: Codable, Equatable, Hashable {
|
||||
|
||||
/// The identifier of the chat to which the message to be replied belongs
|
||||
public let chatId: Int64
|
||||
|
||||
/// Identifier of the checklist task in the message to be replied; pass 0 to reply to the whole message
|
||||
public let checklistTaskId: Int
|
||||
|
||||
/// The identifier of the message to be replied in the specified chat. A message can be replied in another chat or forum topic only if messageProperties.can_be_replied_in_another_chat
|
||||
public let messageId: Int64
|
||||
|
||||
/// Identifier of the poll option in the message to be replied; pass an empty string if none
|
||||
public let pollOptionId: String
|
||||
|
||||
/// Quote from the message to be replied; pass null if none
|
||||
public let quote: InputTextQuote?
|
||||
|
||||
|
||||
public init(
|
||||
chatId: Int64,
|
||||
checklistTaskId: Int,
|
||||
messageId: Int64,
|
||||
pollOptionId: String,
|
||||
quote: InputTextQuote?
|
||||
) {
|
||||
self.chatId = chatId
|
||||
self.checklistTaskId = checklistTaskId
|
||||
self.messageId = messageId
|
||||
self.pollOptionId = pollOptionId
|
||||
self.quote = quote
|
||||
}
|
||||
}
|
||||
|
||||
/// Describes a story to be replied
|
||||
public struct InputMessageReplyToStory: Codable, Equatable, Hashable {
|
||||
|
||||
/// The identifier of the story
|
||||
public let storyId: Int
|
||||
|
||||
/// The identifier of the poster of the story. Currently, stories can be replied only in the chat that posted the story; channel stories can't be replied
|
||||
public let storyPosterChatId: Int64
|
||||
|
||||
|
||||
public init(
|
||||
storyId: Int,
|
||||
storyPosterChatId: Int64
|
||||
) {
|
||||
self.storyId = storyId
|
||||
self.storyPosterChatId = storyPosterChatId
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// InputPaidMedia.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes a paid media to be sent
|
||||
public struct InputPaidMedia: Codable, Equatable, Hashable {
|
||||
|
||||
/// File identifiers of the stickers added to the media, if applicable
|
||||
public let addedStickerFileIds: [Int]
|
||||
|
||||
/// Media height
|
||||
public let height: Int
|
||||
|
||||
/// Photo or video to be sent
|
||||
public let media: InputFile
|
||||
|
||||
/// Media thumbnail; pass null to skip thumbnail uploading
|
||||
public let thumbnail: InputThumbnail?
|
||||
|
||||
/// Type of the media
|
||||
public let type: InputPaidMediaType
|
||||
|
||||
/// Media width
|
||||
public let width: Int
|
||||
|
||||
|
||||
public init(
|
||||
addedStickerFileIds: [Int],
|
||||
height: Int,
|
||||
media: InputFile,
|
||||
thumbnail: InputThumbnail?,
|
||||
type: InputPaidMediaType,
|
||||
width: Int
|
||||
) {
|
||||
self.addedStickerFileIds = addedStickerFileIds
|
||||
self.height = height
|
||||
self.media = media
|
||||
self.thumbnail = thumbnail
|
||||
self.type = type
|
||||
self.width = width
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
//
|
||||
// InputPaidMediaType.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes type of paid media to sent
|
||||
public indirect enum InputPaidMediaType: Codable, Equatable, Hashable {
|
||||
|
||||
/// The media is a photo. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20
|
||||
case inputPaidMediaTypePhoto(InputPaidMediaTypePhoto)
|
||||
|
||||
/// The media is a video
|
||||
case inputPaidMediaTypeVideo(InputPaidMediaTypeVideo)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case inputPaidMediaTypePhoto
|
||||
case inputPaidMediaTypeVideo
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .inputPaidMediaTypePhoto:
|
||||
let value = try InputPaidMediaTypePhoto(from: decoder)
|
||||
self = .inputPaidMediaTypePhoto(value)
|
||||
case .inputPaidMediaTypeVideo:
|
||||
let value = try InputPaidMediaTypeVideo(from: decoder)
|
||||
self = .inputPaidMediaTypeVideo(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .inputPaidMediaTypePhoto(let value):
|
||||
try container.encode(Kind.inputPaidMediaTypePhoto, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inputPaidMediaTypeVideo(let value):
|
||||
try container.encode(Kind.inputPaidMediaTypeVideo, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The media is a photo. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20
|
||||
public struct InputPaidMediaTypePhoto: Codable, Equatable, Hashable {
|
||||
|
||||
/// Video of the live photo; pass null if the photo isn't a live photo
|
||||
public let video: InputFile?
|
||||
|
||||
|
||||
public init(video: InputFile?) {
|
||||
self.video = video
|
||||
}
|
||||
}
|
||||
|
||||
/// The media is a video
|
||||
public struct InputPaidMediaTypeVideo: Codable, Equatable, Hashable {
|
||||
|
||||
/// Cover of the video; pass null to skip cover uploading
|
||||
public let cover: InputFile?
|
||||
|
||||
/// Duration of the video, in seconds
|
||||
public let duration: Int
|
||||
|
||||
/// Timestamp from which the video playing must start, in seconds
|
||||
public let startTimestamp: Int
|
||||
|
||||
/// True, if the video is expected to be streamed
|
||||
public let supportsStreaming: Bool
|
||||
|
||||
|
||||
public init(
|
||||
cover: InputFile?,
|
||||
duration: Int,
|
||||
startTimestamp: Int,
|
||||
supportsStreaming: Bool
|
||||
) {
|
||||
self.cover = cover
|
||||
self.duration = duration
|
||||
self.startTimestamp = startTimestamp
|
||||
self.supportsStreaming = supportsStreaming
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
//
|
||||
// InputPollOption.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes one answer option of a poll to be created
|
||||
public struct InputPollOption: Codable, Equatable, Hashable {
|
||||
|
||||
/// Option media; pass null if none; ignored in addPollOption. Must be one of the following types: inputMessageAnimation, non-live inputMessageLocation, inputMessagePhoto, inputMessageSticker, inputMessageVenue, or inputMessageVideo without caption
|
||||
public let media: InputMessageContent?
|
||||
|
||||
/// Option text; 1-100 characters. Only custom emoji entities are allowed to be added and only by Premium users
|
||||
public let text: FormattedText
|
||||
|
||||
|
||||
public init(
|
||||
media: InputMessageContent?,
|
||||
text: FormattedText
|
||||
) {
|
||||
self.media = media
|
||||
self.text = text
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,97 @@
|
|||
//
|
||||
// InputPollType.swift
|
||||
// tl2swift
|
||||
//
|
||||
// Generated automatically. Any changes will be lost!
|
||||
// Based on TDLib 1.8.64-49b3bcbb-49b3bcbb
|
||||
// https://github.com/tdlib/td/tree/49b3bcbb
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
/// Describes the type of poll to send
|
||||
public indirect enum InputPollType: Codable, Equatable, Hashable {
|
||||
|
||||
/// A regular poll
|
||||
case inputPollTypeRegular(InputPollTypeRegular)
|
||||
|
||||
/// A poll in quiz mode, which has predefined correct answers
|
||||
case inputPollTypeQuiz(InputPollTypeQuiz)
|
||||
|
||||
/// Decoded when the @type is not one of the known cases (forward-compatible).
|
||||
case unsupported
|
||||
|
||||
private enum Kind: String, Codable {
|
||||
case inputPollTypeRegular
|
||||
case inputPollTypeQuiz
|
||||
}
|
||||
|
||||
public init(from decoder: Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: DtoCodingKeys.self)
|
||||
let typeString = try container.decode(String.self, forKey: .type)
|
||||
guard let type = Kind(rawValue: typeString) else {
|
||||
self = .unsupported
|
||||
return
|
||||
}
|
||||
switch type {
|
||||
case .inputPollTypeRegular:
|
||||
let value = try InputPollTypeRegular(from: decoder)
|
||||
self = .inputPollTypeRegular(value)
|
||||
case .inputPollTypeQuiz:
|
||||
let value = try InputPollTypeQuiz(from: decoder)
|
||||
self = .inputPollTypeQuiz(value)
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: DtoCodingKeys.self)
|
||||
switch self {
|
||||
case .inputPollTypeRegular(let value):
|
||||
try container.encode(Kind.inputPollTypeRegular, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .inputPollTypeQuiz(let value):
|
||||
try container.encode(Kind.inputPollTypeQuiz, forKey: .type)
|
||||
try value.encode(to: encoder)
|
||||
case .unsupported:
|
||||
try container.encode("unsupported", forKey: .type)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A regular poll
|
||||
public struct InputPollTypeRegular: Codable, Equatable, Hashable {
|
||||
|
||||
/// True, if answer options can be added to the poll after creation; not supported in channel chats and for anonymous polls
|
||||
public let allowAddingOptions: Bool
|
||||
|
||||
|
||||
public init(allowAddingOptions: Bool) {
|
||||
self.allowAddingOptions = allowAddingOptions
|
||||
}
|
||||
}
|
||||
|
||||
/// A poll in quiz mode, which has predefined correct answers
|
||||
public struct InputPollTypeQuiz: Codable, Equatable, Hashable {
|
||||
|
||||
/// Increasing list of 0-based identifiers of the correct answer options; must be non-empty
|
||||
public let correctOptionIds: [Int]
|
||||
|
||||
/// Text that is shown when the user chooses an incorrect answer or taps on the lamp icon; 0-200 characters with at most 2 line feeds
|
||||
public let explanation: FormattedText
|
||||
|
||||
/// Media that is shown when the user chooses an incorrect answer or taps on the lamp icon; pass null if none. Must be one of the following types: inputMessageAnimation, inputMessageAudio, inputMessageDocument, non-live inputMessageLocation, inputMessagePhoto, inputMessageVenue, or inputMessageVideo without caption
|
||||
public let explanationMedia: InputMessageContent?
|
||||
|
||||
|
||||
public init(
|
||||
correctOptionIds: [Int],
|
||||
explanation: FormattedText,
|
||||
explanationMedia: InputMessageContent?
|
||||
) {
|
||||
self.correctOptionIds = correctOptionIds
|
||||
self.explanation = explanation
|
||||
self.explanationMedia = explanationMedia
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue