Class ScriptService

java.lang.Object
com.bitheads.braincloud.services.ScriptService

public class ScriptService
extends Object
  • Constructor Details

  • Method Details

    • runScript

      public void runScript​(String scriptName, String jsonScriptData, IServerCallback callback)
      Executes a script on the server. Service Name - Script Service Operation - Run
      Parameters:
      scriptName - The name of the script to be run
      jsonScriptData - Data to be sent to the script in json format
      callback - The callback handler See The API documentation site for more details on cloud code
    • scheduleRunScriptUTC

      public void scheduleRunScriptUTC​(String scriptName, String jsonScriptData, Date startTimeUTC, IServerCallback callback)
      Deprecated.
      Use scheduleRunScriptMillisUTC instead - Removal September 1, 2021
      Schedules a script to run at given UTC time.
      Parameters:
      scriptName - The name of the script with its path to be run.
      jsonScriptData - Data to be sent to the script in JSON format.
      startTimeUTC - The start date. (date in millis UTC)
      callback - The callback handler
    • scheduleRunScriptMillisUTC

      public void scheduleRunScriptMillisUTC​(String scriptName, String jsonScriptData, long startTimeUTC, IServerCallback callback)
      Allows cloud script executions to be scheduled Service Name - Script Service Operation - ScheduleCloudScript
      Parameters:
      scriptName - The name of the script to be run
      jsonScriptData - JSON bundle to pass to script
      startTimeUTC - The start date as a Date object
      callback - The callback handler See The API documentation site for more details on cloud code
    • scheduleRunScriptMinutes

      public void scheduleRunScriptMinutes​(String scriptName, String jsonScriptData, int minutesFromNow, IServerCallback callback)
      Allows cloud script executions to be scheduled Service Name - Script Service Operation - ScheduleCloudScript
      Parameters:
      scriptName - The name of the script to be run
      jsonScriptData - JSON bundle to pass to script
      minutesFromNow - Number of minutes from now to run script
      callback - The callback handler See The API documentation site for more details on cloud code
    • runParentScript

      public void runParentScript​(String scriptName, String scriptData, String parentLevel, IServerCallback callback)
      Run a cloud script in a parent app Service Name - Script Service Operation - RUN_PARENT_SCRIPT
      Parameters:
      scriptName - The name of the script to be run
      scriptData - Data to be sent to the script in json format
      parentLevel - The level name of the parent to run the script from
      callback - The method to be invoked when the server response is received See The API documentation site for more details on cloud code
    • getScheduledCloudScripts

      public void getScheduledCloudScripts​(Date startTimeUTC, IServerCallback callback)
      Allows cloud script executions to be scheduled Service Name - Script Service Operation - ScheduleCloudScript
      Parameters:
      startTimeUTC - The start date as a Date object
      callback - The method to be invoked when the server response is received See The API documentation site for more details on cloud code
    • getRunningOrQueuedCloudScripts

      public void getRunningOrQueuedCloudScripts​(IServerCallback callback)
      Allows cloud script executions to be scheduled Service Name - Script Service Operation - ScheduleCloudScript
      Parameters:
      callback - The method to be invoked when the server response is received See The API documentation site for more details on cloud code
    • cancelScheduledScript

      public void cancelScheduledScript​(String jobId, IServerCallback callback)
      Cancels a scheduled cloud code script Service Name - Script Service Operation - CANCEL_SCHEDULED_SCRIPT
      Parameters:
      jobId - The scheduled script job to cancel
      callback - The method to be invoked when the server response is received
    • runPeerScript

      public void runPeerScript​(String scriptName, String jsonScriptData, String peer, IServerCallback callback)
      Runs a script from the context of a peer Service Name - Script Service Operation - RUN_PEER_SCRIPT
      Parameters:
      scriptName - The name of the script to be run
      jsonScriptData - Data to be sent to the script in json format
      peer - Peer the script belongs to
      callback - The method to be invoked when the server response is received
    • runPeerScriptAsync

      public void runPeerScriptAsync​(String scriptName, String jsonScriptData, String peer, IServerCallback callback)
      Runs a script asynchronously from the context of a peer This method does not wait for the script to complete before returning Service Name - Script Service Operation - RUN_PEER_SCRIPT_ASYNC
      Parameters:
      scriptName - The name of the script to be run
      jsonScriptData - Data to be sent to the script in json format
      peer - Peer the script belongs to
      callback - The method to be invoked when the server response is received