use of POGOProtos.Data.PlayerBadgeOuterClass.PlayerBadge in project PokeGOAPI-Java by Grover-c13.
the class PlayerProfile method getProfile.
/**
* Performs a GET_PLAYER_PROFILE request.
*
* @throws RequestFailedException if an exception occurred while sending requests
*/
public void getProfile() throws RequestFailedException {
GetPlayerProfileMessage profileMessage = GetPlayerProfileMessage.newBuilder().setPlayerName("").build();
ServerRequest profileRequest = new ServerRequest(RequestType.GET_PLAYER_PROFILE, profileMessage);
api.requestHandler.sendServerRequests(profileRequest, true);
try {
GetPlayerProfileResponse response = GetPlayerProfileResponse.parseFrom(profileRequest.getData());
if (response.getResult() == GetPlayerProfileResponse.Result.SUCCESS) {
medals.clear();
List<PlayerBadge> badges = response.getBadgesList();
for (PlayerBadge badge : badges) {
medals.put(badge.getBadgeType(), new Medal(api, badge));
}
this.startTime = response.getStartTime();
}
} catch (InvalidProtocolBufferException e) {
throw new RequestFailedException(e);
}
}
Aggregations