use of POGOProtos.Networking.Responses.GetPlayerProfileResponseOuterClass.GetPlayerProfileResponse 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.getRequestHandler().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(badge));
}
this.startTime = response.getStartTime();
}
} catch (InvalidProtocolBufferException e) {
throw new RequestFailedException(e);
}
}
Aggregations