This commit is contained in:
Ruben Bermudez 2019-06-08 20:33:28 +01:00
parent b3914c5e76
commit 25e69f8055
127 changed files with 854 additions and 190 deletions

View File

@ -16,11 +16,11 @@
<sourceOutputDir name="target/generated-sources/annotations" /> <sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" /> <outputRelativeToContentRoot value="true" />
<module name="telegrambots-meta" />
<module name="telegrambots-extensions" />
<module name="telegrambots" /> <module name="telegrambots" />
<module name="telegrambots-abilities" /> <module name="telegrambots-abilities" />
<module name="telegrambots-chat-session-bot" /> <module name="telegrambots-chat-session-bot" />
<module name="telegrambots-extensions" />
<module name="telegrambots-meta" />
<module name="telegrambots-spring-boot-starter" /> <module name="telegrambots-spring-boot-starter" />
</profile> </profile>
<profile name="Annotation profile for Bots" enabled="true"> <profile name="Annotation profile for Bots" enabled="true">
@ -503,7 +503,7 @@
<component name="DBNavigator.Project.StatementExecutionManager"> <component name="DBNavigator.Project.StatementExecutionManager">
<execution-variables /> <execution-variables />
</component> </component>
<component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8" addBOMForNewFiles="with NO BOM"> <component name="Encoding" defaultCharsetForPropertiesFiles="UTF-8">
<file url="file://$PROJECT_DIR$/telegrambots" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/telegrambots" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/telegrambots-abilities" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/telegrambots-abilities" charset="UTF-8" />
<file url="file://$PROJECT_DIR$/telegrambots-chat-session-bot" charset="UTF-8" /> <file url="file://$PROJECT_DIR$/telegrambots-chat-session-bot" charset="UTF-8" />
@ -909,59 +909,59 @@
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-annotations/2.9.0/jackson-annotations-2.9.0-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
<library name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.8"> <library name="Maven: com.fasterxml.jackson.core:jackson-core:2.9.9">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.9.8/jackson-core-2.9.8.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.9.9/jackson-core-2.9.9.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.9.8/jackson-core-2.9.8-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.9.9/jackson-core-2.9.9-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.9.8/jackson-core-2.9.8-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-core/2.9.9/jackson-core-2.9.9-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
<library name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.8"> <library name="Maven: com.fasterxml.jackson.core:jackson-databind:2.9.9">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.9.9/jackson-databind-2.9.9.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.9.9/jackson-databind-2.9.9-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.9.8/jackson-databind-2.9.8-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/core/jackson-databind/2.9.9/jackson-databind-2.9.9-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
<library name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.9.8"> <library name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:2.9.9">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.9.8/jackson-jaxrs-base-2.9.8.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.9.9/jackson-jaxrs-base-2.9.9.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.9.8/jackson-jaxrs-base-2.9.8-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.9.9/jackson-jaxrs-base-2.9.9-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.9.8/jackson-jaxrs-base-2.9.8-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-base/2.9.9/jackson-jaxrs-base-2.9.9-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
<library name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.9.8"> <library name="Maven: com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:2.9.9">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.9.8/jackson-jaxrs-json-provider-2.9.8.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.9.9/jackson-jaxrs-json-provider-2.9.9.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.9.8/jackson-jaxrs-json-provider-2.9.8-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.9.9/jackson-jaxrs-json-provider-2.9.9-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.9.8/jackson-jaxrs-json-provider-2.9.8-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/jaxrs/jackson-jaxrs-json-provider/2.9.9/jackson-jaxrs-json-provider-2.9.9-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
<library name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.9.8"> <library name="Maven: com.fasterxml.jackson.module:jackson-module-jaxb-annotations:2.9.9">
<CLASSES> <CLASSES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.9.8/jackson-module-jaxb-annotations-2.9.8.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.9.9/jackson-module-jaxb-annotations-2.9.9.jar!/" />
</CLASSES> </CLASSES>
<JAVADOC> <JAVADOC>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.9.8/jackson-module-jaxb-annotations-2.9.8-javadoc.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.9.9/jackson-module-jaxb-annotations-2.9.9-javadoc.jar!/" />
</JAVADOC> </JAVADOC>
<SOURCES> <SOURCES>
<root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.9.8/jackson-module-jaxb-annotations-2.9.8-sources.jar!/" /> <root url="jar://$MAVEN_REPOSITORY$/com/fasterxml/jackson/module/jackson-module-jaxb-annotations/2.9.9/jackson-module-jaxb-annotations-2.9.9-sources.jar!/" />
</SOURCES> </SOURCES>
</library> </library>
<library name="Maven: com.google.code.findbugs:jsr305:3.0.2"> <library name="Maven: com.google.code.findbugs:jsr305:3.0.2">

View File

@ -1,3 +1,9 @@
### <a id="4.3.1"></a>4.3.1 ###
1. Fix bug #625
2. Moved ApiResponse to different package, deprecated old one (will be removed in next mayor version)
3. Deprecated InputBotApiObject (It will be removed in next mayor update). And all usages moved to basic BotApiObject type.
4. Updated jackson dependency to avoid security bug
### <a id="4.3"></a>4.3 ### ### <a id="4.3"></a>4.3 ###
1. Update to Api version [4.3](https://core.telegram.org/bots/api-changelog#may-31-2019) 1. Update to Api version [4.3](https://core.telegram.org/bots/api-changelog#may-31-2019)
2. Fixed: #615, #621 2. Fixed: #615, #621

View File

@ -60,7 +60,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<guice.version>4.2.2</guice.version> <guice.version>4.2.2</guice.version>
<jackson.version>2.9.8</jackson.version> <jackson.version>2.9.9</jackson.version>
<jacksonanotation.version>2.9.0</jacksonanotation.version> <jacksonanotation.version>2.9.0</jacksonanotation.version>
<json.version>20180813</json.version> <json.version>20180813</json.version>
<junit.version>4.12</junit.version> <junit.version>4.12</junit.version>

View File

@ -2,17 +2,16 @@ package org.telegram.telegrambots.meta.api.interfaces;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import java.io.Serializable;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* An object used in the Bots API to answer updates * An object used in the Bots API to answer updates
*
* @deprecated Please, use BotApiObject directly
*/ */
@JsonIgnoreProperties(ignoreUnknown = true) @JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL) @JsonInclude(JsonInclude.Include.NON_NULL)
@JsonTypeInfo(use=JsonTypeInfo.Id.CLASS, property="@class") @Deprecated
public interface InputBotApiObject extends Serializable { public interface InputBotApiObject extends BotApiObject {
} }

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -12,14 +12,13 @@ import java.io.IOException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Use this method to send answers to callback queries sent from inline keyboards. The answer * Use this method to send answers to callback queries sent from inline keyboards. The answer
* will be displayed to the user as a notification at the top of the chat screen or as an alert. On * will be displayed to the user as a notification at the top of the chat screen or as an alert. On
* success, True is returned. * success, True is returned.
* *
* @note Alternatively, the user can be redirected to the specified URL. For this option to work, * @note Alternatively, the user can be redirected to the specified URL. For this option to work,
* you must enable /setcustomurls for your bot via BotFather and accept the terms. * you must enable /setcustomurls for your bot via BotFather and accept the terms.
* *
* @date 10 of April of 2016
*/ */
public class AnswerCallbackQuery extends BotApiMethod<Boolean> { public class AnswerCallbackQuery extends BotApiMethod<Boolean> {
public static final String PATH = "answercallbackquery"; public static final String PATH = "answercallbackquery";
@ -36,21 +35,21 @@ public class AnswerCallbackQuery extends BotApiMethod<Boolean> {
private String text; ///< Optional Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters private String text; ///< Optional Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters
@JsonProperty(SHOWALERT_FIELD) @JsonProperty(SHOWALERT_FIELD)
private Boolean showAlert; ///< Optional. If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false. private Boolean showAlert; ///< Optional. If true, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to false.
@JsonProperty(URL_FIELD)
/** /**
* Optional. URL that will be opened by the user's client. * Optional. URL that will be opened by the user's client.
* If you have created a Game and accepted the conditions via @Botfather, * If you have created a Game and accepted the conditions via @Botfather,
* specify the URL that opens your game. Otherwise you may use links * specify the URL that opens your game. Otherwise you may use links
* like telegram.me/your_bot?start=XXXX that open your bot with a parameter. * like telegram.me/your_bot?start=XXXX that open your bot with a parameter.
*/ */
@JsonProperty(URL_FIELD)
private String url; private String url;
@JsonProperty(CACHETIME_FIELD)
/** /**
* Optional The maximum amount of time in seconds that the result of the callback query * Optional The maximum amount of time in seconds that the result of the callback query
* may be cached client-side. * may be cached client-side.
* *
* @note Telegram apps will support caching starting in version 3.14. Defaults to 0. * @note Telegram apps will support caching starting in version 3.14. Defaults to 0.
*/ */
@JsonProperty(CACHETIME_FIELD)
private Integer cacheTime; private Integer cacheTime;
public AnswerCallbackQuery() { public AnswerCallbackQuery() {

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -2,7 +2,7 @@ package org.telegram.telegrambots.meta.api.methods;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.objects.payments.ShippingOption; import org.telegram.telegrambots.meta.api.objects.payments.ShippingOption;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.objects.File; import org.telegram.telegrambots.meta.api.objects.File;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -13,14 +13,13 @@ import java.io.IOException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Use this method to get basic info about a file and prepare it for downloading. * Use this method to get basic info about a file and prepare it for downloading.
* For the moment, bots can download files of up to 20MB in size. * For the moment, bots can download files of up to 20MB in size.
* On success, a File object is returned. * On success, a File object is returned.
* The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>, * The file can then be downloaded via the link https://api.telegram.org/file/bot<token>/<file_path>,
* where <file_path> is taken from the response. * where <file_path> is taken from the response.
* It is guaranteed that the link will be valid for at least 1 hour. * It is guaranteed that the link will be valid for at least 1 hour.
* When the link expires, a new one can be requested by calling getFile again. * When the link expires, a new one can be requested by calling getFile again.
* @date 20 of June of 2015
*/ */
public class GetFile extends BotApiMethod<File> { public class GetFile extends BotApiMethod<File> {
public static final String PATH = "getFile"; public static final String PATH = "getFile";

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.objects.User; import org.telegram.telegrambots.meta.api.objects.User;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -12,9 +12,8 @@ import java.io.IOException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief A simple method for testing your bot's auth token. Requires no parameters. * A simple method for testing your bot's auth token. Requires no parameters.
* Returns basic information about the bot in form of a User object * Returns basic information about the bot in form of a User object
* @date 20 of June of 2015
*/ */
public class GetMe extends BotApiMethod<User> { public class GetMe extends BotApiMethod<User> {
public static final String PATH = "getme"; public static final String PATH = "getme";

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.objects.UserProfilePhotos; import org.telegram.telegrambots.meta.api.objects.UserProfilePhotos;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -13,8 +13,7 @@ import java.io.IOException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object. * Use this method to get a list of profile pictures for a user. Returns a UserProfilePhotos object.
* @date 20 of June of 2015
*/ */
public class GetUserProfilePhotos extends BotApiMethod<UserProfilePhotos> { public class GetUserProfilePhotos extends BotApiMethod<UserProfilePhotos> {
public static final String PATH = "getuserprofilephotos"; public static final String PATH = "getuserprofilephotos";

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.objects.passport.dataerror.PassportElementError; import org.telegram.telegrambots.meta.api.objects.passport.dataerror.PassportElementError;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -21,7 +21,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.games.GameHighScore; import org.telegram.telegrambots.meta.api.objects.games.GameHighScore;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -31,7 +31,7 @@ import java.util.ArrayList;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 2.4 * @version 2.4
* @brief Use this method to get data for high score tables. * Use this method to get data for high score tables.
* Will return the score of the specified user and several of his neighbors in a game. * Will return the score of the specified user and several of his neighbors in a game.
* On success, returns an Array of GameHighScore objects. * On success, returns an Array of GameHighScore objects.
* *
@ -40,7 +40,6 @@ import java.util.ArrayList;
* if the user and his neighbors are not among them. * if the user and his neighbors are not among them.
* Please note that this behavior is subject to change. * Please note that this behavior is subject to change.
* *
* @date 16 of September of 2016
*/ */
public class GetGameHighScores extends BotApiMethod<ArrayList<GameHighScore>> { public class GetGameHighScores extends BotApiMethod<ArrayList<GameHighScore>> {
public static final String PATH = "getGameHighScores"; public static final String PATH = "getGameHighScores";

View File

@ -22,7 +22,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -2,12 +2,14 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import java.io.IOException;
import java.util.Objects;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import java.io.IOException;
import java.util.Objects;
import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkNotNull;
/** /**

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Chat; import org.telegram.telegrambots.meta.api.objects.Chat;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ChatMember; import org.telegram.telegrambots.meta.api.objects.ChatMember;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -16,12 +16,11 @@ import java.util.Objects;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Use this method to get a list of administrators in a chat. * Use this method to get a list of administrators in a chat.
* An Array of ChatMember objects is returned on success, * An Array of ChatMember objects is returned on success,
* containing information about all chat administrators except other bots. * containing information about all chat administrators except other bots.
* If the chat is a group or a supergroup and no administrators were appointed, * If the chat is a group or a supergroup and no administrators were appointed,
* only the creator will be returned. * only the creator will be returned.
* @date 20 of May of 2016
*/ */
public class GetChatAdministrators extends BotApiMethod<ArrayList<ChatMember>> { public class GetChatAdministrators extends BotApiMethod<ArrayList<ChatMember>> {
public static final String PATH = "getChatAdministrators"; public static final String PATH = "getChatAdministrators";

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.ChatMember; import org.telegram.telegrambots.meta.api.objects.ChatMember;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -15,9 +15,8 @@ import java.util.Objects;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Use this method to get information about a member of a chat. * Use this method to get information about a member of a chat.
* Returns a ChatMember object on success. * Returns a ChatMember object on success.
* @date 20 of May of 2016
*/ */
public class GetChatMember extends BotApiMethod<ChatMember> { public class GetChatMember extends BotApiMethod<ChatMember> {
public static final String PATH = "getChatMember"; public static final String PATH = "getChatMember";

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -14,8 +14,7 @@ import java.util.Objects;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Use this method for your bot to leave a group, supergroup or channel. Returns True on success. * Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
* @date 20 of May of 2016
*/ */
public class LeaveChat extends BotApiMethod<Boolean> { public class LeaveChat extends BotApiMethod<Boolean> {
public static final String PATH = "leaveChat"; public static final String PATH = "leaveChat";

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -2,7 +2,7 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.groupadministration;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.pinnedmessages;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -31,11 +31,11 @@ public class PinChatMessage extends BotApiMethod<Boolean> {
private String chatId; ///< Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername) private String chatId; ///< Required. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
@JsonProperty(MESSAGEID_FIELD) @JsonProperty(MESSAGEID_FIELD)
private Integer messageId; ///< Required. Identifier of a message to pin private Integer messageId; ///< Required. Identifier of a message to pin
@JsonProperty(DISABLENOTIFICATION_FIELD)
/** /**
* Pass True, if it is not necessary to send a notification to all chat members about the new pinned message. * Pass True, if it is not necessary to send a notification to all chat members about the new pinned message.
* Notifications are always disabled in channels. * Notifications are always disabled in channels.
*/ */
@JsonProperty(DISABLENOTIFICATION_FIELD)
private Boolean disableNotification; private Boolean disableNotification;
public PinChatMessage() { public PinChatMessage() {

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.pinnedmessages;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -33,11 +33,11 @@ public class SendPoll extends BotApiMethod<Message> {
private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id"; private static final String REPLYTOMESSAGEID_FIELD = "reply_to_message_id";
private static final String REPLYMARKUP_FIELD = "reply_markup"; private static final String REPLYMARKUP_FIELD = "reply_markup";
@JsonProperty(CHATID_FIELD)
/** /**
* Unique identifier for the target chat or username of the target channel (in the format @channelusername). * Unique identifier for the target chat or username of the target channel (in the format @channelusername).
* A native poll can't be sent to a private chat. * A native poll can't be sent to a private chat.
*/ */
@JsonProperty(CHATID_FIELD)
private String chatId; private String chatId;
@JsonProperty(QUESTION_FIELD) @JsonProperty(QUESTION_FIELD)
private String question; ///< Poll question, 1-255 characters private String question; ///< Poll question, 1-255 characters

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.polls.Poll; import org.telegram.telegrambots.meta.api.objects.polls.Poll;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -6,7 +6,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.ActionType; import org.telegram.telegrambots.meta.api.methods.ActionType;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -27,7 +27,7 @@ public class SendChatAction extends BotApiMethod<Boolean> {
public static final String PATH = "sendChatAction"; public static final String PATH = "sendChatAction";
public static final String CHATID_FIELD = "chat_id"; public static final String CHATID_FIELD = "chat_id";
public static final String ACTION_FIELD = "action"; private static final String ACTION_FIELD = "action";
@JsonProperty(CHATID_FIELD) @JsonProperty(CHATID_FIELD)
private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels) private String chatId; ///< Unique identifier for the chat to send the message to (Or username for channels)

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -22,7 +22,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -33,8 +33,7 @@ import java.util.Objects;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Use this method to send a game. On success, the sent Message is returned. * Use this method to send a game. On success, the sent Message is returned.
* @date 27 of September of 2016
*/ */
public class SendGame extends BotApiMethod<Message> { public class SendGame extends BotApiMethod<Message> {
public static final String PATH = "sendGame"; public static final String PATH = "sendGame";

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice; import org.telegram.telegrambots.meta.api.objects.payments.LabeledPrice;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -61,11 +61,11 @@ public class SendInvoice extends BotApiMethod<Message> {
private String currency; ///< 3-letter ISO 4217 currency code private String currency; ///< 3-letter ISO 4217 currency code
@JsonProperty(PRICES_FIELD) @JsonProperty(PRICES_FIELD)
private List<LabeledPrice> prices; ///< Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) private List<LabeledPrice> prices; ///< Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
@JsonProperty(PHOTO_URL_FIELD)
/** /**
* Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service. * Optional. URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.
* People like it better when they see what they are paying for * People like it better when they see what they are paying for
*/ */
@JsonProperty(PHOTO_URL_FIELD)
private String photoUrl; private String photoUrl;
@JsonProperty(PHOTO_SIZE_FIELD) @JsonProperty(PHOTO_SIZE_FIELD)
private Integer photoSize; ///< Optional. Photo size private Integer photoSize; ///< Optional. Photo size
@ -87,19 +87,19 @@ public class SendInvoice extends BotApiMethod<Message> {
private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound. private Boolean disableNotification; ///< Optional. Sends the message silently. Users will receive a notification with no sound.
@JsonProperty(REPLY_TO_MESSAGE_ID_FIELD) @JsonProperty(REPLY_TO_MESSAGE_ID_FIELD)
private Integer replyToMessageId; ///< Optional. If the message is a reply, ID of the original message private Integer replyToMessageId; ///< Optional. If the message is a reply, ID of the original message
@JsonProperty(REPLY_MARKUP_FIELD)
/** /**
* Optional. A JSON-serialized object for an inline keyboard. * Optional. A JSON-serialized object for an inline keyboard.
* *
* @note If empty, one 'Buy title' button will be shown. If not empty, the first button must be a Pay button. * @note If empty, one 'Buy title' button will be shown. If not empty, the first button must be a Pay button.
*/ */
@JsonProperty(REPLY_MARKUP_FIELD)
private InlineKeyboardMarkup replyMarkup; private InlineKeyboardMarkup replyMarkup;
@JsonProperty(PRIVIDER_DATA_FIELD)
/** /**
* Optional JSON-encoded data about the invoice, which will be shared with the payment provider. * Optional JSON-encoded data about the invoice, which will be shared with the payment provider.
* *
* @note A detailed description of required fields should be provided by the payment provider. * @note A detailed description of required fields should be provided by the payment provider.
*/ */
@JsonProperty(PRIVIDER_DATA_FIELD)
private String providerData; private String providerData;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -7,7 +7,7 @@ import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.media.InputMedia; import org.telegram.telegrambots.meta.api.objects.media.InputMedia;
import org.telegram.telegrambots.meta.api.objects.media.InputMediaPhoto; import org.telegram.telegrambots.meta.api.objects.media.InputMediaPhoto;
import org.telegram.telegrambots.meta.api.objects.media.InputMediaVideo; import org.telegram.telegrambots.meta.api.objects.media.InputMediaVideo;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -2,10 +2,11 @@ package org.telegram.telegrambots.meta.api.methods.send;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.methods.ParseMode; import org.telegram.telegrambots.meta.api.methods.ParseMode;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -44,6 +45,7 @@ public class SendMessage extends BotApiMethod<Message> {
@JsonProperty(REPLYTOMESSAGEID_FIELD) @JsonProperty(REPLYTOMESSAGEID_FIELD)
private Integer replyToMessageId; ///< Optional. If the message is a reply, ID of the original message private Integer replyToMessageId; ///< Optional. If the message is a reply, ID of the original message
@JsonProperty(REPLYMARKUP_FIELD) @JsonProperty(REPLYMARKUP_FIELD)
@JsonDeserialize()
private ReplyKeyboard replyMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard private ReplyKeyboard replyMarkup; ///< Optional. JSON-serialized object for a custom reply keyboard
public SendMessage() { public SendMessage() {

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard; import org.telegram.telegrambots.meta.api.objects.replykeyboard.ReplyKeyboard;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.stickers;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.stickers.MaskPosition; import org.telegram.telegrambots.meta.api.objects.stickers.MaskPosition;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.stickers;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.stickers.MaskPosition; import org.telegram.telegrambots.meta.api.objects.stickers.MaskPosition;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.stickers;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.stickers;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.stickers.StickerSet; import org.telegram.telegrambots.meta.api.objects.stickers.StickerSet;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.stickers;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.File; import org.telegram.telegrambots.meta.api.objects.File;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.updates;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -12,9 +12,8 @@ import java.io.IOException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Use this method to receive incoming updates using long polling (wiki). An Array of Update * Use this method to receive incoming updates using long polling (wiki). An Array of Update
* objects is returned. * objects is returned.
* @date 20 of June of 2015
*/ */
public class DeleteWebhook extends BotApiMethod<Boolean>{ public class DeleteWebhook extends BotApiMethod<Boolean>{
public static final String PATH = "deleteWebhook"; public static final String PATH = "deleteWebhook";

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Update; import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -16,9 +16,8 @@ import java.util.List;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Use this method to receive incoming updates using long polling (wiki). An Array of Update * Use this method to receive incoming updates using long polling (wiki). An Array of Update
* objects is returned. * objects is returned.
* @date 20 of June of 2015
*/ */
public class GetUpdates extends BotApiMethod<ArrayList<Update>>{ public class GetUpdates extends BotApiMethod<ArrayList<Update>>{
public static final String PATH = "getupdates"; public static final String PATH = "getupdates";

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.WebhookInfo; import org.telegram.telegrambots.meta.api.objects.WebhookInfo;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -13,12 +13,10 @@ import java.io.IOException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 2.4 * @version 2.4
* @brief Use this method to get current webhook status. * Use this method to get current webhook status.
* Requires no parameters. * Requires no parameters.
* On success, returns a WebhookInfo object. * On success, returns a WebhookInfo object.
* Will throw an error, if the bot is using getUpdates. * Will throw an error, if the bot is using getUpdates.
*
* @date 12 of August of 2016
*/ */
public class GetWebhookInfo extends BotApiMethod<WebhookInfo> { public class GetWebhookInfo extends BotApiMethod<WebhookInfo> {
public static final String PATH = "getwebhookinfo"; public static final String PATH = "getwebhookinfo";

View File

@ -3,7 +3,7 @@ package org.telegram.telegrambots.meta.api.methods.updatingmessages;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod; import org.telegram.telegrambots.meta.api.methods.PartialBotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.media.InputMedia; import org.telegram.telegrambots.meta.api.objects.media.InputMedia;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;

View File

@ -5,7 +5,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -16,10 +16,9 @@ import java.io.Serializable;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Use this method to edit only the reply markup of messages. * Use this method to edit only the reply markup of messages.
* On success, if edited message is sent by the bot, the edited Message is returned, * On success, if edited message is sent by the bot, the edited Message is returned,
* therwise True is returned. * otherwise True is returned.
* @date 10 of April of 2016
*/ */
public class EditMessageReplyMarkup extends BotApiMethod<Serializable> { public class EditMessageReplyMarkup extends BotApiMethod<Serializable> {
public static final String PATH = "editmessagereplymarkup"; public static final String PATH = "editmessagereplymarkup";

View File

@ -6,7 +6,7 @@ import com.fasterxml.jackson.core.type.TypeReference;
import org.telegram.telegrambots.meta.api.methods.BotApiMethod; import org.telegram.telegrambots.meta.api.methods.BotApiMethod;
import org.telegram.telegrambots.meta.api.methods.ParseMode; import org.telegram.telegrambots.meta.api.methods.ParseMode;
import org.telegram.telegrambots.meta.api.objects.Message; import org.telegram.telegrambots.meta.api.objects.Message;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.ApiResponse; import org.telegram.telegrambots.meta.api.objects.ApiResponse;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException; import org.telegram.telegrambots.meta.exceptions.TelegramApiRequestException;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -17,9 +17,8 @@ import java.io.Serializable;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Use this method to edit text messages. On * Use this method to edit text messages. On
* success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned. * success, if edited message is sent by the bot, the edited Message is returned, otherwise True is returned.
* @date 10 of April of 2016
*/ */
public class EditMessageText extends BotApiMethod<Serializable> { public class EditMessageText extends BotApiMethod<Serializable> {
public static final String PATH = "editmessagetext"; public static final String PATH = "editmessagetext";

View File

@ -0,0 +1,70 @@
package org.telegram.telegrambots.meta.api.objects;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.Serializable;
/**
* @author Ruben Bermudez
* @version 1.0
* Response from Telegram Server
*/
@JsonIgnoreProperties(ignoreUnknown = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
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 + '\'' +
'}';
}
}
}

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessageconte
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
@ -11,6 +12,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@JsonDeserialize
public class InputContactMessageContent implements InputMessageContent { public class InputContactMessageContent implements InputMessageContent {
private static final String PHONE_NUMBER_FIELD = "phone_number"; private static final String PHONE_NUMBER_FIELD = "phone_number";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessageconte
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import java.util.Objects; import java.util.Objects;
@ -15,6 +16,7 @@ import static com.google.common.base.Preconditions.checkNotNull;
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@JsonDeserialize
public class InputLocationMessageContent implements InputMessageContent { public class InputLocationMessageContent implements InputMessageContent {
private static final String LATITUDE_FIELD = "latitude"; private static final String LATITUDE_FIELD = "latitude";

View File

@ -1,14 +1,16 @@
package org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent; 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.InputBotApiObject;
import org.telegram.telegrambots.meta.api.interfaces.Validable; import org.telegram.telegrambots.meta.api.interfaces.Validable;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.serialization.InputMessageContentDeserializer;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief This object represents the content of a message to be sent as a result of an inline * This object represents the content of a message to be sent as a result of an inline
* query. * query.
* @date 10 of April of 2016
*/ */
@JsonDeserialize(using = InputMessageContentDeserializer.class)
public interface InputMessageContent extends InputBotApiObject, Validable { public interface InputMessageContent extends InputBotApiObject, Validable {
} }

View File

@ -2,15 +2,16 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessageconte
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.methods.ParseMode; import org.telegram.telegrambots.meta.api.methods.ParseMode;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Represents the content of a text message to be sent as the result of an inline query. * Represents the content of a text message to be sent as the result of an inline query.
* @date 10 of April of 2016
*/ */
@JsonDeserialize
public class InputTextMessageContent implements InputMessageContent { public class InputTextMessageContent implements InputMessageContent {
private static final String MESSAGETEXT_FIELD = "message_text"; private static final String MESSAGETEXT_FIELD = "message_text";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessageconte
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
@ -11,6 +12,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@JsonDeserialize
public class InputVenueMessageContent implements InputMessageContent { public class InputVenueMessageContent implements InputMessageContent {
private static final String LATITUDE_FIELD = "latitude"; private static final String LATITUDE_FIELD = "latitude";

View File

@ -0,0 +1,57 @@
package org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.serialization;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.*;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
*/
public class InputMessageContentDeserializer extends StdDeserializer<InputMessageContent> {
private final ObjectMapper objectMapper;
public InputMessageContentDeserializer() {
this(null);
}
private InputMessageContentDeserializer(Class<?> vc) {
super(vc);
this.objectMapper = new ObjectMapper();
}
@Override
public InputMessageContent deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException {
JsonNode node = jsonParser.getCodec().readTree(jsonParser);
if (node.has("message_text")) {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InputTextMessageContent>(){});
}
// Order here is important since Venue and Location has both latitude
if (node.has("address")) {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InputVenueMessageContent>(){});
}
if (node.has("latitude")) {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InputLocationMessageContent>(){});
}
if (node.has("phone_number")) {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InputContactMessageContent>(){});
}
return null;
}
}

View File

@ -1,13 +1,15 @@
package org.telegram.telegrambots.meta.api.objects.inlinequery.result; 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.InputBotApiObject;
import org.telegram.telegrambots.meta.api.interfaces.Validable; import org.telegram.telegrambots.meta.api.interfaces.Validable;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.serialization.InlineQueryResultDeserializer;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief This object represents one result of an inline query. * This object represents one result of an inline query.
* @date 01 of January of 2016
*/ */
@JsonDeserialize(using = InlineQueryResultDeserializer.class)
public interface InlineQueryResult extends InputBotApiObject, Validable { public interface InlineQueryResult extends InputBotApiObject, Validable {
} }

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -9,9 +10,9 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Represents a link to an article or web page. * Represents a link to an article or web page.
* @date 01 of January of 2016
*/ */
@JsonDeserialize
public class InlineQueryResultArticle implements InlineQueryResult { public class InlineQueryResultArticle implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -15,6 +16,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@JsonDeserialize
public class InlineQueryResultAudio implements InlineQueryResult { public class InlineQueryResultAudio implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -1,7 +1,7 @@
package org.telegram.telegrambots.meta.api.objects.inlinequery.result; package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -15,6 +15,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@JsonDeserialize
public class InlineQueryResultContact implements InlineQueryResult { public class InlineQueryResultContact implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -16,6 +17,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@JsonDeserialize
public class InlineQueryResultDocument implements InlineQueryResult { public class InlineQueryResultDocument implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -19,6 +19,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -30,6 +31,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* *
* @apiNote This will only work in Telegram versions released after 1 October, 2016. Older clients will ignore them. * @apiNote This will only work in Telegram versions released after 1 October, 2016. Older clients will ignore them.
*/ */
@JsonDeserialize
public class InlineQueryResultGame implements InlineQueryResult { public class InlineQueryResultGame implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -13,6 +14,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* by the user with optional caption. Alternatively, you can use input_message_content to send a * 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. * message with the specified content instead of the animation.
*/ */
@JsonDeserialize
public class InlineQueryResultGif implements InlineQueryResult { public class InlineQueryResultGif implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";
private static final String ID_FIELD = "id"; private static final String ID_FIELD = "id";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -15,6 +16,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@JsonDeserialize
public class InlineQueryResultLocation implements InlineQueryResult { public class InlineQueryResultLocation implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -9,11 +10,11 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, * 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 * 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. * use input_message_content to send a message with the specified content instead of the animation.
* @date 01 of January of 2016
*/ */
@JsonDeserialize
public class InlineQueryResultMpeg4Gif implements InlineQueryResult { public class InlineQueryResultMpeg4Gif implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -13,6 +14,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* optional caption. Alternatively, you can use input_message_content to send a message with the * optional caption. Alternatively, you can use input_message_content to send a message with the
* specified content instead of the photo. * specified content instead of the photo.
*/ */
@JsonDeserialize
public class InlineQueryResultPhoto implements InlineQueryResult { public class InlineQueryResultPhoto implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";
private static final String ID_FIELD = "id"; private static final String ID_FIELD = "id";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -14,6 +15,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@JsonDeserialize
public class InlineQueryResultVenue implements InlineQueryResult { public class InlineQueryResultVenue implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -13,6 +14,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* Alternatively, you can use input_message_content to send a message with the specified content * Alternatively, you can use input_message_content to send a message with the specified content
* instead of the video. * instead of the video.
*/ */
@JsonDeserialize
public class InlineQueryResultVideo implements InlineQueryResult { public class InlineQueryResultVideo implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";
private static final String ID_FIELD = "id"; private static final String ID_FIELD = "id";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -15,6 +16,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@JsonDeserialize
public class InlineQueryResultVoice implements InlineQueryResult { public class InlineQueryResultVoice implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";
private static final String ID_FIELD = "id"; private static final String ID_FIELD = "id";

View File

@ -1,7 +1,7 @@
package org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached; package org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -10,13 +10,13 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Represents a link to an mp3 audio file stored on the Telegram servers. By default, this * 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 * 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. * 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 * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
* @date 10 of April of 2016
*/ */
@JsonDeserialize
public class InlineQueryResultCachedAudio implements InlineQueryResult { public class InlineQueryResultCachedAudio implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -17,6 +18,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@JsonDeserialize
public class InlineQueryResultCachedDocument implements InlineQueryResult { public class InlineQueryResultCachedDocument implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -14,6 +15,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* animated GIF file will be sent by the user with an optional caption. Alternatively, you can use * 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. * input_message_content to send a message with specified content instead of the animation.
*/ */
@JsonDeserialize
public class InlineQueryResultCachedGif implements InlineQueryResult { public class InlineQueryResultCachedGif implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";
private static final String ID_FIELD = "id"; private static final String ID_FIELD = "id";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -10,11 +11,11 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, * 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 * 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. * use input_message_content to send a message with the specified content instead of the animation.
* @date 01 of January of 2016
*/ */
@JsonDeserialize
public class InlineQueryResultCachedMpeg4Gif implements InlineQueryResult { public class InlineQueryResultCachedMpeg4Gif implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -14,6 +15,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* be sent by the user with an optional caption. Alternatively, you can use input_message_content to * 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. * send a message with the specified content instead of the photo.
*/ */
@JsonDeserialize
public class InlineQueryResultCachedPhoto implements InlineQueryResult { public class InlineQueryResultCachedPhoto implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";
private static final String ID_FIELD = "id"; private static final String ID_FIELD = "id";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -10,13 +11,13 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
/** /**
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 1.0 * @version 1.0
* @brief Represents a link to a sticker stored on the Telegram servers. By default, this sticker * 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 * 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. * the specified content instead of the sticker.
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
* @date 10 of April of 2016
*/ */
@JsonDeserialize
public class InlineQueryResultCachedSticker implements InlineQueryResult { public class InlineQueryResultCachedSticker implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -14,6 +15,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* file will be sent by the user with an optional caption. Alternatively, you can use * 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. * input_message_content to send a message with the specified content instead of the video.
*/ */
@JsonDeserialize
public class InlineQueryResultCachedVideo implements InlineQueryResult { public class InlineQueryResultCachedVideo implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";
private static final String ID_FIELD = "id"; private static final String ID_FIELD = "id";

View File

@ -2,6 +2,7 @@ package org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent; import org.telegram.telegrambots.meta.api.objects.inlinequery.inputmessagecontent.InputMessageContent;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult; import org.telegram.telegrambots.meta.api.objects.inlinequery.result.InlineQueryResult;
import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup; import org.telegram.telegrambots.meta.api.objects.replykeyboard.InlineKeyboardMarkup;
@ -16,6 +17,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* @note This will only work in Telegram versions released after 9 April, 2016. Older clients will * @note This will only work in Telegram versions released after 9 April, 2016. Older clients will
* ignore them. * ignore them.
*/ */
@JsonDeserialize
public class InlineQueryResultCachedVoice implements InlineQueryResult { public class InlineQueryResultCachedVoice implements InlineQueryResult {
private static final String TYPE_FIELD = "type"; private static final String TYPE_FIELD = "type";
private static final String ID_FIELD = "id"; private static final String ID_FIELD = "id";

View File

@ -0,0 +1,113 @@
package org.telegram.telegrambots.meta.api.objects.inlinequery.result.serialization;
import com.fasterxml.jackson.core.JsonParser;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.*;
import org.telegram.telegrambots.meta.api.objects.inlinequery.result.cached.*;
import java.io.IOException;
/**
* @author Ruben Bermudez
* @version 1.0
*/
public class InlineQueryResultDeserializer extends StdDeserializer<InlineQueryResult> {
private final ObjectMapper objectMapper;
public InlineQueryResultDeserializer() {
this(null);
}
private InlineQueryResultDeserializer(Class<?> vc) {
super(vc);
this.objectMapper = new ObjectMapper();
}
@Override
public InlineQueryResult deserialize(JsonParser jsonParser, DeserializationContext deserializationContext)
throws IOException {
JsonNode node = jsonParser.getCodec().readTree(jsonParser);
switch (node.get("type").asText()) {
case "article":
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultArticle>(){});
case "audio":
if (node.has("audio_url")) {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultAudio>(){});
} else {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultCachedAudio>(){});
}
case "contact":
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultContact>(){});
case "document":
if (node.has("document_url")) {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultDocument>(){});
} else {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultCachedDocument>(){});
}
case "game":
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultGame>(){});
case "gif":
if (node.has("gif_url")) {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultGif>(){});
} else {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultCachedGif>(){});
}
case "location":
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultLocation>(){});
case "mpeg4_gif":
if (node.has("mpeg4_url")) {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultMpeg4Gif>(){});
} else {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultCachedMpeg4Gif>(){});
}
case "photo":
if (node.has("photo_url")) {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultPhoto>(){});
} else {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultCachedPhoto>(){});
}
case "venue":
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultVenue>(){});
case "video":
if (node.has("video_url")) {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultVideo>(){});
} else {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultCachedVideo>(){});
}
case "voice":
if (node.has("voice_url")) {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultVoice>(){});
} else {
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultCachedVoice>(){});
}
case "sticker":
return objectMapper.readValue(node.toString(),
new com.fasterxml.jackson.core.type.TypeReference<InlineQueryResultCachedSticker>(){});
}
return null;
}
}

View File

@ -2,9 +2,12 @@ package org.telegram.telegrambots.meta.api.objects.media;
import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject; import org.telegram.telegrambots.meta.api.interfaces.InputBotApiObject;
import org.telegram.telegrambots.meta.api.interfaces.Validable; 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;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
import java.io.File; import java.io.File;
@ -14,8 +17,9 @@ import java.io.InputStream;
* @author Ruben Bermudez * @author Ruben Bermudez
* @version 3.5 * @version 3.5
*/ */
@SuppressWarnings({"WeakerAccess", "unchecked"}) @SuppressWarnings({"unchecked"})
@JsonSerialize(using = InputMediaSerializer.class) @JsonSerialize(using = InputMediaSerializer.class)
@JsonDeserialize(using = InputMediaDeserializer.class)
public abstract class InputMedia<T> implements InputBotApiObject, Validable { public abstract class InputMedia<T> implements InputBotApiObject, Validable {
public static final String TYPE_FIELD = "type"; public static final String TYPE_FIELD = "type";
public static final String MEDIA_FIELD = "media"; public static final String MEDIA_FIELD = "media";

View File

@ -1,6 +1,7 @@
package org.telegram.telegrambots.meta.api.objects.media; package org.telegram.telegrambots.meta.api.objects.media;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -11,6 +12,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent. * Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
@JsonDeserialize
public class InputMediaAnimation extends InputMedia<InputMediaAnimation> { public class InputMediaAnimation extends InputMedia<InputMediaAnimation> {
private static final String TYPE = "animation"; private static final String TYPE = "animation";

View File

@ -1,6 +1,7 @@
package org.telegram.telegrambots.meta.api.objects.media; package org.telegram.telegrambots.meta.api.objects.media;
import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -10,7 +11,8 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* *
* Represents an audio file to be treated as music to be sent. * Represents an audio file to be treated as music to be sent.
*/ */
@SuppressWarnings({"unused", "WeakerAccess"}) @SuppressWarnings({"unused"})
@JsonDeserialize
public class InputMediaAudio extends InputMedia<InputMediaAudio> { public class InputMediaAudio extends InputMedia<InputMediaAudio> {
private static final String TYPE = "audio"; private static final String TYPE = "audio";

View File

@ -1,5 +1,6 @@
package org.telegram.telegrambots.meta.api.objects.media; package org.telegram.telegrambots.meta.api.objects.media;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import org.telegram.telegrambots.meta.api.objects.InputFile; import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException; import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
@ -10,6 +11,7 @@ import org.telegram.telegrambots.meta.exceptions.TelegramApiValidationException;
* Represents a general file to be sent. * Represents a general file to be sent.
*/ */
@SuppressWarnings("unused") @SuppressWarnings("unused")
@JsonDeserialize
public class InputMediaDocument extends InputMedia<InputMediaDocument> { public class InputMediaDocument extends InputMedia<InputMediaDocument> {
private static final String TYPE = "document"; private static final String TYPE = "document";
public static final String THUMB_FIELD = "thumb"; public static final String THUMB_FIELD = "thumb";

Some files were not shown because too many files have changed in this diff Show More