Class SFS2X.Entities.Variables.SFSUserVariable

The User Variable entity representation on the client.

Class Summary
Constructor Attributes Constructor Name and Description
 
Creates a new SFSUserVariable instance.

Field Summary

Method Summary

Class Detail

SFS2X.Entities.Variables.SFSUserVariable(name, value, type)
Creates a new SFSUserVariable instance.

A SFSUserVariable is a custom value attached to a SFSUser object that gets automatically synchronized between client and server on every change.

User Variables are particularly useful to store custom user data that must be "visible" to the other users, such as a profile, a score, a status message, etc. User Variables can be set by means of the SetUserVariablesRequest request; they support the following data types (also nested): Boolean, Number, String, Object, Array. A User Variable can also be null.

Parameters:
{String} name
The name of the User Variable.
{*} value
The value of the User Variable; valid data types are: Boolean, Number, String, Object, Array. The value can also be null.
{Number} type Optional, Default: -1
The type id of the User Variable among those available in the VariableType class. Usually it is not necessary to pass this parameter, as the type is auto-detected from the value.
See also:
SFS2X.Entities.Variables.VariableType
SFS2X.Entities.SFSUser
SFS2X.Requests.System.SetUserVariablesRequest

Field Detail

{Boolean} isPrivate
Indicates whether this User Variable is private or not. A private User Variable is visible only to its owner; any changes made to the variable will be transmitted to the owner only.

NOTE: setting the isPrivate property manually on an existing User Variable returned by the API has no effect on the server and can disrupt the API functioning. This flag can be set when the User Variable object is created using the constructor.

Method Detail

  • {String} toString()
    Returns a string that contains the User Variable name, type, value and isPrivate flag.
    Returns:
    {String} The string representation of the SFSUserVariable object.