Class WhatsappApiServiceGenerator

java.lang.Object
com.whatsapp.api.WhatsappApiServiceGenerator

public class WhatsappApiServiceGenerator extends Object
The type Whatsapp api service generator.
  • Method Details

    • createDefaultHttpClient

      public static okhttp3.OkHttpClient createDefaultHttpClient()
    • setHttpProxy

      public static void setHttpProxy(String host, int port, String username, String pwd)
      Sets http proxy for the shared client.

      If you need to use a proxy to connect to the internet, you can use this method to set it.

      • If you want to use a proxy that requires authentication, you can pass the username and password as parameters.

      • If you want to use a proxy that does not require authentication, you can pass null as parameters for username and pwd.

      Parameters:
      host - the host (Not null)
      port - the port
      username - the username
      pwd - the pwd
      See Also:
    • createService

      public static <S> S createService(Class<S> serviceClass, String token, String baseUrl)
      Create service s.
      Type Parameters:
      S - the type parameter
      Parameters:
      serviceClass - the service class
      token - the token
      baseUrl - the base url
      Returns:
      the s
    • createService

      public static <S> S createService(Class<S> serviceClass, String token)
      Create service s.
      Type Parameters:
      S - the type parameter
      Parameters:
      serviceClass - the service class
      token - the token
      Returns:
      the s
    • executeSync

      public static <T> T executeSync(retrofit2.Call<T> call)
      Execute sync t.
      Type Parameters:
      T - the type parameter
      Parameters:
      call - the call
      Returns:
      the t
    • executeDownloadSync

      public static <T> MediaFile executeDownloadSync(retrofit2.Call<T> call)
      Execute sync file download
      Type Parameters:
      T - the type parameter
      Parameters:
      call - the call
      Returns:
      the t
    • getWhatsappApiError

      public static WhatsappApiError getWhatsappApiError(retrofit2.Response<?> response) throws WhatsappApiException, IOException
      Gets whatsapp api error.
      Parameters:
      response - the response
      Returns:
      the whatsapp api error
      Throws:
      WhatsappApiException - the whatsapp api exception
      IOException - the io exception
    • getSharedClient

      public static okhttp3.OkHttpClient getSharedClient()
      Gets shared client.
      Returns:
      the shared client