CompleteMatchWithSummaryData
Marks the given match as complete.
caution
Only a match whose current status is PENDING (at least one turn has occurred) or COMPLETE can be marked as COMPLETE
Service | Operation |
---|---|
asyncMatch | COMPLETE_MATCH_WITH_SUMMARY_DATA |
Method Parameters
Parameter | Description |
---|---|
ownerId | The match owner id. |
matchId | The match id. |
pushContent | Optional push notification message to send to the other party. Refer to the Push Notification functions for the syntax required. |
summary | Optional JSON object defining what the other player will see as a summary of the game when listing their games. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string ownerId = "the-owner-id";
string matchId = "the-match-id";
string pushContent = "An async-match has been completed!";
string summary = "{\"completedBy\":{\"display\":\"John Doe wins!\",\"player\":2,\"reason\":\"victory\"}}";
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.AsyncMatchService.CompleteMatchWithSummaryData(ownerId, matchId, pushContent, summary, successCallback, failureCallback);
const char *ownerId = "the-owner-id";
const char *matchId = "the-match-id";
const char *pushContent = "An async-match has been completed!";
const char *summary = "{\"completedBy\":{\"display\":\"John Doe wins!\",\"player\":2,\"reason\":\"victory\"}}";
_bc->getAsyncMatchService()->completeMatchWithSummaryData(ownerId, matchId, pushContent, summary, this);
NSString *ownerId = @"the-owner-id";
NSString *matchId = @"the-match-id";
NSString *pushContent = @"An async-match has been completed!";
NSString *summary = "{\"completedBy\":{\"display\":\"John Doe wins!\",\"player\":2,\"reason\":\"victory\"}}";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc asyncMatchService] completeMatchWithSummaryData:ownerId
matchId:matchId
pushContent:pushContent
summary:summary
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String ownerId = "the-owner-id";
String matchId = "the-match-id";
String pushContent = "An async-match has been completed!";
String summary = "{\"completedBy\":{\"display\":\"John Doe wins!\",\"player\":2,\"reason\":\"victory\"}}";
this; // implements IServerCallback
_bc.getAsyncMatchService().completeMatchWithSummaryData(ownerId, matchId, pushContent, summary, 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 ownerId = "the-owner-id";
var matchId = "the-match-id";
var pushContent = "An async-match has been completed!";
var summary = {
"completedBy": {
"display": "John Doe wins!",
"player": 2,
"reason": "victory"
}
};
_bc.asyncMatch.completeMatchWithSummaryData(ownerId, matchId, pushContent, summary, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var ownerId = "the-owner-id";
var matchId = "the-match-id";
var pushContent = "An async-match has been completed!";
var summary = {
"completedBy": {
"display": "John Doe wins!",
"player": 2,
"reason": "victory"
}
};
ServerResponse result = await _bc.asyncMatchService.completeMatchWithSummaryData(ownerId:ownerId, matchId:matchId, pushContent:pushContent, summary:summary);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var ownerId = "the-owner-id";
var matchId = "the-match-id";
var pushContent = "An async-match has been completed!";
var summary = {
"completedBy": {
"display": "John Doe wins!",
"player": 2,
"reason": "victory"
}
};
var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
var postResult = asyncMatchProxy.completeMatchWithSummaryData(ownerId, matchId, pushContent, summary);
if (postResult.status == 200) {
// Success!
}
{
"service": "asyncMatch",
"operation": "COMPLETE_MATCH_WITH_SUMMARY_DATA",
"data": {
"ownerId": "the-owner-id",
"matchId": "the-match-id",
"pushContent": "An async-match has been completed!",
"summary": {
"completedBy": {
"display": "John Doe wins!",
"player": 2,
"reason": "victory"
}
}
}
}
JSON Response
{
"status": 200,
"data": null
}