Interface ApiMethodMultiResponse
- All Superinterfaces:
ApiMethod<Serializable>
- All Known Implementing Classes:
EditMessageCaption, EditMessageLiveLocation, EditMessageReplyMarkup, EditMessageText, SetGameScore, StopMessageLiveLocation
Base API method that supports requests with multiple response types
-
Field Summary
Fields inherited from interface ApiMethod
OBJECT_MAPPER -
Method Summary
Modifier and TypeMethodDescriptiondefault @NotNull SerializabledeserializeResponse(@NotNull String answer) Deserializes the response from a string answer.default SerializabledeserializeResponse(String answer, List<Class<? extends Serializable>> possibleValues) Deserializes the response from a string answer using a list of possible classes.@NotNull List<Class<? extends Serializable>> Retrieves the list of classes representing possible types for deserialization of the response.Methods inherited from interface ApiMethod
deserializeResponse, deserializeResponseArray, deserializeResponseSerializable, getEndpointURL
-
Method Details
-
getSerializableClasses
Retrieves the list of classes representing possible types for deserialization of the response.- Returns:
- A
Listof classes extendingSerializable.
-
deserializeResponse
@NotNull default @NotNull Serializable deserializeResponse(@NotNull @NotNull String answer) throws TelegramRequestException Deserializes the response from a string answer.- Specified by:
deserializeResponsein interfaceApiMethod<Serializable>- Parameters:
answer- The string representing the response.- Returns:
- The deserialized response object.
- Throws:
TelegramRequestException- If an error occurs during deserialization.
-
deserializeResponse
default Serializable deserializeResponse(String answer, List<Class<? extends Serializable>> possibleValues) throws TelegramRequestException Deserializes the response from a string answer using a list of possible classes.- Parameters:
answer- The string representing the response.possibleValues- The list of possible classes for deserialization.- Returns:
- The deserialized response object. Null if an error occurs during deserialization.
- Throws:
TelegramRequestException- If an error occurs during deserialization.
-