Class AbstractTelegramRequest

    • Field Detail

      • gson

        protected static transient com.google.gson.Gson gson
      • errorHandler

        protected transient java.util.function.Consumer<TelegramException> errorHandler
    • Constructor Detail

      • AbstractTelegramRequest

        protected AbstractTelegramRequest​(java.lang.String endPoint,
                                          java.util.function.Consumer<TelegramException> errorHandler)
    • Method Detail

      • getBody

        protected java.lang.String getBody​(okhttp3.Response response)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • validate

        protected com.google.gson.JsonElement validate​(java.lang.String response)
      • getEndPoint

        public java.lang.String getEndPoint()
        Description copied from interface: TelegramRequest
        Get the appropriate endpoint for this request.
        Specified by:
        getEndPoint in interface TelegramRequest
        Returns:
        The endpoint
      • serialize

        public java.lang.String serialize()
        Description copied from interface: TelegramRequest
        Use GSON to properly serialize the request to send to Telegram's servers. This method exists if there are any special cases or pre-processing required.
        Specified by:
        serialize in interface TelegramRequest
        Returns:
        the serialized JSON string
      • handleException

        public void handleException​(java.io.IOException ex)
        Description copied from interface: TelegramRequest
        Handle an exception in the case that an I/O error occured
        Specified by:
        handleException in interface TelegramRequest
        Parameters:
        ex - The exception
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • canEqual

        protected boolean canEqual​(java.lang.Object other)
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • setErrorHandler

        public void setErrorHandler​(java.util.function.Consumer<TelegramException> errorHandler)