Interface ApiMethod<R extends Serializable>
- Type Parameters:
R- result type of the method
- All Known Subinterfaces:
ApiMethodBoolean, ApiMethodMessage, ApiMethodMultiResponse, ApiMethodString, MultiPartApiMethod<R>, MultiPartApiMethodBoolean, MultiPartApiMethodMessage
- All Known Implementing Classes:
AddStickerToSet, AnswerCallbackQuery, AnswerGuestQuery, AnswerInlineQuery, AnswerPreCheckoutQuery, AnswerShippingQuery, AnswerWebAppQuery, ApproveChatJoinRequest, ApproveSuggestedPost, BanChatMember, BanChatSenderChat, BatchCopyMessages, BatchDeleteMessages, BatchForwardMessages, CloseForumTopic, CloseGeneralForumTopic, ConvertGiftToStars, CopyMessage, CopyTextButton, CreateChatInviteLink, CreateChatSubscriptionInviteLink, CreateForumTopic, CreateInvoiceLink, CreateNewStickerSet, DeclineChatJoinRequest, DeclineSuggestedPost, DeleteAllMessageReactions, DeleteBusinessMessages, DeleteChatPhoto, DeleteChatStickerSet, DeleteForumTopic, DeleteMessage, DeleteMessageReaction, DeleteMyCommands, DeleteStickerFromSet, DeleteStickerSet, DeleteStory, DeleteWebhook, EditChatInviteLink, EditChatSubscriptionInviteLink, EditForumTopic, EditGeneralForumTopic, EditMessageCaption, EditMessageChecklist, EditMessageLiveLocation, EditMessageMedia, EditMessageReplyMarkup, EditMessageText, EditStory, EditUserStarSubscription, ExportChatInviteLink, ForwardMessage, GetAvailableGifts, GetBusinessAccountGifts, GetBusinessAccountStarBalance, GetBusinessConnection, GetChat, GetChatAdministrators, GetChatGifts, GetChatMember, GetChatMemberCount, GetChatMenuButton, GetCustomEmojiStickers, GetFile, GetForumTopicIconStickers, GetGameHighScores, GetManagedBotAccessSettings, GetManagedBotToken, GetMe, GetMyCommands, GetMyDefaultAdministratorRights, GetMyDescription, GetMyName, GetMyShortDescription, GetMyStarBalance, GetStarTransactions, GetStickerSet, GetUpdates, GetUserChatBoosts, GetUserGifts, GetUserPersonalChatMessages, GetUserProfileAudios, GetUserProfilePhotos, GetWebhookInfo, GiftPremiumSubscription, HideGeneralForumTopic, LeaveChat, PinChatMessage, PostStory, PromoteChatMember, ReadBusinessMessage, RefundStarPayment, RemoveBusinessAccountProfilePhoto, RemoveChatVerification, RemoveMyProfilePhoto, RemoveUserVerification, ReopenForumTopic, ReopenGeneralForumTopic, ReplaceManagedBotToken, ReplaceStickerInSet, RepostStory, RestrictChatMember, RevokeChatInviteLink, SavePreparedInlineMessage, SavePreparedKeyboardButton, SendAnimation, SendAudio, SendChatAction, SendChecklist, SendContact, SendDice, SendDocument, SendGame, SendGift, SendInvoice, SendLivePhoto, SendLocation, SendMediaGroup, SendMessage, SendMessageDraft, SendPaidMedia, SendPhoto, SendPoll, SendSticker, SendVenue, SendVideo, SendVideoNote, SendVoice, SetBusinessAccountBio, SetBusinessAccountGiftSettings, SetBusinessAccountName, SetBusinessAccountProfilePhoto, SetBusinessAccountUsername, SetChatAdministratorCustomTitle, SetChatDescription, SetChatMemberTag, SetChatMenuButton, SetChatPermissions, SetChatPhoto, SetChatStickerSet, SetChatTitle, SetCustomEmojiStickerSetThumbnail, SetGameScore, SetManagedBotAccessSettings, SetMessageReaction, SetMyCommands, SetMyDefaultAdministratorRights, SetMyDescription, SetMyName, SetMyProfilePhoto, SetMyShortDescription, SetPassportDataErrors, SetStickerEmojiList, SetStickerKeywords, SetStickerMaskPosition, SetStickerPositionInSet, SetStickerSetThumbnail, SetStickerSetTitle, SetUserEmojiStatus, SetWebhook, StopMessageLiveLocation, StopPoll, TransferBusinessAccountStars, TransferGift, UnbanChatMember, UnbanChatSenderChat, UnhideGeneralForumTopic, UnpinAllChatMessages, UnpinAllForumTopicMessages, UnpinAllGeneralForumTopicMessages, UnpinChatMessage, UpgradeGift, UploadStickerFile, VerifyChat, VerifyUser
public interface ApiMethod<R extends Serializable>
Base interface for all Telegram Bot API methods.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final tools.jackson.databind.json.JsonMapperThe object mapper used to serialize and deserialize objects to and from JSON. -
Method Summary
Modifier and TypeMethodDescriptiondeserializeResponse(@NotNull String answer) Deserializes the response from the Telegram Bot API.default RdeserializeResponse(@NotNull String answer, @NotNull Class<R> returnClass) Deserializes the response from the Telegram Bot API into a specific class.default <K extends Serializable>
RdeserializeResponseArray(@NotNull String answer, @NotNull Class<K> returnClass) Deserializes the response from the Telegram Bot API into an array of a specific class.default <K extends Serializable>
RdeserializeResponseSerializable(String answer, Class<K> returnClass) Deserializes the response from the Telegram Bot API into a specific serializable class@NotNull StringReturns the endpoint URL for the Telegram Bot API method.
-
Field Details
-
OBJECT_MAPPER
static final tools.jackson.databind.json.JsonMapper OBJECT_MAPPERThe object mapper used to serialize and deserialize objects to and from JSON.
-
-
Method Details
-
getEndpointURL
Returns the endpoint URL for the Telegram Bot API method.- Returns:
- the endpoint URL
-
deserializeResponse
@Internal @NotNull R deserializeResponse(@NotNull @NotNull String answer) throws TelegramRequestException Deserializes the response from the Telegram Bot API.- Parameters:
answer- the response from the Telegram Bot API- Returns:
- the deserialized response
- Throws:
TelegramRequestException- if an error occurs while deserializing the response
-
deserializeResponse
@Internal @NotNull default R deserializeResponse(@NotNull @NotNull String answer, @NotNull @NotNull Class<R> returnClass) throws TelegramRequestException Deserializes the response from the Telegram Bot API into a specific class.- Parameters:
answer- the response from the Telegram Bot APIreturnClass- the class to deserialize the response into- Returns:
- the deserialized response
- Throws:
TelegramRequestException- if an error occurs while deserializing the response
-
deserializeResponseArray
@Internal @NotNull default <K extends Serializable> R deserializeResponseArray(@NotNull @NotNull String answer, @NotNull @NotNull Class<K> returnClass) throws TelegramRequestException Deserializes the response from the Telegram Bot API into an array of a specific class.- Type Parameters:
K- the class to deserialize the response into- Parameters:
answer- the response from the Telegram Bot APIreturnClass- the class to deserialize the response into- Returns:
- the deserialized response
- Throws:
TelegramRequestException- if an error occurs while deserializing the response
-
deserializeResponseSerializable
@Internal default <K extends Serializable> R deserializeResponseSerializable(String answer, Class<K> returnClass) throws TelegramRequestException Deserializes the response from the Telegram Bot API into a specific serializable class- Type Parameters:
K- the class to deserialize the response into- Parameters:
answer- the response from the Telegram Bot APIreturnClass- the class to deserialize the response into- Returns:
- the deserialized response
- Throws:
TelegramRequestException- if an error occurs while deserializing the response
-