diff --git a/README.md b/README.md index 5812a801..0af63d34 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ [![codecov](https://codecov.io/gh/pengrad/java-telegram-bot-api/branch/master/graph/badge.svg)](https://codecov.io/gh/pengrad/java-telegram-bot-api) Java library for interacting with [Telegram Bot API](https://core.telegram.org/bots/api) -- Full support of all Bot API 9.2 methods +- Full support of all Bot API 9.3 methods - Telegram [Passport](https://core.telegram.org/passport) and Decryption API - Bot [Payments](https://core.telegram.org/bots/payments) - [Gaming Platform](https://telegram.org/blog/games) @@ -13,14 +13,14 @@ Java library for interacting with [Telegram Bot API](https://core.telegram.org/b Gradle: ```groovy -implementation 'com.github.pengrad:java-telegram-bot-api:9.2.1' +implementation 'com.github.pengrad:java-telegram-bot-api:9.3.0' ``` Maven: ```xml com.github.pengrad java-telegram-bot-api - 9.2.1 + 9.3.0 ``` [JAR with all dependencies on release page](https://github.com/pengrad/java-telegram-bot-api/releases) diff --git a/README_RU.md b/README_RU.md index b960d3f6..7b46817c 100644 --- a/README_RU.md +++ b/README_RU.md @@ -4,7 +4,7 @@ [![codecov](https://codecov.io/gh/pengrad/java-telegram-bot-api/branch/master/graph/badge.svg)](https://codecov.io/gh/pengrad/java-telegram-bot-api) Java библиотека, созданная для работы с [Telegram Bot API](https://core.telegram.org/bots/api) -- Полная поддержка всех методов BOT API 9.2 +- Полная поддержка всех методов BOT API 9.3 - Поддержка Telegram [паспорта](https://core.telegram.org/passport) и дешифровки (Decryption API); - Поддержка [платежей](https://core.telegram.org/bots/payments); - [Игровая платформа](https://telegram.org/blog/games). @@ -13,14 +13,14 @@ Java библиотека, созданная для работы с [Telegram B Gradle: ```groovy -implementation 'com.github.pengrad:java-telegram-bot-api:9.2.1' +implementation 'com.github.pengrad:java-telegram-bot-api:9.3.0' ``` Maven: ```xml com.github.pengrad java-telegram-bot-api - 9.2.1 + 9.3.0 ``` Также JAR со всеми зависимостями можно найти [в релизах](https://github.com/pengrad/java-telegram-bot-api/releases). diff --git a/gradle.properties b/gradle.properties index 0b4efc4a..2b57b088 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ GROUP=com.github.pengrad -VERSION_NAME=9.2.1 +VERSION_NAME=9.3.0 POM_DESCRIPTION=Java API for Telegram Bot API POM_URL=https://github.com/pengrad/java-telegram-bot-api/ diff --git a/library/src/main/java/com/pengrad/telegrambot/model/ChatFullInfo.java b/library/src/main/java/com/pengrad/telegrambot/model/ChatFullInfo.java index 30e08d85..44c6ebd1 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/ChatFullInfo.java +++ b/library/src/main/java/com/pengrad/telegrambot/model/ChatFullInfo.java @@ -5,6 +5,7 @@ import com.pengrad.telegrambot.model.business.BusinessLocation; import com.pengrad.telegrambot.model.business.BusinessOpeningHours; import com.pengrad.telegrambot.model.gift.AcceptedGiftTypes; +import com.pengrad.telegrambot.model.gift.unique.UniqueGiftColors; import com.pengrad.telegrambot.model.reaction.ReactionType; @@ -75,6 +76,9 @@ public enum Type { private ChatLocation location; private Boolean can_send_gift; private AcceptedGiftTypes accepted_gift_types; + private UserRating rating; + private Integer paid_message_star_count; + private UniqueGiftColors unique_gift_colors; public Long id() { return id; @@ -272,6 +276,18 @@ public AcceptedGiftTypes acceptedGiftTypes() { return accepted_gift_types; } + public UserRating rating() { + return rating; + } + + public Integer paidMessageStarCount() { + return paid_message_star_count; + } + + public UniqueGiftColors uniqueGiftColors() { + return unique_gift_colors; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -323,7 +339,10 @@ public boolean equals(Object o) { Objects.equals(custom_emoji_sticker_set_name, chat.custom_emoji_sticker_set_name) && Objects.equals(linked_chat_id, chat.linked_chat_id) && Objects.equals(location, chat.location) && - Objects.equals(accepted_gift_types, chat.accepted_gift_types); + Objects.equals(accepted_gift_types, chat.accepted_gift_types) && + Objects.equals(rating, chat.rating) && + Objects.equals(paid_message_star_count, chat.paid_message_star_count) && + Objects.equals(unique_gift_colors, chat.unique_gift_colors); } @Override @@ -381,6 +400,9 @@ public String toString() { ", linked_chat_id=" + linked_chat_id + ", location=" + location + ", accepted_gift_types=" + accepted_gift_types + + ", rating=" + rating + + ", paid_message_star_count=" + paid_message_star_count + + ", unique_gift_colors=" + unique_gift_colors + '}'; } } diff --git a/library/src/main/java/com/pengrad/telegrambot/model/ForumTopic.java b/library/src/main/java/com/pengrad/telegrambot/model/ForumTopic.java index f42ffa7a..2393d930 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/ForumTopic.java +++ b/library/src/main/java/com/pengrad/telegrambot/model/ForumTopic.java @@ -6,12 +6,13 @@ public class ForumTopic implements Serializable { private final static long serialVersionUID = 0L; - private Integer message_thread_id; + private Long message_thread_id; private String name; private Integer icon_color; private String icon_custom_emoji_id; + private Boolean is_name_implicit; - public Integer messageThreadId() { + public Long messageThreadId() { return message_thread_id; } @@ -27,6 +28,10 @@ public String iconCustomEmojiId() { return icon_custom_emoji_id; } + public Boolean isNameImplicit() { + return is_name_implicit; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -37,7 +42,8 @@ public boolean equals(Object o) { return Objects.equals(message_thread_id, that.message_thread_id) && Objects.equals(name, that.name) && Objects.equals(icon_color, that.icon_color) && - Objects.equals(icon_custom_emoji_id, that.icon_custom_emoji_id); + Objects.equals(icon_custom_emoji_id, that.icon_custom_emoji_id) && + Objects.equals(is_name_implicit, that.is_name_implicit); } @Override @@ -45,7 +51,8 @@ public int hashCode() { return Objects.hash(message_thread_id, name, icon_color, - icon_custom_emoji_id); + icon_custom_emoji_id, + is_name_implicit); } @Override @@ -55,6 +62,7 @@ public String toString() { ", name='" + name + '\'' + ", icon_color=" + icon_color + ", icon_custom_emoji_id='" + icon_custom_emoji_id + '\'' + + ", is_name_implicit=" + is_name_implicit + '}'; } } diff --git a/library/src/main/java/com/pengrad/telegrambot/model/ForumTopicCreated.java b/library/src/main/java/com/pengrad/telegrambot/model/ForumTopicCreated.java index b2e71767..4eedc1ba 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/ForumTopicCreated.java +++ b/library/src/main/java/com/pengrad/telegrambot/model/ForumTopicCreated.java @@ -9,6 +9,7 @@ public class ForumTopicCreated implements Serializable { private String name; private Integer icon_color; private String icon_custom_emoji_id; + private Boolean is_name_implicit; public String name() { return name; @@ -22,6 +23,10 @@ public String iconCustomEmojiId() { return icon_custom_emoji_id; } + public Boolean isNameImplicit() { + return is_name_implicit; + } + @Override public boolean equals(Object o) { if (this == o) return true; @@ -31,14 +36,16 @@ public boolean equals(Object o) { return Objects.equals(name, that.name) && Objects.equals(icon_color, that.icon_color) && - Objects.equals(icon_custom_emoji_id, that.icon_custom_emoji_id); + Objects.equals(icon_custom_emoji_id, that.icon_custom_emoji_id) && + Objects.equals(is_name_implicit, that.is_name_implicit); } @Override public int hashCode() { return Objects.hash(name, icon_color, - icon_custom_emoji_id); + icon_custom_emoji_id, + is_name_implicit); } @Override @@ -47,6 +54,7 @@ public String toString() { "name='" + name + '\'' + ", icon_color=" + icon_color + ", icon_custom_emoji_id='" + icon_custom_emoji_id + '\'' + + ", is_name_implicit=" + is_name_implicit + '}'; } } diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Message.java b/library/src/main/java/com/pengrad/telegrambot/model/Message.java index 7cc7e433..3384affb 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/Message.java +++ b/library/src/main/java/com/pengrad/telegrambot/model/Message.java @@ -31,7 +31,7 @@ public class Message extends MaybeInaccessibleMessage implements Serializable { private final static long serialVersionUID = 0L; - private Integer message_thread_id; + private Long message_thread_id; private DirectMessagesTopic direct_messages_topic; private User from; private Chat sender_chat; @@ -122,6 +122,7 @@ public class Message extends MaybeInaccessibleMessage implements Serializable { private WebAppData web_app_data; private GiftInfo gift; private UniqueGiftInfo unique_gift; + private GiftInfo gift_upgrade_sent; private PaidMessagePriceChanged paid_message_price_changed; private SuggestedPostApproved suggested_post_approved; private SuggestedPostApprovalFailed suggested_post_approval_failed; @@ -131,7 +132,7 @@ public class Message extends MaybeInaccessibleMessage implements Serializable { private DirectMessagePriceChanged direct_message_price_changed; private Integer paid_star_count; - public Integer messageThreadId() { + public Long messageThreadId() { return message_thread_id; } @@ -496,6 +497,10 @@ public UniqueGiftInfo uniqueGift() { return unique_gift; } + public GiftInfo giftUpgradeSent() { + return gift_upgrade_sent; + } + public PaidMessagePriceChanged paidMessagePriceChanged() { return paid_message_price_changed; } @@ -648,6 +653,7 @@ public boolean equals(Object o) { Objects.equals(web_app_data, message.web_app_data) && Objects.equals(gift, message.gift) && Objects.equals(unique_gift, message.unique_gift) && + Objects.equals(gift_upgrade_sent, message.gift_upgrade_sent) && Objects.equals(paid_message_price_changed, message.paid_message_price_changed) && Objects.equals(suggested_post_approved, message.suggested_post_approved) && Objects.equals(suggested_post_approval_failed, message.suggested_post_approval_failed) && @@ -760,6 +766,7 @@ public String toString() { ", web_app_data=" + web_app_data + ", gift=" + gift + ", unique_gift=" + unique_gift + + ", gift_upgrade_sent=" + gift_upgrade_sent + ", paid_message_price_changed=" + paid_message_price_changed + ", suggested_post_approved=" + suggested_post_approved + ", suggested_post_approval_failed=" + suggested_post_approval_failed + diff --git a/library/src/main/java/com/pengrad/telegrambot/model/Story.java b/library/src/main/java/com/pengrad/telegrambot/model/Story.java index e288c62a..c57eefae 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/Story.java +++ b/library/src/main/java/com/pengrad/telegrambot/model/Story.java @@ -13,13 +13,13 @@ public class Story implements Serializable { private final static long serialVersionUID = 0L; private Chat chat; - private Integer id; + private Long id; public Chat chat() { return chat; } - public Integer id() { + public Long id() { return id; } diff --git a/library/src/main/java/com/pengrad/telegrambot/model/User.java b/library/src/main/java/com/pengrad/telegrambot/model/User.java index c3ac2141..177d60bc 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/User.java +++ b/library/src/main/java/com/pengrad/telegrambot/model/User.java @@ -23,6 +23,7 @@ public class User implements Serializable { private Boolean supports_inline_queries; private Boolean can_connect_to_business; private Boolean has_main_web_app; + private Boolean has_topics_enabled; private User() { } @@ -83,12 +84,16 @@ public Boolean hasMainWebApp() { return has_main_web_app; } + public Boolean hasTopicsEnabled() { + return has_topics_enabled; + } + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; User user = (User) o; - return Objects.equals(id, user.id) && Objects.equals(is_bot, user.is_bot) && Objects.equals(first_name, user.first_name) && Objects.equals(last_name, user.last_name) && Objects.equals(username, user.username) && Objects.equals(language_code, user.language_code) && Objects.equals(is_premium, user.is_premium) && Objects.equals(added_to_attachment_menu, user.added_to_attachment_menu) && Objects.equals(can_join_groups, user.can_join_groups) && Objects.equals(can_read_all_group_messages, user.can_read_all_group_messages) && Objects.equals(supports_inline_queries, user.supports_inline_queries) && Objects.equals(can_connect_to_business, user.can_connect_to_business) && Objects.equals(has_main_web_app, user.has_main_web_app); + return Objects.equals(id, user.id) && Objects.equals(is_bot, user.is_bot) && Objects.equals(first_name, user.first_name) && Objects.equals(last_name, user.last_name) && Objects.equals(username, user.username) && Objects.equals(language_code, user.language_code) && Objects.equals(is_premium, user.is_premium) && Objects.equals(added_to_attachment_menu, user.added_to_attachment_menu) && Objects.equals(can_join_groups, user.can_join_groups) && Objects.equals(can_read_all_group_messages, user.can_read_all_group_messages) && Objects.equals(supports_inline_queries, user.supports_inline_queries) && Objects.equals(can_connect_to_business, user.can_connect_to_business) && Objects.equals(has_main_web_app, user.has_main_web_app) && Objects.equals(has_topics_enabled, user.has_topics_enabled); } @Override @@ -112,6 +117,7 @@ public String toString() { ", supports_inline_queries=" + supports_inline_queries + ", can_connect_to_business=" + can_connect_to_business + ", has_main_web_app=" + has_main_web_app + + ", has_topics_enabled=" + has_topics_enabled + '}'; } } \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/model/UserRating.kt b/library/src/main/java/com/pengrad/telegrambot/model/UserRating.kt new file mode 100644 index 00000000..61b533bd --- /dev/null +++ b/library/src/main/java/com/pengrad/telegrambot/model/UserRating.kt @@ -0,0 +1,8 @@ +package com.pengrad.telegrambot.model + +data class UserRating( + @get:JvmName("level") val level: Int, + @get:JvmName("rating") val rating: Int, + @get:JvmName("currentLevelRating") val currentLevelRating: Int, + @get:JvmName("nextLevelRating") val nextLevelRating: Int? = null +) diff --git a/library/src/main/java/com/pengrad/telegrambot/model/checklist/ChecklistTask.kt b/library/src/main/java/com/pengrad/telegrambot/model/checklist/ChecklistTask.kt index 184b133e..e236b4b6 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/checklist/ChecklistTask.kt +++ b/library/src/main/java/com/pengrad/telegrambot/model/checklist/ChecklistTask.kt @@ -1,5 +1,6 @@ package com.pengrad.telegrambot.model.checklist +import com.pengrad.telegrambot.model.Chat import com.pengrad.telegrambot.model.MessageEntity import com.pengrad.telegrambot.model.User @@ -9,6 +10,7 @@ data class ChecklistTask( @get:JvmName("text") val text: String, @get:JvmName("textEntities") val textEntities: Array?, @get:JvmName("completedByUser") val completedByUser: User?, + @get:JvmName("completedByChat") val completedByChat: Chat? = null, @get:JvmName("completionDate") val completionDate: Int? ) { @@ -21,6 +23,7 @@ data class ChecklistTask( text == other.text && textEntities contentEquals other.textEntities && completedByUser == other.completedByUser && + completedByChat == other.completedByChat && completionDate == other.completionDate } @@ -29,6 +32,7 @@ data class ChecklistTask( result = 31 * result + (text?.hashCode() ?: 0) result = 31 * result + (textEntities?.contentHashCode() ?: 0) result = 31 * result + (completedByUser?.hashCode() ?: 0) + result = 31 * result + (completedByChat?.hashCode() ?: 0) result = 31 * result + (completionDate?.hashCode() ?: 0) return result } diff --git a/library/src/main/java/com/pengrad/telegrambot/model/gift/AcceptedGiftTypes.kt b/library/src/main/java/com/pengrad/telegrambot/model/gift/AcceptedGiftTypes.kt index e1072190..afa6e6d7 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/gift/AcceptedGiftTypes.kt +++ b/library/src/main/java/com/pengrad/telegrambot/model/gift/AcceptedGiftTypes.kt @@ -4,5 +4,6 @@ data class AcceptedGiftTypes( @get:JvmName("unlimitedGifts") val unlimitedGifts: Boolean, @get:JvmName("limitedGifts") val limitedGifts: Boolean, @get:JvmName("uniqueGifts") val uniqueGifts: Boolean, - @get:JvmName("premiumSubscription") val premiumSubscription: Boolean + @get:JvmName("premiumSubscription") val premiumSubscription: Boolean, + @get:JvmName("giftsFromChannels") val giftsFromChannels: Boolean ) \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/model/gift/Gift.kt b/library/src/main/java/com/pengrad/telegrambot/model/gift/Gift.kt index fe35e2e5..62f9a09e 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/gift/Gift.kt +++ b/library/src/main/java/com/pengrad/telegrambot/model/gift/Gift.kt @@ -10,5 +10,11 @@ data class Gift( @get:JvmName("upgradeStarCount") val upgradeStarCount: Int? = null, @get:JvmName("totalCount") val totalCount: Int? = null, @get:JvmName("remainingCount") val remainingCount: Int? = null, + @get:JvmName("personalTotalCount") val personalTotalCount: Int? = null, + @get:JvmName("personalRemainingCount") val personalRemainingCount: Int? = null, + @get:JvmName("isPremium") val isPremium: Boolean? = null, + @get:JvmName("hasColors") val hasColors: Boolean? = null, + @get:JvmName("background") val background: GiftBackground? = null, + @get:JvmName("uniqueGiftVariantCount") val uniqueGiftVariantCount: Int? = null, @get:JvmName("publisherChat") val publisherChat: Chat? = null ) diff --git a/library/src/main/java/com/pengrad/telegrambot/model/gift/GiftBackground.kt b/library/src/main/java/com/pengrad/telegrambot/model/gift/GiftBackground.kt new file mode 100644 index 00000000..77b16532 --- /dev/null +++ b/library/src/main/java/com/pengrad/telegrambot/model/gift/GiftBackground.kt @@ -0,0 +1,7 @@ +package com.pengrad.telegrambot.model.gift + +data class GiftBackground( + @get:JvmName("centerColor") val centerColor: Int, + @get:JvmName("edgeColor") val edgeColor: Int, + @get:JvmName("textColor") val textColor: Int +) diff --git a/library/src/main/java/com/pengrad/telegrambot/model/gift/GiftInfo.kt b/library/src/main/java/com/pengrad/telegrambot/model/gift/GiftInfo.kt index 84d51b52..14351c25 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/gift/GiftInfo.kt +++ b/library/src/main/java/com/pengrad/telegrambot/model/gift/GiftInfo.kt @@ -11,6 +11,8 @@ data class GiftInfo( @get:JvmName("text") val text: String?, @get:JvmName("entities") val entities: Array?, @get:JvmName("isPrivate") val isPrivate: Boolean?, + @get:JvmName("isUpgradeSeparate") val isUpgradeSeparate: Boolean? = null, + @get:JvmName("uniqueGiftNumber") val uniqueGiftNumber: Int? = null, ) { override fun equals(other: Any?): Boolean { @@ -24,7 +26,9 @@ data class GiftInfo( canBeUpgraded == other.canBeUpgraded && text == other.text && entities contentEquals other.entities && - isPrivate == other.isPrivate + isPrivate == other.isPrivate && + isUpgradeSeparate == other.isUpgradeSeparate && + uniqueGiftNumber == other.uniqueGiftNumber } override fun hashCode(): Int { @@ -36,13 +40,16 @@ data class GiftInfo( result = 31 * result + (text?.hashCode() ?: 0) result = 31 * result + (entities?.contentHashCode() ?: 0) result = 31 * result + (isPrivate?.hashCode() ?: 0) + result = 31 * result + (isUpgradeSeparate?.hashCode() ?: 0) + result = 31 * result + (uniqueGiftNumber ?: 0) return result } override fun toString(): String { return "GiftInfo(gift=$gift, ownedGiftId=$ownedGiftId, convertStarCount=$convertStarCount, " + "prepaidUpgradeStarCount=$prepaidUpgradeStarCount, canBeUpgraded=$canBeUpgraded, " + - "text=$text, entities=${entities?.contentToString()}, isPrivate=$isPrivate)" + "text=$text, entities=${entities?.contentToString()}, isPrivate=$isPrivate, " + + "isUpgradeSeparate=$isUpgradeSeparate, uniqueGiftNumber=$uniqueGiftNumber)" } } \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/model/gift/owned/OwnedGiftRegular.kt b/library/src/main/java/com/pengrad/telegrambot/model/gift/owned/OwnedGiftRegular.kt index 77fe1ca5..db1f862e 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/gift/owned/OwnedGiftRegular.kt +++ b/library/src/main/java/com/pengrad/telegrambot/model/gift/owned/OwnedGiftRegular.kt @@ -17,7 +17,9 @@ class OwnedGiftRegular private constructor( @get:JvmName("canBeUpgraded") var canBeUpgraded: Boolean?, @get:JvmName("wasRefunded") var wasRefunded: Boolean?, @get:JvmName("convertStarCount") var convertStarCount: Int?, - @get:JvmName("prepaidUpgradeStarCount") var prepaidUpgradeStarCount: Int? + @get:JvmName("prepaidUpgradeStarCount") var prepaidUpgradeStarCount: Int?, + @get:JvmName("isUpgradeSeparate") var isUpgradeSeparate: Boolean?, + @get:JvmName("uniqueGiftNumber") var uniqueGiftNumber: Int? ) : OwnedGift(type = TYPE) { companion object { @@ -37,6 +39,8 @@ class OwnedGiftRegular private constructor( wasRefunded = null, convertStarCount = null, prepaidUpgradeStarCount = null, + isUpgradeSeparate = null, + uniqueGiftNumber = null, ) fun ownedGiftId(ownedGiftId: String) = apply { @@ -79,4 +83,12 @@ class OwnedGiftRegular private constructor( this.prepaidUpgradeStarCount = prepaidUpgradeStarCount } + fun isUpgradeSeparate(isUpgradeSeparate: Boolean) = apply { + this.isUpgradeSeparate = isUpgradeSeparate + } + + fun uniqueGiftNumber(uniqueGiftNumber: Int) = apply { + this.uniqueGiftNumber = uniqueGiftNumber + } + } \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/model/gift/unique/UniqueGift.kt b/library/src/main/java/com/pengrad/telegrambot/model/gift/unique/UniqueGift.kt index a80c9ebd..946777ad 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/gift/unique/UniqueGift.kt +++ b/library/src/main/java/com/pengrad/telegrambot/model/gift/unique/UniqueGift.kt @@ -10,5 +10,9 @@ data class UniqueGift( @get:JvmName("model") val model: UniqueGiftModel, @get:JvmName("symbol") val symbol: UniqueGiftSymbol, @get:JvmName("backdrop") val backdrop: UniqueGiftBackdrop, - @get:JvmName("publisherChat") val publisherChat: Chat? = null + @get:JvmName("publisherChat") val publisherChat: Chat? = null, + @get:JvmName("giftId") val giftId: String? = null, + @get:JvmName("isFromBlockchain") val isFromBlockchain: Boolean? = null, + @get:JvmName("isPremium") val isPremium: Boolean? = null, + @get:JvmName("colors") val colors: UniqueGiftColors? = null ) \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/model/gift/unique/UniqueGiftColors.kt b/library/src/main/java/com/pengrad/telegrambot/model/gift/unique/UniqueGiftColors.kt new file mode 100644 index 00000000..70b3d8d8 --- /dev/null +++ b/library/src/main/java/com/pengrad/telegrambot/model/gift/unique/UniqueGiftColors.kt @@ -0,0 +1,34 @@ +package com.pengrad.telegrambot.model.gift.unique + +data class UniqueGiftColors( + @get:JvmName("modelCustomEmojiId") val modelCustomEmojiId: String, + @get:JvmName("symbolCustomEmojiId") val symbolCustomEmojiId: String, + @get:JvmName("lightThemeMainColor") val lightThemeMainColor: Int, + @get:JvmName("lightThemeOtherColors") val lightThemeOtherColors: Array, + @get:JvmName("darkThemeMainColor") val darkThemeMainColor: Int, + @get:JvmName("darkThemeOtherColors") val darkThemeOtherColors: Array +) { + + override fun equals(other: Any?): Boolean { + if (this === other) return true + if (other !is UniqueGiftColors) return false + + return modelCustomEmojiId == other.modelCustomEmojiId && + symbolCustomEmojiId == other.symbolCustomEmojiId && + lightThemeMainColor == other.lightThemeMainColor && + lightThemeOtherColors contentEquals other.lightThemeOtherColors && + darkThemeMainColor == other.darkThemeMainColor && + darkThemeOtherColors contentEquals other.darkThemeOtherColors + } + + override fun hashCode(): Int { + var result = modelCustomEmojiId.hashCode() + result = 31 * result + symbolCustomEmojiId.hashCode() + result = 31 * result + lightThemeMainColor + result = 31 * result + lightThemeOtherColors.contentHashCode() + result = 31 * result + darkThemeMainColor + result = 31 * result + darkThemeOtherColors.contentHashCode() + return result + } + +} diff --git a/library/src/main/java/com/pengrad/telegrambot/model/gift/unique/UniqueGiftInfo.kt b/library/src/main/java/com/pengrad/telegrambot/model/gift/unique/UniqueGiftInfo.kt index bf60fa6a..1429504f 100644 --- a/library/src/main/java/com/pengrad/telegrambot/model/gift/unique/UniqueGiftInfo.kt +++ b/library/src/main/java/com/pengrad/telegrambot/model/gift/unique/UniqueGiftInfo.kt @@ -7,5 +7,8 @@ data class UniqueGiftInfo( @get:JvmName("ownedGiftId") val ownedGiftId: String?, @get:JvmName("transferStarCount") val transferStarCount: Int?, @get:JvmName("nextTransferDate") var nextTransferDate: Long?, - @get:JvmName("lastResaleStarCount") val lastResaleStarCount: Int? + @Deprecated("Use lastResaleCurrency and lastResaleAmount instead") + @get:JvmName("lastResaleStarCount") val lastResaleStarCount: Int?, + @get:JvmName("lastResaleCurrency") val lastResaleCurrency: String?, + @get:JvmName("lastResaleAmount") val lastResaleAmount: Long? ) \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/request/AbstractSendRequest.kt b/library/src/main/java/com/pengrad/telegrambot/request/AbstractSendRequest.kt index 43d6f871..422fb41c 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/AbstractSendRequest.kt +++ b/library/src/main/java/com/pengrad/telegrambot/request/AbstractSendRequest.kt @@ -15,7 +15,7 @@ abstract class AbstractSendRequest>( val channelUsername: String? by optionalRequestParameter(channelUsername, customParameterName = "chat_id") var businessConnectionId: String? by optionalRequestParameter() - var messageThreadId: Int? by optionalRequestParameter() + var messageThreadId: Long? by optionalRequestParameter() var directMessagesTopicId: Long? by optionalRequestParameter() var disableNotification: Boolean? by optionalRequestParameter() var protectContent: Boolean? by optionalRequestParameter() @@ -27,7 +27,7 @@ abstract class AbstractSendRequest>( fun businessConnectionId(businessConnectionId: String) = applySelf { this.businessConnectionId = businessConnectionId } - fun messageThreadId(messageThreadId: Int) = applySelf { this.messageThreadId = messageThreadId } + fun messageThreadId(messageThreadId: Long) = applySelf { this.messageThreadId = messageThreadId } fun directMessagesTopicId(directMessagesTopicId: Long) = applySelf { this.directMessagesTopicId = directMessagesTopicId } diff --git a/library/src/main/java/com/pengrad/telegrambot/request/CloseForumTopic.java b/library/src/main/java/com/pengrad/telegrambot/request/CloseForumTopic.java index d9d96e5f..fb9925ae 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/CloseForumTopic.java +++ b/library/src/main/java/com/pengrad/telegrambot/request/CloseForumTopic.java @@ -4,11 +4,11 @@ public class CloseForumTopic extends BaseRequest { - public CloseForumTopic(Long chatId, Integer messageThreadId) { + public CloseForumTopic(Long chatId, Long messageThreadId) { this(chatId.toString(), messageThreadId); } - public CloseForumTopic(String chatId, Integer messageThreadId) { + public CloseForumTopic(String chatId, Long messageThreadId) { super(BaseResponse.class); add("chat_id", chatId); add("message_thread_id", messageThreadId); diff --git a/library/src/main/java/com/pengrad/telegrambot/request/CopyMessage.kt b/library/src/main/java/com/pengrad/telegrambot/request/CopyMessage.kt index 20febfbd..8b4d8075 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/CopyMessage.kt +++ b/library/src/main/java/com/pengrad/telegrambot/request/CopyMessage.kt @@ -136,7 +136,7 @@ class CopyMessage private constructor( val messageId: Int by requestParameter(messageId) - var messageThreadId: Int? by optionalRequestParameter() + var messageThreadId: Long? by optionalRequestParameter() var caption: String? by optionalRequestParameter() var parseMode: ParseMode? by optionalRequestParameter() @@ -150,8 +150,9 @@ class CopyMessage private constructor( var protectContent: Boolean? by optionalRequestParameter() var videoStartTimestamp: Int? by optionalRequestParameter() var allowPaidBroadcast: Boolean? by optionalRequestParameter() + var messageEffectId: String? by optionalRequestParameter() - fun messageThreadId(messageThreadId: Int) = applySelf { this.messageThreadId = messageThreadId } + fun messageThreadId(messageThreadId: Long) = applySelf { this.messageThreadId = messageThreadId } fun caption(caption: String) = applySelf { this.caption = caption } @@ -175,4 +176,6 @@ class CopyMessage private constructor( fun allowPaidBroadcast(allowPaidBroadcast: Boolean) = applySelf { this.allowPaidBroadcast = allowPaidBroadcast } + fun messageEffectId(messageEffectId: String) = applySelf { this.messageEffectId = messageEffectId } + } \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/request/CopyMessages.kt b/library/src/main/java/com/pengrad/telegrambot/request/CopyMessages.kt index 8dfaf0e7..99619577 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/CopyMessages.kt +++ b/library/src/main/java/com/pengrad/telegrambot/request/CopyMessages.kt @@ -11,7 +11,7 @@ class CopyMessages( add("chat_id", chatId).add("from_chat_id", fromChatId).add("message_ids", messageIds) } - fun messageThreadId(messageThreadId: Int?): CopyMessages { + fun messageThreadId(messageThreadId: Long?): CopyMessages { return add("message_thread_id", messageThreadId) } diff --git a/library/src/main/java/com/pengrad/telegrambot/request/DeleteForumTopic.java b/library/src/main/java/com/pengrad/telegrambot/request/DeleteForumTopic.java index e972ad83..12ab8202 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/DeleteForumTopic.java +++ b/library/src/main/java/com/pengrad/telegrambot/request/DeleteForumTopic.java @@ -4,11 +4,11 @@ public class DeleteForumTopic extends BaseRequest { - public DeleteForumTopic(Long chatId, Integer messageThreadId) { + public DeleteForumTopic(Long chatId, Long messageThreadId) { this(chatId.toString(), messageThreadId); } - public DeleteForumTopic(String chatId, Integer messageThreadId) { + public DeleteForumTopic(String chatId, Long messageThreadId) { super(BaseResponse.class); add("chat_id", chatId); add("message_thread_id", messageThreadId); diff --git a/library/src/main/java/com/pengrad/telegrambot/request/EditForumTopic.java b/library/src/main/java/com/pengrad/telegrambot/request/EditForumTopic.java index 6cc6429f..a2206772 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/EditForumTopic.java +++ b/library/src/main/java/com/pengrad/telegrambot/request/EditForumTopic.java @@ -4,21 +4,21 @@ public class EditForumTopic extends BaseRequest { - public EditForumTopic(Long chatId, Integer messageThreadId) { + public EditForumTopic(Long chatId, Long messageThreadId) { this(chatId.toString(), messageThreadId); } - public EditForumTopic(String chatId, Integer messageThreadId) { + public EditForumTopic(String chatId, Long messageThreadId) { super(BaseResponse.class); add("chat_id", chatId); add("message_thread_id", messageThreadId); } - public EditForumTopic(Long chatId, Integer messageThreadId, String name, String iconCustomEmojiId) { + public EditForumTopic(Long chatId, Long messageThreadId, String name, String iconCustomEmojiId) { this(chatId.toString(), messageThreadId, name, iconCustomEmojiId); } - public EditForumTopic(String chatId, Integer messageThreadId, String name, String iconCustomEmojiId) { + public EditForumTopic(String chatId, Long messageThreadId, String name, String iconCustomEmojiId) { super(BaseResponse.class); add("chat_id", chatId); add("message_thread_id", messageThreadId); diff --git a/library/src/main/java/com/pengrad/telegrambot/request/ForwardMessage.kt b/library/src/main/java/com/pengrad/telegrambot/request/ForwardMessage.kt index 535f0a34..19c448d0 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/ForwardMessage.kt +++ b/library/src/main/java/com/pengrad/telegrambot/request/ForwardMessage.kt @@ -134,12 +134,13 @@ class ForwardMessage private constructor( val messageId: Int by requestParameter(messageId) - var messageThreadId: Int? by optionalRequestParameter() + var messageThreadId: Long? by optionalRequestParameter() var disableNotification: Boolean? by optionalRequestParameter() var protectContent: Boolean? by optionalRequestParameter() var videoStartTimestamp: Int? by optionalRequestParameter() + var messageEffectId: String? by optionalRequestParameter() - fun messageThreadId(messageThreadId: Int) = applySelf { this.messageThreadId = messageThreadId } + fun messageThreadId(messageThreadId: Long) = applySelf { this.messageThreadId = messageThreadId } fun disableNotification(disableNotification: Boolean) = applySelf { this.disableNotification = disableNotification } @@ -147,4 +148,6 @@ class ForwardMessage private constructor( fun videoStartTimestamp(videoStartTimestamp: Int) = applySelf { this.videoStartTimestamp = videoStartTimestamp } + fun messageEffectId(messageEffectId: String) = applySelf { this.messageEffectId = messageEffectId } + } \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/request/ForwardMessages.java b/library/src/main/java/com/pengrad/telegrambot/request/ForwardMessages.java index 3a348b39..6d12e4a2 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/ForwardMessages.java +++ b/library/src/main/java/com/pengrad/telegrambot/request/ForwardMessages.java @@ -9,7 +9,7 @@ public ForwardMessages(Object chatId, Object fromChatId, int[] messageIds) { add("chat_id", chatId).add("from_chat_id", fromChatId).add("message_ids", messageIds); } - public ForwardMessages messageThreadId(Integer messageThreadId) { + public ForwardMessages messageThreadId(Long messageThreadId) { return add("message_thread_id", messageThreadId); } public ForwardMessages disableNotification(boolean disableNotification) { diff --git a/library/src/main/java/com/pengrad/telegrambot/request/GetChatGifts.kt b/library/src/main/java/com/pengrad/telegrambot/request/GetChatGifts.kt new file mode 100644 index 00000000..b6b0e337 --- /dev/null +++ b/library/src/main/java/com/pengrad/telegrambot/request/GetChatGifts.kt @@ -0,0 +1,55 @@ +package com.pengrad.telegrambot.request + +import com.pengrad.telegrambot.response.GetChatGiftsResponse +import com.pengrad.telegrambot.utility.kotlin.optionalRequestParameter + +class GetChatGifts private constructor( + chatId: Long? = null, + channelUsername: String? = null +) : KBaseRequest(GetChatGiftsResponse::class) { + + constructor(chatId: Long) : this( + chatId = chatId, + channelUsername = null + ) + + constructor(channelUsername: String) : this( + chatId = null, + channelUsername = channelUsername + ) + + val chatId: Long? by optionalRequestParameter(chatId, customParameterName = "chat_id") + val channelUsername: String? by optionalRequestParameter(channelUsername, customParameterName = "chat_id") + + var excludeUnsaved: Boolean? by optionalRequestParameter() + var excludeSaved: Boolean? by optionalRequestParameter() + var excludeUnlimited: Boolean? by optionalRequestParameter() + var excludeLimitedUpgradable: Boolean? by optionalRequestParameter() + var excludeLimitedNonUpgradable: Boolean? by optionalRequestParameter() + var excludeFromBlockchain: Boolean? by optionalRequestParameter() + var excludeUnique: Boolean? by optionalRequestParameter() + var sortByPrice: Boolean? by optionalRequestParameter() + var offset: String? by optionalRequestParameter() + var limit: Int? by optionalRequestParameter() + + fun excludeUnsaved(excludeUnsaved: Boolean) = applySelf { this.excludeUnsaved = excludeUnsaved } + + fun excludeSaved(excludeSaved: Boolean) = applySelf { this.excludeSaved = excludeSaved } + + fun excludeUnlimited(excludeUnlimited: Boolean) = applySelf { this.excludeUnlimited = excludeUnlimited } + + fun excludeLimitedUpgradable(excludeLimitedUpgradable: Boolean) = applySelf { this.excludeLimitedUpgradable = excludeLimitedUpgradable } + + fun excludeLimitedNonUpgradable(excludeLimitedNonUpgradable: Boolean) = applySelf { this.excludeLimitedNonUpgradable = excludeLimitedNonUpgradable } + + fun excludeFromBlockchain(excludeFromBlockchain: Boolean) = applySelf { this.excludeFromBlockchain = excludeFromBlockchain } + + fun excludeUnique(excludeUnique: Boolean) = applySelf { this.excludeUnique = excludeUnique } + + fun sortByPrice(sortByPrice: Boolean) = applySelf { this.sortByPrice = sortByPrice } + + fun offset(offset: String) = applySelf { this.offset = offset } + + fun limit(limit: Int) = applySelf { this.limit = limit } + +} diff --git a/library/src/main/java/com/pengrad/telegrambot/request/GetUserGifts.kt b/library/src/main/java/com/pengrad/telegrambot/request/GetUserGifts.kt new file mode 100644 index 00000000..767546cf --- /dev/null +++ b/library/src/main/java/com/pengrad/telegrambot/request/GetUserGifts.kt @@ -0,0 +1,38 @@ +package com.pengrad.telegrambot.request + +import com.pengrad.telegrambot.response.GetUserGiftsResponse +import com.pengrad.telegrambot.utility.kotlin.optionalRequestParameter +import com.pengrad.telegrambot.utility.kotlin.requestParameter + +class GetUserGifts( + userId: Long +) : KBaseRequest(GetUserGiftsResponse::class) { + + val userId: Long by requestParameter(userId) + + var excludeUnlimited: Boolean? by optionalRequestParameter() + var excludeLimitedUpgradable: Boolean? by optionalRequestParameter() + var excludeLimitedNonUpgradable: Boolean? by optionalRequestParameter() + var excludeFromBlockchain: Boolean? by optionalRequestParameter() + var excludeUnique: Boolean? by optionalRequestParameter() + var sortByPrice: Boolean? by optionalRequestParameter() + var offset: String? by optionalRequestParameter() + var limit: Int? by optionalRequestParameter() + + fun excludeUnlimited(excludeUnlimited: Boolean) = applySelf { this.excludeUnlimited = excludeUnlimited } + + fun excludeLimitedUpgradable(excludeLimitedUpgradable: Boolean) = applySelf { this.excludeLimitedUpgradable = excludeLimitedUpgradable } + + fun excludeLimitedNonUpgradable(excludeLimitedNonUpgradable: Boolean) = applySelf { this.excludeLimitedNonUpgradable = excludeLimitedNonUpgradable } + + fun excludeFromBlockchain(excludeFromBlockchain: Boolean) = applySelf { this.excludeFromBlockchain = excludeFromBlockchain } + + fun excludeUnique(excludeUnique: Boolean) = applySelf { this.excludeUnique = excludeUnique } + + fun sortByPrice(sortByPrice: Boolean) = applySelf { this.sortByPrice = sortByPrice } + + fun offset(offset: String) = applySelf { this.offset = offset } + + fun limit(limit: Int) = applySelf { this.limit = limit } + +} diff --git a/library/src/main/java/com/pengrad/telegrambot/request/ReopenForumTopic.java b/library/src/main/java/com/pengrad/telegrambot/request/ReopenForumTopic.java index 2cc07909..d0618b08 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/ReopenForumTopic.java +++ b/library/src/main/java/com/pengrad/telegrambot/request/ReopenForumTopic.java @@ -4,11 +4,11 @@ public class ReopenForumTopic extends BaseRequest { - public ReopenForumTopic(Long chatId, Integer messageThreadId) { + public ReopenForumTopic(Long chatId, Long messageThreadId) { this(chatId.toString(), messageThreadId); } - public ReopenForumTopic(String chatId, Integer messageThreadId) { + public ReopenForumTopic(String chatId, Long messageThreadId) { super(BaseResponse.class); add("chat_id", chatId); add("message_thread_id", messageThreadId); diff --git a/library/src/main/java/com/pengrad/telegrambot/request/SendChatAction.java b/library/src/main/java/com/pengrad/telegrambot/request/SendChatAction.java index 1fbabce7..abdb4976 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/SendChatAction.java +++ b/library/src/main/java/com/pengrad/telegrambot/request/SendChatAction.java @@ -19,7 +19,7 @@ public SendChatAction(Object chatId, ChatAction action) { add("chat_id", chatId).add("action", action.name()); } - public SendChatAction messageThreadId(int message_thread_id) { + public SendChatAction messageThreadId(long message_thread_id) { add("message_thread_id", message_thread_id); return this; } diff --git a/library/src/main/java/com/pengrad/telegrambot/request/SendMediaGroup.java b/library/src/main/java/com/pengrad/telegrambot/request/SendMediaGroup.java index 1be92773..d97ee024 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/SendMediaGroup.java +++ b/library/src/main/java/com/pengrad/telegrambot/request/SendMediaGroup.java @@ -35,7 +35,7 @@ public SendMediaGroup businessConnectionId(String businessConnectionId) { return add("business_connection_id", businessConnectionId); } - public SendMediaGroup messageThreadId(Integer messageThreadId) { + public SendMediaGroup messageThreadId(Long messageThreadId) { return add("message_thread_id", messageThreadId); } diff --git a/library/src/main/java/com/pengrad/telegrambot/request/SendMessageDraft.kt b/library/src/main/java/com/pengrad/telegrambot/request/SendMessageDraft.kt new file mode 100644 index 00000000..73b48456 --- /dev/null +++ b/library/src/main/java/com/pengrad/telegrambot/request/SendMessageDraft.kt @@ -0,0 +1,29 @@ +package com.pengrad.telegrambot.request + +import com.pengrad.telegrambot.model.MessageEntity +import com.pengrad.telegrambot.model.request.ParseMode +import com.pengrad.telegrambot.response.BaseResponse +import com.pengrad.telegrambot.utility.kotlin.optionalRequestParameter +import com.pengrad.telegrambot.utility.kotlin.requestParameter + +class SendMessageDraft( + chatId: Long, + draftId: Int, + text: String +) : KBaseRequest(BaseResponse::class) { + + val chatId: Long by requestParameter(chatId) + val draftId: Int by requestParameter(draftId) + val text: String by requestParameter(text) + + var messageThreadId: Long? by optionalRequestParameter() + var parseMode: ParseMode? by optionalRequestParameter() + var entities: List? by optionalRequestParameter() + + fun messageThreadId(messageThreadId: Long) = applySelf { this.messageThreadId = messageThreadId } + + fun parseMode(parseMode: ParseMode) = applySelf { this.parseMode = parseMode } + + fun entities(entities: List) = applySelf { this.entities = entities } + +} diff --git a/library/src/main/java/com/pengrad/telegrambot/request/UnpinAllForumTopicMessages.java b/library/src/main/java/com/pengrad/telegrambot/request/UnpinAllForumTopicMessages.java index 22b62554..4de3aad5 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/UnpinAllForumTopicMessages.java +++ b/library/src/main/java/com/pengrad/telegrambot/request/UnpinAllForumTopicMessages.java @@ -4,11 +4,11 @@ public class UnpinAllForumTopicMessages extends BaseRequest { - public UnpinAllForumTopicMessages(Long chatId, Integer messageThreadId) { + public UnpinAllForumTopicMessages(Long chatId, Long messageThreadId) { this(chatId.toString(), messageThreadId); } - public UnpinAllForumTopicMessages(String chatId, Integer messageThreadId) { + public UnpinAllForumTopicMessages(String chatId, Long messageThreadId) { super(BaseResponse.class); add("chat_id", chatId); add("message_thread_id", messageThreadId); diff --git a/library/src/main/java/com/pengrad/telegrambot/request/business/DeleteStory.kt b/library/src/main/java/com/pengrad/telegrambot/request/business/DeleteStory.kt index 24fdc38d..4ae66fc5 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/business/DeleteStory.kt +++ b/library/src/main/java/com/pengrad/telegrambot/request/business/DeleteStory.kt @@ -7,10 +7,10 @@ import com.pengrad.telegrambot.utility.kotlin.requestParameter @Suppress("unused") class DeleteStory( businessConnectionId: String, - storyId: Int + storyId: Long ): KBaseRequest(BaseResponse::class) { val businessConnectionId: String by requestParameter(businessConnectionId, customParameterName = "business_connection_id") - val storyId: Int by requestParameter(storyId, customParameterName = "story_id") + val storyId: Long by requestParameter(storyId, customParameterName = "story_id") } \ No newline at end of file diff --git a/library/src/main/java/com/pengrad/telegrambot/request/business/EditStory.kt b/library/src/main/java/com/pengrad/telegrambot/request/business/EditStory.kt index ca7e6e87..05ecd88c 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/business/EditStory.kt +++ b/library/src/main/java/com/pengrad/telegrambot/request/business/EditStory.kt @@ -11,7 +11,7 @@ import com.pengrad.telegrambot.utility.kotlin.requestParameter @Suppress("unused") class EditStory private constructor( businessConnectionId: String, - storyId: Int, + storyId: Long, content: InputStoryContent, caption: String?, parseMode: String?, @@ -19,7 +19,7 @@ class EditStory private constructor( areas: Array? ): KBaseRequest(EditStoryResponse::class) { - constructor(businessConnectionId: String, storyId: Int, content: InputStoryContent) : this( + constructor(businessConnectionId: String, storyId: Long, content: InputStoryContent) : this( businessConnectionId = businessConnectionId, storyId = storyId, content = content, @@ -30,7 +30,7 @@ class EditStory private constructor( ) val businessConnectionId: String by requestParameter(businessConnectionId, customParameterName = "business_connection_id") - val storyId: Int by requestParameter(storyId, customParameterName = "story_id") + val storyId: Long by requestParameter(storyId, customParameterName = "story_id") val content: InputStoryContent by requestParameter(content, customParameterName = "content") var caption: String? by optionalRequestParameter(caption, customParameterName = "caption") diff --git a/library/src/main/java/com/pengrad/telegrambot/request/business/GetBusinessAccountGifts.kt b/library/src/main/java/com/pengrad/telegrambot/request/business/GetBusinessAccountGifts.kt index 30d62eef..31fe5b8d 100644 --- a/library/src/main/java/com/pengrad/telegrambot/request/business/GetBusinessAccountGifts.kt +++ b/library/src/main/java/com/pengrad/telegrambot/request/business/GetBusinessAccountGifts.kt @@ -12,7 +12,10 @@ class GetBusinessAccountGifts private constructor( excludeSaved: Boolean?, excludeUnlimited: Boolean?, excludeLimited: Boolean?, + excludeLimitedUpgradable: Boolean?, + excludeLimitedNonUpgradable: Boolean?, excludeUnique: Boolean?, + excludeFromBlockchain: Boolean?, sortByPrice: Boolean?, offset: String?, limit: Int? @@ -24,7 +27,10 @@ class GetBusinessAccountGifts private constructor( excludeSaved = null, excludeUnlimited = null, excludeLimited = null, + excludeLimitedUpgradable = null, + excludeLimitedNonUpgradable = null, excludeUnique = null, + excludeFromBlockchain = null, sortByPrice = null, offset = null, limit = null, @@ -41,12 +47,23 @@ class GetBusinessAccountGifts private constructor( var excludeUnlimited: Boolean? by optionalRequestParameter(excludeUnlimited, customParameterName = "exclude_unlimited") fun excludeUnlimited(excludeUnlimited: Boolean) = applySelf { this.excludeUnlimited = excludeUnlimited } + @Deprecated("Use excludeLimitedUpgradable and excludeLimitedNonUpgradable instead") var excludeLimited: Boolean? by optionalRequestParameter(excludeLimited, customParameterName = "exclude_limited") + @Deprecated("Use excludeLimitedUpgradable and excludeLimitedNonUpgradable instead") fun excludeLimited(excludeLimited: Boolean) = applySelf { this.excludeLimited = excludeLimited } + var excludeLimitedUpgradable: Boolean? by optionalRequestParameter(excludeLimitedUpgradable, customParameterName = "exclude_limited_upgradable") + fun excludeLimitedUpgradable(excludeLimitedUpgradable: Boolean) = applySelf { this.excludeLimitedUpgradable = excludeLimitedUpgradable } + + var excludeLimitedNonUpgradable: Boolean? by optionalRequestParameter(excludeLimitedNonUpgradable, customParameterName = "exclude_limited_non_upgradable") + fun excludeLimitedNonUpgradable(excludeLimitedNonUpgradable: Boolean) = applySelf { this.excludeLimitedNonUpgradable = excludeLimitedNonUpgradable } + var excludeUnique: Boolean? by optionalRequestParameter(excludeUnique, customParameterName = "exclude_unique") fun excludeUnique(excludeUnique: Boolean) = applySelf { this.excludeUnique = excludeUnique } + var excludeFromBlockchain: Boolean? by optionalRequestParameter(excludeFromBlockchain, customParameterName = "exclude_from_blockchain") + fun excludeFromBlockchain(excludeFromBlockchain: Boolean) = applySelf { this.excludeFromBlockchain = excludeFromBlockchain } + var sortByPrice: Boolean? by optionalRequestParameter(sortByPrice, customParameterName = "sort_by_price") fun sortByPrice(sortByPrice: Boolean) = applySelf { this.sortByPrice = sortByPrice } diff --git a/library/src/main/java/com/pengrad/telegrambot/request/business/RepostStory.kt b/library/src/main/java/com/pengrad/telegrambot/request/business/RepostStory.kt new file mode 100644 index 00000000..d2d67cc3 --- /dev/null +++ b/library/src/main/java/com/pengrad/telegrambot/request/business/RepostStory.kt @@ -0,0 +1,38 @@ +package com.pengrad.telegrambot.request.business + +import com.pengrad.telegrambot.request.KBaseRequest +import com.pengrad.telegrambot.response.RepostStoryResponse +import com.pengrad.telegrambot.utility.kotlin.optionalRequestParameter +import com.pengrad.telegrambot.utility.kotlin.requestParameter + +@Suppress("unused") +class RepostStory private constructor( + businessConnectionId: String, + fromChatId: Long, + fromStoryId: Long, + activePeriod: Int, + postToChatPage: Boolean?, + protectContent: Boolean? +): KBaseRequest(RepostStoryResponse::class) { + + constructor(businessConnectionId: String, fromChatId: Long, fromStoryId: Long, activePeriod: Int) : this( + businessConnectionId = businessConnectionId, + fromChatId = fromChatId, + fromStoryId = fromStoryId, + activePeriod = activePeriod, + postToChatPage = null, + protectContent = null + ) + + val businessConnectionId: String by requestParameter(businessConnectionId, customParameterName = "business_connection_id") + val fromChatId: Long by requestParameter(fromChatId, customParameterName = "from_chat_id") + val fromStoryId: Long by requestParameter(fromStoryId, customParameterName = "from_story_id") + val activePeriod: Int by requestParameter(activePeriod, customParameterName = "active_period") + + var postToChatPage: Boolean? by optionalRequestParameter(postToChatPage, customParameterName = "post_to_chat_page") + fun postToChatPage(postToChatPage: Boolean) = applySelf { this.postToChatPage = postToChatPage } + + var protectContent: Boolean? by optionalRequestParameter(protectContent, customParameterName = "protect_content") + fun protectContent(protectContent: Boolean) = applySelf { this.protectContent = protectContent } + +} diff --git a/library/src/main/java/com/pengrad/telegrambot/response/GetChatGiftsResponse.kt b/library/src/main/java/com/pengrad/telegrambot/response/GetChatGiftsResponse.kt new file mode 100644 index 00000000..4c74ac08 --- /dev/null +++ b/library/src/main/java/com/pengrad/telegrambot/response/GetChatGiftsResponse.kt @@ -0,0 +1,5 @@ +package com.pengrad.telegrambot.response + +import com.pengrad.telegrambot.model.gift.owned.OwnedGifts + +data class GetChatGiftsResponse(val result: OwnedGifts) : BaseResponse() diff --git a/library/src/main/java/com/pengrad/telegrambot/response/GetUserGiftsResponse.kt b/library/src/main/java/com/pengrad/telegrambot/response/GetUserGiftsResponse.kt new file mode 100644 index 00000000..12b9b4a8 --- /dev/null +++ b/library/src/main/java/com/pengrad/telegrambot/response/GetUserGiftsResponse.kt @@ -0,0 +1,5 @@ +package com.pengrad.telegrambot.response + +import com.pengrad.telegrambot.model.gift.owned.OwnedGifts + +data class GetUserGiftsResponse(val result: OwnedGifts) : BaseResponse() diff --git a/library/src/main/java/com/pengrad/telegrambot/response/RepostStoryResponse.kt b/library/src/main/java/com/pengrad/telegrambot/response/RepostStoryResponse.kt new file mode 100644 index 00000000..0a5710e9 --- /dev/null +++ b/library/src/main/java/com/pengrad/telegrambot/response/RepostStoryResponse.kt @@ -0,0 +1,5 @@ +package com.pengrad.telegrambot.response + +import com.pengrad.telegrambot.model.Story + +data class RepostStoryResponse(val result: Story) : BaseResponse() diff --git a/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java b/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java index 5d8b690c..85ba40e4 100644 --- a/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java +++ b/library/src/test/java/com/pengrad/telegrambot/TelegramBotTest.java @@ -97,7 +97,7 @@ public static TelegramBot createTestBot() { Long memberBot = 215003245L; Long localGroup = -1001431704825L; Long forum = -1001833520519L; - Integer forumEditThread = 3; + Long forumEditThread = 3L; static String privateKey; static String testPassportData; static String testCallbackQuery; @@ -685,7 +685,7 @@ public void forwardMessage() { @Test public void forwardMessages() { MessageIdsResponse response = bot.execute(new ForwardMessages(chatId, chatId, new int[]{forwardMessageId}) - .messageThreadId(0) + .messageThreadId(0L) .disableNotification(true) .protectContent(true) ); @@ -712,7 +712,7 @@ public void copyMessage() { @Test public void copyMessages() { MessageIdsResponse response = bot.execute(new CopyMessages(chatId, chatId, new int[]{forwardMessageId}) - .messageThreadId(0) + .messageThreadId(0L) .removeCaption(true) .disableNotification(true) .protectContent(true) @@ -1646,7 +1646,7 @@ public void sendMediaGroup() { new InputMediaVideo(videoFile), new InputMediaVideo(videoBytes).caption("my video bold").parseMode(ParseMode.HTML) .duration(10).width(11).height(12).supportsStreaming(true) - ).messageThreadId(0).disableNotification(false).replyParameters(new ReplyParameters(1).allowSendingWithoutReply(false))); + ).messageThreadId(0L).disableNotification(false).replyParameters(new ReplyParameters(1).allowSendingWithoutReply(false))); assertTrue(response.isOk()); assertEquals(6, response.messages().length); diff --git a/pom.xml b/pom.xml index 893ece7e..d590bb3e 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ 4.0.0 com.github.pengrad java-telegram-bot-api - 9.2.1 + 9.3.0 JavaTelegramBotApi Java API for Telegram Bot API https://github.com/pengrad/java-telegram-bot-api/