Class UpdateTelegramRequest
- java.lang.Object
-
- com.jtelegram.api.requests.framework.AbstractTelegramRequest
-
- com.jtelegram.api.requests.framework.UpdateTelegramRequest
-
- All Implemented Interfaces:
TelegramRequest
- Direct Known Subclasses:
AnswerCallbackQuery,AnswerInlineQuery,AnswerPreCheckoutQuery,AnswerShippingQuery,DeleteChatStickerSet,DeleteSticker,DeleteWebhook,InputFileMessageUpdate,SendChatAction,SetChatStickerSet,SetStickerPosition,SetWebhook,UpdatableChatRequest
public abstract class UpdateTelegramRequest extends AbstractTelegramRequest
Not to be confused with Telegram Updates, this type of request doesn't have a result and merely just notifies the developer that the request was successful or there was an error.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.Runnablecallback-
Fields inherited from class com.jtelegram.api.requests.framework.AbstractTelegramRequest
errorHandler, gson
-
Fields inherited from interface com.jtelegram.api.requests.framework.TelegramRequest
JSON_MEDIA_TYPE
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedUpdateTelegramRequest(java.lang.String endPoint, java.util.function.Consumer<TelegramException> errorHandler, java.lang.Runnable callback)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidhandleResponse(okhttp3.Response response)Handle the response from the server, call any relevant callbacks and do error validationprotected abstract booleanisValid()Checks validity of this request.voidsetCallback(java.lang.Runnable callback)-
Methods inherited from class com.jtelegram.api.requests.framework.AbstractTelegramRequest
canEqual, equals, getBody, getEndPoint, handleError, handleException, hashCode, serialize, setErrorHandler, validate
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.jtelegram.api.requests.framework.TelegramRequest
build
-
-
-
-
Constructor Detail
-
UpdateTelegramRequest
protected UpdateTelegramRequest(java.lang.String endPoint, java.util.function.Consumer<TelegramException> errorHandler, java.lang.Runnable callback)
-
-
Method Detail
-
handleResponse
public void handleResponse(okhttp3.Response response) throws java.io.IOExceptionDescription copied from interface:TelegramRequestHandle the response from the server, call any relevant callbacks and do error validation- Parameters:
response- The response- Throws:
java.io.IOException- If any I/O error occurred
-
isValid
protected abstract boolean isValid()
Checks validity of this request. Internal method used before sending.- Returns:
- If it's valid
-
setCallback
public void setCallback(java.lang.Runnable callback)
-
-