Member API Adapter
The Member API Adapter provides methods to look up information about end users for your project and how they are divided across groups. It is based on query capabilities of the underlying RESTful Member API.
This is only needed for Authenticated projects, that is, team projects with end users and groups. For example, if some of your end users are facilitators, or if your end users should be treated differently based on which group they are in, use the Member API to find that information.
var ma = new F.service.Member({ token: 'user-or-project-access-token' });
ma.getGroupsForUser({ userId: 'b6b313a3-ab84-479c-baea-206f6bff337' });
ma.getGroupDetails({ groupId: '00b53308-9833-47f2-b21e-1278c07d53b8' });
Configuration Options
userId
- string
Epicenter user id. Defaults to a blank string.
groupId
- string
Epicenter group id. Defaults to a blank string. Note that this is the group id, not the group name.
transport
- object
Options to pass on to the underlying transport layer. All jquery.ajax options at http://api.jquery.com/jQuery.ajax/ are available. Defaults to empty object.
Methods
getGroupsForUser
Retrieve details about all of the group memberships for one end user. The membership details are returned in an array, with one element (group record) for each group to which the end user belongs.
In the membership array, each group record includes the group id, project id, account (team) id, and an array of members. However, only the user whose userId is included in the call is listed in the members array (regardless of whether there are other members in this group).
Example
var ma = new F.service.Member({ token: 'user-or-project-access-token' });
ma.getGroupsForUser('42836d4b-5b61-4fe4-80eb-3136e956ee5c')
.then(function(memberships){
for (var i=0; i<memberships.length; i++) {
console.log(memberships[i].groupId);
}
});
ma.getGroupsForUser({ userId: '42836d4b-5b61-4fe4-80eb-3136e956ee5c' });
Parameters
params
: string|object The user id for the end user. Alternatively, an object with fielduserId
and value the user id.options
: object (Optional) Overrides for configuration options.
getGroupDetails
Retrieve details about one group, including an array of all its members.
Example
var ma = new F.service.Member({ token: 'user-or-project-access-token' });
ma.getGroupDetails('80257a25-aa10-4959-968b-fd053901f72f')
.then(function(group){
for (var i=0; i<group.members.length; i++) {
console.log(group.members[i].userName);
}
});
ma.getGroupDetails({ groupId: '80257a25-aa10-4959-968b-fd053901f72f' });
Parameters
params
: string|object The group id. Alternatively, an object with fieldgroupId
and value the group id.options
: object (Optional) Overrides for configuration options.
makeUserActive
Set a particular end user as active
. Active end users can be assigned to worlds in multiplayer games during automatic assignment.
Example
var ma = new F.service.Member({ token: 'user-or-project-access-token' });
ma.makeUserActive({ userId: '42836d4b-5b61-4fe4-80eb-3136e956ee5c',
groupId: '80257a25-aa10-4959-968b-fd053901f72f' });
Parameters
params
: object The end user and group information.params.userId
: string The id of the end user to make active.params.groupId
: string The id of the group to which this end user belongs, and in which the end user should become active.options
: object (Optional) Overrides for configuration options.
makeUserInactive
Set a particular end user as inactive
. Inactive end users are not assigned to worlds in multiplayer games during automatic assignment.
Example
var ma = new F.service.Member({ token: 'user-or-project-access-token' });
ma.makeUserInactive({ userId: '42836d4b-5b61-4fe4-80eb-3136e956ee5c',
groupId: '80257a25-aa10-4959-968b-fd053901f72f' });
Parameters
params
: object The end user and group information.params.userId
: string The id of the end user to make inactive.params.groupId
: string The id of the group to which this end user belongs, and in which the end user should become inactive.options
: object (Optional) Overrides for configuration options.