getAttributes function

Future<PlayerAttributes> getAttributes(
  1. String accessToken
)

Gets player attributes. Some attributes define gameplay features which are enabled through XBOX live, which are presumably also parental control features. Attributes also give information about the ban status of a player.

Implementation

Future<PlayerAttributes> getAttributes(String accessToken) async {
  final headers = {
    'authorization': 'Bearer $accessToken',
  };
  final response = await request(
      http.get, _minecraftServicesApi, '/player/attributes',
      headers: headers);

  if (response.statusCode == 401) {
    throw AuthException(AuthException.invalidCredentialsMessage);
  }
  final map = parseResponseMap(response);
  return PlayerAttributes(map);
}