import org.eclipse.jetty.http.HttpMethod;
import org.openhab.binding.telegram.internal.TelegramHandler;
import org.openhab.core.automation.annotation.ActionInput;
+import org.openhab.core.automation.annotation.ActionOutput;
import org.openhab.core.automation.annotation.RuleAction;
import org.openhab.core.thing.binding.ThingActions;
import org.openhab.core.thing.binding.ThingActionsScope;
}
@RuleAction(label = "send an answer", description = "Send a Telegram answer using the Telegram API.")
- public boolean sendTelegramAnswer(@ActionInput(name = "chatId") @Nullable Long chatId,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramAnswer(
+ @ActionInput(name = "chatId") @Nullable Long chatId,
@ActionInput(name = "callbackId") @Nullable String callbackId,
@ActionInput(name = "messageId") @Nullable Long messageId,
@ActionInput(name = "message") @Nullable String message) {
}
@RuleAction(label = "send an answer", description = "Send a Telegram answer using the Telegram API.")
- public boolean sendTelegramAnswer(@ActionInput(name = "chatId") @Nullable Long chatId,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramAnswer(
+ @ActionInput(name = "chatId") @Nullable Long chatId,
@ActionInput(name = "replyId") @Nullable String replyId,
@ActionInput(name = "message") @Nullable String message) {
if (replyId == null) {
}
@RuleAction(label = "send an answer", description = "Send a Telegram answer using the Telegram API.")
- public boolean sendTelegramAnswer(@ActionInput(name = "replyId") @Nullable String replyId,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramAnswer(
+ @ActionInput(name = "replyId") @Nullable String replyId,
@ActionInput(name = "message") @Nullable String message) {
TelegramHandler localHandler = handler;
if (localHandler != null) {
}
@RuleAction(label = "send a message", description = "Send a Telegram message using the Telegram API.")
- public boolean sendTelegram(@ActionInput(name = "chatId") @Nullable Long chatId,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegram(
+ @ActionInput(name = "chatId") @Nullable Long chatId,
@ActionInput(name = "message") @Nullable String message) {
return sendTelegramGeneral(chatId, message, (String) null);
}
@RuleAction(label = "send a message", description = "Send a Telegram message using the Telegram API.")
- public boolean sendTelegram(@ActionInput(name = "message") @Nullable String message) {
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegram(
+ @ActionInput(name = "message") @Nullable String message) {
TelegramHandler localHandler = handler;
if (localHandler != null) {
for (Long chatId : localHandler.getReceiverChatIds()) {
}
@RuleAction(label = "send a query", description = "Send a Telegram Query using the Telegram API.")
- public boolean sendTelegramQuery(@ActionInput(name = "chatId") @Nullable Long chatId,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramQuery(
+ @ActionInput(name = "chatId") @Nullable Long chatId,
@ActionInput(name = "message") @Nullable String message,
@ActionInput(name = "replyId") @Nullable String replyId,
@ActionInput(name = "buttons") @Nullable String... buttons) {
}
@RuleAction(label = "send a query", description = "Send a Telegram Query using the Telegram API.")
- public boolean sendTelegramQuery(@ActionInput(name = "message") @Nullable String message,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramQuery(
+ @ActionInput(name = "message") @Nullable String message,
@ActionInput(name = "replyId") @Nullable String replyId,
@ActionInput(name = "buttons") @Nullable String... buttons) {
TelegramHandler localHandler = handler;
return true;
}
- private boolean sendTelegramGeneral(@ActionInput(name = "chatId") @Nullable Long chatId, @Nullable String message,
- @Nullable String replyId, @Nullable String... buttons) {
+ private boolean sendTelegramGeneral(@Nullable Long chatId, @Nullable String message, @Nullable String replyId,
+ @Nullable String... buttons) {
if (message == null) {
logger.warn("Message not defined; action skipped.");
return false;
}
@RuleAction(label = "delete a query", description = "Delete a Query using the Telegram API.")
- public boolean deleteTelegramQuery(@ActionInput(name = "replyId") @Nullable String replyId) {
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean deleteTelegramQuery(
+ @ActionInput(name = "replyId") @Nullable String replyId) {
if (replyId == null) {
logger.warn("deleteTelegramQuery() - replyId not passed!");
return false;
} // public boolean deleteTelegramQuery(String replyId)
@RuleAction(label = "send a message", description = "Send a Telegram using the Telegram API.")
- public boolean sendTelegram(@ActionInput(name = "chatId") @Nullable Long chatId,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegram(
+ @ActionInput(name = "chatId") @Nullable Long chatId,
@ActionInput(name = "message") @Nullable String message,
@ActionInput(name = "args") @Nullable Object... args) {
if (message == null) {
}
@RuleAction(label = "send a message", description = "Send a Telegram using the Telegram API.")
- public boolean sendTelegram(@ActionInput(name = "message") @Nullable String message,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegram(
+ @ActionInput(name = "message") @Nullable String message,
@ActionInput(name = "args") @Nullable Object... args) {
TelegramHandler localHandler = handler;
if (localHandler != null) {
}
@RuleAction(label = "send a photo", description = "Send a picture using the Telegram API.")
- public boolean sendTelegramPhoto(@ActionInput(name = "chatId") @Nullable Long chatId,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramPhoto(
+ @ActionInput(name = "chatId") @Nullable Long chatId,
@ActionInput(name = "photoURL") @Nullable String photoURL,
@ActionInput(name = "caption") @Nullable String caption) {
return sendTelegramPhoto(chatId, photoURL, caption, null, null);
}
@RuleAction(label = "send a photo", description = "Send a picture using the Telegram API.")
- public boolean sendTelegramPhoto(@ActionInput(name = "chatId") @Nullable Long chatId,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramPhoto(
+ @ActionInput(name = "chatId") @Nullable Long chatId,
@ActionInput(name = "photoURL") @Nullable String photoURL,
@ActionInput(name = "caption") @Nullable String caption,
@ActionInput(name = "username") @Nullable String username,
}
@RuleAction(label = "send a photo", description = "Send a Picture using the Telegram API.")
- public boolean sendTelegramPhoto(@ActionInput(name = "photoURL") @Nullable String photoURL,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramPhoto(
+ @ActionInput(name = "photoURL") @Nullable String photoURL,
@ActionInput(name = "caption") @Nullable String caption,
@ActionInput(name = "username") @Nullable String username,
@ActionInput(name = "password") @Nullable String password) {
}
@RuleAction(label = "send a photo", description = "Send a Picture using the Telegram API.")
- public boolean sendTelegramPhoto(@ActionInput(name = "photoURL") @Nullable String photoURL,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramPhoto(
+ @ActionInput(name = "photoURL") @Nullable String photoURL,
@ActionInput(name = "caption") @Nullable String caption) {
return sendTelegramPhoto(photoURL, caption, null, null);
}
@RuleAction(label = "send animation", description = "Send an Animation using the Telegram API.")
- public boolean sendTelegramAnimation(@ActionInput(name = "animationURL") @Nullable String animationURL,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramAnimation(
+ @ActionInput(name = "animationURL") @Nullable String animationURL,
@ActionInput(name = "caption") @Nullable String caption) {
TelegramHandler localHandler = handler;
if (localHandler != null) {
}
@RuleAction(label = "send animation", description = "Send an Animation using the Telegram API.")
- public boolean sendTelegramAnimation(@ActionInput(name = "chatId") @Nullable Long chatId,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramAnimation(
+ @ActionInput(name = "chatId") @Nullable Long chatId,
@ActionInput(name = "animationURL") @Nullable String animationURL,
@ActionInput(name = "caption") @Nullable String caption) {
if (animationURL == null) {
}
@RuleAction(label = "send video", description = "Send a Video using the Telegram API.")
- public boolean sendTelegramVideo(@ActionInput(name = "videoURL") @Nullable String videoURL,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramVideo(
+ @ActionInput(name = "videoURL") @Nullable String videoURL,
@ActionInput(name = "caption") @Nullable String caption) {
TelegramHandler localHandler = handler;
if (localHandler != null) {
}
@RuleAction(label = "send video", description = "Send a Video using the Telegram API.")
- public boolean sendTelegramVideo(@ActionInput(name = "chatId") @Nullable Long chatId,
+ public @ActionOutput(name = "success", type = "java.lang.Boolean") boolean sendTelegramVideo(
+ @ActionInput(name = "chatId") @Nullable Long chatId,
@ActionInput(name = "videoURL") @Nullable String videoURL,
@ActionInput(name = "caption") @Nullable String caption) {
final SendVideo sendVideo;
public static boolean sendTelegramAnimation(ThingActions actions, @Nullable String animationURL,
@Nullable String caption) {
- return ((TelegramActions) actions).sendTelegramVideo(animationURL, caption);
+ return ((TelegramActions) actions).sendTelegramAnimation(animationURL, caption);
}
public static boolean sendTelegramVideo(ThingActions actions, @Nullable String videoURL, @Nullable String caption) {
public static boolean sendTelegramAnimation(ThingActions actions, @Nullable Long chatId,
@Nullable String animationURL, @Nullable String caption) {
- return ((TelegramActions) actions).sendTelegramVideo(chatId, animationURL, caption);
+ return ((TelegramActions) actions).sendTelegramAnimation(chatId, animationURL, caption);
}
public static boolean sendTelegramVideo(ThingActions actions, @Nullable Long chatId, @Nullable String videoURL,