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 protected
QueryTelegramRequest(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 boolean
canEqual(java.lang.Object other)
boolean
equals(java.lang.Object o)
void
handleResponse(okhttp3.Response response)
Handle the response from the server, call any relevant callbacks and do error validationint
hashCode()
protected abstract boolean
isValid()
Checks validity of this request.void
setCallback(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.IOException
Description copied from interface:TelegramRequest
Handle 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:
equals
in classAbstractTelegramRequest
-
canEqual
protected boolean canEqual(java.lang.Object other)
- Overrides:
canEqual
in classAbstractTelegramRequest
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classAbstractTelegramRequest
-
setCallback
public void setCallback(java.util.function.Consumer<T> callback)
-
-