Class RemoteFunctionBuilder


  • public class RemoteFunctionBuilder
    extends Object
    A utility class for building RemoteFunction instances.
    • Method Detail

      • create

        public static RemoteFunctionBuilder create​(String functionName)
        Create a new instance of RemoteFunctionBuilder that can be used to build instances of RemoteFunction. The provided functionName must map with the name of a remote function that is configured in Gluon CloudLink.
        Parameters:
        functionName - the name of the configured remote function to call
        Returns:
        a new instance of RemoteFunctionBuilder
      • cachingEnabled

        public RemoteFunctionBuilder cachingEnabled​(boolean cachingEnabled)
        Defines whether the responses from calls to the remote function should be cached locally in the private storage of the device's platform. Local caching is enabled by default.
        Parameters:
        cachingEnabled - true to enable local caching, false to disable it
        Returns:
        A reference to this builder.
        See Also:
        RemoteFunction.isCachingEnabled()
      • param

        public RemoteFunctionBuilder param​(String key,
                                           String value)
        Adds a function parameter with the specified key and value. If a parameter with the specified key was already provided before, the old value will be overwritten with the specified value.
        Parameters:
        key - the name of the parameter
        value - the value of the parameter
        Returns:
        A reference to this builder.
        See Also:
        RemoteFunction.getParams()
      • rawBody

        public RemoteFunctionBuilder rawBody​(byte[] rawBody)
        Defines the bytes that are sent as the raw body when executing the request to the remote function.
        Parameters:
        rawBody - the raw bytes to sent as the raw body for the remote function
        Returns:
        A reference to this builder.
        See Also:
        RemoteFunction.getRawBody()