use of POGOProtos.Networking.Requests.Messages.AddFortModifierMessageOuterClass.AddFortModifierMessage in project PokeGOAPI-Java by Grover-c13.
the class Pokestop method addModifierAsync.
/**
* Adds a modifier to this pokestop. (i.e. add a lure module)
*
* @param item the modifier to add to this pokestop
* @return true if success
*/
public Observable<Boolean> addModifierAsync(ItemId item) {
AddFortModifierMessage msg = AddFortModifierMessage.newBuilder().setModifierType(item).setFortId(getId()).setPlayerLatitude(api.getLatitude()).setPlayerLongitude(api.getLongitude()).build();
ServerRequest serverRequest = new ServerRequest(RequestTypeOuterClass.RequestType.ADD_FORT_MODIFIER, msg);
return api.getRequestHandler().sendAsyncServerRequests(serverRequest).map(new Func1<ByteString, Boolean>() {
@Override
public Boolean call(ByteString result) {
try {
//sadly the server response does not contain any information to verify if the request was
// successful
AddFortModifierResponseOuterClass.AddFortModifierResponse.parseFrom(result);
} catch (InvalidProtocolBufferException e) {
throw Exceptions.propagate(e);
}
return Boolean.TRUE;
}
});
}
Aggregations