Search in sources :

Example 1 with GetGymDetailsMessage

use of POGOProtos.Networking.Requests.Messages.GetGymDetailsMessageOuterClass.GetGymDetailsMessage in project PokeGOAPI-Java by Grover-c13.

the class Gym method details.

private GetGymDetailsResponse details() throws RequestFailedException {
    if (details == null) {
        GetGymDetailsMessage reqMsg = GetGymDetailsMessage.newBuilder().setGymId(this.getId()).setGymLatitude(this.getLatitude()).setGymLongitude(this.getLongitude()).setPlayerLatitude(api.getLatitude()).setPlayerLongitude(api.getLongitude()).build();
        ServerRequest serverRequest = new ServerRequest(RequestType.GET_GYM_DETAILS, reqMsg);
        api.getRequestHandler().sendServerRequests(serverRequest, true);
        try {
            details = GetGymDetailsResponse.parseFrom(serverRequest.getData());
        } catch (InvalidProtocolBufferException e) {
            throw new RequestFailedException();
        }
    }
    return details;
}
Also used : GetGymDetailsMessage(POGOProtos.Networking.Requests.Messages.GetGymDetailsMessageOuterClass.GetGymDetailsMessage) RequestFailedException(com.pokegoapi.exceptions.request.RequestFailedException) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) ServerRequest(com.pokegoapi.main.ServerRequest)

Aggregations

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