diff --git a/src/main/java/org/teleight/teleightbots/api/methods/CopyMessage.java b/src/main/java/org/teleight/teleightbots/api/methods/CopyMessage.java index eb0c451..dc4e1d8 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/CopyMessage.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/CopyMessage.java @@ -22,7 +22,7 @@ public record CopyMessage( String fromChatId, @JsonProperty(value = "message_id", required = true) - long messageId, + int messageId, @JsonProperty(value = "caption") @Nullable @@ -36,6 +36,9 @@ public record CopyMessage( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "disable_notification") boolean disableNotification, @@ -51,7 +54,7 @@ public record CopyMessage( ReplyKeyboard replyMarkup ) implements ApiMethodMessage { - public static Builder ofBuilder(String chatId, String fromChatId, long messageId) { + public static Builder ofBuilder(String chatId, String fromChatId, int messageId) { return new CopyMessage.Builder(chatId, fromChatId, messageId); } @@ -64,16 +67,17 @@ public static class Builder { private final String chatId; private int messageThreadId; private final String fromChatId; - private final long messageId; + private final int messageId; private String caption; private ParseMode parseMode; private MessageEntity[] captionEntities; + private boolean showCaptionAboveMedia; private boolean disableNotification; private boolean protectContent; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; - Builder(String chatId, String fromChatId, long messageId) { + Builder(String chatId, String fromChatId, int messageId) { this.chatId = chatId; this.fromChatId = fromChatId; this.messageId = messageId; @@ -99,6 +103,11 @@ public Builder captionEntities(MessageEntity[] captionEntities) { return this; } + public Builder showCaptionAboveMedia(boolean showCaptionAboveMedia) { + this.showCaptionAboveMedia = showCaptionAboveMedia; + return this; + } + public Builder disableNotification(boolean disableNotification) { this.disableNotification = disableNotification; return this; @@ -120,7 +129,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public CopyMessage build() { - return new CopyMessage(this.chatId, this.messageThreadId, this.fromChatId, this.messageId, this.caption, this.parseMode, this.captionEntities, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new CopyMessage(this.chatId, this.messageThreadId, this.fromChatId, this.messageId, this.caption, this.parseMode, this.captionEntities, this.showCaptionAboveMedia, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); } } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/EditMessageCaption.java b/src/main/java/org/teleight/teleightbots/api/methods/EditMessageCaption.java index 363864a..283579f 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/EditMessageCaption.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/EditMessageCaption.java @@ -36,6 +36,9 @@ public record EditMessageCaption( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "reply_markup") @Nullable ReplyKeyboard replyMarkup @@ -62,6 +65,7 @@ public static class Builder { private String caption; private ParseMode parseMode; private MessageEntity[] captionEntities; + private boolean showCaptionAboveMedia; private ReplyKeyboard replyMarkup; public Builder chatId(String chatId) { @@ -94,13 +98,18 @@ public Builder captionEntities(MessageEntity[] captionEntities) { return this; } + public Builder showCaptionAboveMedia(boolean showCaptionAboveMedia) { + this.showCaptionAboveMedia = showCaptionAboveMedia; + return this; + } + public Builder replyMarkup(ReplyKeyboard replyMarkup) { this.replyMarkup = replyMarkup; return this; } public EditMessageCaption build() { - return new EditMessageCaption(this.chatId, this.messageId, this.inlineMessageId, this.caption, this.parseMode, this.captionEntities, this.replyMarkup); + return new EditMessageCaption(this.chatId, this.messageId, this.inlineMessageId, this.caption, this.parseMode, this.captionEntities, this.showCaptionAboveMedia, this.replyMarkup); } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/GetGameHighScores.java b/src/main/java/org/teleight/teleightbots/api/methods/GetGameHighScores.java new file mode 100644 index 0000000..0e921de --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/methods/GetGameHighScores.java @@ -0,0 +1,70 @@ +package org.teleight.teleightbots.api.methods; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.teleight.teleightbots.api.ApiMethod; +import org.teleight.teleightbots.api.objects.GameHighScore; +import org.teleight.teleightbots.exception.exceptions.TelegramRequestException; + +public record GetGameHighScores( + @JsonProperty(value = "user_id", required = true) + long userId, + + @JsonProperty("chat_id") + @Nullable + String chatId, + + @JsonProperty("message_id") + int messageId, + + @JsonProperty("inline_message_id") + @Nullable + String inlineMessageId +) implements ApiMethod { + + public static GetGameHighScores.Builder ofBuilder(long userId) { + return new GetGameHighScores.Builder(userId); + } + + @Override + public @NotNull String getEndpointURL() { + return "getGameHighScores"; + } + + @Override + public GameHighScore @NotNull [] deserializeResponse(@NotNull String answer) throws TelegramRequestException { + return deserializeResponse(answer, GameHighScore[].class); + } + + public static class Builder { + private final long userId; + private String chatId; + private int messageId; + private String inlineMessageId; + + Builder(long userId) { + this.userId = userId; + } + + public Builder chatId(String chatId) { + this.chatId = chatId; + return this; + } + + public Builder messageId(int messageId) { + this.messageId = messageId; + return this; + } + + public Builder inlineMessageId(String inlineMessageId) { + this.inlineMessageId = inlineMessageId; + return this; + } + + public GetGameHighScores build() { + return new GetGameHighScores(this.userId, this.chatId, this.messageId, this.inlineMessageId); + } + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendAnimation.java b/src/main/java/org/teleight/teleightbots/api/methods/SendAnimation.java index 48baeb7..19c252a 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendAnimation.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendAnimation.java @@ -54,6 +54,9 @@ public record SendAnimation( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "has_spoiler") boolean hasSpoiler, @@ -63,6 +66,9 @@ public record SendAnimation( @JsonProperty(value = "protect_content") boolean protectContent, + @JsonProperty(value = "message_effect_id") + String messageEffectId, + @JsonProperty(value = "reply_parameters") @Nullable ReplyParameters replyParameters, @@ -94,9 +100,11 @@ public Map getParameters() { parameters.put("caption", caption); parameters.put("parse_mode", parseMode); parameters.put("caption_entities", captionEntities); + parameters.put("show_caption_above_media", showCaptionAboveMedia); parameters.put("has_spoiler", hasSpoiler); parameters.put("disable_notification", disableNotification); parameters.put("protect_content", protectContent); + parameters.put("message_effect_id", messageEffectId); parameters.put("reply_parameters", replyParameters); parameters.put("reply_markup", replyMarkup); return parameters; @@ -122,9 +130,11 @@ public static class Builder { private String caption; private ParseMode parseMode; private MessageEntity[] captionEntities; + private boolean showCaptionAboveMedia; private boolean hasSpoiler; private boolean disableNotification; private boolean protectContent; + private String messageEffectId; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; @@ -178,6 +188,11 @@ public Builder captionEntities(MessageEntity[] captionEntities) { return this; } + public Builder showCaptionAboveMedia(boolean showCaptionAboveMedia) { + this.showCaptionAboveMedia = showCaptionAboveMedia; + return this; + } + public Builder hasSpoiler(boolean hasSpoiler) { this.hasSpoiler = hasSpoiler; return this; @@ -193,6 +208,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -204,7 +224,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendAnimation build() { - return new SendAnimation(this.businessConnectionId, this.chatId, this.messageThreadId, this.animation, this.duration, this.width, this.height, this.thumbnail, this.caption, this.parseMode, this.captionEntities, this.hasSpoiler, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendAnimation(this.businessConnectionId, this.chatId, this.messageThreadId, this.animation, this.duration, this.width, this.height, this.thumbnail, this.caption, this.parseMode, this.captionEntities, this.showCaptionAboveMedia, this.hasSpoiler, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendAudio.java b/src/main/java/org/teleight/teleightbots/api/methods/SendAudio.java index 77eb962..babda1c 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendAudio.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendAudio.java @@ -62,6 +62,9 @@ public record SendAudio( @JsonProperty(value = "protect_content") boolean protectContent, + @JsonProperty(value = "message_effect_id") + String messageEffectId, + @JsonProperty(value = "reply_parameters") @Nullable ReplyParameters replyParameters, @@ -94,6 +97,7 @@ public Map getParameters() { parameters.put("title", title); parameters.put("disable_notification", disableNotification); parameters.put("protect_content", protectContent); + parameters.put("message_effect_id", messageEffectId); parameters.put("reply_parameters", replyParameters); parameters.put("reply_markup", replyMarkup); return parameters; @@ -121,6 +125,7 @@ public static class Builder { private InputFile thumbnail; private boolean disableNotification; private boolean protectContent; + private String messageEffectId; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; @@ -184,6 +189,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -195,7 +205,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendAudio build() { - return new SendAudio(this.businessConnectionId, this.chatId, this.messageThreadId, this.audio, this.caption, this.parseMode, this.captionEntities, this.duration, this.performer, this.title, this.thumbnail, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendAudio(this.businessConnectionId, this.chatId, this.messageThreadId, this.audio, this.caption, this.parseMode, this.captionEntities, this.duration, this.performer, this.title, this.thumbnail, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendContact.java b/src/main/java/org/teleight/teleightbots/api/methods/SendContact.java new file mode 100644 index 0000000..05e63a0 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendContact.java @@ -0,0 +1,140 @@ +package org.teleight.teleightbots.api.methods; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.teleight.teleightbots.api.ApiMethod; +import org.teleight.teleightbots.api.objects.Dice; +import org.teleight.teleightbots.api.objects.ReplyKeyboard; +import org.teleight.teleightbots.api.objects.ReplyParameters; +import org.teleight.teleightbots.exception.exceptions.TelegramRequestException; + +public record SendContact( + @JsonProperty("business_connection_id") + @Nullable + String businessConnectionId, + + @JsonProperty(value = "chat_id", required = true) + @NotNull + String chatId, + + @JsonProperty("message_thread_id") + int messageThreadId, + + @JsonProperty(value = "phone_number", required = true) + int phoneNumber, + + @JsonProperty(value = "first_name", required = true) + String firstName, + + @JsonProperty("last_name") + @Nullable + String lastName, + + @JsonProperty("vcard") + @Nullable + String vcard, + + @JsonProperty("disable_notification") + boolean disableNotification, + + @JsonProperty("protect_content") + boolean protectContent, + + @JsonProperty("message_effect_id") + @Nullable + String messageEffectId, + + @JsonProperty("reply_parameters") + @Nullable + ReplyParameters replyParameters, + + @JsonProperty("reply_markup") + @Nullable + ReplyKeyboard replyMarkup +) implements ApiMethod { + + public static Builder ofBuilder(String chatId, int phoneNumber, String firstName) { + return new SendContact.Builder(chatId, phoneNumber, firstName); + } + + @Override + public @NotNull String getEndpointURL() { + return "sendDice"; + } + + @Override + public @NotNull Dice deserializeResponse(@NotNull String answer) throws TelegramRequestException { + return deserializeResponse(answer, Dice.class); + } + + public static class Builder { + private String businessConnectionId; + private final String chatId; + private int messageThreadId; + private final int phoneNumber; + private final String firstName; + private String lastName; + private String vcard; + private boolean disableNotification; + private boolean protectContent; + private String messageEffectId; + private ReplyParameters replyParameters; + private ReplyKeyboard replyMarkup; + + Builder(String chatId, int phoneNumber, String firstName) { + this.chatId = chatId; + this.phoneNumber = phoneNumber; + this.firstName = firstName; + } + + public Builder businessConnectionId(String businessConnectionId) { + this.businessConnectionId = businessConnectionId; + return this; + } + + public Builder messageThreadId(int messageThreadId) { + this.messageThreadId = messageThreadId; + return this; + } + + public Builder lastName(String lastName) { + this.lastName = lastName; + return this; + } + + public Builder vcard(String vcard) { + this.vcard = vcard; + return this; + } + + public Builder disableNotification(boolean disableNotification) { + this.disableNotification = disableNotification; + return this; + } + + public Builder protectContent(boolean protectContent) { + this.protectContent = protectContent; + return this; + } + + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + + public Builder replyParameters(ReplyParameters replyParameters) { + this.replyParameters = replyParameters; + return this; + } + + public Builder replyMarkup(ReplyKeyboard replyMarkup) { + this.replyMarkup = replyMarkup; + return this; + } + + public SendContact build() { + return new SendContact(this.businessConnectionId, this.chatId, this.messageThreadId, this.phoneNumber, this.firstName, this.lastName, this.vcard, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); + } + } +} diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendDice.java b/src/main/java/org/teleight/teleightbots/api/methods/SendDice.java index 69c4ce2..6f1fa0e 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendDice.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendDice.java @@ -10,7 +10,7 @@ import org.teleight.teleightbots.exception.exceptions.TelegramRequestException; public record SendDice( - @JsonProperty(value = "business_connection_id") + @JsonProperty("business_connection_id") @Nullable String businessConnectionId, @@ -18,24 +18,28 @@ public record SendDice( @NotNull String chatId, - @JsonProperty(value = "message_thread_id") + @JsonProperty("message_thread_id") int messageThreadId, - @JsonProperty(value = "emoji") + @JsonProperty("emoji") @Nullable String emoji, - @JsonProperty(value = "disable_notification") + @JsonProperty("disable_notification") boolean disableNotification, - @JsonProperty(value = "protect_content") + @JsonProperty("protect_content") boolean protectContent, - @JsonProperty(value = "reply_parameters") + @JsonProperty("message_effect_id") + @Nullable + String messageEffectId, + + @JsonProperty("reply_parameters") @Nullable ReplyParameters replyParameters, - @JsonProperty(value = "reply_markup") + @JsonProperty("reply_markup") @Nullable ReplyKeyboard replyMarkup ) implements ApiMethod { @@ -61,6 +65,7 @@ public static class Builder { private String emoji; private boolean disableNotification; private boolean protectContent; + private String messageEffectId; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; @@ -93,6 +98,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -104,7 +114,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendDice build() { - return new SendDice(this.businessConnectionId, this.chatId, this.messageThreadId, this.emoji, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendDice(this.businessConnectionId, this.chatId, this.messageThreadId, this.emoji, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendDocument.java b/src/main/java/org/teleight/teleightbots/api/methods/SendDocument.java index c4c3a34..b4b44c3 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendDocument.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendDocument.java @@ -54,6 +54,9 @@ public record SendDocument( @JsonProperty(value = "protect_content") boolean protectContent, + @JsonProperty(value = "message_effect_id") + String messageEffectId, + @JsonProperty(value = "reply_parameters") @Nullable ReplyParameters replyParameters, @@ -84,6 +87,7 @@ public Map getParameters() { parameters.put("disable_content_type_detection", disableContentTypeDetection); parameters.put("disable_notification", disableNotification); parameters.put("protect_content", protectContent); + parameters.put("message_effect_id", messageEffectId); parameters.put("reply_parameters", replyParameters); parameters.put("reply_markup", replyMarkup); return parameters; @@ -109,6 +113,7 @@ public static class Builder { private boolean disableContentTypeDetection; private boolean disableNotification; private boolean protectContent; + private String messageEffectId; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; @@ -162,6 +167,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -173,7 +183,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendDocument build() { - return new SendDocument(this.businessConnectionId, this.chatId, this.messageThreadId, this.document, this.thumbnail, this.caption, this.parseMode, this.captionEntities, this.disableContentTypeDetection, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendDocument(this.businessConnectionId, this.chatId, this.messageThreadId, this.document, this.thumbnail, this.caption, this.parseMode, this.captionEntities, this.disableContentTypeDetection, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendGame.java b/src/main/java/org/teleight/teleightbots/api/methods/SendGame.java new file mode 100644 index 0000000..17803b4 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendGame.java @@ -0,0 +1,109 @@ +package org.teleight.teleightbots.api.methods; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.teleight.teleightbots.api.ApiMethodMessage; +import org.teleight.teleightbots.api.objects.ReplyKeyboard; +import org.teleight.teleightbots.api.objects.ReplyParameters; + +public record SendGame( + @JsonProperty("business_connection_id") + @Nullable + String businessConnectionId, + + @JsonProperty(value = "chat_id", required = true) + @NotNull + String chatId, + + @JsonProperty("message_thread_id") + int messageThreadId, + + @JsonProperty(value = "game_short_name", required = true) + @NotNull + String gameShortName, + + @JsonProperty("disable_notification") + boolean disableNotification, + + @JsonProperty("protect_content") + boolean protectContent, + + @JsonProperty("message_effect_id") + String messageEffectId, + + @JsonProperty("reply_parameters") + @Nullable + ReplyParameters replyParameters, + + @JsonProperty("reply_markup") + @Nullable + ReplyKeyboard replyMarkup +) implements ApiMethodMessage { + + public static SendGame.Builder ofBuilder(String chatId, String gameShortName) { + return new SendGame.Builder(chatId, gameShortName); + } + + @Override + public @NotNull String getEndpointURL() { + return "sendGame"; + } + + public static class Builder { + private String businessConnectionId; + private final String chatId; + private int messageThreadId; + private final String gameShortName; + private boolean disableNotification; + private boolean protectContent; + private String messageEffectId; + private ReplyParameters replyParameters; + private ReplyKeyboard replyMarkup; + + Builder(String chatId, String gameShortName) { + this.chatId = chatId; + this.gameShortName = gameShortName; + } + + public Builder businessConnectionId(String businessConnectionId) { + this.businessConnectionId = businessConnectionId; + return this; + } + + public Builder messageThreadId(int messageThreadId) { + this.messageThreadId = messageThreadId; + return this; + } + + public Builder disableNotification(boolean disableNotification) { + this.disableNotification = disableNotification; + return this; + } + + public Builder protectContent(boolean protectContent) { + this.protectContent = protectContent; + return this; + } + + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + + public Builder replyParameters(ReplyParameters replyParameters) { + this.replyParameters = replyParameters; + return this; + } + + public Builder replyMarkup(ReplyKeyboard replyMarkup) { + this.replyMarkup = replyMarkup; + return this; + } + + public SendGame build() { + return new SendGame(this.businessConnectionId, this.chatId, this.messageThreadId, this.gameShortName, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); + } + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendInvoice.java b/src/main/java/org/teleight/teleightbots/api/methods/SendInvoice.java new file mode 100644 index 0000000..b8257da --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendInvoice.java @@ -0,0 +1,269 @@ +package org.teleight.teleightbots.api.methods; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.teleight.teleightbots.api.ApiMethodMessage; +import org.teleight.teleightbots.api.objects.InlineKeyboardMarkup; +import org.teleight.teleightbots.api.objects.LabeledPrice; +import org.teleight.teleightbots.api.objects.ReplyParameters; + +public record SendInvoice( + @JsonProperty(value = "chat_id", required = true) + @NotNull + String chatId, + + @JsonProperty(value = "message_thread_id") + int messageThreadId, + + @JsonProperty(value = "title", required = true) + @NotNull + String title, + + @JsonProperty(value = "description", required = true) + @NotNull + String description, + + @JsonProperty(value = "payload", required = true) + @NotNull + String payload, + + @JsonProperty(value = "provider_token") + String providerToken, + + @JsonProperty(value = "currency", required = true) + @NotNull + String currency, + + @JsonProperty(value = "prices", required = true) + @NotNull + LabeledPrice[] prices, + + @JsonProperty(value = "max_tip_amount") + int maxTipAmount, + + @JsonProperty(value = "suggested_tip_amounts") + int[] suggestedTipAmounts, + + @JsonProperty(value = "start_parameter") + String startParameter, + + @JsonProperty(value = "provider_data") + String providerData, + + @JsonProperty(value = "photo_url") + String photoUrl, + + @JsonProperty(value = "photo_size") + int photoSize, + + @JsonProperty(value = "photo_width") + int photoWidth, + + @JsonProperty(value = "photo_height") + int photoHeight, + + @JsonProperty(value = "need_name") + boolean needName, + + @JsonProperty(value = "need_phone_number") + boolean needPhoneNumber, + + @JsonProperty(value = "need_email") + boolean needEmail, + + @JsonProperty(value = "need_shipping_address") + boolean needShippingAddress, + + @JsonProperty(value = "send_phone_number_to_provider") + boolean sendPhoneNumberToProvider, + + @JsonProperty(value = "send_email_to_provider") + boolean sendEmailToProvider, + + @JsonProperty(value = "is_flexible") + boolean isFlexible, + + @JsonProperty(value = "disable_notification") + boolean disableNotification, + + @JsonProperty(value = "protect_content") + boolean protectContent, + + @JsonProperty(value = "message_effect_id") + String messageEffectId, + + @JsonProperty(value = "reply_parameters") + ReplyParameters replyParameters, + + @JsonProperty(value = "reply_markup") + InlineKeyboardMarkup replyMarkup +) implements ApiMethodMessage { + + public static SendInvoice.Builder ofBuilder(String chatId, String title, String description, String payload, String currency, LabeledPrice[] prices) { + return new SendInvoice.Builder(chatId, title, description, payload, currency, prices); + } + + @Override + public @NotNull String getEndpointURL() { + return "sendInvoice"; + } + + public static class Builder { + private final String chatId; + private final String title; + private final String description; + private final String payload; + private final String currency; + private final LabeledPrice[] prices; + private int messageThreadId; + private String providerToken; + private int maxTipAmount; + private int[] suggestedTipAmounts; + private String startParameter; + private String providerData; + private String photoUrl; + private int photoSize; + private int photoWidth; + private int photoHeight; + private boolean needName; + private boolean needPhoneNumber; + private boolean needEmail; + private boolean needShippingAddress; + private boolean sendPhoneNumberToProvider; + private boolean sendEmailToProvider; + private boolean isFlexible; + private boolean disableNotification; + private boolean protectContent; + private String messageEffectId; + private ReplyParameters replyParameters; + private InlineKeyboardMarkup replyMarkup; + + Builder(String chatId, String title, String description, String payload, String currency, LabeledPrice[] prices) { + this.chatId = chatId; + this.title = title; + this.description = description; + this.payload = payload; + this.currency = currency; + this.prices = prices; + } + + public Builder messageThreadId(Integer messageThreadId) { + this.messageThreadId = messageThreadId; + return this; + } + + public Builder providerToken(String providerToken) { + this.providerToken = providerToken; + return this; + } + + public Builder maxTipAmount(Integer maxTipAmount) { + this.maxTipAmount = maxTipAmount; + return this; + } + + public Builder suggestedTipAmounts(int[] suggestedTipAmounts) { + this.suggestedTipAmounts = suggestedTipAmounts; + return this; + } + + public Builder startParameter(String startParameter) { + this.startParameter = startParameter; + return this; + } + + public Builder providerData(String providerData) { + this.providerData = providerData; + return this; + } + + public Builder photoUrl(String photoUrl) { + this.photoUrl = photoUrl; + return this; + } + + public Builder photoSize(int photoSize) { + this.photoSize = photoSize; + return this; + } + + public Builder photoWidth(int photoWidth) { + this.photoWidth = photoWidth; + return this; + } + + public Builder photoHeight(int photoHeight) { + this.photoHeight = photoHeight; + return this; + } + + public Builder needName(boolean needName) { + this.needName = needName; + return this; + } + + public Builder needPhoneNumber(boolean needPhoneNumber) { + this.needPhoneNumber = needPhoneNumber; + return this; + } + + public Builder needEmail(boolean needEmail) { + this.needEmail = needEmail; + return this; + } + + public Builder needShippingAddress(boolean needShippingAddress) { + this.needShippingAddress = needShippingAddress; + return this; + } + + public Builder sendPhoneNumberToProvider(boolean sendPhoneNumberToProvider) { + this.sendPhoneNumberToProvider = sendPhoneNumberToProvider; + return this; + } + + public Builder sendEmailToProvider(boolean sendEmailToProvider) { + this.sendEmailToProvider = sendEmailToProvider; + return this; + } + + public Builder isFlexible(boolean isFlexible) { + this.isFlexible = isFlexible; + return this; + } + + public Builder disableNotification(boolean disableNotification) { + this.disableNotification = disableNotification; + return this; + } + + public Builder protectContent(boolean protectContent) { + this.protectContent = protectContent; + return this; + } + + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + + public Builder replyParameters(ReplyParameters replyParameters) { + this.replyParameters = replyParameters; + return this; + } + + public Builder replyMarkup(InlineKeyboardMarkup replyMarkup) { + this.replyMarkup = replyMarkup; + return this; + } + + public SendInvoice build() { + return new SendInvoice(this.chatId, this.messageThreadId, this.title, this.description, this.payload, + this.providerToken, this.currency, this.prices, this.maxTipAmount, this.suggestedTipAmounts, + this.startParameter, this.providerData, this.photoUrl, this.photoSize, this.photoWidth, this.photoHeight, this.needName, + this.needPhoneNumber, this.needEmail, this.needShippingAddress, this.sendPhoneNumberToProvider, this.sendEmailToProvider, this.isFlexible, + this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); + } + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendLocation.java b/src/main/java/org/teleight/teleightbots/api/methods/SendLocation.java index 0e4c8a9..0cb6d97 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendLocation.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendLocation.java @@ -45,6 +45,9 @@ public record SendLocation( @JsonProperty(value = "protect_content") boolean protectContent, + @JsonProperty(value = "message_effect_id") + String messageEffectId, + @JsonProperty(value = "reply_parameters") @Nullable ReplyParameters replyParameters, @@ -80,6 +83,7 @@ public static class Builder { private int proximityAlertRadius; private boolean disableNotification; private boolean protectContent; + private String messageEffectId; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; @@ -129,6 +133,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -140,7 +149,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendLocation build() { - return new SendLocation(this.businessConnectionId, this.chatId, this.messageThreadId, this.latitude, this.longitude, this.horizontalAccuracy, this.livePeriod, this.heading, this.proximityAlertRadius, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendLocation(this.businessConnectionId, this.chatId, this.messageThreadId, this.latitude, this.longitude, this.horizontalAccuracy, this.livePeriod, this.heading, this.proximityAlertRadius, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendMessage.java b/src/main/java/org/teleight/teleightbots/api/methods/SendMessage.java index 5fd0158..df02804 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendMessage.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendMessage.java @@ -44,6 +44,9 @@ public record SendMessage( @JsonProperty(value = "protect_content") boolean protectContent, + @JsonProperty(value = "message_effect_id") + String messageEffectId, + @JsonProperty(value = "reply_parameters") @Nullable ReplyParameters replyParameters, @@ -72,6 +75,7 @@ public static class Builder { private LinkPreviewOptions linkPreviewOptions; private boolean disableNotification; private boolean protectContent; + private String messageEffectId; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; @@ -115,6 +119,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -126,7 +135,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendMessage build() { - return new SendMessage(this.businessConnectionId, this.chatId, this.messageThreadId, this.text, this.parseMode, this.entities, this.linkPreviewOptions, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendMessage(this.businessConnectionId, this.chatId, this.messageThreadId, this.text, this.parseMode, this.entities, this.linkPreviewOptions, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendPhoto.java b/src/main/java/org/teleight/teleightbots/api/methods/SendPhoto.java index 9b3f4b3..6e2ae07 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendPhoto.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendPhoto.java @@ -41,6 +41,9 @@ public record SendPhoto( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "has_spoiler") boolean hasSpoiler, @@ -50,6 +53,9 @@ public record SendPhoto( @JsonProperty(value = "protect_content") boolean protectContent, + @JsonProperty(value = "message_effect_id") + String messageEffectId, + @JsonProperty(value = "reply_parameters") @Nullable ReplyParameters replyParameters, @@ -77,9 +83,11 @@ public Map getParameters() { parameters.put("caption", caption); parameters.put("parse_mode", parseMode); parameters.put("caption_entities", captionEntities); + parameters.put("show_caption_above_media", showCaptionAboveMedia); parameters.put("has_spoiler", hasSpoiler); parameters.put("disable_notification", disableNotification); parameters.put("protect_content", protectContent); + parameters.put("message_effect_id", messageEffectId); parameters.put("reply_parameters", replyParameters); parameters.put("reply_markup", replyMarkup); return parameters; @@ -100,9 +108,11 @@ public static class Builder { private String caption; private ParseMode parseMode; private MessageEntity[] captionEntities; + private boolean showCaptionAboveMedia; private boolean hasSpoiler; private boolean disableNotification; private boolean protectContent; + private String messageEffectId; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; @@ -136,6 +146,11 @@ public Builder captionEntities(MessageEntity[] captionEntities) { return this; } + public Builder showCaptionAboveMedia(boolean showCaptionAboveMedia) { + this.showCaptionAboveMedia = showCaptionAboveMedia; + return this; + } + public Builder hasSpoiler(boolean hasSpoiler) { this.hasSpoiler = hasSpoiler; return this; @@ -151,6 +166,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -162,7 +182,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendPhoto build() { - return new SendPhoto(this.businessConnectionId, this.chatId, this.messageThreadId, this.photo, this.caption, this.parseMode, this.captionEntities, this.hasSpoiler, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendPhoto(this.businessConnectionId, this.chatId, this.messageThreadId, this.photo, this.caption, this.parseMode, this.captionEntities, this.showCaptionAboveMedia, this.hasSpoiler, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendPoll.java b/src/main/java/org/teleight/teleightbots/api/methods/SendPoll.java index a0ea3a7..7caf17a 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendPoll.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendPoll.java @@ -80,6 +80,9 @@ public record SendPoll( @JsonProperty(value = "protect_content") boolean protectContent, + @JsonProperty(value = "message_effect_id") + String messageEffectId, + @JsonProperty(value = "reply_parameters") @Nullable ReplyParameters replyParameters, @@ -123,6 +126,7 @@ public static class Builder { private boolean isClosed; private boolean disableNotification; private boolean protectContent; + private String messageEffectId; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; @@ -212,6 +216,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -223,7 +232,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendPoll build() { - return new SendPoll(this.businessConnectionId, this.chatId, this.messageThreadId, this.question, this.questionParseMode, this.questionEntities, this.options, this.isAnonymous, this.type, this.allowsMultipleAnswers, this.correctOptionId, this.explanation, this.explanationParseMode, this.explanationEntities, this.openPeriod, this.closeDate, this.isClosed, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendPoll(this.businessConnectionId, this.chatId, this.messageThreadId, this.question, this.questionParseMode, this.questionEntities, this.options, this.isAnonymous, this.type, this.allowsMultipleAnswers, this.correctOptionId, this.explanation, this.explanationParseMode, this.explanationEntities, this.openPeriod, this.closeDate, this.isClosed, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendSticker.java b/src/main/java/org/teleight/teleightbots/api/methods/SendSticker.java new file mode 100644 index 0000000..984cbce --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendSticker.java @@ -0,0 +1,144 @@ +package org.teleight.teleightbots.api.methods; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.teleight.teleightbots.api.MultiPartApiMethodMessage; +import org.teleight.teleightbots.api.objects.InputFile; +import org.teleight.teleightbots.api.objects.ReplyKeyboard; +import org.teleight.teleightbots.api.objects.ReplyParameters; + +import java.util.HashMap; +import java.util.Map; + +public record SendSticker( + @JsonProperty(value = "business_connection_id") + @Nullable + String businessConnectionId, + + @JsonProperty(value = "chat_id", required = true) + @NotNull + String chatId, + + @JsonProperty(value = "message_thread_id") + int messageThreadId, + + @JsonProperty(value = "sticker", required = true) + @NotNull + InputFile sticker, + + @JsonProperty(value = "emoji") + @Nullable + String emoji, + + @JsonProperty(value = "disable_notification") + boolean disableNotification, + + @JsonProperty(value = "protect_content") + boolean protectContent, + + @JsonProperty(value = "message_effect_id") + String messageEffectId, + + @JsonProperty(value = "reply_parameters") + @Nullable + ReplyParameters replyParameters, + + @JsonProperty(value = "reply_markup") + @Nullable + ReplyKeyboard replyMarkup +) implements MultiPartApiMethodMessage { + + public static Builder ofBuilder(String chatId, InputFile document) { + return new SendSticker.Builder(chatId, document); + } + + @Override + public @NotNull String getEndpointURL() { + return "sendDocument"; + } + + @Override + public Map getParameters() { + final Map parameters = new HashMap<>(); + parameters.put("business_connection_id", businessConnectionId); + parameters.put("chat_id", chatId); + parameters.put("message_thread_id", messageThreadId); + parameters.put("emoji", emoji); + parameters.put("disable_notification", disableNotification); + parameters.put("protect_content", protectContent); + parameters.put("message_effect_id", messageEffectId); + parameters.put("reply_parameters", replyParameters); + parameters.put("reply_markup", replyMarkup); + return parameters; + } + + @Override + public Map getInputFiles() { + final Map files = new HashMap<>(); + files.put("sticker", sticker); + return files; + } + + public static class Builder { + private String businessConnectionId; + private final String chatId; + private int messageThreadId; + private final InputFile sticker; + private String emoji; + private boolean disableNotification; + private boolean protectContent; + private String messageEffectId; + private ReplyParameters replyParameters; + private ReplyKeyboard replyMarkup; + + Builder(String chatId, InputFile sticker) { + this.chatId = chatId; + this.sticker = sticker; + } + + public Builder businessConnectionId(String businessConnectionId) { + this.businessConnectionId = businessConnectionId; + return this; + } + + public Builder messageThreadId(int messageThreadId) { + this.messageThreadId = messageThreadId; + return this; + } + + public Builder emoji(String emoji) { + this.emoji = emoji; + return this; + } + + public Builder disableNotification(boolean disableNotification) { + this.disableNotification = disableNotification; + return this; + } + + public Builder protectContent(boolean protectContent) { + this.protectContent = protectContent; + return this; + } + + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + + public Builder replyParameters(ReplyParameters replyParameters) { + this.replyParameters = replyParameters; + return this; + } + + public Builder replyMarkup(ReplyKeyboard replyMarkup) { + this.replyMarkup = replyMarkup; + return this; + } + + public SendSticker build() { + return new SendSticker(this.businessConnectionId, this.chatId, this.messageThreadId, this.sticker, this.emoji, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); + } + } +} diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendVenue.java b/src/main/java/org/teleight/teleightbots/api/methods/SendVenue.java index 40e431c..d88d554 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendVenue.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendVenue.java @@ -57,6 +57,9 @@ public record SendVenue( @JsonProperty(value = "protect_content") boolean protectContent, + @JsonProperty(value = "message_effect_id") + String messageEffectId, + @JsonProperty(value = "reply_parameters") @Nullable ReplyParameters replyParameters, @@ -94,6 +97,7 @@ public static class Builder { private String googlePlaceType; private boolean disableNotification; private boolean protectContent; + private String messageEffectId; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; @@ -145,6 +149,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -156,7 +165,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendVenue build() { - return new SendVenue(this.businessConnectionId, this.chatId, this.messageThreadId, this.latitude, this.longitude, this.title, this.address, this.foursquareId, this.foursquareType, this.googlePlaceId, this.googlePlaceType, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendVenue(this.businessConnectionId, this.chatId, this.messageThreadId, this.latitude, this.longitude, this.title, this.address, this.foursquareId, this.foursquareType, this.googlePlaceId, this.googlePlaceType, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendVideo.java b/src/main/java/org/teleight/teleightbots/api/methods/SendVideo.java index 6c49c48..e0bc936 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendVideo.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendVideo.java @@ -54,6 +54,9 @@ public record SendVideo( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "has_spoiler") boolean hasSpoiler, @@ -66,6 +69,9 @@ public record SendVideo( @JsonProperty(value = "protect_content") boolean protectContent, + @JsonProperty(value = "message_effect_id") + String messageEffectId, + @JsonProperty(value = "reply_parameters") @Nullable ReplyParameters replyParameters, @@ -96,10 +102,12 @@ public Map getParameters() { parameters.put("caption", caption); parameters.put("parse_mode", parseMode); parameters.put("caption_entities", captionEntities); + parameters.put("show_caption_above_media", showCaptionAboveMedia); parameters.put("has_spoiler", hasSpoiler); parameters.put("supports_streaming", supportsStreaming); parameters.put("disable_notification", disableNotification); parameters.put("protect_content", protectContent); + parameters.put("message_effect_id", messageEffectId); parameters.put("reply_parameters", replyParameters); parameters.put("reply_markup", replyMarkup); return parameters; @@ -125,10 +133,12 @@ public static class Builder { private String caption; private ParseMode parseMode; private MessageEntity[] captionEntities; + private boolean showCaptionAboveMedia; private boolean hasSpoiler; private boolean supportsStreaming; private boolean disableNotification; private boolean protectContent; + private String messageEffectId; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; @@ -182,6 +192,11 @@ public Builder captionEntities(MessageEntity[] captionEntities) { return this; } + public Builder showCaptionAboveMedia(boolean showCaptionAboveMedia) { + this.showCaptionAboveMedia = showCaptionAboveMedia; + return this; + } + public Builder hasSpoiler(boolean hasSpoiler) { this.hasSpoiler = hasSpoiler; return this; @@ -202,6 +217,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -213,7 +233,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendVideo build() { - return new SendVideo(this.businessConnectionId, this.chatId, this.messageThreadId, this.video, this.duration, this.width, this.height, this.thumbnail, this.caption, this.parseMode, this.captionEntities, this.hasSpoiler, this.supportsStreaming, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendVideo(this.businessConnectionId, this.chatId, this.messageThreadId, this.video, this.duration, this.width, this.height, this.thumbnail, this.caption, this.parseMode, this.captionEntities, this.showCaptionAboveMedia, this.hasSpoiler, this.supportsStreaming, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendVideoNote.java b/src/main/java/org/teleight/teleightbots/api/methods/SendVideoNote.java index b5ab203..6953e92 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendVideoNote.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendVideoNote.java @@ -43,6 +43,9 @@ public record SendVideoNote( @JsonProperty(value = "protect_content") boolean protectContent, + @JsonProperty(value = "message_effect_id") + String messageEffectId, + @JsonProperty(value = "reply_parameters") @Nullable ReplyParameters replyParameters, @@ -71,6 +74,7 @@ public Map getParameters() { parameters.put("length", length); parameters.put("disable_notification", disableNotification); parameters.put("protect_content", protectContent); + parameters.put("message_effect_id", messageEffectId); parameters.put("reply_parameters", replyParameters); parameters.put("reply_markup", replyMarkup); return parameters; @@ -94,6 +98,7 @@ public static class Builder { private InputFile thumbnail; private boolean disableNotification; private boolean protectContent; + private String messageEffectId; private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; @@ -137,6 +142,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -148,7 +158,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendVideoNote build() { - return new SendVideoNote(this.businessConnectionId, this.chatId, this.messageThreadId, this.videoNote, this.duration, this.length, this.thumbnail, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendVideoNote(this.businessConnectionId, this.chatId, this.messageThreadId, this.videoNote, this.duration, this.length, this.thumbnail, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SendVoice.java b/src/main/java/org/teleight/teleightbots/api/methods/SendVoice.java index 3c3f732..c8e0889 100644 --- a/src/main/java/org/teleight/teleightbots/api/methods/SendVoice.java +++ b/src/main/java/org/teleight/teleightbots/api/methods/SendVoice.java @@ -50,6 +50,9 @@ public record SendVoice( @JsonProperty(value = "protect_content") boolean protectContent, + @JsonProperty(value = "message_effect_id") + String messageEffectId, + @JsonProperty(value = "reply_parameters") @Nullable ReplyParameters replyParameters, @@ -80,6 +83,7 @@ public Map getParameters() { parameters.put("duration", duration); parameters.put("disable_notification", disableNotification); parameters.put("protect_content", protectContent); + parameters.put("message_effect_id", messageEffectId); parameters.put("reply_parameters", replyParameters); parameters.put("reply_markup", replyMarkup); return parameters; @@ -103,7 +107,8 @@ public static class Builder { private int duration; private boolean disableNotification; private boolean protectContent; - private @Nullable ReplyParameters replyParameters; + private String messageEffectId; + private ReplyParameters replyParameters; private ReplyKeyboard replyMarkup; Builder(String chatId, InputFile voice) { @@ -151,6 +156,11 @@ public Builder protectContent(boolean protectContent) { return this; } + public Builder messageEffectId(String messageEffectId) { + this.messageEffectId = messageEffectId; + return this; + } + public Builder replyParameters(ReplyParameters replyParameters) { this.replyParameters = replyParameters; return this; @@ -162,7 +172,7 @@ public Builder replyMarkup(ReplyKeyboard replyMarkup) { } public SendVoice build() { - return new SendVoice(this.businessConnectionId, this.chatId, this.messageThreadId, this.voice, this.caption, this.parseMode, this.captionEntities, this.duration, this.disableNotification, this.protectContent, this.replyParameters, this.replyMarkup); + return new SendVoice(this.businessConnectionId, this.chatId, this.messageThreadId, this.voice, this.caption, this.parseMode, this.captionEntities, this.duration, this.disableNotification, this.protectContent, this.messageEffectId, this.replyParameters, this.replyMarkup); } } } diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SetGameScore.java b/src/main/java/org/teleight/teleightbots/api/methods/SetGameScore.java new file mode 100644 index 0000000..fcc0c82 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/methods/SetGameScore.java @@ -0,0 +1,102 @@ +package org.teleight.teleightbots.api.methods; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.checkerframework.common.value.qual.IntRange; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.teleight.teleightbots.api.ApiMethodMultiResponse; +import org.teleight.teleightbots.api.objects.Message; + +import java.io.Serializable; +import java.util.List; + +public record SetGameScore( + @JsonProperty(value = "user_id", required = true) + long userId, + + @JsonProperty(value = "score", required = true) + @IntRange(from = 0) + int score, + + @JsonProperty("force") + boolean force, + + @JsonProperty("disable_edit_message") + boolean disableEditMessage, + + @JsonProperty("chat_id") + @Nullable + String chatId, + + @JsonProperty("message_id") + int messageId, + + @JsonProperty("inline_message_id") + @Nullable + String inlineMessageId +) implements ApiMethodMultiResponse { + + public static SetGameScore.Builder ofBuilder(long userId, @IntRange(from = 0) int score) { + return new SetGameScore.Builder(userId, score); + } + + @Override + public List> getSerializableClasses() { + return List.of(Message.class, Boolean.class); + } + + @Override + public @NotNull String getEndpointURL() { + return "setGameScore"; + } + + public static class Builder { + private final long userId; + private int score; + private boolean force; + private boolean disableEditMessage; + private String chatId; + private int messageId; + private String inlineMessageId; + + Builder(long userId, @IntRange(from = 0) int score) { + this.userId = userId; + this.score = score; + } + + public Builder score(int score) { + this.score = score; + return this; + } + + public Builder force(boolean force) { + this.force = force; + return this; + } + + public Builder disableEditMessage(boolean disableEditMessage) { + this.disableEditMessage = disableEditMessage; + return this; + } + + public Builder chatId(String chatId) { + this.chatId = chatId; + return this; + } + + public Builder messageId(int messageId) { + this.messageId = messageId; + return this; + } + + public Builder inlineMessageId(String inlineMessageId) { + this.inlineMessageId = inlineMessageId; + return this; + } + + public SetGameScore build() { + return new SetGameScore(this.userId, this.score, this.force, this.disableEditMessage, this.chatId, this.messageId, this.inlineMessageId); + } + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/methods/SetPassportDataErrors.java b/src/main/java/org/teleight/teleightbots/api/methods/SetPassportDataErrors.java new file mode 100644 index 0000000..86b1222 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/methods/SetPassportDataErrors.java @@ -0,0 +1,40 @@ +package org.teleight.teleightbots.api.methods; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.teleight.teleightbots.api.ApiMethodBoolean; +import org.teleight.teleightbots.api.objects.PassportElementError; + +public record SetPassportDataErrors( + @JsonProperty(value = "user_id", required = true) + long userId, + + @JsonProperty(value = "errors", required = true) + @NotNull + PassportElementError[] errors +) implements ApiMethodBoolean { + + public static SetPassportDataErrors.Builder ofBuilder(long userId, PassportElementError[] errors) { + return new SetPassportDataErrors.Builder(userId, errors); + } + + @Override + public @NotNull String getEndpointURL() { + return "setPassportDataErrors"; + } + + public static class Builder { + private final long userId; + private final PassportElementError[] errors; + + Builder(long userId, PassportElementError[] errors) { + this.userId = userId; + this.errors = errors; + } + + public SetPassportDataErrors build() { + return new SetPassportDataErrors(this.userId, this.errors); + } + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScope.java b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScope.java index edd8b3c..ef55a1b 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScope.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScope.java @@ -25,7 +25,7 @@ enum BotCommandScopeType implements WrappedFieldValueProvider { ALL_CHAT_ADMINS("all_chat_administrators", BotCommandScopeAllChatAdministrators.class), CHAT("chat", BotCommandScopeChat.class), CHAT_ADMINS("chat_administrators", BotCommandScopeChatAdministrators.class), - CHAT_MEMBER("chat_member", BotCommandScopeChatMember.class),; + CHAT_MEMBER("chat_member", BotCommandScopeChatMember.class); private final String fieldValue; private final Class wrapperClass; diff --git a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllChatAdministrators.java b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllChatAdministrators.java index 7fffd63..395e3df 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllChatAdministrators.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllChatAdministrators.java @@ -2,7 +2,7 @@ import org.jetbrains.annotations.NotNull; -record BotCommandScopeAllChatAdministrators() implements BotCommandScope { +public record BotCommandScopeAllChatAdministrators() implements BotCommandScope { @Override public @NotNull BotCommandScope.BotCommandScopeType type() { diff --git a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllGroupChats.java b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllGroupChats.java index 47f20c4..80daa3d 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllGroupChats.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllGroupChats.java @@ -2,7 +2,7 @@ import org.jetbrains.annotations.NotNull; -record BotCommandScopeAllGroupChats() implements BotCommandScope { +public record BotCommandScopeAllGroupChats() implements BotCommandScope { @Override public @NotNull BotCommandScope.BotCommandScopeType type() { diff --git a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllPrivateChats.java b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllPrivateChats.java index ec76a20..2239a3f 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllPrivateChats.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeAllPrivateChats.java @@ -3,7 +3,7 @@ import org.jetbrains.annotations.NotNull; -record BotCommandScopeAllPrivateChats() implements BotCommandScope { +public record BotCommandScopeAllPrivateChats() implements BotCommandScope { @Override public @NotNull BotCommandScope.BotCommandScopeType type() { diff --git a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChat.java b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChat.java index 979a065..196943a 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChat.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChat.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import org.jetbrains.annotations.NotNull; -record BotCommandScopeChat( +public record BotCommandScopeChat( @JsonProperty(value = "chat_id", required = true) @NotNull String chatId diff --git a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChatAdministrators.java b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChatAdministrators.java index 9802468..ed8f52b 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChatAdministrators.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChatAdministrators.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import org.jetbrains.annotations.NotNull; -record BotCommandScopeChatAdministrators( +public record BotCommandScopeChatAdministrators( @JsonProperty(value = "chat_id", required = true) @NotNull String chatId diff --git a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChatMember.java b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChatMember.java index b118494..34dd1ac 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChatMember.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeChatMember.java @@ -3,7 +3,7 @@ import com.fasterxml.jackson.annotation.JsonProperty; import org.jetbrains.annotations.NotNull; -record BotCommandScopeChatMember( +public record BotCommandScopeChatMember( @JsonProperty(value = "chat_id", required = true) @NotNull String chatId, diff --git a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeDefault.java b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeDefault.java index 561b190..969de67 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeDefault.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/BotCommandScopeDefault.java @@ -2,7 +2,7 @@ import org.jetbrains.annotations.NotNull; -record BotCommandScopeDefault() implements BotCommandScope { +public record BotCommandScopeDefault() implements BotCommandScope { @Override public @NotNull BotCommandScope.BotCommandScopeType type() { diff --git a/src/main/java/org/teleight/teleightbots/api/objects/CallbackGame.java b/src/main/java/org/teleight/teleightbots/api/objects/CallbackGame.java new file mode 100644 index 0000000..eb96661 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/CallbackGame.java @@ -0,0 +1,6 @@ +package org.teleight.teleightbots.api.objects; + +import org.teleight.teleightbots.api.ApiResult; + +public record CallbackGame() implements ApiResult { +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/ChatShared.java b/src/main/java/org/teleight/teleightbots/api/objects/ChatShared.java index 46356ee..fd34316 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/ChatShared.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/ChatShared.java @@ -11,7 +11,7 @@ public record ChatShared( @JsonProperty(value = "chat_id", required = true) @NotNull - Long chatId, + String chatId, @JsonProperty(value = "title") @Nullable diff --git a/src/main/java/org/teleight/teleightbots/api/objects/GameHighScore.java b/src/main/java/org/teleight/teleightbots/api/objects/GameHighScore.java new file mode 100644 index 0000000..125f849 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/GameHighScore.java @@ -0,0 +1,18 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.teleight.teleightbots.api.ApiResult; + +public record GameHighScore( + @JsonProperty(value = "position", required = true) + int position, + + @JsonProperty(value = "user", required = true) + @NotNull + User user, + + @JsonProperty(value = "score", required = true) + int score +) implements ApiResult { +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResult.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResult.java index b7200ad..94d7495 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResult.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResult.java @@ -32,26 +32,27 @@ public sealed interface InlineQueryResult extends ApiResult permits InlineQueryResultType type(); enum InlineQueryResultType implements WrappedFieldValueProvider { - INLINE_QUERY_RESULT_CACHED_AUDIO("audio", InlineQueryResultCachedAudio.class), - INLINE_QUERY_RESULT_CACHED_DOCUMENT("document", InlineQueryResultCachedDocument.class), - INLINE_QUERY_RESULT_CACHED_GIF("gif", InlineQueryResultCachedGif.class), - INLINE_QUERY_RESULT_CACHED_MPEG4_GIF("mpeg4_gif", InlineQueryResultCachedMpeg4Gif.class), - INLINE_QUERY_RESULT_CACHED_PHOTO("photo", InlineQueryResultCachedPhoto.class), - INLINE_QUERY_RESULT_CACHED_STICKER("sticker", InlineQueryResultCachedSticker.class), - INLINE_QUERY_RESULT_CACHED_VIDEO("video", InlineQueryResultCachedVideo.class), - INLINE_QUERY_RESULT_CACHED_VOICE("voice", InlineQueryResultCachedVoice.class), - INLINE_QUERY_RESULT_ARTICLE("article", InlineQueryResultArticle.class), - INLINE_QUERY_RESULT_AUDIO("audio", InlineQueryResultAudio.class), - INLINE_QUERY_RESULT_CONTACT("contact", InlineQueryResultContact.class), - INLINE_QUERY_RESULT_GAME("game", InlineQueryResultGame.class), - INLINE_QUERY_RESULT_DOCUMENT("document", InlineQueryResultDocument.class), - INLINE_QUERY_RESULT_GIF("gif", InlineQueryResultGif.class), - INLINE_QUERY_RESULT_LOCATION("location", InlineQueryResultLocation.class), - INLINE_QUERY_RESULT_MPEG4_GIF("mpeg4_gif", InlineQueryResultMpeg4Gif.class), - INLINE_QUERY_RESULT_PHOTO("photo", InlineQueryResultPhoto.class), - INLINE_QUERY_RESULT_VENUE("venue", InlineQueryResultVenue.class), - INLINE_QUERY_RESULT_VIDEO("video", InlineQueryResultVideo.class), - INLINE_QUERY_RESULT_VOICE("voice", InlineQueryResultVoice.class); + + CACHED_AUDIO("audio", InlineQueryResultCachedAudio.class), + CACHED_DOCUMENT("document", InlineQueryResultCachedDocument.class), + CACHED_GIF("gif", InlineQueryResultCachedGif.class), + CACHED_MPEG4_GIF("mpeg4_gif", InlineQueryResultCachedMpeg4Gif.class), + CACHED_PHOTO("photo", InlineQueryResultCachedPhoto.class), + CACHED_STICKER("sticker", InlineQueryResultCachedSticker.class), + CACHED_VIDEO("video", InlineQueryResultCachedVideo.class), + CACHED_VOICE("voice", InlineQueryResultCachedVoice.class), + ARTICLE("article", InlineQueryResultArticle.class), + AUDIO("audio", InlineQueryResultAudio.class), + CONTACT("contact", InlineQueryResultContact.class), + GAME("game", InlineQueryResultGame.class), + DOCUMENT("document", InlineQueryResultDocument.class), + GIF("gif", InlineQueryResultGif.class), + LOCATION("location", InlineQueryResultLocation.class), + MPEG4_GIF("mpeg4_gif", InlineQueryResultMpeg4Gif.class), + PHOTO("photo", InlineQueryResultPhoto.class), + VENUE("venue", InlineQueryResultVenue.class), + VIDEO("video", InlineQueryResultVideo.class), + VOICE("voice", InlineQueryResultVoice.class); private final String fieldValue; private final Class wrapperClass; diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultArticle.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultArticle.java index 225a2c5..a654ed0 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultArticle.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultArticle.java @@ -45,7 +45,7 @@ public record InlineQueryResultArticle( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_ARTICLE; + return InlineQueryResultType.ARTICLE; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultAudio.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultAudio.java index 61678bc..1784628 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultAudio.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultAudio.java @@ -51,7 +51,7 @@ public record InlineQueryResultAudio( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_AUDIO; + return InlineQueryResultType.AUDIO; } public static final class Builder { diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedAudio.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedAudio.java index 972732c..728405f 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedAudio.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedAudio.java @@ -36,7 +36,7 @@ public record InlineQueryResultCachedAudio( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_PHOTO; + return InlineQueryResultType.PHOTO; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedDocument.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedDocument.java index 92786bd..28467ec 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedDocument.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedDocument.java @@ -44,7 +44,7 @@ public record InlineQueryResultCachedDocument( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_DOCUMENT; + return InlineQueryResultType.DOCUMENT; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedGif.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedGif.java index 5736785..1f33294 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedGif.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedGif.java @@ -29,6 +29,9 @@ public record InlineQueryResultCachedGif( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "reply_markup") @Nullable ReplyKeyboard replyMarkup, @@ -40,7 +43,7 @@ public record InlineQueryResultCachedGif( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_GIF; + return InlineQueryResultType.GIF; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedMpeg4Gif.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedMpeg4Gif.java index a974007..b5f85d2 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedMpeg4Gif.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedMpeg4Gif.java @@ -29,6 +29,9 @@ public record InlineQueryResultCachedMpeg4Gif( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "reply_markup") @Nullable ReplyKeyboard replyMarkup, @@ -40,7 +43,7 @@ public record InlineQueryResultCachedMpeg4Gif( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_MPEG4_GIF; + return InlineQueryResultType.MPEG4_GIF; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedPhoto.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedPhoto.java index 80dbc25..6f28a03 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedPhoto.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedPhoto.java @@ -33,6 +33,9 @@ public record InlineQueryResultCachedPhoto( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "reply_markup") @Nullable ReplyKeyboard replyMarkup, @@ -44,7 +47,7 @@ public record InlineQueryResultCachedPhoto( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_PHOTO; + return InlineQueryResultType.PHOTO; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedSticker.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedSticker.java index 3d76aeb..04ba1d0 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedSticker.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedSticker.java @@ -24,7 +24,7 @@ public record InlineQueryResultCachedSticker( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_CACHED_STICKER; + return InlineQueryResultType.CACHED_STICKER; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedVideo.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedVideo.java index 7fcb00e..3ea71b3 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedVideo.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedVideo.java @@ -33,6 +33,9 @@ public record InlineQueryResultCachedVideo( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "reply_markup") @Nullable ReplyKeyboard replyMarkup, @@ -44,7 +47,7 @@ public record InlineQueryResultCachedVideo( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_VIDEO; + return InlineQueryResultType.VIDEO; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedVoice.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedVoice.java index 37e166f..fe4a01e 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedVoice.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultCachedVoice.java @@ -40,7 +40,7 @@ public record InlineQueryResultCachedVoice( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_VOICE; + return InlineQueryResultType.VOICE; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultContact.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultContact.java index b1b8a5d..c67d9b8 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultContact.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultContact.java @@ -46,7 +46,7 @@ public record InlineQueryResultContact( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_CONTACT; + return InlineQueryResultType.CONTACT; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultDocument.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultDocument.java index e03e514..ce0b84a 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultDocument.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultDocument.java @@ -58,7 +58,7 @@ public record InlineQueryResultDocument( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_DOCUMENT; + return InlineQueryResultType.DOCUMENT; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultGame.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultGame.java index 6b728d0..0eb95e7 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultGame.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultGame.java @@ -20,7 +20,7 @@ public record InlineQueryResultGame( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_GAME; + return InlineQueryResultType.GAME; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultGif.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultGif.java index b257284..150790f 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultGif.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultGif.java @@ -46,6 +46,9 @@ public record InlineQueryResultGif( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "reply_markup") @Nullable ReplyKeyboard replyMarkup, @@ -57,7 +60,7 @@ public record InlineQueryResultGif( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_GIF; + return InlineQueryResultType.GIF; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultLocation.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultLocation.java index 7990d70..ab671c3 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultLocation.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultLocation.java @@ -53,7 +53,7 @@ public record InlineQueryResultLocation( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_LOCATION; + return InlineQueryResultType.LOCATION; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultMpeg4Gif.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultMpeg4Gif.java index bb26adf..e3f1b04 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultMpeg4Gif.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultMpeg4Gif.java @@ -46,6 +46,9 @@ public record InlineQueryResultMpeg4Gif( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "reply_markup") @Nullable ReplyKeyboard replyMarkup, @@ -57,7 +60,7 @@ public record InlineQueryResultMpeg4Gif( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_MPEG4_GIF; + return InlineQueryResultType.MPEG4_GIF; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultPhoto.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultPhoto.java index b0e3853..417a016 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultPhoto.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultPhoto.java @@ -43,6 +43,9 @@ public record InlineQueryResultPhoto( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "reply_markup") @Nullable ReplyKeyboard replyMarkup, @@ -54,7 +57,7 @@ public record InlineQueryResultPhoto( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_PHOTO; + return InlineQueryResultType.PHOTO; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVenue.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVenue.java index f9e8e32..63b4263 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVenue.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVenue.java @@ -60,7 +60,7 @@ public record InlineQueryResultVenue( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_VENUE; + return InlineQueryResultType.VENUE; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVideo.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVideo.java index 79b1b29..4849fa2 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVideo.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVideo.java @@ -37,6 +37,9 @@ public record InlineQueryResultVideo( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "video_width") int videoWidth, @@ -61,7 +64,7 @@ public record InlineQueryResultVideo( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_VIDEO; + return InlineQueryResultType.VIDEO; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVoice.java b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVoice.java index 6f84def..733a877 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVoice.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InlineQueryResultVoice.java @@ -43,7 +43,7 @@ public record InlineQueryResultVoice( @Override public InlineQueryResultType type() { - return InlineQueryResultType.INLINE_QUERY_RESULT_VOICE; + return InlineQueryResultType.VOICE; } } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InputInvoiceMessageContent.java b/src/main/java/org/teleight/teleightbots/api/objects/InputInvoiceMessageContent.java index 61edd81..349f699 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InputInvoiceMessageContent.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InputInvoiceMessageContent.java @@ -15,7 +15,8 @@ public record InputInvoiceMessageContent( @JsonProperty(value = "payload", required = true) String payload, - @JsonProperty(value = "provider_token", required = true) + @JsonProperty(value = "provider_token") + @Nullable String providerToken, @JsonProperty(value = "currency", required = true) diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InputMedia.java b/src/main/java/org/teleight/teleightbots/api/objects/InputMedia.java index 292c28b..5b6dc24 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InputMedia.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InputMedia.java @@ -1,10 +1,50 @@ package org.teleight.teleightbots.api.objects; -public sealed interface InputMedia permits - InputMediaPhoto -// InputMediaVideo, -// InputMediaAnimation, -// InputMediaAudio, -// InputMediaDocument -{ +import com.fasterxml.jackson.annotation.JsonProperty; +import org.teleight.teleightbots.api.ApiResult; +import org.teleight.teleightbots.api.serialization.WrappedFieldValueProvider; + +public sealed interface InputMedia extends ApiResult permits + InputMediaPhoto, + InputMediaVideo, + InputMediaAnimation, + InputMediaAudio, + InputMediaDocument { + + String TYPE_NAME = "type"; + + @JsonProperty(TYPE_NAME) + InputMediaType type(); + + enum InputMediaType implements WrappedFieldValueProvider { + PHOTO("photo", InputMediaPhoto.class), + VIDEO("video", InputMediaVideo.class), + ANIMATION("animation", InputMediaAnimation.class), + AUDIO("audio", InputMediaAudio.class), + DOCUMENT("document", InputMediaDocument.class); + + private final String fieldValue; + private final Class wrapperClass; + + InputMediaType(String fieldValue, Class wrapperClass) { + this.fieldValue = fieldValue; + this.wrapperClass = wrapperClass; + } + + @Override + public Class getWrapperClass() { + return wrapperClass; + } + + @Override + public String getFieldName() { + return TYPE_NAME; + } + + @Override + public String getFieldValue() { + return fieldValue; + } + } + } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InputMediaAnimation.java b/src/main/java/org/teleight/teleightbots/api/objects/InputMediaAnimation.java new file mode 100644 index 0000000..59affb6 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/InputMediaAnimation.java @@ -0,0 +1,49 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public record InputMediaAnimation( + @JsonProperty(value = "media", required = true) + @NotNull + String media, + + @JsonProperty("thumbnail") + @Nullable + InputFile thumbnail, + + @JsonProperty("caption") + @Nullable + String caption, + + @JsonProperty("parse_mode") + @Nullable + ParseMode parseMode, + + @JsonProperty("caption_entities") + @Nullable + MessageEntity[] captionEntities, + + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + + @JsonProperty("width") + int width, + + @JsonProperty("height") + int height, + + @JsonProperty("duration") + int duration, + + @JsonProperty("has_spoiler") + boolean hasSpoiler +) implements InputMedia { + + @Override + public InputMediaType type() { + return InputMediaType.ANIMATION; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InputMediaAudio.java b/src/main/java/org/teleight/teleightbots/api/objects/InputMediaAudio.java new file mode 100644 index 0000000..79b41c7 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/InputMediaAudio.java @@ -0,0 +1,37 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public record InputMediaAudio( + @JsonProperty(value = "media", required = true) + @NotNull + String media, + + @JsonProperty("thumbnail") + @Nullable + InputFile thumbnail, + + @JsonProperty("caption") + @Nullable + String caption, + + @JsonProperty("parse_mode") + @Nullable + ParseMode parseMode, + + @JsonProperty("caption_entities") + @Nullable + MessageEntity[] captionEntities, + + @JsonProperty("disable_content_type_detection") + boolean disableContentTypeDetection +) implements InputMedia { + + @Override + public InputMediaType type() { + return InputMediaType.AUDIO; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InputMediaDocument.java b/src/main/java/org/teleight/teleightbots/api/objects/InputMediaDocument.java new file mode 100644 index 0000000..1867ce0 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/InputMediaDocument.java @@ -0,0 +1,37 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public record InputMediaDocument( + @JsonProperty(value = "media", required = true) + @NotNull + String media, + + @JsonProperty("thumbnail") + @Nullable + InputFile thumbnail, + + @JsonProperty("caption") + @Nullable + String caption, + + @JsonProperty("parse_mode") + @Nullable + ParseMode parseMode, + + @JsonProperty("caption_entities") + @Nullable + MessageEntity[] captionEntities, + + @JsonProperty("disable_content_type_detection") + boolean disableContentTypeDetection +) implements InputMedia { + + @Override + public InputMediaType type() { + return InputMediaType.DOCUMENT; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InputMediaPhoto.java b/src/main/java/org/teleight/teleightbots/api/objects/InputMediaPhoto.java index 5bcdef9..9b48b8b 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/InputMediaPhoto.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/InputMediaPhoto.java @@ -3,13 +3,8 @@ import com.fasterxml.jackson.annotation.JsonProperty; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.teleight.teleightbots.api.ApiResult; public record InputMediaPhoto( - @JsonProperty(value = "type", required = true) - @NotNull - String type, - @JsonProperty(value = "media", required = true) @NotNull InputFile media, @@ -26,7 +21,16 @@ public record InputMediaPhoto( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty(value = "has_spoiler") boolean hasSpoiler -) implements ApiResult, InputMedia { +) implements InputMedia { + + @Override + public InputMediaType type() { + return InputMediaType.PHOTO; + } + } diff --git a/src/main/java/org/teleight/teleightbots/api/objects/InputMediaVideo.java b/src/main/java/org/teleight/teleightbots/api/objects/InputMediaVideo.java new file mode 100644 index 0000000..7bd8832 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/InputMediaVideo.java @@ -0,0 +1,52 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +public record InputMediaVideo( + @JsonProperty(value = "media", required = true) + @NotNull + String media, + + @JsonProperty("thumbnail") + @Nullable + InputFile thumbnail, + + @JsonProperty("caption") + @Nullable + String caption, + + @JsonProperty("parse_mode") + @Nullable + ParseMode parseMode, + + @JsonProperty("caption_entities") + @Nullable + MessageEntity[] captionEntities, + + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + + @JsonProperty("width") + int width, + + @JsonProperty("height") + int height, + + @JsonProperty("duration") + int duration, + + @JsonProperty("supports_streaming") + boolean supportStreaming, + + @JsonProperty("has_spoiler") + boolean hasSpoiler +) implements InputMedia { + + @Override + public InputMediaType type() { + return InputMediaType.VIDEO; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/Message.java b/src/main/java/org/teleight/teleightbots/api/objects/Message.java index ded0d52..2f9f18a 100644 --- a/src/main/java/org/teleight/teleightbots/api/objects/Message.java +++ b/src/main/java/org/teleight/teleightbots/api/objects/Message.java @@ -101,6 +101,10 @@ public record Message( @Nullable LinkPreviewOptions linkPreviewOptions, + @JsonProperty("effect_id") + @Nullable + String effectId, + @JsonProperty("animation") @Nullable Animation animation, @@ -145,6 +149,9 @@ public record Message( @Nullable MessageEntity[] captionEntities, + @JsonProperty("show_caption_above_media") + boolean showCaptionAboveMedia, + @JsonProperty("has_media_spoiler") boolean hasMediaSpoiler, diff --git a/src/main/java/org/teleight/teleightbots/api/objects/PassportElementError.java b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementError.java new file mode 100644 index 0000000..5136818 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementError.java @@ -0,0 +1,61 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; +import org.teleight.teleightbots.api.ApiResult; +import org.teleight.teleightbots.api.serialization.WrappedFieldValueProvider; + +public sealed interface PassportElementError extends ApiResult permits + PassportElementErrorDataField, + PassportElementErrorFrontSide, + PassportElementErrorReverseSide, + PassportElementErrorSelfie, + PassportElementErrorFile, + PassportElementErrorFiles, + PassportElementErrorTranslationFile, + PassportElementErrorTranslationFiles, + PassportElementErrorUnspecified { + + String TYPE_NAME = "source"; + + @JsonProperty(TYPE_NAME) + PassportElementError.PassportElementErrorType source(); + + + enum PassportElementErrorType implements WrappedFieldValueProvider { + + DATA_FIELD("data", PassportElementErrorDataField.class), + FRONT_SIDE("front_side", PassportElementErrorFrontSide.class), + REVERSE_SIDE("reverse_side", PassportElementErrorReverseSide.class), + SELFIE("selfie", PassportElementErrorSelfie.class), + FILE("file", PassportElementErrorFile.class), + FILES("files", PassportElementErrorFiles.class), + TRANSLATION_FILE("translation_file", PassportElementErrorTranslationFile.class), + TRANSLATION_FILES("translation_files", PassportElementErrorTranslationFiles.class), + UNSPECIFIED("unspecified", PassportElementErrorUnspecified.class); + + private final String fieldValue; + private final Class wrapperClass; + + PassportElementErrorType(String fieldValue, Class wrapperClass) { + this.fieldValue = fieldValue; + this.wrapperClass = wrapperClass; + } + + @Override + public String getFieldValue() { + return fieldValue; + } + + @Override + public Class getWrapperClass() { + return wrapperClass; + } + + @Override + public String getFieldName() { + return TYPE_NAME; + } + } + + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorDataField.java b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorDataField.java new file mode 100644 index 0000000..4db0248 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorDataField.java @@ -0,0 +1,24 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public record PassportElementErrorDataField( + @JsonProperty(value = "type", required = true) + String type, + + @JsonProperty(value = "field_name", required = true) + String fieldName, + + @JsonProperty(value = "data_hash", required = true) + String dataHash, + + @JsonProperty(value = "message", required = true) + String message +) implements PassportElementError { + + @Override + public PassportElementErrorType source() { + return PassportElementErrorType.DATA_FIELD; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFile.java b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFile.java new file mode 100644 index 0000000..b972e49 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFile.java @@ -0,0 +1,21 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public record PassportElementErrorFile( + @JsonProperty(value = "type", required = true) + String type, + + @JsonProperty(value = "file_hash", required = true) + String fileHash, + + @JsonProperty(value = "message", required = true) + String message +) implements PassportElementError { + + @Override + public PassportElementErrorType source() { + return PassportElementErrorType.FILE; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFiles.java b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFiles.java new file mode 100644 index 0000000..dc6481d --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFiles.java @@ -0,0 +1,21 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public record PassportElementErrorFiles( + @JsonProperty(value = "type", required = true) + String type, + + @JsonProperty(value = "file_hashes", required = true) + String[] fileHashes, + + @JsonProperty(value = "message", required = true) + String message +) implements PassportElementError { + + @Override + public PassportElementErrorType source() { + return PassportElementErrorType.FILES; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFrontSide.java b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFrontSide.java new file mode 100644 index 0000000..f8dc817 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorFrontSide.java @@ -0,0 +1,21 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public record PassportElementErrorFrontSide( + @JsonProperty(value = "type", required = true) + String type, + + @JsonProperty(value = "file_hash", required = true) + String fileHash, + + @JsonProperty(value = "message", required = true) + String message +) implements PassportElementError { + + @Override + public PassportElementErrorType source() { + return PassportElementErrorType.FRONT_SIDE; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorReverseSide.java b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorReverseSide.java new file mode 100644 index 0000000..29b2082 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorReverseSide.java @@ -0,0 +1,21 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public record PassportElementErrorReverseSide( + @JsonProperty(value = "type", required = true) + String type, + + @JsonProperty(value = "file_hash", required = true) + String fileHash, + + @JsonProperty(value = "message", required = true) + String message +) implements PassportElementError { + + @Override + public PassportElementErrorType source() { + return PassportElementErrorType.REVERSE_SIDE; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorSelfie.java b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorSelfie.java new file mode 100644 index 0000000..5fb649d --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorSelfie.java @@ -0,0 +1,21 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public record PassportElementErrorSelfie( + @JsonProperty(value = "type", required = true) + String type, + + @JsonProperty(value = "file_hash", required = true) + String fileHash, + + @JsonProperty(value = "message", required = true) + String message +) implements PassportElementError { + + @Override + public PassportElementErrorType source() { + return PassportElementErrorType.SELFIE; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorTranslationFile.java b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorTranslationFile.java new file mode 100644 index 0000000..7d7562b --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorTranslationFile.java @@ -0,0 +1,21 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public record PassportElementErrorTranslationFile( + @JsonProperty(value = "type", required = true) + String type, + + @JsonProperty(value = "file_hash", required = true) + String fileHash, + + @JsonProperty(value = "message", required = true) + String message +) implements PassportElementError { + + @Override + public PassportElementErrorType source() { + return PassportElementErrorType.TRANSLATION_FILE; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorTranslationFiles.java b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorTranslationFiles.java new file mode 100644 index 0000000..6c370fc --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorTranslationFiles.java @@ -0,0 +1,21 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public record PassportElementErrorTranslationFiles( + @JsonProperty(value = "type", required = true) + String type, + + @JsonProperty(value = "file_hashes", required = true) + String[] fileHashes, + + @JsonProperty(value = "message", required = true) + String message +) implements PassportElementError { + + @Override + public PassportElementErrorType source() { + return PassportElementErrorType.TRANSLATION_FILES; + } + +} diff --git a/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorUnspecified.java b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorUnspecified.java new file mode 100644 index 0000000..e5eb4c7 --- /dev/null +++ b/src/main/java/org/teleight/teleightbots/api/objects/PassportElementErrorUnspecified.java @@ -0,0 +1,21 @@ +package org.teleight.teleightbots.api.objects; + +import com.fasterxml.jackson.annotation.JsonProperty; + +public record PassportElementErrorUnspecified( + @JsonProperty(value = "type", required = true) + String type, + + @JsonProperty(value = "element_hash", required = true) + String elementHash, + + @JsonProperty(value = "message", required = true) + String message +) implements PassportElementError { + + @Override + public PassportElementErrorType source() { + return PassportElementErrorType.UNSPECIFIED; + } + +}