Class Client


  • public final class Client
    extends Object
    Main class for interaction with the TDLib.
    • Method Detail

      • send

        public void send​(TdApi.Function query,
                         Client.ResultHandler resultHandler,
                         Client.ExceptionHandler exceptionHandler)
        Sends a request to the TDLib.
        Parameters:
        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.
        Throws:
        NullPointerException - if query is null.
      • send

        public void send​(TdApi.Function query,
                         Client.ResultHandler resultHandler)
        Sends a request to the TDLib with an empty ExceptionHandler.
        Parameters:
        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.
        Throws:
        NullPointerException - if query is null.
      • execute

        public static TdApi.Object execute​(TdApi.Function query)
        Synchronously executes a TDLib request. Only a few marked accordingly requests can be executed synchronously.
        Parameters:
        query - Object representing a query to the TDLib.
        Returns:
        request result.
        Throws:
        NullPointerException - if query is null.
      • create

        public static Client create​(Client.ResultHandler updateHandler,
                                    Client.ExceptionHandler updateExceptionHandler,
                                    Client.ExceptionHandler defaultExceptionHandler)
        Creates new Client.
        Parameters:
        updateHandler - Handler for incoming updates.
        updateExceptionHandler - Handler for exceptions thrown from updateHandler. If it is null, exceptions will be iggnored.
        defaultExceptionHandler - Default handler for exceptions thrown from all ResultHandler. If it is null, exceptions will be iggnored.
        Returns:
        created Client