Search in sources :

Example 1 with GetIncensePokemonMessage

use of POGOProtos.Networking.Requests.Messages.GetIncensePokemonMessageOuterClass.GetIncensePokemonMessage in project PokeGOAPI-Java by Grover-c13.

the class Map method requestIncensePokemon.

/**
	 * Requests and returns incense pokemon from the server.
	 *
	 * @return the returned incense pokemon response
	 * @throws RequestFailedException if an exception occurred while sending requests
	 */
protected GetIncensePokemonResponse requestIncensePokemon() throws RequestFailedException {
    GetIncensePokemonMessage message = GetIncensePokemonMessage.newBuilder().setPlayerLatitude(api.getLatitude()).setPlayerLongitude(api.getLongitude()).build();
    ServerRequest request = new ServerRequest(RequestType.GET_INCENSE_POKEMON, message);
    api.getRequestHandler().sendServerRequests(request);
    try {
        return GetIncensePokemonResponse.parseFrom(request.getData());
    } catch (InvalidProtocolBufferException e) {
        throw new RequestFailedException(e);
    }
}
Also used : GetIncensePokemonMessage(POGOProtos.Networking.Requests.Messages.GetIncensePokemonMessageOuterClass.GetIncensePokemonMessage) RequestFailedException(com.pokegoapi.exceptions.request.RequestFailedException) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) ServerRequest(com.pokegoapi.main.ServerRequest)

Aggregations

GetIncensePokemonMessage (POGOProtos.Networking.Requests.Messages.GetIncensePokemonMessageOuterClass.GetIncensePokemonMessage)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 RequestFailedException (com.pokegoapi.exceptions.request.RequestFailedException)1 ServerRequest (com.pokegoapi.main.ServerRequest)1