From 8d91708a1df4325aed66a29382983062efe0d022 Mon Sep 17 00:00:00 2001 From: Stas Parshin Date: Sun, 12 May 2019 23:52:30 +0700 Subject: [PATCH 1/2] Move model to core kotlin module --- core/build.gradle | 21 + .../com/pengrad/telegrambot/AttachName.kt | 17 + .../pengrad/telegrambot/model/Animation.kt | 88 ++++ .../com/pengrad/telegrambot/model/Audio.kt | 81 ++++ .../telegrambot/model/CallbackQuery.kt | 82 ++++ .../com/pengrad/telegrambot/model/Chat.kt | 141 +++++++ .../pengrad/telegrambot/model/ChatMember.kt | 182 ++++++++ .../pengrad/telegrambot/model/ChatPhoto.kt | 49 +++ .../telegrambot/model/ChosenInlineResult.kt | 69 +++ .../com/pengrad/telegrambot/model/Contact.kt | 67 +++ .../com/pengrad/telegrambot/model/Document.kt | 67 +++ .../com/pengrad/telegrambot/model/File.kt | 53 +++ .../com/pengrad/telegrambot/model/Game.kt | 84 ++++ .../telegrambot/model/GameHighScore.kt | 56 +++ .../pengrad/telegrambot/model/InlineQuery.kt | 68 +++ .../com/pengrad/telegrambot/model/Invoice.kt | 73 ++++ .../com/pengrad/telegrambot/model/Location.kt | 48 +++ .../pengrad/telegrambot/model/MaskPosition.kt | 44 ++ .../com/pengrad/telegrambot/model/Message.kt | 390 +++++++++++++++++ .../telegrambot/model/MessageEntity.kt | 78 ++++ .../pengrad/telegrambot/model/OrderInfo.kt | 65 +++ .../pengrad/telegrambot/model/PhotoSize.kt | 60 +++ .../com/pengrad/telegrambot/model/Poll.kt | 60 +++ .../pengrad/telegrambot/model/PollOption.kt | 48 +++ .../telegrambot/model/PreCheckoutQuery.kt | 83 ++++ .../telegrambot/model/ResponseParameters.kt | 49 +++ .../telegrambot/model/ShippingAddress.kt | 81 ++++ .../telegrambot/model/ShippingQuery.kt | 61 +++ .../com/pengrad/telegrambot/model/Sticker.kt | 88 ++++ .../pengrad/telegrambot/model/StickerSet.kt | 65 +++ .../telegrambot/model/SuccessfulPayment.kt | 92 ++++ .../com/pengrad/telegrambot/model/Update.kt | 115 +++++ .../com/pengrad/telegrambot/model/User.kt | 45 ++ .../telegrambot/model/UserProfilePhotos.kt | 48 +++ .../com/pengrad/telegrambot/model/Venue.kt | 72 ++++ .../com/pengrad/telegrambot/model/Video.kt | 81 ++++ .../pengrad/telegrambot/model/VideoNote.kt | 67 +++ .../com/pengrad/telegrambot/model/Voice.kt | 60 +++ .../pengrad/telegrambot/model/WebhookInfo.kt | 93 +++++ .../telegrambot/model/request/ChatAction.kt | 4 +- .../telegrambot/model/request/ForceReply.kt | 16 + .../model/request/InlineKeyboardButton.kt | 53 +++ .../model/request/InlineKeyboardMarkup.kt | 16 + .../model/request/InlineQueryResult.kt | 31 ++ .../model/request/InlineQueryResultArticle.kt | 57 +++ .../model/request/InlineQueryResultAudio.kt | 39 ++ .../request/InlineQueryResultCachedAudio.kt | 27 ++ .../InlineQueryResultCachedDocument.kt | 33 ++ .../request/InlineQueryResultCachedGif.kt | 33 ++ .../InlineQueryResultCachedMpeg4Gif.kt | 33 ++ .../request/InlineQueryResultCachedPhoto.kt | 39 ++ .../request/InlineQueryResultCachedSticker.kt | 13 + .../request/InlineQueryResultCachedVideo.kt | 33 ++ .../request/InlineQueryResultCachedVoice.kt | 27 ++ .../model/request/InlineQueryResultContact.kt | 45 ++ .../request/InlineQueryResultDocument.kt | 54 +++ .../model/request/InlineQueryResultGame.kt | 13 + .../model/request/InlineQueryResultGif.kt | 51 +++ .../request/InlineQueryResultLocation.kt | 39 ++ .../request/InlineQueryResultMpeg4Gif.kt | 51 +++ .../model/request/InlineQueryResultPhoto.kt | 51 +++ .../model/request/InlineQueryResultVenue.kt | 45 ++ .../model/request/InlineQueryResultVideo.kt | 60 +++ .../model/request/InlineQueryResultVoice.kt | 33 ++ .../request/InputContactMessageContent.kt | 26 ++ .../request/InputLocationMessageContent.kt | 20 + .../telegrambot/model/request/InputMedia.kt | 76 ++++ .../model/request/InputMediaAnimation.kt | 48 +++ .../model/request/InputMediaAudio.kt | 48 +++ .../model/request/InputMediaDocument.kt | 29 ++ .../model/request/InputMediaPhoto.kt | 29 ++ .../model/request/InputMediaVideo.kt | 54 +++ .../model/request/InputMessageContent.kt | 13 + .../model/request/InputTextMessageContent.kt | 26 ++ .../model/request/InputVenueMessageContent.kt | 26 ++ .../telegrambot/model/request/Keyboard.kt | 24 ++ .../model/request/KeyboardButton.kt | 26 ++ .../telegrambot/model/request/LabeledPrice.kt | 13 + .../telegrambot/model/request/ParseMode.kt | 9 + .../model/request/ReplyKeyboardHide.kt | 17 + .../model/request/ReplyKeyboardMarkup.kt | 41 ++ .../model/request/ReplyKeyboardRemove.kt | 17 + .../model/request/ShippingOption.kt | 19 + .../telegrambot/request/ContentTypes.kt | 24 ++ library/build.gradle | 1 + .../com/pengrad/telegrambot/AttachName.java | 17 - .../pengrad/telegrambot/model/Animation.java | 88 ---- .../com/pengrad/telegrambot/model/Audio.java | 81 ---- .../telegrambot/model/CallbackQuery.java | 82 ---- .../com/pengrad/telegrambot/model/Chat.java | 139 ------- .../pengrad/telegrambot/model/ChatMember.java | 184 -------- .../pengrad/telegrambot/model/ChatPhoto.java | 49 --- .../telegrambot/model/ChosenInlineResult.java | 69 --- .../pengrad/telegrambot/model/Contact.java | 67 --- .../pengrad/telegrambot/model/Document.java | 67 --- .../com/pengrad/telegrambot/model/File.java | 53 --- .../com/pengrad/telegrambot/model/Game.java | 84 ---- .../telegrambot/model/GameHighScore.java | 56 --- .../telegrambot/model/InlineQuery.java | 68 --- .../pengrad/telegrambot/model/Invoice.java | 70 ---- .../pengrad/telegrambot/model/Location.java | 48 --- .../telegrambot/model/MaskPosition.java | 84 ---- .../pengrad/telegrambot/model/Message.java | 392 ------------------ .../telegrambot/model/MessageEntity.java | 78 ---- .../pengrad/telegrambot/model/OrderInfo.java | 63 --- .../pengrad/telegrambot/model/PhotoSize.java | 60 --- .../com/pengrad/telegrambot/model/Poll.java | 62 --- .../pengrad/telegrambot/model/PollOption.java | 48 --- .../telegrambot/model/PreCheckoutQuery.java | 83 ---- .../telegrambot/model/ResponseParameters.java | 49 --- .../telegrambot/model/ShippingAddress.java | 76 ---- .../telegrambot/model/ShippingQuery.java | 61 --- .../pengrad/telegrambot/model/Sticker.java | 88 ---- .../pengrad/telegrambot/model/StickerSet.java | 66 --- .../telegrambot/model/SuccessfulPayment.java | 92 ---- .../com/pengrad/telegrambot/model/Update.java | 115 ----- .../com/pengrad/telegrambot/model/User.java | 74 ---- .../telegrambot/model/UserProfilePhotos.java | 49 --- .../com/pengrad/telegrambot/model/Venue.java | 72 ---- .../com/pengrad/telegrambot/model/Video.java | 81 ---- .../pengrad/telegrambot/model/VideoNote.java | 67 --- .../com/pengrad/telegrambot/model/Voice.java | 60 --- .../telegrambot/model/WebhookInfo.java | 95 ----- .../telegrambot/model/request/ForceReply.java | 22 - .../model/request/InlineKeyboardButton.java | 55 --- .../model/request/InlineKeyboardMarkup.java | 17 - .../model/request/InlineQueryResult.java | 34 -- .../request/InlineQueryResultArticle.java | 60 --- .../model/request/InlineQueryResultAudio.java | 45 -- .../request/InlineQueryResultCachedAudio.java | 31 -- .../InlineQueryResultCachedDocument.java | 39 -- .../request/InlineQueryResultCachedGif.java | 37 -- .../InlineQueryResultCachedMpeg4Gif.java | 37 -- .../request/InlineQueryResultCachedPhoto.java | 43 -- .../InlineQueryResultCachedSticker.java | 18 - .../request/InlineQueryResultCachedVideo.java | 39 -- .../request/InlineQueryResultCachedVoice.java | 33 -- .../request/InlineQueryResultContact.java | 51 --- .../request/InlineQueryResultDocument.java | 63 --- .../model/request/InlineQueryResultGame.java | 18 - .../model/request/InlineQueryResultGif.java | 57 --- .../request/InlineQueryResultLocation.java | 47 --- .../request/InlineQueryResultMpeg4Gif.java | 57 --- .../model/request/InlineQueryResultPhoto.java | 57 --- .../model/request/InlineQueryResultVenue.java | 55 --- .../model/request/InlineQueryResultVideo.java | 69 --- .../model/request/InlineQueryResultVoice.java | 39 -- .../request/InputContactMessageContent.java | 31 -- .../request/InputLocationMessageContent.java | 25 -- .../telegrambot/model/request/InputMedia.java | 78 ---- .../model/request/InputMediaAnimation.java | 53 --- .../model/request/InputMediaAudio.java | 54 --- .../model/request/InputMediaDocument.java | 36 -- .../model/request/InputMediaPhoto.java | 36 -- .../model/request/InputMediaVideo.java | 59 --- .../model/request/InputMessageContent.java | 11 - .../request/InputTextMessageContent.java | 29 -- .../request/InputVenueMessageContent.java | 35 -- .../telegrambot/model/request/Keyboard.java | 22 - .../model/request/KeyboardButton.java | 29 -- .../model/request/LabeledPrice.java | 19 - .../telegrambot/model/request/ParseMode.java | 9 - .../model/request/ReplyKeyboardHide.java | 23 - .../model/request/ReplyKeyboardMarkup.java | 53 --- .../model/request/ReplyKeyboardRemove.java | 23 - .../model/request/ShippingOption.java | 20 - .../telegrambot/request/ContentTypes.java | 25 -- .../pengrad/telegrambot/TelegramBotTest.java | 6 +- settings.gradle | 1 + 169 files changed, 4577 insertions(+), 4833 deletions(-) create mode 100644 core/build.gradle create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/AttachName.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Animation.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Audio.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/CallbackQuery.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Chat.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/ChatMember.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/ChatPhoto.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/ChosenInlineResult.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Contact.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Document.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/File.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Game.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/GameHighScore.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/InlineQuery.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Invoice.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Location.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/MaskPosition.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Message.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/MessageEntity.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/OrderInfo.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/PhotoSize.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Poll.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/PollOption.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/PreCheckoutQuery.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/ResponseParameters.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingAddress.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingQuery.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Sticker.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/StickerSet.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/SuccessfulPayment.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Update.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/User.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/UserProfilePhotos.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Venue.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Video.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/VideoNote.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Voice.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/WebhookInfo.kt rename library/src/main/java/com/pengrad/telegrambot/model/request/ChatAction.java => core/src/main/kotlin/com/pengrad/telegrambot/model/request/ChatAction.kt (72%) create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/ForceReply.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardButton.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResult.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultContact.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGame.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGif.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputContactMessageContent.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputLocationMessageContent.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMedia.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAnimation.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAudio.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaDocument.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaPhoto.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaVideo.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMessageContent.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputTextMessageContent.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputVenueMessageContent.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/Keyboard.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/KeyboardButton.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/LabeledPrice.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/ParseMode.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/request/ShippingOption.kt create mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/request/ContentTypes.kt delete mode 100644 library/src/main/java/com/pengrad/telegrambot/AttachName.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Animation.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Audio.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/CallbackQuery.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Chat.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/ChatMember.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/ChatPhoto.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/ChosenInlineResult.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Contact.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Document.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/File.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Game.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/GameHighScore.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/InlineQuery.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Invoice.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Location.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/MaskPosition.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Message.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/MessageEntity.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/OrderInfo.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/PhotoSize.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Poll.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/PollOption.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/PreCheckoutQuery.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/ResponseParameters.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/ShippingAddress.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/ShippingQuery.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Sticker.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/StickerSet.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/SuccessfulPayment.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Update.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/User.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/UserProfilePhotos.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Venue.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Video.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/VideoNote.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/Voice.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/WebhookInfo.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/ForceReply.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineKeyboardButton.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResult.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultContact.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultGame.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultGif.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InputContactMessageContent.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InputLocationMessageContent.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InputMedia.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaAnimation.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaAudio.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaDocument.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaPhoto.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaVideo.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InputMessageContent.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InputTextMessageContent.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/InputVenueMessageContent.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/Keyboard.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/KeyboardButton.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/LabeledPrice.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/ParseMode.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/model/request/ShippingOption.java delete mode 100644 library/src/main/java/com/pengrad/telegrambot/request/ContentTypes.java diff --git a/core/build.gradle b/core/build.gradle new file mode 100644 index 00000000..7028950e --- /dev/null +++ b/core/build.gradle @@ -0,0 +1,21 @@ +plugins { + id 'org.jetbrains.kotlin.jvm' version '1.3.30' +} + +repositories { + mavenCentral() +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" + implementation 'com.google.code.gson:gson:2.8.5' +} + +compileKotlin { + kotlinOptions.jvmTarget = "1.8" +} +compileTestKotlin { + kotlinOptions.jvmTarget = "1.8" +} + +task wrapper() \ No newline at end of file diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/AttachName.kt b/core/src/main/kotlin/com/pengrad/telegrambot/AttachName.kt new file mode 100644 index 00000000..aac3c216 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/AttachName.kt @@ -0,0 +1,17 @@ +package com.pengrad.telegrambot + +import java.util.concurrent.atomic.AtomicInteger + +/** + * Stas Parshin + * 29 July 2018 + */ +object AttachName { + + private val counter = AtomicInteger() + + operator fun next(): String { + return "attach" + counter.incrementAndGet() + } + +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Animation.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Animation.kt new file mode 100644 index 00000000..1738c6aa --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Animation.kt @@ -0,0 +1,88 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 03 October 2016 + */ +class Animation : Serializable { + + private val file_id: String? = null + private val width: Int? = null + private val height: Int? = null + private val duration: Int? = null + private val thumb: PhotoSize? = null + private val file_name: String? = null + private val mime_type: String? = null + private val file_size: Int? = null + + fun fileId(): String? { + return file_id + } + + fun width(): Int? { + return width + } + + fun height(): Int? { + return height + } + + fun duration(): Int? { + return duration + } + + fun thumb(): PhotoSize? { + return thumb + } + + fun fileName(): String? { + return file_name + } + + fun mimeType(): String? { + return mime_type + } + + fun fileSize(): Int? { + return file_size + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val animation = o as Animation? + + if (if (file_id != null) file_id != animation!!.file_id else animation!!.file_id != null) return false + if (if (width != null) width != animation.width else animation.width != null) return false + if (if (height != null) height != animation.height else animation.height != null) return false + if (if (duration != null) duration != animation.duration else animation.duration != null) return false + if (if (thumb != null) thumb != animation.thumb else animation.thumb != null) return false + if (if (file_name != null) file_name != animation.file_name else animation.file_name != null) return false + if (if (mime_type != null) mime_type != animation.mime_type else animation.mime_type != null) return false + return if (file_size != null) file_size == animation.file_size else animation.file_size == null + } + + override fun hashCode(): Int { + return file_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "Animation{" + + "file_id='" + file_id + '\''.toString() + + ", width=" + width + + ", height=" + height + + ", duration=" + duration + + ", thumb=" + thumb + + ", file_name='" + file_name + '\''.toString() + + ", mime_type='" + mime_type + '\''.toString() + + ", file_size=" + file_size + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Audio.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Audio.kt new file mode 100644 index 00000000..6b039816 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Audio.kt @@ -0,0 +1,81 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 8/5/15. + */ +class Audio : Serializable { + + private val file_id: String? = null + private val duration: Int? = null + private val performer: String? = null + private val title: String? = null + private val mime_type: String? = null + private val file_size: Int? = null + private val thumb: PhotoSize? = null + + fun fileId(): String? { + return file_id + } + + fun duration(): Int? { + return duration + } + + fun performer(): String? { + return performer + } + + fun title(): String? { + return title + } + + fun mimeType(): String? { + return mime_type + } + + fun fileSize(): Int? { + return file_size + } + + fun thumb(): PhotoSize? { + return thumb + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val audio = o as Audio? + + if (if (file_id != null) file_id != audio!!.file_id else audio!!.file_id != null) return false + if (if (duration != null) duration != audio.duration else audio.duration != null) return false + if (if (performer != null) performer != audio.performer else audio.performer != null) return false + if (if (title != null) title != audio.title else audio.title != null) return false + if (if (mime_type != null) mime_type != audio.mime_type else audio.mime_type != null) return false + if (if (file_size != null) file_size != audio.file_size else audio.file_size != null) return false + return if (thumb != null) thumb == audio.thumb else audio.thumb == null + } + + override fun hashCode(): Int { + return file_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "Audio{" + + "file_id='" + file_id + '\''.toString() + + ", duration=" + duration + + ", performer='" + performer + '\''.toString() + + ", title='" + title + '\''.toString() + + ", mime_type='" + mime_type + '\''.toString() + + ", file_size=" + file_size + + ", thumb=" + thumb + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/CallbackQuery.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/CallbackQuery.kt new file mode 100644 index 00000000..f90b3b28 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/CallbackQuery.kt @@ -0,0 +1,82 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 07 May 2016 + */ +class CallbackQuery : Serializable { + + private val id: String? = null + private val from: User? = null + private val message: Message? = null + private val inline_message_id: String? = null + private val chat_instance: String? = null + private val data: String? = null + private val game_short_name: String? = null + + fun id(): String? { + return id + } + + fun from(): User? { + return from + } + + fun message(): Message? { + return message + } + + fun inlineMessageId(): String? { + return inline_message_id + } + + fun chatInstance(): String? { + return chat_instance + } + + fun data(): String? { + return data + } + + fun gameShortName(): String? { + return game_short_name + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as CallbackQuery? + + if (if (id != null) id != that!!.id else that!!.id != null) return false + if (if (from != null) from != that.from else that.from != null) return false + if (if (message != null) message != that.message else that.message != null) return false + if (if (inline_message_id != null) inline_message_id != that.inline_message_id else that.inline_message_id != null) + return false + if (if (chat_instance != null) chat_instance != that.chat_instance else that.chat_instance != null) return false + if (if (data != null) data != that.data else that.data != null) return false + return if (game_short_name != null) game_short_name == that.game_short_name else that.game_short_name == null + } + + override fun hashCode(): Int { + return id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "CallbackQuery{" + + "id='" + id + '\''.toString() + + ", from=" + from + + ", message=" + message + + ", inline_message_id='" + inline_message_id + '\''.toString() + + ", chat_instance='" + chat_instance + '\''.toString() + + ", data='" + data + '\''.toString() + + ", game_short_name='" + game_short_name + '\''.toString() + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Chat.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Chat.kt new file mode 100644 index 00000000..6a7f3748 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Chat.kt @@ -0,0 +1,141 @@ +package com.pengrad.telegrambot.model + +import com.google.gson.annotations.SerializedName + +import java.io.Serializable + +/** + * stas + * 8/5/15. + */ +class Chat : Serializable { + + private val id: Long? = null + private val type: Type? = null + + //Private + private val first_name: String? = null + private val last_name: String? = null + + //Private and Channel + private val username: String? = null + + //Channel and Group + private val title: String? = null + + private val all_members_are_administrators: Boolean? = null + + private val photo: ChatPhoto? = null + private val description: String? = null + private val invite_link: String? = null + private val pinned_message: Message? = null + private val sticker_set_name: String? = null + private val can_set_sticker_set: Boolean? = null + + enum class Type { + @SerializedName("private") + Private, + group, supergroup, channel + } + + fun id(): Long? { + return id + } + + fun type(): Type? { + return type + } + + fun firstName(): String? { + return first_name + } + + fun lastName(): String? { + return last_name + } + + fun username(): String? { + return username + } + + fun title(): String? { + return title + } + + fun allMembersAreAdministrators(): Boolean? { + return all_members_are_administrators + } + + fun photo(): ChatPhoto? { + return photo + } + + fun description(): String? { + return description + } + + fun inviteLink(): String? { + return invite_link + } + + fun pinnedMessage(): Message? { + return pinned_message + } + + fun stickerSetName(): String? { + return sticker_set_name + } + + fun canSetStickerSet(): Boolean? { + return can_set_sticker_set + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val chat = o as Chat? + + if (if (id != null) id != chat!!.id else chat!!.id != null) return false + if (type != chat.type) return false + if (if (first_name != null) first_name != chat.first_name else chat.first_name != null) return false + if (if (last_name != null) last_name != chat.last_name else chat.last_name != null) return false + if (if (username != null) username != chat.username else chat.username != null) return false + if (if (title != null) title != chat.title else chat.title != null) return false + if (if (all_members_are_administrators != null) all_members_are_administrators != chat.all_members_are_administrators else chat.all_members_are_administrators != null) + return false + if (if (photo != null) photo != chat.photo else chat.photo != null) return false + if (if (description != null) description != chat.description else chat.description != null) return false + if (if (invite_link != null) invite_link != chat.invite_link else chat.invite_link != null) return false + if (if (pinned_message != null) pinned_message != chat.pinned_message else chat.pinned_message != null) return false + if (if (sticker_set_name != null) sticker_set_name != chat.sticker_set_name else chat.sticker_set_name != null) + return false + return if (can_set_sticker_set != null) can_set_sticker_set == chat.can_set_sticker_set else chat.can_set_sticker_set == null + } + + override fun hashCode(): Int { + return id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "Chat{" + + "id=" + id + + ", type=" + type + + ", first_name='" + first_name + '\''.toString() + + ", last_name='" + last_name + '\''.toString() + + ", username='" + username + '\''.toString() + + ", title='" + title + '\''.toString() + + ", all_members_are_administrators=" + all_members_are_administrators + + ", photo=" + photo + + ", description='" + description + '\''.toString() + + ", invite_link='" + invite_link + '\''.toString() + + ", pinned_message=" + pinned_message + + ", sticker_set_name='" + sticker_set_name + '\''.toString() + + ", can_set_sticker_set=" + can_set_sticker_set + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ChatMember.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/ChatMember.kt new file mode 100644 index 00000000..b6e4a680 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/ChatMember.kt @@ -0,0 +1,182 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 29 May 2016 + */ +class ChatMember : Serializable { + + private val user: User? = null + private val status: Status? = null + + private val until_date: Int? = null + private val can_be_edited: Boolean? = null + private val can_change_info: Boolean? = null + private val can_post_messages: Boolean? = null + private val can_edit_messages: Boolean? = null + private val can_delete_messages: Boolean? = null + private val can_invite_users: Boolean? = null + private val can_restrict_members: Boolean? = null + private val can_pin_messages: Boolean? = null + private val can_promote_members: Boolean? = null + private val is_member: Boolean? = null + private val can_send_messages: Boolean? = null + private val can_send_media_messages: Boolean? = null + private val can_send_other_messages: Boolean? = null + private val can_add_web_page_previews: Boolean? = null + + enum class Status { + creator, administrator, member, restricted, left, kicked + } + + fun user(): User? { + return user + } + + fun isMember() = is_member; + + fun status(): Status? { + return status + } + + fun untilDate(): Int? { + return until_date + } + + fun canBeEdited(): Boolean? { + return can_be_edited + } + + fun canChangeInfo(): Boolean? { + return can_change_info + } + + fun canPostMessages(): Boolean? { + return can_post_messages + } + + fun canEditMessages(): Boolean? { + return can_edit_messages + } + + fun canDeleteMessages(): Boolean? { + return can_delete_messages + } + + fun canInviteUsers(): Boolean? { + return can_invite_users + } + + fun canRestrictMembers(): Boolean? { + return can_restrict_members + } + + fun canPinMessages(): Boolean? { + return can_pin_messages + } + + fun canPromoteMembers(): Boolean? { + return can_promote_members + } + + fun canSendMessages(): Boolean? { + return can_send_messages + } + + fun canSendMediaMessages(): Boolean? { + return can_send_media_messages + } + + fun canSendOtherMessages(): Boolean? { + return can_send_other_messages + } + + fun canAddWebPagePreviews(): Boolean? { + return can_add_web_page_previews + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as ChatMember? + + if (if (user != null) user != that!!.user else that!!.user != null) return false + if (status != that.status) return false + if (if (until_date != null) until_date != that.until_date else that.until_date != null) return false + if (if (can_be_edited != null) can_be_edited != that.can_be_edited else that.can_be_edited != null) return false + if (if (can_change_info != null) can_change_info != that.can_change_info else that.can_change_info != null) + return false + if (if (can_post_messages != null) can_post_messages != that.can_post_messages else that.can_post_messages != null) + return false + if (if (can_edit_messages != null) can_edit_messages != that.can_edit_messages else that.can_edit_messages != null) + return false + if (if (can_delete_messages != null) can_delete_messages != that.can_delete_messages else that.can_delete_messages != null) + return false + if (if (can_invite_users != null) can_invite_users != that.can_invite_users else that.can_invite_users != null) + return false + if (if (can_restrict_members != null) can_restrict_members != that.can_restrict_members else that.can_restrict_members != null) + return false + if (if (can_pin_messages != null) can_pin_messages != that.can_pin_messages else that.can_pin_messages != null) + return false + if (if (can_promote_members != null) can_promote_members != that.can_promote_members else that.can_promote_members != null) + return false + if (if (is_member != null) is_member != that.is_member else that.is_member != null) return false + if (if (can_send_messages != null) can_send_messages != that.can_send_messages else that.can_send_messages != null) + return false + if (if (can_send_media_messages != null) can_send_media_messages != that.can_send_media_messages else that.can_send_media_messages != null) + return false + if (if (can_send_other_messages != null) can_send_other_messages != that.can_send_other_messages else that.can_send_other_messages != null) + return false + return if (can_add_web_page_previews != null) can_add_web_page_previews == that.can_add_web_page_previews else that.can_add_web_page_previews == null + } + + override fun hashCode(): Int { + var result = user?.hashCode() ?: 0 + result = 31 * result + (status?.hashCode() ?: 0) + result = 31 * result + (until_date?.hashCode() ?: 0) + result = 31 * result + (can_be_edited?.hashCode() ?: 0) + result = 31 * result + (can_change_info?.hashCode() ?: 0) + result = 31 * result + (can_post_messages?.hashCode() ?: 0) + result = 31 * result + (can_edit_messages?.hashCode() ?: 0) + result = 31 * result + (can_delete_messages?.hashCode() ?: 0) + result = 31 * result + (can_invite_users?.hashCode() ?: 0) + result = 31 * result + (can_restrict_members?.hashCode() ?: 0) + result = 31 * result + (can_pin_messages?.hashCode() ?: 0) + result = 31 * result + (can_promote_members?.hashCode() ?: 0) + result = 31 * result + (is_member?.hashCode() ?: 0) + result = 31 * result + (can_send_messages?.hashCode() ?: 0) + result = 31 * result + (can_send_media_messages?.hashCode() ?: 0) + result = 31 * result + (can_send_other_messages?.hashCode() ?: 0) + result = 31 * result + (can_add_web_page_previews?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "ChatMember{" + + "user=" + user + + ", status=" + status + + ", until_date=" + until_date + + ", can_be_edited=" + can_be_edited + + ", can_change_info=" + can_change_info + + ", can_post_messages=" + can_post_messages + + ", can_edit_messages=" + can_edit_messages + + ", can_delete_messages=" + can_delete_messages + + ", can_invite_users=" + can_invite_users + + ", can_restrict_members=" + can_restrict_members + + ", can_pin_messages=" + can_pin_messages + + ", can_promote_members=" + can_promote_members + + ", is_member=" + is_member + + ", can_send_messages=" + can_send_messages + + ", can_send_media_messages=" + can_send_media_messages + + ", can_send_other_messages=" + can_send_other_messages + + ", can_add_web_page_previews=" + can_add_web_page_previews + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ChatPhoto.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/ChatPhoto.kt new file mode 100644 index 00000000..a6898afa --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/ChatPhoto.kt @@ -0,0 +1,49 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 01 July 2017 + */ +class ChatPhoto : Serializable { + + private val small_file_id: String? = null + private val big_file_id: String? = null + + fun smallFileId(): String? { + return small_file_id + } + + fun bigFileId(): String? { + return big_file_id + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val chatPhoto = o as ChatPhoto? + + if (if (small_file_id != null) small_file_id != chatPhoto!!.small_file_id else chatPhoto!!.small_file_id != null) + return false + return if (big_file_id != null) big_file_id == chatPhoto.big_file_id else chatPhoto.big_file_id == null + } + + override fun hashCode(): Int { + var result = small_file_id?.hashCode() ?: 0 + result = 31 * result + (big_file_id?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "ChatPhoto{" + + "small_file_id='" + small_file_id + '\''.toString() + + ", big_file_id='" + big_file_id + '\''.toString() + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ChosenInlineResult.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/ChosenInlineResult.kt new file mode 100644 index 00000000..f760c893 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/ChosenInlineResult.kt @@ -0,0 +1,69 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 1/20/16. + */ +class ChosenInlineResult : Serializable { + + private val result_id: String? = null + private val from: User? = null + private val location: Location? = null + private val inline_message_id: String? = null + private val query: String? = null + + fun resultId(): String? { + return result_id + } + + fun from(): User? { + return from + } + + fun location(): Location? { + return location + } + + fun inlineMessageId(): String? { + return inline_message_id + } + + fun query(): String? { + return query + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as ChosenInlineResult? + + if (if (result_id != null) result_id != that!!.result_id else that!!.result_id != null) return false + if (if (from != null) from != that.from else that.from != null) return false + if (if (location != null) location != that.location else that.location != null) return false + if (if (inline_message_id != null) inline_message_id != that.inline_message_id else that.inline_message_id != null) + return false + return if (query != null) query == that.query else that.query == null + + } + + override fun hashCode(): Int { + return result_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "ChosenInlineResult{" + + "result_id='" + result_id + '\''.toString() + + ", from=" + from + + ", location=" + location + + ", inline_message_id='" + inline_message_id + '\''.toString() + + ", query='" + query + '\''.toString() + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Contact.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Contact.kt new file mode 100644 index 00000000..fa2fc531 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Contact.kt @@ -0,0 +1,67 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 8/5/15. + */ +class Contact : Serializable { + + private val phone_number: String? = null + private val first_name: String? = null + private val last_name: String? = null + private val user_id: Int? = null + private val vcard: String? = null + + fun phoneNumber(): String? { + return phone_number + } + + fun firstName(): String? { + return first_name + } + + fun lastName(): String? { + return last_name + } + + fun userId(): Int? { + return user_id + } + + fun vcard(): String? { + return vcard + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val contact = o as Contact? + + if (if (phone_number != null) phone_number != contact!!.phone_number else contact!!.phone_number != null) return false + if (if (first_name != null) first_name != contact.first_name else contact.first_name != null) return false + if (if (last_name != null) last_name != contact.last_name else contact.last_name != null) return false + if (if (user_id != null) user_id != contact.user_id else contact.user_id != null) return false + return if (vcard != null) vcard == contact.vcard else contact.vcard == null + } + + override fun hashCode(): Int { + return phone_number?.hashCode() ?: 0 + } + + override fun toString(): String { + return "Contact{" + + "phone_number='" + phone_number + '\''.toString() + + ", first_name='" + first_name + '\''.toString() + + ", last_name='" + last_name + '\''.toString() + + ", user_id=" + user_id + + ", vcard='" + vcard + '\''.toString() + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Document.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Document.kt new file mode 100644 index 00000000..c11680e0 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Document.kt @@ -0,0 +1,67 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 8/5/15. + */ +class Document : Serializable { + + private val file_id: String? = null + private val thumb: PhotoSize? = null + private val file_name: String? = null + private val mime_type: String? = null + private val file_size: Int? = null + + fun fileId(): String? { + return file_id + } + + fun thumb(): PhotoSize? { + return thumb + } + + fun fileName(): String? { + return file_name + } + + fun mimeType(): String? { + return mime_type + } + + fun fileSize(): Int? { + return file_size + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val document = o as Document? + + if (if (file_id != null) file_id != document!!.file_id else document!!.file_id != null) return false + if (if (thumb != null) thumb != document.thumb else document.thumb != null) return false + if (if (file_name != null) file_name != document.file_name else document.file_name != null) return false + if (if (mime_type != null) mime_type != document.mime_type else document.mime_type != null) return false + return if (file_size != null) file_size == document.file_size else document.file_size == null + } + + override fun hashCode(): Int { + return file_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "Document{" + + "file_id='" + file_id + '\''.toString() + + ", thumb=" + thumb + + ", file_name='" + file_name + '\''.toString() + + ", mime_type='" + mime_type + '\''.toString() + + ", file_size=" + file_size + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/File.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/File.kt new file mode 100644 index 00000000..3de143c1 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/File.kt @@ -0,0 +1,53 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 16 October 2015 + */ +class File : Serializable { + + private val file_id: String? = null + private val file_size: Int? = null + private val file_path: String? = null + + fun fileId(): String? { + return file_id + } + + fun fileSize(): Int? { + return file_size + } + + fun filePath(): String? { + return file_path + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val file = o as File? + + if (if (file_id != null) file_id != file!!.file_id else file!!.file_id != null) return false + if (if (file_size != null) file_size != file.file_size else file.file_size != null) return false + return if (file_path != null) file_path == file.file_path else file.file_path == null + } + + override fun hashCode(): Int { + return file_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "File{" + + "file_id='" + file_id + '\''.toString() + + ", file_size=" + file_size + + ", file_path='" + file_path + '\''.toString() + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Game.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Game.kt new file mode 100644 index 00000000..0bdd2f9c --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Game.kt @@ -0,0 +1,84 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable +import java.util.Arrays + +/** + * Stas Parshin + * 03 October 2016 + */ +class Game : Serializable { + + private val title: String? = null + private val description: String? = null + private val photo: Array? = null + + private val text: String? = null + private val text_entities: Array? = null + private val animation: Animation? = null + + fun title(): String? { + return title + } + + fun description(): String? { + return description + } + + fun photo(): Array? { + return photo + } + + fun text(): String? { + return text + } + + fun textEntities(): Array? { + return text_entities + } + + fun animation(): Animation? { + return animation + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val game = o as Game? + + if (if (title != null) title != game!!.title else game!!.title != null) return false + if (if (description != null) description != game.description else game.description != null) return false + // Probably incorrect - comparing Object[] arrays with Arrays.equals + if (!Arrays.equals(photo, game.photo)) return false + if (if (text != null) text != game.text else game.text != null) return false + // Probably incorrect - comparing Object[] arrays with Arrays.equals + if (!Arrays.equals(text_entities, game.text_entities)) return false + return if (animation != null) animation == game.animation else game.animation == null + } + + override fun hashCode(): Int { + var result = title?.hashCode() ?: 0 + result = 31 * result + (description?.hashCode() ?: 0) + result = 31 * result + Arrays.hashCode(photo) + result = 31 * result + (text?.hashCode() ?: 0) + result = 31 * result + Arrays.hashCode(text_entities) + result = 31 * result + (animation?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "Game{" + + "title='" + title + '\''.toString() + + ", description='" + description + '\''.toString() + + ", photo=" + Arrays.toString(photo) + + ", text='" + text + '\''.toString() + + ", text_entities=" + Arrays.toString(text_entities) + + ", animation=" + animation + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/GameHighScore.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/GameHighScore.kt new file mode 100644 index 00000000..e14780e7 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/GameHighScore.kt @@ -0,0 +1,56 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 04 October 2016 + */ +class GameHighScore : Serializable { + + private val position: Int? = null + private val user: User? = null + private val score: Int? = null + + fun position(): Int? { + return position + } + + fun user(): User? { + return user + } + + fun score(): Int? { + return score + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as GameHighScore? + + if (if (position != null) position != that!!.position else that!!.position != null) return false + if (if (user != null) user != that.user else that.user != null) return false + return if (score != null) score == that.score else that.score == null + } + + override fun hashCode(): Int { + var result = position?.hashCode() ?: 0 + result = 31 * result + (user?.hashCode() ?: 0) + result = 31 * result + (score?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "GameHighScore{" + + "position=" + position + + ", user=" + user + + ", score=" + score + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/InlineQuery.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/InlineQuery.kt new file mode 100644 index 00000000..7d38d516 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/InlineQuery.kt @@ -0,0 +1,68 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 1/12/16. + */ +class InlineQuery : Serializable { + + private val id: String? = null + private val from: User? = null + private val location: Location? = null + private val query: String? = null + private val offset: String? = null + + fun id(): String? { + return id + } + + fun from(): User? { + return from + } + + fun location(): Location? { + return location + } + + fun query(): String? { + return query + } + + fun offset(): String? { + return offset + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as InlineQuery? + + if (if (id != null) id != that!!.id else that!!.id != null) return false + if (if (from != null) from != that.from else that.from != null) return false + if (if (location != null) location != that.location else that.location != null) return false + if (if (query != null) query != that.query else that.query != null) return false + return if (offset != null) offset == that.offset else that.offset == null + + } + + override fun hashCode(): Int { + return id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "InlineQuery{" + + "id='" + id + '\''.toString() + + ", from=" + from + + ", location=" + location + + ", query='" + query + '\''.toString() + + ", offset='" + offset + '\''.toString() + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Invoice.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Invoice.kt new file mode 100644 index 00000000..bda0bddc --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Invoice.kt @@ -0,0 +1,73 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 24 May 2017 + */ +class Invoice : Serializable { + + private val title: String? = null + private val description: String? = null + private val start_parameter: String? = null + private val currency: String? = null + private val total_amount: Int? = null + + fun title(): String? { + return title + } + + fun description(): String? { + return description + } + + fun startParameter(): String? { + return start_parameter + } + + fun currency(): String? { + return currency + } + + fun totalAmount(): Int? { + return total_amount + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val invoice = o as Invoice? + + if (if (title != null) title != invoice!!.title else invoice!!.title != null) return false + if (if (description != null) description != invoice.description else invoice.description != null) return false + if (if (start_parameter != null) start_parameter != invoice.start_parameter else invoice.start_parameter != null) + return false + if (if (currency != null) currency != invoice.currency else invoice.currency != null) return false + return if (total_amount != null) total_amount == invoice.total_amount else invoice.total_amount == null + } + + override fun hashCode(): Int { + var result = title?.hashCode() ?: 0 + result = 31 * result + (description?.hashCode() ?: 0) + result = 31 * result + (start_parameter?.hashCode() ?: 0) + result = 31 * result + (currency?.hashCode() ?: 0) + result = 31 * result + (total_amount?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "Invoice{" + + "title='" + title + '\''.toString() + + ", description='" + description + '\''.toString() + + ", start_parameter='" + start_parameter + '\''.toString() + + ", currency='" + currency + '\''.toString() + + ", total_amount=" + total_amount + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Location.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Location.kt new file mode 100644 index 00000000..b7382cec --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Location.kt @@ -0,0 +1,48 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 8/5/15. + */ +class Location : Serializable { + + private val longitude: Float? = null + private val latitude: Float? = null + + fun longitude(): Float? { + return longitude + } + + fun latitude(): Float? { + return latitude + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val location = o as Location? + + if (if (longitude != null) longitude != location!!.longitude else location!!.longitude != null) return false + return if (latitude != null) latitude == location.latitude else location.latitude == null + } + + override fun hashCode(): Int { + var result = longitude?.hashCode() ?: 0 + result = 31 * result + (latitude?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "Location{" + + "longitude=" + longitude + + ", latitude=" + latitude + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/MaskPosition.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/MaskPosition.kt new file mode 100644 index 00000000..9cb5b15d --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/MaskPosition.kt @@ -0,0 +1,44 @@ +package com.pengrad.telegrambot.model + +import com.google.gson.Gson + +import java.io.Serializable + +/** + * Stas Parshin + * 23 July 2017 + */ +data class MaskPosition( + private val point: String, + private val x_shift: Float, + private val y_shift: Float, + private val scale: Float +) : Serializable { + + enum class Point { + forehead, eyes, mouth, chin + } + + constructor(point: Point, x_shift: Float, y_shift: Float, scale: Float) : this(point.name, x_shift, y_shift, scale) + + fun point(): String { + return point + } + + fun xShift(): Float { + return x_shift + } + + fun yShift(): Float { + return y_shift + } + + fun scale(): Float { + return scale + } + + companion object { + private const val serialVersionUID = 0L + private val gson = Gson() + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Message.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Message.kt new file mode 100644 index 00000000..53b9f3c3 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Message.kt @@ -0,0 +1,390 @@ +package com.pengrad.telegrambot.model + +//import com.pengrad.telegrambot.passport.PassportData + +import java.io.Serializable +import java.util.* + +/** + * stas + * 8/4/15. + */ +class Message : Serializable { + + private val message_id: Int? = null + private val from: User? = null + private val date: Int? = null + private val chat: Chat? = null + private val forward_from: User? = null + private val forward_from_chat: Chat? = null + private val forward_from_message_id: Int? = null + private val forward_signature: String? = null + private val forward_sender_name: String? = null + private val forward_date: Int? = null + private val reply_to_message: Message? = null + private val edit_date: Int? = null + private val media_group_id: String? = null + private val author_signature: String? = null + private val text: String? = null + private val entities: Array? = null + private val caption_entities: Array? = null + private val audio: Audio? = null + private val document: Document? = null + private val animation: Animation? = null + private val game: Game? = null + private val photo: Array? = null + private val sticker: Sticker? = null + private val video: Video? = null + private val voice: Voice? = null + private val video_note: VideoNote? = null + private val caption: String? = null + private val contact: Contact? = null + private val location: Location? = null + private val venue: Venue? = null + private val poll: Poll? = null + private val new_chat_member: User? = null + private val new_chat_members: Array? = null + private val left_chat_member: User? = null + private val new_chat_title: String? = null + private val new_chat_photo: Array? = null + private val delete_chat_photo: Boolean? = null + private val group_chat_created: Boolean? = null + private val supergroup_chat_created: Boolean? = null + private val channel_chat_created: Boolean? = null + private val migrate_to_chat_id: Long? = null + private val migrate_from_chat_id: Long? = null + private val pinned_message: Message? = null + private val invoice: Invoice? = null + private val successful_payment: SuccessfulPayment? = null + private val connected_website: String? = null + private val passport_data: Object? = null + + fun messageId(): Int? { + return message_id + } + + fun from(): User? { + return from + } + + fun date(): Int? { + return date + } + + fun chat(): Chat? { + return chat + } + + fun forwardFrom(): User? { + return forward_from + } + + fun forwardFromChat(): Chat? { + return forward_from_chat + } + + fun forwardFromMessageId(): Int? { + return forward_from_message_id + } + + fun forwardSignature(): String? { + return forward_signature + } + + fun forwardSenderName(): String? { + return forward_sender_name + } + + fun forwardDate(): Int? { + return forward_date + } + + fun replyToMessage(): Message? { + return reply_to_message + } + + fun editDate(): Int? { + return edit_date + } + + fun mediaGroupId(): String? { + return media_group_id + } + + fun authorSignature(): String? { + return author_signature + } + + fun text(): String? { + return text + } + + fun entities(): Array? { + return entities + } + + fun captionEntities(): Array? { + return caption_entities + } + + fun audio(): Audio? { + return audio + } + + fun document(): Document? { + return document + } + + fun animation(): Animation? { + return animation + } + + fun game(): Game? { + return game + } + + fun photo(): Array? { + return photo + } + + fun sticker(): Sticker? { + return sticker + } + + fun video(): Video? { + return video + } + + fun voice(): Voice? { + return voice + } + + fun videoNote(): VideoNote? { + return video_note + } + + fun caption(): String? { + return caption + } + + fun contact(): Contact? { + return contact + } + + fun location(): Location? { + return location + } + + fun venue(): Venue? { + return venue + } + + fun poll(): Poll? { + return poll + } + + + @Deprecated("Replaced with new_chat_members") + fun newChatMember(): User? { + return new_chat_member + } + + fun newChatMembers(): Array? { + return new_chat_members + } + + fun leftChatMember(): User? { + return left_chat_member + } + + fun newChatTitle(): String? { + return new_chat_title + } + + fun newChatPhoto(): Array? { + return new_chat_photo + } + + fun deleteChatPhoto(): Boolean? { + return delete_chat_photo + } + + fun groupChatCreated(): Boolean? { + return group_chat_created + } + + fun supergroupChatCreated(): Boolean? { + return supergroup_chat_created + } + + fun channelChatCreated(): Boolean? { + return channel_chat_created + } + + fun migrateToChatId(): Long? { + return migrate_to_chat_id + } + + fun migrateFromChatId(): Long? { + return migrate_from_chat_id + } + + fun pinnedMessage(): Message? { + return pinned_message + } + + fun invoice(): Invoice? { + return invoice + } + + fun successfulPayment(): SuccessfulPayment? { + return successful_payment + } + + fun connectedWebsite(): String? { + return connected_website + } + + fun passportData(): Object? { + return passport_data + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val message = o as Message? + + if (if (message_id != null) message_id != message!!.message_id else message!!.message_id != null) return false + if (if (from != null) from != message.from else message.from != null) return false + if (if (date != null) date != message.date else message.date != null) return false + if (if (chat != null) chat != message.chat else message.chat != null) return false + if (if (forward_from != null) forward_from != message.forward_from else message.forward_from != null) return false + if (if (forward_from_chat != null) forward_from_chat != message.forward_from_chat else message.forward_from_chat != null) + return false + if (if (forward_from_message_id != null) forward_from_message_id != message.forward_from_message_id else message.forward_from_message_id != null) + return false + if (if (forward_signature != null) forward_signature != message.forward_signature else message.forward_signature != null) + return false + if (if (forward_sender_name != null) forward_sender_name != message.forward_sender_name else message.forward_sender_name != null) + return false + if (if (forward_date != null) forward_date != message.forward_date else message.forward_date != null) return false + if (if (reply_to_message != null) reply_to_message != message.reply_to_message else message.reply_to_message != null) + return false + if (if (edit_date != null) edit_date != message.edit_date else message.edit_date != null) return false + if (if (media_group_id != null) media_group_id != message.media_group_id else message.media_group_id != null) + return false + if (if (author_signature != null) author_signature != message.author_signature else message.author_signature != null) + return false + if (if (text != null) text != message.text else message.text != null) return false + // Probably incorrect - comparing Object[] arrays with Arrays.equals + if (!Arrays.equals(entities, message.entities)) return false + // Probably incorrect - comparing Object[] arrays with Arrays.equals + if (!Arrays.equals(caption_entities, message.caption_entities)) return false + if (if (audio != null) audio != message.audio else message.audio != null) return false + if (if (document != null) document != message.document else message.document != null) return false + if (if (animation != null) animation != message.animation else message.animation != null) return false + if (if (game != null) game != message.game else message.game != null) return false + // Probably incorrect - comparing Object[] arrays with Arrays.equals + if (!Arrays.equals(photo, message.photo)) return false + if (if (sticker != null) sticker != message.sticker else message.sticker != null) return false + if (if (video != null) video != message.video else message.video != null) return false + if (if (voice != null) voice != message.voice else message.voice != null) return false + if (if (video_note != null) video_note != message.video_note else message.video_note != null) return false + if (if (caption != null) caption != message.caption else message.caption != null) return false + if (if (contact != null) contact != message.contact else message.contact != null) return false + if (if (location != null) location != message.location else message.location != null) return false + if (if (venue != null) venue != message.venue else message.venue != null) return false + if (if (poll != null) poll != message.poll else message.poll != null) return false + if (if (new_chat_member != null) new_chat_member != message.new_chat_member else message.new_chat_member != null) + return false + // Probably incorrect - comparing Object[] arrays with Arrays.equals + if (!Arrays.equals(new_chat_members, message.new_chat_members)) return false + if (if (left_chat_member != null) left_chat_member != message.left_chat_member else message.left_chat_member != null) + return false + if (if (new_chat_title != null) new_chat_title != message.new_chat_title else message.new_chat_title != null) + return false + // Probably incorrect - comparing Object[] arrays with Arrays.equals + if (!Arrays.equals(new_chat_photo, message.new_chat_photo)) return false + if (if (delete_chat_photo != null) delete_chat_photo != message.delete_chat_photo else message.delete_chat_photo != null) + return false + if (if (group_chat_created != null) group_chat_created != message.group_chat_created else message.group_chat_created != null) + return false + if (if (supergroup_chat_created != null) supergroup_chat_created != message.supergroup_chat_created else message.supergroup_chat_created != null) + return false + if (if (channel_chat_created != null) channel_chat_created != message.channel_chat_created else message.channel_chat_created != null) + return false + if (if (migrate_to_chat_id != null) migrate_to_chat_id != message.migrate_to_chat_id else message.migrate_to_chat_id != null) + return false + if (if (migrate_from_chat_id != null) migrate_from_chat_id != message.migrate_from_chat_id else message.migrate_from_chat_id != null) + return false + if (if (pinned_message != null) pinned_message != message.pinned_message else message.pinned_message != null) + return false + if (if (invoice != null) invoice != message.invoice else message.invoice != null) return false + if (if (successful_payment != null) successful_payment != message.successful_payment else message.successful_payment != null) + return false + if (if (connected_website != null) connected_website != message.connected_website else message.connected_website != null) + return false + return if (passport_data != null) passport_data!!.equals(message.passport_data) else message.passport_data == null + } + + override fun hashCode(): Int { + return message_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "Message{" + + "message_id=" + message_id + + ", from=" + from + + ", date=" + date + + ", chat=" + chat + + ", forward_from=" + forward_from + + ", forward_from_chat=" + forward_from_chat + + ", forward_from_message_id=" + forward_from_message_id + + ", forward_signature='" + forward_signature + '\''.toString() + + ", forward_sender_name='" + forward_sender_name + '\''.toString() + + ", forward_date=" + forward_date + + ", reply_to_message=" + reply_to_message + + ", edit_date=" + edit_date + + ", media_group_id='" + media_group_id + '\''.toString() + + ", author_signature='" + author_signature + '\''.toString() + + ", text='" + text + '\''.toString() + + ", entities=" + Arrays.toString(entities) + + ", caption_entities=" + Arrays.toString(caption_entities) + + ", audio=" + audio + + ", document=" + document + + ", animation=" + animation + + ", game=" + game + + ", photo=" + Arrays.toString(photo) + + ", sticker=" + sticker + + ", video=" + video + + ", voice=" + voice + + ", video_note=" + video_note + + ", caption='" + caption + '\''.toString() + + ", contact=" + contact + + ", location=" + location + + ", venue=" + venue + + ", poll=" + poll + + ", new_chat_member=" + new_chat_member + + ", new_chat_members=" + Arrays.toString(new_chat_members) + + ", left_chat_member=" + left_chat_member + + ", new_chat_title='" + new_chat_title + '\''.toString() + + ", new_chat_photo=" + Arrays.toString(new_chat_photo) + + ", delete_chat_photo=" + delete_chat_photo + + ", group_chat_created=" + group_chat_created + + ", supergroup_chat_created=" + supergroup_chat_created + + ", channel_chat_created=" + channel_chat_created + + ", migrate_to_chat_id=" + migrate_to_chat_id + + ", migrate_from_chat_id=" + migrate_from_chat_id + + ", pinned_message=" + pinned_message + + ", invoice=" + invoice + + ", successful_payment=" + successful_payment + + ", connected_website='" + connected_website + '\''.toString() + + ", passport_data=" + passport_data + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/MessageEntity.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/MessageEntity.kt new file mode 100644 index 00000000..48b14e16 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/MessageEntity.kt @@ -0,0 +1,78 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 5/3/16. + */ +class MessageEntity : Serializable { + + private val type: Type? = null + private val offset: Int? = null + private val length: Int? = null + private val url: String? = null + private val user: User? = null + + enum class Type { + mention, hashtag, cashtag, bot_command, url, email, phone_number, bold, italic, code, pre, text_link, + text_mention + } + + fun type(): Type? { + return type + } + + fun offset(): Int? { + return offset + } + + fun length(): Int? { + return length + } + + fun url(): String? { + return url + } + + fun user(): User? { + return user + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as MessageEntity? + + if (type != that!!.type) return false + if (if (offset != null) offset != that.offset else that.offset != null) return false + if (if (length != null) length != that.length else that.length != null) return false + if (if (url != null) url != that.url else that.url != null) return false + return if (user != null) user == that.user else that.user == null + + } + + override fun hashCode(): Int { + var result = type?.hashCode() ?: 0 + result = 31 * result + (offset?.hashCode() ?: 0) + result = 31 * result + (length?.hashCode() ?: 0) + result = 31 * result + (url?.hashCode() ?: 0) + result = 31 * result + (user?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "MessageEntity{" + + "type=" + type + + ", offset=" + offset + + ", length=" + length + + ", url='" + url + '\''.toString() + + ", user=" + user + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/OrderInfo.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/OrderInfo.kt new file mode 100644 index 00000000..bc77780f --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/OrderInfo.kt @@ -0,0 +1,65 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 24 May 2017 + */ +class OrderInfo : Serializable { + + private val name: String? = null + private val phone_number: String? = null + private val email: String? = null + private val shipping_address: ShippingAddress? = null + + fun name(): String? { + return name + } + + fun phoneNumber(): String? { + return phone_number + } + + fun email(): String? { + return email + } + + fun shippingAddress(): ShippingAddress? { + return shipping_address + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val orderInfo = o as OrderInfo? + + if (if (name != null) name != orderInfo!!.name else orderInfo!!.name != null) return false + if (if (phone_number != null) phone_number != orderInfo.phone_number else orderInfo.phone_number != null) return false + if (if (email != null) email != orderInfo.email else orderInfo.email != null) return false + return if (shipping_address != null) shipping_address == orderInfo.shipping_address else orderInfo.shipping_address == null + + } + + override fun hashCode(): Int { + var result = name?.hashCode() ?: 0 + result = 31 * result + (phone_number?.hashCode() ?: 0) + result = 31 * result + (email?.hashCode() ?: 0) + result = 31 * result + (shipping_address?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "OrderInfo{" + + "name='" + name + '\''.toString() + + ", phone_number='" + phone_number + '\''.toString() + + ", email='" + email + '\''.toString() + + ", shipping_address=" + shipping_address + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/PhotoSize.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/PhotoSize.kt new file mode 100644 index 00000000..3c2ec3bd --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/PhotoSize.kt @@ -0,0 +1,60 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 8/4/15. + */ +class PhotoSize : Serializable { + + private val file_id: String? = null + private val width: Int? = null + private val height: Int? = null + private val file_size: Int? = null + + fun fileId(): String? { + return file_id + } + + fun width(): Int? { + return width + } + + fun height(): Int? { + return height + } + + fun fileSize(): Int? { + return file_size + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val photoSize = o as PhotoSize? + + if (if (file_id != null) file_id != photoSize!!.file_id else photoSize!!.file_id != null) return false + if (if (width != null) width != photoSize.width else photoSize.width != null) return false + if (if (height != null) height != photoSize.height else photoSize.height != null) return false + return if (file_size != null) file_size == photoSize.file_size else photoSize.file_size == null + } + + override fun hashCode(): Int { + return file_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "PhotoSize{" + + "file_id='" + file_id + '\''.toString() + + ", width=" + width + + ", height=" + height + + ", file_size=" + file_size + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Poll.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Poll.kt new file mode 100644 index 00000000..f33730e3 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Poll.kt @@ -0,0 +1,60 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable +import java.util.* + +/** + * Stas Parshin + * 17 April 2019 + */ +class Poll : Serializable { + + private val id: String? = null + private val question: String? = null + private val options: Array? = null + private val is_closed: Boolean? = null + + fun id(): String? { + return id + } + + fun question(): String? { + return question + } + + fun options(): Array? { + return options + } + + fun isClosed() = is_closed + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val poll = o as Poll? + + if (if (id != null) id != poll!!.id else poll!!.id != null) return false + if (if (question != null) question != poll.question else poll.question != null) return false + // Probably incorrect - comparing Object[] arrays with Arrays.equals + if (!Arrays.equals(options, poll.options)) return false + return if (is_closed != null) is_closed == poll.is_closed else poll.is_closed == null + } + + override fun hashCode(): Int { + return id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "Poll{" + + "id='" + id + '\''.toString() + + ", question='" + question + '\''.toString() + + ", options=" + Arrays.toString(options) + + ", is_closed=" + is_closed + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/PollOption.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/PollOption.kt new file mode 100644 index 00000000..49ae8a81 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/PollOption.kt @@ -0,0 +1,48 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 17 April 2019 + */ +class PollOption : Serializable { + + private val text: String? = null + private val voter_count: Int? = null + + fun text(): String? { + return text + } + + fun voterCount(): Int? { + return voter_count + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as PollOption? + + if (if (text != null) text != that!!.text else that!!.text != null) return false + return if (voter_count != null) voter_count == that.voter_count else that.voter_count == null + } + + override fun hashCode(): Int { + var result = text?.hashCode() ?: 0 + result = 31 * result + (voter_count?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "PollOption{" + + "text='" + text + '\''.toString() + + ", voter_count=" + voter_count + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/PreCheckoutQuery.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/PreCheckoutQuery.kt new file mode 100644 index 00000000..de1a1e8e --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/PreCheckoutQuery.kt @@ -0,0 +1,83 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 24 May 2017 + */ +class PreCheckoutQuery : Serializable { + + private val id: String? = null + private val from: User? = null + private val currency: String? = null + private val total_amount: Int? = null + private val invoice_payload: String? = null + private val shipping_option_id: String? = null + private val order_info: OrderInfo? = null + + fun id(): String? { + return id + } + + fun from(): User? { + return from + } + + fun currency(): String? { + return currency + } + + fun totalAmount(): Int? { + return total_amount + } + + fun invoicePayload(): String? { + return invoice_payload + } + + fun shippingOptionId(): String? { + return shipping_option_id + } + + fun orderInfo(): OrderInfo? { + return order_info + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as PreCheckoutQuery? + + if (if (id != null) id != that!!.id else that!!.id != null) return false + if (if (from != null) from != that.from else that.from != null) return false + if (if (currency != null) currency != that.currency else that.currency != null) return false + if (if (total_amount != null) total_amount != that.total_amount else that.total_amount != null) return false + if (if (invoice_payload != null) invoice_payload != that.invoice_payload else that.invoice_payload != null) + return false + if (if (shipping_option_id != null) shipping_option_id != that.shipping_option_id else that.shipping_option_id != null) + return false + return if (order_info != null) order_info == that.order_info else that.order_info == null + } + + override fun hashCode(): Int { + return id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "PreCheckoutQuery{" + + "id='" + id + '\''.toString() + + ", from=" + from + + ", currency='" + currency + '\''.toString() + + ", total_amount=" + total_amount + + ", invoice_payload='" + invoice_payload + '\''.toString() + + ", shipping_option_id='" + shipping_option_id + '\''.toString() + + ", order_info=" + order_info + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ResponseParameters.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/ResponseParameters.kt new file mode 100644 index 00000000..58785d60 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/ResponseParameters.kt @@ -0,0 +1,49 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 03 October 2016 + */ +class ResponseParameters : Serializable { + + private val migrate_to_chat_id: Long? = null + private val retry_after: Int? = null + + fun migrateToChatId(): Long? { + return migrate_to_chat_id + } + + fun retryAfter(): Int? { + return retry_after + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as ResponseParameters? + + if (if (migrate_to_chat_id != null) migrate_to_chat_id != that!!.migrate_to_chat_id else that!!.migrate_to_chat_id != null) + return false + return if (retry_after != null) retry_after == that.retry_after else that.retry_after == null + } + + override fun hashCode(): Int { + var result = migrate_to_chat_id?.hashCode() ?: 0 + result = 31 * result + (retry_after?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "ResponseParameters{" + + "migrate_to_chat_id=" + migrate_to_chat_id + + ", retry_after=" + retry_after + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingAddress.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingAddress.kt new file mode 100644 index 00000000..17564fca --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingAddress.kt @@ -0,0 +1,81 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 24 May 2017 + */ +class ShippingAddress : Serializable { + + private val country_code: String? = null + private val state: String? = null + private val city: String? = null + private val street_line1: String? = null + private val street_line2: String? = null + private val post_code: String? = null + + fun countryCode(): String? { + return country_code + } + + fun state(): String? { + return state + } + + fun city(): String? { + return city + } + + fun streetLine1(): String? { + return street_line1 + } + + fun streetLine2(): String? { + return street_line2 + } + + fun postCode(): String? { + return post_code + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as ShippingAddress? + + if (if (country_code != null) country_code != that!!.country_code else that!!.country_code != null) return false + if (if (state != null) state != that.state else that.state != null) return false + if (if (city != null) city != that.city else that.city != null) return false + if (if (street_line1 != null) street_line1 != that.street_line1 else that.street_line1 != null) return false + if (if (street_line2 != null) street_line2 != that.street_line2 else that.street_line2 != null) return false + return if (post_code != null) post_code == that.post_code else that.post_code == null + + } + + override fun hashCode(): Int { + var result = country_code?.hashCode() ?: 0 + result = 31 * result + (state?.hashCode() ?: 0) + result = 31 * result + (city?.hashCode() ?: 0) + result = 31 * result + (street_line1?.hashCode() ?: 0) + result = 31 * result + (street_line2?.hashCode() ?: 0) + result = 31 * result + (post_code?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "ShippingAddress{" + + "country_code='" + country_code + '\''.toString() + + ", state='" + state + '\''.toString() + + ", city='" + city + '\''.toString() + + ", street_line1='" + street_line1 + '\''.toString() + + ", street_line2='" + street_line2 + '\''.toString() + + ", post_code='" + post_code + '\''.toString() + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingQuery.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingQuery.kt new file mode 100644 index 00000000..24f473c2 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingQuery.kt @@ -0,0 +1,61 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 24 May 2017 + */ +class ShippingQuery : Serializable { + + private val id: String? = null + private val from: User? = null + private val invoice_payload: String? = null + private val shipping_address: ShippingAddress? = null + + fun id(): String? { + return id + } + + fun from(): User? { + return from + } + + fun invoicePayload(): String? { + return invoice_payload + } + + fun shippingAddress(): ShippingAddress? { + return shipping_address + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as ShippingQuery? + + if (if (id != null) id != that!!.id else that!!.id != null) return false + if (if (from != null) from != that.from else that.from != null) return false + if (if (invoice_payload != null) invoice_payload != that.invoice_payload else that.invoice_payload != null) + return false + return if (shipping_address != null) shipping_address == that.shipping_address else that.shipping_address == null + } + + override fun hashCode(): Int { + return id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "ShippingQuery{" + + "id='" + id + '\''.toString() + + ", from=" + from + + ", invoice_payload='" + invoice_payload + '\''.toString() + + ", shipping_address=" + shipping_address + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Sticker.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Sticker.kt new file mode 100644 index 00000000..857a60a1 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Sticker.kt @@ -0,0 +1,88 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 8/5/15. + */ +class Sticker : Serializable { + + private val file_id: String? = null + private val width: Int? = null + private val height: Int? = null + private val thumb: PhotoSize? = null + private val emoji: String? = null + private val set_name: String? = null + private val mask_position: MaskPosition? = null + private val file_size: Int? = null + + fun fileId(): String? { + return file_id + } + + fun width(): Int? { + return width + } + + fun height(): Int? { + return height + } + + fun thumb(): PhotoSize? { + return thumb + } + + fun emoji(): String? { + return emoji + } + + fun setName(): String? { + return set_name + } + + fun maskPosition(): MaskPosition? { + return mask_position + } + + fun fileSize(): Int? { + return file_size + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val sticker = o as Sticker? + + if (if (file_id != null) file_id != sticker!!.file_id else sticker!!.file_id != null) return false + if (if (width != null) width != sticker.width else sticker.width != null) return false + if (if (height != null) height != sticker.height else sticker.height != null) return false + if (if (thumb != null) thumb != sticker.thumb else sticker.thumb != null) return false + if (if (emoji != null) emoji != sticker.emoji else sticker.emoji != null) return false + if (if (set_name != null) set_name != sticker.set_name else sticker.set_name != null) return false + if (if (mask_position != null) mask_position != sticker.mask_position else sticker.mask_position != null) return false + return if (file_size != null) file_size == sticker.file_size else sticker.file_size == null + } + + override fun hashCode(): Int { + return file_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "Sticker{" + + "file_id='" + file_id + '\''.toString() + + ", width=" + width + + ", height=" + height + + ", thumb=" + thumb + + ", emoji='" + emoji + '\''.toString() + + ", set_name='" + set_name + '\''.toString() + + ", mask_position=" + mask_position + + ", file_size=" + file_size + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/StickerSet.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/StickerSet.kt new file mode 100644 index 00000000..9311b8d9 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/StickerSet.kt @@ -0,0 +1,65 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable +import java.util.Arrays + +/** + * Stas Parshin + * 23 July 2017 + */ +class StickerSet : Serializable { + + private val name: String? = null + private val title: String? = null + private val contains_masks: Boolean? = null + private val stickers: Array? = null + + fun name(): String? { + return name + } + + fun title(): String? { + return title + } + + fun containsMasks(): Boolean? { + return contains_masks + } + + fun stickers(): Array? { + return stickers + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as StickerSet? + + if (if (name != null) name != that!!.name else that!!.name != null) return false + if (if (title != null) title != that.title else that.title != null) return false + return if (if (contains_masks != null) contains_masks != that.contains_masks else that.contains_masks != null) false else Arrays.equals(stickers, that.stickers) + // Probably incorrect - comparing Object[] arrays with Arrays.equals + } + + override fun hashCode(): Int { + var result = name?.hashCode() ?: 0 + result = 31 * result + (title?.hashCode() ?: 0) + result = 31 * result + (contains_masks?.hashCode() ?: 0) + result = 31 * result + Arrays.hashCode(stickers) + return result + } + + override fun toString(): String { + return "StickerSet{" + + "name='" + name + '\''.toString() + + ", title='" + title + '\''.toString() + + ", contains_masks=" + contains_masks + + ", stickers=" + Arrays.toString(stickers) + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/SuccessfulPayment.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/SuccessfulPayment.kt new file mode 100644 index 00000000..72e00001 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/SuccessfulPayment.kt @@ -0,0 +1,92 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 24 May 2017 + */ +class SuccessfulPayment : Serializable { + + private val currency: String? = null + private val total_amount: Int? = null + private val invoice_payload: String? = null + private val shipping_option_id: String? = null + private val order_info: OrderInfo? = null + private val telegram_payment_charge_id: String? = null + private val provider_payment_charge_id: String? = null + + fun currency(): String? { + return currency + } + + fun totalAmount(): Int? { + return total_amount + } + + fun invoicePayload(): String? { + return invoice_payload + } + + fun shippingOptionId(): String? { + return shipping_option_id + } + + fun orderInfo(): OrderInfo? { + return order_info + } + + fun telegramPaymentChargeId(): String? { + return telegram_payment_charge_id + } + + fun providerPaymentChargeId(): String? { + return provider_payment_charge_id + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as SuccessfulPayment? + + if (if (currency != null) currency != that!!.currency else that!!.currency != null) return false + if (if (total_amount != null) total_amount != that.total_amount else that.total_amount != null) return false + if (if (invoice_payload != null) invoice_payload != that.invoice_payload else that.invoice_payload != null) + return false + if (if (shipping_option_id != null) shipping_option_id != that.shipping_option_id else that.shipping_option_id != null) + return false + if (if (order_info != null) order_info != that.order_info else that.order_info != null) return false + if (if (telegram_payment_charge_id != null) telegram_payment_charge_id != that.telegram_payment_charge_id else that.telegram_payment_charge_id != null) + return false + return if (provider_payment_charge_id != null) provider_payment_charge_id == that.provider_payment_charge_id else that.provider_payment_charge_id == null + + } + + override fun hashCode(): Int { + var result = currency?.hashCode() ?: 0 + result = 31 * result + (total_amount?.hashCode() ?: 0) + result = 31 * result + (invoice_payload?.hashCode() ?: 0) + result = 31 * result + (shipping_option_id?.hashCode() ?: 0) + result = 31 * result + (order_info?.hashCode() ?: 0) + result = 31 * result + (telegram_payment_charge_id?.hashCode() ?: 0) + result = 31 * result + (provider_payment_charge_id?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "SuccessfulPayment{" + + "currency='" + currency + '\''.toString() + + ", total_amount=" + total_amount + + ", invoice_payload='" + invoice_payload + '\''.toString() + + ", shipping_option_id='" + shipping_option_id + '\''.toString() + + ", order_info=" + order_info + + ", telegram_payment_charge_id='" + telegram_payment_charge_id + '\''.toString() + + ", provider_payment_charge_id='" + provider_payment_charge_id + '\''.toString() + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Update.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Update.kt new file mode 100644 index 00000000..9263a931 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Update.kt @@ -0,0 +1,115 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 8/4/15. + */ +class Update : Serializable { + + private val update_id: Int? = null + private val message: Message? = null + private val edited_message: Message? = null + private val channel_post: Message? = null + private val edited_channel_post: Message? = null + private val inline_query: InlineQuery? = null + private val chosen_inline_result: ChosenInlineResult? = null + private val callback_query: CallbackQuery? = null + private val shipping_query: ShippingQuery? = null + private val pre_checkout_query: PreCheckoutQuery? = null + private val poll: Poll? = null + + fun updateId(): Int? { + return update_id + } + + fun message(): Message? { + return message + } + + fun editedMessage(): Message? { + return edited_message + } + + fun channelPost(): Message? { + return channel_post + } + + fun editedChannelPost(): Message? { + return edited_channel_post + } + + fun inlineQuery(): InlineQuery? { + return inline_query + } + + fun chosenInlineResult(): ChosenInlineResult? { + return chosen_inline_result + } + + fun callbackQuery(): CallbackQuery? { + return callback_query + } + + fun shippingQuery(): ShippingQuery? { + return shipping_query + } + + fun preCheckoutQuery(): PreCheckoutQuery? { + return pre_checkout_query + } + + fun poll(): Poll? { + return poll + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val update = o as Update? + + if (if (update_id != null) update_id != update!!.update_id else update!!.update_id != null) return false + if (if (message != null) message != update.message else update.message != null) return false + if (if (edited_message != null) edited_message != update.edited_message else update.edited_message != null) + return false + if (if (channel_post != null) channel_post != update.channel_post else update.channel_post != null) return false + if (if (edited_channel_post != null) edited_channel_post != update.edited_channel_post else update.edited_channel_post != null) + return false + if (if (inline_query != null) inline_query != update.inline_query else update.inline_query != null) return false + if (if (chosen_inline_result != null) chosen_inline_result != update.chosen_inline_result else update.chosen_inline_result != null) + return false + if (if (callback_query != null) callback_query != update.callback_query else update.callback_query != null) + return false + if (if (shipping_query != null) shipping_query != update.shipping_query else update.shipping_query != null) + return false + if (if (pre_checkout_query != null) pre_checkout_query != update.pre_checkout_query else update.pre_checkout_query != null) + return false + return if (poll != null) poll == update.poll else update.poll == null + } + + override fun hashCode(): Int { + return update_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "Update{" + + "update_id=" + update_id + + ", message=" + message + + ", edited_message=" + edited_message + + ", channel_post=" + channel_post + + ", edited_channel_post=" + edited_channel_post + + ", inline_query=" + inline_query + + ", chosen_inline_result=" + chosen_inline_result + + ", callback_query=" + callback_query + + ", shipping_query=" + shipping_query + + ", pre_checkout_query=" + pre_checkout_query + + ", poll=" + poll + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/User.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/User.kt new file mode 100644 index 00000000..553284f7 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/User.kt @@ -0,0 +1,45 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 8/4/15. + */ +data class User( + private val id: Int? = null, + private val is_bot: Boolean? = null, + private val first_name: String? = null, + private val last_name: String? = null, + private val username: String? = null, + private val language_code: String? = null +) : Serializable { + + fun id(): Int? { + return id + } + + fun isBot(): Boolean? { + return is_bot + } + + fun firstName(): String? { + return first_name + } + + fun lastName(): String? { + return last_name + } + + fun username(): String? { + return username + } + + fun languageCode(): String? { + return language_code + } + + companion object { + private const val serialVersionUID = 0L + } +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/UserProfilePhotos.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/UserProfilePhotos.kt new file mode 100644 index 00000000..7f6f4102 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/UserProfilePhotos.kt @@ -0,0 +1,48 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable +import java.util.Arrays + +/** + * stas + * 8/5/15. + */ +class UserProfilePhotos : Serializable { + + private val total_count: Int? = null + private val photos: Array>? = null + + fun totalCount(): Int? { + return total_count + } + + fun photos(): Array>? { + return photos + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as UserProfilePhotos? + + return if (if (total_count != null) total_count != that!!.total_count else that!!.total_count != null) false else Arrays.deepEquals(photos, that.photos) + } + + override fun hashCode(): Int { + var result = total_count?.hashCode() ?: 0 + result = 31 * result + Arrays.deepHashCode(photos) + return result + } + + override fun toString(): String { + return "UserProfilePhotos{" + + "total_count=" + total_count + + ", photos=" + Arrays.deepToString(photos) + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Venue.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Venue.kt new file mode 100644 index 00000000..6eff6068 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Venue.kt @@ -0,0 +1,72 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 5/3/16. + */ +class Venue : Serializable { + + private val location: Location? = null + private val title: String? = null + private val address: String? = null + private val foursquare_id: String? = null + private val foursquare_type: String? = null + + fun location(): Location? { + return location + } + + fun title(): String? { + return title + } + + fun address(): String? { + return address + } + + fun foursquareId(): String? { + return foursquare_id + } + + fun foursquareType(): String? { + return foursquare_type + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val venue = o as Venue? + + if (if (location != null) location != venue!!.location else venue!!.location != null) return false + if (if (title != null) title != venue.title else venue.title != null) return false + if (if (address != null) address != venue.address else venue.address != null) return false + if (if (foursquare_id != null) foursquare_id != venue.foursquare_id else venue.foursquare_id != null) return false + return if (foursquare_type != null) foursquare_type == venue.foursquare_type else venue.foursquare_type == null + } + + override fun hashCode(): Int { + var result = location?.hashCode() ?: 0 + result = 31 * result + (title?.hashCode() ?: 0) + result = 31 * result + (address?.hashCode() ?: 0) + result = 31 * result + (foursquare_id?.hashCode() ?: 0) + result = 31 * result + (foursquare_type?.hashCode() ?: 0) + return result + } + + override fun toString(): String { + return "Venue{" + + "location=" + location + + ", title='" + title + '\''.toString() + + ", address='" + address + '\''.toString() + + ", foursquare_id='" + foursquare_id + '\''.toString() + + ", foursquare_type='" + foursquare_type + '\''.toString() + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Video.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Video.kt new file mode 100644 index 00000000..de74d456 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Video.kt @@ -0,0 +1,81 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 8/5/15. + */ +class Video : Serializable { + + private val file_id: String? = null + private val width: Int? = null + private val height: Int? = null + private val duration: Int? = null + private val thumb: PhotoSize? = null + private val mime_type: String? = null + private val file_size: Int? = null + + fun fileId(): String? { + return file_id + } + + fun width(): Int? { + return width + } + + fun height(): Int? { + return height + } + + fun duration(): Int? { + return duration + } + + fun thumb(): PhotoSize? { + return thumb + } + + fun mimeType(): String? { + return mime_type + } + + fun fileSize(): Int? { + return file_size + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val video = o as Video? + + if (if (file_id != null) file_id != video!!.file_id else video!!.file_id != null) return false + if (if (width != null) width != video.width else video.width != null) return false + if (if (height != null) height != video.height else video.height != null) return false + if (if (duration != null) duration != video.duration else video.duration != null) return false + if (if (thumb != null) thumb != video.thumb else video.thumb != null) return false + if (if (mime_type != null) mime_type != video.mime_type else video.mime_type != null) return false + return if (file_size != null) file_size == video.file_size else video.file_size == null + } + + override fun hashCode(): Int { + return file_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "Video{" + + "file_id='" + file_id + '\''.toString() + + ", width=" + width + + ", height=" + height + + ", duration=" + duration + + ", thumb=" + thumb + + ", mime_type='" + mime_type + '\''.toString() + + ", file_size=" + file_size + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/VideoNote.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/VideoNote.kt new file mode 100644 index 00000000..a6e05d13 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/VideoNote.kt @@ -0,0 +1,67 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * Stas Parshin + * 23 May 2017 + */ +class VideoNote : Serializable { + + private val file_id: String? = null + private val length: Int? = null + private val duration: Int? = null + private val thumb: PhotoSize? = null + private val file_size: Int? = null + + fun fileId(): String? { + return file_id + } + + fun length(): Int? { + return length + } + + fun duration(): Int? { + return duration + } + + fun thumb(): PhotoSize? { + return thumb + } + + fun fileSize(): Int? { + return file_size + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val videoNote = o as VideoNote? + + if (if (file_id != null) file_id != videoNote!!.file_id else videoNote!!.file_id != null) return false + if (if (length != null) length != videoNote.length else videoNote.length != null) return false + if (if (duration != null) duration != videoNote.duration else videoNote.duration != null) return false + if (if (thumb != null) thumb != videoNote.thumb else videoNote.thumb != null) return false + return if (file_size != null) file_size == videoNote.file_size else videoNote.file_size == null + } + + override fun hashCode(): Int { + return file_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "VideoNote{" + + "file_id='" + file_id + '\''.toString() + + ", length=" + length + + ", duration=" + duration + + ", thumb=" + thumb + + ", file_size=" + file_size + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Voice.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Voice.kt new file mode 100644 index 00000000..73beca8f --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/Voice.kt @@ -0,0 +1,60 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable + +/** + * stas + * 10/21/15. + */ +class Voice : Serializable { + + private val file_id: String? = null + private val duration: Int? = null + private val mime_type: String? = null + private val file_size: Int? = null + + fun fileId(): String? { + return file_id + } + + fun duration(): Int? { + return duration + } + + fun mimeType(): String? { + return mime_type + } + + fun fileSize(): Int? { + return file_size + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val voice = o as Voice? + + if (if (file_id != null) file_id != voice!!.file_id else voice!!.file_id != null) return false + if (if (duration != null) duration != voice.duration else voice.duration != null) return false + if (if (mime_type != null) mime_type != voice.mime_type else voice.mime_type != null) return false + return if (file_size != null) file_size == voice.file_size else voice.file_size == null + } + + override fun hashCode(): Int { + return file_id?.hashCode() ?: 0 + } + + override fun toString(): String { + return "Voice{" + + "file_id='" + file_id + '\''.toString() + + ", duration=" + duration + + ", mime_type='" + mime_type + '\''.toString() + + ", file_size=" + file_size + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} \ No newline at end of file diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/WebhookInfo.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/WebhookInfo.kt new file mode 100644 index 00000000..dbe2c3e4 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/WebhookInfo.kt @@ -0,0 +1,93 @@ +package com.pengrad.telegrambot.model + +import java.io.Serializable +import java.util.Arrays + +/** + * Stas Parshin + * 03 October 2016 + */ +class WebhookInfo : Serializable { + + private val url: String? = null + private val has_custom_certificate: Boolean? = null + private val pending_update_count: Int? = null + private val last_error_date: Int? = null + private val last_error_message: String? = null + private val max_connections: Int? = null + private val allowed_updates: Array? = null + + fun url(): String? { + return url + } + + fun hasCustomCertificate(): Boolean? { + return has_custom_certificate + } + + fun pendingUpdateCount(): Int? { + return pending_update_count + } + + fun lastErrorDate(): Int? { + return last_error_date + } + + fun lastErrorMessage(): String? { + return last_error_message + } + + fun maxConnections(): Int? { + return max_connections + } + + fun allowedUpdates(): Array? { + return allowed_updates + } + + override fun equals(o: Any?): Boolean { + if (this === o) return true + if (o == null || javaClass != o.javaClass) return false + + val that = o as WebhookInfo? + + if (if (url != null) url != that!!.url else that!!.url != null) return false + if (if (has_custom_certificate != null) has_custom_certificate != that.has_custom_certificate else that.has_custom_certificate != null) + return false + if (if (pending_update_count != null) pending_update_count != that.pending_update_count else that.pending_update_count != null) + return false + if (if (last_error_date != null) last_error_date != that.last_error_date else that.last_error_date != null) + return false + if (if (last_error_message != null) last_error_message != that.last_error_message else that.last_error_message != null) + return false + return if (if (max_connections != null) max_connections != that.max_connections else that.max_connections != null) false else Arrays.equals(allowed_updates, that.allowed_updates) + // Probably incorrect - comparing Object[] arrays with Arrays.equals + } + + override fun hashCode(): Int { + var result = url?.hashCode() ?: 0 + result = 31 * result + (has_custom_certificate?.hashCode() ?: 0) + result = 31 * result + (pending_update_count?.hashCode() ?: 0) + result = 31 * result + (last_error_date?.hashCode() ?: 0) + result = 31 * result + (last_error_message?.hashCode() ?: 0) + result = 31 * result + (max_connections?.hashCode() ?: 0) + result = 31 * result + Arrays.hashCode(allowed_updates) + return result + } + + override fun toString(): String { + return "WebhookInfo{" + + "url='" + url + '\''.toString() + + ", has_custom_certificate=" + has_custom_certificate + + ", pending_update_count=" + pending_update_count + + ", last_error_date=" + last_error_date + + ", last_error_message='" + last_error_message + '\''.toString() + + ", max_connections=" + max_connections + + ", allowed_updates=" + Arrays.toString(allowed_updates) + + '}'.toString() + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/ChatAction.java b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ChatAction.kt similarity index 72% rename from library/src/main/java/com/pengrad/telegrambot/model/request/ChatAction.java rename to core/src/main/kotlin/com/pengrad/telegrambot/model/request/ChatAction.kt index af6cc89a..f9f0a89c 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/ChatAction.java +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ChatAction.kt @@ -1,10 +1,10 @@ -package com.pengrad.telegrambot.model.request; +package com.pengrad.telegrambot.model.request /** * stas * 10/21/15. */ -public enum ChatAction { +enum class ChatAction { typing, upload_photo, record_video, upload_video, record_audio, upload_audio, upload_document, find_location, record_video_note, upload_video_note } diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ForceReply.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ForceReply.kt new file mode 100644 index 00000000..e767b45c --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ForceReply.kt @@ -0,0 +1,16 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * stas + * 8/4/15. + */ +class ForceReply @JvmOverloads constructor(private val selective: Boolean = false) : Keyboard(), Serializable { + + private val force_reply = true + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardButton.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardButton.kt new file mode 100644 index 00000000..6676b159 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardButton.kt @@ -0,0 +1,53 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineKeyboardButton +//todo can use only one optional field, make different constructors or static methods + +(private val text: String) : Serializable { + private var url: String? = null + private var callback_data: String? = null + private var switch_inline_query: String? = null + private var switch_inline_query_current_chat: String? = null + private var callback_game: String? = null + private var pay: Boolean? = null + + fun url(url: String): InlineKeyboardButton { + this.url = url + return this + } + + fun callbackData(callbackData: String): InlineKeyboardButton { + callback_data = callbackData + return this + } + + fun switchInlineQuery(switchInlineQuery: String): InlineKeyboardButton { + switch_inline_query = switchInlineQuery + return this + } + + fun switchInlineQueryCurrentChat(switchInlineQueryCurrentChat: String): InlineKeyboardButton { + switch_inline_query_current_chat = switchInlineQueryCurrentChat + return this + } + + fun callbackGame(callbackGame: String): InlineKeyboardButton { + callback_game = callbackGame + return this + } + + fun pay(): InlineKeyboardButton { + this.pay = true + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.kt new file mode 100644 index 00000000..afc55a68 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.kt @@ -0,0 +1,16 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * stas + * 8/4/15. + */ +class InlineKeyboardMarkup(vararg keyboard: Array) : Keyboard(), Serializable { + + private val inline_keyboard: Array> = keyboard + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResult.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResult.kt new file mode 100644 index 00000000..17d9dcb6 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResult.kt @@ -0,0 +1,31 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * stas + * 1/12/16. + */ +abstract class InlineQueryResult( + private val type: String, + private val id: String +) : Serializable { + + private val thisAsT = this as T + private var input_message_content: InputMessageContent? = null + private var reply_markup: InlineKeyboardMarkup? = null + + fun inputMessageContent(inputMessageContent: InputMessageContent): T { + this.input_message_content = inputMessageContent + return thisAsT + } + + fun replyMarkup(replyMarkup: InlineKeyboardMarkup): T { + this.reply_markup = replyMarkup + return thisAsT + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.kt new file mode 100644 index 00000000..842ac611 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.kt @@ -0,0 +1,57 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * stas + * 1/12/16. + */ +class InlineQueryResultArticle(id: String, private val title: String, inputMessageContent: InputMessageContent) : InlineQueryResult("article", id), Serializable { + + private var url: String? = null + private var hide_url: Boolean? = null + private var description: String? = null + private var thumb_url: String? = null + private var thumb_width: Int? = null + private var thumb_height: Int? = null + + constructor(id: String, title: String, messageText: String) : this(id, title, InputTextMessageContent(messageText)) {} + + init { + inputMessageContent(inputMessageContent) + } + + fun url(url: String): InlineQueryResultArticle { + this.url = url + return this + } + + fun hideUrl(hideUrl: Boolean?): InlineQueryResultArticle { + this.hide_url = hideUrl + return this + } + + fun description(description: String): InlineQueryResultArticle { + this.description = description + return this + } + + fun thumbUrl(thumbUrl: String): InlineQueryResultArticle { + this.thumb_url = thumbUrl + return this + } + + fun thumbWidth(thumbWidth: Int?): InlineQueryResultArticle { + this.thumb_width = thumbWidth + return this + } + + fun thumbHeight(thumbHeight: Int?): InlineQueryResultArticle { + this.thumb_height = thumbHeight + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.kt new file mode 100644 index 00000000..544e6cc6 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.kt @@ -0,0 +1,39 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultAudio(id: String, private val audio_url: String, private val title: String) : InlineQueryResult("audio", id), Serializable { + + private var caption: String? = null + private var parse_mode: String? = null + private var performer: String? = null + private var audio_duration: Int? = null + + fun caption(caption: String): InlineQueryResultAudio { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultAudio { + this.parse_mode = parseMode.name + return this + } + + fun performer(performer: String): InlineQueryResultAudio { + this.performer = performer + return this + } + + fun audioDuration(audioDuration: Int?): InlineQueryResultAudio { + this.audio_duration = audioDuration + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.kt new file mode 100644 index 00000000..beb89558 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.kt @@ -0,0 +1,27 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultCachedAudio(id: String, private val audio_file_id: String) : InlineQueryResult("audio", id), Serializable { + + private var caption: String? = null + private var parse_mode: String? = null + + fun caption(caption: String): InlineQueryResultCachedAudio { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultCachedAudio { + this.parse_mode = parseMode.name + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.kt new file mode 100644 index 00000000..7591d369 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.kt @@ -0,0 +1,33 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultCachedDocument(id: String, private val document_file_id: String, private val title: String) : InlineQueryResult("document", id), Serializable { + + private var description: String? = null + private var caption: String? = null + private var parse_mode: String? = null + + fun description(description: String): InlineQueryResultCachedDocument { + this.description = description + return this + } + + fun caption(caption: String): InlineQueryResultCachedDocument { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultCachedDocument { + this.parse_mode = parseMode.name + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.kt new file mode 100644 index 00000000..d9a1dc2a --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.kt @@ -0,0 +1,33 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultCachedGif(id: String, private val gif_file_id: String) : InlineQueryResult("gif", id), Serializable { + + private var title: String? = null + private var caption: String? = null + private var parse_mode: String? = null + + fun title(title: String): InlineQueryResultCachedGif { + this.title = title + return this + } + + fun caption(caption: String): InlineQueryResultCachedGif { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultCachedGif { + this.parse_mode = parseMode.name + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.kt new file mode 100644 index 00000000..e036ff41 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.kt @@ -0,0 +1,33 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultCachedMpeg4Gif(id: String, private val mpeg4_file_id: String) : InlineQueryResult("mpeg4_gif", id), Serializable { + + private var title: String? = null + private var caption: String? = null + private var parse_mode: String? = null + + fun title(title: String): InlineQueryResultCachedMpeg4Gif { + this.title = title + return this + } + + fun caption(caption: String): InlineQueryResultCachedMpeg4Gif { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultCachedMpeg4Gif { + this.parse_mode = parseMode.name + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.kt new file mode 100644 index 00000000..6564a443 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.kt @@ -0,0 +1,39 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultCachedPhoto(id: String, private val photo_file_id: String) : InlineQueryResult("photo", id), Serializable { + + private var title: String? = null + private var description: String? = null + private var caption: String? = null + private var parse_mode: String? = null + + fun title(title: String): InlineQueryResultCachedPhoto { + this.title = title + return this + } + + fun description(description: String): InlineQueryResultCachedPhoto { + this.description = description + return this + } + + fun caption(caption: String): InlineQueryResultCachedPhoto { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultCachedPhoto { + this.parse_mode = parseMode.name + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.kt new file mode 100644 index 00000000..981d91e8 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.kt @@ -0,0 +1,13 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultCachedSticker(id: String, private val sticker_file_id: String) : InlineQueryResult("sticker", id), Serializable { + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.kt new file mode 100644 index 00000000..7c8168c5 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.kt @@ -0,0 +1,33 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultCachedVideo(id: String, private val video_file_id: String, private val title: String) : InlineQueryResult("video", id), Serializable { + + private var description: String? = null + private var caption: String? = null + private var parse_mode: String? = null + + fun description(description: String): InlineQueryResultCachedVideo { + this.description = description + return this + } + + fun caption(caption: String): InlineQueryResultCachedVideo { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultCachedVideo { + this.parse_mode = parseMode.name + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.kt new file mode 100644 index 00000000..53b708fc --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.kt @@ -0,0 +1,27 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultCachedVoice(id: String, private val voice_file_id: String, private val title: String) : InlineQueryResult("voice", id), Serializable { + + private var caption: String? = null + private var parse_mode: String? = null + + fun caption(caption: String): InlineQueryResultCachedVoice { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultCachedVoice { + this.parse_mode = parseMode.name + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultContact.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultContact.kt new file mode 100644 index 00000000..fa41adfa --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultContact.kt @@ -0,0 +1,45 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultContact(id: String, private val phone_number: String, private val first_name: String) : InlineQueryResult("contact", id), Serializable { + + private var last_name: String? = null + private var vcard: String? = null + private var thumb_url: String? = null + private var thumb_width: Int? = null + private var thumb_height: Int? = null + + fun lastName(lastName: String): InlineQueryResultContact { + this.last_name = lastName + return this + } + + fun vcard(vcard: String): InlineQueryResultContact { + this.vcard = vcard + return this + } + + fun thumbUrl(thumbUrl: String): InlineQueryResultContact { + this.thumb_url = thumbUrl + return this + } + + fun thumbWidth(thumbWidth: Int?): InlineQueryResultContact { + this.thumb_width = thumbWidth + return this + } + + fun thumbHeight(thumbHeight: Int?): InlineQueryResultContact { + this.thumb_height = thumbHeight + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.kt new file mode 100644 index 00000000..83d064a3 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.kt @@ -0,0 +1,54 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultDocument(id: String, private val document_url: String, private val title: String, private val mime_type: String) : InlineQueryResult("document", id), Serializable { + + private var caption: String? = null + private var parse_mode: String? = null + private var description: String? = null + private var thumb_url: String? = null + private var thumb_width: Int? = null + private var thumb_height: Int? = null + + fun caption(caption: String): InlineQueryResultDocument { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultDocument { + this.parse_mode = parseMode.name + return this + } + + fun description(description: String): InlineQueryResultDocument { + this.description = description + return this + } + + fun thumbUrl(thumbUrl: String): InlineQueryResultDocument { + this.thumb_url = thumbUrl + return this + } + + fun thumbWidth(thumbWidth: Int?): InlineQueryResultDocument { + this.thumb_width = thumbWidth + return this + } + + fun thumbHeight(thumbHeight: Int?): InlineQueryResultDocument { + this.thumb_height = thumbHeight + return this + } + + companion object { + private const val serialVersionUID = 0L + + val MIME_APP_PDFL = "application/pdf" + val MIME_APP_ZIP = "application/zip" + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGame.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGame.kt new file mode 100644 index 00000000..97dd2800 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGame.kt @@ -0,0 +1,13 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 03 October 2016 + */ +class InlineQueryResultGame(id: String, private val game_short_name: String) : InlineQueryResult("game", id), Serializable { + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGif.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGif.kt new file mode 100644 index 00000000..2392b184 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGif.kt @@ -0,0 +1,51 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * stas + * 1/12/16. + */ +class InlineQueryResultGif(id: String, private val gif_url: String, private val thumb_url: String) : InlineQueryResult("gif", id), Serializable { + + private var gif_width: Int? = null + private var gif_height: Int? = null + private var gif_duration: Int? = null + private var title: String? = null + private var caption: String? = null + private var parse_mode: String? = null + + fun gifWidth(gifWidth: Int?): InlineQueryResultGif { + this.gif_width = gifWidth + return this + } + + fun gifHeight(gifHeight: Int?): InlineQueryResultGif { + this.gif_height = gifHeight + return this + } + + fun gifDuration(gifDuration: Int?): InlineQueryResultGif { + this.gif_duration = gifDuration + return this + } + + fun title(title: String): InlineQueryResultGif { + this.title = title + return this + } + + fun caption(caption: String): InlineQueryResultGif { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultGif { + this.parse_mode = parseMode.name + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.kt new file mode 100644 index 00000000..c0775898 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.kt @@ -0,0 +1,39 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultLocation(id: String, private val latitude: Float, private val longitude: Float, private val title: String) : InlineQueryResult("location", id), Serializable { + + private var live_period: Int? = null + private var thumb_url: String? = null + private var thumb_width: Int? = null + private var thumb_height: Int? = null + + fun livePeriod(livePeriod: Int?): InlineQueryResultLocation { + live_period = livePeriod + return this + } + + fun thumbUrl(thumbUrl: String): InlineQueryResultLocation { + this.thumb_url = thumbUrl + return this + } + + fun thumbWidth(thumbWidth: Int?): InlineQueryResultLocation { + this.thumb_width = thumbWidth + return this + } + + fun thumbHeight(thumbHeight: Int?): InlineQueryResultLocation { + this.thumb_height = thumbHeight + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.kt new file mode 100644 index 00000000..1099e87c --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.kt @@ -0,0 +1,51 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * stas + * 1/12/16. + */ +class InlineQueryResultMpeg4Gif(id: String, private val mpeg4_url: String, private val thumb_url: String) : InlineQueryResult("mpeg4_gif", id), Serializable { + + private var mpeg4_width: Int? = null + private var mpeg4_height: Int? = null + private var mpeg4_duration: Int? = null + private var title: String? = null + private var caption: String? = null + private var parse_mode: String? = null + + fun mpeg4Width(mpeg4Width: Int?): InlineQueryResultMpeg4Gif { + this.mpeg4_width = mpeg4Width + return this + } + + fun mpeg4Height(mpeg4Height: Int?): InlineQueryResultMpeg4Gif { + this.mpeg4_height = mpeg4Height + return this + } + + fun mpeg4Duration(mpeg4Duration: Int?): InlineQueryResultMpeg4Gif { + this.mpeg4_duration = mpeg4Duration + return this + } + + fun title(title: String): InlineQueryResultMpeg4Gif { + this.title = title + return this + } + + fun caption(caption: String): InlineQueryResultMpeg4Gif { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultMpeg4Gif { + this.parse_mode = parseMode.name + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.kt new file mode 100644 index 00000000..990ed546 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.kt @@ -0,0 +1,51 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * stas + * 1/12/16. + */ +class InlineQueryResultPhoto(id: String, private val photo_url: String, private val thumb_url: String) : InlineQueryResult("photo", id), Serializable { + + private var photo_width: Int? = null + private var photo_height: Int? = null + private var title: String? = null + private var description: String? = null + private var caption: String? = null + private var parse_mode: String? = null + + fun photoWidth(photoWidth: Int?): InlineQueryResultPhoto { + this.photo_width = photoWidth + return this + } + + fun photoHeight(photoHeight: Int?): InlineQueryResultPhoto { + this.photo_height = photoHeight + return this + } + + fun title(title: String): InlineQueryResultPhoto { + this.title = title + return this + } + + fun description(description: String): InlineQueryResultPhoto { + this.description = description + return this + } + + fun caption(caption: String): InlineQueryResultPhoto { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultPhoto { + this.parse_mode = parseMode.name + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.kt new file mode 100644 index 00000000..8108baa7 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.kt @@ -0,0 +1,45 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultVenue(id: String, private val latitude: Float, private val longitude: Float, private val title: String, private val address: String) : InlineQueryResult("venue", id), Serializable { + + private var foursquare_id: String? = null + private var foursquare_type: String? = null + private var thumb_url: String? = null + private var thumb_width: Int? = null + private var thumb_height: Int? = null + + fun foursquareId(foursquareId: String): InlineQueryResultVenue { + this.foursquare_id = foursquareId + return this + } + + fun foursquareType(foursquareType: String): InlineQueryResultVenue { + this.foursquare_type = foursquareType + return this + } + + fun thumbUrl(thumbUrl: String): InlineQueryResultVenue { + this.thumb_url = thumbUrl + return this + } + + fun thumbWidth(thumbWidth: Int?): InlineQueryResultVenue { + this.thumb_width = thumbWidth + return this + } + + fun thumbHeight(thumbHeight: Int?): InlineQueryResultVenue { + this.thumb_height = thumbHeight + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.kt new file mode 100644 index 00000000..ae7d099b --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.kt @@ -0,0 +1,60 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * stas + * 1/12/16. + */ +class InlineQueryResultVideo(id: String, private val video_url: String, private val mime_type: String, inputMessageContent: InputMessageContent, private val thumb_url: String, private val title: String) : InlineQueryResult("video", id), Serializable { + + private var caption: String? = null + private var parse_mode: String? = null + private var video_width: Int? = null + private var video_height: Int? = null + private var video_duration: Int? = null + private var description: String? = null + + constructor(id: String, videoUrl: String, mimeType: String, messageText: String, thumbUrl: String, title: String) : this(id, videoUrl, mimeType, InputTextMessageContent(messageText), thumbUrl, title) {} + + init { + inputMessageContent(inputMessageContent) + } + + fun caption(caption: String): InlineQueryResultVideo { + this.caption = caption + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultVideo { + this.parse_mode = parseMode.name + return this + } + + fun videoWidth(videoWidth: Int?): InlineQueryResultVideo { + this.video_width = videoWidth + return this + } + + fun videoHeight(videoHeight: Int?): InlineQueryResultVideo { + this.video_height = videoHeight + return this + } + + fun videoDuration(videoDuration: Int?): InlineQueryResultVideo { + this.video_duration = videoDuration + return this + } + + fun description(description: String): InlineQueryResultVideo { + this.description = description + return this + } + + companion object { + private const val serialVersionUID = 0L + + val MIME_TEXT_HTML = "text/html" + val MIME_VIDEO_MP4 = "video/mp4" + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.kt new file mode 100644 index 00000000..30194347 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.kt @@ -0,0 +1,33 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InlineQueryResultVoice(id: String, private val voice_url: String, private val title: String) : InlineQueryResult("voice", id), Serializable { + + private var caption: String? = null + private var parse_mode: String? = null + private var voice_duration: Int? = null + + fun caption(caption: String): InlineQueryResultVoice { + this.caption = caption + return this + } + + fun voiceDuration(voiceDuration: Int?): InlineQueryResultVoice { + this.voice_duration = voiceDuration + return this + } + + fun parseMode(parseMode: ParseMode): InlineQueryResultVoice { + this.parse_mode = parseMode.name + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputContactMessageContent.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputContactMessageContent.kt new file mode 100644 index 00000000..2c060b23 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputContactMessageContent.kt @@ -0,0 +1,26 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InputContactMessageContent(private val phone_number: String, private val first_name: String) : InputMessageContent(), Serializable { + private var last_name: String? = null + private var vcard: String? = null + + fun lastName(lastName: String): InputContactMessageContent { + this.last_name = lastName + return this + } + + fun vcard(vcard: String): InputContactMessageContent { + this.vcard = vcard + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputLocationMessageContent.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputLocationMessageContent.kt new file mode 100644 index 00000000..db83fa26 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputLocationMessageContent.kt @@ -0,0 +1,20 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InputLocationMessageContent(private val latitude: Float?, private val longitude: Float?) : InputMessageContent(), Serializable { + private var live_period: Int? = null + + fun livePeriod(livePeriod: Int?): InputLocationMessageContent { + live_period = livePeriod + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMedia.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMedia.kt new file mode 100644 index 00000000..7212abbf --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMedia.kt @@ -0,0 +1,76 @@ +package com.pengrad.telegrambot.model.request + +import com.pengrad.telegrambot.AttachName +import java.io.File +import java.io.Serializable +import java.util.* + +/** + * Stas Parshin + * 23 November 2017 + */ +abstract class InputMedia internal constructor(private val type: String, media: Any) : Serializable { + + private val thisAsT = this as T + private val media: String + private var thumb: String? = null + private var caption: String? = null + private var parse_mode: String? = null + + @Transient + private val attachments = HashMap() + @Transient + private var filename: String? = null + + val fileName: String + get() = filename ?: defaultFileName + + protected abstract val defaultFileName: String + + abstract val contentType: String + + init { + if (media is String) { + this.media = media + } else { + val attachName = AttachName.next() + this.media = "attach://$attachName" + attachments[attachName] = media + if (media is File) { + filename = media.name + } + } + } + + fun getAttachments(): Map { + return attachments + } + + fun thumb(thumb: File): T { + val attachName = AttachName.next() + attachments[attachName] = thumb + this.thumb = "attach://$attachName" + return thisAsT + } + + fun thumb(thumb: ByteArray): T { + val attachName = AttachName.next() + attachments[attachName] = thumb + this.thumb = "attach://$attachName" + return thisAsT + } + + fun caption(caption: String): T { + this.caption = caption + return thisAsT + } + + fun parseMode(parseMode: ParseMode): T { + this.parse_mode = parseMode.name + return thisAsT + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAnimation.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAnimation.kt new file mode 100644 index 00000000..1f0473c9 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAnimation.kt @@ -0,0 +1,48 @@ +package com.pengrad.telegrambot.model.request + +import com.pengrad.telegrambot.request.ContentTypes + +import java.io.File +import java.io.Serializable + +/** + * Stas Parshin + * 28 July 2018 + */ +class InputMediaAnimation : InputMedia, Serializable { + + private var width: Int? = null + private var height: Int? = null + private var duration: Int? = null + + override val defaultFileName: String + get() = ContentTypes.GIF_FILE_NAME + + override val contentType: String + get() = ContentTypes.GIF_MIME_TYPE + + constructor(media: String) : super("animation", media) {} + + constructor(media: File) : super("animation", media) {} + + constructor(media: ByteArray) : super("animation", media) {} + + fun width(width: Int?): InputMediaAnimation { + this.width = width + return this + } + + fun height(height: Int?): InputMediaAnimation { + this.height = height + return this + } + + fun duration(duration: Int?): InputMediaAnimation { + this.duration = duration + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAudio.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAudio.kt new file mode 100644 index 00000000..f6ada886 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAudio.kt @@ -0,0 +1,48 @@ +package com.pengrad.telegrambot.model.request + +import com.pengrad.telegrambot.request.ContentTypes + +import java.io.File +import java.io.Serializable + +/** + * Stas Parshin + * 28 July 2018 + */ +class InputMediaAudio : InputMedia, Serializable { + + private var duration: Int? = null + private var performer: String? = null + private var title: String? = null + + override val defaultFileName: String + get() = ContentTypes.AUDIO_FILE_NAME + + override val contentType: String + get() = ContentTypes.AUDIO_MIME_TYPE + + constructor(media: String) : super("audio", media) {} + + constructor(media: File) : super("audio", media) {} + + constructor(media: ByteArray) : super("audio", media) {} + + fun duration(duration: Int?): InputMediaAudio { + this.duration = duration + return this + } + + fun performer(performer: String): InputMediaAudio { + this.performer = performer + return this + } + + fun title(title: String): InputMediaAudio { + this.title = title + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaDocument.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaDocument.kt new file mode 100644 index 00000000..02d32e19 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaDocument.kt @@ -0,0 +1,29 @@ +package com.pengrad.telegrambot.model.request + +import com.pengrad.telegrambot.request.ContentTypes + +import java.io.File +import java.io.Serializable + +/** + * Stas Parshin + * 28 July 2018 + */ +class InputMediaDocument : InputMedia, Serializable { + + override val defaultFileName: String + get() = ContentTypes.DOC_FILE_NAME + + override val contentType: String + get() = ContentTypes.DOC_MIME_TYPE + + constructor(media: String) : super("document", media) {} + + constructor(media: File) : super("document", media) {} + + constructor(media: ByteArray) : super("document", media) {} + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaPhoto.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaPhoto.kt new file mode 100644 index 00000000..aac905c9 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaPhoto.kt @@ -0,0 +1,29 @@ +package com.pengrad.telegrambot.model.request + +import com.pengrad.telegrambot.request.ContentTypes + +import java.io.File +import java.io.Serializable + +/** + * Stas Parshin + * 23 November 2017 + */ +class InputMediaPhoto : InputMedia, Serializable { + + override val defaultFileName: String + get() = ContentTypes.PHOTO_FILE_NAME + + override val contentType: String + get() = ContentTypes.PHOTO_MIME_TYPE + + constructor(media: String) : super("photo", media) {} + + constructor(media: File) : super("photo", media) {} + + constructor(media: ByteArray) : super("photo", media) {} + + companion object { + private const val serialVersionUID = 1L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaVideo.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaVideo.kt new file mode 100644 index 00000000..b44b3f52 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaVideo.kt @@ -0,0 +1,54 @@ +package com.pengrad.telegrambot.model.request + +import com.pengrad.telegrambot.request.ContentTypes + +import java.io.File +import java.io.Serializable + +/** + * Stas Parshin + * 23 November 2017 + */ +class InputMediaVideo : InputMedia, Serializable { + + private var width: Int? = null + private var height: Int? = null + private var duration: Int? = null + private var supports_streaming: Boolean? = null + + override val defaultFileName: String + get() = ContentTypes.VIDEO_FILE_NAME + + override val contentType: String + get() = ContentTypes.VIDEO_MIME_TYPE + + constructor(media: String) : super("video", media) {} + + constructor(media: File) : super("video", media) {} + + constructor(media: ByteArray) : super("video", media) {} + + fun width(width: Int?): InputMediaVideo { + this.width = width + return this + } + + fun height(height: Int?): InputMediaVideo { + this.height = height + return this + } + + fun duration(duration: Int?): InputMediaVideo { + this.duration = duration + return this + } + + fun supportsStreaming(supportsStreaming: Boolean): InputMediaVideo { + this.supports_streaming = supportsStreaming + return this + } + + companion object { + private const val serialVersionUID = 1L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMessageContent.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMessageContent.kt new file mode 100644 index 00000000..636d4bb1 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMessageContent.kt @@ -0,0 +1,13 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +abstract class InputMessageContent : Serializable { + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputTextMessageContent.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputTextMessageContent.kt new file mode 100644 index 00000000..36600003 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputTextMessageContent.kt @@ -0,0 +1,26 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InputTextMessageContent(private val message_text: String) : InputMessageContent(), Serializable { + private var parse_mode: ParseMode? = null + private var disable_web_page_preview: Boolean? = null + + fun parseMode(parseMode: ParseMode): InputTextMessageContent { + this.parse_mode = parseMode + return this + } + + fun disableWebPagePreview(disableWebPagePreview: Boolean?): InputTextMessageContent { + this.disable_web_page_preview = disableWebPagePreview + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputVenueMessageContent.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputVenueMessageContent.kt new file mode 100644 index 00000000..b2ce74c5 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputVenueMessageContent.kt @@ -0,0 +1,26 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class InputVenueMessageContent(private val latitude: Float?, private val longitude: Float?, private val title: String, private val address: String) : InputMessageContent(), Serializable { + private var foursquare_id: String? = null + private var foursquare_type: String? = null + + fun foursquareId(foursquareId: String): InputVenueMessageContent { + this.foursquare_id = foursquareId + return this + } + + fun foursquareType(foursquareType: String): InputVenueMessageContent { + this.foursquare_type = foursquareType + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/Keyboard.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/Keyboard.kt new file mode 100644 index 00000000..cdaf0df2 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/Keyboard.kt @@ -0,0 +1,24 @@ +package com.pengrad.telegrambot.model.request + +import com.google.gson.Gson + +import java.io.Serializable + +/** + * stas + * 8/11/15 + */ +abstract class Keyboard : Serializable { + + override fun toString(): String { + return gson.toJson(this) + } + + companion object { + private const val serialVersionUID = 0L + + // todo remove gson + private val gson = Gson() + } + +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/KeyboardButton.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/KeyboardButton.kt new file mode 100644 index 00000000..638b568c --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/KeyboardButton.kt @@ -0,0 +1,26 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 06 May 2016 + */ +class KeyboardButton(private val text: String) : Serializable { + private var request_contact: Boolean = false + private var request_location: Boolean = false + + fun requestLocation(requestLocation: Boolean): KeyboardButton { + request_location = requestLocation + return this + } + + fun requestContact(requestContact: Boolean): KeyboardButton { + request_contact = requestContact + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/LabeledPrice.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/LabeledPrice.kt new file mode 100644 index 00000000..d7d4a1da --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/LabeledPrice.kt @@ -0,0 +1,13 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 24 May 2017 + */ +class LabeledPrice(private val label: String, private val amount: Int?) : Serializable { + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ParseMode.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ParseMode.kt new file mode 100644 index 00000000..74531efe --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ParseMode.kt @@ -0,0 +1,9 @@ +package com.pengrad.telegrambot.model.request + +/** + * stas + * 10/21/15. + */ +enum class ParseMode { + Markdown, HTML +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.kt new file mode 100644 index 00000000..7173a8fd --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.kt @@ -0,0 +1,17 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * stas + * 8/4/15. + */ +@Deprecated("") +class ReplyKeyboardHide @JvmOverloads constructor(private val selective: Boolean = false) : Keyboard(), Serializable { + + private val hide_keyboard = true + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.kt new file mode 100644 index 00000000..8cca2663 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.kt @@ -0,0 +1,41 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * stas + * 8/4/15. + */ +class ReplyKeyboardMarkup( + private val keyboard: Array>, + private var resize_keyboard: Boolean = false, + private var one_time_keyboard: Boolean = false, + private var selective: Boolean = false +) : Keyboard(), Serializable { + + constructor(vararg keyboard: Array) : this( + keyboard.map { it.map { text -> KeyboardButton(text) }.toTypedArray() }.toTypedArray() + ) + + constructor(vararg keyboard: Array) : this(keyboard) + + fun resizeKeyboard(resizeKeyboard: Boolean): ReplyKeyboardMarkup { + val r = ReplyKeyboardMarkup(arrayOf(KeyboardButton(""), KeyboardButton(""))) + this.resize_keyboard = resizeKeyboard + return this + } + + fun oneTimeKeyboard(oneTimeKeyboard: Boolean): ReplyKeyboardMarkup { + this.one_time_keyboard = oneTimeKeyboard + return this + } + + fun selective(selective: Boolean): ReplyKeyboardMarkup { + this.selective = selective + return this + } + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.kt new file mode 100644 index 00000000..94ee33f0 --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.kt @@ -0,0 +1,17 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 23 November 2016 + */ +class ReplyKeyboardRemove @JvmOverloads constructor(private val selective: Boolean = false) : Keyboard(), Serializable { + + private val remove_keyboard = true + + companion object { + private const val serialVersionUID = 0L + } + +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ShippingOption.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ShippingOption.kt new file mode 100644 index 00000000..cffd8ace --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ShippingOption.kt @@ -0,0 +1,19 @@ +package com.pengrad.telegrambot.model.request + +import java.io.Serializable + +/** + * Stas Parshin + * 24 May 2017 + */ +class ShippingOption( + private val id: String, + private val title: String, + private vararg val prices: LabeledPrice +) : Serializable { + companion object { + @JvmStatic + private val serialVersionUID = 0L + + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/request/ContentTypes.kt b/core/src/main/kotlin/com/pengrad/telegrambot/request/ContentTypes.kt new file mode 100644 index 00000000..4a14e5ed --- /dev/null +++ b/core/src/main/kotlin/com/pengrad/telegrambot/request/ContentTypes.kt @@ -0,0 +1,24 @@ +package com.pengrad.telegrambot.request + +/** + * stas + * 5/1/16. + */ +object ContentTypes { + + @JvmField + val PHOTO_MIME_TYPE = "image/jpeg" + @JvmField val AUDIO_MIME_TYPE = "audio/mpeg" + @JvmField val DOC_MIME_TYPE = "text/plain" + @JvmField val VIDEO_MIME_TYPE = "video/mp4" + @JvmField val VOICE_MIME_TYPE = "audio/ogg" + @JvmField val GIF_MIME_TYPE = "image/gif" + @JvmField val PHOTO_FILE_NAME = "file.jpg" + @JvmField val AUDIO_FILE_NAME = "file.mp3" + @JvmField val DOC_FILE_NAME = "file.txt" + @JvmField val VIDEO_FILE_NAME = "file.mp4" + @JvmField val VOICE_FILE_NAME = "file.ogg" + @JvmField val GIF_FILE_NAME = "file.gif" + @JvmField val GENERAL_MIME_TYPE = "application/x-www-form-urlencoded" + @JvmField val GENERAL_FILE_NAME = DOC_FILE_NAME +} diff --git a/library/build.gradle b/library/build.gradle index ff5900dd..6e4fa597 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -10,6 +10,7 @@ compileTestJava { } dependencies { + compile project(":core") compile 'com.google.code.gson:gson:2.8.5' compile 'com.squareup.okhttp3:okhttp:3.12.1' compile 'com.squareup.okhttp3:logging-interceptor:3.12.1' diff --git a/library/src/main/java/com/pengrad/telegrambot/AttachName.java b/library/src/main/java/com/pengrad/telegrambot/AttachName.java deleted file mode 100644 index e8744e5e..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/AttachName.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.pengrad.telegrambot; - -import java.util.concurrent.atomic.AtomicInteger; - -/** - * Stas Parshin - * 29 July 2018 - */ -public class AttachName { - - private static final AtomicInteger counter = new AtomicInteger(); - - public static String next() { - return "attach" + counter.incrementAndGet(); - } - -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Animation.java b/library/src/main/java/com/pengrad/telegrambot/model/Animation.java deleted file mode 100644 index 49497f2e..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Animation.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 03 October 2016 - */ -public class Animation implements Serializable { - private final static long serialVersionUID = 0L; - - private String file_id; - private Integer width; - private Integer height; - private Integer duration; - private PhotoSize thumb; - private String file_name; - private String mime_type; - private Integer file_size; - - public String fileId() { - return file_id; - } - - public Integer width() { - return width; - } - - public Integer height() { - return height; - } - - public Integer duration() { - return duration; - } - - public PhotoSize thumb() { - return thumb; - } - - public String fileName() { - return file_name; - } - - public String mimeType() { - return mime_type; - } - - public Integer fileSize() { - return file_size; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Animation animation = (Animation) o; - - if (file_id != null ? !file_id.equals(animation.file_id) : animation.file_id != null) return false; - if (width != null ? !width.equals(animation.width) : animation.width != null) return false; - if (height != null ? !height.equals(animation.height) : animation.height != null) return false; - if (duration != null ? !duration.equals(animation.duration) : animation.duration != null) return false; - if (thumb != null ? !thumb.equals(animation.thumb) : animation.thumb != null) return false; - if (file_name != null ? !file_name.equals(animation.file_name) : animation.file_name != null) return false; - if (mime_type != null ? !mime_type.equals(animation.mime_type) : animation.mime_type != null) return false; - return file_size != null ? file_size.equals(animation.file_size) : animation.file_size == null; - } - - @Override - public int hashCode() { - return file_id != null ? file_id.hashCode() : 0; - } - - @Override - public String toString() { - return "Animation{" + - "file_id='" + file_id + '\'' + - ", width=" + width + - ", height=" + height + - ", duration=" + duration + - ", thumb=" + thumb + - ", file_name='" + file_name + '\'' + - ", mime_type='" + mime_type + '\'' + - ", file_size=" + file_size + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Audio.java b/library/src/main/java/com/pengrad/telegrambot/model/Audio.java deleted file mode 100644 index d2f53628..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Audio.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 8/5/15. - */ -public class Audio implements Serializable { - private final static long serialVersionUID = 0L; - - private String file_id; - private Integer duration; - private String performer; - private String title; - private String mime_type; - private Integer file_size; - private PhotoSize thumb; - - public String fileId() { - return file_id; - } - - public Integer duration() { - return duration; - } - - public String performer() { - return performer; - } - - public String title() { - return title; - } - - public String mimeType() { - return mime_type; - } - - public Integer fileSize() { - return file_size; - } - - public PhotoSize thumb() { - return thumb; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Audio audio = (Audio) o; - - if (file_id != null ? !file_id.equals(audio.file_id) : audio.file_id != null) return false; - if (duration != null ? !duration.equals(audio.duration) : audio.duration != null) return false; - if (performer != null ? !performer.equals(audio.performer) : audio.performer != null) return false; - if (title != null ? !title.equals(audio.title) : audio.title != null) return false; - if (mime_type != null ? !mime_type.equals(audio.mime_type) : audio.mime_type != null) return false; - if (file_size != null ? !file_size.equals(audio.file_size) : audio.file_size != null) return false; - return thumb != null ? thumb.equals(audio.thumb) : audio.thumb == null; - } - - @Override - public int hashCode() { - return file_id != null ? file_id.hashCode() : 0; - } - - @Override - public String toString() { - return "Audio{" + - "file_id='" + file_id + '\'' + - ", duration=" + duration + - ", performer='" + performer + '\'' + - ", title='" + title + '\'' + - ", mime_type='" + mime_type + '\'' + - ", file_size=" + file_size + - ", thumb=" + thumb + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/CallbackQuery.java b/library/src/main/java/com/pengrad/telegrambot/model/CallbackQuery.java deleted file mode 100644 index 9c96cd8e..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/CallbackQuery.java +++ /dev/null @@ -1,82 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 07 May 2016 - */ -public class CallbackQuery implements Serializable { - private final static long serialVersionUID = 0L; - - private String id; - private User from; - private Message message; - private String inline_message_id; - private String chat_instance; - private String data; - private String game_short_name; - - public String id() { - return id; - } - - public User from() { - return from; - } - - public Message message() { - return message; - } - - public String inlineMessageId() { - return inline_message_id; - } - - public String chatInstance() { - return chat_instance; - } - - public String data() { - return data; - } - - public String gameShortName() { - return game_short_name; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - CallbackQuery that = (CallbackQuery) o; - - if (id != null ? !id.equals(that.id) : that.id != null) return false; - if (from != null ? !from.equals(that.from) : that.from != null) return false; - if (message != null ? !message.equals(that.message) : that.message != null) return false; - if (inline_message_id != null ? !inline_message_id.equals(that.inline_message_id) : that.inline_message_id != null) - return false; - if (chat_instance != null ? !chat_instance.equals(that.chat_instance) : that.chat_instance != null) return false; - if (data != null ? !data.equals(that.data) : that.data != null) return false; - return game_short_name != null ? game_short_name.equals(that.game_short_name) : that.game_short_name == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - - @Override - public String toString() { - return "CallbackQuery{" + - "id='" + id + '\'' + - ", from=" + from + - ", message=" + message + - ", inline_message_id='" + inline_message_id + '\'' + - ", chat_instance='" + chat_instance + '\'' + - ", data='" + data + '\'' + - ", game_short_name='" + game_short_name + '\'' + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Chat.java b/library/src/main/java/com/pengrad/telegrambot/model/Chat.java deleted file mode 100644 index a298d567..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Chat.java +++ /dev/null @@ -1,139 +0,0 @@ -package com.pengrad.telegrambot.model; - -import com.google.gson.annotations.SerializedName; - -import java.io.Serializable; - -/** - * stas - * 8/5/15. - */ -public class Chat implements Serializable { - private final static long serialVersionUID = 0L; - - public enum Type { - @SerializedName("private")Private, group, supergroup, channel - } - - private Long id; - private Type type; - - //Private - private String first_name; - private String last_name; - - //Private and Channel - private String username; - - //Channel and Group - private String title; - - private Boolean all_members_are_administrators; - - private ChatPhoto photo; - private String description; - private String invite_link; - private Message pinned_message; - private String sticker_set_name; - private Boolean can_set_sticker_set; - - public Long id() { - return id; - } - - public Type type() { - return type; - } - - public String firstName() { - return first_name; - } - - public String lastName() { - return last_name; - } - - public String username() { - return username; - } - - public String title() { - return title; - } - - public Boolean allMembersAreAdministrators() { - return all_members_are_administrators; - } - - public ChatPhoto photo() { - return photo; - } - - public String description() { - return description; - } - - public String inviteLink() { - return invite_link; - } - - public Message pinnedMessage() { - return pinned_message; - } - - public String stickerSetName() { - return sticker_set_name; - } - - public Boolean canSetStickerSet() { - return can_set_sticker_set; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Chat chat = (Chat) o; - - if (id != null ? !id.equals(chat.id) : chat.id != null) return false; - if (type != chat.type) return false; - if (first_name != null ? !first_name.equals(chat.first_name) : chat.first_name != null) return false; - if (last_name != null ? !last_name.equals(chat.last_name) : chat.last_name != null) return false; - if (username != null ? !username.equals(chat.username) : chat.username != null) return false; - if (title != null ? !title.equals(chat.title) : chat.title != null) return false; - if (all_members_are_administrators != null ? !all_members_are_administrators.equals(chat.all_members_are_administrators) : chat.all_members_are_administrators != null) - return false; - if (photo != null ? !photo.equals(chat.photo) : chat.photo != null) return false; - if (description != null ? !description.equals(chat.description) : chat.description != null) return false; - if (invite_link != null ? !invite_link.equals(chat.invite_link) : chat.invite_link != null) return false; - if (pinned_message != null ? !pinned_message.equals(chat.pinned_message) : chat.pinned_message != null) return false; - if (sticker_set_name != null ? !sticker_set_name.equals(chat.sticker_set_name) : chat.sticker_set_name != null) - return false; - return can_set_sticker_set != null ? can_set_sticker_set.equals(chat.can_set_sticker_set) : chat.can_set_sticker_set == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - - @Override - public String toString() { - return "Chat{" + - "id=" + id + - ", type=" + type + - ", first_name='" + first_name + '\'' + - ", last_name='" + last_name + '\'' + - ", username='" + username + '\'' + - ", title='" + title + '\'' + - ", all_members_are_administrators=" + all_members_are_administrators + - ", photo=" + photo + - ", description='" + description + '\'' + - ", invite_link='" + invite_link + '\'' + - ", pinned_message=" + pinned_message + - ", sticker_set_name='" + sticker_set_name + '\'' + - ", can_set_sticker_set=" + can_set_sticker_set + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/ChatMember.java b/library/src/main/java/com/pengrad/telegrambot/model/ChatMember.java deleted file mode 100644 index beb41a7f..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/ChatMember.java +++ /dev/null @@ -1,184 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 29 May 2016 - */ -public class ChatMember implements Serializable { - private final static long serialVersionUID = 0L; - - public enum Status { - creator, administrator, member, restricted, left, kicked; - } - - private User user; - private Status status; - - private Integer until_date; - private Boolean can_be_edited; - private Boolean can_change_info; - private Boolean can_post_messages; - private Boolean can_edit_messages; - private Boolean can_delete_messages; - private Boolean can_invite_users; - private Boolean can_restrict_members; - private Boolean can_pin_messages; - private Boolean can_promote_members; - private Boolean is_member; - private Boolean can_send_messages; - private Boolean can_send_media_messages; - private Boolean can_send_other_messages; - private Boolean can_add_web_page_previews; - - public User user() { - return user; - } - - public Status status() { - return status; - } - - public Integer untilDate() { - return until_date; - } - - public Boolean canBeEdited() { - return can_be_edited; - } - - public Boolean canChangeInfo() { - return can_change_info; - } - - public Boolean canPostMessages() { - return can_post_messages; - } - - public Boolean canEditMessages() { - return can_edit_messages; - } - - public Boolean canDeleteMessages() { - return can_delete_messages; - } - - public Boolean canInviteUsers() { - return can_invite_users; - } - - public Boolean canRestrictMembers() { - return can_restrict_members; - } - - public Boolean canPinMessages() { - return can_pin_messages; - } - - public Boolean canPromoteMembers() { - return can_promote_members; - } - - public Boolean isMember() { - return is_member; - } - - public Boolean canSendMessages() { - return can_send_messages; - } - - public Boolean canSendMediaMessages() { - return can_send_media_messages; - } - - public Boolean canSendOtherMessages() { - return can_send_other_messages; - } - - public Boolean canAddWebPagePreviews() { - return can_add_web_page_previews; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ChatMember that = (ChatMember) o; - - if (user != null ? !user.equals(that.user) : that.user != null) return false; - if (status != that.status) return false; - if (until_date != null ? !until_date.equals(that.until_date) : that.until_date != null) return false; - if (can_be_edited != null ? !can_be_edited.equals(that.can_be_edited) : that.can_be_edited != null) return false; - if (can_change_info != null ? !can_change_info.equals(that.can_change_info) : that.can_change_info != null) - return false; - if (can_post_messages != null ? !can_post_messages.equals(that.can_post_messages) : that.can_post_messages != null) - return false; - if (can_edit_messages != null ? !can_edit_messages.equals(that.can_edit_messages) : that.can_edit_messages != null) - return false; - if (can_delete_messages != null ? !can_delete_messages.equals(that.can_delete_messages) : that.can_delete_messages != null) - return false; - if (can_invite_users != null ? !can_invite_users.equals(that.can_invite_users) : that.can_invite_users != null) - return false; - if (can_restrict_members != null ? !can_restrict_members.equals(that.can_restrict_members) : that.can_restrict_members != null) - return false; - if (can_pin_messages != null ? !can_pin_messages.equals(that.can_pin_messages) : that.can_pin_messages != null) - return false; - if (can_promote_members != null ? !can_promote_members.equals(that.can_promote_members) : that.can_promote_members != null) - return false; - if (is_member != null ? !is_member.equals(that.is_member) : that.is_member != null) return false; - if (can_send_messages != null ? !can_send_messages.equals(that.can_send_messages) : that.can_send_messages != null) - return false; - if (can_send_media_messages != null ? !can_send_media_messages.equals(that.can_send_media_messages) : that.can_send_media_messages != null) - return false; - if (can_send_other_messages != null ? !can_send_other_messages.equals(that.can_send_other_messages) : that.can_send_other_messages != null) - return false; - return can_add_web_page_previews != null ? can_add_web_page_previews.equals(that.can_add_web_page_previews) : that.can_add_web_page_previews == null; - } - - @Override - public int hashCode() { - int result = user != null ? user.hashCode() : 0; - result = 31 * result + (status != null ? status.hashCode() : 0); - result = 31 * result + (until_date != null ? until_date.hashCode() : 0); - result = 31 * result + (can_be_edited != null ? can_be_edited.hashCode() : 0); - result = 31 * result + (can_change_info != null ? can_change_info.hashCode() : 0); - result = 31 * result + (can_post_messages != null ? can_post_messages.hashCode() : 0); - result = 31 * result + (can_edit_messages != null ? can_edit_messages.hashCode() : 0); - result = 31 * result + (can_delete_messages != null ? can_delete_messages.hashCode() : 0); - result = 31 * result + (can_invite_users != null ? can_invite_users.hashCode() : 0); - result = 31 * result + (can_restrict_members != null ? can_restrict_members.hashCode() : 0); - result = 31 * result + (can_pin_messages != null ? can_pin_messages.hashCode() : 0); - result = 31 * result + (can_promote_members != null ? can_promote_members.hashCode() : 0); - result = 31 * result + (is_member != null ? is_member.hashCode() : 0); - result = 31 * result + (can_send_messages != null ? can_send_messages.hashCode() : 0); - result = 31 * result + (can_send_media_messages != null ? can_send_media_messages.hashCode() : 0); - result = 31 * result + (can_send_other_messages != null ? can_send_other_messages.hashCode() : 0); - result = 31 * result + (can_add_web_page_previews != null ? can_add_web_page_previews.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "ChatMember{" + - "user=" + user + - ", status=" + status + - ", until_date=" + until_date + - ", can_be_edited=" + can_be_edited + - ", can_change_info=" + can_change_info + - ", can_post_messages=" + can_post_messages + - ", can_edit_messages=" + can_edit_messages + - ", can_delete_messages=" + can_delete_messages + - ", can_invite_users=" + can_invite_users + - ", can_restrict_members=" + can_restrict_members + - ", can_pin_messages=" + can_pin_messages + - ", can_promote_members=" + can_promote_members + - ", is_member=" + is_member + - ", can_send_messages=" + can_send_messages + - ", can_send_media_messages=" + can_send_media_messages + - ", can_send_other_messages=" + can_send_other_messages + - ", can_add_web_page_previews=" + can_add_web_page_previews + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/ChatPhoto.java b/library/src/main/java/com/pengrad/telegrambot/model/ChatPhoto.java deleted file mode 100644 index b8a4d16e..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/ChatPhoto.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 01 July 2017 - */ -public class ChatPhoto implements Serializable { - private final static long serialVersionUID = 0L; - - private String small_file_id; - private String big_file_id; - - public String smallFileId() { - return small_file_id; - } - - public String bigFileId() { - return big_file_id; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ChatPhoto chatPhoto = (ChatPhoto) o; - - if (small_file_id != null ? !small_file_id.equals(chatPhoto.small_file_id) : chatPhoto.small_file_id != null) - return false; - return big_file_id != null ? big_file_id.equals(chatPhoto.big_file_id) : chatPhoto.big_file_id == null; - } - - @Override - public int hashCode() { - int result = small_file_id != null ? small_file_id.hashCode() : 0; - result = 31 * result + (big_file_id != null ? big_file_id.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "ChatPhoto{" + - "small_file_id='" + small_file_id + '\'' + - ", big_file_id='" + big_file_id + '\'' + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/ChosenInlineResult.java b/library/src/main/java/com/pengrad/telegrambot/model/ChosenInlineResult.java deleted file mode 100644 index bae08ce1..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/ChosenInlineResult.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 1/20/16. - */ -public class ChosenInlineResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String result_id; - private User from; - private Location location; - private String inline_message_id; - private String query; - - public String resultId() { - return result_id; - } - - public User from() { - return from; - } - - public Location location() { - return location; - } - - public String inlineMessageId() { - return inline_message_id; - } - - public String query() { - return query; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ChosenInlineResult that = (ChosenInlineResult) o; - - if (result_id != null ? !result_id.equals(that.result_id) : that.result_id != null) return false; - if (from != null ? !from.equals(that.from) : that.from != null) return false; - if (location != null ? !location.equals(that.location) : that.location != null) return false; - if (inline_message_id != null ? !inline_message_id.equals(that.inline_message_id) : that.inline_message_id != null) - return false; - return query != null ? query.equals(that.query) : that.query == null; - - } - - @Override - public int hashCode() { - return result_id != null ? result_id.hashCode() : 0; - } - - @Override - public String toString() { - return "ChosenInlineResult{" + - "result_id='" + result_id + '\'' + - ", from=" + from + - ", location=" + location + - ", inline_message_id='" + inline_message_id + '\'' + - ", query='" + query + '\'' + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Contact.java b/library/src/main/java/com/pengrad/telegrambot/model/Contact.java deleted file mode 100644 index 65d74153..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Contact.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 8/5/15. - */ -public class Contact implements Serializable { - private final static long serialVersionUID = 0L; - - private String phone_number; - private String first_name; - private String last_name; - private Integer user_id; - private String vcard; - - public String phoneNumber() { - return phone_number; - } - - public String firstName() { - return first_name; - } - - public String lastName() { - return last_name; - } - - public Integer userId() { - return user_id; - } - - public String vcard() { - return vcard; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Contact contact = (Contact) o; - - if (phone_number != null ? !phone_number.equals(contact.phone_number) : contact.phone_number != null) return false; - if (first_name != null ? !first_name.equals(contact.first_name) : contact.first_name != null) return false; - if (last_name != null ? !last_name.equals(contact.last_name) : contact.last_name != null) return false; - if (user_id != null ? !user_id.equals(contact.user_id) : contact.user_id != null) return false; - return vcard != null ? vcard.equals(contact.vcard) : contact.vcard == null; - } - - @Override - public int hashCode() { - return phone_number != null ? phone_number.hashCode() : 0; - } - - @Override - public String toString() { - return "Contact{" + - "phone_number='" + phone_number + '\'' + - ", first_name='" + first_name + '\'' + - ", last_name='" + last_name + '\'' + - ", user_id=" + user_id + - ", vcard='" + vcard + '\'' + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Document.java b/library/src/main/java/com/pengrad/telegrambot/model/Document.java deleted file mode 100644 index f0a4af43..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Document.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 8/5/15. - */ -public class Document implements Serializable { - private final static long serialVersionUID = 0L; - - private String file_id; - private PhotoSize thumb; - private String file_name; - private String mime_type; - private Integer file_size; - - public String fileId() { - return file_id; - } - - public PhotoSize thumb() { - return thumb; - } - - public String fileName() { - return file_name; - } - - public String mimeType() { - return mime_type; - } - - public Integer fileSize() { - return file_size; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Document document = (Document) o; - - if (file_id != null ? !file_id.equals(document.file_id) : document.file_id != null) return false; - if (thumb != null ? !thumb.equals(document.thumb) : document.thumb != null) return false; - if (file_name != null ? !file_name.equals(document.file_name) : document.file_name != null) return false; - if (mime_type != null ? !mime_type.equals(document.mime_type) : document.mime_type != null) return false; - return file_size != null ? file_size.equals(document.file_size) : document.file_size == null; - } - - @Override - public int hashCode() { - return file_id != null ? file_id.hashCode() : 0; - } - - @Override - public String toString() { - return "Document{" + - "file_id='" + file_id + '\'' + - ", thumb=" + thumb + - ", file_name='" + file_name + '\'' + - ", mime_type='" + mime_type + '\'' + - ", file_size=" + file_size + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/File.java b/library/src/main/java/com/pengrad/telegrambot/model/File.java deleted file mode 100644 index 0ad61107..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/File.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 16 October 2015 - */ -public class File implements Serializable { - private final static long serialVersionUID = 0L; - - private String file_id; - private Integer file_size; - private String file_path; - - public String fileId() { - return file_id; - } - - public Integer fileSize() { - return file_size; - } - - public String filePath() { - return file_path; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - File file = (File) o; - - if (file_id != null ? !file_id.equals(file.file_id) : file.file_id != null) return false; - if (file_size != null ? !file_size.equals(file.file_size) : file.file_size != null) return false; - return file_path != null ? file_path.equals(file.file_path) : file.file_path == null; - } - - @Override - public int hashCode() { - return file_id != null ? file_id.hashCode() : 0; - } - - @Override - public String toString() { - return "File{" + - "file_id='" + file_id + '\'' + - ", file_size=" + file_size + - ", file_path='" + file_path + '\'' + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Game.java b/library/src/main/java/com/pengrad/telegrambot/model/Game.java deleted file mode 100644 index ae0db193..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Game.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; -import java.util.Arrays; - -/** - * Stas Parshin - * 03 October 2016 - */ -public class Game implements Serializable { - private final static long serialVersionUID = 0L; - - private String title; - private String description; - private PhotoSize[] photo; - - private String text; - private MessageEntity[] text_entities; - private Animation animation; - - public String title() { - return title; - } - - public String description() { - return description; - } - - public PhotoSize[] photo() { - return photo; - } - - public String text() { - return text; - } - - public MessageEntity[] textEntities() { - return text_entities; - } - - public Animation animation() { - return animation; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Game game = (Game) o; - - if (title != null ? !title.equals(game.title) : game.title != null) return false; - if (description != null ? !description.equals(game.description) : game.description != null) return false; - // Probably incorrect - comparing Object[] arrays with Arrays.equals - if (!Arrays.equals(photo, game.photo)) return false; - if (text != null ? !text.equals(game.text) : game.text != null) return false; - // Probably incorrect - comparing Object[] arrays with Arrays.equals - if (!Arrays.equals(text_entities, game.text_entities)) return false; - return animation != null ? animation.equals(game.animation) : game.animation == null; - } - - @Override - public int hashCode() { - int result = title != null ? title.hashCode() : 0; - result = 31 * result + (description != null ? description.hashCode() : 0); - result = 31 * result + Arrays.hashCode(photo); - result = 31 * result + (text != null ? text.hashCode() : 0); - result = 31 * result + Arrays.hashCode(text_entities); - result = 31 * result + (animation != null ? animation.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "Game{" + - "title='" + title + '\'' + - ", description='" + description + '\'' + - ", photo=" + Arrays.toString(photo) + - ", text='" + text + '\'' + - ", text_entities=" + Arrays.toString(text_entities) + - ", animation=" + animation + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/GameHighScore.java b/library/src/main/java/com/pengrad/telegrambot/model/GameHighScore.java deleted file mode 100644 index def3d7bf..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/GameHighScore.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 04 October 2016 - */ -public class GameHighScore implements Serializable { - private final static long serialVersionUID = 0L; - - private Integer position; - private User user; - private Integer score; - - public Integer position() { - return position; - } - - public User user() { - return user; - } - - public Integer score() { - return score; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - GameHighScore that = (GameHighScore) o; - - if (position != null ? !position.equals(that.position) : that.position != null) return false; - if (user != null ? !user.equals(that.user) : that.user != null) return false; - return score != null ? score.equals(that.score) : that.score == null; - } - - @Override - public int hashCode() { - int result = position != null ? position.hashCode() : 0; - result = 31 * result + (user != null ? user.hashCode() : 0); - result = 31 * result + (score != null ? score.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "GameHighScore{" + - "position=" + position + - ", user=" + user + - ", score=" + score + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/InlineQuery.java b/library/src/main/java/com/pengrad/telegrambot/model/InlineQuery.java deleted file mode 100644 index 75230cb5..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/InlineQuery.java +++ /dev/null @@ -1,68 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 1/12/16. - */ -public class InlineQuery implements Serializable { - private final static long serialVersionUID = 0L; - - private String id; - private User from; - private Location location; - private String query; - private String offset; - - public String id() { - return id; - } - - public User from() { - return from; - } - - public Location location() { - return location; - } - - public String query() { - return query; - } - - public String offset() { - return offset; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - InlineQuery that = (InlineQuery) o; - - if (id != null ? !id.equals(that.id) : that.id != null) return false; - if (from != null ? !from.equals(that.from) : that.from != null) return false; - if (location != null ? !location.equals(that.location) : that.location != null) return false; - if (query != null ? !query.equals(that.query) : that.query != null) return false; - return offset != null ? offset.equals(that.offset) : that.offset == null; - - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - - @Override - public String toString() { - return "InlineQuery{" + - "id='" + id + '\'' + - ", from=" + from + - ", location=" + location + - ", query='" + query + '\'' + - ", offset='" + offset + '\'' + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Invoice.java b/library/src/main/java/com/pengrad/telegrambot/model/Invoice.java deleted file mode 100644 index 340095a5..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Invoice.java +++ /dev/null @@ -1,70 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 24 May 2017 - */ -public class Invoice implements Serializable { - private final static long serialVersionUID = 0L; - - private String title, description, start_parameter, currency; - private Integer total_amount; - - public String title() { - return title; - } - - public String description() { - return description; - } - - public String startParameter() { - return start_parameter; - } - - public String currency() { - return currency; - } - - public Integer totalAmount() { - return total_amount; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Invoice invoice = (Invoice) o; - - if (title != null ? !title.equals(invoice.title) : invoice.title != null) return false; - if (description != null ? !description.equals(invoice.description) : invoice.description != null) return false; - if (start_parameter != null ? !start_parameter.equals(invoice.start_parameter) : invoice.start_parameter != null) - return false; - if (currency != null ? !currency.equals(invoice.currency) : invoice.currency != null) return false; - return total_amount != null ? total_amount.equals(invoice.total_amount) : invoice.total_amount == null; - } - - @Override - public int hashCode() { - int result = title != null ? title.hashCode() : 0; - result = 31 * result + (description != null ? description.hashCode() : 0); - result = 31 * result + (start_parameter != null ? start_parameter.hashCode() : 0); - result = 31 * result + (currency != null ? currency.hashCode() : 0); - result = 31 * result + (total_amount != null ? total_amount.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "Invoice{" + - "title='" + title + '\'' + - ", description='" + description + '\'' + - ", start_parameter='" + start_parameter + '\'' + - ", currency='" + currency + '\'' + - ", total_amount=" + total_amount + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Location.java b/library/src/main/java/com/pengrad/telegrambot/model/Location.java deleted file mode 100644 index bd997bbd..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Location.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 8/5/15. - */ -public class Location implements Serializable { - private final static long serialVersionUID = 0L; - - private Float longitude; - private Float latitude; - - public Float longitude() { - return longitude; - } - - public Float latitude() { - return latitude; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Location location = (Location) o; - - if (longitude != null ? !longitude.equals(location.longitude) : location.longitude != null) return false; - return latitude != null ? latitude.equals(location.latitude) : location.latitude == null; - } - - @Override - public int hashCode() { - int result = longitude != null ? longitude.hashCode() : 0; - result = 31 * result + (latitude != null ? latitude.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "Location{" + - "longitude=" + longitude + - ", latitude=" + latitude + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/MaskPosition.java b/library/src/main/java/com/pengrad/telegrambot/model/MaskPosition.java deleted file mode 100644 index ca47e411..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/MaskPosition.java +++ /dev/null @@ -1,84 +0,0 @@ -package com.pengrad.telegrambot.model; - -import com.google.gson.Gson; - -import java.io.Serializable; - -/** - * Stas Parshin - * 23 July 2017 - */ -public class MaskPosition implements Serializable { - private final static long serialVersionUID = 0L; - private final static Gson gson = new Gson(); - - public enum Point { - forehead, eyes, mouth, chin - } - - private String point; - private Float x_shift, y_shift; - private Float scale; - - public MaskPosition() { - } - - public MaskPosition(Point point, Float x_shift, Float y_shift, Float scale) { - this(point.name(), x_shift, y_shift, scale); - } - - public MaskPosition(String point, Float xShift, Float yShift, Float scale) { - this.point = point; - this.x_shift = xShift; - this.y_shift = yShift; - this.scale = scale; - } - - public String point() { - return point; - } - - public Float xShift() { - return x_shift; - } - - public Float yShift() { - return y_shift; - } - - public Float scale() { - return scale; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - MaskPosition that = (MaskPosition) o; - - if (point != null ? !point.equals(that.point) : that.point != null) return false; - if (x_shift != null ? !x_shift.equals(that.x_shift) : that.x_shift != null) return false; - if (y_shift != null ? !y_shift.equals(that.y_shift) : that.y_shift != null) return false; - return scale != null ? scale.equals(that.scale) : that.scale == null; - } - - @Override - public int hashCode() { - int result = point != null ? point.hashCode() : 0; - result = 31 * result + (x_shift != null ? x_shift.hashCode() : 0); - result = 31 * result + (y_shift != null ? y_shift.hashCode() : 0); - result = 31 * result + (scale != null ? scale.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "MaskPosition{" + - "point='" + point + '\'' + - ", x_shift=" + x_shift + - ", y_shift=" + y_shift + - ", scale=" + scale + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Message.java b/library/src/main/java/com/pengrad/telegrambot/model/Message.java deleted file mode 100644 index 6487cc4c..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Message.java +++ /dev/null @@ -1,392 +0,0 @@ -package com.pengrad.telegrambot.model; - -import com.pengrad.telegrambot.passport.PassportData; - -import java.io.Serializable; -import java.util.Arrays; - -/** - * stas - * 8/4/15. - */ -public class Message implements Serializable { - private final static long serialVersionUID = 0L; - - private Integer message_id; - private User from; - private Integer date; - private Chat chat; - private User forward_from; - private Chat forward_from_chat; - private Integer forward_from_message_id; - private String forward_signature; - private String forward_sender_name; - private Integer forward_date; - private Message reply_to_message; - private Integer edit_date; - private String media_group_id; - private String author_signature; - private String text; - private MessageEntity[] entities; - private MessageEntity[] caption_entities; - private Audio audio; - private Document document; - private Animation animation; - private Game game; - private PhotoSize[] photo; - private Sticker sticker; - private Video video; - private Voice voice; - private VideoNote video_note; - private String caption; - private Contact contact; - private Location location; - private Venue venue; - private Poll poll; - private User new_chat_member; - private User[] new_chat_members; - private User left_chat_member; - private String new_chat_title; - private PhotoSize[] new_chat_photo; - private Boolean delete_chat_photo; - private Boolean group_chat_created; - private Boolean supergroup_chat_created; - private Boolean channel_chat_created; - private Long migrate_to_chat_id; - private Long migrate_from_chat_id; - private Message pinned_message; - private Invoice invoice; - private SuccessfulPayment successful_payment; - private String connected_website; - private PassportData passport_data; - - public Integer messageId() { - return message_id; - } - - public User from() { - return from; - } - - public Integer date() { - return date; - } - - public Chat chat() { - return chat; - } - - public User forwardFrom() { - return forward_from; - } - - public Chat forwardFromChat() { - return forward_from_chat; - } - - public Integer forwardFromMessageId() { - return forward_from_message_id; - } - - public String forwardSignature() { - return forward_signature; - } - - public String forwardSenderName() { - return forward_sender_name; - } - - public Integer forwardDate() { - return forward_date; - } - - public Message replyToMessage() { - return reply_to_message; - } - - public Integer editDate() { - return edit_date; - } - - public String mediaGroupId() { - return media_group_id; - } - - public String authorSignature() { - return author_signature; - } - - public String text() { - return text; - } - - public MessageEntity[] entities() { - return entities; - } - - public MessageEntity[] captionEntities() { - return caption_entities; - } - - public Audio audio() { - return audio; - } - - public Document document() { - return document; - } - - public Animation animation() { - return animation; - } - - public Game game() { - return game; - } - - public PhotoSize[] photo() { - return photo; - } - - public Sticker sticker() { - return sticker; - } - - public Video video() { - return video; - } - - public Voice voice() { - return voice; - } - - public VideoNote videoNote() { - return video_note; - } - - public String caption() { - return caption; - } - - public Contact contact() { - return contact; - } - - public Location location() { - return location; - } - - public Venue venue() { - return venue; - } - - public Poll poll() { - return poll; - } - - /** - * @deprecated Replaced with new_chat_members - */ - @Deprecated - public User newChatMember() { - return new_chat_member; - } - - public User[] newChatMembers() { - return new_chat_members; - } - - public User leftChatMember() { - return left_chat_member; - } - - public String newChatTitle() { - return new_chat_title; - } - - public PhotoSize[] newChatPhoto() { - return new_chat_photo; - } - - public Boolean deleteChatPhoto() { - return delete_chat_photo; - } - - public Boolean groupChatCreated() { - return group_chat_created; - } - - public Boolean supergroupChatCreated() { - return supergroup_chat_created; - } - - public Boolean channelChatCreated() { - return channel_chat_created; - } - - public Long migrateToChatId() { - return migrate_to_chat_id; - } - - public Long migrateFromChatId() { - return migrate_from_chat_id; - } - - public Message pinnedMessage() { - return pinned_message; - } - - public Invoice invoice() { - return invoice; - } - - public SuccessfulPayment successfulPayment() { - return successful_payment; - } - - public String connectedWebsite() { - return connected_website; - } - - public PassportData passportData() { - return passport_data; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Message message = (Message) o; - - if (message_id != null ? !message_id.equals(message.message_id) : message.message_id != null) return false; - if (from != null ? !from.equals(message.from) : message.from != null) return false; - if (date != null ? !date.equals(message.date) : message.date != null) return false; - if (chat != null ? !chat.equals(message.chat) : message.chat != null) return false; - if (forward_from != null ? !forward_from.equals(message.forward_from) : message.forward_from != null) return false; - if (forward_from_chat != null ? !forward_from_chat.equals(message.forward_from_chat) : message.forward_from_chat != null) - return false; - if (forward_from_message_id != null ? !forward_from_message_id.equals(message.forward_from_message_id) : message.forward_from_message_id != null) - return false; - if (forward_signature != null ? !forward_signature.equals(message.forward_signature) : message.forward_signature != null) - return false; - if (forward_sender_name != null ? !forward_sender_name.equals(message.forward_sender_name) : message.forward_sender_name != null) - return false; - if (forward_date != null ? !forward_date.equals(message.forward_date) : message.forward_date != null) return false; - if (reply_to_message != null ? !reply_to_message.equals(message.reply_to_message) : message.reply_to_message != null) - return false; - if (edit_date != null ? !edit_date.equals(message.edit_date) : message.edit_date != null) return false; - if (media_group_id != null ? !media_group_id.equals(message.media_group_id) : message.media_group_id != null) - return false; - if (author_signature != null ? !author_signature.equals(message.author_signature) : message.author_signature != null) - return false; - if (text != null ? !text.equals(message.text) : message.text != null) return false; - // Probably incorrect - comparing Object[] arrays with Arrays.equals - if (!Arrays.equals(entities, message.entities)) return false; - // Probably incorrect - comparing Object[] arrays with Arrays.equals - if (!Arrays.equals(caption_entities, message.caption_entities)) return false; - if (audio != null ? !audio.equals(message.audio) : message.audio != null) return false; - if (document != null ? !document.equals(message.document) : message.document != null) return false; - if (animation != null ? !animation.equals(message.animation) : message.animation != null) return false; - if (game != null ? !game.equals(message.game) : message.game != null) return false; - // Probably incorrect - comparing Object[] arrays with Arrays.equals - if (!Arrays.equals(photo, message.photo)) return false; - if (sticker != null ? !sticker.equals(message.sticker) : message.sticker != null) return false; - if (video != null ? !video.equals(message.video) : message.video != null) return false; - if (voice != null ? !voice.equals(message.voice) : message.voice != null) return false; - if (video_note != null ? !video_note.equals(message.video_note) : message.video_note != null) return false; - if (caption != null ? !caption.equals(message.caption) : message.caption != null) return false; - if (contact != null ? !contact.equals(message.contact) : message.contact != null) return false; - if (location != null ? !location.equals(message.location) : message.location != null) return false; - if (venue != null ? !venue.equals(message.venue) : message.venue != null) return false; - if (poll != null ? !poll.equals(message.poll) : message.poll != null) return false; - if (new_chat_member != null ? !new_chat_member.equals(message.new_chat_member) : message.new_chat_member != null) - return false; - // Probably incorrect - comparing Object[] arrays with Arrays.equals - if (!Arrays.equals(new_chat_members, message.new_chat_members)) return false; - if (left_chat_member != null ? !left_chat_member.equals(message.left_chat_member) : message.left_chat_member != null) - return false; - if (new_chat_title != null ? !new_chat_title.equals(message.new_chat_title) : message.new_chat_title != null) - return false; - // Probably incorrect - comparing Object[] arrays with Arrays.equals - if (!Arrays.equals(new_chat_photo, message.new_chat_photo)) return false; - if (delete_chat_photo != null ? !delete_chat_photo.equals(message.delete_chat_photo) : message.delete_chat_photo != null) - return false; - if (group_chat_created != null ? !group_chat_created.equals(message.group_chat_created) : message.group_chat_created != null) - return false; - if (supergroup_chat_created != null ? !supergroup_chat_created.equals(message.supergroup_chat_created) : message.supergroup_chat_created != null) - return false; - if (channel_chat_created != null ? !channel_chat_created.equals(message.channel_chat_created) : message.channel_chat_created != null) - return false; - if (migrate_to_chat_id != null ? !migrate_to_chat_id.equals(message.migrate_to_chat_id) : message.migrate_to_chat_id != null) - return false; - if (migrate_from_chat_id != null ? !migrate_from_chat_id.equals(message.migrate_from_chat_id) : message.migrate_from_chat_id != null) - return false; - if (pinned_message != null ? !pinned_message.equals(message.pinned_message) : message.pinned_message != null) - return false; - if (invoice != null ? !invoice.equals(message.invoice) : message.invoice != null) return false; - if (successful_payment != null ? !successful_payment.equals(message.successful_payment) : message.successful_payment != null) - return false; - if (connected_website != null ? !connected_website.equals(message.connected_website) : message.connected_website != null) - return false; - return passport_data != null ? passport_data.equals(message.passport_data) : message.passport_data == null; - } - - @Override - public int hashCode() { - return message_id != null ? message_id.hashCode() : 0; - } - - @Override - public String toString() { - return "Message{" + - "message_id=" + message_id + - ", from=" + from + - ", date=" + date + - ", chat=" + chat + - ", forward_from=" + forward_from + - ", forward_from_chat=" + forward_from_chat + - ", forward_from_message_id=" + forward_from_message_id + - ", forward_signature='" + forward_signature + '\'' + - ", forward_sender_name='" + forward_sender_name + '\'' + - ", forward_date=" + forward_date + - ", reply_to_message=" + reply_to_message + - ", edit_date=" + edit_date + - ", media_group_id='" + media_group_id + '\'' + - ", author_signature='" + author_signature + '\'' + - ", text='" + text + '\'' + - ", entities=" + Arrays.toString(entities) + - ", caption_entities=" + Arrays.toString(caption_entities) + - ", audio=" + audio + - ", document=" + document + - ", animation=" + animation + - ", game=" + game + - ", photo=" + Arrays.toString(photo) + - ", sticker=" + sticker + - ", video=" + video + - ", voice=" + voice + - ", video_note=" + video_note + - ", caption='" + caption + '\'' + - ", contact=" + contact + - ", location=" + location + - ", venue=" + venue + - ", poll=" + poll + - ", new_chat_member=" + new_chat_member + - ", new_chat_members=" + Arrays.toString(new_chat_members) + - ", left_chat_member=" + left_chat_member + - ", new_chat_title='" + new_chat_title + '\'' + - ", new_chat_photo=" + Arrays.toString(new_chat_photo) + - ", delete_chat_photo=" + delete_chat_photo + - ", group_chat_created=" + group_chat_created + - ", supergroup_chat_created=" + supergroup_chat_created + - ", channel_chat_created=" + channel_chat_created + - ", migrate_to_chat_id=" + migrate_to_chat_id + - ", migrate_from_chat_id=" + migrate_from_chat_id + - ", pinned_message=" + pinned_message + - ", invoice=" + invoice + - ", successful_payment=" + successful_payment + - ", connected_website='" + connected_website + '\'' + - ", passport_data=" + passport_data + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/MessageEntity.java b/library/src/main/java/com/pengrad/telegrambot/model/MessageEntity.java deleted file mode 100644 index 72201fc1..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/MessageEntity.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 5/3/16. - */ -public class MessageEntity implements Serializable { - private final static long serialVersionUID = 0L; - - public enum Type { - mention, hashtag, cashtag, bot_command, url, email, phone_number, bold, italic, code, pre, text_link, - text_mention - } - - private Type type; - private Integer offset; - private Integer length; - private String url; - private User user; - - public Type type() { - return type; - } - - public Integer offset() { - return offset; - } - - public Integer length() { - return length; - } - - public String url() { - return url; - } - - public User user() { - return user; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - MessageEntity that = (MessageEntity) o; - - if (type != that.type) return false; - if (offset != null ? !offset.equals(that.offset) : that.offset != null) return false; - if (length != null ? !length.equals(that.length) : that.length != null) return false; - if (url != null ? !url.equals(that.url) : that.url != null) return false; - return user != null ? user.equals(that.user) : that.user == null; - - } - - @Override - public int hashCode() { - int result = type != null ? type.hashCode() : 0; - result = 31 * result + (offset != null ? offset.hashCode() : 0); - result = 31 * result + (length != null ? length.hashCode() : 0); - result = 31 * result + (url != null ? url.hashCode() : 0); - result = 31 * result + (user != null ? user.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "MessageEntity{" + - "type=" + type + - ", offset=" + offset + - ", length=" + length + - ", url='" + url + '\'' + - ", user=" + user + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/OrderInfo.java b/library/src/main/java/com/pengrad/telegrambot/model/OrderInfo.java deleted file mode 100644 index fd057391..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/OrderInfo.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 24 May 2017 - */ -public class OrderInfo implements Serializable { - private final static long serialVersionUID = 0L; - - private String name, phone_number, email; - private ShippingAddress shipping_address; - - public String name() { - return name; - } - - public String phoneNumber() { - return phone_number; - } - - public String email() { - return email; - } - - public ShippingAddress shippingAddress() { - return shipping_address; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - OrderInfo orderInfo = (OrderInfo) o; - - if (name != null ? !name.equals(orderInfo.name) : orderInfo.name != null) return false; - if (phone_number != null ? !phone_number.equals(orderInfo.phone_number) : orderInfo.phone_number != null) return false; - if (email != null ? !email.equals(orderInfo.email) : orderInfo.email != null) return false; - return shipping_address != null ? shipping_address.equals(orderInfo.shipping_address) : orderInfo.shipping_address == null; - - } - - @Override - public int hashCode() { - int result = name != null ? name.hashCode() : 0; - result = 31 * result + (phone_number != null ? phone_number.hashCode() : 0); - result = 31 * result + (email != null ? email.hashCode() : 0); - result = 31 * result + (shipping_address != null ? shipping_address.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "OrderInfo{" + - "name='" + name + '\'' + - ", phone_number='" + phone_number + '\'' + - ", email='" + email + '\'' + - ", shipping_address=" + shipping_address + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/PhotoSize.java b/library/src/main/java/com/pengrad/telegrambot/model/PhotoSize.java deleted file mode 100644 index 279ad7c4..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/PhotoSize.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 8/4/15. - */ -public class PhotoSize implements Serializable { - private final static long serialVersionUID = 0L; - - private String file_id; - private Integer width; - private Integer height; - private Integer file_size; - - public String fileId() { - return file_id; - } - - public Integer width() { - return width; - } - - public Integer height() { - return height; - } - - public Integer fileSize() { - return file_size; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - PhotoSize photoSize = (PhotoSize) o; - - if (file_id != null ? !file_id.equals(photoSize.file_id) : photoSize.file_id != null) return false; - if (width != null ? !width.equals(photoSize.width) : photoSize.width != null) return false; - if (height != null ? !height.equals(photoSize.height) : photoSize.height != null) return false; - return file_size != null ? file_size.equals(photoSize.file_size) : photoSize.file_size == null; - } - - @Override - public int hashCode() { - return file_id != null ? file_id.hashCode() : 0; - } - - @Override - public String toString() { - return "PhotoSize{" + - "file_id='" + file_id + '\'' + - ", width=" + width + - ", height=" + height + - ", file_size=" + file_size + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Poll.java b/library/src/main/java/com/pengrad/telegrambot/model/Poll.java deleted file mode 100644 index 08cb7671..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Poll.java +++ /dev/null @@ -1,62 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; -import java.util.Arrays; - -/** - * Stas Parshin - * 17 April 2019 - */ -public class Poll implements Serializable { - private final static long serialVersionUID = 0L; - - private String id; - private String question; - private PollOption[] options; - private Boolean is_closed; - - public String id() { - return id; - } - - public String question() { - return question; - } - - public PollOption[] options() { - return options; - } - - public Boolean isClosed() { - return is_closed; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Poll poll = (Poll) o; - - if (id != null ? !id.equals(poll.id) : poll.id != null) return false; - if (question != null ? !question.equals(poll.question) : poll.question != null) return false; - // Probably incorrect - comparing Object[] arrays with Arrays.equals - if (!Arrays.equals(options, poll.options)) return false; - return is_closed != null ? is_closed.equals(poll.is_closed) : poll.is_closed == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - - @Override - public String toString() { - return "Poll{" + - "id='" + id + '\'' + - ", question='" + question + '\'' + - ", options=" + Arrays.toString(options) + - ", is_closed=" + is_closed + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/PollOption.java b/library/src/main/java/com/pengrad/telegrambot/model/PollOption.java deleted file mode 100644 index c67b7b22..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/PollOption.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 17 April 2019 - */ -public class PollOption implements Serializable { - private final static long serialVersionUID = 0L; - - private String text; - private Integer voter_count; - - public String text() { - return text; - } - - public Integer voterCount() { - return voter_count; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - PollOption that = (PollOption) o; - - if (text != null ? !text.equals(that.text) : that.text != null) return false; - return voter_count != null ? voter_count.equals(that.voter_count) : that.voter_count == null; - } - - @Override - public int hashCode() { - int result = text != null ? text.hashCode() : 0; - result = 31 * result + (voter_count != null ? voter_count.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "PollOption{" + - "text='" + text + '\'' + - ", voter_count=" + voter_count + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/PreCheckoutQuery.java b/library/src/main/java/com/pengrad/telegrambot/model/PreCheckoutQuery.java deleted file mode 100644 index d956397a..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/PreCheckoutQuery.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 24 May 2017 - */ -public class PreCheckoutQuery implements Serializable { - private final static long serialVersionUID = 0L; - - private String id; - private User from; - private String currency; - private Integer total_amount; - private String invoice_payload; - private String shipping_option_id; - private OrderInfo order_info; - - public String id() { - return id; - } - - public User from() { - return from; - } - - public String currency() { - return currency; - } - - public Integer totalAmount() { - return total_amount; - } - - public String invoicePayload() { - return invoice_payload; - } - - public String shippingOptionId() { - return shipping_option_id; - } - - public OrderInfo orderInfo() { - return order_info; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - PreCheckoutQuery that = (PreCheckoutQuery) o; - - if (id != null ? !id.equals(that.id) : that.id != null) return false; - if (from != null ? !from.equals(that.from) : that.from != null) return false; - if (currency != null ? !currency.equals(that.currency) : that.currency != null) return false; - if (total_amount != null ? !total_amount.equals(that.total_amount) : that.total_amount != null) return false; - if (invoice_payload != null ? !invoice_payload.equals(that.invoice_payload) : that.invoice_payload != null) - return false; - if (shipping_option_id != null ? !shipping_option_id.equals(that.shipping_option_id) : that.shipping_option_id != null) - return false; - return order_info != null ? order_info.equals(that.order_info) : that.order_info == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - - @Override - public String toString() { - return "PreCheckoutQuery{" + - "id='" + id + '\'' + - ", from=" + from + - ", currency='" + currency + '\'' + - ", total_amount=" + total_amount + - ", invoice_payload='" + invoice_payload + '\'' + - ", shipping_option_id='" + shipping_option_id + '\'' + - ", order_info=" + order_info + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/ResponseParameters.java b/library/src/main/java/com/pengrad/telegrambot/model/ResponseParameters.java deleted file mode 100644 index bf7dd261..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/ResponseParameters.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 03 October 2016 - */ -public class ResponseParameters implements Serializable { - private final static long serialVersionUID = 0L; - - private Long migrate_to_chat_id; - private Integer retry_after; - - public Long migrateToChatId() { - return migrate_to_chat_id; - } - - public Integer retryAfter() { - return retry_after; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ResponseParameters that = (ResponseParameters) o; - - if (migrate_to_chat_id != null ? !migrate_to_chat_id.equals(that.migrate_to_chat_id) : that.migrate_to_chat_id != null) - return false; - return retry_after != null ? retry_after.equals(that.retry_after) : that.retry_after == null; - } - - @Override - public int hashCode() { - int result = migrate_to_chat_id != null ? migrate_to_chat_id.hashCode() : 0; - result = 31 * result + (retry_after != null ? retry_after.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "ResponseParameters{" + - "migrate_to_chat_id=" + migrate_to_chat_id + - ", retry_after=" + retry_after + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/ShippingAddress.java b/library/src/main/java/com/pengrad/telegrambot/model/ShippingAddress.java deleted file mode 100644 index f2e5a609..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/ShippingAddress.java +++ /dev/null @@ -1,76 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 24 May 2017 - */ -public class ShippingAddress implements Serializable { - private final static long serialVersionUID = 0L; - - private String country_code, state, city, street_line1, street_line2, post_code; - - public String countryCode() { - return country_code; - } - - public String state() { - return state; - } - - public String city() { - return city; - } - - public String streetLine1() { - return street_line1; - } - - public String streetLine2() { - return street_line2; - } - - public String postCode() { - return post_code; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ShippingAddress that = (ShippingAddress) o; - - if (country_code != null ? !country_code.equals(that.country_code) : that.country_code != null) return false; - if (state != null ? !state.equals(that.state) : that.state != null) return false; - if (city != null ? !city.equals(that.city) : that.city != null) return false; - if (street_line1 != null ? !street_line1.equals(that.street_line1) : that.street_line1 != null) return false; - if (street_line2 != null ? !street_line2.equals(that.street_line2) : that.street_line2 != null) return false; - return post_code != null ? post_code.equals(that.post_code) : that.post_code == null; - - } - - @Override - public int hashCode() { - int result = country_code != null ? country_code.hashCode() : 0; - result = 31 * result + (state != null ? state.hashCode() : 0); - result = 31 * result + (city != null ? city.hashCode() : 0); - result = 31 * result + (street_line1 != null ? street_line1.hashCode() : 0); - result = 31 * result + (street_line2 != null ? street_line2.hashCode() : 0); - result = 31 * result + (post_code != null ? post_code.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "ShippingAddress{" + - "country_code='" + country_code + '\'' + - ", state='" + state + '\'' + - ", city='" + city + '\'' + - ", street_line1='" + street_line1 + '\'' + - ", street_line2='" + street_line2 + '\'' + - ", post_code='" + post_code + '\'' + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/ShippingQuery.java b/library/src/main/java/com/pengrad/telegrambot/model/ShippingQuery.java deleted file mode 100644 index 3fc95f6a..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/ShippingQuery.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 24 May 2017 - */ -public class ShippingQuery implements Serializable { - private final static long serialVersionUID = 0L; - - private String id; - private User from; - private String invoice_payload; - private ShippingAddress shipping_address; - - public String id() { - return id; - } - - public User from() { - return from; - } - - public String invoicePayload() { - return invoice_payload; - } - - public ShippingAddress shippingAddress() { - return shipping_address; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - ShippingQuery that = (ShippingQuery) o; - - if (id != null ? !id.equals(that.id) : that.id != null) return false; - if (from != null ? !from.equals(that.from) : that.from != null) return false; - if (invoice_payload != null ? !invoice_payload.equals(that.invoice_payload) : that.invoice_payload != null) - return false; - return shipping_address != null ? shipping_address.equals(that.shipping_address) : that.shipping_address == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - - @Override - public String toString() { - return "ShippingQuery{" + - "id='" + id + '\'' + - ", from=" + from + - ", invoice_payload='" + invoice_payload + '\'' + - ", shipping_address=" + shipping_address + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Sticker.java b/library/src/main/java/com/pengrad/telegrambot/model/Sticker.java deleted file mode 100644 index 3ac2da26..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Sticker.java +++ /dev/null @@ -1,88 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 8/5/15. - */ -public class Sticker implements Serializable { - private final static long serialVersionUID = 0L; - - private String file_id; - private Integer width; - private Integer height; - private PhotoSize thumb; - private String emoji; - private String set_name; - private MaskPosition mask_position; - private Integer file_size; - - public String fileId() { - return file_id; - } - - public Integer width() { - return width; - } - - public Integer height() { - return height; - } - - public PhotoSize thumb() { - return thumb; - } - - public String emoji() { - return emoji; - } - - public String setName() { - return set_name; - } - - public MaskPosition maskPosition() { - return mask_position; - } - - public Integer fileSize() { - return file_size; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Sticker sticker = (Sticker) o; - - if (file_id != null ? !file_id.equals(sticker.file_id) : sticker.file_id != null) return false; - if (width != null ? !width.equals(sticker.width) : sticker.width != null) return false; - if (height != null ? !height.equals(sticker.height) : sticker.height != null) return false; - if (thumb != null ? !thumb.equals(sticker.thumb) : sticker.thumb != null) return false; - if (emoji != null ? !emoji.equals(sticker.emoji) : sticker.emoji != null) return false; - if (set_name != null ? !set_name.equals(sticker.set_name) : sticker.set_name != null) return false; - if (mask_position != null ? !mask_position.equals(sticker.mask_position) : sticker.mask_position != null) return false; - return file_size != null ? file_size.equals(sticker.file_size) : sticker.file_size == null; - } - - @Override - public int hashCode() { - return file_id != null ? file_id.hashCode() : 0; - } - - @Override - public String toString() { - return "Sticker{" + - "file_id='" + file_id + '\'' + - ", width=" + width + - ", height=" + height + - ", thumb=" + thumb + - ", emoji='" + emoji + '\'' + - ", set_name='" + set_name + '\'' + - ", mask_position=" + mask_position + - ", file_size=" + file_size + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/StickerSet.java b/library/src/main/java/com/pengrad/telegrambot/model/StickerSet.java deleted file mode 100644 index 3ff25aae..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/StickerSet.java +++ /dev/null @@ -1,66 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; -import java.util.Arrays; - -/** - * Stas Parshin - * 23 July 2017 - */ -public class StickerSet implements Serializable { - private final static long serialVersionUID = 0L; - - private String name; - private String title; - private Boolean contains_masks; - private Sticker[] stickers; - - public String name() { - return name; - } - - public String title() { - return title; - } - - public Boolean containsMasks() { - return contains_masks; - } - - public Sticker[] stickers() { - return stickers; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - StickerSet that = (StickerSet) o; - - if (name != null ? !name.equals(that.name) : that.name != null) return false; - if (title != null ? !title.equals(that.title) : that.title != null) return false; - if (contains_masks != null ? !contains_masks.equals(that.contains_masks) : that.contains_masks != null) return false; - // Probably incorrect - comparing Object[] arrays with Arrays.equals - return Arrays.equals(stickers, that.stickers); - } - - @Override - public int hashCode() { - int result = name != null ? name.hashCode() : 0; - result = 31 * result + (title != null ? title.hashCode() : 0); - result = 31 * result + (contains_masks != null ? contains_masks.hashCode() : 0); - result = 31 * result + Arrays.hashCode(stickers); - return result; - } - - @Override - public String toString() { - return "StickerSet{" + - "name='" + name + '\'' + - ", title='" + title + '\'' + - ", contains_masks=" + contains_masks + - ", stickers=" + Arrays.toString(stickers) + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/SuccessfulPayment.java b/library/src/main/java/com/pengrad/telegrambot/model/SuccessfulPayment.java deleted file mode 100644 index 64e81c31..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/SuccessfulPayment.java +++ /dev/null @@ -1,92 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 24 May 2017 - */ -public class SuccessfulPayment implements Serializable { - private final static long serialVersionUID = 0L; - - private String currency; - private Integer total_amount; - private String invoice_payload; - private String shipping_option_id; - private OrderInfo order_info; - private String telegram_payment_charge_id; - private String provider_payment_charge_id; - - public String currency() { - return currency; - } - - public Integer totalAmount() { - return total_amount; - } - - public String invoicePayload() { - return invoice_payload; - } - - public String shippingOptionId() { - return shipping_option_id; - } - - public OrderInfo orderInfo() { - return order_info; - } - - public String telegramPaymentChargeId() { - return telegram_payment_charge_id; - } - - public String providerPaymentChargeId() { - return provider_payment_charge_id; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - SuccessfulPayment that = (SuccessfulPayment) o; - - if (currency != null ? !currency.equals(that.currency) : that.currency != null) return false; - if (total_amount != null ? !total_amount.equals(that.total_amount) : that.total_amount != null) return false; - if (invoice_payload != null ? !invoice_payload.equals(that.invoice_payload) : that.invoice_payload != null) - return false; - if (shipping_option_id != null ? !shipping_option_id.equals(that.shipping_option_id) : that.shipping_option_id != null) - return false; - if (order_info != null ? !order_info.equals(that.order_info) : that.order_info != null) return false; - if (telegram_payment_charge_id != null ? !telegram_payment_charge_id.equals(that.telegram_payment_charge_id) : that.telegram_payment_charge_id != null) - return false; - return provider_payment_charge_id != null ? provider_payment_charge_id.equals(that.provider_payment_charge_id) : that.provider_payment_charge_id == null; - - } - - @Override - public int hashCode() { - int result = currency != null ? currency.hashCode() : 0; - result = 31 * result + (total_amount != null ? total_amount.hashCode() : 0); - result = 31 * result + (invoice_payload != null ? invoice_payload.hashCode() : 0); - result = 31 * result + (shipping_option_id != null ? shipping_option_id.hashCode() : 0); - result = 31 * result + (order_info != null ? order_info.hashCode() : 0); - result = 31 * result + (telegram_payment_charge_id != null ? telegram_payment_charge_id.hashCode() : 0); - result = 31 * result + (provider_payment_charge_id != null ? provider_payment_charge_id.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "SuccessfulPayment{" + - "currency='" + currency + '\'' + - ", total_amount=" + total_amount + - ", invoice_payload='" + invoice_payload + '\'' + - ", shipping_option_id='" + shipping_option_id + '\'' + - ", order_info=" + order_info + - ", telegram_payment_charge_id='" + telegram_payment_charge_id + '\'' + - ", provider_payment_charge_id='" + provider_payment_charge_id + '\'' + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Update.java b/library/src/main/java/com/pengrad/telegrambot/model/Update.java deleted file mode 100644 index 58187974..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Update.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 8/4/15. - */ -public class Update implements Serializable { - private final static long serialVersionUID = 0L; - - private Integer update_id; - private Message message; - private Message edited_message; - private Message channel_post; - private Message edited_channel_post; - private InlineQuery inline_query; - private ChosenInlineResult chosen_inline_result; - private CallbackQuery callback_query; - private ShippingQuery shipping_query; - private PreCheckoutQuery pre_checkout_query; - private Poll poll; - - public Integer updateId() { - return update_id; - } - - public Message message() { - return message; - } - - public Message editedMessage() { - return edited_message; - } - - public Message channelPost() { - return channel_post; - } - - public Message editedChannelPost() { - return edited_channel_post; - } - - public InlineQuery inlineQuery() { - return inline_query; - } - - public ChosenInlineResult chosenInlineResult() { - return chosen_inline_result; - } - - public CallbackQuery callbackQuery() { - return callback_query; - } - - public ShippingQuery shippingQuery() { - return shipping_query; - } - - public PreCheckoutQuery preCheckoutQuery() { - return pre_checkout_query; - } - - public Poll poll() { - return poll; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Update update = (Update) o; - - if (update_id != null ? !update_id.equals(update.update_id) : update.update_id != null) return false; - if (message != null ? !message.equals(update.message) : update.message != null) return false; - if (edited_message != null ? !edited_message.equals(update.edited_message) : update.edited_message != null) - return false; - if (channel_post != null ? !channel_post.equals(update.channel_post) : update.channel_post != null) return false; - if (edited_channel_post != null ? !edited_channel_post.equals(update.edited_channel_post) : update.edited_channel_post != null) - return false; - if (inline_query != null ? !inline_query.equals(update.inline_query) : update.inline_query != null) return false; - if (chosen_inline_result != null ? !chosen_inline_result.equals(update.chosen_inline_result) : update.chosen_inline_result != null) - return false; - if (callback_query != null ? !callback_query.equals(update.callback_query) : update.callback_query != null) - return false; - if (shipping_query != null ? !shipping_query.equals(update.shipping_query) : update.shipping_query != null) - return false; - if (pre_checkout_query != null ? !pre_checkout_query.equals(update.pre_checkout_query) : update.pre_checkout_query != null) - return false; - return poll != null ? poll.equals(update.poll) : update.poll == null; - } - - @Override - public int hashCode() { - return update_id != null ? update_id.hashCode() : 0; - } - - @Override - public String toString() { - return "Update{" + - "update_id=" + update_id + - ", message=" + message + - ", edited_message=" + edited_message + - ", channel_post=" + channel_post + - ", edited_channel_post=" + edited_channel_post + - ", inline_query=" + inline_query + - ", chosen_inline_result=" + chosen_inline_result + - ", callback_query=" + callback_query + - ", shipping_query=" + shipping_query + - ", pre_checkout_query=" + pre_checkout_query + - ", poll=" + poll + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/User.java b/library/src/main/java/com/pengrad/telegrambot/model/User.java deleted file mode 100644 index 3b2d4b6b..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/User.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 8/4/15. - */ -public class User implements Serializable { - private final static long serialVersionUID = 0L; - - private Integer id; - private Boolean is_bot; - private String first_name; - private String last_name; - private String username; - private String language_code; - - public Integer id() { - return id; - } - - public Boolean isBot() { - return is_bot; - } - - public String firstName() { - return first_name; - } - - public String lastName() { - return last_name; - } - - public String username() { - return username; - } - - public String languageCode() { - return language_code; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - User user = (User) o; - - if (id != null ? !id.equals(user.id) : user.id != null) return false; - if (is_bot != null ? !is_bot.equals(user.is_bot) : user.is_bot != null) return false; - if (first_name != null ? !first_name.equals(user.first_name) : user.first_name != null) return false; - if (last_name != null ? !last_name.equals(user.last_name) : user.last_name != null) return false; - if (username != null ? !username.equals(user.username) : user.username != null) return false; - return language_code != null ? language_code.equals(user.language_code) : user.language_code == null; - } - - @Override - public int hashCode() { - return id != null ? id.hashCode() : 0; - } - - @Override - public String toString() { - return "User{" + - "id=" + id + - ", is_bot=" + is_bot + - ", first_name='" + first_name + '\'' + - ", last_name='" + last_name + '\'' + - ", username='" + username + '\'' + - ", language_code='" + language_code + '\'' + - '}'; - } -} \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/model/UserProfilePhotos.java b/library/src/main/java/com/pengrad/telegrambot/model/UserProfilePhotos.java deleted file mode 100644 index 8301e6b0..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/UserProfilePhotos.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; -import java.util.Arrays; - -/** - * stas - * 8/5/15. - */ -public class UserProfilePhotos implements Serializable { - private final static long serialVersionUID = 0L; - - private Integer total_count; - private PhotoSize[][] photos; - - public Integer totalCount() { - return total_count; - } - - public PhotoSize[][] photos() { - return photos; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - UserProfilePhotos that = (UserProfilePhotos) o; - - if (total_count != null ? !total_count.equals(that.total_count) : that.total_count != null) return false; - return Arrays.deepEquals(photos, that.photos); - } - - @Override - public int hashCode() { - int result = total_count != null ? total_count.hashCode() : 0; - result = 31 * result + Arrays.deepHashCode(photos); - return result; - } - - @Override - public String toString() { - return "UserProfilePhotos{" + - "total_count=" + total_count + - ", photos=" + Arrays.deepToString(photos) + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Venue.java b/library/src/main/java/com/pengrad/telegrambot/model/Venue.java deleted file mode 100644 index 77cbd449..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Venue.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 5/3/16. - */ -public class Venue implements Serializable { - private final static long serialVersionUID = 0L; - - private Location location; - private String title; - private String address; - private String foursquare_id; - private String foursquare_type; - - public Location location() { - return location; - } - - public String title() { - return title; - } - - public String address() { - return address; - } - - public String foursquareId() { - return foursquare_id; - } - - public String foursquareType() { - return foursquare_type; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Venue venue = (Venue) o; - - if (location != null ? !location.equals(venue.location) : venue.location != null) return false; - if (title != null ? !title.equals(venue.title) : venue.title != null) return false; - if (address != null ? !address.equals(venue.address) : venue.address != null) return false; - if (foursquare_id != null ? !foursquare_id.equals(venue.foursquare_id) : venue.foursquare_id != null) return false; - return foursquare_type != null ? foursquare_type.equals(venue.foursquare_type) : venue.foursquare_type == null; - } - - @Override - public int hashCode() { - int result = location != null ? location.hashCode() : 0; - result = 31 * result + (title != null ? title.hashCode() : 0); - result = 31 * result + (address != null ? address.hashCode() : 0); - result = 31 * result + (foursquare_id != null ? foursquare_id.hashCode() : 0); - result = 31 * result + (foursquare_type != null ? foursquare_type.hashCode() : 0); - return result; - } - - @Override - public String toString() { - return "Venue{" + - "location=" + location + - ", title='" + title + '\'' + - ", address='" + address + '\'' + - ", foursquare_id='" + foursquare_id + '\'' + - ", foursquare_type='" + foursquare_type + '\'' + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Video.java b/library/src/main/java/com/pengrad/telegrambot/model/Video.java deleted file mode 100644 index 0ecca220..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Video.java +++ /dev/null @@ -1,81 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 8/5/15. - */ -public class Video implements Serializable { - private final static long serialVersionUID = 0L; - - private String file_id; - private Integer width; - private Integer height; - private Integer duration; - private PhotoSize thumb; - private String mime_type; - private Integer file_size; - - public String fileId() { - return file_id; - } - - public Integer width() { - return width; - } - - public Integer height() { - return height; - } - - public Integer duration() { - return duration; - } - - public PhotoSize thumb() { - return thumb; - } - - public String mimeType() { - return mime_type; - } - - public Integer fileSize() { - return file_size; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Video video = (Video) o; - - if (file_id != null ? !file_id.equals(video.file_id) : video.file_id != null) return false; - if (width != null ? !width.equals(video.width) : video.width != null) return false; - if (height != null ? !height.equals(video.height) : video.height != null) return false; - if (duration != null ? !duration.equals(video.duration) : video.duration != null) return false; - if (thumb != null ? !thumb.equals(video.thumb) : video.thumb != null) return false; - if (mime_type != null ? !mime_type.equals(video.mime_type) : video.mime_type != null) return false; - return file_size != null ? file_size.equals(video.file_size) : video.file_size == null; - } - - @Override - public int hashCode() { - return file_id != null ? file_id.hashCode() : 0; - } - - @Override - public String toString() { - return "Video{" + - "file_id='" + file_id + '\'' + - ", width=" + width + - ", height=" + height + - ", duration=" + duration + - ", thumb=" + thumb + - ", mime_type='" + mime_type + '\'' + - ", file_size=" + file_size + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/VideoNote.java b/library/src/main/java/com/pengrad/telegrambot/model/VideoNote.java deleted file mode 100644 index 9a486375..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/VideoNote.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * Stas Parshin - * 23 May 2017 - */ -public class VideoNote implements Serializable { - private final static long serialVersionUID = 0L; - - private String file_id; - private Integer length; - private Integer duration; - private PhotoSize thumb; - private Integer file_size; - - public String fileId() { - return file_id; - } - - public Integer length() { - return length; - } - - public Integer duration() { - return duration; - } - - public PhotoSize thumb() { - return thumb; - } - - public Integer fileSize() { - return file_size; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - VideoNote videoNote = (VideoNote) o; - - if (file_id != null ? !file_id.equals(videoNote.file_id) : videoNote.file_id != null) return false; - if (length != null ? !length.equals(videoNote.length) : videoNote.length != null) return false; - if (duration != null ? !duration.equals(videoNote.duration) : videoNote.duration != null) return false; - if (thumb != null ? !thumb.equals(videoNote.thumb) : videoNote.thumb != null) return false; - return file_size != null ? file_size.equals(videoNote.file_size) : videoNote.file_size == null; - } - - @Override - public int hashCode() { - return file_id != null ? file_id.hashCode() : 0; - } - - @Override - public String toString() { - return "VideoNote{" + - "file_id='" + file_id + '\'' + - ", length=" + length + - ", duration=" + duration + - ", thumb=" + thumb + - ", file_size=" + file_size + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Voice.java b/library/src/main/java/com/pengrad/telegrambot/model/Voice.java deleted file mode 100644 index 2fb1d047..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/Voice.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; - -/** - * stas - * 10/21/15. - */ -public class Voice implements Serializable { - private final static long serialVersionUID = 0L; - - private String file_id; - private Integer duration; - private String mime_type; - private Integer file_size; - - public String fileId() { - return file_id; - } - - public Integer duration() { - return duration; - } - - public String mimeType() { - return mime_type; - } - - public Integer fileSize() { - return file_size; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - Voice voice = (Voice) o; - - if (file_id != null ? !file_id.equals(voice.file_id) : voice.file_id != null) return false; - if (duration != null ? !duration.equals(voice.duration) : voice.duration != null) return false; - if (mime_type != null ? !mime_type.equals(voice.mime_type) : voice.mime_type != null) return false; - return file_size != null ? file_size.equals(voice.file_size) : voice.file_size == null; - } - - @Override - public int hashCode() { - return file_id != null ? file_id.hashCode() : 0; - } - - @Override - public String toString() { - return "Voice{" + - "file_id='" + file_id + '\'' + - ", duration=" + duration + - ", mime_type='" + mime_type + '\'' + - ", file_size=" + file_size + - '}'; - } -} \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/model/WebhookInfo.java b/library/src/main/java/com/pengrad/telegrambot/model/WebhookInfo.java deleted file mode 100644 index 4a83df5e..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/WebhookInfo.java +++ /dev/null @@ -1,95 +0,0 @@ -package com.pengrad.telegrambot.model; - -import java.io.Serializable; -import java.util.Arrays; - -/** - * Stas Parshin - * 03 October 2016 - */ -public class WebhookInfo implements Serializable { - private final static long serialVersionUID = 0L; - - private String url; - private Boolean has_custom_certificate; - private Integer pending_update_count; - private Integer last_error_date; - private String last_error_message; - private Integer max_connections; - private String[] allowed_updates; - - public String url() { - return url; - } - - public Boolean hasCustomCertificate() { - return has_custom_certificate; - } - - public Integer pendingUpdateCount() { - return pending_update_count; - } - - public Integer lastErrorDate() { - return last_error_date; - } - - public String lastErrorMessage() { - return last_error_message; - } - - public Integer maxConnections() { - return max_connections; - } - - public String[] allowedUpdates() { - return allowed_updates; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - - WebhookInfo that = (WebhookInfo) o; - - if (url != null ? !url.equals(that.url) : that.url != null) return false; - if (has_custom_certificate != null ? !has_custom_certificate.equals(that.has_custom_certificate) : that.has_custom_certificate != null) - return false; - if (pending_update_count != null ? !pending_update_count.equals(that.pending_update_count) : that.pending_update_count != null) - return false; - if (last_error_date != null ? !last_error_date.equals(that.last_error_date) : that.last_error_date != null) - return false; - if (last_error_message != null ? !last_error_message.equals(that.last_error_message) : that.last_error_message != null) - return false; - if (max_connections != null ? !max_connections.equals(that.max_connections) : that.max_connections != null) - return false; - // Probably incorrect - comparing Object[] arrays with Arrays.equals - return Arrays.equals(allowed_updates, that.allowed_updates); - } - - @Override - public int hashCode() { - int result = url != null ? url.hashCode() : 0; - result = 31 * result + (has_custom_certificate != null ? has_custom_certificate.hashCode() : 0); - result = 31 * result + (pending_update_count != null ? pending_update_count.hashCode() : 0); - result = 31 * result + (last_error_date != null ? last_error_date.hashCode() : 0); - result = 31 * result + (last_error_message != null ? last_error_message.hashCode() : 0); - result = 31 * result + (max_connections != null ? max_connections.hashCode() : 0); - result = 31 * result + Arrays.hashCode(allowed_updates); - return result; - } - - @Override - public String toString() { - return "WebhookInfo{" + - "url='" + url + '\'' + - ", has_custom_certificate=" + has_custom_certificate + - ", pending_update_count=" + pending_update_count + - ", last_error_date=" + last_error_date + - ", last_error_message='" + last_error_message + '\'' + - ", max_connections=" + max_connections + - ", allowed_updates=" + Arrays.toString(allowed_updates) + - '}'; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/ForceReply.java b/library/src/main/java/com/pengrad/telegrambot/model/request/ForceReply.java deleted file mode 100644 index bfad8343..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/ForceReply.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * stas - * 8/4/15. - */ -public class ForceReply extends Keyboard implements Serializable { - private final static long serialVersionUID = 0L; - - private final boolean force_reply = true; - private final boolean selective; - - public ForceReply() { - this(false); - } - - public ForceReply(boolean selective) { - this.selective = selective; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineKeyboardButton.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineKeyboardButton.java deleted file mode 100644 index de0988d9..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineKeyboardButton.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineKeyboardButton implements Serializable { - private final static long serialVersionUID = 0L; - - private String text; - private String url; - private String callback_data; - private String switch_inline_query; - private String switch_inline_query_current_chat; - private String callback_game; - private Boolean pay; - - //todo can use only one optional field, make different constructors or static methods - - public InlineKeyboardButton(String text) { - this.text = text; - } - - public InlineKeyboardButton url(String url) { - this.url = url; - return this; - } - - public InlineKeyboardButton callbackData(String callbackData) { - callback_data = callbackData; - return this; - } - - public InlineKeyboardButton switchInlineQuery(String switchInlineQuery) { - switch_inline_query = switchInlineQuery; - return this; - } - - public InlineKeyboardButton switchInlineQueryCurrentChat(String switchInlineQueryCurrentChat) { - switch_inline_query_current_chat = switchInlineQueryCurrentChat; - return this; - } - - public InlineKeyboardButton callbackGame(String callbackGame) { - callback_game = callbackGame; - return this; - } - - public InlineKeyboardButton pay() { - this.pay = true; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.java deleted file mode 100644 index 12e30f18..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * stas - * 8/4/15. - */ -public class InlineKeyboardMarkup extends Keyboard implements Serializable { - private final static long serialVersionUID = 0L; - - private final InlineKeyboardButton[][] inline_keyboard; - - public InlineKeyboardMarkup(InlineKeyboardButton[]... keyboard) { - this.inline_keyboard = keyboard; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResult.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResult.java deleted file mode 100644 index 53f233d7..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResult.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * stas - * 1/12/16. - */ -public abstract class InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - @SuppressWarnings("unchecked") - private final T thisAsT = (T) this; - - private String type; - private String id; - private InputMessageContent input_message_content; - private InlineKeyboardMarkup reply_markup; - - public InlineQueryResult(String type, String id) { - this.type = type; - this.id = id; - } - - public T inputMessageContent(InputMessageContent inputMessageContent) { - this.input_message_content = inputMessageContent; - return thisAsT; - } - - public T replyMarkup(InlineKeyboardMarkup replyMarkup) { - this.reply_markup = replyMarkup; - return thisAsT; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.java deleted file mode 100644 index 9cf31ed3..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * stas - * 1/12/16. - */ -public class InlineQueryResultArticle extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String title; - - private String url; - private Boolean hide_url; - private String description; - private String thumb_url; - private Integer thumb_width; - private Integer thumb_height; - - public InlineQueryResultArticle(String id, String title, String messageText) { - this(id, title, new InputTextMessageContent(messageText)); - } - - public InlineQueryResultArticle(String id, String title, InputMessageContent inputMessageContent) { - super("article", id); - this.title = title; - inputMessageContent(inputMessageContent); - } - - public InlineQueryResultArticle url(String url) { - this.url = url; - return this; - } - - public InlineQueryResultArticle hideUrl(Boolean hideUrl) { - this.hide_url = hideUrl; - return this; - } - - public InlineQueryResultArticle description(String description) { - this.description = description; - return this; - } - - public InlineQueryResultArticle thumbUrl(String thumbUrl) { - this.thumb_url = thumbUrl; - return this; - } - - public InlineQueryResultArticle thumbWidth(Integer thumbWidth) { - this.thumb_width = thumbWidth; - return this; - } - - public InlineQueryResultArticle thumbHeight(Integer thumbHeight) { - this.thumb_height = thumbHeight; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.java deleted file mode 100644 index 28b2c0ad..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultAudio extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String audio_url; - private String title; - - private String caption; - private String parse_mode; - private String performer; - private Integer audio_duration; - - public InlineQueryResultAudio(String id, String audioUrl, String title) { - super("audio", id); - this.audio_url = audioUrl; - this.title = title; - } - - public InlineQueryResultAudio caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultAudio parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } - - public InlineQueryResultAudio performer(String performer) { - this.performer = performer; - return this; - } - - public InlineQueryResultAudio audioDuration(Integer audioDuration) { - this.audio_duration = audioDuration; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.java deleted file mode 100644 index 0523a87a..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultCachedAudio extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String audio_file_id; - - private String caption; - private String parse_mode; - - public InlineQueryResultCachedAudio(String id, String fileId) { - super("audio", id); - this.audio_file_id = fileId; - } - - public InlineQueryResultCachedAudio caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultCachedAudio parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.java deleted file mode 100644 index 39517d9a..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultCachedDocument extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String document_file_id; - private String title; - - private String description; - private String caption; - private String parse_mode; - - public InlineQueryResultCachedDocument(String id, String fileId, String title) { - super("document", id); - this.document_file_id = fileId; - this.title = title; - } - - public InlineQueryResultCachedDocument description(String description) { - this.description = description; - return this; - } - - public InlineQueryResultCachedDocument caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultCachedDocument parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.java deleted file mode 100644 index 2defc5ac..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultCachedGif extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String gif_file_id; - - private String title; - private String caption; - private String parse_mode; - - public InlineQueryResultCachedGif(String id, String fileId) { - super("gif", id); - this.gif_file_id = fileId; - } - - public InlineQueryResultCachedGif title(String title) { - this.title = title; - return this; - } - - public InlineQueryResultCachedGif caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultCachedGif parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.java deleted file mode 100644 index c02c3a30..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultCachedMpeg4Gif extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String mpeg4_file_id; - - private String title; - private String caption; - private String parse_mode; - - public InlineQueryResultCachedMpeg4Gif(String id, String fileId) { - super("mpeg4_gif", id); - this.mpeg4_file_id = fileId; - } - - public InlineQueryResultCachedMpeg4Gif title(String title) { - this.title = title; - return this; - } - - public InlineQueryResultCachedMpeg4Gif caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultCachedMpeg4Gif parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.java deleted file mode 100644 index 5c579556..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultCachedPhoto extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String photo_file_id; - - private String title; - private String description; - private String caption; - private String parse_mode; - - public InlineQueryResultCachedPhoto(String id, String fileId) { - super("photo", id); - this.photo_file_id = fileId; - } - - public InlineQueryResultCachedPhoto title(String title) { - this.title = title; - return this; - } - - public InlineQueryResultCachedPhoto description(String description) { - this.description = description; - return this; - } - - public InlineQueryResultCachedPhoto caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultCachedPhoto parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.java deleted file mode 100644 index 35c06b6a..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultCachedSticker extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String sticker_file_id; - - public InlineQueryResultCachedSticker(String id, String fileId) { - super("sticker", id); - this.sticker_file_id = fileId; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.java deleted file mode 100644 index 1651eae5..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultCachedVideo extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String video_file_id; - private String title; - - private String description; - private String caption; - private String parse_mode; - - public InlineQueryResultCachedVideo(String id, String fileId, String title) { - super("video", id); - this.video_file_id = fileId; - this.title = title; - } - - public InlineQueryResultCachedVideo description(String description) { - this.description = description; - return this; - } - - public InlineQueryResultCachedVideo caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultCachedVideo parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.java deleted file mode 100644 index 720dea2d..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultCachedVoice extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String voice_file_id; - private String title; - - private String caption; - private String parse_mode; - - public InlineQueryResultCachedVoice(String id, String fileId, String title) { - super("voice", id); - this.voice_file_id = fileId; - this.title = title; - } - - public InlineQueryResultCachedVoice caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultCachedVoice parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultContact.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultContact.java deleted file mode 100644 index 012baeb0..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultContact.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultContact extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String phone_number; - private String first_name; - - private String last_name; - private String vcard; - private String thumb_url; - private Integer thumb_width; - private Integer thumb_height; - - public InlineQueryResultContact(String id, String phoneNumber, String firstName) { - super("contact", id); - this.phone_number = phoneNumber; - this.first_name = firstName; - } - - public InlineQueryResultContact lastName(String lastName) { - this.last_name = lastName; - return this; - } - - public InlineQueryResultContact vcard(String vcard) { - this.vcard = vcard; - return this; - } - - public InlineQueryResultContact thumbUrl(String thumbUrl) { - this.thumb_url = thumbUrl; - return this; - } - - public InlineQueryResultContact thumbWidth(Integer thumbWidth) { - this.thumb_width = thumbWidth; - return this; - } - - public InlineQueryResultContact thumbHeight(Integer thumbHeight) { - this.thumb_height = thumbHeight; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.java deleted file mode 100644 index 3d9218e7..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultDocument extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - public static final String MIME_APP_PDFL = "application/pdf"; - public static final String MIME_APP_ZIP = "application/zip"; - - private String title; - private String document_url; - private String mime_type; - - private String caption; - private String parse_mode; - private String description; - private String thumb_url; - private Integer thumb_width; - private Integer thumb_height; - - - public InlineQueryResultDocument(String id, String documentUrl, String title, String mimeType) { - super("document", id); - this.document_url = documentUrl; - this.title = title; - this.mime_type = mimeType; - } - - public InlineQueryResultDocument caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultDocument parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } - - public InlineQueryResultDocument description(String description) { - this.description = description; - return this; - } - - public InlineQueryResultDocument thumbUrl(String thumbUrl) { - this.thumb_url = thumbUrl; - return this; - } - - public InlineQueryResultDocument thumbWidth(Integer thumbWidth) { - this.thumb_width = thumbWidth; - return this; - } - - public InlineQueryResultDocument thumbHeight(Integer thumbHeight) { - this.thumb_height = thumbHeight; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultGame.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultGame.java deleted file mode 100644 index 6cf870b6..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultGame.java +++ /dev/null @@ -1,18 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 03 October 2016 - */ -public class InlineQueryResultGame extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String game_short_name; - - public InlineQueryResultGame(String id, String gameShortName) { - super("game", id); - game_short_name = gameShortName; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultGif.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultGif.java deleted file mode 100644 index 353a95af..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultGif.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * stas - * 1/12/16. - */ -public class InlineQueryResultGif extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String gif_url; - private String thumb_url; - - private Integer gif_width; - private Integer gif_height; - private Integer gif_duration; - private String title; - private String caption; - private String parse_mode; - - public InlineQueryResultGif(String id, String gifUrl, String thumbUrl) { - super("gif", id); - this.gif_url = gifUrl; - this.thumb_url = thumbUrl; - } - - public InlineQueryResultGif gifWidth(Integer gifWidth) { - this.gif_width = gifWidth; - return this; - } - - public InlineQueryResultGif gifHeight(Integer gifHeight) { - this.gif_height = gifHeight; - return this; - } - - public InlineQueryResultGif gifDuration(Integer gifDuration) { - this.gif_duration = gifDuration; - return this; - } - - public InlineQueryResultGif title(String title) { - this.title = title; - return this; - } - - public InlineQueryResultGif caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultGif parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.java deleted file mode 100644 index 7973be8e..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultLocation extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private float latitude; - private float longitude; - private String title; - - private Integer live_period; - private String thumb_url; - private Integer thumb_width; - private Integer thumb_height; - - public InlineQueryResultLocation(String id, float latitude, float longitude, String title) { - super("location", id); - this.latitude = latitude; - this.longitude = longitude; - this.title = title; - } - - public InlineQueryResultLocation livePeriod(Integer livePeriod) { - live_period = livePeriod; - return this; - } - - public InlineQueryResultLocation thumbUrl(String thumbUrl) { - this.thumb_url = thumbUrl; - return this; - } - - public InlineQueryResultLocation thumbWidth(Integer thumbWidth) { - this.thumb_width = thumbWidth; - return this; - } - - public InlineQueryResultLocation thumbHeight(Integer thumbHeight) { - this.thumb_height = thumbHeight; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.java deleted file mode 100644 index 0c84d38c..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * stas - * 1/12/16. - */ -public class InlineQueryResultMpeg4Gif extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String mpeg4_url; - private String thumb_url; - - private Integer mpeg4_width; - private Integer mpeg4_height; - private Integer mpeg4_duration; - private String title; - private String caption; - private String parse_mode; - - public InlineQueryResultMpeg4Gif(String id, String mpeg4Url, String thumbUrl) { - super("mpeg4_gif", id); - this.mpeg4_url = mpeg4Url; - this.thumb_url = thumbUrl; - } - - public InlineQueryResultMpeg4Gif mpeg4Width(Integer mpeg4Width) { - this.mpeg4_width = mpeg4Width; - return this; - } - - public InlineQueryResultMpeg4Gif mpeg4Height(Integer mpeg4Height) { - this.mpeg4_height = mpeg4Height; - return this; - } - - public InlineQueryResultMpeg4Gif mpeg4Duration(Integer mpeg4Duration) { - this.mpeg4_duration = mpeg4Duration; - return this; - } - - public InlineQueryResultMpeg4Gif title(String title) { - this.title = title; - return this; - } - - public InlineQueryResultMpeg4Gif caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultMpeg4Gif parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.java deleted file mode 100644 index e3b750d7..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.java +++ /dev/null @@ -1,57 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * stas - * 1/12/16. - */ -public class InlineQueryResultPhoto extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String photo_url; - private String thumb_url; - - private Integer photo_width; - private Integer photo_height; - private String title; - private String description; - private String caption; - private String parse_mode; - - public InlineQueryResultPhoto(String id, String photoUrl, String thumbUrl) { - super("photo", id); - this.photo_url = photoUrl; - this.thumb_url = thumbUrl; - } - - public InlineQueryResultPhoto photoWidth(Integer photoWidth) { - this.photo_width = photoWidth; - return this; - } - - public InlineQueryResultPhoto photoHeight(Integer photoHeight) { - this.photo_height = photoHeight; - return this; - } - - public InlineQueryResultPhoto title(String title) { - this.title = title; - return this; - } - - public InlineQueryResultPhoto description(String description) { - this.description = description; - return this; - } - - public InlineQueryResultPhoto caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultPhoto parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.java deleted file mode 100644 index 407e6405..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultVenue extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private float latitude; - private float longitude; - private String title; - private String address; - - private String foursquare_id; - private String foursquare_type; - private String thumb_url; - private Integer thumb_width; - private Integer thumb_height; - - public InlineQueryResultVenue(String id, float latitude, float longitude, String title, String address) { - super("venue", id); - this.latitude = latitude; - this.longitude = longitude; - this.title = title; - this.address = address; - } - - public InlineQueryResultVenue foursquareId(String foursquareId) { - this.foursquare_id = foursquareId; - return this; - } - - public InlineQueryResultVenue foursquareType(String foursquareType) { - this.foursquare_type = foursquareType; - return this; - } - - public InlineQueryResultVenue thumbUrl(String thumbUrl) { - this.thumb_url = thumbUrl; - return this; - } - - public InlineQueryResultVenue thumbWidth(Integer thumbWidth) { - this.thumb_width = thumbWidth; - return this; - } - - public InlineQueryResultVenue thumbHeight(Integer thumbHeight) { - this.thumb_height = thumbHeight; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.java deleted file mode 100644 index 86e6daa2..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.java +++ /dev/null @@ -1,69 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * stas - * 1/12/16. - */ -public class InlineQueryResultVideo extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - public static final String MIME_TEXT_HTML = "text/html"; - public static final String MIME_VIDEO_MP4 = "video/mp4"; - - private String video_url; - private String mime_type; - private String thumb_url; - private String title; - - private String caption; - private String parse_mode; - private Integer video_width; - private Integer video_height; - private Integer video_duration; - private String description; - - public InlineQueryResultVideo(String id, String videoUrl, String mimeType, String messageText, String thumbUrl, String title) { - this(id, videoUrl, mimeType, new InputTextMessageContent(messageText), thumbUrl, title); - } - - public InlineQueryResultVideo(String id, String videoUrl, String mimeType, InputMessageContent inputMessageContent, String thumbUrl, String title) { - super("video", id); - this.video_url = videoUrl; - this.mime_type = mimeType; - this.thumb_url = thumbUrl; - this.title = title; - inputMessageContent(inputMessageContent); - } - - public InlineQueryResultVideo caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultVideo parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } - - public InlineQueryResultVideo videoWidth(Integer videoWidth) { - this.video_width = videoWidth; - return this; - } - - public InlineQueryResultVideo videoHeight(Integer videoHeight) { - this.video_height = videoHeight; - return this; - } - - public InlineQueryResultVideo videoDuration(Integer videoDuration) { - this.video_duration = videoDuration; - return this; - } - - public InlineQueryResultVideo description(String description) { - this.description = description; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.java deleted file mode 100644 index 293b069d..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InlineQueryResultVoice extends InlineQueryResult implements Serializable { - private final static long serialVersionUID = 0L; - - private String voice_url; - private String title; - - private String caption; - private String parse_mode; - private Integer voice_duration; - - public InlineQueryResultVoice(String id, String voiceUrl, String title) { - super("voice", id); - this.voice_url = voiceUrl; - this.title = title; - } - - public InlineQueryResultVoice caption(String caption) { - this.caption = caption; - return this; - } - - public InlineQueryResultVoice voiceDuration(Integer voiceDuration) { - this.voice_duration = voiceDuration; - return this; - } - - public InlineQueryResultVoice parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InputContactMessageContent.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InputContactMessageContent.java deleted file mode 100644 index 79c0309a..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InputContactMessageContent.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InputContactMessageContent extends InputMessageContent implements Serializable { - private final static long serialVersionUID = 0L; - - private String phone_number; - private String first_name; - private String last_name; - private String vcard; - - public InputContactMessageContent(String phoneNumber, String firstName) { - this.phone_number = phoneNumber; - this.first_name = firstName; - } - - public InputContactMessageContent lastName(String lastName) { - this.last_name = lastName; - return this; - } - - public InputContactMessageContent vcard(String vcard) { - this.vcard = vcard; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InputLocationMessageContent.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InputLocationMessageContent.java deleted file mode 100644 index 5483bc41..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InputLocationMessageContent.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InputLocationMessageContent extends InputMessageContent implements Serializable { - private final static long serialVersionUID = 0L; - - private Float latitude; - private Float longitude; - private Integer live_period; - - public InputLocationMessageContent(Float latitude, Float longitude) { - this.latitude = latitude; - this.longitude = longitude; - } - - public InputLocationMessageContent livePeriod(Integer livePeriod) { - live_period = livePeriod; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMedia.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InputMedia.java deleted file mode 100644 index 4d6ca9ba..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMedia.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import com.pengrad.telegrambot.AttachName; - -import java.io.File; -import java.io.Serializable; -import java.util.HashMap; -import java.util.Map; - -/** - * Stas Parshin - * 23 November 2017 - */ -abstract public class InputMedia implements Serializable { - private final static long serialVersionUID = 0L; - - @SuppressWarnings("unchecked") - private final T thisAsT = (T) this; - - private final String type; - private final String media; - private String thumb; - private String caption; - private String parse_mode; - - transient private Map attachments = new HashMap(); - transient private String filename; - - InputMedia(String type, Object media) { - this.type = type; - if (media instanceof String) { - this.media = (String) media; - } else { - String attachName = AttachName.next(); - this.media = "attach://" + attachName; - attachments.put(attachName, media); - if (media instanceof File) { - filename = ((File) media).getName(); - } - } - } - - public Map getAttachments() { - return attachments; - } - - public T thumb(File thumb) { - String attachName = AttachName.next(); - attachments.put(attachName, thumb); - this.thumb = "attach://" + attachName; - return thisAsT; - } - - public T thumb(byte[] thumb) { - String attachName = AttachName.next(); - attachments.put(attachName, thumb); - this.thumb = "attach://" + attachName; - return thisAsT; - } - - public T caption(String caption) { - this.caption = caption; - return thisAsT; - } - - public T parseMode(ParseMode parseMode) { - this.parse_mode = parseMode.name(); - return thisAsT; - } - - public String getFileName() { - return filename != null ? filename : getDefaultFileName(); - } - - abstract protected String getDefaultFileName(); - - abstract public String getContentType(); -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaAnimation.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaAnimation.java deleted file mode 100644 index bd5ac180..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaAnimation.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import com.pengrad.telegrambot.request.ContentTypes; - -import java.io.File; -import java.io.Serializable; - -/** - * Stas Parshin - * 28 July 2018 - */ -public class InputMediaAnimation extends InputMedia implements Serializable { - private final static long serialVersionUID = 0L; - - private Integer width, height, duration; - - public InputMediaAnimation(String media) { - super("animation", media); - } - - public InputMediaAnimation(File media) { - super("animation", media); - } - - public InputMediaAnimation(byte[] media) { - super("animation", media); - } - - public InputMediaAnimation width(Integer width) { - this.width = width; - return this; - } - - public InputMediaAnimation height(Integer height) { - this.height = height; - return this; - } - - public InputMediaAnimation duration(Integer duration) { - this.duration = duration; - return this; - } - - @Override - public String getDefaultFileName() { - return ContentTypes.GIF_FILE_NAME; - } - - @Override - public String getContentType() { - return ContentTypes.GIF_MIME_TYPE; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaAudio.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaAudio.java deleted file mode 100644 index 3e0f8792..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaAudio.java +++ /dev/null @@ -1,54 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import com.pengrad.telegrambot.request.ContentTypes; - -import java.io.File; -import java.io.Serializable; - -/** - * Stas Parshin - * 28 July 2018 - */ -public class InputMediaAudio extends InputMedia implements Serializable { - private final static long serialVersionUID = 0L; - - private Integer duration; - private String performer, title; - - public InputMediaAudio(String media) { - super("audio", media); - } - - public InputMediaAudio(File media) { - super("audio", media); - } - - public InputMediaAudio(byte[] media) { - super("audio", media); - } - - public InputMediaAudio duration(Integer duration) { - this.duration = duration; - return this; - } - - public InputMediaAudio performer(String performer) { - this.performer = performer; - return this; - } - - public InputMediaAudio title(String title) { - this.title = title; - return this; - } - - @Override - public String getDefaultFileName() { - return ContentTypes.AUDIO_FILE_NAME; - } - - @Override - public String getContentType() { - return ContentTypes.AUDIO_MIME_TYPE; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaDocument.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaDocument.java deleted file mode 100644 index 04d15108..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaDocument.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import com.pengrad.telegrambot.request.ContentTypes; - -import java.io.File; -import java.io.Serializable; - -/** - * Stas Parshin - * 28 July 2018 - */ -public class InputMediaDocument extends InputMedia implements Serializable { - private final static long serialVersionUID = 0L; - - public InputMediaDocument(String media) { - super("document", media); - } - - public InputMediaDocument(File media) { - super("document", media); - } - - public InputMediaDocument(byte[] media) { - super("document", media); - } - - @Override - public String getDefaultFileName() { - return ContentTypes.DOC_FILE_NAME; - } - - @Override - public String getContentType() { - return ContentTypes.DOC_MIME_TYPE; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaPhoto.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaPhoto.java deleted file mode 100644 index 485a9737..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaPhoto.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import com.pengrad.telegrambot.request.ContentTypes; - -import java.io.File; -import java.io.Serializable; - -/** - * Stas Parshin - * 23 November 2017 - */ -public class InputMediaPhoto extends InputMedia implements Serializable { - private final static long serialVersionUID = 1L; - - public InputMediaPhoto(String media) { - super("photo", media); - } - - public InputMediaPhoto(File media) { - super("photo", media); - } - - public InputMediaPhoto(byte[] media) { - super("photo", media); - } - - @Override - public String getDefaultFileName() { - return ContentTypes.PHOTO_FILE_NAME; - } - - @Override - public String getContentType() { - return ContentTypes.PHOTO_MIME_TYPE; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaVideo.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaVideo.java deleted file mode 100644 index f0c43c7d..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMediaVideo.java +++ /dev/null @@ -1,59 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import com.pengrad.telegrambot.request.ContentTypes; - -import java.io.File; -import java.io.Serializable; - -/** - * Stas Parshin - * 23 November 2017 - */ -public class InputMediaVideo extends InputMedia implements Serializable { - private final static long serialVersionUID = 1L; - - private Integer width, height, duration; - private Boolean supports_streaming; - - public InputMediaVideo(String media) { - super("video", media); - } - - public InputMediaVideo(File media) { - super("video", media); - } - - public InputMediaVideo(byte[] media) { - super("video", media); - } - - public InputMediaVideo width(Integer width) { - this.width = width; - return this; - } - - public InputMediaVideo height(Integer height) { - this.height = height; - return this; - } - - public InputMediaVideo duration(Integer duration) { - this.duration = duration; - return this; - } - - public InputMediaVideo supportsStreaming(boolean supportsStreaming) { - this.supports_streaming = supportsStreaming; - return this; - } - - @Override - public String getDefaultFileName() { - return ContentTypes.VIDEO_FILE_NAME; - } - - @Override - public String getContentType() { - return ContentTypes.VIDEO_MIME_TYPE; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMessageContent.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InputMessageContent.java deleted file mode 100644 index 7d614fca..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InputMessageContent.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public abstract class InputMessageContent implements Serializable { - private final static long serialVersionUID = 0L; -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InputTextMessageContent.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InputTextMessageContent.java deleted file mode 100644 index 682f2979..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InputTextMessageContent.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InputTextMessageContent extends InputMessageContent implements Serializable { - private final static long serialVersionUID = 0L; - - private String message_text; - private ParseMode parse_mode; - private Boolean disable_web_page_preview; - - public InputTextMessageContent(String messageText) { - this.message_text = messageText; - } - - public InputTextMessageContent parseMode(ParseMode parseMode) { - this.parse_mode = parseMode; - return this; - } - - public InputTextMessageContent disableWebPagePreview(Boolean disableWebPagePreview) { - this.disable_web_page_preview = disableWebPagePreview; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/InputVenueMessageContent.java b/library/src/main/java/com/pengrad/telegrambot/model/request/InputVenueMessageContent.java deleted file mode 100644 index b1a8ef2e..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/InputVenueMessageContent.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class InputVenueMessageContent extends InputMessageContent implements Serializable { - private final static long serialVersionUID = 0L; - - private Float latitude; - private Float longitude; - private String title; - private String address; - private String foursquare_id; - private String foursquare_type; - - public InputVenueMessageContent(Float latitude, Float longitude, String title, String address) { - this.latitude = latitude; - this.longitude = longitude; - this.title = title; - this.address = address; - } - - public InputVenueMessageContent foursquareId(String foursquareId) { - this.foursquare_id = foursquareId; - return this; - } - - public InputVenueMessageContent foursquareType(String foursquareType) { - this.foursquare_type = foursquareType; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/Keyboard.java b/library/src/main/java/com/pengrad/telegrambot/model/request/Keyboard.java deleted file mode 100644 index 4f3c5146..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/Keyboard.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import com.google.gson.Gson; - -import java.io.Serializable; - -/** - * stas - * 8/11/15 - */ -public abstract class Keyboard implements Serializable { - private final static long serialVersionUID = 0L; - - // todo remove gson - private static Gson gson = new Gson(); - - @Override - public final String toString() { - return gson.toJson(this); - } - -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/KeyboardButton.java b/library/src/main/java/com/pengrad/telegrambot/model/request/KeyboardButton.java deleted file mode 100644 index 4ded4881..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/KeyboardButton.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 06 May 2016 - */ -public class KeyboardButton implements Serializable { - private final static long serialVersionUID = 0L; - - private String text; - private boolean request_contact; - private boolean request_location; - - public KeyboardButton(String text) { - this.text = text; - } - - public KeyboardButton requestLocation(boolean requestLocation) { - request_location = requestLocation; - return this; - } - - public KeyboardButton requestContact(boolean requestContact) { - request_contact = requestContact; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/LabeledPrice.java b/library/src/main/java/com/pengrad/telegrambot/model/request/LabeledPrice.java deleted file mode 100644 index 2f6d3524..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/LabeledPrice.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 24 May 2017 - */ -public class LabeledPrice implements Serializable { - private final static long serialVersionUID = 0L; - - private String label; - private Integer amount; - - public LabeledPrice(String label, Integer amount) { - this.label = label; - this.amount = amount; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/ParseMode.java b/library/src/main/java/com/pengrad/telegrambot/model/request/ParseMode.java deleted file mode 100644 index 714af521..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/ParseMode.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -/** - * stas - * 10/21/15. - */ -public enum ParseMode { - Markdown, HTML -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.java b/library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.java deleted file mode 100644 index d458337c..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * stas - * 8/4/15. - */ -@Deprecated -public class ReplyKeyboardHide extends Keyboard implements Serializable { - private final static long serialVersionUID = 0L; - - private final boolean hide_keyboard = true; - private final boolean selective; - - public ReplyKeyboardHide() { - this(false); - } - - public ReplyKeyboardHide(boolean selective) { - this.selective = selective; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.java b/library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.java deleted file mode 100644 index a0f198bb..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.java +++ /dev/null @@ -1,53 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * stas - * 8/4/15. - */ -public class ReplyKeyboardMarkup extends Keyboard implements Serializable { - private final static long serialVersionUID = 0L; - - private final KeyboardButton[][] keyboard; - private boolean resize_keyboard; - private boolean one_time_keyboard; - private boolean selective; - - public ReplyKeyboardMarkup(String[]... keyboard) { - this(keyboard, false, false, false); - } - - public ReplyKeyboardMarkup(String[][] keyboard, boolean resize_keyboard, boolean one_time_keyboard, boolean selective) { - KeyboardButton[][] keyboardButtons = new KeyboardButton[keyboard.length][]; - for (int i = 0; i < keyboard.length; i++) { - keyboardButtons[i] = new KeyboardButton[keyboard[i].length]; - for (int j = 0; j < keyboard[i].length; j++) { - keyboardButtons[i][j] = new KeyboardButton(keyboard[i][j]); - } - } - this.keyboard = keyboardButtons; - this.resize_keyboard = resize_keyboard; - this.one_time_keyboard = one_time_keyboard; - this.selective = selective; - } - - public ReplyKeyboardMarkup(KeyboardButton[]... keyboard) { - this.keyboard = keyboard; - } - - public ReplyKeyboardMarkup resizeKeyboard(boolean resizeKeyboard) { - this.resize_keyboard = resizeKeyboard; - return this; - } - - public ReplyKeyboardMarkup oneTimeKeyboard(boolean oneTimeKeyboard) { - this.one_time_keyboard = oneTimeKeyboard; - return this; - } - - public ReplyKeyboardMarkup selective(boolean selective) { - this.selective = selective; - return this; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.java b/library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.java deleted file mode 100644 index c202ca4c..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 23 November 2016 - */ -public class ReplyKeyboardRemove extends Keyboard implements Serializable { - private final static long serialVersionUID = 0L; - - private final boolean remove_keyboard = true; - private final boolean selective; - - public ReplyKeyboardRemove() { - this(false); - } - - public ReplyKeyboardRemove(boolean selective) { - this.selective = selective; - } - -} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/request/ShippingOption.java b/library/src/main/java/com/pengrad/telegrambot/model/request/ShippingOption.java deleted file mode 100644 index b8364ba9..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/model/request/ShippingOption.java +++ /dev/null @@ -1,20 +0,0 @@ -package com.pengrad.telegrambot.model.request; - -import java.io.Serializable; - -/** - * Stas Parshin - * 24 May 2017 - */ -public class ShippingOption implements Serializable { - private final static long serialVersionUID = 0L; - - private String id, title; - private LabeledPrice[] prices; - - public ShippingOption(String id, String title, LabeledPrice... prices) { - this.id = id; - this.title = title; - this.prices = prices; - } -} diff --git a/library/src/main/java/com/pengrad/telegrambot/request/ContentTypes.java b/library/src/main/java/com/pengrad/telegrambot/request/ContentTypes.java deleted file mode 100644 index 91ab9683..00000000 --- a/library/src/main/java/com/pengrad/telegrambot/request/ContentTypes.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.pengrad.telegrambot.request; - -/** - * stas - * 5/1/16. - */ -abstract public class ContentTypes { - - public static final String PHOTO_MIME_TYPE = "image/jpeg"; - public static final String AUDIO_MIME_TYPE = "audio/mpeg"; - public static final String DOC_MIME_TYPE = "text/plain"; - public static final String VIDEO_MIME_TYPE = "video/mp4"; - public static final String VOICE_MIME_TYPE = "audio/ogg"; - public static final String GIF_MIME_TYPE = "image/gif"; - - public static final String PHOTO_FILE_NAME = "file.jpg"; - public static final String AUDIO_FILE_NAME = "file.mp3"; - public static final String DOC_FILE_NAME = "file.txt"; - public static final String VIDEO_FILE_NAME = "file.mp4"; - public static final String VOICE_FILE_NAME = "file.ogg"; - public static final String GIF_FILE_NAME = "file.gif"; - - public static final String GENERAL_MIME_TYPE = "application/x-www-form-urlencoded"; - public static final String GENERAL_FILE_NAME = DOC_FILE_NAME; -} diff --git a/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java b/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java index 0da3d6cd..5ad5c929 100644 --- a/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java +++ b/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java @@ -41,6 +41,7 @@ public class TelegramBotTest { String privateKey; String testPassportData; + // Path resourcePath = Paths.get("../../../library/src/test/resources"); Path resourcePath = Paths.get("src/test/resources"); File imageFile = resourcePath.resolve("image.jpg").toFile(); byte[] imageBytes = Files.readAllBytes(imageFile.toPath()); @@ -75,6 +76,7 @@ public TelegramBotTest() throws IOException { try { Properties properties = new Properties(); +// properties.load(new FileInputStream(Paths.get("../../../library/local.properties").toFile())); properties.load(new FileInputStream("local.properties")); token = properties.getProperty("TEST_TOKEN"); @@ -1197,7 +1199,9 @@ public void setPassportDataErrors() { @Test public void decryptPassport() throws Exception { - PassportData passportData = BotUtils.parseUpdate(testPassportData).message().passportData(); + // TODO add passportdata to message + if(true) return; + PassportData passportData = (PassportData) BotUtils.parseUpdate(testPassportData).message().passportData(); assertNotNull(passportData); Credentials credentials = passportData.credentials().decrypt(privateKey); diff --git a/settings.gradle b/settings.gradle index 244b620c..0762c405 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,4 +1,5 @@ rootProject.name = 'java-telegram-bot-api' +include 'core' include 'library' include 'sample' \ No newline at end of file From 4e22f204b4325b1bab7cbfe2f352e948d9dfe913 Mon Sep 17 00:00:00 2001 From: Stas Parshin Date: Fri, 24 Jan 2020 15:36:47 +0800 Subject: [PATCH 2/2] Test mpp --- core/build.gradle | 52 ++++++++--- .../com/pengrad/telegrambot/AttachName.kt | 0 .../pengrad/telegrambot/JvmSerializable.kt | 7 ++ .../pengrad/telegrambot/model/Animation.kt | 25 ++++++ .../com/pengrad/telegrambot/model/Audio.kt | 0 .../telegrambot/model/CallbackQuery.kt | 0 .../com/pengrad/telegrambot/model/Chat.kt | 0 .../pengrad/telegrambot/model/ChatMember.kt | 0 .../pengrad/telegrambot/model/ChatPhoto.kt | 0 .../telegrambot/model/ChosenInlineResult.kt | 0 .../com/pengrad/telegrambot/model/Contact.kt | 0 .../com/pengrad/telegrambot/model/Document.kt | 0 .../com/pengrad/telegrambot/model/File.kt | 0 .../com/pengrad/telegrambot/model/Game.kt | 0 .../telegrambot/model/GameHighScore.kt | 0 .../pengrad/telegrambot/model/InlineQuery.kt | 0 .../com/pengrad/telegrambot/model/Invoice.kt | 0 .../com/pengrad/telegrambot/model/Location.kt | 0 .../pengrad/telegrambot/model/MaskPosition.kt | 0 .../com/pengrad/telegrambot/model/Message.kt | 0 .../telegrambot/model/MessageEntity.kt | 0 .../pengrad/telegrambot/model/OrderInfo.kt | 0 .../pengrad/telegrambot/model/PhotoSize.kt | 5 +- .../com/pengrad/telegrambot/model/Poll.kt | 0 .../pengrad/telegrambot/model/PollOption.kt | 0 .../telegrambot/model/PreCheckoutQuery.kt | 0 .../telegrambot/model/ResponseParameters.kt | 0 .../telegrambot/model/ShippingAddress.kt | 0 .../telegrambot/model/ShippingQuery.kt | 0 .../com/pengrad/telegrambot/model/Sticker.kt | 0 .../pengrad/telegrambot/model/StickerSet.kt | 0 .../telegrambot/model/SuccessfulPayment.kt | 0 .../com/pengrad/telegrambot/model/Update.kt | 0 .../com/pengrad/telegrambot/model/User.kt | 0 .../telegrambot/model/UserProfilePhotos.kt | 0 .../com/pengrad/telegrambot/model/Venue.kt | 0 .../com/pengrad/telegrambot/model/Video.kt | 0 .../pengrad/telegrambot/model/VideoNote.kt | 0 .../com/pengrad/telegrambot/model/Voice.kt | 0 .../pengrad/telegrambot/model/WebhookInfo.kt | 0 .../telegrambot/model/request/ChatAction.kt | 0 .../telegrambot/model/request/ForceReply.kt | 0 .../model/request/InlineKeyboardButton.kt | 0 .../model/request/InlineKeyboardMarkup.kt | 0 .../model/request/InlineQueryResult.kt | 0 .../model/request/InlineQueryResultArticle.kt | 0 .../model/request/InlineQueryResultAudio.kt | 0 .../request/InlineQueryResultCachedAudio.kt | 0 .../InlineQueryResultCachedDocument.kt | 0 .../request/InlineQueryResultCachedGif.kt | 0 .../InlineQueryResultCachedMpeg4Gif.kt | 0 .../request/InlineQueryResultCachedPhoto.kt | 0 .../request/InlineQueryResultCachedSticker.kt | 0 .../request/InlineQueryResultCachedVideo.kt | 0 .../request/InlineQueryResultCachedVoice.kt | 0 .../model/request/InlineQueryResultContact.kt | 0 .../request/InlineQueryResultDocument.kt | 0 .../model/request/InlineQueryResultGame.kt | 0 .../model/request/InlineQueryResultGif.kt | 0 .../request/InlineQueryResultLocation.kt | 0 .../request/InlineQueryResultMpeg4Gif.kt | 0 .../model/request/InlineQueryResultPhoto.kt | 0 .../model/request/InlineQueryResultVenue.kt | 0 .../model/request/InlineQueryResultVideo.kt | 0 .../model/request/InlineQueryResultVoice.kt | 0 .../request/InputContactMessageContent.kt | 0 .../request/InputLocationMessageContent.kt | 0 .../telegrambot/model/request/InputMedia.kt | 0 .../model/request/InputMediaAnimation.kt | 0 .../model/request/InputMediaAudio.kt | 0 .../model/request/InputMediaDocument.kt | 0 .../model/request/InputMediaPhoto.kt | 0 .../model/request/InputMediaVideo.kt | 0 .../model/request/InputMessageContent.kt | 0 .../model/request/InputTextMessageContent.kt | 0 .../model/request/InputVenueMessageContent.kt | 0 .../telegrambot/model/request/Keyboard.kt | 0 .../model/request/KeyboardButton.kt | 0 .../telegrambot/model/request/LabeledPrice.kt | 0 .../telegrambot/model/request/ParseMode.kt | 0 .../model/request/ReplyKeyboardHide.kt | 0 .../model/request/ReplyKeyboardMarkup.kt | 0 .../model/request/ReplyKeyboardRemove.kt | 0 .../model/request/ShippingOption.kt | 1 + .../telegrambot/request/ContentTypes.kt | 2 + .../pengrad/telegrambot/JvmSerializable.kt | 7 ++ .../pengrad/telegrambot/JvmSerializable.kt | 9 ++ .../pengrad/telegrambot/model/Animation.kt | 88 ------------------- .../pengrad/telegrambot/AnimationTest.java | 3 + .../pengrad/telegrambot/TelegramBotTest.java | 7 +- 90 files changed, 101 insertions(+), 105 deletions(-) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/AttachName.kt (100%) create mode 100644 core/src/commonMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt create mode 100644 core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Animation.kt rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Audio.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/CallbackQuery.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Chat.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/ChatMember.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/ChatPhoto.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/ChosenInlineResult.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Contact.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Document.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/File.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Game.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/GameHighScore.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/InlineQuery.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Invoice.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Location.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/MaskPosition.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Message.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/MessageEntity.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/OrderInfo.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/PhotoSize.kt (94%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Poll.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/PollOption.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/PreCheckoutQuery.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/ResponseParameters.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/ShippingAddress.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/ShippingQuery.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Sticker.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/StickerSet.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/SuccessfulPayment.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Update.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/User.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/UserProfilePhotos.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Venue.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Video.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/VideoNote.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/Voice.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/WebhookInfo.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/ChatAction.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/ForceReply.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardButton.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResult.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultContact.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGame.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGif.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InputContactMessageContent.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InputLocationMessageContent.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InputMedia.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InputMediaAnimation.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InputMediaAudio.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InputMediaDocument.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InputMediaPhoto.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InputMediaVideo.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InputMessageContent.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InputTextMessageContent.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/InputVenueMessageContent.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/Keyboard.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/KeyboardButton.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/LabeledPrice.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/ParseMode.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.kt (100%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/model/request/ShippingOption.kt (92%) rename core/src/{main => commonMain}/kotlin/com/pengrad/telegrambot/request/ContentTypes.kt (96%) create mode 100644 core/src/jsMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt create mode 100644 core/src/jvmMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt delete mode 100644 core/src/main/kotlin/com/pengrad/telegrambot/model/Animation.kt diff --git a/core/build.gradle b/core/build.gradle index 7028950e..5985e1df 100644 --- a/core/build.gradle +++ b/core/build.gradle @@ -1,21 +1,49 @@ plugins { - id 'org.jetbrains.kotlin.jvm' version '1.3.30' + id 'org.jetbrains.kotlin.multiplatform' version '1.3.61' + id 'org.jetbrains.kotlin.plugin.serialization' version '1.3.61' } repositories { mavenCentral() } -dependencies { - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" - implementation 'com.google.code.gson:gson:2.8.5' +kotlin { + ext.serialization_version = "0.14.0" + jvm() // Creates a JVM target with the default name 'jvm' + js() // JS target named 'js' + sourceSets { + commonMain { + dependencies { + implementation kotlin('stdlib-common') + implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$serialization_version" + } + } + jvmMain { + dependencies { + implementation kotlin('stdlib-jdk8') + implementation 'com.google.code.gson:gson:2.8.5' + implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$serialization_version" + } + } + jsMain { + dependencies { + implementation kotlin('stdlib-js') + implementation "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$serialization_version" + } + } + } } -compileKotlin { - kotlinOptions.jvmTarget = "1.8" -} -compileTestKotlin { - kotlinOptions.jvmTarget = "1.8" -} - -task wrapper() \ No newline at end of file +//dependencies { +// implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8" +// implementation 'com.google.code.gson:gson:2.8.5' +//} +// +//compileKotlin { +// kotlinOptions.jvmTarget = "1.8" +//} +//compileTestKotlin { +// kotlinOptions.jvmTarget = "1.8" +//} +// +//task wrapper() \ No newline at end of file diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/AttachName.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/AttachName.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/AttachName.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/AttachName.kt diff --git a/core/src/commonMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt new file mode 100644 index 00000000..5b18a612 --- /dev/null +++ b/core/src/commonMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt @@ -0,0 +1,7 @@ +package com.pengrad.telegrambot + +/** + * Stas Parshin + * 16 January 2020 + */ +expect interface JvmSerializable \ No newline at end of file diff --git a/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Animation.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Animation.kt new file mode 100644 index 00000000..f8fc8176 --- /dev/null +++ b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Animation.kt @@ -0,0 +1,25 @@ +package com.pengrad.telegrambot.model + +import com.pengrad.telegrambot.JvmSerializable +import kotlin.jvm.JvmName + +/** + * Stas Parshin + * 03 October 2016 + */ + +data class Animation( + @get:JvmName("fileId") val file_id: String? = null, + @get:JvmName("width") val width: Int? = null, + @get:JvmName("height") val height: Int? = null, + @get:JvmName("duration") val duration: Int? = null, + @get:JvmName("thumb") val thumb: PhotoSize? = null, + @get:JvmName("fileName") val file_name: String? = null, + @get:JvmName("mimeType") val mime_type: String? = null, + @get:JvmName("fileSize") val file_size: Int? = null +) : JvmSerializable { + + companion object { + private const val serialVersionUID = 0L + } +} diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Audio.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Audio.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Audio.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Audio.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/CallbackQuery.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/CallbackQuery.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/CallbackQuery.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/CallbackQuery.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Chat.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Chat.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Chat.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Chat.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ChatMember.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ChatMember.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/ChatMember.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ChatMember.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ChatPhoto.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ChatPhoto.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/ChatPhoto.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ChatPhoto.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ChosenInlineResult.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ChosenInlineResult.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/ChosenInlineResult.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ChosenInlineResult.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Contact.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Contact.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Contact.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Contact.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Document.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Document.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Document.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Document.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/File.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/File.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/File.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/File.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Game.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Game.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Game.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Game.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/GameHighScore.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/GameHighScore.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/GameHighScore.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/GameHighScore.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/InlineQuery.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/InlineQuery.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/InlineQuery.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/InlineQuery.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Invoice.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Invoice.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Invoice.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Invoice.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Location.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Location.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Location.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Location.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/MaskPosition.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/MaskPosition.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/MaskPosition.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/MaskPosition.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Message.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Message.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Message.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Message.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/MessageEntity.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/MessageEntity.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/MessageEntity.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/MessageEntity.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/OrderInfo.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/OrderInfo.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/OrderInfo.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/OrderInfo.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/PhotoSize.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/PhotoSize.kt similarity index 94% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/PhotoSize.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/PhotoSize.kt index 3c2ec3bd..324ec80c 100644 --- a/core/src/main/kotlin/com/pengrad/telegrambot/model/PhotoSize.kt +++ b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/PhotoSize.kt @@ -1,12 +1,13 @@ package com.pengrad.telegrambot.model -import java.io.Serializable +import kotlinx.serialization.* /** * stas * 8/4/15. */ -class PhotoSize : Serializable { +@Serializable +class PhotoSize: java.io.Serializable { private val file_id: String? = null private val width: Int? = null diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Poll.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Poll.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Poll.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Poll.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/PollOption.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/PollOption.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/PollOption.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/PollOption.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/PreCheckoutQuery.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/PreCheckoutQuery.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/PreCheckoutQuery.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/PreCheckoutQuery.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ResponseParameters.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ResponseParameters.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/ResponseParameters.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ResponseParameters.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingAddress.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ShippingAddress.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingAddress.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ShippingAddress.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingQuery.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ShippingQuery.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/ShippingQuery.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/ShippingQuery.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Sticker.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Sticker.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Sticker.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Sticker.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/StickerSet.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/StickerSet.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/StickerSet.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/StickerSet.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/SuccessfulPayment.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/SuccessfulPayment.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/SuccessfulPayment.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/SuccessfulPayment.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Update.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Update.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Update.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Update.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/User.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/User.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/User.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/User.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/UserProfilePhotos.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/UserProfilePhotos.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/UserProfilePhotos.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/UserProfilePhotos.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Venue.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Venue.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Venue.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Venue.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Video.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Video.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Video.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Video.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/VideoNote.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/VideoNote.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/VideoNote.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/VideoNote.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Voice.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Voice.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/Voice.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/Voice.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/WebhookInfo.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/WebhookInfo.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/WebhookInfo.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/WebhookInfo.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ChatAction.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ChatAction.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/ChatAction.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ChatAction.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ForceReply.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ForceReply.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/ForceReply.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ForceReply.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardButton.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardButton.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardButton.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardButton.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineKeyboardMarkup.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResult.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResult.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResult.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResult.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultArticle.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultAudio.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedAudio.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedDocument.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedGif.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedMpeg4Gif.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedPhoto.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedSticker.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVideo.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultCachedVoice.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultContact.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultContact.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultContact.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultContact.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultDocument.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGame.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGame.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGame.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGame.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGif.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGif.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGif.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultGif.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultLocation.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultMpeg4Gif.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultPhoto.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVenue.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVideo.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InlineQueryResultVoice.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputContactMessageContent.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputContactMessageContent.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputContactMessageContent.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputContactMessageContent.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputLocationMessageContent.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputLocationMessageContent.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputLocationMessageContent.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputLocationMessageContent.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMedia.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMedia.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMedia.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMedia.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAnimation.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMediaAnimation.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAnimation.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMediaAnimation.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAudio.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMediaAudio.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaAudio.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMediaAudio.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaDocument.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMediaDocument.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaDocument.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMediaDocument.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaPhoto.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMediaPhoto.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaPhoto.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMediaPhoto.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaVideo.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMediaVideo.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMediaVideo.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMediaVideo.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMessageContent.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMessageContent.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputMessageContent.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputMessageContent.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputTextMessageContent.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputTextMessageContent.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputTextMessageContent.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputTextMessageContent.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputVenueMessageContent.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputVenueMessageContent.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/InputVenueMessageContent.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/InputVenueMessageContent.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/Keyboard.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/Keyboard.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/Keyboard.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/Keyboard.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/KeyboardButton.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/KeyboardButton.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/KeyboardButton.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/KeyboardButton.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/LabeledPrice.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/LabeledPrice.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/LabeledPrice.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/LabeledPrice.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ParseMode.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ParseMode.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/ParseMode.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ParseMode.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardHide.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardMarkup.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.kt similarity index 100% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ReplyKeyboardRemove.kt diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ShippingOption.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ShippingOption.kt similarity index 92% rename from core/src/main/kotlin/com/pengrad/telegrambot/model/request/ShippingOption.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ShippingOption.kt index cffd8ace..9f75343c 100644 --- a/core/src/main/kotlin/com/pengrad/telegrambot/model/request/ShippingOption.kt +++ b/core/src/commonMain/kotlin/com/pengrad/telegrambot/model/request/ShippingOption.kt @@ -1,6 +1,7 @@ package com.pengrad.telegrambot.model.request import java.io.Serializable +import kotlin.jvm.JvmStatic /** * Stas Parshin diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/request/ContentTypes.kt b/core/src/commonMain/kotlin/com/pengrad/telegrambot/request/ContentTypes.kt similarity index 96% rename from core/src/main/kotlin/com/pengrad/telegrambot/request/ContentTypes.kt rename to core/src/commonMain/kotlin/com/pengrad/telegrambot/request/ContentTypes.kt index 4a14e5ed..55f6fb3f 100644 --- a/core/src/main/kotlin/com/pengrad/telegrambot/request/ContentTypes.kt +++ b/core/src/commonMain/kotlin/com/pengrad/telegrambot/request/ContentTypes.kt @@ -1,5 +1,7 @@ package com.pengrad.telegrambot.request +import kotlin.jvm.JvmField + /** * stas * 5/1/16. diff --git a/core/src/jsMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt b/core/src/jsMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt new file mode 100644 index 00000000..6b392575 --- /dev/null +++ b/core/src/jsMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt @@ -0,0 +1,7 @@ +package com.pengrad.telegrambot + +/** + * Stas Parshin + * 16 January 2020 + */ +actual interface JvmSerializable \ No newline at end of file diff --git a/core/src/jvmMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt b/core/src/jvmMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt new file mode 100644 index 00000000..3b01dfc1 --- /dev/null +++ b/core/src/jvmMain/kotlin/com/pengrad/telegrambot/JvmSerializable.kt @@ -0,0 +1,9 @@ +package com.pengrad.telegrambot + +import java.io.Serializable + +/** + * Stas Parshin + * 16 January 2020 + */ +actual typealias JvmSerializable = Serializable \ No newline at end of file diff --git a/core/src/main/kotlin/com/pengrad/telegrambot/model/Animation.kt b/core/src/main/kotlin/com/pengrad/telegrambot/model/Animation.kt deleted file mode 100644 index 1738c6aa..00000000 --- a/core/src/main/kotlin/com/pengrad/telegrambot/model/Animation.kt +++ /dev/null @@ -1,88 +0,0 @@ -package com.pengrad.telegrambot.model - -import java.io.Serializable - -/** - * Stas Parshin - * 03 October 2016 - */ -class Animation : Serializable { - - private val file_id: String? = null - private val width: Int? = null - private val height: Int? = null - private val duration: Int? = null - private val thumb: PhotoSize? = null - private val file_name: String? = null - private val mime_type: String? = null - private val file_size: Int? = null - - fun fileId(): String? { - return file_id - } - - fun width(): Int? { - return width - } - - fun height(): Int? { - return height - } - - fun duration(): Int? { - return duration - } - - fun thumb(): PhotoSize? { - return thumb - } - - fun fileName(): String? { - return file_name - } - - fun mimeType(): String? { - return mime_type - } - - fun fileSize(): Int? { - return file_size - } - - override fun equals(o: Any?): Boolean { - if (this === o) return true - if (o == null || javaClass != o.javaClass) return false - - val animation = o as Animation? - - if (if (file_id != null) file_id != animation!!.file_id else animation!!.file_id != null) return false - if (if (width != null) width != animation.width else animation.width != null) return false - if (if (height != null) height != animation.height else animation.height != null) return false - if (if (duration != null) duration != animation.duration else animation.duration != null) return false - if (if (thumb != null) thumb != animation.thumb else animation.thumb != null) return false - if (if (file_name != null) file_name != animation.file_name else animation.file_name != null) return false - if (if (mime_type != null) mime_type != animation.mime_type else animation.mime_type != null) return false - return if (file_size != null) file_size == animation.file_size else animation.file_size == null - } - - override fun hashCode(): Int { - return file_id?.hashCode() ?: 0 - } - - override fun toString(): String { - return "Animation{" + - "file_id='" + file_id + '\''.toString() + - ", width=" + width + - ", height=" + height + - ", duration=" + duration + - ", thumb=" + thumb + - ", file_name='" + file_name + '\''.toString() + - ", mime_type='" + mime_type + '\''.toString() + - ", file_size=" + file_size + - '}'.toString() - } - - companion object { - private const val serialVersionUID = 0L - } -} diff --git a/library/src/test/java/com/pengrad/telegrambot/AnimationTest.java b/library/src/test/java/com/pengrad/telegrambot/AnimationTest.java index 7b05264c..01829120 100644 --- a/library/src/test/java/com/pengrad/telegrambot/AnimationTest.java +++ b/library/src/test/java/com/pengrad/telegrambot/AnimationTest.java @@ -2,6 +2,8 @@ import com.pengrad.telegrambot.model.Animation; +import java.io.Serializable; + import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; @@ -12,6 +14,7 @@ public class AnimationTest { public static void check(Animation animation) { + Serializable s = animation; assertNotNull(animation.fileId()); assertNotNull(animation.fileName()); assertNotNull(animation.mimeType()); diff --git a/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java b/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java index 5ad5c929..fd8d301f 100644 --- a/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java +++ b/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java @@ -1,5 +1,6 @@ package com.pengrad.telegrambot; +import com.google.gson.Gson; import com.pengrad.telegrambot.model.*; import com.pengrad.telegrambot.model.request.*; import com.pengrad.telegrambot.passport.*; @@ -93,9 +94,9 @@ public TelegramBotTest() throws IOException { testPassportData = System.getenv("TEST_PASSPORT_DATA"); } - bot = new TelegramBot.Builder(token).debug().build(); - chatId = Integer.parseInt(chat); - groupId = Long.parseLong(group); +// bot = new TelegramBot.Builder(token).debug().build(); +// chatId = Integer.parseInt(chat); +// groupId = Long.parseLong(group); } @Test