CreateGroupEntity
Create an entity in the group. Optional parameters: entityType, acl and jsonData
Service | Operation |
---|---|
group | CREATE_GROUP_ENTITY |
Method Parameters
Parameter | Description |
---|---|
groupId | ID of the group |
entityType | Type of the group entity |
isOwnedByGroupMember | true if entity is owned by a member; false if owned by the entire group |
acl | Access control list for the group entity |
jsonData | Custom application data |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string groupId = "a-group-id";
string entityType = "myEntityType";
bool isOwnedByGroupMember = false;
GroupACL.Access memberAccess = GroupACL.Access.ReadWrite;
GroupACL.Access otherAccess = GroupACL.Access.None;
GroupACL acl = new GroupACL(otherAccess, memberAccess);
string jsonData = "{\"aKey\":\"aValue\"}";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};
_bc.Group.CreateGroupEntity(groupId, entityType, isOwnedByGroupMember, acl, jsonData, successCallback, failureCallback);
const char *groupId = "a-group-id";
const char *entityType = "myEntityType";
bool isOwnedByGroupMember = false;
const char *acl = "{\"member\":2,\"other\":1}";
const char *jsonData = "{\"aKey\":\"aValue\"}";
_bc->getGroup()->createGroupEntity(groupId, entityType, isOwnedByGroupMember, acl, jsonData, this);
NSString *groupId = @"a-group-id";
NSString *entityType = @"myEntityType";
bool isOwnedByGroupMember = false;
NSString *acl = @"{\"member\":2,\"other\":1}";
NSString *jsonData = @"{\"aKey\":\"aValue\"}";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc groupService] createGroupEntity:groupId
entityType:entityType
isOwnedByGroupMember:isOwnedByGroupMember
acl:acl
jsonData:jsonData
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String groupId = "a-group-id";
String entityType = "myEntityType";
boolean isOwnedByGroupMember = false;
GroupACL acl = new GroupACL(GroupACL.Access.None, GroupACL.Access.ReadWrite);
String jsonData = "{\"aKey\":\"aValue\"}";
this; // implements IServerCallback
_bc.getGroup().createGroupEntity(groupId, entityType, isOwnedByGroupMember, acl, jsonData, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var groupId = "a-group-id";
var entityType = "myEntityType";
var isOwnedByGroupMember = false;
var acl = {
"member": 2,
"other": 1
};
var jsonData = {
"aKey": "aValue"
};
_bc.group.createGroupEntity(groupId, entityType, isOwnedByGroupMember, acl, jsonData, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var groupId = "a-group-id";
var entityType = "myEntityType";
var isOwnedByGroupMember = false;
var acl = {
"member": 2,
"other": 1
};
var jsonData = {
"aKey": "aValue"
};
ServerResponse result = await _bc.groupService.createGroupEntity(groupId:groupId, entityType:entityType, isOwnedByGroupMember:isOwnedByGroupMember, acl:acl, data:jsonData);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var groupId = "a-group-id";
var isOwnedByGroupMember = false;
var entityType = "myEntityType";
var acl = {
"member": 2,
"other": 1
};
var jsonData = {
"aKey": "aValue"
};
var groupProxy = bridge.getGroupServiceProxy();
var postResult = groupProxy.createGroupEntity(groupId, isOwnedByGroupMember, entityType, acl, jsonData);
if (postResult.status == 200) {
// Success!
}
{
"service": "group",
"operation": "CREATE_GROUP_ENTITY",
"data": {
"groupId": "a-group-id",
"entityType": "myEntityType",
"isOwnedByGroupMember": false,
"acl": {
"member": 2,
"other": 1
},
"data": {
"aKey": "aValue"
}
}
}
JSON Response
{
"status": 200,
"data": {
"gameId": "20595",
"groupId": "fee55a37-5e86-43e8-942e-06bcbe1b701e",
"entityId": "91cfece7-debb-4698-ba6b-cd2cb432458d",
"ownerId": null,
"entityType": "BLUE",
"createdAt": 1462812680359,
"updatedAt": 1462812680359,
"version": 1,
"data": {},
"acl": {
"member": 2,
"other": 1
}
}
}