1. Add docs
This commit is contained in:
parent
b8c36ec4fb
commit
732eb2850b
@ -22,12 +22,12 @@ import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
|||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @brief TODO
|
* @brief Interface that can be implemented by objects that knows how to validate their fields
|
||||||
* @date 16 of September of 2016
|
* @date 16 of September of 2016
|
||||||
*/
|
*/
|
||||||
public interface IValidable {
|
public interface Validable {
|
||||||
/**
|
/**
|
||||||
* Validates that mandatory fields are filled
|
* Validates that mandatory fields are filled and optional objects
|
||||||
* @throws TelegramApiValidationException If any mandatory field is empty
|
* @throws TelegramApiValidationException If any mandatory field is empty
|
||||||
*/
|
*/
|
||||||
void validate() throws TelegramApiValidationException;
|
void validate() throws TelegramApiValidationException;
|
@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.JsonSerializable;
|
|||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.telegram.telegrambots.api.interfaces.IToJson;
|
import org.telegram.telegrambots.api.interfaces.IToJson;
|
||||||
import org.telegram.telegrambots.api.interfaces.IValidable;
|
import org.telegram.telegrambots.api.interfaces.Validable;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ import java.io.Serializable;
|
|||||||
* @brief A method of Telegram Bots Api that is fully supported in json format
|
* @brief A method of Telegram Bots Api that is fully supported in json format
|
||||||
* @date 07 of September of 2015
|
* @date 07 of September of 2015
|
||||||
*/
|
*/
|
||||||
public abstract class BotApiMethod<T extends Serializable> implements JsonSerializable, IToJson, IValidable {
|
public abstract class BotApiMethod<T extends Serializable> implements JsonSerializable, IToJson, Validable {
|
||||||
protected static final String METHOD_FIELD = "method";
|
protected static final String METHOD_FIELD = "method";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +24,7 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
|||||||
|
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
||||||
import org.telegram.telegrambots.api.interfaces.IValidable;
|
import org.telegram.telegrambots.api.interfaces.Validable;
|
||||||
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -35,7 +35,7 @@ import java.io.IOException;
|
|||||||
* @brief This object contains information about a game that will be returned as a response to a callback query.
|
* @brief This object contains information about a game that will be returned as a response to a callback query.
|
||||||
* @date 16 of September of 2016
|
* @date 16 of September of 2016
|
||||||
*/
|
*/
|
||||||
public class CallbackGame implements IBotApiObject, IValidable {
|
public class CallbackGame implements IBotApiObject, Validable {
|
||||||
private static final String TITLE_FIELD = "title";
|
private static final String TITLE_FIELD = "title";
|
||||||
private static final String ID_FIELD = "game_id";
|
private static final String ID_FIELD = "game_id";
|
||||||
private static final String START_PARAMETER_FIELD = "start_parameter";
|
private static final String START_PARAMETER_FIELD = "start_parameter";
|
||||||
|
@ -2,7 +2,7 @@ package org.telegram.telegrambots.api.objects.inlinequery.inputmessagecontent;
|
|||||||
|
|
||||||
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
||||||
import org.telegram.telegrambots.api.interfaces.IToJson;
|
import org.telegram.telegrambots.api.interfaces.IToJson;
|
||||||
import org.telegram.telegrambots.api.interfaces.IValidable;
|
import org.telegram.telegrambots.api.interfaces.Validable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
@ -11,5 +11,5 @@ import org.telegram.telegrambots.api.interfaces.IValidable;
|
|||||||
* query.
|
* query.
|
||||||
* @date 10 of April of 2016
|
* @date 10 of April of 2016
|
||||||
*/
|
*/
|
||||||
public interface InputMessageContent extends IBotApiObject, IToJson, IValidable {
|
public interface InputMessageContent extends IBotApiObject, IToJson, Validable {
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package org.telegram.telegrambots.api.objects.inlinequery.result;
|
|||||||
|
|
||||||
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
||||||
import org.telegram.telegrambots.api.interfaces.IToJson;
|
import org.telegram.telegrambots.api.interfaces.IToJson;
|
||||||
import org.telegram.telegrambots.api.interfaces.IValidable;
|
import org.telegram.telegrambots.api.interfaces.Validable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
@ -10,5 +10,5 @@ import org.telegram.telegrambots.api.interfaces.IValidable;
|
|||||||
* @brief This object represents one result of an inline query.
|
* @brief This object represents one result of an inline query.
|
||||||
* @date 01 of January of 2016
|
* @date 01 of January of 2016
|
||||||
*/
|
*/
|
||||||
public interface InlineQueryResult extends IBotApiObject, IToJson, IValidable {
|
public interface InlineQueryResult extends IBotApiObject, IToJson, Validable {
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ package org.telegram.telegrambots.api.objects.replykeyboard;
|
|||||||
|
|
||||||
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
||||||
import org.telegram.telegrambots.api.interfaces.IToJson;
|
import org.telegram.telegrambots.api.interfaces.IToJson;
|
||||||
import org.telegram.telegrambots.api.interfaces.IValidable;
|
import org.telegram.telegrambots.api.interfaces.Validable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
@ -10,5 +10,5 @@ import org.telegram.telegrambots.api.interfaces.IValidable;
|
|||||||
* @brief Reply keyboard abstract type
|
* @brief Reply keyboard abstract type
|
||||||
* @date 20 of June of 2015
|
* @date 20 of June of 2015
|
||||||
*/
|
*/
|
||||||
public interface ReplyKeyboard extends IBotApiObject, IToJson, IValidable {
|
public interface ReplyKeyboard extends IBotApiObject, IToJson, Validable {
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,7 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
||||||
import org.telegram.telegrambots.api.interfaces.IToJson;
|
import org.telegram.telegrambots.api.interfaces.IToJson;
|
||||||
import org.telegram.telegrambots.api.interfaces.IValidable;
|
import org.telegram.telegrambots.api.interfaces.Validable;
|
||||||
import org.telegram.telegrambots.api.objects.games.CallbackGame;
|
import org.telegram.telegrambots.api.objects.games.CallbackGame;
|
||||||
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ import java.io.IOException;
|
|||||||
* display unsupported message.
|
* display unsupported message.
|
||||||
* @date 10 of April of 2016
|
* @date 10 of April of 2016
|
||||||
*/
|
*/
|
||||||
public class InlineKeyboardButton implements IBotApiObject, IToJson, IValidable {
|
public class InlineKeyboardButton implements IBotApiObject, IToJson, Validable {
|
||||||
|
|
||||||
private static final String TEXT_FIELD = "text";
|
private static final String TEXT_FIELD = "text";
|
||||||
private static final String URL_FIELD = "url";
|
private static final String URL_FIELD = "url";
|
||||||
|
@ -8,7 +8,7 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
|
|||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
|
||||||
import org.telegram.telegrambots.api.interfaces.IToJson;
|
import org.telegram.telegrambots.api.interfaces.IToJson;
|
||||||
import org.telegram.telegrambots.api.interfaces.IValidable;
|
import org.telegram.telegrambots.api.interfaces.Validable;
|
||||||
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -23,7 +23,7 @@ import java.io.IOException;
|
|||||||
* after 9 April, 2016. Older clients will ignore them.
|
* after 9 April, 2016. Older clients will ignore them.
|
||||||
* @date 10 of April of 2016
|
* @date 10 of April of 2016
|
||||||
*/
|
*/
|
||||||
public class KeyboardButton implements IBotApiObject, IToJson, IValidable {
|
public class KeyboardButton implements IBotApiObject, IToJson, Validable {
|
||||||
|
|
||||||
private static final String TEXT_FIELD = "text";
|
private static final String TEXT_FIELD = "text";
|
||||||
private static final String REQUEST_CONTACT_FIELD = "request_contact";
|
private static final String REQUEST_CONTACT_FIELD = "request_contact";
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package org.telegram.telegrambots.api.objects.replykeyboard.buttons;
|
package org.telegram.telegrambots.api.objects.replykeyboard.buttons;
|
||||||
|
|
||||||
import org.telegram.telegrambots.api.interfaces.IValidable;
|
import org.telegram.telegrambots.api.interfaces.Validable;
|
||||||
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -11,7 +11,7 @@ import java.util.ArrayList;
|
|||||||
* @brief Row for ReplyKeyBoardMarkup
|
* @brief Row for ReplyKeyBoardMarkup
|
||||||
* @date 10 of April of 2016
|
* @date 10 of April of 2016
|
||||||
*/
|
*/
|
||||||
public class KeyboardRow extends ArrayList<KeyboardButton> implements IValidable {
|
public class KeyboardRow extends ArrayList<KeyboardButton> implements Validable {
|
||||||
public boolean add(String text) {
|
public boolean add(String text) {
|
||||||
return super.add(new KeyboardButton(text));
|
return super.add(new KeyboardButton(text));
|
||||||
}
|
}
|
||||||
|
@ -17,18 +17,20 @@ public interface ITelegramWebhookBot {
|
|||||||
BotApiMethod onWebhookUpdateReceived(Update update);
|
BotApiMethod onWebhookUpdateReceived(Update update);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return bot username of this bot
|
* Gets bot username of this bot
|
||||||
|
* @return Bot username
|
||||||
*/
|
*/
|
||||||
String getBotUsername();
|
String getBotUsername();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return bot token to access Telegram API
|
* Gets bot token to access Telegram API
|
||||||
|
* @return Bot token
|
||||||
*/
|
*/
|
||||||
String getBotToken();
|
String getBotToken();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO
|
* Gets in the url for the webhook
|
||||||
* @return
|
* @return path in the url
|
||||||
*/
|
*/
|
||||||
String getBotPath();
|
String getBotPath();
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,8 @@ package org.telegram.telegrambots.bots;
|
|||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @brief TODO
|
* @brief Base abstract class for a bot that will get updates using
|
||||||
|
* <a href="https://core.telegram.org/bots/api#getupdates">long-polling</a> method
|
||||||
* @date 14 of January of 2016
|
* @date 14 of January of 2016
|
||||||
*/
|
*/
|
||||||
public abstract class TelegramLongPollingBot extends AbsSender implements ITelegramLongPollingBot {
|
public abstract class TelegramLongPollingBot extends AbsSender implements ITelegramLongPollingBot {
|
||||||
|
@ -3,7 +3,8 @@ package org.telegram.telegrambots.bots;
|
|||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @brief TODO
|
* @brief Base abstract class for a bot that will receive updates using a
|
||||||
|
* <a href="https://core.telegram.org/bots/api#setwebhook">webhook</a>
|
||||||
* @date 14 of January of 2016
|
* @date 14 of January of 2016
|
||||||
*/
|
*/
|
||||||
public abstract class TelegramWebhookBot extends AbsSender implements ITelegramWebhookBot {
|
public abstract class TelegramWebhookBot extends AbsSender implements ITelegramWebhookBot {
|
||||||
|
@ -20,7 +20,7 @@ package org.telegram.telegrambots.exceptions;
|
|||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @brief TODO
|
* @brief Base class for any exception from TelegramBots api
|
||||||
* @date 16 of September of 2016
|
* @date 16 of September of 2016
|
||||||
*/
|
*/
|
||||||
public class TelegramApiException extends Exception {
|
public class TelegramApiException extends Exception {
|
||||||
|
@ -6,7 +6,7 @@ import java.util.logging.FileHandler;
|
|||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @brief TODO
|
* @brief Handler to use a file as logs destination with {@link BotLogger}
|
||||||
* @date 19 of May of 2016
|
* @date 19 of May of 2016
|
||||||
*/
|
*/
|
||||||
public class BotsFileHandler extends FileHandler {
|
public class BotsFileHandler extends FileHandler {
|
||||||
|
@ -8,7 +8,7 @@ import java.util.logging.LogRecord;
|
|||||||
/**
|
/**
|
||||||
* @author Ruben Bermudez
|
* @author Ruben Bermudez
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @brief TODO
|
* @brief Formatter for {@link BotsFileHandler}
|
||||||
* @date 19 of May of 2016
|
* @date 19 of May of 2016
|
||||||
*/
|
*/
|
||||||
class FileFormatter extends Formatter {
|
class FileFormatter extends Formatter {
|
||||||
|
Loading…
Reference in New Issue
Block a user