public final class Client
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
Client.ExceptionHandler
Interface for handler of exceptions thrown while invoking ResultHandler.
|
static class |
Client.ExecutionException
Exception class thrown when TDLib error occurred while performing
execute(TdApi.Function). |
static interface |
Client.LogMessageHandler
Interface for handler of messages that are added to the internal TDLib log.
|
static interface |
Client.ResultHandler
Interface for handler for results of queries to TDLib and incoming updates from TDLib.
|
| Modifier and Type | Method and Description |
|---|---|
static Client |
create(Client.ResultHandler updateHandler,
Client.ExceptionHandler updateExceptionHandler,
Client.ExceptionHandler defaultExceptionHandler)
Creates new Client.
|
static <T extends TdApi.Object> |
execute(TdApi.Function<T> query)
Synchronously executes a TDLib request.
|
void |
send(TdApi.Function query,
Client.ResultHandler resultHandler)
Sends a request to the TDLib with an empty ExceptionHandler.
|
void |
send(TdApi.Function query,
Client.ResultHandler resultHandler,
Client.ExceptionHandler exceptionHandler)
Sends a request to the TDLib.
|
static void |
setLogMessageHandler(int maxVerbosityLevel,
Client.LogMessageHandler logMessageHandler)
Sets the handler for messages that are added to the internal TDLib log.
|
public void send(TdApi.Function query, Client.ResultHandler resultHandler, Client.ExceptionHandler exceptionHandler)
query - Object representing a query to the TDLib.resultHandler - Result handler with onResult method which will be called with result
of the query or with TdApi.Error as parameter. If it is null, nothing
will be called.exceptionHandler - Exception handler with onException method which will be called on
exception thrown from resultHandler. If it is null, then
defaultExceptionHandler will be called.public void send(TdApi.Function query, Client.ResultHandler resultHandler)
query - Object representing a query to the TDLib.resultHandler - Result handler with onResult method which will be called with result
of the query or with TdApi.Error as parameter. If it is null, then
defaultExceptionHandler will be called.public static <T extends TdApi.Object> T execute(TdApi.Function<T> query) throws Client.ExecutionException
T - Automatically deduced return type of the query.query - Object representing a query to the TDLib.Client.ExecutionException - if query execution fails.public static Client create(Client.ResultHandler updateHandler, Client.ExceptionHandler updateExceptionHandler, Client.ExceptionHandler defaultExceptionHandler)
updateHandler - Handler for incoming updates.updateExceptionHandler - Handler for exceptions thrown from updateHandler. If it is null, exceptions will be ignored.defaultExceptionHandler - Default handler for exceptions thrown from all ResultHandler. If it is null, exceptions will be ignored.public static void setLogMessageHandler(int maxVerbosityLevel,
Client.LogMessageHandler logMessageHandler)
maxVerbosityLevel - The maximum verbosity level of messages for which the callback will be called.logMessageHandler - Handler for messages that are added to the internal TDLib log. Pass null to remove the handler.