Class QueryTelegramRequest<T>
- java.lang.Object
-
- com.jtelegram.api.requests.framework.AbstractTelegramRequest
-
- com.jtelegram.api.requests.framework.QueryTelegramRequest<T>
-
- All Implemented Interfaces:
TelegramRequest
- Direct Known Subclasses:
GetChat,GetChatAdministrators,GetChatMember,GetChatMembersCount,GetFile,GetGameHighScores,GetMe,GetStickerSet,GetUpdates,GetUserProfilePhotos,GetWebhookInfo,SendableChatRequest,SendableInlineRequest,SetGameScore,UploadStickerFile
public abstract class QueryTelegramRequest<T> extends AbstractTelegramRequest
A generic telegram request class which has a response beyond "OK"
-
-
Field Summary
-
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 protectedQueryTelegramRequest(java.lang.String endPoint, java.lang.Class<T> callbackType, java.util.function.Consumer<T> callback, java.util.function.Consumer<TelegramException> errorHandler)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(java.lang.Object other)booleanequals(java.lang.Object o)voidhandleResponse(okhttp3.Response response)Handle the response from the server, call any relevant callbacks and do error validationinthashCode()protected abstract booleanisValid()Checks validity of this request.voidsetCallback(java.util.function.Consumer<T> callback)-
Methods inherited from class com.jtelegram.api.requests.framework.AbstractTelegramRequest
getBody, getEndPoint, handleError, handleException, 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
-
QueryTelegramRequest
protected QueryTelegramRequest(java.lang.String endPoint, java.lang.Class<T> callbackType, java.util.function.Consumer<T> callback, java.util.function.Consumer<TelegramException> errorHandler)
-
-
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
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classAbstractTelegramRequest
-
canEqual
protected boolean canEqual(java.lang.Object other)
- Overrides:
canEqualin classAbstractTelegramRequest
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractTelegramRequest
-
setCallback
public void setCallback(java.util.function.Consumer<T> callback)
-
-