Coordinator
public class Coordinator
The Coordinator handles update, functions, downloads and the authorization- and connection state.
-
The
TDJsonClientinstance.Declaration
Swift
public private(set) var client: TDJsonClient -
The stream of authorization stats.
waitTdlibParametersandwaitEncryptionKeyare already handled by theCoordinatorand should be ignored.Declaration
Swift
public let authorizationState: Stream<LoadingEvent<AuthorizationState>> -
The stream of the current connection state.
Declaration
Swift
public let connectionState: Stream<LoadingEvent<ConnectionState>> -
The stream of all updates.
-
Undocumented
Declaration
Swift
public let floodStream: FloodStream -
Initalizes a new
Coordinatorinstance.Declaration
Swift
public init(client: TDJsonClient = TDJsonClient(), parameters: TdlibParameters, encryptionKey: Data = Data(repeating: 123, count: 64))Parameters
clientThe
TDJsonClientused for all communcation withtdlib(default is newTDJsonClient).parametersThe parameters used to configure
tdlib.encryptionKeyThe encryption key for the local database.
-
Initalizes a new
Coordinatorinstance.Declaration
Swift
public convenience init(client: TDJsonClient = TDJsonClient(), apiId: Int32, apiHash: String, useTestDc: Bool = false, encryptionKey: Data = Data(repeating: 123, count: 64))Parameters
clientThe
TDJsonClientused for all communcation withtdlib(default is newTDJsonClient).apiIdThe application identifier for Telegram API access, which can be obtained at https://my.telegram.org
apiHashThe application identifier hash for Telegram API access, which can be obtained at https://my.telegram.org
useTestDcIf set to true, the Telegram test environment will be used instead of the production environment
encryptionKeyThe encryption key for the local database.
-
Undocumented
Declaration
Swift
public func recreateClient(_ client: TDJsonClient = TDJsonClient()) -
Downloads a new file.
Declaration
Swift
public func download(file: File, priority: Int32 = 32) -> Stream<DownloadEvent<File>>Parameters
fileThe file to download.
priorityA priority between 0 and 32 (default 32).
Return Value
A stream of the download events of the given file.
-
Send the request to
tdlib.Declaration
Swift
public func send<F>(_ function: F) -> Promise<F.Result> where F : TDFunctionParameters
functionA
TDFunction.Return Value
A promise of the result of the function.
View on GitHub
Install in Dash
Coordinator Class Reference