Search in sources :

Example 1 with GetHatchedEggsMessage

use of POGOProtos.Networking.Requests.Messages.GetHatchedEggsMessageOuterClass.GetHatchedEggsMessage in project PokeGOAPI-Java by Grover-c13.

the class Hatchery method queryHatchedEggs.

/**
 * Get if eggs has hatched.
 *
 * @return list of hatched eggs
 * @throws RequestFailedException if an exception occurred while sending requests
 * @deprecated Use getHatchedEggs()
 */
@Deprecated
public List<HatchedEgg> queryHatchedEggs() throws RequestFailedException {
    GetHatchedEggsMessage msg = GetHatchedEggsMessage.newBuilder().build();
    ServerRequest serverRequest = new ServerRequest(RequestType.GET_HATCHED_EGGS, msg);
    api.requestHandler.sendServerRequests(serverRequest, false);
    GetHatchedEggsResponse response;
    try {
        response = GetHatchedEggsResponse.parseFrom(serverRequest.getData());
    } catch (InvalidProtocolBufferException e) {
        throw new RequestFailedException(e);
    }
    api.inventories.updateInventories();
    return updateHatchedEggs(response);
}
Also used : GetHatchedEggsResponse(POGOProtos.Networking.Responses.GetHatchedEggsResponseOuterClass.GetHatchedEggsResponse) GetHatchedEggsMessage(POGOProtos.Networking.Requests.Messages.GetHatchedEggsMessageOuterClass.GetHatchedEggsMessage) RequestFailedException(com.pokegoapi.exceptions.request.RequestFailedException) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) ServerRequest(com.pokegoapi.main.ServerRequest)

Aggregations

GetHatchedEggsMessage (POGOProtos.Networking.Requests.Messages.GetHatchedEggsMessageOuterClass.GetHatchedEggsMessage)1 GetHatchedEggsResponse (POGOProtos.Networking.Responses.GetHatchedEggsResponseOuterClass.GetHatchedEggsResponse)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 RequestFailedException (com.pokegoapi.exceptions.request.RequestFailedException)1 ServerRequest (com.pokegoapi.main.ServerRequest)1