get method

Future<Player> get(
  1. String playerId, {
  2. String? language,
  3. String? playerIdConsistencyToken,
  4. String? $fields,
})

Retrieves the Player resource with the given ID.

To retrieve the player for the currently authenticated user, set playerId to me.

Request parameters:

playerId - A player ID. A value of me may be used in place of the authenticated player's ID.

language - The preferred language to use for strings returned by this method.

playerIdConsistencyToken - Consistency token of the player id. The call returns a 'not found' result when the token is present and invalid. Empty value is ignored. See also GlobalPlayerIdConsistencyTokenProto

$fields - Selector specifying which fields to include in a partial response.

Completes with a Player.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<Player> get(
  core.String playerId, {
  core.String? language,
  core.String? playerIdConsistencyToken,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (language != null) 'language': [language],
    if (playerIdConsistencyToken != null)
      'playerIdConsistencyToken': [playerIdConsistencyToken],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'games/v1/players/' + commons.escapeVariable('$playerId');

  final response_ = await _requester.request(
    url_,
    'GET',
    queryParams: queryParams_,
  );
  return Player.fromJson(response_ as core.Map<core.String, core.dynamic>);
}