Interface TelegramRequest

    • Field Summary

      Fields 
      Modifier and Type Field Description
      static okhttp3.MediaType JSON_MEDIA_TYPE  
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default okhttp3.Request.Builder build​(TelegramBot bot)  
      java.lang.String getEndPoint()
      Get the appropriate endpoint for this request.
      void handleException​(java.io.IOException ex)
      Handle an exception in the case that an I/O error occured
      void handleResponse​(okhttp3.Response response)
      Handle the response from the server, call any relevant callbacks and do error validation
      java.lang.String serialize()
      Use GSON to properly serialize the request to send to Telegram's servers.
    • Field Detail

      • JSON_MEDIA_TYPE

        static final okhttp3.MediaType JSON_MEDIA_TYPE
    • Method Detail

      • serialize

        java.lang.String serialize()
        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.
        Returns:
        the serialized JSON string
      • build

        default okhttp3.Request.Builder build​(TelegramBot bot)
      • getEndPoint

        java.lang.String getEndPoint()
        Get the appropriate endpoint for this request.
        Returns:
        The endpoint
      • handleResponse

        void handleResponse​(okhttp3.Response response)
                     throws java.io.IOException
        Handle the response from the server, call any relevant callbacks and do error validation
        Parameters:
        response - The response
        Throws:
        java.io.IOException - If any I/O error occurred
      • handleException

        void handleException​(java.io.IOException ex)
        Handle an exception in the case that an I/O error occured
        Parameters:
        ex - The exception