Represents a turn-based match.
For a list of methods for this resource, see the end of this page.
Resource representations
This is a JSON template for a turn-based match resource object.
{ "kind": "games#turnBasedMatch", "matchId": string, "applicationId": string, "variant": integer, "status": string, "userMatchStatus": string, "participants": [ { "kind": "games#turnBasedMatchParticipant", "id": string, "player": players Resource, "autoMatchedPlayer": { "kind": "games#anonymousPlayer", "displayName": string, "avatarImageUrl": string }, "autoMatched": boolean, "status": string } ], "creationDetails": { "kind": "games#turnBasedMatchModification", "participantId": string, "modifiedTimestampMillis": long }, "lastUpdateDetails": { "kind": "games#turnBasedMatchModification", "participantId": string, "modifiedTimestampMillis": long }, "autoMatchingCriteria": { "kind": "games#turnBasedAutoMatchingCriteria", "minAutoMatchingPlayers": integer, "maxAutoMatchingPlayers": integer, "exclusiveBitmask": long }, "data": { "kind": "games#turnBasedMatchData", "dataAvailable": boolean, "data": bytes }, "results": [ { "kind": "games#participantResult", "participantId": string, "result": string, "placing": integer } ], "inviterId": string, "withParticipantId": string, "description": string, "pendingParticipantId": string, "matchVersion": integer, "rematchId": string, "matchNumber": integer, "previousMatchData": { "kind": "games#turnBasedMatchData", "dataAvailable": boolean, "data": bytes } }
Property name | Value | Description | Notes |
---|---|---|---|
applicationId |
string |
The ID of the application being played. | |
autoMatchingCriteria |
nested object |
Criteria for auto-matching players into this match. | |
autoMatchingCriteria.exclusiveBitmask |
long |
A bitmask indicating when auto-matches are valid. When ANDed with other exclusive bitmasks, the result must be zero. Can be used to support exclusive roles within a game. | |
autoMatchingCriteria.kind |
string |
Uniquely identifies the type of this resource. Value is always the fixed string games#turnBasedAutoMatchingCriteria . |
|
autoMatchingCriteria.maxAutoMatchingPlayers |
integer |
The maximum number of players that should be added to the match by auto-matching. | |
autoMatchingCriteria.minAutoMatchingPlayers |
integer |
The minimum number of players that should be added to the match by auto-matching. | |
creationDetails |
nested object |
Details about the match creation. | |
creationDetails.kind |
string |
Uniquely identifies the type of this resource. Value is always the fixed string games#turnBasedMatchModification . |
|
creationDetails.modifiedTimestampMillis |
long |
The timestamp at which they modified the match, in milliseconds since the epoch in UTC. | |
creationDetails.participantId |
string |
The ID of the participant that modified the match. | |
data |
nested object |
The data / game state for this match. | |
data.data |
bytes |
The byte representation of the data (limited to 128 kB), as a Base64-encoded string with the URL_SAFE encoding option. | |
data.dataAvailable |
boolean |
True if this match has data available but it wasn't returned in a list response; fetching the match individually will retrieve this data. | |
data.kind |
string |
Uniquely identifies the type of this resource. Value is always the fixed string games#turnBasedMatchData . |
|
description |
string |
This short description is generated by our servers based on turn state and is localized and worded relative to the player requesting the match. It is intended to be displayed when the match is shown in a list. | |
inviterId |
string |
The ID of the participant that invited the user to the match. Not set if the user was not invited to the match. | |
kind |
string |
Uniquely identifies the type of this resource. Value is always the fixed string games#turnBasedMatch . |
|
lastUpdateDetails |
nested object |
Details about the last update to the match. | |
lastUpdateDetails.kind |
string |
Uniquely identifies the type of this resource. Value is always the fixed string games#turnBasedMatchModification . |
|
lastUpdateDetails.modifiedTimestampMillis |
long |
The timestamp at which they modified the match, in milliseconds since the epoch in UTC. | |
lastUpdateDetails.participantId |
string |
The ID of the participant that modified the match. | |
matchId |
string |
Globally unique ID for a turn-based match. | |
matchNumber |
integer |
The number of the match in a chain of rematches. Will be set to 1 for the first match and incremented by 1 for each rematch. | |
matchVersion |
integer |
The version of this match: an increasing counter, used to avoid out-of-date updates to the match. | |
participants[] |
list |
The participants involved in the match, along with their statuses. Includes participants who have left or declined invitations. | |
participants[].autoMatched |
boolean |
True if this participant was auto-matched with the requesting player. | |
participants[].autoMatchedPlayer |
nested object |
Information about a player that has been anonymously auto-matched against the requesting player. (Either player or autoMatchedPlayer will be set.) |
|
participants[].autoMatchedPlayer.avatarImageUrl |
string |
The base URL for the image to display for the anonymous player. | |
participants[].autoMatchedPlayer.displayName |
string |
The name to display for the anonymous player. | |
participants[].autoMatchedPlayer.kind |
string |
Uniquely identifies the type of this resource. Value is always the fixed string games#anonymousPlayer . |
|
participants[].id |
string |
An identifier for the participant in the scope of the match. Cannot be used to identify a player across matches or in other contexts. | |
participants[].kind |
string |
Uniquely identifies the type of this resource. Value is always the fixed string games#turnBasedMatchParticipant . |
|
participants[].player |
nested object |
Information about the player. Not populated if this player was anonymously auto-matched against the requesting player. (Either player or autoMatchedPlayer will be set.) |
|
participants[].status |
string |
The status of the participant with respect to the match. Possible values are:
Acceptable values are:
|
|
pendingParticipantId |
string |
The ID of the participant that is taking a turn. | |
previousMatchData |
nested object |
The data / game state for the previous match; set for the first turn of rematches only. | |
previousMatchData.data |
bytes |
The byte representation of the data (limited to 128 kB), as a Base64-encoded string with the URL_SAFE encoding option. | |
previousMatchData.dataAvailable |
boolean |
True if this match has data available but it wasn't returned in a list response; fetching the match individually will retrieve this data. | |
previousMatchData.kind |
string |
Uniquely identifies the type of this resource. Value is always the fixed string games#turnBasedMatchData . |
|
rematchId |
string |
The ID of a rematch of this match. Only set for completed matches that have been rematched. | |
results[] |
list |
The results reported for this match. | |
results[].kind |
string |
Uniquely identifies the type of this resource. Value is always the fixed string games#participantResult . |
|
results[].participantId |
string |
The ID of the participant. | |
results[].placing |
integer |
The placement or ranking of the participant in the match results; a number from one to the number of participants in the match. Multiple participants may have the same placing value in case of a type. | |
results[].result |
string |
The result of the participant for this match. Possible values are:
Acceptable values are:
|
|
status |
string |
The status of the match. Possible values are:
Acceptable values are:
|
|
userMatchStatus |
string |
The status of the current user in the match. Derived from the match type, match status, the user's participant status, and the pending participant for the match. Possible values are:
Acceptable values are:
|
|
variant |
integer |
The variant / mode of the application being played; can be any integer value, or left blank. | |
withParticipantId |
string |
The ID of another participant in the match that can be used when describing the participants the user is playing with. |
Methods
- cancel
- Cancel a turn-based match.
- create
- Create a turn-based match.
- decline
- Decline an invitation to play a turn-based match.
- dismiss
- Dismiss a turn-based match from the match list. The match will no longer show up in the list and will not generate notifications.
- finish
- Finish a turn-based match. Each player should make this call once, after all results are in. Only the player whose turn it is may make the first call to Finish, and can pass in the final match state.
- get
- Get the data for a turn-based match.
- join
- Join a turn-based match.
- leave
- Leave a turn-based match when it is not the current player's turn, without canceling the match.
- leaveTurn
- Leave a turn-based match during the current player's turn, without canceling the match.
- list
- Returns turn-based matches the player is or was involved in.
- rematch
- Create a rematch of a match that was previously completed, with the same participants. This can be called by only one player on a match still in their list; the player must have called Finish first. Returns the newly created match; it will be the caller's turn.
- sync
- Returns turn-based matches the player is or was involved in that changed since the last sync call, with the least recent changes coming first. Matches that should be removed from the local cache will have a status of
MATCH_DELETED
. - takeTurn
- Commit the results of a player turn.