2018-07-08 01:41:21 +02:00
|
|
|
package org.telegram.telegrambots.meta.api.objects;
|
2016-01-14 01:14:53 +01:00
|
|
|
|
|
|
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
2016-04-02 18:20:49 +02:00
|
|
|
|
2018-07-08 01:41:21 +02:00
|
|
|
import org.telegram.telegrambots.meta.api.interfaces.BotApiObject;
|
|
|
|
import org.telegram.telegrambots.meta.api.objects.inlinequery.ChosenInlineQuery;
|
|
|
|
import org.telegram.telegrambots.meta.api.objects.inlinequery.InlineQuery;
|
|
|
|
import org.telegram.telegrambots.meta.api.objects.payments.PreCheckoutQuery;
|
|
|
|
import org.telegram.telegrambots.meta.api.objects.payments.ShippingQuery;
|
2016-01-14 01:14:53 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Ruben Bermudez
|
|
|
|
* @version 1.0
|
2017-03-27 00:49:08 +02:00
|
|
|
*
|
|
|
|
* This object represents an incoming update.
|
|
|
|
*
|
|
|
|
* @apiNote Only one of the optional parameters can be present in any given update.
|
2016-01-14 01:14:53 +01:00
|
|
|
*/
|
2016-11-17 02:41:12 +01:00
|
|
|
public class Update implements BotApiObject {
|
2016-04-11 02:53:53 +02:00
|
|
|
private static final String UPDATEID_FIELD = "update_id";
|
|
|
|
private static final String MESSAGE_FIELD = "message";
|
|
|
|
private static final String INLINEQUERY_FIELD = "inline_query";
|
|
|
|
private static final String CHOSENINLINEQUERY_FIELD = "chosen_inline_result";
|
|
|
|
private static final String CALLBACKQUERY_FIELD = "callback_query";
|
2016-05-22 12:13:18 +02:00
|
|
|
private static final String EDITEDMESSAGE_FIELD = "edited_message";
|
2016-11-21 01:28:09 +01:00
|
|
|
private static final String CHANNELPOST_FIELD = "channel_post";
|
|
|
|
private static final String EDITEDCHANNELPOST_FIELD = "edited_channel_post";
|
2017-03-27 00:49:08 +02:00
|
|
|
private static final String SHIPPING_QUERY_FIELD = "shipping_query";
|
|
|
|
private static final String PRE_CHECKOUT_QUERY_FIELD = "pre_checkout_query";
|
2016-11-17 02:41:12 +01:00
|
|
|
|
2016-01-14 01:14:53 +01:00
|
|
|
@JsonProperty(UPDATEID_FIELD)
|
|
|
|
private Integer updateId;
|
|
|
|
@JsonProperty(MESSAGE_FIELD)
|
|
|
|
private Message message; ///< Optional. New incoming message of any kind — text, photo, sticker, etc.
|
|
|
|
@JsonProperty(INLINEQUERY_FIELD)
|
|
|
|
private InlineQuery inlineQuery; ///< Optional. New incoming inline query
|
|
|
|
@JsonProperty(CHOSENINLINEQUERY_FIELD)
|
|
|
|
private ChosenInlineQuery chosenInlineQuery; ///< Optional. The result of a inline query that was chosen by a user and sent to their chat partner
|
2016-04-11 02:53:53 +02:00
|
|
|
@JsonProperty(CALLBACKQUERY_FIELD)
|
|
|
|
private CallbackQuery callbackQuery; ///< Optional. New incoming callback query
|
2016-05-22 11:42:04 +02:00
|
|
|
@JsonProperty(EDITEDMESSAGE_FIELD)
|
|
|
|
private Message editedMessage; ///< Optional. New version of a message that is known to the bot and was edited
|
2016-11-21 01:28:09 +01:00
|
|
|
@JsonProperty(CHANNELPOST_FIELD)
|
|
|
|
private Message channelPost; ///< Optional. New incoming channel post of any kind — text, photo, sticker, etc.
|
|
|
|
@JsonProperty(EDITEDCHANNELPOST_FIELD)
|
|
|
|
private Message editedChannelPost; ///< Optional. New version of a channel post that is known to the bot and was edited
|
2017-03-27 00:49:08 +02:00
|
|
|
@JsonProperty(SHIPPING_QUERY_FIELD)
|
|
|
|
private ShippingQuery shippingQuery; ///< Optional. New incoming shipping query. Only for invoices with flexible price
|
|
|
|
@JsonProperty(PRE_CHECKOUT_QUERY_FIELD)
|
|
|
|
private PreCheckoutQuery preCheckoutQuery; ///< Optional. New incoming pre-checkout query. Contains full information about checkout
|
2016-01-14 01:14:53 +01:00
|
|
|
|
|
|
|
public Update() {
|
|
|
|
super();
|
|
|
|
}
|
|
|
|
|
|
|
|
public Integer getUpdateId() {
|
|
|
|
return updateId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Message getMessage() {
|
|
|
|
return message;
|
|
|
|
}
|
|
|
|
|
|
|
|
public InlineQuery getInlineQuery() {
|
|
|
|
return inlineQuery;
|
|
|
|
}
|
|
|
|
|
|
|
|
public ChosenInlineQuery getChosenInlineQuery() {
|
|
|
|
return chosenInlineQuery;
|
|
|
|
}
|
|
|
|
|
2016-04-11 02:53:53 +02:00
|
|
|
public CallbackQuery getCallbackQuery() {
|
|
|
|
return callbackQuery;
|
|
|
|
}
|
|
|
|
|
2016-05-22 11:42:04 +02:00
|
|
|
public Message getEditedMessage() {
|
|
|
|
return editedMessage;
|
|
|
|
}
|
|
|
|
|
2016-11-21 01:28:09 +01:00
|
|
|
public Message getChannelPost() {
|
|
|
|
return channelPost;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Message getEditedChannelPost() {
|
|
|
|
return editedChannelPost;
|
|
|
|
}
|
|
|
|
|
2017-03-27 00:49:08 +02:00
|
|
|
public ShippingQuery getShippingQuery() {
|
|
|
|
return shippingQuery;
|
|
|
|
}
|
|
|
|
|
|
|
|
public PreCheckoutQuery getPreCheckoutQuery() {
|
|
|
|
return preCheckoutQuery;
|
|
|
|
}
|
|
|
|
|
2016-01-14 01:14:53 +01:00
|
|
|
public boolean hasMessage() {
|
|
|
|
return message != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean hasInlineQuery() {
|
|
|
|
return inlineQuery != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean hasChosenInlineQuery() {
|
|
|
|
return chosenInlineQuery != null;
|
|
|
|
}
|
|
|
|
|
2016-04-11 02:53:53 +02:00
|
|
|
public boolean hasCallbackQuery() {
|
|
|
|
return callbackQuery != null;
|
|
|
|
}
|
|
|
|
|
2016-05-22 11:42:04 +02:00
|
|
|
public boolean hasEditedMessage() {
|
|
|
|
return editedMessage != null;
|
|
|
|
}
|
2016-03-08 20:17:07 +01:00
|
|
|
|
2016-11-21 01:28:09 +01:00
|
|
|
public boolean hasChannelPost() {
|
|
|
|
return channelPost != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean hasEditedChannelPost() {
|
|
|
|
return editedChannelPost != null;
|
|
|
|
}
|
|
|
|
|
2017-03-27 00:49:08 +02:00
|
|
|
public boolean hasShippingQuery() {
|
|
|
|
return shippingQuery != null;
|
|
|
|
}
|
|
|
|
|
|
|
|
public boolean hasPreCheckoutQuery() {
|
|
|
|
return preCheckoutQuery != null;
|
|
|
|
}
|
|
|
|
|
2016-03-08 20:17:07 +01:00
|
|
|
@Override
|
|
|
|
public String toString() {
|
|
|
|
return "Update{" +
|
|
|
|
"updateId=" + updateId +
|
|
|
|
", message=" + message +
|
|
|
|
", inlineQuery=" + inlineQuery +
|
|
|
|
", chosenInlineQuery=" + chosenInlineQuery +
|
2016-05-01 23:02:22 +02:00
|
|
|
", callbackQuery=" + callbackQuery +
|
2016-05-22 11:42:04 +02:00
|
|
|
", editedMessage=" + editedMessage +
|
2016-11-21 01:28:09 +01:00
|
|
|
", channelPost=" + channelPost +
|
|
|
|
", editedChannelPost=" + editedChannelPost +
|
2017-03-27 00:49:08 +02:00
|
|
|
", shippingQuery=" + shippingQuery +
|
|
|
|
", preCheckoutQuery=" + preCheckoutQuery +
|
2016-03-08 20:17:07 +01:00
|
|
|
'}';
|
|
|
|
}
|
2016-01-14 01:14:53 +01:00
|
|
|
}
|