AddGroupMember
Add a member to the group. Optional parameters: jsonAttributes.
Service | Operation |
---|---|
group | ADD_MEMBER_TO_GROUP |
Method Parameters
Parameter | Description |
---|---|
groupId | ID of the group |
profileId | Profile ID of the member being added |
role | Role of the member being added |
jsonAttributes | Attributes of the member being added |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string groupId = <%= data.example.groupId %>;
string profileId = <%= data.example.profileId %>;
BrainCloudGroup.Role role = BrainCloudGroup.Role.MEMBER;
string jsonAttributes = <%= data.example.jsonAttributes %>;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("[AddGroupMember Success] {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.GroupService.AddGroupMember(
groupId,
profileId,
role,
jsonAttributes,
successCallback,
failureCallback);
const char* groupId = <%= data.example.groupId %>;
const char* profileId = <%= data.example.profileId %>;
eGroupMember::Role role = eGroupMember::MEMBER;
std::string jsonAttributes = <%= data.example.jsonAttributes %>;
BrainCloudClient->getGroupService()->addGroupMember(groupId, profileId, role, jsonAttributes, this);
NSString * groupId = @<%= data.example.groupId %>;
NSString * profileId = @<%= data.example.profileId %>;
GroupMemberRole role = MEMBER;
NSString * jsonAttributes = @<%= data.example.jsonAttributes %>;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc groupService]
addGroupMember:groupId
profileId:profileId
role:role
jsonAttributes:jsonAttributes
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String groupId = <%= data.example.groupId %>;
String profileId = <%= data.example.profileId %>;
GroupService.Role role = GroupService.Role.MEMBER;
String jsonAttributes = <%= data.example.jsonAttributes %>;
<%= data.example.implementCallback %>
_bc.getGroupService().addGroupMember(groupId, profileId, role, jsonAttributes, this);
var groupId = <%= data.example.groupId %>;
var profileId = <%= data.example.profileId %>;
var role = "MEMBER";
var jsonAttributes = <%= data.example.jsonAttributes_js %>;
_bc.group.addGroupMember(groupId, profileId, role, attributes, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var groupId = <%= data.example.groupId %>;
var profileId = <%= data.example.profileId %>;
var role = "MEMBER";
var jsonAttributes = <%= data.example.jsonAttributes_js %>;
ServerResponse result = await _bc.groupService.addGroupMember(groupId:groupId, profileId:profileId, role:role, attributes:attributes);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var groupId = <%= data.example.groupId %>;
var profileId = <%= data.example.profileId %>;
var role = "MEMBER";
var jsonAttributes = <%= data.example.jsonAttributes_js %>;
var groupProxy = bridge.getGroupServiceProxy();
var retVal = groupProxy.addGroupMember(groupId, profileId, role, jsonAttributes);
{
"groupId": "a-group-id",
"profileId": "a-profile-id",
"role": "MEMBER",
"attributes": {}
}
JSON Response
{
"status": 200,
"data": null
}