use of POGOProtos.Networking.Responses.SetBuddyPokemonResponseOuterClass.SetBuddyPokemonResponse in project PokeGOAPI-Java by Grover-c13.
the class PlayerProfile method setBuddy.
/**
* Sets the current buddy
*
* @param pokemon the pokemon to set as your buddy
* @return if this task was successfull
* @throws RequestFailedException if an exception occurred while sending requests
*/
public boolean setBuddy(Pokemon pokemon) throws RequestFailedException {
SetBuddyPokemonMessageOuterClass.SetBuddyPokemonMessage message = SetBuddyPokemonMessageOuterClass.SetBuddyPokemonMessage.newBuilder().setPokemonId(pokemon.getId()).build();
ServerRequest request = new ServerRequest(RequestType.SET_BUDDY_POKEMON, message);
api.getRequestHandler().sendServerRequests(request);
try {
SetBuddyPokemonResponse response = SetBuddyPokemonResponse.parseFrom(request.getData());
buddy = new Buddy(api, response.getUpdatedBuddy());
return response.hasUpdatedBuddy();
} catch (InvalidProtocolBufferException e) {
throw new RequestFailedException(e);
}
}
Aggregations