Remove deprecated versions
This commit is contained in:
parent
f776950240
commit
6b18fbb545
@ -24,21 +24,6 @@ public final class CommandRegistry implements ICommandRegistry {
|
||||
private final Supplier<String> botUsernameSupplier;
|
||||
private BiConsumer<AbsSender, Message> defaultConsumer;
|
||||
|
||||
/**
|
||||
* Creates a Command registry
|
||||
*
|
||||
* @param allowCommandsWithUsername True to allow commands with username, false otherwise
|
||||
* @param botUsername Bot username
|
||||
* @throws java.lang.NullPointerException if {@code botUsername} is {@code null}
|
||||
* @deprecated Use {@link #CommandRegistry(boolean, java.util.function.Supplier)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public CommandRegistry(boolean allowCommandsWithUsername, String botUsername) {
|
||||
Objects.requireNonNull(botUsername, "Bot username must not be null");
|
||||
this.allowCommandsWithUsername = allowCommandsWithUsername;
|
||||
this.botUsernameSupplier = () -> botUsername;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a Command registry
|
||||
* @param allowCommandsWithUsername True to allow commands with username, false otherwise
|
||||
@ -103,7 +88,7 @@ public final class CommandRegistry implements ICommandRegistry {
|
||||
/**
|
||||
* Executes a command action if the command is registered.
|
||||
*
|
||||
* @note If the command is not registered and there is a default consumer,
|
||||
* @apiNote If the command is not registered and there is a default consumer,
|
||||
* that action will be performed
|
||||
*
|
||||
* @param absSender absSender
|
||||
|
@ -1,17 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.interfaces;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* An object used in the Bots API to answer updates
|
||||
*
|
||||
* @deprecated Please, use BotApiObject directly
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Deprecated
|
||||
public interface InputBotApiObject extends BotApiObject {
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.groupadministration;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 3.4
|
||||
* Use this method to delete a group sticker set from a supergroup.
|
||||
* The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
||||
* Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method.
|
||||
* Returns True on success.
|
||||
* @deprecated Replaced by {@link DeleteChatStickerSet}
|
||||
*/
|
||||
@Deprecated
|
||||
public class DeleteStickerSetName extends DeleteChatStickerSet {
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.groupadministration;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* Use this method to get the number of members in a chat. Returns Int on success.
|
||||
* @deprecated Replaced by {@link GetChatMembersCount}
|
||||
*/
|
||||
@Deprecated
|
||||
public class GetChatMemberCount extends GetChatMembersCount {
|
||||
}
|
@ -123,74 +123,6 @@ public class RestrictChatMember extends BotApiMethod<Boolean> {
|
||||
return setUntilDate(Instant.now().plusMillis(duration.toMillis()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getPermissions()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public Boolean getCanSendMessages() {
|
||||
return canSendMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setPermissions(ChatPermissions)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public RestrictChatMember setCanSendMessages(Boolean canSendMessages) {
|
||||
this.canSendMessages = canSendMessages;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getPermissions()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public Boolean getCanSendMediaMessages() {
|
||||
return canSendMediaMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setPermissions(ChatPermissions)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public RestrictChatMember setCanSendMediaMessages(Boolean canSendMediaMessages) {
|
||||
this.canSendMediaMessages = canSendMediaMessages;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getPermissions()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public Boolean getCanSendOtherMessages() {
|
||||
return canSendOtherMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setPermissions(ChatPermissions)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public RestrictChatMember setCanSendOtherMessages(Boolean canSendOtherMessages) {
|
||||
this.canSendOtherMessages = canSendOtherMessages;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getPermissions()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public Boolean getCanAddWebPagePreviews() {
|
||||
return canAddWebPagePreviews;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #setPermissions(ChatPermissions)} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public RestrictChatMember setCanAddWebPagePreviews(Boolean canAddWebPagePreviews) {
|
||||
this.canAddWebPagePreviews = canAddWebPagePreviews;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ChatPermissions getPermissions() {
|
||||
return permissions;
|
||||
}
|
||||
|
@ -1,11 +1,10 @@
|
||||
package org.telegram.telegrambots.meta.api.methods.updatingmessages;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
|
||||
import org.telegram.telegrambots.meta.api.objects.Message;
|
||||
import org.telegram.telegrambots.meta.api.objects.ApiResponse;
|
||||
import org.telegram.telegrambots.meta.api.objects.Message;
|
||||
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
@ -110,28 +109,10 @@ public class EditMessageLiveLocation extends BotApiMethod<Serializable> {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Replaced by {@link #getLongitude()}
|
||||
*/
|
||||
@Deprecated
|
||||
@JsonIgnore
|
||||
public Float getLongitud() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
public Float getLongitude() {
|
||||
return longitude;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Replaced by {@link #setLongitude(Float)}
|
||||
*/
|
||||
@Deprecated
|
||||
@JsonIgnore
|
||||
public EditMessageLiveLocation setLongitud(Float longitude) {
|
||||
return setLongitude(longitude);
|
||||
}
|
||||
|
||||
public EditMessageLiveLocation setLongitude(Float longitude) {
|
||||
Objects.requireNonNull(longitude);
|
||||
this.longitude = longitude;
|
||||
|
@ -127,14 +127,6 @@ public class Chat implements BotApiObject {
|
||||
return permissions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {@link #getPermissions()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
public Boolean getAllMembersAreAdministrators() {
|
||||
return allMembersAreAdministrators;
|
||||
}
|
||||
|
||||
public ChatPhoto getPhoto() {
|
||||
return photo;
|
||||
}
|
||||
|
@ -121,14 +121,6 @@ public class ChatMember implements BotApiObject {
|
||||
return canRestrictMembers;
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Use {{@link #getCanRestrictMembers()}}
|
||||
*/
|
||||
@Deprecated
|
||||
public Boolean getCanRestrictUsers() {
|
||||
return canRestrictMembers;
|
||||
}
|
||||
|
||||
public Boolean getCanPinMessages() {
|
||||
return canPinMessages;
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ package org.telegram.telegrambots.meta.api.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
|
||||
@ -17,7 +17,7 @@ import java.io.InputStream;
|
||||
*/
|
||||
@SuppressWarnings({"WeakerAccess", "UnusedReturnValue"})
|
||||
@JsonSerialize(using = InputFileSerializer.class, as = String.class)
|
||||
public class InputFile implements InputBotApiObject, Validable {
|
||||
public class InputFile implements Validable, BotApiObject {
|
||||
|
||||
private String attachName;
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.telegram.telegrambots.meta.api.objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
|
||||
@ -18,7 +18,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
* All the user needs to do is tap/click a button and confirm that they want to log in.
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
public class LoginUrl implements InputBotApiObject, Validable {
|
||||
public class LoginUrl implements Validable, BotApiObject {
|
||||
private static final String URL_FIELD = "url";
|
||||
private static final String FORWARD_TEXT_FIELD = "forward_text";
|
||||
private static final String BOT_USERNAME_FIELD = "bot_username";
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.serialization.InputMessageContentDeserializer;
|
||||
|
||||
@ -12,5 +12,5 @@ import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessageconten
|
||||
* query.
|
||||
*/
|
||||
@JsonDeserialize(using = InputMessageContentDeserializer.class)
|
||||
public interface InputMessageContent extends InputBotApiObject, Validable {
|
||||
public interface InputMessageContent extends Validable, BotApiObject {
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.serialization.InlineQueryResultDeserializer;
|
||||
|
||||
@ -11,5 +11,5 @@ import org.telegram.telegrambots.meta.api.objects.inlinequery.result.serializati
|
||||
* This object represents one result of an inline query.
|
||||
*/
|
||||
@JsonDeserialize(using = InlineQueryResultDeserializer.class)
|
||||
public interface InlineQueryResult extends InputBotApiObject, Validable {
|
||||
public interface InlineQueryResult extends Validable, BotApiObject {
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* Represents a link to an mp3 audio file stored on the Telegram servers. By default, this
|
||||
* audio file will be sent by the user. Alternatively, you can use input_message_content to send a
|
||||
* message with the specified content instead of the audio.
|
||||
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
|
||||
* ignore them.
|
||||
* @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedAudio}
|
||||
*/
|
||||
@Deprecated
|
||||
public class InlineQueryResultCachedAudio extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedAudio {
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* Represents a link to a file stored on the Telegram servers. By default, this file will be
|
||||
* sent by the user with an optional caption. Alternatively, you can use input_message_content to
|
||||
* send a message with the specified content instead of the file.
|
||||
* @note Currently, only pdf-files and zip archives can be sent using this method.
|
||||
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
|
||||
* ignore them.
|
||||
* @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedDocument}
|
||||
*/
|
||||
@Deprecated
|
||||
public class InlineQueryResultCachedDocument extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedDocument {
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* Represents a link to an animated GIF file stored on the Telegram servers. By default, this
|
||||
* animated GIF file will be sent by the user with an optional caption. Alternatively, you can use
|
||||
* input_message_content to send a message with specified content instead of the animation.
|
||||
* @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedGif}
|
||||
*/
|
||||
@Deprecated
|
||||
public class InlineQueryResultCachedGif extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedGif {
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default,
|
||||
* this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can
|
||||
* use input_message_content to send a message with the specified content instead of the animation.
|
||||
* @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedMpeg4Gif}
|
||||
*/
|
||||
@Deprecated
|
||||
public class InlineQueryResultCachedMpeg4Gif extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedMpeg4Gif {
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* Represents a link to a photo stored on the Telegram servers. By default, this photo will
|
||||
* be sent by the user with an optional caption. Alternatively, you can use input_message_content to
|
||||
* send a message with the specified content instead of the photo.
|
||||
* @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedPhoto}
|
||||
*/
|
||||
@Deprecated
|
||||
public class InlineQueryResultCachedPhoto extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedPhoto {
|
||||
}
|
@ -1,16 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* Represents a link to a sticker stored on the Telegram servers. By default, this sticker
|
||||
* will be sent by the user. Alternatively, you can use input_message_content to send a message with
|
||||
* the specified content instead of the sticker.
|
||||
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
|
||||
* ignore them.
|
||||
* @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedSticker}
|
||||
*/
|
||||
@Deprecated
|
||||
public class InlineQueryResultCachedSticker extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedSticker {
|
||||
|
||||
}
|
@ -1,13 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* Represents a link to a video file stored on the Telegram servers. By default, this video
|
||||
* file will be sent by the user with an optional caption. Alternatively, you can use
|
||||
* input_message_content to send a message with the specified content instead of the video.
|
||||
* @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedVideo}
|
||||
*/
|
||||
@Deprecated
|
||||
public class InlineQueryResultCachedVideo extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedVideo {
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.inlinequery.result.chached;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* Represents a link to a voice message stored on the Telegram servers. By default, this
|
||||
* voice message will be sent by the user. Alternatively, you can use input_message_content to send
|
||||
* a message with the specified content instead of the voice message.
|
||||
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
|
||||
* ignore them.
|
||||
* @deprecated Replaced by {@link org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedVoice}
|
||||
*/
|
||||
@Deprecated
|
||||
public class InlineQueryResultCachedVoice extends org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.InlineQueryResultCachedVoice {
|
||||
}
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.api.objects.media.serialization.InputMediaDeserializer;
|
||||
import org.telegram.telegrambots.meta.api.objects.media.serialization.InputMediaSerializer;
|
||||
@ -20,7 +20,7 @@ import java.io.InputStream;
|
||||
@SuppressWarnings({"unchecked"})
|
||||
@JsonSerialize(using = InputMediaSerializer.class)
|
||||
@JsonDeserialize(using = InputMediaDeserializer.class)
|
||||
public abstract class InputMedia<T> implements InputBotApiObject, Validable {
|
||||
public abstract class InputMedia<T> implements Validable, BotApiObject {
|
||||
public static final String TYPE_FIELD = "type";
|
||||
public static final String MEDIA_FIELD = "media";
|
||||
public static final String CAPTION_FIELD = "caption";
|
||||
@ -117,7 +117,7 @@ public abstract class InputMedia<T> implements InputBotApiObject, Validable {
|
||||
return caption;
|
||||
}
|
||||
|
||||
public InputMedia setCaption(String caption) {
|
||||
public InputMedia<T> setCaption(String caption) {
|
||||
this.caption = caption;
|
||||
return this;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.passport.dataerror;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.api.objects.passport.dataerror.serialization.PassportElementErrorDeserializer;
|
||||
|
||||
@ -22,5 +22,5 @@ import org.telegram.telegrambots.meta.api.objects.passport.dataerror.serializati
|
||||
* PassportElementErrorTranslationFiles
|
||||
*/
|
||||
@JsonDeserialize(using = PassportElementErrorDeserializer.class)
|
||||
public interface PassportElementError extends InputBotApiObject, Validable {
|
||||
public interface PassportElementError extends Validable, BotApiObject {
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.payments;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
|
||||
@ -12,17 +12,17 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
* @version 1.0
|
||||
* This object represents a portion of goods price.
|
||||
*/
|
||||
public class LabeledPrice implements InputBotApiObject, Validable {
|
||||
public class LabeledPrice implements Validable, BotApiObject {
|
||||
private static final String LABEL_FIELD = "label";
|
||||
private static final String AMOUNT_FIELD = "amount";
|
||||
|
||||
@JsonProperty(LABEL_FIELD)
|
||||
private String label; ///< Portion label
|
||||
@JsonProperty(AMOUNT_FIELD)
|
||||
/**
|
||||
* Price of the product in the smallest units of the currency (integer, not float/double).
|
||||
* For example, for a price of US$ 1.45 pass amount = 145.
|
||||
*/
|
||||
@JsonProperty(AMOUNT_FIELD)
|
||||
private Integer amount;
|
||||
|
||||
/**
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.payments;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
|
||||
@ -15,7 +15,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
*
|
||||
* This object represents one shipping option.
|
||||
*/
|
||||
public class ShippingOption implements InputBotApiObject, Validable {
|
||||
public class ShippingOption implements Validable, BotApiObject {
|
||||
private static final String ID_FIELD = "id";
|
||||
private static final String TITLE_FIELD = "title";
|
||||
private static final String PRICES_FIELD = "prices";
|
||||
|
@ -1,76 +0,0 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.replykeyboard;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import org.telegram.telegrambots.meta.api.objects.ResponseParameters;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Ruben Bermudez
|
||||
* @version 1.0
|
||||
* Response from Telegram Server
|
||||
*
|
||||
* @deprecated Please, use {@link org.telegram.telegrambots.meta.api.objects.ApiResponse} instead.
|
||||
* This class will be removed
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Deprecated
|
||||
public class ApiResponse<T> implements Serializable {
|
||||
private static final String OK_FIELD = "ok";
|
||||
private static final String ERROR_CODE_FIELD = "error_code";
|
||||
private static final String DESCRIPTION_CODE_FIELD = "description";
|
||||
private static final String PARAMETERS_FIELD = "parameters";
|
||||
private static final String RESULT_FIELD = "result";
|
||||
|
||||
@JsonProperty(OK_FIELD)
|
||||
private Boolean ok;
|
||||
@JsonProperty(ERROR_CODE_FIELD)
|
||||
private Integer errorCode;
|
||||
@JsonProperty(DESCRIPTION_CODE_FIELD)
|
||||
private String errorDescription;
|
||||
@JsonProperty(PARAMETERS_FIELD)
|
||||
private ResponseParameters parameters;
|
||||
@JsonProperty(RESULT_FIELD)
|
||||
private T result;
|
||||
|
||||
public Boolean getOk() {
|
||||
return ok;
|
||||
}
|
||||
|
||||
public Integer getErrorCode() {
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
public String getErrorDescription() {
|
||||
return errorDescription;
|
||||
}
|
||||
|
||||
public T getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public ResponseParameters getParameters() {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
if (ok) {
|
||||
return "ApiResponse{" +
|
||||
"ok=" + ok +
|
||||
", result=" + result +
|
||||
'}';
|
||||
} else {
|
||||
return "ApiResponse{" +
|
||||
"ok=" + ok +
|
||||
", errorCode=" + errorCode +
|
||||
", errorDescription='" + errorDescription + '\'' +
|
||||
", parameters='" + parameters + '\'' +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@ package org.telegram.telegrambots.meta.api.objects.replykeyboard;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.api.objects.replykeyboard.serialization.KeyboardDeserializer;
|
||||
|
||||
@ -12,5 +11,5 @@ import org.telegram.telegrambots.meta.api.objects.replykeyboard.serialization.Ke
|
||||
* Reply keyboard abstract type
|
||||
*/
|
||||
@JsonDeserialize(using = KeyboardDeserializer.class)
|
||||
public interface ReplyKeyboard extends InputBotApiObject, BotApiObject, Validable {
|
||||
public interface ReplyKeyboard extends BotApiObject, Validable {
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.api.objects.LoginUrl;
|
||||
import org.telegram.telegrambots.meta.api.objects.games.CallbackGame;
|
||||
@ -16,10 +16,10 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
||||
* @version 1.0
|
||||
* This object represents one button of an inline keyboard. You must use exactly one of the
|
||||
* optional fields.
|
||||
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
|
||||
* @apiNote This will only work in Telegram versions released after 9 April, 2016. Older clients will
|
||||
* display unsupported message.
|
||||
*/
|
||||
public class InlineKeyboardButton implements InputBotApiObject, Validable {
|
||||
public class InlineKeyboardButton implements Validable, BotApiObject {
|
||||
|
||||
private static final String TEXT_FIELD = "text";
|
||||
private static final String URL_FIELD = "url";
|
||||
@ -39,7 +39,7 @@ public class InlineKeyboardButton implements InputBotApiObject, Validable {
|
||||
/**
|
||||
* Optional. Description of the game that will be launched when the user presses the button.
|
||||
*
|
||||
* @note This type of button must always be the first button in the first row.
|
||||
* @apiNote This type of button must always be the first button in the first row.
|
||||
*/
|
||||
@JsonProperty(CALLBACK_GAME_FIELD)
|
||||
private CallbackGame callbackGame;
|
||||
@ -49,7 +49,7 @@ public class InlineKeyboardButton implements InputBotApiObject, Validable {
|
||||
* open that chat and insert the bot‘s username and the specified inline query in the input field.
|
||||
* Can be empty, in which case just the bot’s username will be inserted.
|
||||
*
|
||||
* @note This offers an easy way for users to start using your bot in inline mode when
|
||||
* @apiNote This offers an easy way for users to start using your bot in inline mode when
|
||||
* they are currently in a private chat with it.
|
||||
* Especially useful when combined with switch_pm… actions – in this case the user will
|
||||
* be automatically returned to the chat they switched from, skipping the chat selection screen.
|
||||
@ -67,7 +67,7 @@ public class InlineKeyboardButton implements InputBotApiObject, Validable {
|
||||
/**
|
||||
* Optional. Specify True, to send a Buy button.
|
||||
*
|
||||
* @note This type of button must always be the first button in the first row.
|
||||
* @apiNote This type of button must always be the first button in the first row.
|
||||
*/
|
||||
@JsonProperty(PAY_FIELD)
|
||||
private Boolean pay;
|
||||
|
@ -1,7 +1,7 @@
|
||||
package org.telegram.telegrambots.meta.api.objects.replykeyboard.buttons;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
|
||||
@ -19,7 +19,7 @@ import java.util.Objects;
|
||||
* @apiNote request_poll option will only work in Telegram versions released after 1X January, 2020.
|
||||
* Older clients will receive unsupported message.
|
||||
*/
|
||||
public class KeyboardButton implements InputBotApiObject, Validable {
|
||||
public class KeyboardButton implements Validable, BotApiObject {
|
||||
|
||||
private static final String TEXT_FIELD = "text";
|
||||
private static final String REQUEST_CONTACT_FIELD = "request_contact";
|
||||
|
@ -2,7 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.stickers;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
||||
import org.telegram.telegrambots.meta.api.interfaces.Validable;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
|
||||
@ -12,7 +12,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
|
||||
* This object describes the position on faces where a mask should be placed by default.
|
||||
*/
|
||||
@JsonTypeInfo(use=JsonTypeInfo.Id.NONE)
|
||||
public class MaskPosition implements InputBotApiObject, Validable {
|
||||
public class MaskPosition implements Validable, BotApiObject {
|
||||
private static final String POINT_FIELD = "point";
|
||||
private static final String XSHIFT_FIELD = "x_shift";
|
||||
private static final String YSHIFT_FIELD = "y_shift";
|
||||
|
Loading…
Reference in New Issue
Block a user