From 0e36784cbea34dfacdcbb48ee5d2c8ef13f0423d Mon Sep 17 00:00:00 2001 From: Alexander Babai Date: Tue, 12 Apr 2016 22:25:54 +0300 Subject: [PATCH 1/6] methods classes: setters to builder style --- .../api/methods/AnswerInlineQuery.java | 21 ++++++++++----- .../api/methods/ForwardMessage.java | 9 ++++--- .../telegrambots/api/methods/GetFile.java | 3 ++- .../api/methods/GetUserProfilePhotos.java | 10 ++++--- .../groupadministration/KickChatMember.java | 6 +++-- .../groupadministration/UnbanChatMember.java | 6 +++-- .../api/methods/send/SendAudio.java | 24 +++++++++++------ .../api/methods/send/SendChatAction.java | 6 +++-- .../api/methods/send/SendContact.java | 18 ++++++++----- .../api/methods/send/SendDocument.java | 18 ++++++++----- .../api/methods/send/SendLocation.java | 15 +++++++---- .../api/methods/send/SendMessage.java | 12 ++++++--- .../api/methods/send/SendPhoto.java | 18 ++++++++----- .../api/methods/send/SendSticker.java | 15 +++++++---- .../api/methods/send/SendVenue.java | 24 +++++++++++------ .../api/methods/send/SendVideo.java | 27 ++++++++++++------- .../api/methods/send/SendVoice.java | 18 ++++++++----- .../api/methods/updates/GetUpdates.java | 9 ++++--- .../api/methods/updates/SetWebhook.java | 6 +++-- .../updatingmessages/EditMessageCaption.java | 15 +++++++---- .../EditMessageReplyMarkup.java | 12 ++++++--- .../updatingmessages/EditMessageText.java | 15 +++++++---- 22 files changed, 205 insertions(+), 102 deletions(-) diff --git a/src/main/java/org/telegram/telegrambots/api/methods/AnswerInlineQuery.java b/src/main/java/org/telegram/telegrambots/api/methods/AnswerInlineQuery.java index c991e44a..12192324 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/AnswerInlineQuery.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/AnswerInlineQuery.java @@ -44,56 +44,63 @@ public class AnswerInlineQuery extends BotApiMethod { return inlineQueryId; } - public void setInlineQueryId(String inlineQueryId) { + public AnswerInlineQuery setInlineQueryId(String inlineQueryId) { this.inlineQueryId = inlineQueryId; + return this; } public List getResults() { return results; } - public void setResults(List results) { + public AnswerInlineQuery setResults(List results) { this.results = results; + return this; } public Integer getCacheTime() { return cacheTime; } - public void setCacheTime(Integer cacheTime) { + public AnswerInlineQuery setCacheTime(Integer cacheTime) { this.cacheTime = cacheTime; + return this; } public Boolean getPersonal() { return isPersonal; } - public void setPersonal(Boolean personal) { + public AnswerInlineQuery setPersonal(Boolean personal) { isPersonal = personal; + return this; } public String getNextOffset() { return nextOffset; } - public void setNextOffset(String nextOffset) { + public AnswerInlineQuery setNextOffset(String nextOffset) { this.nextOffset = nextOffset; + return this; } public String getSwitchPmText() { return switchPmText; } - public void setSwitchPmText(String switchPmText) { + public AnswerInlineQuery setSwitchPmText(String switchPmText) { this.switchPmText = switchPmText; + return this; } public String getSwitchPmParameter() { return switchPmParameter; } - public void setSwitchPmParameter(String switchPmParameter) { + public AnswerInlineQuery setSwitchPmParameter(String switchPmParameter) { this.switchPmParameter = switchPmParameter; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java b/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java index 4f09c95d..14da4fa7 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/ForwardMessage.java @@ -42,24 +42,27 @@ public class ForwardMessage extends BotApiMethod { return chatId; } - public void setChatId(String chatId) { + public ForwardMessage setChatId(String chatId) { this.chatId = chatId; + return this; } public Integer getFromChatId() { return fromChatId; } - public void setFromChatId(Integer fromChatId) { + public ForwardMessage setFromChatId(Integer fromChatId) { this.fromChatId = fromChatId; + return this; } public Integer getMessageId() { return messageId; } - public void setMessageId(Integer messageId) { + public ForwardMessage setMessageId(Integer messageId) { this.messageId = messageId; + return this; } public Boolean getDisableNotification() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/GetFile.java b/src/main/java/org/telegram/telegrambots/api/methods/GetFile.java index 51e0fb41..2089f7ed 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/GetFile.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/GetFile.java @@ -36,8 +36,9 @@ public class GetFile extends BotApiMethod { return fileId; } - public void setFileId(String fileId) { + public GetFile setFileId(String fileId) { this.fileId = fileId; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/GetUserProfilePhotos.java b/src/main/java/org/telegram/telegrambots/api/methods/GetUserProfilePhotos.java index c17a0b97..fb5ef555 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/GetUserProfilePhotos.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/GetUserProfilePhotos.java @@ -41,25 +41,29 @@ public class GetUserProfilePhotos extends BotApiMethod { return userId; } - public void setUserId(Integer userId) { + public GetUserProfilePhotos setUserId(Integer userId) { this.userId = userId; + return this; } public Integer getOffset() { return offset; } - public void setOffset(Integer offset) { + public GetUserProfilePhotos setOffset(Integer offset) { this.offset = offset; + return this; } public Integer getLimit() { return limit; } - public void setLimit(Integer limit) { + public GetUserProfilePhotos setLimit(Integer limit) { this.limit = limit; + return this; } + @Override public JSONObject toJson() { JSONObject jsonObject = new JSONObject(); diff --git a/src/main/java/org/telegram/telegrambots/api/methods/groupadministration/KickChatMember.java b/src/main/java/org/telegram/telegrambots/api/methods/groupadministration/KickChatMember.java index d441a040..2ce1f911 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/groupadministration/KickChatMember.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/groupadministration/KickChatMember.java @@ -38,16 +38,18 @@ public class KickChatMember extends BotApiMethod { return chatId; } - public void setChatId(String chatId) { + public KickChatMember setChatId(String chatId) { this.chatId = chatId; + return this; } public Integer getUserId() { return userId; } - public void setUserId(Integer userId) { + public KickChatMember setUserId(Integer userId) { this.userId = userId; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/groupadministration/UnbanChatMember.java b/src/main/java/org/telegram/telegrambots/api/methods/groupadministration/UnbanChatMember.java index 6de57d1f..6c75940c 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/groupadministration/UnbanChatMember.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/groupadministration/UnbanChatMember.java @@ -34,16 +34,18 @@ public class UnbanChatMember extends BotApiMethod { return chatId; } - public void setChatId(String chatId) { + public UnbanChatMember setChatId(String chatId) { this.chatId = chatId; + return this; } public Integer getUserId() { return userId; } - public void setUserId(Integer userId) { + public UnbanChatMember setUserId(Integer userId) { this.userId = userId; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendAudio.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendAudio.java index 10689142..c9b6444c 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendAudio.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendAudio.java @@ -47,16 +47,18 @@ public class SendAudio { return this.duration; } - public void setDuration(Integer duration) { + public SendAudio setDuration(Integer duration) { this.duration = duration; + return this; } public String getChatId() { return chatId; } - public void setChatId(String chatId) { + public SendAudio setChatId(String chatId) { this.chatId = chatId; + return this; } public String getAudio() { @@ -69,9 +71,10 @@ public class SendAudio { * @param audio File_id of the audio to send * @note The file_id must have already been received or sent by your bot */ - public void setAudio(String audio) { + public SendAudio setAudio(String audio) { this.audio = audio; this.isNewAudio = false; + return this; } /** @@ -80,42 +83,47 @@ public class SendAudio { * @param audio Path to the new file in your server * @param audioName Name of the file itself */ - public void setNewAudio(String audio, String audioName) { + public SendAudio setNewAudio(String audio, String audioName) { this.audio = audio; this.isNewAudio = true; this.audioName = audioName; + return this; } public Integer getReplayToMessageId() { return replayToMessageId; } - public void setReplayToMessageId(Integer replayToMessageId) { + public SendAudio setReplayToMessageId(Integer replayToMessageId) { this.replayToMessageId = replayToMessageId; + return this; } public ReplyKeyboard getReplayMarkup() { return replayMarkup; } - public void setReplayMarkup(ReplyKeyboard replayMarkup) { + public SendAudio setReplayMarkup(ReplyKeyboard replayMarkup) { this.replayMarkup = replayMarkup; + return this; } public String getPerformer() { return performer; } - public void setPerformer(String performer) { + public SendAudio setPerformer(String performer) { this.performer = performer; + return this; } public String getTitle() { return title; } - public void setTitle(String title) { + public SendAudio setTitle(String title) { this.title = title; + return this; } public Boolean getDisableNotification() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendChatAction.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendChatAction.java index fe3f7c0a..8e1e55bf 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendChatAction.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendChatAction.java @@ -37,16 +37,18 @@ public class SendChatAction extends BotApiMethod { return chatId; } - public void setChatId(String chatId) { + public SendChatAction setChatId(String chatId) { this.chatId = chatId; + return this; } public String getAction() { return action; } - public void setAction(String action) { + public SendChatAction setAction(String action) { this.action = action; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendContact.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendContact.java index 7fb6eff9..b3eaf39a 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendContact.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendContact.java @@ -45,24 +45,27 @@ public class SendContact extends BotApiMethod { return chatId; } - public void setChatId(String chatId) { + public SendContact setChatId(String chatId) { this.chatId = chatId; + return this; } public Integer getReplayToMessageId() { return replayToMessageId; } - public void setReplayToMessageId(Integer replayToMessageId) { + public SendContact setReplayToMessageId(Integer replayToMessageId) { this.replayToMessageId = replayToMessageId; + return this; } public ReplyKeyboard getReplayMarkup() { return replayMarkup; } - public void setReplayMarkup(ReplyKeyboard replayMarkup) { + public SendContact setReplayMarkup(ReplyKeyboard replayMarkup) { this.replayMarkup = replayMarkup; + return this; } public Boolean getDisableNotification() { @@ -81,24 +84,27 @@ public class SendContact extends BotApiMethod { return phoneNumber; } - public void setPhoneNumber(String phoneNumber) { + public SendContact setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; + return this; } public String getFirstName() { return firstName; } - public void setFirstName(String firstName) { + public SendContact setFirstName(String firstName) { this.firstName = firstName; + return this; } public String getLastName() { return lastName; } - public void setLastName(String lastName) { + public SendContact setLastName(String lastName) { this.lastName = lastName; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendDocument.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendDocument.java index 91a08c4c..5a552d0d 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendDocument.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendDocument.java @@ -39,23 +39,26 @@ public class SendDocument { return chatId; } - public void setChatId(String chatId) { + public SendDocument setChatId(String chatId) { this.chatId = chatId; + return this; } public String getDocument() { return document; } - public void setDocument(String document) { + public SendDocument setDocument(String document) { this.document = document; this.isNewDocument = false; + return this; } - public void setNewDocument(String document, String documentName) { + public SendDocument setNewDocument(String document, String documentName) { this.document = document; this.isNewDocument = true; this.documentName = documentName; + return this; } public boolean isNewDocument() { @@ -70,8 +73,9 @@ public class SendDocument { return replayToMessageId; } - public void setReplayToMessageId(Integer replayToMessageId) { + public SendDocument setReplayToMessageId(Integer replayToMessageId) { this.replayToMessageId = replayToMessageId; + return this; } public Boolean getDisableNotification() { @@ -90,16 +94,18 @@ public class SendDocument { return caption; } - public void setCaption(String caption) { + public SendDocument setCaption(String caption) { this.caption = caption; + return this; } public ReplyKeyboard getReplayMarkup() { return replayMarkup; } - public void setReplayMarkup(ReplyKeyboard replayMarkup) { + public SendDocument setReplayMarkup(ReplyKeyboard replayMarkup) { this.replayMarkup = replayMarkup; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendLocation.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendLocation.java index 6d5fd334..42098638 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendLocation.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendLocation.java @@ -42,40 +42,45 @@ public class SendLocation extends BotApiMethod { return chatId; } - public void setChatId(String chatId) { + public SendLocation setChatId(String chatId) { this.chatId = chatId; + return this; } public Float getLatitude() { return latitude; } - public void setLatitude(Float latitude) { + public SendLocation setLatitude(Float latitude) { this.latitude = latitude; + return this; } public Float getLongitude() { return longitude; } - public void setLongitude(Float longitude) { + public SendLocation setLongitude(Float longitude) { this.longitude = longitude; + return this; } public Integer getReplayToMessageId() { return replayToMessageId; } - public void setReplayToMessageId(Integer replayToMessageId) { + public SendLocation setReplayToMessageId(Integer replayToMessageId) { this.replayToMessageId = replayToMessageId; + return this; } public ReplyKeyboard getReplayMarkup() { return replayMarkup; } - public void setReplayMarkup(ReplyKeyboard replayMarkup) { + public SendLocation setReplayMarkup(ReplyKeyboard replayMarkup) { this.replayMarkup = replayMarkup; + return this; } public Boolean getDisableNotification() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java index 9938381a..f0488644 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java @@ -49,32 +49,36 @@ public class SendMessage extends BotApiMethod { return chatId; } - public void setChatId(String chatId) { + public SendMessage setChatId(String chatId) { this.chatId = chatId; + return this; } public String getText() { return text; } - public void setText(String text) { + public SendMessage setText(String text) { this.text = text; + return this; } public Integer getReplayToMessageId() { return replayToMessageId; } - public void setReplayToMessageId(Integer replayToMessageId) { + public SendMessage setReplayToMessageId(Integer replayToMessageId) { this.replayToMessageId = replayToMessageId; + return this; } public ReplyKeyboard getReplayMarkup() { return replayMarkup; } - public void setReplayMarkup(ReplyKeyboard replayMarkup) { + public SendMessage setReplayMarkup(ReplyKeyboard replayMarkup) { this.replayMarkup = replayMarkup; + return this; } public Boolean getDisableWebPagePreview() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendPhoto.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendPhoto.java index 1ea1b3a8..3bb8536a 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendPhoto.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendPhoto.java @@ -40,41 +40,46 @@ public class SendPhoto { return chatId; } - public void setChatId(String chatId) { + public SendPhoto setChatId(String chatId) { this.chatId = chatId; + return this; } public String getPhoto() { return photo; } - public void setPhoto(String photo) { + public SendPhoto setPhoto(String photo) { this.photo = photo; this.isNewPhoto = false; + return this; } public String getCaption() { return caption; } - public void setCaption(String caption) { + public SendPhoto setCaption(String caption) { this.caption = caption; + return this; } public Integer getReplayToMessageId() { return replayToMessageId; } - public void setReplayToMessageId(Integer replayToMessageId) { + public SendPhoto setReplayToMessageId(Integer replayToMessageId) { this.replayToMessageId = replayToMessageId; + return this; } public ReplyKeyboard getReplayMarkup() { return replayMarkup; } - public void setReplayMarkup(ReplyKeyboard replayMarkup) { + public SendPhoto setReplayMarkup(ReplyKeyboard replayMarkup) { this.replayMarkup = replayMarkup; + return this; } public boolean isNewPhoto() { @@ -97,10 +102,11 @@ public class SendPhoto { this.disableNotification = true; } - public void setNewPhoto(String photo, String photoName) { + public SendPhoto setNewPhoto(String photo, String photoName) { this.photo = photo; this.isNewPhoto = true; this.photoName = photoName; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendSticker.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendSticker.java index cb150961..3a08f29b 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendSticker.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendSticker.java @@ -37,39 +37,44 @@ public class SendSticker { return chatId; } - public void setChatId(String chatId) { + public SendSticker setChatId(String chatId) { this.chatId = chatId; + return this; } public String getSticker() { return sticker; } - public void setSticker(String sticker) { + public SendSticker setSticker(String sticker) { this.sticker = sticker; this.isNewSticker = false; + return this; } public Integer getReplayToMessageId() { return replayToMessageId; } - public void setReplayToMessageId(Integer replayToMessageId) { + public SendSticker setReplayToMessageId(Integer replayToMessageId) { this.replayToMessageId = replayToMessageId; + return this; } public ReplyKeyboard getReplayMarkup() { return replayMarkup; } - public void setReplayMarkup(ReplyKeyboard replayMarkup) { + public SendSticker setReplayMarkup(ReplyKeyboard replayMarkup) { this.replayMarkup = replayMarkup; + return this; } - public void setSticker(String sticker, String stickerName) { + public SendSticker setSticker(String sticker, String stickerName) { this.sticker = sticker; this.isNewSticker = true; this.stickerName = stickerName; + return this; } public Boolean getDisableNotification() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVenue.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVenue.java index 7d220419..c3ac39c6 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVenue.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVenue.java @@ -49,40 +49,45 @@ public class SendVenue extends BotApiMethod { return chatId; } - public void setChatId(String chatId) { + public SendVenue setChatId(String chatId) { this.chatId = chatId; + return this; } public Float getLatitude() { return latitude; } - public void setLatitude(Float latitude) { + public SendVenue setLatitude(Float latitude) { this.latitude = latitude; + return this; } public Float getLongitude() { return longitude; } - public void setLongitude(Float longitude) { + public SendVenue setLongitude(Float longitude) { this.longitude = longitude; + return this; } public Integer getReplayToMessageId() { return replayToMessageId; } - public void setReplayToMessageId(Integer replayToMessageId) { + public SendVenue setReplayToMessageId(Integer replayToMessageId) { this.replayToMessageId = replayToMessageId; + return this; } public ReplyKeyboard getReplayMarkup() { return replayMarkup; } - public void setReplayMarkup(ReplyKeyboard replayMarkup) { + public SendVenue setReplayMarkup(ReplyKeyboard replayMarkup) { this.replayMarkup = replayMarkup; + return this; } public Boolean getDisableNotification() { @@ -101,24 +106,27 @@ public class SendVenue extends BotApiMethod { return title; } - public void setTitle(String title) { + public SendVenue setTitle(String title) { this.title = title; + return this; } public String getAddress() { return address; } - public void setAddress(String address) { + public SendVenue setAddress(String address) { this.address = address; + return this; } public String getFoursquareId() { return foursquareId; } - public void setFoursquareId(String foursquareId) { + public SendVenue setFoursquareId(String foursquareId) { this.foursquareId = foursquareId; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVideo.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVideo.java index 89620a35..e1da970f 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVideo.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVideo.java @@ -46,49 +46,55 @@ public class SendVideo { return chatId; } - public void setChatId(String chatId) { + public SendVideo setChatId(String chatId) { this.chatId = chatId; + return this; } public String getVideo() { return video; } - public void setVideo(String video) { + public SendVideo setVideo(String video) { this.video = video; this.isNewVideo = false; + return this; } public Integer getDuration() { return duration; } - public void setDuration(Integer duration) { + public SendVideo setDuration(Integer duration) { this.duration = duration; + return this; } public String getCaption() { return caption; } - public void setCaption(String caption) { + public SendVideo setCaption(String caption) { this.caption = caption; + return this; } public Integer getReplayToMessageId() { return replayToMessageId; } - public void setReplayToMessageId(Integer replayToMessageId) { + public SendVideo setReplayToMessageId(Integer replayToMessageId) { this.replayToMessageId = replayToMessageId; + return this; } public ReplyKeyboard getReplayMarkup() { return replayMarkup; } - public void setReplayMarkup(ReplyKeyboard replayMarkup) { + public SendVideo setReplayMarkup(ReplyKeyboard replayMarkup) { this.replayMarkup = replayMarkup; + return this; } public boolean isNewVideo() { @@ -115,22 +121,25 @@ public class SendVideo { return width; } - public void setWidth(Integer width) { + public SendVideo setWidth(Integer width) { this.width = width; + return this; } public Integer getHeight() { return height; } - public void setHeight(Integer height) { + public SendVideo setHeight(Integer height) { this.height = height; + return this; } - public void setNewVideo(String video, String videoName) { + public SendVideo setNewVideo(String video, String videoName) { this.video = video; this.isNewVideo = true; this.videoName = videoName; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVoice.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVoice.java index 0a8456a3..6095b938 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVoice.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVoice.java @@ -64,47 +64,53 @@ public class SendVoice { return chatId; } - public void setChatId(String chatId) { + public SendVoice setChatId(String chatId) { this.chatId = chatId; + return this; } public String getAudio() { return audio; } - public void setAudio(String audio) { + public SendVoice setAudio(String audio) { this.audio = audio; this.isNewVoice = false; + return this; } - public void setNewAudio(String audio, String audioName) { + public SendVoice setNewAudio(String audio, String audioName) { this.audio = audio; this.isNewVoice = false; this.voiceName = audioName; + return this; } public Integer getReplayToMessageId() { return replayToMessageId; } - public void setReplayToMessageId(Integer replayToMessageId) { + public SendVoice setReplayToMessageId(Integer replayToMessageId) { this.replayToMessageId = replayToMessageId; + return this; } public ReplyKeyboard getReplayMarkup() { return replayMarkup; } - public void setReplayMarkup(ReplyKeyboard replayMarkup) { + public SendVoice setReplayMarkup(ReplyKeyboard replayMarkup) { this.replayMarkup = replayMarkup; + return this; } public Integer getDuration() { return duration; } - public void setDuration(Integer duration) { + public SendVoice setDuration(Integer duration) { this.duration = duration; + return this; } public boolean isNewVoice() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/updates/GetUpdates.java b/src/main/java/org/telegram/telegrambots/api/methods/updates/GetUpdates.java index 3dcb2155..91c4a5b7 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/updates/GetUpdates.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/updates/GetUpdates.java @@ -43,24 +43,27 @@ public class GetUpdates implements IToJson { return offset; } - public void setOffset(Integer offset) { + public GetUpdates setOffset(Integer offset) { this.offset = offset; + return this; } public Integer getLimit() { return limit; } - public void setLimit(Integer limit) { + public GetUpdates setLimit(Integer limit) { this.limit = limit; + return this; } public Integer getTimeout() { return timeout; } - public void setTimeout(Integer timeout) { + public GetUpdates setTimeout(Integer timeout) { this.timeout = timeout; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/updates/SetWebhook.java b/src/main/java/org/telegram/telegrambots/api/methods/updates/SetWebhook.java index 99ebdca7..b61bfc71 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/updates/SetWebhook.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/updates/SetWebhook.java @@ -25,16 +25,18 @@ public class SetWebhook { return url; } - public void setUrl(String url) { + public SetWebhook setUrl(String url) { this.url = url; + return this; } public String getCertificateFile() { return certificateFile; } - public void setCertificateFile(String certificateFile) { + public SetWebhook setCertificateFile(String certificateFile) { this.certificateFile = certificateFile; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageCaption.java b/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageCaption.java index cb6b6fa9..ebc8de28 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageCaption.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageCaption.java @@ -52,40 +52,45 @@ public class EditMessageCaption extends BotApiMethod { return chatId; } - public void setChatId(String chatId) { + public EditMessageCaption setChatId(String chatId) { this.chatId = chatId; + return this; } public Integer getMessageId() { return messageId; } - public void setMessageId(Integer messageId) { + public EditMessageCaption setMessageId(Integer messageId) { this.messageId = messageId; + return this; } public String getInlineMessageId() { return inlineMessageId; } - public void setInlineMessageId(String inlineMessageId) { + public EditMessageCaption setInlineMessageId(String inlineMessageId) { this.inlineMessageId = inlineMessageId; + return this; } public String getCaption() { return caption; } - public void setCaption(String caption) { + public EditMessageCaption setCaption(String caption) { this.caption = caption; + return this; } public InlineKeyboardMarkup getReplyMarkup() { return replyMarkup; } - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + public EditMessageCaption setReplyMarkup(InlineKeyboardMarkup replyMarkup) { this.replyMarkup = replyMarkup; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageReplyMarkup.java b/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageReplyMarkup.java index 7b9551d5..3d236fdf 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageReplyMarkup.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageReplyMarkup.java @@ -50,32 +50,36 @@ public class EditMessageReplyMarkup extends BotApiMethod { return chatId; } - public void setChatId(String chatId) { + public EditMessageReplyMarkup setChatId(String chatId) { this.chatId = chatId; + return this; } public Integer getMessageId() { return messageId; } - public void setMessageId(Integer messageId) { + public EditMessageReplyMarkup setMessageId(Integer messageId) { this.messageId = messageId; + return this; } public String getInlineMessageId() { return inlineMessageId; } - public void setInlineMessageId(String inlineMessageId) { + public EditMessageReplyMarkup setInlineMessageId(String inlineMessageId) { this.inlineMessageId = inlineMessageId; + return this; } public InlineKeyboardMarkup getReplyMarkup() { return replyMarkup; } - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + public EditMessageReplyMarkup setReplyMarkup(InlineKeyboardMarkup replyMarkup) { this.replyMarkup = replyMarkup; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageText.java b/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageText.java index ba0a85ae..1d2d470f 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageText.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageText.java @@ -64,40 +64,45 @@ public class EditMessageText extends BotApiMethod { return chatId; } - public void setChatId(String chatId) { + public EditMessageText setChatId(String chatId) { this.chatId = chatId; + return this; } public Integer getMessageId() { return messageId; } - public void setMessageId(Integer messageId) { + public EditMessageText setMessageId(Integer messageId) { this.messageId = messageId; + return this; } public String getInlineMessageId() { return inlineMessageId; } - public void setInlineMessageId(String inlineMessageId) { + public EditMessageText setInlineMessageId(String inlineMessageId) { this.inlineMessageId = inlineMessageId; + return this; } public String getText() { return text; } - public void setText(String text) { + public EditMessageText setText(String text) { this.text = text; + return this; } public InlineKeyboardMarkup getReplyMarkup() { return replyMarkup; } - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + public EditMessageText setReplyMarkup(InlineKeyboardMarkup replyMarkup) { this.replyMarkup = replyMarkup; + return this; } public void disableWebPagePreview() { From 79616210f4c9a7b43e832bb9378f2ebda9eb66c7 Mon Sep 17 00:00:00 2001 From: Alexander Babai Date: Tue, 12 Apr 2016 23:19:03 +0300 Subject: [PATCH 2/6] objects classes: setters to builder style --- .../telegrambots/api/objects/Audio.java | 18 ++- .../telegrambots/api/objects/Document.java | 15 ++- .../telegrambots/api/objects/File.java | 9 +- .../telegrambots/api/objects/Location.java | 6 +- .../telegrambots/api/objects/Message.java | 118 ++++++++---------- .../telegrambots/api/objects/PhotoSize.java | 15 ++- .../api/objects/UserProfilePhotos.java | 6 +- .../telegrambots/api/objects/Video.java | 35 +++--- .../telegrambots/api/objects/Voice.java | 12 +- .../inlinequery/ChosenInlineQuery.java | 29 ++++- .../api/objects/inlinequery/InlineQuery.java | 25 ++++ .../InputContactMessageContent.java | 9 +- .../InputLocationMessageContent.java | 20 +-- .../InputTextMessageContent.java | 21 +++- .../InputVenueMessageContent.java | 15 ++- .../result/InlineQueryResultArticle.java | 30 +++-- .../result/InlineQueryResultAudio.java | 63 +++++----- .../result/InlineQueryResultContact.java | 97 +++++++------- .../result/InlineQueryResultDocument.java | 109 ++++++++-------- .../result/InlineQueryResultGif.java | 69 +++++----- .../result/InlineQueryResultLocation.java | 67 +++++----- .../result/InlineQueryResultMpeg4Gif.java | 69 +++++----- .../result/InlineQueryResultPhoto.java | 75 ++++++----- .../result/InlineQueryResultVenue.java | 103 ++++++++------- .../result/InlineQueryResultVideo.java | 78 +++++++----- .../result/InlineQueryResultVoice.java | 74 ++++++----- .../chached/InlineQueryResultCachedAudio.java | 40 +++--- .../InlineQueryResultCachedDocument.java | 63 +++++----- .../chached/InlineQueryResultCachedGif.java | 60 +++++---- .../InlineQueryResultCachedMpeg4Gif.java | 60 +++++---- .../chached/InlineQueryResultCachedPhoto.java | 63 +++++----- .../InlineQueryResultCachedSticker.java | 40 +++--- .../chached/InlineQueryResultCachedVideo.java | 69 +++++----- .../chached/InlineQueryResultCachedVoice.java | 57 +++++---- .../replykeyboard/ForceReplyKeyboard.java | 6 +- .../replykeyboard/InlineKeyboardMarkup.java | 12 +- .../replykeyboard/ReplyKeyboardHide.java | 6 +- .../replykeyboard/ReplyKeyboardMarkup.java | 12 +- .../buttons/InlineKeyboardButton.java | 12 +- .../replykeyboard/buttons/KeyboardButton.java | 15 +-- 40 files changed, 978 insertions(+), 724 deletions(-) diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Audio.java b/src/main/java/org/telegram/telegrambots/api/objects/Audio.java index 20f80443..7364acd3 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/Audio.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/Audio.java @@ -63,48 +63,54 @@ public class Audio implements IBotApiObject { return fileId; } - public void setFileId(String fileId) { + public Audio setFileId(String fileId) { this.fileId = fileId; + return this; } public Integer getDuration() { return duration; } - public void setDuration(Integer duration) { + public Audio setDuration(Integer duration) { this.duration = duration; + return this; } public String getMimeType() { return mimeType; } - public void setMimeType(String mimeType) { + public Audio setMimeType(String mimeType) { this.mimeType = mimeType; + return this; } public Integer getFileSize() { return fileSize; } - public void setFileSize(Integer fileSize) { + public Audio setFileSize(Integer fileSize) { this.fileSize = fileSize; + return this; } public String getTitle() { return title; } - public void setTitle(String title) { + public Audio setTitle(String title) { this.title = title; + return this; } public String getPerformer() { return performer; } - public void setPerformer(String performer) { + public Audio setPerformer(String performer) { this.performer = performer; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Document.java b/src/main/java/org/telegram/telegrambots/api/objects/Document.java index d8ddf177..3d868067 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/Document.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/Document.java @@ -59,40 +59,45 @@ public class Document implements IBotApiObject { return fileId; } - public void setFileId(String fileId) { + public Document setFileId(String fileId) { this.fileId = fileId; + return this; } public PhotoSize getThumb() { return thumb; } - public void setThumb(PhotoSize thumb) { + public Document setThumb(PhotoSize thumb) { this.thumb = thumb; + return this; } public String getFileName() { return fileName; } - public void setFileName(String fileName) { + public Document setFileName(String fileName) { this.fileName = fileName; + return this; } public String getMimeType() { return mimeType; } - public void setMimeType(String mimeType) { + public Document setMimeType(String mimeType) { this.mimeType = mimeType; + return this; } public Integer getFileSize() { return fileSize; } - public void setFileSize(Integer fileSize) { + public Document setFileSize(Integer fileSize) { this.fileSize = fileSize; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/File.java b/src/main/java/org/telegram/telegrambots/api/objects/File.java index 7b7a3289..65299e25 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/File.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/File.java @@ -46,24 +46,27 @@ public class File implements IBotApiObject { return fileId; } - public void setFileId(String fileId) { + public File setFileId(String fileId) { this.fileId = fileId; + return this; } public Integer getFileSize() { return fileSize; } - public void setFileSize(Integer fileSize) { + public File setFileSize(Integer fileSize) { this.fileSize = fileSize; + return this; } public String getFilePath() { return filePath; } - public void setFilePath(String filePath) { + public File setFilePath(String filePath) { this.filePath = filePath; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Location.java b/src/main/java/org/telegram/telegrambots/api/objects/Location.java index 4602745d..3343d2dd 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/Location.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/Location.java @@ -39,16 +39,18 @@ public class Location implements IBotApiObject { return longitude; } - public void setLongitude(Double longitude) { + public Location setLongitude(Double longitude) { this.longitude = longitude; + return this; } public Double getLatitude() { return latitude; } - public void setLatitude(Double latitude) { + public Location setLatitude(Double latitude) { this.latitude = latitude; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Message.java b/src/main/java/org/telegram/telegrambots/api/objects/Message.java index b404e2ba..924d8f7e 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/Message.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/Message.java @@ -219,248 +219,234 @@ public class Message implements IBotApiObject { return messageId; } - public void setMessageId(Integer messageId) { + public Message setMessageId(Integer messageId) { this.messageId = messageId; + return this; } public User getFrom() { return from; } - public void setFrom(User from) { + public Message setFrom(User from) { this.from = from; + return this; } public Integer getDate() { return date; } - public void setDate(Integer date) { + public Message setDate(Integer date) { this.date = date; - } - - public boolean isGroupMessage() { - return chat.isGroupChat(); - } - - public boolean isUserMessage() { - return chat.isUserChat(); - } - - public boolean isChannelMessage() { - return chat.isChannelChat(); - } - - public boolean isSuperGroupMessage() { - return chat.isSuperGroupChat(); - } - - public Long getChatId() { - return chat.getId(); + return this; } public Chat getChat() { return chat; } - public void setChat(Chat chat) { + public Message setChat(Chat chat) { this.chat = chat; + return this; } public User getForwardFrom() { return forwardFrom; } - public void setForwardFrom(User forwardFrom) { + public Message setForwardFrom(User forwardFrom) { this.forwardFrom = forwardFrom; + return this; } public Integer getForwardDate() { return forwardDate; } - public void setForwardDate(Integer forwardDate) { + public Message setForwardDate(Integer forwardDate) { this.forwardDate = forwardDate; - } - - public boolean hasText() { - return text != null && !text.isEmpty(); + return this; } public String getText() { return text; } - public void setText(String text) { + public Message setText(String text) { this.text = text; + return this; } public Audio getAudio() { return audio; } - public void setAudio(Audio audio) { + public Message setAudio(Audio audio) { this.audio = audio; - } - - public boolean hasDocument() { - return this.document != null; + return this; } public Document getDocument() { return document; } - public void setDocument(Document document) { + public Message setDocument(Document document) { this.document = document; + return this; } public List getPhoto() { return photo; } - public void setPhoto(List photo) { + public Message setPhoto(List photo) { this.photo = photo; + return this; } public Sticker getSticker() { return sticker; } - public void setSticker(Sticker sticker) { + public Message setSticker(Sticker sticker) { this.sticker = sticker; + return this; } public Video getVideo() { return video; } - public void setVideo(Video video) { + public Message setVideo(Video video) { this.video = video; + return this; } public Contact getContact() { return contact; } - public void setContact(Contact contact) { + public Message setContact(Contact contact) { this.contact = contact; + return this; } public Location getLocation() { return location; } - public void setLocation(Location location) { + public Message setLocation(Location location) { this.location = location; + return this; } public User getNewChatMember() { return newChatMember; } - public void setNewChatMember(User newChatMember) { + public Message setNewChatMember(User newChatMember) { this.newChatMember = newChatMember; + return this; } public User getLeftChatMember() { return leftChatMember; } - public void setLeftChatMember(User leftChatMember) { + public Message setLeftChatMember(User leftChatMember) { this.leftChatMember = leftChatMember; + return this; } public String getNewChatTitle() { return newChatTitle; } - public void setNewChatTitle(String newChatTitle) { + public Message setNewChatTitle(String newChatTitle) { this.newChatTitle = newChatTitle; + return this; } public List getNewChatPhoto() { return newChatPhoto; } - public void setNewChatPhoto(List newChatPhoto) { + public Message setNewChatPhoto(List newChatPhoto) { this.newChatPhoto = newChatPhoto; + return this; } public Boolean getDeleteChatPhoto() { return deleteChatPhoto; } - public void setDeleteChatPhoto(Boolean deleteChatPhoto) { + public Message setDeleteChatPhoto(Boolean deleteChatPhoto) { this.deleteChatPhoto = deleteChatPhoto; + return this; } public Boolean getGroupchatCreated() { return groupchatCreated; } - public void setGroupchatCreated(Boolean groupchatCreated) { + public Message setGroupchatCreated(Boolean groupchatCreated) { this.groupchatCreated = groupchatCreated; - } - - public boolean hasReplayMessage() { - return replyToMessage != null; + return this; } public Message getReplyToMessage() { return replyToMessage; } - public void setReplyToMessage(Message replyToMessage) { + public Message setReplyToMessage(Message replyToMessage) { this.replyToMessage = replyToMessage; - } - - public boolean isReply() { - return this.replyToMessage != null; - } - - public boolean hasLocation() { - return location != null; + return this; } public Voice getVoice() { return voice; } - public void setVoice(Voice voice) { + public Message setVoice(Voice voice) { this.voice = voice; + return this; } public Boolean getSuperGroupCreated() { return superGroupCreated; } - public void setSuperGroupCreated(Boolean superGroupCreated) { + public Message setSuperGroupCreated(Boolean superGroupCreated) { this.superGroupCreated = superGroupCreated; + return this; } public Boolean getChannelChatCreated() { return channelChatCreated; } - public void setChannelChatCreated(Boolean channelChatCreated) { + public Message setChannelChatCreated(Boolean channelChatCreated) { this.channelChatCreated = channelChatCreated; + return this; } public Long getMigrateToChatId() { return migrateToChatId; } - public void setMigrateToChatId(Long migrateToChatId) { + public Message setMigrateToChatId(Long migrateToChatId) { this.migrateToChatId = migrateToChatId; + return this; } public Long getMigrateFromChatId() { return migrateFromChatId; } - public void setMigrateFromChatId(Long migrateFromChatId) { + public Message setMigrateFromChatId(Long migrateFromChatId) { this.migrateFromChatId = migrateFromChatId; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/PhotoSize.java b/src/main/java/org/telegram/telegrambots/api/objects/PhotoSize.java index 3db4f6e9..90812725 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/PhotoSize.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/PhotoSize.java @@ -55,40 +55,45 @@ public class PhotoSize implements IBotApiObject { return fileId; } - public void setFileId(String fileId) { + public PhotoSize setFileId(String fileId) { this.fileId = fileId; + return this; } public Integer getWidth() { return width; } - public void setWidth(Integer width) { + public PhotoSize setWidth(Integer width) { this.width = width; + return this; } public Integer getHeight() { return height; } - public void setHeight(Integer height) { + public PhotoSize setHeight(Integer height) { this.height = height; + return this; } public Integer getFileSize() { return fileSize; } - public void setFileSize(Integer fileSize) { + public PhotoSize setFileSize(Integer fileSize) { this.fileSize = fileSize; + return this; } public String getFilePath() { return filePath; } - public void setFilePath(String filePath) { + public PhotoSize setFilePath(String filePath) { this.filePath = filePath; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/UserProfilePhotos.java b/src/main/java/org/telegram/telegrambots/api/objects/UserProfilePhotos.java index 6369a9b5..80fc6aa8 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/UserProfilePhotos.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/UserProfilePhotos.java @@ -53,16 +53,18 @@ public class UserProfilePhotos implements IBotApiObject { return totalCount; } - public void setTotalCount(Integer totalCount) { + public UserProfilePhotos setTotalCount(Integer totalCount) { this.totalCount = totalCount; + return this; } public List> getPhotos() { return photos; } - public void setPhotos(List> photos) { + public UserProfilePhotos setPhotos(List> photos) { this.photos = photos; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Video.java b/src/main/java/org/telegram/telegrambots/api/objects/Video.java index 9ccccf35..65b09f23 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/Video.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/Video.java @@ -60,60 +60,67 @@ public class Video implements IBotApiObject { } } - public Integer getWidth() { - return width; - } - - public void setWidth(Integer width) { - this.width = width; - } - public String getFileId() { return fileId; } - public void setFileId(String fileId) { + public Video setFileId(String fileId) { this.fileId = fileId; + return this; + } + + public Integer getWidth() { + return width; + } + + public Video setWidth(Integer width) { + this.width = width; + return this; } public Integer getHeight() { return height; } - public void setHeight(Integer height) { + public Video setHeight(Integer height) { this.height = height; + return this; } public Integer getDuration() { return duration; } - public void setDuration(Integer duration) { + public Video setDuration(Integer duration) { this.duration = duration; + return this; } public PhotoSize getThumb() { return thumb; } - public void setThumb(PhotoSize thumb) { + public Video setThumb(PhotoSize thumb) { this.thumb = thumb; + return this; } public String getMimeType() { return mimeType; } - public void setMimeType(String mimeType) { + public Video setMimeType(String mimeType) { this.mimeType = mimeType; + return this; } public Integer getFileSize() { return fileSize; } - public void setFileSize(Integer fileSize) { + public Video setFileSize(Integer fileSize) { this.fileSize = fileSize; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Voice.java b/src/main/java/org/telegram/telegrambots/api/objects/Voice.java index ffa4a640..155a18c8 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/Voice.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/Voice.java @@ -50,32 +50,36 @@ public class Voice implements IBotApiObject { return fileId; } - public void setFileId(String fileId) { + public Voice setFileId(String fileId) { this.fileId = fileId; + return this; } public Integer getDuration() { return duration; } - public void setDuration(Integer duration) { + public Voice setDuration(Integer duration) { this.duration = duration; + return this; } public String getMimeType() { return mimeType; } - public void setMimeType(String mimeType) { + public Voice setMimeType(String mimeType) { this.mimeType = mimeType; + return this; } public Integer getFileSize() { return fileSize; } - public void setFileSize(Integer fileSize) { + public Voice setFileSize(Integer fileSize) { this.fileSize = fileSize; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/ChosenInlineQuery.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/ChosenInlineQuery.java index f5ead3fb..3437083a 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/ChosenInlineQuery.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/ChosenInlineQuery.java @@ -64,22 +64,47 @@ public class ChosenInlineQuery implements IBotApiObject { return resultId; } + public ChosenInlineQuery setResultId(String resultId) { + this.resultId = resultId; + return this; + } + public User getFrom() { return from; } - public String getQuery() { - return query; + public ChosenInlineQuery setFrom(User from) { + this.from = from; + return this; } public Location getLocation() { return location; } + public ChosenInlineQuery setLocation(Location location) { + this.location = location; + return this; + } + public String getInlineMessageId() { return inlineMessageId; } + public ChosenInlineQuery setInlineMessageId(String inlineMessageId) { + this.inlineMessageId = inlineMessageId; + return this; + } + + public String getQuery() { + return query; + } + + public ChosenInlineQuery setQuery(String query) { + this.query = query; + return this; + } + @Override public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException { gen.writeStartObject(); diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/InlineQuery.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/InlineQuery.java index 60ec2317..713ff7e5 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/InlineQuery.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/InlineQuery.java @@ -69,22 +69,47 @@ public class InlineQuery implements IBotApiObject { return id; } + public InlineQuery setId(String id) { + this.id = id; + return this; + } + public User getFrom() { return from; } + public InlineQuery setFrom(User from) { + this.from = from; + return this; + } + public Location getLocation() { return location; } + public InlineQuery setLocation(Location location) { + this.location = location; + return this; + } + public String getQuery() { return query; } + public InlineQuery setQuery(String query) { + this.query = query; + return this; + } + public String getOffset() { return offset; } + public InlineQuery setOffset(String offset) { + this.offset = offset; + return this; + } + @Override public void serializeWithType(JsonGenerator gen, SerializerProvider serializers, TypeSerializer typeSer) throws IOException { serialize(gen, serializers); diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputContactMessageContent.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputContactMessageContent.java index f4515340..67ee65ea 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputContactMessageContent.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputContactMessageContent.java @@ -37,24 +37,27 @@ public class InputContactMessageContent implements InputMessageContent { return phoneNumber; } - public void setPhoneNumber(String phoneNumber) { + public InputContactMessageContent setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; + return this; } public String getFirstName() { return firstName; } - public void setFirstName(String firstName) { + public InputContactMessageContent setFirstName(String firstName) { this.firstName = firstName; + return this; } public String getLastName() { return lastName; } - public void setLastName(String lastName) { + public InputContactMessageContent setLastName(String lastName) { this.lastName = lastName; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputLocationMessageContent.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputLocationMessageContent.java index 59bb84c1..553e1eeb 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputLocationMessageContent.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputLocationMessageContent.java @@ -30,20 +30,22 @@ public class InputLocationMessageContent implements InputMessageContent { super(); } - public Float getLatitude() { - return latitude; - } - - public void setLatitude(Float latitude) { - this.latitude = latitude; - } - public Float getLongitude() { return longitude; } - public void setLongitude(Float longitude) { + public InputLocationMessageContent setLongitude(Float longitude) { this.longitude = longitude; + return this; + } + + public Float getLatitude() { + return latitude; + } + + public InputLocationMessageContent setLatitude(Float latitude) { + this.latitude = latitude; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputTextMessageContent.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputTextMessageContent.java index 47960b6a..23769798 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputTextMessageContent.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputTextMessageContent.java @@ -36,14 +36,29 @@ public class InputTextMessageContent implements InputMessageContent { return messageText; } - public void setMessageText(String messageText) { + public InputTextMessageContent setMessageText(String messageText) { this.messageText = messageText; + return this; } public String getParseMode() { return parseMode; } + public InputTextMessageContent setParseMode(String parseMode) { + this.parseMode = parseMode; + return this; + } + + public Boolean getDisableWebPagePreview() { + return disableWebPagePreview; + } + + public InputTextMessageContent setDisableWebPagePreview(Boolean disableWebPagePreview) { + this.disableWebPagePreview = disableWebPagePreview; + return this; + } + public void enableMarkdown(boolean enable) { if (enable) { this.parseMode = ParseMode.MARKDOWN; @@ -60,10 +75,6 @@ public class InputTextMessageContent implements InputMessageContent { } } - public Boolean getDisableWebPagePreview() { - return disableWebPagePreview; - } - public void disableWebPagePreview() { disableWebPagePreview = true; } diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputVenueMessageContent.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputVenueMessageContent.java index f2f02115..a133b9e0 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputVenueMessageContent.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputVenueMessageContent.java @@ -43,40 +43,45 @@ public class InputVenueMessageContent implements InputMessageContent { return latitude; } - public void setLatitude(Float latitude) { + public InputVenueMessageContent setLatitude(Float latitude) { this.latitude = latitude; + return this; } public Float getLongitude() { return longitude; } - public void setLongitude(Float longitude) { + public InputVenueMessageContent setLongitude(Float longitude) { this.longitude = longitude; + return this; } public String getTitle() { return title; } - public void setTitle(String title) { + public InputVenueMessageContent setTitle(String title) { this.title = title; + return this; } public String getAddress() { return address; } - public void setAddress(String address) { + public InputVenueMessageContent setAddress(String address) { this.address = address; + return this; } public String getFoursquareId() { return foursquareId; } - public void setFoursquareId(String foursquareId) { + public InputVenueMessageContent setFoursquareId(String foursquareId) { this.foursquareId = foursquareId; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultArticle.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultArticle.java index fa7a9c6a..bb08b6ec 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultArticle.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultArticle.java @@ -61,80 +61,90 @@ public class InlineQueryResultArticle implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultArticle setId(String id) { this.id = id; + return this; } public String getTitle() { return title; } - public void setTitle(String title) { + public InlineQueryResultArticle setTitle(String title) { this.title = title; + return this; } public InputMessageContent getInputMessageContent() { return inputMessageContent; } - public void setInputMessageContent(InputMessageContent inputMessageContent) { + public InlineQueryResultArticle setInputMessageContent(InputMessageContent inputMessageContent) { this.inputMessageContent = inputMessageContent; + return this; } public InlineKeyboardMarkup getReplyMarkup() { return replyMarkup; } - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + public InlineQueryResultArticle setReplyMarkup(InlineKeyboardMarkup replyMarkup) { this.replyMarkup = replyMarkup; + return this; } public String getUrl() { return url; } - public void setUrl(String url) { + public InlineQueryResultArticle setUrl(String url) { this.url = url; + return this; } public Boolean getHideUrl() { return hideUrl; } - public void setHideUrl(Boolean hideUrl) { + public InlineQueryResultArticle setHideUrl(Boolean hideUrl) { this.hideUrl = hideUrl; + return this; } public String getDescription() { return description; } - public void setDescription(String description) { + public InlineQueryResultArticle setDescription(String description) { this.description = description; + return this; } public String getThumbUrl() { return thumbUrl; } - public void setThumbUrl(String thumbUrl) { + public InlineQueryResultArticle setThumbUrl(String thumbUrl) { this.thumbUrl = thumbUrl; + return this; } public Integer getThumbWidth() { return thumbWidth; } - public void setThumbWidth(Integer thumbWidth) { + public InlineQueryResultArticle setThumbWidth(Integer thumbWidth) { this.thumbWidth = thumbWidth; + return this; } public Integer getThumbHeight() { return thumbHeight; } - public void setThumbHeight(Integer thumbHeight) { + public InlineQueryResultArticle setThumbHeight(Integer thumbHeight) { this.thumbHeight = thumbHeight; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultAudio.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultAudio.java index 73c1c92c..6cb5fc91 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultAudio.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultAudio.java @@ -56,56 +56,63 @@ public class InlineQueryResultAudio implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultAudio setId(String id) { this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getAudioUrl() { return audioUrl; } - public void setAudioUrl(String audioUrl) { + public InlineQueryResultAudio setAudioUrl(String audioUrl) { this.audioUrl = audioUrl; + return this; + } + + public String getTitle() { + return title; + } + + public InlineQueryResultAudio setTitle(String title) { + this.title = title; + return this; } public String getPerformer() { return performer; } - public void setPerformer(String performer) { + public InlineQueryResultAudio setPerformer(String performer) { this.performer = performer; + return this; } public Integer getAudioDuration() { return audioDuration; } - public void setAudioDuration(Integer audioDuration) { + public InlineQueryResultAudio setAudioDuration(Integer audioDuration) { this.audioDuration = audioDuration; + return this; + } + + public InputMessageContent getInputMessageContent() { + return inputMessageContent; + } + + public InlineQueryResultAudio setInputMessageContent(InputMessageContent inputMessageContent) { + this.inputMessageContent = inputMessageContent; + return this; + } + + public InlineKeyboardMarkup getReplyMarkup() { + return replyMarkup; + } + + public InlineQueryResultAudio setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + this.replyMarkup = replyMarkup; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultContact.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultContact.java index bcfb6fb8..78ee36e3 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultContact.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultContact.java @@ -62,72 +62,81 @@ public class InlineQueryResultContact implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultContact setId(String id) { this.id = id; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - } - - public Integer getThumbWidth() { - return thumbWidth; - } - - public void setThumbWidth(Integer thumbWidth) { - this.thumbWidth = thumbWidth; - } - - public Integer getThumbHeight() { - return thumbHeight; - } - - public void setThumbHeight(Integer thumbHeight) { - this.thumbHeight = thumbHeight; - } - - public String getThumbUrl() { - return thumbUrl; - } - - public void setThumbUrl(String thumbUrl) { - this.thumbUrl = thumbUrl; + return this; } public String getPhoneNumber() { return phoneNumber; } - public void setPhoneNumber(String phoneNumber) { + public InlineQueryResultContact setPhoneNumber(String phoneNumber) { this.phoneNumber = phoneNumber; + return this; } public String getFirstName() { return firstName; } - public void setFirstName(String firstName) { + public InlineQueryResultContact setFirstName(String firstName) { this.firstName = firstName; + return this; } public String getLastName() { return lastName; } - public void setLastName(String lastName) { + public InlineQueryResultContact setLastName(String lastName) { this.lastName = lastName; + return this; + } + + public InlineKeyboardMarkup getReplyMarkup() { + return replyMarkup; + } + + public InlineQueryResultContact setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + this.replyMarkup = replyMarkup; + return this; + } + + public InputMessageContent getInputMessageContent() { + return inputMessageContent; + } + + public InlineQueryResultContact setInputMessageContent(InputMessageContent inputMessageContent) { + this.inputMessageContent = inputMessageContent; + return this; + } + + public String getThumbUrl() { + return thumbUrl; + } + + public InlineQueryResultContact setThumbUrl(String thumbUrl) { + this.thumbUrl = thumbUrl; + return this; + } + + public Integer getThumbWidth() { + return thumbWidth; + } + + public InlineQueryResultContact setThumbWidth(Integer thumbWidth) { + this.thumbWidth = thumbWidth; + return this; + } + + public Integer getThumbHeight() { + return thumbHeight; + } + + public InlineQueryResultContact setThumbHeight(Integer thumbHeight) { + this.thumbHeight = thumbHeight; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultDocument.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultDocument.java index c72344d7..74f1a6cf 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultDocument.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultDocument.java @@ -69,88 +69,99 @@ public class InlineQueryResultDocument implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultDocument setId(String id) { this.id = id; + return this; } public String getTitle() { return title; } - public void setTitle(String title) { + public InlineQueryResultDocument setTitle(String title) { this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - } - - public String getMimeType() { - return mimeType; - } - - public void setMimeType(String mimeType) { - this.mimeType = mimeType; + return this; } public String getDocumentUrl() { return documentUrl; } - public void setDocumentUrl(String documentUrl) { + public InlineQueryResultDocument setDocumentUrl(String documentUrl) { this.documentUrl = documentUrl; + return this; } - public Integer getThumbWidth() { - return thumbWidth; + public String getMimeType() { + return mimeType; } - public void setThumbWidth(Integer thumbWidth) { - this.thumbWidth = thumbWidth; - } - - public Integer getThumbHeight() { - return thumbHeight; - } - - public void setThumbHeight(Integer thumbHeight) { - this.thumbHeight = thumbHeight; - } - - public String getThumbUrl() { - return thumbUrl; - } - - public void setThumbUrl(String thumbUrl) { - this.thumbUrl = thumbUrl; + public InlineQueryResultDocument setMimeType(String mimeType) { + this.mimeType = mimeType; + return this; } public String getDescription() { return description; } - public void setDescription(String description) { + public InlineQueryResultDocument setDescription(String description) { this.description = description; + return this; } public String getCaption() { return caption; } - public void setCaption(String caption) { + public InlineQueryResultDocument setCaption(String caption) { this.caption = caption; + return this; + } + + public InlineKeyboardMarkup getReplyMarkup() { + return replyMarkup; + } + + public InlineQueryResultDocument setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + this.replyMarkup = replyMarkup; + return this; + } + + public InputMessageContent getInputMessageContent() { + return inputMessageContent; + } + + public InlineQueryResultDocument setInputMessageContent(InputMessageContent inputMessageContent) { + this.inputMessageContent = inputMessageContent; + return this; + } + + public String getThumbUrl() { + return thumbUrl; + } + + public InlineQueryResultDocument setThumbUrl(String thumbUrl) { + this.thumbUrl = thumbUrl; + return this; + } + + public Integer getThumbWidth() { + return thumbWidth; + } + + public InlineQueryResultDocument setThumbWidth(Integer thumbWidth) { + this.thumbWidth = thumbWidth; + return this; + } + + public Integer getThumbHeight() { + return thumbHeight; + } + + public InlineQueryResultDocument setThumbHeight(Integer thumbHeight) { + this.thumbHeight = thumbHeight; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultGif.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultGif.java index 9701212c..217d0c22 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultGif.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultGif.java @@ -60,72 +60,81 @@ public class InlineQueryResultGif implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultGif setId(String id) { this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getGifUrl() { return gifUrl; } - public void setGifUrl(String gifUrl) { + public InlineQueryResultGif setGifUrl(String gifUrl) { this.gifUrl = gifUrl; + return this; } public Integer getGifWidth() { return gifWidth; } - public void setGifWidth(Integer gifWidth) { + public InlineQueryResultGif setGifWidth(Integer gifWidth) { this.gifWidth = gifWidth; + return this; } public Integer getGifHeight() { return gifHeight; } - public void setGifHeight(Integer gifHeight) { + public InlineQueryResultGif setGifHeight(Integer gifHeight) { this.gifHeight = gifHeight; + return this; } public String getThumbUrl() { return thumbUrl; } - public void setThumbUrl(String thumbUrl) { + public InlineQueryResultGif setThumbUrl(String thumbUrl) { this.thumbUrl = thumbUrl; + return this; + } + + public String getTitle() { + return title; + } + + public InlineQueryResultGif setTitle(String title) { + this.title = title; + return this; } public String getCaption() { return caption; } - public void setCaption(String caption) { + public InlineQueryResultGif setCaption(String caption) { this.caption = caption; + return this; + } + + public InputMessageContent getInputMessageContent() { + return inputMessageContent; + } + + public InlineQueryResultGif setInputMessageContent(InputMessageContent inputMessageContent) { + this.inputMessageContent = inputMessageContent; + return this; + } + + public InlineKeyboardMarkup getReplyMarkup() { + return replyMarkup; + } + + public InlineQueryResultGif setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + this.replyMarkup = replyMarkup; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultLocation.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultLocation.java index 7ca7c562..bc5fbc86 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultLocation.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultLocation.java @@ -62,72 +62,81 @@ public class InlineQueryResultLocation implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultLocation setId(String id) { this.id = id; + return this; } public String getTitle() { return title; } - public void setTitle(String title) { + public InlineQueryResultLocation setTitle(String title) { this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getLatitude() { return latitude; } - public void setLatitude(String latitude) { + public InlineQueryResultLocation setLatitude(String latitude) { this.latitude = latitude; + return this; } public String getLongitude() { return longitude; } - public void setLongitude(String longitude) { + public InlineQueryResultLocation setLongitude(String longitude) { this.longitude = longitude; + return this; } - public Integer getThumbWidth() { - return thumbWidth; + public InlineKeyboardMarkup getReplyMarkup() { + return replyMarkup; } - public void setThumbWidth(Integer thumbWidth) { - this.thumbWidth = thumbWidth; + public InlineQueryResultLocation setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + this.replyMarkup = replyMarkup; + return this; } - public Integer getThumbHeight() { - return thumbHeight; + public InputMessageContent getInputMessageContent() { + return inputMessageContent; } - public void setThumbHeight(Integer thumbHeight) { - this.thumbHeight = thumbHeight; + public InlineQueryResultLocation setInputMessageContent(InputMessageContent inputMessageContent) { + this.inputMessageContent = inputMessageContent; + return this; } public String getThumbUrl() { return thumbUrl; } - public void setThumbUrl(String thumbUrl) { + public InlineQueryResultLocation setThumbUrl(String thumbUrl) { this.thumbUrl = thumbUrl; + return this; + } + + public Integer getThumbWidth() { + return thumbWidth; + } + + public InlineQueryResultLocation setThumbWidth(Integer thumbWidth) { + this.thumbWidth = thumbWidth; + return this; + } + + public Integer getThumbHeight() { + return thumbHeight; + } + + public InlineQueryResultLocation setThumbHeight(Integer thumbHeight) { + this.thumbHeight = thumbHeight; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultMpeg4Gif.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultMpeg4Gif.java index 973c0866..f9486568 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultMpeg4Gif.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultMpeg4Gif.java @@ -60,72 +60,81 @@ public class InlineQueryResultMpeg4Gif implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultMpeg4Gif setId(String id) { this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getMpeg4Url() { return mpeg4Url; } - public void setMpeg4Url(String mpeg4Url) { + public InlineQueryResultMpeg4Gif setMpeg4Url(String mpeg4Url) { this.mpeg4Url = mpeg4Url; + return this; } public Integer getMpeg4Width() { return mpeg4Width; } - public void setMpeg4Width(Integer mpeg4Width) { + public InlineQueryResultMpeg4Gif setMpeg4Width(Integer mpeg4Width) { this.mpeg4Width = mpeg4Width; + return this; } public Integer getMpeg4Height() { return mpeg4Height; } - public void setMpeg4Height(Integer mpeg4Height) { + public InlineQueryResultMpeg4Gif setMpeg4Height(Integer mpeg4Height) { this.mpeg4Height = mpeg4Height; + return this; } public String getThumbUrl() { return thumbUrl; } - public void setThumbUrl(String thumbUrl) { + public InlineQueryResultMpeg4Gif setThumbUrl(String thumbUrl) { this.thumbUrl = thumbUrl; + return this; + } + + public String getTitle() { + return title; + } + + public InlineQueryResultMpeg4Gif setTitle(String title) { + this.title = title; + return this; } public String getCaption() { return caption; } - public void setCaption(String caption) { + public InlineQueryResultMpeg4Gif setCaption(String caption) { this.caption = caption; + return this; + } + + public InputMessageContent getInputMessageContent() { + return inputMessageContent; + } + + public InlineQueryResultMpeg4Gif setInputMessageContent(InputMessageContent inputMessageContent) { + this.inputMessageContent = inputMessageContent; + return this; + } + + public InlineKeyboardMarkup getReplyMarkup() { + return replyMarkup; + } + + public InlineQueryResultMpeg4Gif setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + this.replyMarkup = replyMarkup; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultPhoto.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultPhoto.java index ba657623..4ce4af90 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultPhoto.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultPhoto.java @@ -66,88 +66,99 @@ public class InlineQueryResultPhoto implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultPhoto setId(String id) { this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getPhotoUrl() { return photoUrl; } - public void setPhotoUrl(String photoUrl) { + public InlineQueryResultPhoto setPhotoUrl(String photoUrl) { this.photoUrl = photoUrl; + return this; } public String getMimeType() { return mimeType; } - public void setMimeType(String mimeType) { + public InlineQueryResultPhoto setMimeType(String mimeType) { this.mimeType = mimeType; + return this; } public Integer getPhotoWidth() { return photoWidth; } - public void setPhotoWidth(Integer photoWidth) { + public InlineQueryResultPhoto setPhotoWidth(Integer photoWidth) { this.photoWidth = photoWidth; + return this; } public Integer getPhotoHeight() { return photoHeight; } - public void setPhotoHeight(Integer photoHeight) { + public InlineQueryResultPhoto setPhotoHeight(Integer photoHeight) { this.photoHeight = photoHeight; + return this; } public String getThumbUrl() { return thumbUrl; } - public void setThumbUrl(String thumbUrl) { + public InlineQueryResultPhoto setThumbUrl(String thumbUrl) { this.thumbUrl = thumbUrl; + return this; + } + + public String getTitle() { + return title; + } + + public InlineQueryResultPhoto setTitle(String title) { + this.title = title; + return this; } public String getDescription() { return description; } - public void setDescription(String description) { + public InlineQueryResultPhoto setDescription(String description) { this.description = description; + return this; } public String getCaption() { return caption; } - public void setCaption(String caption) { + public InlineQueryResultPhoto setCaption(String caption) { this.caption = caption; + return this; + } + + public InputMessageContent getInputMessageContent() { + return inputMessageContent; + } + + public InlineQueryResultPhoto setInputMessageContent(InputMessageContent inputMessageContent) { + this.inputMessageContent = inputMessageContent; + return this; + } + + public InlineKeyboardMarkup getReplyMarkup() { + return replyMarkup; + } + + public InlineQueryResultPhoto setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + this.replyMarkup = replyMarkup; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVenue.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVenue.java index 2d101dbf..b99feb7d 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVenue.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVenue.java @@ -67,88 +67,99 @@ public class InlineQueryResultVenue implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultVenue setId(String id) { this.id = id; + return this; } public String getTitle() { return title; } - public void setTitle(String title) { + public InlineQueryResultVenue setTitle(String title) { this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getLatitude() { return latitude; } - public void setLatitude(String latitude) { + public InlineQueryResultVenue setLatitude(String latitude) { this.latitude = latitude; + return this; } public String getLongitude() { return longitude; } - public void setLongitude(String longitude) { + public InlineQueryResultVenue setLongitude(String longitude) { this.longitude = longitude; - } - - public Integer getThumbWidth() { - return thumbWidth; - } - - public void setThumbWidth(Integer thumbWidth) { - this.thumbWidth = thumbWidth; - } - - public Integer getThumbHeight() { - return thumbHeight; - } - - public void setThumbHeight(Integer thumbHeight) { - this.thumbHeight = thumbHeight; - } - - public String getThumbUrl() { - return thumbUrl; - } - - public void setThumbUrl(String thumbUrl) { - this.thumbUrl = thumbUrl; + return this; } public String getAddress() { return address; } - public void setAddress(String address) { + public InlineQueryResultVenue setAddress(String address) { this.address = address; + return this; } public String getFoursquareId() { return foursquareId; } - public void setFoursquareId(String foursquareId) { + public InlineQueryResultVenue setFoursquareId(String foursquareId) { this.foursquareId = foursquareId; + return this; + } + + public InlineKeyboardMarkup getReplyMarkup() { + return replyMarkup; + } + + public InlineQueryResultVenue setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + this.replyMarkup = replyMarkup; + return this; + } + + public InputMessageContent getInputMessageContent() { + return inputMessageContent; + } + + public InlineQueryResultVenue setInputMessageContent(InputMessageContent inputMessageContent) { + this.inputMessageContent = inputMessageContent; + return this; + } + + public String getThumbUrl() { + return thumbUrl; + } + + public InlineQueryResultVenue setThumbUrl(String thumbUrl) { + this.thumbUrl = thumbUrl; + return this; + } + + public Integer getThumbWidth() { + return thumbWidth; + } + + public InlineQueryResultVenue setThumbWidth(Integer thumbWidth) { + this.thumbWidth = thumbWidth; + return this; + } + + public Integer getThumbHeight() { + return thumbHeight; + } + + public InlineQueryResultVenue setThumbHeight(Integer thumbHeight) { + this.thumbHeight = thumbHeight; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVideo.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVideo.java index e01e0ff8..3f6a3022 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVideo.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVideo.java @@ -69,96 +69,108 @@ public class InlineQueryResultVideo implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultVideo setId(String id) { this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getMimeType() { return mimeType; } - public void setMimeType(String mimeType) { + public InlineQueryResultVideo setMimeType(String mimeType) { this.mimeType = mimeType; + return this; } public String getVideoUrl() { return videoUrl; } - public void setVideoUrl(String videoUrl) { + public InlineQueryResultVideo setVideoUrl(String videoUrl) { this.videoUrl = videoUrl; + return this; } public Integer getVideoWidth() { return videoWidth; } - public void setVideoWidth(Integer videoWidth) { + public InlineQueryResultVideo setVideoWidth(Integer videoWidth) { this.videoWidth = videoWidth; + return this; } public Integer getVideoHeight() { return videoHeight; } - public void setVideoHeight(Integer videoHeight) { + public InlineQueryResultVideo setVideoHeight(Integer videoHeight) { this.videoHeight = videoHeight; + return this; } public Integer getVideoDuration() { return videoDuration; } - public void setVideoDuration(Integer videoDuration) { + public InlineQueryResultVideo setVideoDuration(Integer videoDuration) { this.videoDuration = videoDuration; + return this; } public String getThumbUrl() { return thumbUrl; } - public void setThumbUrl(String thumbUrl) { + public InlineQueryResultVideo setThumbUrl(String thumbUrl) { this.thumbUrl = thumbUrl; + return this; + } + + public String getTitle() { + return title; + } + + public InlineQueryResultVideo setTitle(String title) { + this.title = title; + return this; } public String getDescription() { return description; } - public void setDescription(String description) { + public InlineQueryResultVideo setDescription(String description) { this.description = description; + return this; } public String getCaption() { return caption; } - public void setCaption(String caption) { + public InlineQueryResultVideo setCaption(String caption) { this.caption = caption; + return this; + } + + public InputMessageContent getInputMessageContent() { + return inputMessageContent; + } + + public InlineQueryResultVideo setInputMessageContent(InputMessageContent inputMessageContent) { + this.inputMessageContent = inputMessageContent; + return this; + } + + public InlineKeyboardMarkup getReplyMarkup() { + return replyMarkup; + } + + public InlineQueryResultVideo setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + this.replyMarkup = replyMarkup; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVoice.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVoice.java index 23268a73..31631028 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVoice.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/InlineQueryResultVoice.java @@ -53,48 +53,54 @@ public class InlineQueryResultVoice implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultVoice setId(String id) { this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - } - - public Integer getVoiceDuration() { - return voiceDuration; - } - - public void setVoiceDuration(Integer voiceDuration) { - this.voiceDuration = voiceDuration; + return this; } public String getVoiceUrl() { return voiceUrl; } - public void setVoiceUrl(String voiceUrl) { + public InlineQueryResultVoice setVoiceUrl(String voiceUrl) { this.voiceUrl = voiceUrl; + return this; + } + + public String getTitle() { + return title; + } + + public InlineQueryResultVoice setTitle(String title) { + this.title = title; + return this; + } + + public Integer getVoiceDuration() { + return voiceDuration; + } + + public InlineQueryResultVoice setVoiceDuration(Integer voiceDuration) { + this.voiceDuration = voiceDuration; + return this; + } + + public InputMessageContent getInputMessageContent() { + return inputMessageContent; + } + + public InlineQueryResultVoice setInputMessageContent(InputMessageContent inputMessageContent) { + this.inputMessageContent = inputMessageContent; + return this; + } + + public InlineKeyboardMarkup getReplyMarkup() { + return replyMarkup; + } + + public InlineQueryResultVoice setReplyMarkup(InlineKeyboardMarkup replyMarkup) { + this.replyMarkup = replyMarkup; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedAudio.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedAudio.java index 4a60879a..a53ca68c 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedAudio.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedAudio.java @@ -48,32 +48,36 @@ public class InlineQueryResultCachedAudio implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultCachedAudio setId(String id) { this.id = id; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getAudioFileId() { return audioFileId; } - public void setAudioFileId(String 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; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedDocument.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedDocument.java index 9c60eff2..21634824 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedDocument.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedDocument.java @@ -58,56 +58,63 @@ public class InlineQueryResultCachedDocument implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultCachedDocument setId(String id) { this.id = id; + return this; } public String getTitle() { return title; } - public void setTitle(String title) { + public InlineQueryResultCachedDocument setTitle(String title) { this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; - } - - public String getCaption() { - return caption; - } - - public void setCaption(String caption) { - this.caption = caption; + return this; } public String getDocumentFileId() { return documentFileId; } - public void setDocumentFileId(String documentFileId) { + public InlineQueryResultCachedDocument setDocumentFileId(String documentFileId) { this.documentFileId = documentFileId; + return this; } public String getDescription() { return description; } - public void setDescription(String 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; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedGif.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedGif.java index 702303aa..c2ad9280 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedGif.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedGif.java @@ -52,48 +52,54 @@ public class InlineQueryResultCachedGif implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultCachedGif setId(String id) { this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getGifFileId() { return gifFileId; } - public void setGifFileId(String 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 void setCaption(String 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; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedMpeg4Gif.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedMpeg4Gif.java index 4a9d4225..00112f0b 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedMpeg4Gif.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedMpeg4Gif.java @@ -52,48 +52,54 @@ public class InlineQueryResultCachedMpeg4Gif implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultCachedMpeg4Gif setId(String id) { this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getMpeg4FileId() { return mpeg4FileId; } - public void setMpeg4FileId(String 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 void setCaption(String 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; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedPhoto.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedPhoto.java index 08734fe3..a5a8306c 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedPhoto.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedPhoto.java @@ -55,56 +55,63 @@ public class InlineQueryResultCachedPhoto implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultCachedPhoto setId(String id) { this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getPhotoFileId() { return photoFileId; } - public void setPhotoFileId(String 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 void setDescription(String description) { + public InlineQueryResultCachedPhoto setDescription(String description) { this.description = description; + return this; } public String getCaption() { return caption; } - public void setCaption(String 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; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedSticker.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedSticker.java index e84b0f7a..14ad7d90 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedSticker.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedSticker.java @@ -48,32 +48,36 @@ public class InlineQueryResultCachedSticker implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultCachedSticker setId(String id) { this.id = id; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getStickerFileId() { return stickerFileId; } - public void setStickerFileId(String 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 diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedVideo.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedVideo.java index 0ed1f356..d187fc5a 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedVideo.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedVideo.java @@ -55,56 +55,63 @@ public class InlineQueryResultCachedVideo implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultCachedVideo setId(String id) { this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getVideoFileId() { return videoFileId; } - public void setVideoFileId(String videoFileId) { + public InlineQueryResultCachedVideo setVideoFileId(String videoFileId) { this.videoFileId = videoFileId; + return this; } - public String getCaption() { - return caption; + public String getTitle() { + return title; } - public void setCaption(String caption) { - this.caption = caption; + public InlineQueryResultCachedVideo setTitle(String title) { + this.title = title; + return this; } public String getDescription() { return description; } - public void setDescription(String 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; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedVoice.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedVoice.java index e8376494..810656b6 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedVoice.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/result/chached/InlineQueryResultCachedVoice.java @@ -51,40 +51,45 @@ public class InlineQueryResultCachedVoice implements InlineQueryResult { return id; } - public void setId(String id) { + public InlineQueryResultCachedVoice setId(String id) { this.id = id; - } - - public String getTitle() { - return title; - } - - public void setTitle(String title) { - this.title = title; - } - - public InputMessageContent getInputMessageContent() { - return inputMessageContent; - } - - public void setInputMessageContent(InputMessageContent inputMessageContent) { - this.inputMessageContent = inputMessageContent; - } - - public InlineKeyboardMarkup getReplyMarkup() { - return replyMarkup; - } - - public void setReplyMarkup(InlineKeyboardMarkup replyMarkup) { - this.replyMarkup = replyMarkup; + return this; } public String getVoiceFileId() { return voiceFileId; } - public void setVoiceFileId(String 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; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ForceReplyKeyboard.java b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ForceReplyKeyboard.java index 9381e0c6..f086dc89 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ForceReplyKeyboard.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ForceReplyKeyboard.java @@ -55,16 +55,18 @@ public class ForceReplyKeyboard implements ReplyKeyboard { return forceReply; } - public void setForceReply(Boolean forceReply) { + public ForceReplyKeyboard setForceReply(Boolean forceReply) { this.forceReply = forceReply; + return this; } public Boolean getSelective() { return selective; } - public void setSelective(Boolean selective) { + public ForceReplyKeyboard setSelective(Boolean selective) { this.selective = selective; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/InlineKeyboardMarkup.java b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/InlineKeyboardMarkup.java index 7531621c..7850ed29 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/InlineKeyboardMarkup.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/InlineKeyboardMarkup.java @@ -72,32 +72,36 @@ public class InlineKeyboardMarkup implements ReplyKeyboard { return keyboard; } - public void setKeyboard(List> keyboard) { + public InlineKeyboardMarkup setKeyboard(List> keyboard) { this.keyboard = keyboard; + return this; } public Boolean getResizeKeyboard() { return resizeKeyboard; } - public void setResizeKeyboard(Boolean resizeKeyboard) { + public InlineKeyboardMarkup setResizeKeyboard(Boolean resizeKeyboard) { this.resizeKeyboard = resizeKeyboard; + return this; } public Boolean getOneTimeKeyboad() { return oneTimeKeyboad; } - public void setOneTimeKeyboad(Boolean oneTimeKeyboad) { + public InlineKeyboardMarkup setOneTimeKeyboad(Boolean oneTimeKeyboad) { this.oneTimeKeyboad = oneTimeKeyboad; + return this; } public Boolean getSelective() { return selective; } - public void setSelective(Boolean selective) { + public InlineKeyboardMarkup setSelective(Boolean selective) { this.selective = selective; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ReplyKeyboardHide.java b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ReplyKeyboardHide.java index 031ed42b..2b5f9529 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ReplyKeyboardHide.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ReplyKeyboardHide.java @@ -51,16 +51,18 @@ public class ReplyKeyboardHide implements ReplyKeyboard { return hideKeyboard; } - public void setHideKeyboard(Boolean hideKeyboard) { + public ReplyKeyboardHide setHideKeyboard(Boolean hideKeyboard) { this.hideKeyboard = hideKeyboard; + return this; } public Boolean getSelective() { return selective; } - public void setSelective(Boolean selective) { + public ReplyKeyboardHide setSelective(Boolean selective) { this.selective = selective; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ReplyKeyboardMarkup.java b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ReplyKeyboardMarkup.java index bc7ea40c..a372443b 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ReplyKeyboardMarkup.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/ReplyKeyboardMarkup.java @@ -50,32 +50,36 @@ public class ReplyKeyboardMarkup implements ReplyKeyboard { return keyboard; } - public void setKeyboard(List keyboard) { + public ReplyKeyboardMarkup setKeyboard(List keyboard) { this.keyboard = keyboard; + return this; } public Boolean getResizeKeyboard() { return resizeKeyboard; } - public void setResizeKeyboard(Boolean resizeKeyboard) { + public ReplyKeyboardMarkup setResizeKeyboard(Boolean resizeKeyboard) { this.resizeKeyboard = resizeKeyboard; + return this; } public Boolean getOneTimeKeyboad() { return oneTimeKeyboad; } - public void setOneTimeKeyboad(Boolean oneTimeKeyboad) { + public ReplyKeyboardMarkup setOneTimeKeyboad(Boolean oneTimeKeyboad) { this.oneTimeKeyboad = oneTimeKeyboad; + return this; } public Boolean getSelective() { return selective; } - public void setSelective(Boolean selective) { + public ReplyKeyboardMarkup setSelective(Boolean selective) { this.selective = selective; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/InlineKeyboardButton.java b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/InlineKeyboardButton.java index 33db6e75..581566c8 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/InlineKeyboardButton.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/InlineKeyboardButton.java @@ -67,32 +67,36 @@ public class InlineKeyboardButton implements IBotApiObject, IToJson { return text; } - public void setText(String text) { + public InlineKeyboardButton setText(String text) { this.text = text; + return this; } public String getUrl() { return url; } - public void setUrl(String url) { + public InlineKeyboardButton setUrl(String url) { this.url = url; + return this; } public String getCallbackData() { return callbackData; } - public void setCallbackData(String callbackData) { + public InlineKeyboardButton setCallbackData(String callbackData) { this.callbackData = callbackData; + return this; } public String getSwitchInlineQuery() { return switchInlineQuery; } - public void setSwitchInlineQuery(String switchInlineQuery) { + public InlineKeyboardButton setSwitchInlineQuery(String switchInlineQuery) { this.switchInlineQuery = switchInlineQuery; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/KeyboardButton.java b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/KeyboardButton.java index af075ca6..a34dd371 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/KeyboardButton.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/replykeyboard/buttons/KeyboardButton.java @@ -71,30 +71,27 @@ public class KeyboardButton implements IBotApiObject, IToJson { return text; } - public void setText(String text) { + public KeyboardButton setText(String text) { this.text = text; + return this; } public Boolean getRequestContact() { return requestContact; } - public void setRequestContact(Boolean requestContact) { - if (requestContact != null) { - requestLocation = null; - } + public KeyboardButton setRequestContact(Boolean requestContact) { this.requestContact = requestContact; + return this; } public Boolean getRequestLocation() { return requestLocation; } - public void setRequestLocation(Boolean requestLocation) { - if (requestLocation != null) { - requestContact = null; - } + public KeyboardButton setRequestLocation(Boolean requestLocation) { this.requestLocation = requestLocation; + return this; } @Override From 1232d6f37879cf2752f7f1503a0d5e7fcfb86938 Mon Sep 17 00:00:00 2001 From: Alexander Babai Date: Tue, 12 Apr 2016 23:26:59 +0300 Subject: [PATCH 3/6] methods classes: enable/dissable methods to builder style --- .../api/methods/send/SendAudio.java | 6 ++++-- .../api/methods/send/SendContact.java | 6 ++++-- .../api/methods/send/SendDocument.java | 6 ++++-- .../api/methods/send/SendLocation.java | 6 ++++-- .../api/methods/send/SendMessage.java | 18 ++++++++++++------ .../api/methods/send/SendPhoto.java | 6 ++++-- .../api/methods/send/SendSticker.java | 6 ++++-- .../api/methods/send/SendVenue.java | 6 ++++-- .../api/methods/send/SendVideo.java | 6 ++++-- .../api/methods/send/SendVoice.java | 6 ++++-- .../updatingmessages/EditMessageText.java | 12 ++++++++---- 11 files changed, 56 insertions(+), 28 deletions(-) diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendAudio.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendAudio.java index c9b6444c..649906ca 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendAudio.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendAudio.java @@ -130,12 +130,14 @@ public class SendAudio { return disableNotification; } - public void enableNotification() { + public SendAudio enableNotification() { this.disableNotification = false; + return this; } - public void disableNotification() { + public SendAudio disableNotification() { this.disableNotification = true; + return this; } public boolean isNewAudio() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendContact.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendContact.java index b3eaf39a..3fd86098 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendContact.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendContact.java @@ -72,12 +72,14 @@ public class SendContact extends BotApiMethod { return disableNotification; } - public void enableNotification() { + public SendContact enableNotification() { this.disableNotification = false; + return this; } - public void disableNotification() { + public SendContact disableNotification() { this.disableNotification = true; + return this; } public String getPhoneNumber() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendDocument.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendDocument.java index 5a552d0d..dacf2bb2 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendDocument.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendDocument.java @@ -82,12 +82,14 @@ public class SendDocument { return disableNotification; } - public void enableNotification() { + public SendDocument enableNotification() { this.disableNotification = false; + return this; } - public void disableNotification() { + public SendDocument disableNotification() { this.disableNotification = true; + return this; } public String getCaption() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendLocation.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendLocation.java index 42098638..a9d2ee45 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendLocation.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendLocation.java @@ -87,12 +87,14 @@ public class SendLocation extends BotApiMethod { return disableNotification; } - public void enableNotification() { + public SendLocation enableNotification() { this.disableNotification = false; + return this; } - public void disableNotification() { + public SendLocation disableNotification() { this.disableNotification = true; + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java index f0488644..722b8f2a 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendMessage.java @@ -89,36 +89,42 @@ public class SendMessage extends BotApiMethod { return disableNotification; } - public void disableWebPagePreview() { + public SendMessage disableWebPagePreview() { disableWebPagePreview = true; + return this; } - public void enableWebPagePreview() { + public SendMessage enableWebPagePreview() { disableWebPagePreview = null; + return this; } - public void enableNotification() { + public SendMessage enableNotification() { this.disableNotification = null; + return this; } - public void disableNotification() { + public SendMessage disableNotification() { this.disableNotification = true; + return this; } - public void enableMarkdown(boolean enable) { + public SendMessage enableMarkdown(boolean enable) { if (enable) { this.parseMode = ParseMode.MARKDOWN; } else { this.parseMode = null; } + return this; } - public void enableHtml(boolean enable) { + public SendMessage enableHtml(boolean enable) { if (enable) { this.parseMode = ParseMode.HTML; } else { this.parseMode = null; } + return this; } @Override diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendPhoto.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendPhoto.java index 3bb8536a..e1059aa0 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendPhoto.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendPhoto.java @@ -94,12 +94,14 @@ public class SendPhoto { return disableNotification; } - public void enableNotification() { + public SendPhoto enableNotification() { this.disableNotification = false; + return this; } - public void disableNotification() { + public SendPhoto disableNotification() { this.disableNotification = true; + return this; } public SendPhoto setNewPhoto(String photo, String photoName) { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendSticker.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendSticker.java index 3a08f29b..b9c9cd9a 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendSticker.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendSticker.java @@ -81,12 +81,14 @@ public class SendSticker { return disableNotification; } - public void enableNotification() { + public SendSticker enableNotification() { this.disableNotification = false; + return this; } - public void disableNotification() { + public SendSticker disableNotification() { this.disableNotification = true; + return this; } public boolean isNewSticker() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVenue.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVenue.java index c3ac39c6..a2512132 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVenue.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVenue.java @@ -94,12 +94,14 @@ public class SendVenue extends BotApiMethod { return disableNotification; } - public void enableNotification() { + public SendVenue enableNotification() { this.disableNotification = false; + return this; } - public void disableNotification() { + public SendVenue disableNotification() { this.disableNotification = true; + return this; } public String getTitle() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVideo.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVideo.java index e1da970f..135ad939 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVideo.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVideo.java @@ -109,12 +109,14 @@ public class SendVideo { return disableNotification; } - public void enableNotification() { + public SendVideo enableNotification() { this.disableNotification = false; + return this; } - public void disableNotification() { + public SendVideo disableNotification() { this.disableNotification = true; + return this; } public Integer getWidth() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVoice.java b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVoice.java index 6095b938..fb01b1ea 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/send/SendVoice.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/send/SendVoice.java @@ -52,12 +52,14 @@ public class SendVoice { return disableNotification; } - public void enableNotification() { + public SendVoice enableNotification() { this.disableNotification = false; + return this; } - public void disableNotification() { + public SendVoice disableNotification() { this.disableNotification = true; + return this; } public String getChatId() { diff --git a/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageText.java b/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageText.java index 1d2d470f..3beb6823 100644 --- a/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageText.java +++ b/src/main/java/org/telegram/telegrambots/api/methods/updatingmessages/EditMessageText.java @@ -105,28 +105,32 @@ public class EditMessageText extends BotApiMethod { return this; } - public void disableWebPagePreview() { + public EditMessageText disableWebPagePreview() { disableWebPagePreview = true; + return this; } - public void enableWebPagePreview() { + public EditMessageText enableWebPagePreview() { disableWebPagePreview = null; + return this; } - public void enableMarkdown(boolean enable) { + public EditMessageText enableMarkdown(boolean enable) { if (enable) { this.parseMode = ParseMode.MARKDOWN; } else { this.parseMode = null; } + return this; } - public void enableHtml(boolean enable) { + public EditMessageText enableHtml(boolean enable) { if (enable) { this.parseMode = ParseMode.HTML; } else { this.parseMode = null; } + return this; } @Override From 94ea153a18447a46c5e802ed19a293bd719d1ec7 Mon Sep 17 00:00:00 2001 From: Alexander Babai Date: Tue, 12 Apr 2016 23:31:14 +0300 Subject: [PATCH 4/6] objects classes: enable/dissable methods to builder style --- .../inputmessagecontent/InputTextMessageContent.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputTextMessageContent.java b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputTextMessageContent.java index 23769798..2c741574 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputTextMessageContent.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/inlinequery/inputmessagecontent/InputTextMessageContent.java @@ -59,28 +59,32 @@ public class InputTextMessageContent implements InputMessageContent { return this; } - public void enableMarkdown(boolean enable) { + public InputTextMessageContent enableMarkdown(boolean enable) { if (enable) { this.parseMode = ParseMode.MARKDOWN; } else { this.parseMode = null; } + return this; } - public void enableHtml(boolean enable) { + public InputTextMessageContent enableHtml(boolean enable) { if (enable) { this.parseMode = ParseMode.HTML; } else { this.parseMode = null; } + return this; } - public void disableWebPagePreview() { + public InputTextMessageContent disableWebPagePreview() { disableWebPagePreview = true; + return this; } - public void enableWebPagePreview() { + public InputTextMessageContent enableWebPagePreview() { disableWebPagePreview = null; + return this; } @Override From cf91e024cadf3de0f9cb7a9b7a7f7b58ce96d5ac Mon Sep 17 00:00:00 2001 From: Alexander Babai Date: Tue, 12 Apr 2016 23:35:33 +0300 Subject: [PATCH 5/6] TelegramBotsApi methods to builder style --- .../java/org/telegram/telegrambots/TelegramBotsApi.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/telegram/telegrambots/TelegramBotsApi.java b/src/main/java/org/telegram/telegrambots/TelegramBotsApi.java index 0993d3ed..dcf1f9d1 100644 --- a/src/main/java/org/telegram/telegrambots/TelegramBotsApi.java +++ b/src/main/java/org/telegram/telegrambots/TelegramBotsApi.java @@ -125,30 +125,33 @@ public class TelegramBotsApi { * * @param bot */ - public void registerBot(TelegramLongPollingBot bot) throws TelegramApiException { + public TelegramBotsApi registerBot(TelegramLongPollingBot bot) throws TelegramApiException { setWebhook(bot.getBotToken()); new UpdatesThread(bot.getBotToken(), bot); + return this; } /** * * @param bot */ - public void registerBot(TelegramWebhookBot bot) throws TelegramApiException { + public TelegramBotsApi registerBot(TelegramWebhookBot bot) throws TelegramApiException { if (useWebhook) { webhook.registerWebhook(bot); setWebhook(bot.getBotToken()); } + return this; } /** * * @param botToken */ - private void setWebhook(String botToken) throws TelegramApiException { + private TelegramBotsApi setWebhook(String botToken) throws TelegramApiException { if (botToken == null) { throw new TelegramApiException("Parameter botToken can not be null"); } setWebhook(extrenalUrl == null ? "" : extrenalUrl, botToken, pathToCertificate, publicCertificateName); + return this; } } From 62f9e49201e908e1b3e43fa6d5131e554e9ddbb6 Mon Sep 17 00:00:00 2001 From: Alexander Babai Date: Tue, 12 Apr 2016 23:53:44 +0300 Subject: [PATCH 6/6] Message move back some methods --- .../telegrambots/api/objects/Message.java | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/src/main/java/org/telegram/telegrambots/api/objects/Message.java b/src/main/java/org/telegram/telegrambots/api/objects/Message.java index 924d8f7e..4b18d640 100644 --- a/src/main/java/org/telegram/telegrambots/api/objects/Message.java +++ b/src/main/java/org/telegram/telegrambots/api/objects/Message.java @@ -278,6 +278,15 @@ public class Message implements IBotApiObject { return this; } + public List getEntities() { + return entities; + } + + public Message setEntities(List entities) { + this.entities = entities; + return this; + } + public Audio getAudio() { return audio; } @@ -341,6 +350,24 @@ public class Message implements IBotApiObject { return this; } + public Venue getVenue() { + return venue; + } + + public Message setVenue(Venue venue) { + this.venue = venue; + return this; + } + + public Message getPinnedMessage() { + return pinnedMessage; + } + + public Message setPinnedMessage(Message pinnedMessage) { + this.pinnedMessage = pinnedMessage; + return this; + } + public User getNewChatMember() { return newChatMember; } @@ -449,6 +476,42 @@ public class Message implements IBotApiObject { return this; } + public boolean isGroupMessage() { + return chat.isGroupChat(); + } + + public boolean isUserMessage() { + return chat.isUserChat(); + } + + public boolean isChannelMessage() { + return chat.isChannelChat(); + } + + public boolean isSuperGroupMessage() { + return chat.isSuperGroupChat(); + } + + public Long getChatId() { + return chat.getId(); + } + + public boolean hasText() { + return text != null && !text.isEmpty(); + } + + public boolean hasDocument() { + return this.document != null; + } + + public boolean isReply() { + return this.replyToMessage != null; + } + + public boolean hasLocation() { + return location != null; + } + @Override public void serialize(JsonGenerator gen, SerializerProvider serializers) throws IOException { gen.writeStartObject();