From 97e0aaa10fef219993932797289878566b78fe84 Mon Sep 17 00:00:00 2001 From: Rubenlagus Date: Wed, 2 Jan 2019 15:16:03 +0100 Subject: [PATCH] Fix inheritance of deprecated methods --- Bots.ipr | 133 +++++++++++---- .../DeleteStickerSetName.java | 83 +--------- .../GetChatMemberCount.java | 75 +-------- .../GetChatMembersCount.java | 8 +- .../chached/InlineQueryResultCachedAudio.java | 126 +-------------- .../InlineQueryResultCachedDocument.java | 152 +----------------- .../chached/InlineQueryResultCachedGif.java | 135 +--------------- .../InlineQueryResultCachedMpeg4Gif.java | 139 +--------------- .../chached/InlineQueryResultCachedPhoto.java | 148 +---------------- .../InlineQueryResultCachedSticker.java | 99 +----------- .../chached/InlineQueryResultCachedVideo.java | 148 +---------------- .../chached/InlineQueryResultCachedVoice.java | 135 +--------------- 12 files changed, 117 insertions(+), 1264 deletions(-) diff --git a/Bots.ipr b/Bots.ipr index 992b5bc6..4402de7d 100644 --- a/Bots.ipr +++ b/Bots.ipr @@ -220,7 +220,6 @@ - @@ -501,7 +500,7 @@ - + @@ -896,70 +895,92 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + @@ -973,15 +994,37 @@ - + - + - + - + + + + + + + + + + + + + + + + + + + + + + + @@ -1292,6 +1335,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -1622,15 +1687,15 @@ - + - + - + - + diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteStickerSetName.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteStickerSetName.java index dcf72224..23154628 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteStickerSetName.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/DeleteStickerSetName.java @@ -1,17 +1,5 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.type.TypeReference; -import org.telegram.telegrambots.meta.api.methods.BotApiMethod; -import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; -import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; -import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; - -import java.io.IOException; -import java.util.Objects; - -import static com.google.common.base.Preconditions.checkNotNull; - /** * @author Ruben Bermudez * @version 3.4 @@ -22,74 +10,5 @@ import static com.google.common.base.Preconditions.checkNotNull; * @deprecated Replaced by {@link DeleteChatStickerSet} */ @Deprecated -public class DeleteStickerSetName extends BotApiMethod { - public static final String PATH = "deleteChatStickerSet"; - - private static final String CHATID_FIELD = "chat_id"; - - @JsonProperty(CHATID_FIELD) - private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) - - public DeleteStickerSetName() { - super(); - } - - public DeleteStickerSetName(String chatId) { - super(); - this.chatId = checkNotNull(chatId); - } - - public DeleteStickerSetName(Long chatId) { - super(); - this.chatId = checkNotNull(chatId).toString(); - } - - public String getChatId() { - return chatId; - } - - public DeleteStickerSetName setChatId(String chatId) { - this.chatId = chatId; - return this; - } - - public DeleteStickerSetName setChatId(Long chatId) { - Objects.requireNonNull(chatId); - this.chatId = chatId.toString(); - return this; - } - - @Override - public String getMethod() { - return PATH; - } - - @Override - public Boolean deserializeResponse(String answer) throws TelegramApiRequestException { - try { - ApiResponse result = OBJECT_MAPPER.readValue(answer, - new TypeReference>(){}); - if (result.getOk()) { - return result.getResult(); - } else { - throw new TelegramApiRequestException("Error deleting sticker set name", result); - } - } catch (IOException e) { - throw new TelegramApiRequestException("Unable to deserialize response", e); - } - } - - @Override - public void validate() throws TelegramApiValidationException { - if (chatId == null || chatId.isEmpty()) { - throw new TelegramApiValidationException("ChatId can't be empty", this); - } - } - - @Override - public String toString() { - return "GetChat{" + - "chatId='" + chatId + '\'' + - '}'; - } +public class DeleteStickerSetName extends DeleteChatStickerSet { } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCount.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCount.java index 39fbb39f..6724a9ec 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCount.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMemberCount.java @@ -1,82 +1,11 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration; -import com.fasterxml.jackson.annotation.JsonProperty; -import com.fasterxml.jackson.core.type.TypeReference; - -import org.telegram.telegrambots.meta.api.methods.BotApiMethod; -import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; -import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; -import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; - -import java.io.IOException; -import java.util.Objects; - /** * @author Ruben Bermudez * @version 1.0 - * @brief Use this method to get the number of members in a chat. Returns Int on success. - * @date 20 of May of 2016 + * Use this method to get the number of members in a chat. Returns Int on success. * @deprecated Replaced by {@link GetChatMembersCount} */ @Deprecated -public class GetChatMemberCount extends BotApiMethod { - public static final String PATH = "getChatMembersCount"; - - private static final String CHATID_FIELD = "chat_id"; - - @JsonProperty(CHATID_FIELD) - private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) - - public GetChatMemberCount() { - super(); - } - - public String getChatId() { - return chatId; - } - - public GetChatMemberCount setChatId(String chatId) { - this.chatId = chatId; - return this; - } - - public GetChatMemberCount setChatId(Long chatId) { - Objects.requireNonNull(chatId); - this.chatId = chatId.toString(); - return this; - } - - @Override - public String getMethod() { - return PATH; - } - - @Override - public Integer deserializeResponse(String answer) throws TelegramApiRequestException { - try { - ApiResponse result = OBJECT_MAPPER.readValue(answer, - new TypeReference>(){}); - if (result.getOk()) { - return result.getResult(); - } else { - throw new TelegramApiRequestException("Error getting chat member count", result); - } - } catch (IOException e) { - throw new TelegramApiRequestException("Unable to deserialize response", e); - } - } - - @Override - public void validate() throws TelegramApiValidationException { - if (chatId == null || chatId.isEmpty()) { - throw new TelegramApiValidationException("ChatId can't be empty", this); - } - } - - @Override - public String toString() { - return "GetChatMemberCount{" + - "chatId='" + chatId + '\'' + - '}'; - } +public class GetChatMemberCount extends GetChatMembersCount { } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMembersCount.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMembersCount.java index be757c73..16b91d3a 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMembersCount.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/methods/groupadministration/GetChatMembersCount.java @@ -2,18 +2,18 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration; import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.core.type.TypeReference; -import java.io.IOException; -import java.util.Objects; import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; +import java.io.IOException; +import java.util.Objects; + /** * @author Ruben Bermudez * @version 1.0 - * @brief Use this method to get the number of members in a chat. Returns Int on success. - * @date 20 of May of 2016 + * Use this method to get the number of members in a chat. Returns Int on success. */ public class GetChatMembersCount extends BotApiMethod { public static final String PATH = "getChatMembersCount"; diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedAudio.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedAudio.java index f7b67ad4..68ac6663 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedAudio.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedAudio.java @@ -1,137 +1,15 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached; -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; -import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; -import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; -import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; - /** * @author Ruben Bermudez * @version 1.0 - * @brief Represents a link to an mp3 audio file stored on the Telegram servers. By default, this + * Represents a link to an mp3 audio file stored on the Telegram servers. By default, this * audio file will be sent by the user. Alternatively, you can use input_message_content to send a * message with the specified content instead of the audio. * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * ignore them. - * @date 10 of April of 2016 * @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedAudio} */ @Deprecated -public class InlineQueryResultCachedAudio implements InlineQueryResult { - - private static final String TYPE_FIELD = "type"; - private static final String ID_FIELD = "id"; - private static final String AUDIO_FILE_ID_FIELD = "audio_file_id"; - private static final String INPUTMESSAGECONTENT_FIELD = "input_message_content"; - private static final String REPLY_MARKUP_FIELD = "reply_markup"; - private static final String CAPTION_FIELD = "caption"; - private static final String PARSEMODE_FIELD = "parse_mode"; - - @JsonProperty(TYPE_FIELD) - private final String type = "audio"; ///< Type of the result, must be "audio" - @JsonProperty(ID_FIELD) - private String id; ///< Unique identifier of this result - @JsonProperty(AUDIO_FILE_ID_FIELD) - private String audioFileId; ///< A valid file identifier for the audio file - @JsonProperty(INPUTMESSAGECONTENT_FIELD) - private InputMessageContent inputMessageContent; ///< Optional. Content of the message to be sent instead of the audio - @JsonProperty(REPLY_MARKUP_FIELD) - private InlineKeyboardMarkup replyMarkup; ///< Optional. Inline keyboard attached to the message - @JsonProperty(CAPTION_FIELD) - private String caption; ///< Optional. Audio caption (may also be used when resending documents by file_id), 0-200 characters - @JsonProperty(PARSEMODE_FIELD) - private String parseMode; ///< Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - - public InlineQueryResultCachedAudio() { - super(); - } - - public String getType() { - return type; - } - - public String getId() { - return id; - } - - public InlineQueryResultCachedAudio setId(String id) { - this.id = id; - return this; - } - - public String getAudioFileId() { - return audioFileId; - } - - public InlineQueryResultCachedAudio setAudioFileId(String audioFileId) { - this.audioFileId = audioFileId; - return this; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public InlineQueryResultCachedAudio setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - return this; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public InlineQueryResultCachedAudio setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - return this; - } - - public String getCaption() { - return caption; - } - - public InlineQueryResultCachedAudio setCaption(String caption) { - this.caption = caption; - return this; - } - - public String getParseMode() { - return parseMode; - } - - public InlineQueryResultCachedAudio setParseMode(String parseMode) { - this.parseMode = parseMode; - return this; - } - - @Override - public void validate() throws TelegramApiValidationException { - if (id == null || id.isEmpty()) { - throw new TelegramApiValidationException("ID parameter can't be empty", this); - } - if (audioFileId == null || audioFileId.isEmpty()) { - throw new TelegramApiValidationException("AudioFileId parameter can't be empty", this); - } - if (inputMessageContent != null) { - inputMessageContent.validate(); - } - if (replyMarkup != null) { - replyMarkup.validate(); - } - } - - @Override - public String toString() { - return "InlineQueryResultCachedAudio{" + - "type='" + type + '\'' + - ", id='" + id + '\'' + - ", audioFileId='" + audioFileId + '\'' + - ", inputMessageContent=" + inputMessageContent + - ", replyMarkup=" + replyMarkup + - ", caption='" + caption + '\'' + - ", parseMode='" + parseMode + '\'' + - '}'; - } +public class InlineQueryResultCachedAudio extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedAudio { } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedDocument.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedDocument.java index fa3549cc..e20809af 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedDocument.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedDocument.java @@ -1,12 +1,5 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached; -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; -import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; -import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; -import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; - /** * @author Ruben Bermudez * @version 1.0 @@ -19,148 +12,5 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; * @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedDocument} */ @Deprecated -public class InlineQueryResultCachedDocument implements InlineQueryResult { - - private static final String TYPE_FIELD = "type"; - private static final String ID_FIELD = "id"; - private static final String TITLE_FIELD = "title"; - private static final String DOCUMENT_FILE_ID_FIELD = "document_file_id"; - private static final String DESCRIPTION_FIELD = "description"; - private static final String CAPTION_FIELD = "caption"; - private static final String REPLY_MARKUP_FIELD = "reply_markup"; - private static final String INPUTMESSAGECONTENT_FIELD = "input_message_content"; - private static final String PARSEMODE_FIELD = "parse_mode"; - - @JsonProperty(TYPE_FIELD) - private final String type = "document"; ///< Type of the result, must be "document" - @JsonProperty(ID_FIELD) - private String id; ///< Unique identifier of this result, 1-64 bytes - @JsonProperty(TITLE_FIELD) - private String title; ///< Optional. Title for the result - @JsonProperty(DOCUMENT_FILE_ID_FIELD) - private String documentFileId; ///< A valid file identifier for the file - @JsonProperty(DESCRIPTION_FIELD) - private String description; ///< Optional. Short description of the result - @JsonProperty(CAPTION_FIELD) - private String caption; ///< Optional. Caption of the document to be sent, 0-200 characters - @JsonProperty(REPLY_MARKUP_FIELD) - private InlineKeyboardMarkup replyMarkup; ///< Optional. Inline keyboard attached to the message - @JsonProperty(INPUTMESSAGECONTENT_FIELD) - private InputMessageContent inputMessageContent; ///< Optional. Content of the message to be sent instead of the file - @JsonProperty(PARSEMODE_FIELD) - private String parseMode; ///< Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - - public InlineQueryResultCachedDocument() { - super(); - } - - public String getType() { - return type; - } - - public String getId() { - return id; - } - - public InlineQueryResultCachedDocument setId(String id) { - this.id = id; - return this; - } - - public String getTitle() { - return title; - } - - public InlineQueryResultCachedDocument setTitle(String title) { - this.title = title; - return this; - } - - public String getDocumentFileId() { - return documentFileId; - } - - public InlineQueryResultCachedDocument setDocumentFileId(String documentFileId) { - this.documentFileId = documentFileId; - return this; - } - - public String getDescription() { - return description; - } - - public InlineQueryResultCachedDocument setDescription(String description) { - this.description = description; - return this; - } - - public String getCaption() { - return caption; - } - - public InlineQueryResultCachedDocument setCaption(String caption) { - this.caption = caption; - return this; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public InlineQueryResultCachedDocument setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - return this; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public InlineQueryResultCachedDocument setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - return this; - } - - public String getParseMode() { - return parseMode; - } - - public InlineQueryResultCachedDocument setParseMode(String parseMode) { - this.parseMode = parseMode; - return this; - } - - @Override - public void validate() throws TelegramApiValidationException { - if (id == null || id.isEmpty()) { - throw new TelegramApiValidationException("ID parameter can't be empty", this); - } - if (documentFileId == null || documentFileId.isEmpty()) { - throw new TelegramApiValidationException("DocumentFileId parameter can't be empty", this); - } - if (title == null || title.isEmpty()) { - throw new TelegramApiValidationException("Title parameter can't be empty", this); - } - if (inputMessageContent != null) { - inputMessageContent.validate(); - } - if (replyMarkup != null) { - replyMarkup.validate(); - } - } - - @Override - public String toString() { - return "InlineQueryResultCachedDocument{" + - "type='" + type + '\'' + - ", id='" + id + '\'' + - ", title='" + title + '\'' + - ", documentFileId='" + documentFileId + '\'' + - ", description='" + description + '\'' + - ", caption='" + caption + '\'' + - ", replyMarkup=" + replyMarkup + - ", inputMessageContent=" + inputMessageContent + - ", parseMode='" + parseMode + '\'' + - '}'; - } +public class InlineQueryResultCachedDocument extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedDocument { } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedGif.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedGif.java index fb484cfd..d5c89e03 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedGif.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedGif.java @@ -1,12 +1,5 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached; -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; -import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; -import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; -import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; - /** * @author Ruben Bermudez * @version 1.0 @@ -16,131 +9,5 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; * @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedGif} */ @Deprecated -public class InlineQueryResultCachedGif implements InlineQueryResult { - private static final String TYPE_FIELD = "type"; - private static final String ID_FIELD = "id"; - private static final String GIF_FILE_ID_FIELD = "gif_file_id"; - private static final String TITLE_FIELD = "title"; - private static final String CAPTION_FIELD = "caption"; - private static final String INPUTMESSAGECONTENT_FIELD = "input_message_content"; - private static final String REPLY_MARKUP_FIELD = "reply_markup"; - private static final String PARSEMODE_FIELD = "parse_mode"; - - @JsonProperty(TYPE_FIELD) - private final String type = "gif"; ///< Type of the result, must be "gif" - @JsonProperty(ID_FIELD) - private String id; ///< Unique identifier of this result, 1-64 bytes - @JsonProperty(GIF_FILE_ID_FIELD) - private String gifFileId; ///< A valid file identifier for the GIF file - @JsonProperty(TITLE_FIELD) - private String title; ///< Optional. Title for the result - @JsonProperty(CAPTION_FIELD) - private String caption; ///< Optional. Caption of the GIF file to be sent - @JsonProperty(INPUTMESSAGECONTENT_FIELD) - private InputMessageContent inputMessageContent; ///< Optional. Content of the message to be sent instead of the GIF animation - @JsonProperty(REPLY_MARKUP_FIELD) - private InlineKeyboardMarkup replyMarkup; ///< Optional. Inline keyboard attached to the message - @JsonProperty(PARSEMODE_FIELD) - private String parseMode; ///< Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - - public InlineQueryResultCachedGif() { - super(); - } - - public String getType() { - return type; - } - - public String getId() { - return id; - } - - public InlineQueryResultCachedGif setId(String id) { - this.id = id; - return this; - } - - public String getGifFileId() { - return gifFileId; - } - - public InlineQueryResultCachedGif setGifFileId(String gifFileId) { - this.gifFileId = gifFileId; - return this; - } - - public String getTitle() { - return title; - } - - public InlineQueryResultCachedGif setTitle(String title) { - this.title = title; - return this; - } - - public String getCaption() { - return caption; - } - - public InlineQueryResultCachedGif setCaption(String caption) { - this.caption = caption; - return this; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public InlineQueryResultCachedGif setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - return this; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public InlineQueryResultCachedGif setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - return this; - } - - public String getParseMode() { - return parseMode; - } - - public InlineQueryResultCachedGif setParseMode(String parseMode) { - this.parseMode = parseMode; - return this; - } - - @Override - public void validate() throws TelegramApiValidationException { - if (id == null || id.isEmpty()) { - throw new TelegramApiValidationException("ID parameter can't be empty", this); - } - if (gifFileId == null || gifFileId.isEmpty()) { - throw new TelegramApiValidationException("GifFileId parameter can't be empty", this); - } - if (inputMessageContent != null) { - inputMessageContent.validate(); - } - if (replyMarkup != null) { - replyMarkup.validate(); - } - } - - @Override - public String toString() { - return "InlineQueryResultCachedGif{" + - "type='" + type + '\'' + - ", id='" + id + '\'' + - ", gifFileId='" + gifFileId + '\'' + - ", title='" + title + '\'' + - ", caption='" + caption + '\'' + - ", inputMessageContent=" + inputMessageContent + - ", replyMarkup=" + replyMarkup + - ", parseMode='" + parseMode + '\'' + - '}'; - } +public class InlineQueryResultCachedGif extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedGif { } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedMpeg4Gif.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedMpeg4Gif.java index 75d9ad78..ff756d70 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedMpeg4Gif.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedMpeg4Gif.java @@ -1,148 +1,13 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached; -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; -import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; -import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; -import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; - /** * @author Ruben Bermudez * @version 1.0 - * @brief Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, + * Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, * this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can * use input_message_content to send a message with the specified content instead of the animation. - * @date 01 of January of 2016 * @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedMpeg4Gif} */ @Deprecated -public class InlineQueryResultCachedMpeg4Gif implements InlineQueryResult { - - private static final String TYPE_FIELD = "type"; - private static final String ID_FIELD = "id"; - private static final String MPEG4_FILE_ID_FIELD = "mpeg4_file_id"; - private static final String TITLE_FIELD = "title"; - private static final String CAPTION_FIELD = "caption"; - private static final String INPUTMESSAGECONTENT_FIELD = "input_message_content"; - private static final String REPLY_MARKUP_FIELD = "reply_markup"; - private static final String PARSEMODE_FIELD = "parse_mode"; - - @JsonProperty(TYPE_FIELD) - private final String type = "mpeg4_gif"; ///< Type of the result, must be "mpeg4_gif" - @JsonProperty(ID_FIELD) - private String id; ///< Unique identifier of this result, 1-64 bytes - @JsonProperty(MPEG4_FILE_ID_FIELD) - private String mpeg4FileId; ///< A valid file identifier for the MP4 file - @JsonProperty(TITLE_FIELD) - private String title; ///< Optional. Title for the result - @JsonProperty(CAPTION_FIELD) - private String caption; ///< Optional. Caption of the MPEG-4 file to be sent - @JsonProperty(INPUTMESSAGECONTENT_FIELD) - private InputMessageContent inputMessageContent; ///< Optional. Content of the message to be sent instead of the photo - @JsonProperty(REPLY_MARKUP_FIELD) - private InlineKeyboardMarkup replyMarkup; ///< Optional. Inline keyboard attached to the message - @JsonProperty(PARSEMODE_FIELD) - private String parseMode; ///< Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - - public InlineQueryResultCachedMpeg4Gif() { - super(); - } - - public String getType() { - return type; - } - - public String getId() { - return id; - } - - public InlineQueryResultCachedMpeg4Gif setId(String id) { - this.id = id; - return this; - } - - public String getMpeg4FileId() { - return mpeg4FileId; - } - - public InlineQueryResultCachedMpeg4Gif setMpeg4FileId(String mpeg4FileId) { - this.mpeg4FileId = mpeg4FileId; - return this; - } - - public String getTitle() { - return title; - } - - public InlineQueryResultCachedMpeg4Gif setTitle(String title) { - this.title = title; - return this; - } - - public String getCaption() { - return caption; - } - - public InlineQueryResultCachedMpeg4Gif setCaption(String caption) { - this.caption = caption; - return this; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public InlineQueryResultCachedMpeg4Gif setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - return this; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public InlineQueryResultCachedMpeg4Gif setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - return this; - } - - public String getParseMode() { - return parseMode; - } - - public InlineQueryResultCachedMpeg4Gif setParseMode(String parseMode) { - this.parseMode = parseMode; - return this; - } - - @Override - public void validate() throws TelegramApiValidationException { - if (id == null || id.isEmpty()) { - throw new TelegramApiValidationException("ID parameter can't be empty", this); - } - if (mpeg4FileId == null || mpeg4FileId.isEmpty()) { - throw new TelegramApiValidationException("Mpeg4FileId parameter can't be empty", this); - } - if (inputMessageContent != null) { - inputMessageContent.validate(); - } - if (replyMarkup != null) { - replyMarkup.validate(); - } - } - - @Override - public String toString() { - return "InlineQueryResultCachedMpeg4Gif{" + - "type='" + type + '\'' + - ", id='" + id + '\'' + - ", mpeg4FileId='" + mpeg4FileId + '\'' + - ", title='" + title + '\'' + - ", caption='" + caption + '\'' + - ", inputMessageContent=" + inputMessageContent + - ", replyMarkup=" + replyMarkup + - ", parseMode='" + parseMode + '\'' + - '}'; - } +public class InlineQueryResultCachedMpeg4Gif extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedMpeg4Gif { } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedPhoto.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedPhoto.java index 7aa781c3..50224520 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedPhoto.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedPhoto.java @@ -1,12 +1,5 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached; -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; -import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; -import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; -import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; - /** * @author Ruben Bermudez * @version 1.0 @@ -16,144 +9,5 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; * @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedPhoto} */ @Deprecated -public class InlineQueryResultCachedPhoto implements InlineQueryResult { - private static final String TYPE_FIELD = "type"; - private static final String ID_FIELD = "id"; - private static final String PHOTOFILEID_FIELD = "photo_file_id"; - private static final String TITLE_FIELD = "title"; - private static final String DESCRIPTION_FIELD = "description"; - private static final String CAPTION_FIELD = "caption"; - private static final String INPUTMESSAGECONTENT_FIELD = "input_message_content"; - private static final String REPLY_MARKUP_FIELD = "reply_markup"; - private static final String PARSEMODE_FIELD = "parse_mode"; - - @JsonProperty(TYPE_FIELD) - private final String type = "photo"; ///< Type of the result, must be “photo” - @JsonProperty(ID_FIELD) - private String id; ///< Unique identifier of this result, 1-64 bytes - @JsonProperty(PHOTOFILEID_FIELD) - private String photoFileId; ///< A valid file identifier of the photo - @JsonProperty(TITLE_FIELD) - private String title; ///< Optional. Title for the result - @JsonProperty(DESCRIPTION_FIELD) - private String description; ///< Optional. Short description of the result - @JsonProperty(CAPTION_FIELD) - private String caption; ///< Optional. Caption of the photo to be sent - @JsonProperty(INPUTMESSAGECONTENT_FIELD) - private InputMessageContent inputMessageContent; ///< Optional. Content of the message to be sent instead of the photo - @JsonProperty(REPLY_MARKUP_FIELD) - private InlineKeyboardMarkup replyMarkup; ///< Optional. Inline keyboard attached to the message - @JsonProperty(PARSEMODE_FIELD) - private String parseMode; ///< Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - - public InlineQueryResultCachedPhoto() { - super(); - } - - public String getType() { - return type; - } - - public String getId() { - return id; - } - - public InlineQueryResultCachedPhoto setId(String id) { - this.id = id; - return this; - } - - public String getPhotoFileId() { - return photoFileId; - } - - public InlineQueryResultCachedPhoto setPhotoFileId(String photoFileId) { - this.photoFileId = photoFileId; - return this; - } - - public String getTitle() { - return title; - } - - public InlineQueryResultCachedPhoto setTitle(String title) { - this.title = title; - return this; - } - - public String getDescription() { - return description; - } - - public InlineQueryResultCachedPhoto setDescription(String description) { - this.description = description; - return this; - } - - public String getCaption() { - return caption; - } - - public InlineQueryResultCachedPhoto setCaption(String caption) { - this.caption = caption; - return this; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public InlineQueryResultCachedPhoto setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - return this; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public InlineQueryResultCachedPhoto setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - return this; - } - - public String getParseMode() { - return parseMode; - } - - public InlineQueryResultCachedPhoto setParseMode(String parseMode) { - this.parseMode = parseMode; - return this; - } - - @Override - public void validate() throws TelegramApiValidationException { - if (id == null || id.isEmpty()) { - throw new TelegramApiValidationException("ID parameter can't be empty", this); - } - if (photoFileId == null || photoFileId.isEmpty()) { - throw new TelegramApiValidationException("PhotoFileId parameter can't be empty", this); - } - if (inputMessageContent != null) { - inputMessageContent.validate(); - } - if (replyMarkup != null) { - replyMarkup.validate(); - } - } - - @Override - public String toString() { - return "InlineQueryResultCachedPhoto{" + - "type='" + type + '\'' + - ", id='" + id + '\'' + - ", photoFileId='" + photoFileId + '\'' + - ", title='" + title + '\'' + - ", description='" + description + '\'' + - ", caption='" + caption + '\'' + - ", inputMessageContent=" + inputMessageContent + - ", replyMarkup=" + replyMarkup + - ", parseMode='" + parseMode + '\'' + - '}'; - } +public class InlineQueryResultCachedPhoto extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedPhoto { } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedSticker.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedSticker.java index 586651c8..299b5280 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedSticker.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedSticker.java @@ -1,111 +1,16 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached; -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; -import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; -import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; -import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; - /** * @author Ruben Bermudez * @version 1.0 - * @brief Represents a link to a sticker stored on the Telegram servers. By default, this sticker + * Represents a link to a sticker stored on the Telegram servers. By default, this sticker * will be sent by the user. Alternatively, you can use input_message_content to send a message with * the specified content instead of the sticker. * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * ignore them. - * @date 10 of April of 2016 * @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedSticker} */ @Deprecated -public class InlineQueryResultCachedSticker implements InlineQueryResult { +public class InlineQueryResultCachedSticker extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedSticker { - private static final String TYPE_FIELD = "type"; - private static final String ID_FIELD = "id"; - private static final String STICKER_FILE_ID_FIELD = "sticker_file_id"; - private static final String INPUTMESSAGECONTENT_FIELD = "input_message_content"; - private static final String REPLY_MARKUP_FIELD = "reply_markup"; - - @JsonProperty(TYPE_FIELD) - private final String type = "sticker"; ///< Type of the result, must be "sticker" - @JsonProperty(ID_FIELD) - private String id; ///< Unique identifier of this result, 1-64 bytes - @JsonProperty(STICKER_FILE_ID_FIELD) - private String stickerFileId; ///< A valid file identifier of the sticker - @JsonProperty(INPUTMESSAGECONTENT_FIELD) - private InputMessageContent inputMessageContent; ///< Optional. Content of the message to be sent instead of the sticker - @JsonProperty(REPLY_MARKUP_FIELD) - private InlineKeyboardMarkup replyMarkup; ///< Optional. Inline keyboard attached to the message - - public InlineQueryResultCachedSticker() { - super(); - } - - public String getType() { - return type; - } - - public String getId() { - return id; - } - - public InlineQueryResultCachedSticker setId(String id) { - this.id = id; - return this; - } - - public String getStickerFileId() { - return stickerFileId; - } - - public InlineQueryResultCachedSticker setStickerFileId(String stickerFileId) { - this.stickerFileId = stickerFileId; - return this; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public InlineQueryResultCachedSticker setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - return this; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public InlineQueryResultCachedSticker setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - return this; - } - - @Override - public void validate() throws TelegramApiValidationException { - if (id == null || id.isEmpty()) { - throw new TelegramApiValidationException("ID parameter can't be empty", this); - } - if (stickerFileId == null || stickerFileId.isEmpty()) { - throw new TelegramApiValidationException("StickerFileId parameter can't be empty", this); - } - if (inputMessageContent != null) { - inputMessageContent.validate(); - } - if (replyMarkup != null) { - replyMarkup.validate(); - } - } - - @Override - public String toString() { - return "InlineQueryResultCachedSticker{" + - "type='" + type + '\'' + - ", id='" + id + '\'' + - ", sticker_file_id='" + stickerFileId + '\'' + - ", inputMessageContent='" + inputMessageContent + '\'' + - ", replyMarkup='" + replyMarkup + '\'' + - '}'; - } } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedVideo.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedVideo.java index 890f4422..6bde7323 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedVideo.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedVideo.java @@ -1,12 +1,5 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached; -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; -import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; -import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; -import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; - /** * @author Ruben Bermudez * @version 1.0 @@ -16,144 +9,5 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; * @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedVideo} */ @Deprecated -public class InlineQueryResultCachedVideo implements InlineQueryResult { - private static final String TYPE_FIELD = "type"; - private static final String ID_FIELD = "id"; - private static final String VIDEO_FILE_ID_FIELD = "video_file_id"; - private static final String TITLE_FIELD = "title"; - private static final String DESCRIPTION_FIELD = "description"; - private static final String CAPTION_FIELD = "caption"; - private static final String INPUTMESSAGECONTENT_FIELD = "input_message_content"; - private static final String REPLY_MARKUP_FIELD = "reply_markup"; - private static final String PARSEMODE_FIELD = "parse_mode"; - - @JsonProperty(TYPE_FIELD) - private final String type = "video"; ///< Type of the result, must be "video" - @JsonProperty(ID_FIELD) - private String id; ///< Unique identifier of this result - @JsonProperty(VIDEO_FILE_ID_FIELD) - private String videoFileId; ///< A valid file identifier for the video file - @JsonProperty(TITLE_FIELD) - private String title; ///< Optional. Title for the result - @JsonProperty(DESCRIPTION_FIELD) - private String description; ///< Optional. Short description of the result - @JsonProperty(CAPTION_FIELD) - private String caption; ///< Optional. Caption of the video to be sent, 0-200 characters - @JsonProperty(INPUTMESSAGECONTENT_FIELD) - private InputMessageContent inputMessageContent; ///< Optional. Content of the message to be sent instead of the photo - @JsonProperty(REPLY_MARKUP_FIELD) - private InlineKeyboardMarkup replyMarkup; ///< Optional. Inline keyboard attached to the message - @JsonProperty(PARSEMODE_FIELD) - private String parseMode; ///< Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - - public InlineQueryResultCachedVideo() { - super(); - } - - public String getType() { - return type; - } - - public String getId() { - return id; - } - - public InlineQueryResultCachedVideo setId(String id) { - this.id = id; - return this; - } - - public String getVideoFileId() { - return videoFileId; - } - - public InlineQueryResultCachedVideo setVideoFileId(String videoFileId) { - this.videoFileId = videoFileId; - return this; - } - - public String getTitle() { - return title; - } - - public InlineQueryResultCachedVideo setTitle(String title) { - this.title = title; - return this; - } - - public String getDescription() { - return description; - } - - public InlineQueryResultCachedVideo setDescription(String description) { - this.description = description; - return this; - } - - public String getCaption() { - return caption; - } - - public InlineQueryResultCachedVideo setCaption(String caption) { - this.caption = caption; - return this; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public InlineQueryResultCachedVideo setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - return this; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public InlineQueryResultCachedVideo setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - return this; - } - - public String getParseMode() { - return parseMode; - } - - public InlineQueryResultCachedVideo setParseMode(String parseMode) { - this.parseMode = parseMode; - return this; - } - - @Override - public void validate() throws TelegramApiValidationException { - if (id == null || id.isEmpty()) { - throw new TelegramApiValidationException("ID parameter can't be empty", this); - } - if (videoFileId == null || videoFileId.isEmpty()) { - throw new TelegramApiValidationException("VideoFileId parameter can't be empty", this); - } - if (inputMessageContent != null) { - inputMessageContent.validate(); - } - if (replyMarkup != null) { - replyMarkup.validate(); - } - } - - @Override - public String toString() { - return "InlineQueryResultCachedVideo{" + - "type='" + type + '\'' + - ", id='" + id + '\'' + - ", videoFileId='" + videoFileId + '\'' + - ", title='" + title + '\'' + - ", description='" + description + '\'' + - ", caption='" + caption + '\'' + - ", inputMessageContent=" + inputMessageContent + - ", replyMarkup=" + replyMarkup + - ", parseMode='" + parseMode + '\'' + - '}'; - } +public class InlineQueryResultCachedVideo extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedVideo { } diff --git a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedVoice.java b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedVoice.java index c8f9a7c9..b53ade0d 100644 --- a/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedVoice.java +++ b/telegrambots-meta/src/main/java/org/telegram/telegrambots/meta/api/objects/inlinequery/result/chached/InlineQueryResultCachedVoice.java @@ -1,12 +1,5 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached; -import com.fasterxml.jackson.annotation.JsonProperty; - -import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; -import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; -import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; -import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; - /** * @author Ruben Bermudez * @version 1.0 @@ -18,131 +11,5 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; * @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedVoice} */ @Deprecated -public class InlineQueryResultCachedVoice implements InlineQueryResult { - private static final String TYPE_FIELD = "type"; - private static final String ID_FIELD = "id"; - private static final String VOICE_FILE_ID_FIELD = "voice_file_id"; - private static final String TITLE_FIELD = "title"; - private static final String INPUTMESSAGECONTENT_FIELD = "input_message_content"; - private static final String REPLY_MARKUP_FIELD = "reply_markup"; - private static final String CAPTION_FIELD = "caption"; - private static final String PARSEMODE_FIELD = "parse_mode"; - - @JsonProperty(TYPE_FIELD) - private final String type = "voice"; ///< Type of the result, must be "voice" - @JsonProperty(ID_FIELD) - private String id; ///< Unique identifier of this result, 1-64 bytes - @JsonProperty(VOICE_FILE_ID_FIELD) - private String voiceFileId; ///< A valid file identifier for the voice message - @JsonProperty(TITLE_FIELD) - private String title; ///< Recording title - @JsonProperty(INPUTMESSAGECONTENT_FIELD) - private InputMessageContent inputMessageContent; ///< Optional. Content of the message to be sent instead of the voice recording - @JsonProperty(REPLY_MARKUP_FIELD) - private InlineKeyboardMarkup replyMarkup; ///< Optional. Inline keyboard attached to the message - @JsonProperty(CAPTION_FIELD) - private String caption; ///< Optional. Voice caption (may also be used when resending documents by file_id), 0-200 characters - @JsonProperty(PARSEMODE_FIELD) - private String parseMode; ///< Send Markdown or HTML, if you want Telegram apps to show bold, italic, fixed-width text or inline URLs in the media caption. - - public InlineQueryResultCachedVoice() { - super(); - } - - public String getType() { - return type; - } - - public String getId() { - return id; - } - - public InlineQueryResultCachedVoice setId(String id) { - this.id = id; - return this; - } - - public String getVoiceFileId() { - return voiceFileId; - } - - public InlineQueryResultCachedVoice setVoiceFileId(String voiceFileId) { - this.voiceFileId = voiceFileId; - return this; - } - - public String getTitle() { - return title; - } - - public InlineQueryResultCachedVoice setTitle(String title) { - this.title = title; - return this; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public InlineQueryResultCachedVoice setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - return this; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public InlineQueryResultCachedVoice setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - return this; - } - - public String getCaption() { - return caption; - } - - public InlineQueryResultCachedVoice setCaption(String caption) { - this.caption = caption; - return this; - } - - public String getParseMode() { - return parseMode; - } - - public InlineQueryResultCachedVoice setParseMode(String parseMode) { - this.parseMode = parseMode; - return this; - } - - @Override - public void validate() throws TelegramApiValidationException { - if (id == null || id.isEmpty()) { - throw new TelegramApiValidationException("ID parameter can't be empty", this); - } - if (voiceFileId == null || voiceFileId.isEmpty()) { - throw new TelegramApiValidationException("VoiceFileId parameter can't be empty", this); - } - if (inputMessageContent != null) { - inputMessageContent.validate(); - } - if (replyMarkup != null) { - replyMarkup.validate(); - } - } - - @Override - public String toString() { - return "InlineQueryResultCachedVoice{" + - "type='" + type + '\'' + - ", id='" + id + '\'' + - ", voiceFileId='" + voiceFileId + '\'' + - ", title='" + title + '\'' + - ", inputMessageContent=" + inputMessageContent + - ", replyMarkup=" + replyMarkup + - ", caption='" + caption + '\'' + - ", parseMode='" + parseMode + '\'' + - '}'; - } +public class InlineQueryResultCachedVoice extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedVoice { }