CloudVariables ============== The CloudVariables Service provides support for storing variables on the cloud. Variables can be optionally password-protected or stored only for the current user. Cloud variables that are inactive (no reads or writes) for 30 days are subject to deletion. .. toctree:: :maxdepth: 2 :titlesonly: :caption: RPC Categories RPCS ---- .. function:: CloudVariables.deleteUserVariable(name: String) Delete the user variable for the current user. **Arguments:** - ``name: String`` (`String `__) - Variable name .. function:: CloudVariables.deleteVariable(name: String, password: String?) Delete a given cloud variable **Arguments:** - ``name: String`` (`String `__) - Variable to delete - ``password: String?`` (`String `__) - Password (if password-protected) .. function:: CloudVariables.getUserVariable(name: String) Get the value of a variable for the current user. **Arguments:** - ``name: String`` (`String `__) - Variable name **Returns:** ``Any`` (`Any `__) - the stored value .. function:: CloudVariables.getVariable(name: String, password: String?) Get the value of a cloud variable **Arguments:** - ``name: String`` (`String `__) - Variable name - ``password: String?`` (`String `__) - Password (if password-protected) **Returns:** ``Any`` (`Any `__) - the stored value .. function:: CloudVariables.listenToUserVariable(name: String, msgType: Any, duration: Duration?) Identical to :func:`CloudVariables.listenToVariable` except that it listens for updates on a user variable. **Arguments:** - ``name: String`` (`String `__) - Variable name - ``msgType: Any`` (`Any `__) - Message type to send each time the variable is updated - ``duration: Duration?`` (`Duration `__) - The maximum duration to listen for updates on the variable (default 1hr). .. function:: CloudVariables.listenToVariable(name: String, msgType: String, password: String?, duration: Duration?) Registers your client to receive messages each time the variable value is updated. ``name`` and ``password`` denote the variable to listen to. ``msgType`` is the name of the message that will be sent each time it is updated. The variable must already exist prior to calling this RPC. Update events will cease when the variable is deleted. **Message Fields** - ``name`` - the name of the variable that was updated - ``value`` - the new value of the variable **Arguments:** - ``name: String`` (`String `__) - Variable name - ``msgType: String`` (`String `__) - Message type to send each time the variable is updated - ``password: String?`` (`String `__) - Password (if password-protected) - ``duration: Duration?`` (`Duration `__) - The maximum duration to listen for updates on the variable (default 1hr). .. function:: CloudVariables.lockVariable(name: String, password: String?) Lock a given cloud variable. A locked variable cannot be changed by anyone other than the person who locked it. A variable cannot be locked for more than 5 seconds. **Arguments:** - ``name: String`` (`String `__) - Variable to lock - ``password: String?`` (`String `__) - Password (if password-protected) .. function:: CloudVariables.setUserVariable(name: String, value: Any) Set the value of the user cloud variable for the current user. **Arguments:** - ``name: String`` (`String `__) - Variable name - ``value: Any`` (`Any `__) - Value to store in variable .. function:: CloudVariables.setVariable(name: String, value: Any, password: String?) Set a cloud variable. If a password is provided on creation, the variable will be password-protected. **Arguments:** - ``name: String`` (`String `__) - Variable name - ``value: Any`` (`Any `__) - Value to store in variable - ``password: String?`` (`String `__) - Password (if password-protected) .. function:: CloudVariables.unlockVariable(name: String, password: String?) Unlock a given cloud variable. A locked variable cannot be changed by anyone other than the person who locked it. A variable cannot be locked for more than 5 minutes. **Arguments:** - ``name: String`` (`String `__) - Variable to delete - ``password: String?`` (`String `__) - Password (if password-protected)