ReadMatch
Returns the current state of the given match.
Service | Operation |
---|---|
asyncMatch | READ_MATCH |
Method Parameters
Parameter | Description |
---|---|
ownerId | Match owner identifier |
matchId | Match identifier |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string ownerId = "internalPlayerId";
string matchId = "matchId";
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.ReadMatch(ownerId, matchId, successCallback, failureCallback);
const char *ownerId = "internalPlayerId";
const char *matchId = "matchId";
_bc->getAsyncMatchService()->readMatch(ownerId, matchId, this);
NSString *ownerId = @"internalPlayerId";
NSString *matchId = @"matchId";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc asyncMatchService] readMatch:ownerId
matchId:matchId
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String ownerId = "internalPlayerId";
String matchId = "matchId";
this; // implements IServerCallback
_bc.getAsyncMatchService().readMatch(ownerId, matchId, 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 = "internalPlayerId";
var matchId = "matchId";
_bc.asyncMatch.readMatch(ownerId, matchId, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
var ownerId = "internalPlayerId";
var matchId = "matchId";
ServerResponse result = await _bc.asyncMatchService.readMatch(ownerId:ownerId, matchId:matchId);
if (result.statusCode == 200) {
print("Success");
} else {
print("Failed ${result.error['status_message'] ?? result.error}");
}
var ownerId = "internalPlayerId";
var matchId = "matchId";
var asyncMatchProxy = bridge.getAsyncMatchServiceProxy();
var postResult = asyncMatchProxy.readMatch(ownerId, matchId);
if (postResult.status == 200) {
// Success!
}
{
"service": "asyncMatch",
"operation": "READ_MATCH",
"data": {
"ownerId": "the-owner-id",
"matchId": "the-match-id"
}
}
JSON Response
{
"status": 200,
"data": {
"gameId": "11004",
"ownerId": "35e8698f-b14d-48ae-a37c-4b2962308b8d",
"matchId": "cfa752d6-d408-4671-9603-b22bf55d5379",
"version": 1,
"players": [{
"playerId": "35e8698f-b14d-48ae-a37c-4b2962308b8d",
"playerName": "",
"pictureUrl": null,
"summaryFriendData": null
}, {
"playerId": "e84c16ea-bd62-4307-83f9-d32f8ac18bca",
"playerName": "",
"pictureUrl": null,
"summaryFriendData": null
}],
"status": {
"status": "PENDING",
"currentPlayer": "e84c16ea-bd62-4307-83f9-d32f8ac18bca"
},
"summary": null,
"statistics": {},
"matchState": {
"testKey": "testValue"
},
"createdAt": 1472293357985,
"updatedAt": 1472293357996
}
}