1. Add docs

This commit is contained in:
Rubenlagus 2016-09-28 00:41:06 +02:00
parent b8c36ec4fb
commit 732eb2850b
15 changed files with 32 additions and 28 deletions

View File

@ -22,12 +22,12 @@ import org.telegram.telegrambots.exceptions.TelegramApiValidationException;
/**
* @author Ruben Bermudez
* @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
*/
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
*/
void validate() throws TelegramApiValidationException;

View File

@ -4,7 +4,7 @@ import com.fasterxml.jackson.databind.JsonSerializable;
import org.json.JSONObject;
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;
@ -14,7 +14,7 @@ import java.io.Serializable;
* @brief A method of Telegram Bots Api that is fully supported in json format
* @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";
/**

View File

@ -24,7 +24,7 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
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 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.
* @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 ID_FIELD = "game_id";
private static final String START_PARAMETER_FIELD = "start_parameter";

View File

@ -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.IToJson;
import org.telegram.telegrambots.api.interfaces.IValidable;
import org.telegram.telegrambots.api.interfaces.Validable;
/**
* @author Ruben Bermudez
@ -11,5 +11,5 @@ import org.telegram.telegrambots.api.interfaces.IValidable;
* query.
* @date 10 of April of 2016
*/
public interface InputMessageContent extends IBotApiObject, IToJson, IValidable {
public interface InputMessageContent extends IBotApiObject, IToJson, Validable {
}

View File

@ -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.IToJson;
import org.telegram.telegrambots.api.interfaces.IValidable;
import org.telegram.telegrambots.api.interfaces.Validable;
/**
* @author Ruben Bermudez
@ -10,5 +10,5 @@ import org.telegram.telegrambots.api.interfaces.IValidable;
* @brief This object represents one result of an inline query.
* @date 01 of January of 2016
*/
public interface InlineQueryResult extends IBotApiObject, IToJson, IValidable {
public interface InlineQueryResult extends IBotApiObject, IToJson, Validable {
}

View File

@ -2,7 +2,7 @@ package org.telegram.telegrambots.api.objects.replykeyboard;
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
import org.telegram.telegrambots.api.interfaces.IToJson;
import org.telegram.telegrambots.api.interfaces.IValidable;
import org.telegram.telegrambots.api.interfaces.Validable;
/**
* @author Ruben Bermudez
@ -10,5 +10,5 @@ import org.telegram.telegrambots.api.interfaces.IValidable;
* @brief Reply keyboard abstract type
* @date 20 of June of 2015
*/
public interface ReplyKeyboard extends IBotApiObject, IToJson, IValidable {
public interface ReplyKeyboard extends IBotApiObject, IToJson, Validable {
}

View File

@ -8,7 +8,7 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
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.exceptions.TelegramApiValidationException;
@ -23,7 +23,7 @@ import java.io.IOException;
* display unsupported message.
* @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 URL_FIELD = "url";

View File

@ -8,7 +8,7 @@ import com.fasterxml.jackson.databind.jsontype.TypeSerializer;
import org.json.JSONObject;
import org.telegram.telegrambots.api.interfaces.IBotApiObject;
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 java.io.IOException;
@ -23,7 +23,7 @@ import java.io.IOException;
* after 9 April, 2016. Older clients will ignore them.
* @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 REQUEST_CONTACT_FIELD = "request_contact";

View File

@ -1,6 +1,6 @@
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 java.util.ArrayList;
@ -11,7 +11,7 @@ import java.util.ArrayList;
* @brief Row for ReplyKeyBoardMarkup
* @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) {
return super.add(new KeyboardButton(text));
}

View File

@ -17,18 +17,20 @@ public interface ITelegramWebhookBot {
BotApiMethod onWebhookUpdateReceived(Update update);
/**
* Return bot username of this bot
* Gets bot username of this bot
* @return Bot username
*/
String getBotUsername();
/**
* Return bot token to access Telegram API
* Gets bot token to access Telegram API
* @return Bot token
*/
String getBotToken();
/**
* TODO
* @return
* Gets in the url for the webhook
* @return path in the url
*/
String getBotPath();
}

View File

@ -3,7 +3,8 @@ package org.telegram.telegrambots.bots;
/**
* @author Ruben Bermudez
* @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
*/
public abstract class TelegramLongPollingBot extends AbsSender implements ITelegramLongPollingBot {

View File

@ -3,7 +3,8 @@ package org.telegram.telegrambots.bots;
/**
* @author Ruben Bermudez
* @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
*/
public abstract class TelegramWebhookBot extends AbsSender implements ITelegramWebhookBot {

View File

@ -20,7 +20,7 @@ package org.telegram.telegrambots.exceptions;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief TODO
* @brief Base class for any exception from TelegramBots api
* @date 16 of September of 2016
*/
public class TelegramApiException extends Exception {

View File

@ -6,7 +6,7 @@ import java.util.logging.FileHandler;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief TODO
* @brief Handler to use a file as logs destination with {@link BotLogger}
* @date 19 of May of 2016
*/
public class BotsFileHandler extends FileHandler {

View File

@ -8,7 +8,7 @@ import java.util.logging.LogRecord;
/**
* @author Ruben Bermudez
* @version 1.0
* @brief TODO
* @brief Formatter for {@link BotsFileHandler}
* @date 19 of May of 2016
*/
class FileFormatter extends Formatter {