JoinDivision
Similar to JoinTournament, except that you specify the division set id instead of the leaderboard id.
Returns the division instance id (i.e. leaderboardId) upon success. If joining the tournament requires a fee, it is possible to fail (if the user doesn't have enough currency).
| Service | Operation |
|---|---|
| tournament | JOIN_DIVISION |
Method Parameters
Method Parameters
| Parameter | Description |
|---|---|
| divSetId | Division set id. |
| tournamentCode | The code for the tournament to join (eg. free vs. premium, etc.) |
| initialScore | The initial score to give the player on the leaderboard. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string divSetId = "exampleDivSetId";
string tournamentCode = "exampleTournamentCode1";
int initialScore = 0;
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.TournamentService.JoinDivision(divSetId, tournamentCode, initialScore, successCallback, failureCallback);
const char *divSetId = "exampleDivSetId";
const char *tournamentCode = "exampleTournamentCode1";
int initialScore = 0;
_bc->getTournamentService()->joinDivision(divSetId, tournamentCode, initialScore, this);
NSString *divSetId = @"exampleDivSetId";
NSString *tournamentCode = @"exampleTournamentCode1";
int initialScore = 0;
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc tournamentService] joinDivision:divSetId
tournamentCode:tournamentCode
initialScore:initialScore
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String divSetId = "exampleDivSetId";
String tournamentCode = "exampleTournamentCode1";
int initialScore = 0;
this; // implements IServerCallback
_bc.getTournamentService().joinDivision(divSetId, tournamentCode, initialScore, 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 divSetId = "exampleDivSetId";
var tournamentCode = "exampleTournamentCode1";
var initialScore = 0;
_bc.tournament.joinDivision(divSetId, tournamentCode, initialScore, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var divSetId = "exampleDivSetId";
var tournamentCode = "exampleTournamentCode1";
var initialScore = 0;
ServerResponse result = await _bc.tournamentService.joinDivision(divSetId:divSetId, tournamentCode:tournamentCode, initialScore:initialScore);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var divSetId = "exampleDivSetId";
var tournamentCode = "exampleTournamentCode1";
var initialScore = 0;
var tournamentProxy = bridge.getTournamentServiceProxy();
var postResult = tournamentProxy.joinDivision(divSetId, tournamentCode, initialScore);
if (postResult.status == 200) {
// Success!
}
{
"service": "tournament",
"operation": "JOIN_DIVISION",
"data": {
"divSetId": "exampleDivSetId",
"tournamentCode": "exampleTournamentCode1",
"initialScore": 0
}
}
JSON Response
{
"data": {
"entryFee": {},
"createdAt": 1654717860000,
"balance": {
"currency": {
"coin": {
"consumed": 0,
"balance": 25000,
"purchased": 25000,
"awarded": 0
}
}
},
"leaderboardId": "^D^weekly^2",
"enrolled": true
},
"status": 200
}