TDJsonClient
public class TDJsonClient
This is a wrapper around TDJSON.
It is responsible for creating a C td_json_client
, sending request and receiving it’s updates.
The update data can be accessed by subscribing to TDJsonClient.stream
.
It is recommended to let the Coordinator
manage the TDJsonClient
and to never to use TDJsonClient
directly.
-
The log verbosity level of the
See moretdlib
.Declaration
Swift
public enum LogLevel : Int32
-
The raw C
td_json_client
. It is recommended to use it.Declaration
Swift
public let rawClient: UnsafeMutableRawPointer
-
Whether the object is still receiving data from
tdjson
.Declaration
Swift
public private(set) var isListing: Bool
-
Undocumented
Declaration
Swift
public var isRunning: Bool
-
Sets the log verbosity level of the
tdlib
.Declaration
Swift
public var logLevel: TDJsonClient.LogLevel { get set }
-
Undocumented
Declaration
Swift
public var logPath: String? { get set }
-
Initiates a new
TDJsonClient
, that immediately starts receiving data fromtdlib
.Declaration
Swift
public init()
-
Sends a request to
tdlib
. TheJSONDecoder.td
will be used to encode the json. Use@extra
to later identify the response.Throws
An error if something goes wrong during the encoding.Declaration
Swift
public func send<T>(_ encodable: T) throws where T : Encodable
Parameters
encodable
A
encodable
request object. -
Send a request to
tdlib
. Use@extra
to later identify the response.Declaration
Swift
public func send(_ query: String)
Parameters
query
A json encoded request.
-
Executes a request synchronously. Can only be used for certain request.
Declaration
Swift
public func execute(_ query: String) -> String?
Parameters
query
A json encoded request
Return Value
The result of the request, or nil.
-
Stops receiving data from
tdlib
and destroys thetd_json_client
.Declaration
Swift
public func close()