Class WebAPI


  • public class WebAPI
    extends java.lang.Object
    Represents a single interface that exists within the Web API.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  WebAPI.WebAPIRequestException
      Thrown when WebAPI request fails (non success response code).
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String DEFAULT_BASE_ADDRESS  
    • Constructor Summary

      Constructors 
      Constructor Description
      WebAPI​(okhttp3.OkHttpClient httpClient, java.lang.String baseAddress, java.lang.String _interface, java.lang.String webAPIKey)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      KeyValue call​(java.lang.String function)
      Manually calls the specified Web API function with the provided details.
      KeyValue call​(java.lang.String function, int version)
      Manually calls the specified Web API function with the provided details.
      void call​(java.lang.String function, int version, Consumer<KeyValue> callback, Consumer<WebAPI.WebAPIRequestException> error)
      Manually calls the specified Web API function with the provided details.
      KeyValue call​(java.lang.String function, int version, java.util.Map<java.lang.String,​java.lang.String> parameters)
      Manually calls the specified Web API function with the provided details.
      void call​(java.lang.String function, Consumer<KeyValue> callback, Consumer<WebAPI.WebAPIRequestException> error)
      Manually calls the specified Web API function with the provided details.
      KeyValue call​(java.lang.String httpMethod, java.lang.String function)
      Manually calls the specified Web API function with the provided details.
      KeyValue call​(java.lang.String httpMethod, java.lang.String function, int version)
      Manually calls the specified Web API function with the provided details.
      void call​(java.lang.String httpMethod, java.lang.String function, int version, Consumer<KeyValue> callback, Consumer<WebAPI.WebAPIRequestException> error)
      Manually calls the specified Web API function with the provided details.
      KeyValue call​(java.lang.String httpMethod, java.lang.String function, int version, java.util.Map<java.lang.String,​java.lang.String> parameters)
      Manually calls the specified Web API function with the provided details.
      void call​(java.lang.String httpMethod, java.lang.String function, int version, java.util.Map<java.lang.String,​java.lang.String> parameters, Consumer<KeyValue> callback, Consumer<WebAPI.WebAPIRequestException> error)
      Manually calls the specified Web API function with the provided details.
      void call​(java.lang.String httpMethod, java.lang.String function, Consumer<KeyValue> callback, Consumer<WebAPI.WebAPIRequestException> error)
      Manually calls the specified Web API function with the provided details.
      KeyValue call​(java.lang.String httpMethod, java.lang.String function, java.util.Map<java.lang.String,​java.lang.String> parameters)
      Manually calls the specified Web API function with the provided details.
      void call​(java.lang.String httpMethod, java.lang.String function, java.util.Map<java.lang.String,​java.lang.String> parameters, Consumer<KeyValue> callback, Consumer<WebAPI.WebAPIRequestException> error)
      Manually calls the specified Web API function with the provided details.
      KeyValue call​(java.lang.String function, java.util.Map<java.lang.String,​java.lang.String> parameters)
      Manually calls the specified Web API function with the provided details.
      void call​(java.lang.String function, java.util.Map<java.lang.String,​java.lang.String> parameters, Consumer<KeyValue> callback, Consumer<WebAPI.WebAPIRequestException> error)
      Manually calls the specified Web API function with the provided details.
      okhttp3.HttpUrl getBaseAddress()  
      java.lang.String getInterface()  
      java.lang.String getWebAPIKey()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DEFAULT_BASE_ADDRESS

        public static final java.lang.String DEFAULT_BASE_ADDRESS
        See Also:
        Constant Field Values
    • Constructor Detail

      • WebAPI

        public WebAPI​(okhttp3.OkHttpClient httpClient,
                      java.lang.String baseAddress,
                      java.lang.String _interface,
                      java.lang.String webAPIKey)
    • Method Detail

      • call

        public KeyValue call​(java.lang.String httpMethod,
                             java.lang.String function,
                             int version,
                             java.util.Map<java.lang.String,​java.lang.String> parameters)
                      throws java.io.IOException,
                             WebAPI.WebAPIRequestException
        Manually calls the specified Web API function with the provided details. This method is synchronous.
        Parameters:
        httpMethod - The http request method. Either "POST" or "GET".
        function - The function name to call.
        version - The version of the function to call.
        parameters - A map of string key value pairs representing arguments to be passed to the API.
        Returns:
        A KeyValue object representing the results of the Web API call.
        Throws:
        java.io.IOException - if the request could not be executed
        WebAPI.WebAPIRequestException - the request was successful but returned a non success response code
      • call

        public KeyValue call​(java.lang.String function,
                             int version,
                             java.util.Map<java.lang.String,​java.lang.String> parameters)
                      throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is synchronous.
        Parameters:
        function - The function name to call.
        version - The version of the function to call.
        parameters - A map of string key value pairs representing arguments to be passed to the API.
        Returns:
        A KeyValue object representing the results of the Web API call.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public KeyValue call​(java.lang.String httpMethod,
                             java.lang.String function,
                             java.util.Map<java.lang.String,​java.lang.String> parameters)
                      throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is synchronous.
        Parameters:
        httpMethod - The http request method. Either "POST" or "GET".
        function - The function name to call.
        parameters - A map of string key value pairs representing arguments to be passed to the API.
        Returns:
        A KeyValue object representing the results of the Web API call.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public KeyValue call​(java.lang.String function,
                             java.util.Map<java.lang.String,​java.lang.String> parameters)
                      throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is synchronous.
        Parameters:
        function - The function name to call.
        parameters - A map of string key value pairs representing arguments to be passed to the API.
        Returns:
        A KeyValue object representing the results of the Web API call.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public KeyValue call​(java.lang.String httpMethod,
                             java.lang.String function,
                             int version)
                      throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is synchronous.
        Parameters:
        httpMethod - The http request method. Either "POST" or "GET".
        function - The function name to call.
        version - The version of the function to call.
        Returns:
        A KeyValue object representing the results of the Web API call.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public KeyValue call​(java.lang.String function,
                             int version)
                      throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is synchronous.
        Parameters:
        function - The function name to call.
        version - The version of the function to call.
        Returns:
        A KeyValue object representing the results of the Web API call.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public KeyValue call​(java.lang.String httpMethod,
                             java.lang.String function)
                      throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is synchronous.
        Parameters:
        httpMethod - The http request method. Either "POST" or "GET".
        function - The function name to call.
        Returns:
        A KeyValue object representing the results of the Web API call.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public KeyValue call​(java.lang.String function)
                      throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is synchronous.
        Parameters:
        function - The function name to call.
        Returns:
        A KeyValue object representing the results of the Web API call.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public void call​(java.lang.String httpMethod,
                         java.lang.String function,
                         int version,
                         java.util.Map<java.lang.String,​java.lang.String> parameters,
                         Consumer<KeyValue> callback,
                         Consumer<WebAPI.WebAPIRequestException> error)
        Manually calls the specified Web API function with the provided details. This method is asynchronous.
        Parameters:
        httpMethod - The http request method. Either "POST" or "GET".
        function - The function name to call.
        version - The version of the function to call.
        parameters - A map of string key value pairs representing arguments to be passed to the API.
        callback - the callback that will be called with the resulting KeyValue object.
        error - the callback for handling response errors.
      • call

        public void call​(java.lang.String httpMethod,
                         java.lang.String function,
                         int version,
                         Consumer<KeyValue> callback,
                         Consumer<WebAPI.WebAPIRequestException> error)
                  throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is asynchronous.
        Parameters:
        httpMethod - The http request method. Either "POST" or "GET".
        function - The function name to call.
        version - The version of the function to call.
        callback - the callback that will be called with the resulting KeyValue object.
        error - the callback for handling response errors.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public void call​(java.lang.String httpMethod,
                         java.lang.String function,
                         java.util.Map<java.lang.String,​java.lang.String> parameters,
                         Consumer<KeyValue> callback,
                         Consumer<WebAPI.WebAPIRequestException> error)
                  throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is asynchronous.
        Parameters:
        httpMethod - The http request method. Either "POST" or "GET".
        function - The function name to call.
        parameters - A map of string key value pairs representing arguments to be passed to the API.
        callback - the callback that will be called with the resulting KeyValue object.
        error - the callback for handling response errors.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public void call​(java.lang.String httpMethod,
                         java.lang.String function,
                         Consumer<KeyValue> callback,
                         Consumer<WebAPI.WebAPIRequestException> error)
                  throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is asynchronous.
        Parameters:
        httpMethod - The http request method. Either "POST" or "GET".
        function - The function name to call.
        callback - the callback that will be called with the resulting KeyValue object.
        error - the callback for handling response errors.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public void call​(java.lang.String function,
                         int version,
                         Consumer<KeyValue> callback,
                         Consumer<WebAPI.WebAPIRequestException> error)
                  throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is asynchronous.
        Parameters:
        function - The function name to call.
        version - The version of the function to call.
        callback - the callback that will be called with the resulting KeyValue object.
        error - the callback for handling response errors.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public void call​(java.lang.String function,
                         java.util.Map<java.lang.String,​java.lang.String> parameters,
                         Consumer<KeyValue> callback,
                         Consumer<WebAPI.WebAPIRequestException> error)
                  throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is asynchronous.
        Parameters:
        function - The function name to call.
        parameters - A map of string key value pairs representing arguments to be passed to the API.
        callback - the callback that will be called with the resulting KeyValue object.
        error - the callback for handling response errors.
        Throws:
        java.io.IOException - if the request could not be executed
      • call

        public void call​(java.lang.String function,
                         Consumer<KeyValue> callback,
                         Consumer<WebAPI.WebAPIRequestException> error)
                  throws java.io.IOException
        Manually calls the specified Web API function with the provided details. This method is asynchronous.
        Parameters:
        function - The function name to call.
        callback - the callback that will be called with the resulting KeyValue object.
        error - the callback for handling response errors.
        Throws:
        java.io.IOException - if the request could not be executed
      • getBaseAddress

        public okhttp3.HttpUrl getBaseAddress()
      • getInterface

        public java.lang.String getInterface()
      • getWebAPIKey

        public java.lang.String getWebAPIKey()