Search in sources :

Example 1 with CheckChallengeMessage

use of POGOProtos.Networking.Requests.Messages.CheckChallengeMessageOuterClass.CheckChallengeMessage in project PokeGOAPI-Java by Grover-c13.

the class PokemonGo method checkChallenge.

/**
	 * Checks for a challenge / captcha
	 *
	 * @return the new challenge URL, if any
	 * @throws RequestFailedException if an exception occurred while sending requests
	 * @deprecated CHECK_CHALLENGE is sent as a common request, should not be needed
	 */
@Deprecated
public String checkChallenge() throws RequestFailedException {
    CheckChallengeMessage message = CheckChallengeMessage.newBuilder().build();
    try {
        ServerRequest request = new ServerRequest(RequestType.CHECK_CHALLENGE, message);
        ByteString responseData = getRequestHandler().sendServerRequests(request, false);
        CheckChallengeResponse response = CheckChallengeResponse.parseFrom(responseData);
        String newChallenge = response.getChallengeUrl();
        if (response.getShowChallenge() && newChallenge != null && newChallenge.length() > 0) {
            updateChallenge(newChallenge, true);
            return newChallenge;
        }
    } catch (InvalidProtocolBufferException e) {
        throw new RequestFailedException(e);
    }
    return null;
}
Also used : CheckChallengeMessage(POGOProtos.Networking.Requests.Messages.CheckChallengeMessageOuterClass.CheckChallengeMessage) RequestFailedException(com.pokegoapi.exceptions.request.RequestFailedException) ByteString(com.google.protobuf.ByteString) InvalidProtocolBufferException(com.google.protobuf.InvalidProtocolBufferException) CheckChallengeResponse(POGOProtos.Networking.Responses.CheckChallengeResponseOuterClass.CheckChallengeResponse) ByteString(com.google.protobuf.ByteString) ServerRequest(com.pokegoapi.main.ServerRequest)

Aggregations

CheckChallengeMessage (POGOProtos.Networking.Requests.Messages.CheckChallengeMessageOuterClass.CheckChallengeMessage)1 CheckChallengeResponse (POGOProtos.Networking.Responses.CheckChallengeResponseOuterClass.CheckChallengeResponse)1 ByteString (com.google.protobuf.ByteString)1 InvalidProtocolBufferException (com.google.protobuf.InvalidProtocolBufferException)1 RequestFailedException (com.pokegoapi.exceptions.request.RequestFailedException)1 ServerRequest (com.pokegoapi.main.ServerRequest)1