mirror of
https://github.com/openhab/openhab-addons.git
synced 2025-02-04 19:34:05 +01:00
[mail] Add action input labels and descriptions (#18209)
Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
This commit is contained in:
parent
b80efccf92
commit
90da7b9d83
@ -53,17 +53,18 @@ public class SendMailActions implements ThingActions {
|
|||||||
|
|
||||||
@RuleAction(label = "@text/sendMessageActionLabel", description = "@text/sendMessageActionDescription")
|
@RuleAction(label = "@text/sendMessageActionLabel", description = "@text/sendMessageActionDescription")
|
||||||
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendMail(
|
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendMail(
|
||||||
@ActionInput(name = "recipient") @Nullable String recipient,
|
@ActionInput(name = "recipient", label = "@text/actionInputRecipientLabel", description = "@text/actionInputRecipientDescription") @Nullable String recipient,
|
||||||
@ActionInput(name = "subject") @Nullable String subject,
|
@ActionInput(name = "subject", label = "@text/actionInputSubjectLabel", description = "@text/actionInputSubjectDescription") @Nullable String subject,
|
||||||
@ActionInput(name = "text") @Nullable String text) {
|
@ActionInput(name = "text", label = "@text/actionInputTextLabel", description = "@text/actionInputTextDescription") @Nullable String text) {
|
||||||
return sendMailWithAttachments(recipient, subject, text, List.of());
|
return sendMailWithAttachments(recipient, subject, text, List.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RuleAction(label = "@text/sendAttachmentMessageActionLabel", description = "@text/sendAttachmentMessageActionDescription")
|
@RuleAction(label = "@text/sendAttachmentMessageActionLabel", description = "@text/sendAttachmentMessageActionDescription")
|
||||||
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendMailWithAttachment(
|
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendMailWithAttachment(
|
||||||
@ActionInput(name = "recipient") @Nullable String recipient,
|
@ActionInput(name = "recipient", label = "@text/actionInputRecipientLabel", description = "@text/actionInputRecipientDescription") @Nullable String recipient,
|
||||||
@ActionInput(name = "subject") @Nullable String subject, @ActionInput(name = "text") @Nullable String text,
|
@ActionInput(name = "subject", label = "@text/actionInputSubjectLabel", description = "@text/actionInputSubjectDescription") @Nullable String subject,
|
||||||
@ActionInput(name = "url") @Nullable String url) {
|
@ActionInput(name = "text", label = "@text/actionInputTextLabel", description = "@text/actionInputTextDescription") @Nullable String text,
|
||||||
|
@ActionInput(name = "url", label = "@text/actionInputUrlLabel", description = "@text/actionInputUrlDescription") @Nullable String url) {
|
||||||
List<String> urlList = new ArrayList<>();
|
List<String> urlList = new ArrayList<>();
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
urlList.add(url);
|
urlList.add(url);
|
||||||
@ -73,9 +74,10 @@ public class SendMailActions implements ThingActions {
|
|||||||
|
|
||||||
@RuleAction(label = "@text/sendAttachmentsMessageActionLabel", description = "@text/sendAttachmentsMessageActionDescription")
|
@RuleAction(label = "@text/sendAttachmentsMessageActionLabel", description = "@text/sendAttachmentsMessageActionDescription")
|
||||||
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendMailWithAttachments(
|
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendMailWithAttachments(
|
||||||
@ActionInput(name = "recipient") @Nullable String recipient,
|
@ActionInput(name = "recipient", label = "@text/actionInputRecipientLabel", description = "@text/actionInputRecipientDescription") @Nullable String recipient,
|
||||||
@ActionInput(name = "subject") @Nullable String subject, @ActionInput(name = "text") @Nullable String text,
|
@ActionInput(name = "subject", label = "@text/actionInputSubjectLabel", description = "@text/actionInputSubjectDescription") @Nullable String subject,
|
||||||
@ActionInput(name = "urlList", type = "List<String>") @Nullable List<String> urlList) {
|
@ActionInput(name = "text", label = "@text/actionInputTextLabel", description = "@text/actionInputTextDescription") @Nullable String text,
|
||||||
|
@ActionInput(name = "urlList", type = "List<String>", label = "@text/actionInputUrlListLabel", description = "@text/actionInputUrlListDescription") @Nullable List<String> urlList) {
|
||||||
if (recipient == null) {
|
if (recipient == null) {
|
||||||
logger.warn("Cannot send mail as recipient is missing.");
|
logger.warn("Cannot send mail as recipient is missing.");
|
||||||
return false;
|
return false;
|
||||||
@ -142,18 +144,18 @@ public class SendMailActions implements ThingActions {
|
|||||||
|
|
||||||
@RuleAction(label = "@text/sendHTMLMessageActionLabel", description = "@text/sendHTMLMessageActionDescription")
|
@RuleAction(label = "@text/sendHTMLMessageActionLabel", description = "@text/sendHTMLMessageActionDescription")
|
||||||
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendHtmlMail(
|
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendHtmlMail(
|
||||||
@ActionInput(name = "recipient") @Nullable String recipient,
|
@ActionInput(name = "recipient", label = "@text/actionInputRecipientLabel", description = "@text/actionInputRecipientDescription") @Nullable String recipient,
|
||||||
@ActionInput(name = "subject") @Nullable String subject,
|
@ActionInput(name = "subject", label = "@text/actionInputSubjectLabel", description = "@text/actionInputSubjectDescription") @Nullable String subject,
|
||||||
@ActionInput(name = "htmlContent") @Nullable String htmlContent) {
|
@ActionInput(name = "htmlContent", label = "@text/actionInputHtmlContentLabel", description = "@text/actionInputHtmlContentDescription") @Nullable String htmlContent) {
|
||||||
return sendHtmlMailWithAttachments(recipient, subject, htmlContent, List.of());
|
return sendHtmlMailWithAttachments(recipient, subject, htmlContent, List.of());
|
||||||
}
|
}
|
||||||
|
|
||||||
@RuleAction(label = "@text/sendHTMLAttachmentMessageActionLabel", description = "@text/sendHTMLAttachmentMessageActionDescription")
|
@RuleAction(label = "@text/sendHTMLAttachmentMessageActionLabel", description = "@text/sendHTMLAttachmentMessageActionDescription")
|
||||||
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendHtmlMailWithAttachment(
|
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendHtmlMailWithAttachment(
|
||||||
@ActionInput(name = "recipient") @Nullable String recipient,
|
@ActionInput(name = "recipient", label = "@text/actionInputRecipientLabel", description = "@text/actionInputRecipientDescription") @Nullable String recipient,
|
||||||
@ActionInput(name = "subject") @Nullable String subject,
|
@ActionInput(name = "subject", label = "@text/actionInputSubjectLabel", description = "@text/actionInputSubjectDescription") @Nullable String subject,
|
||||||
@ActionInput(name = "htmlContent") @Nullable String htmlContent,
|
@ActionInput(name = "htmlContent", label = "@text/actionInputHtmlContentLabel", description = "@text/actionInputHtmlContentDescription") @Nullable String htmlContent,
|
||||||
@ActionInput(name = "url") @Nullable String url) {
|
@ActionInput(name = "url", label = "@text/actionInputUrlLabel", description = "@text/actionInputUrlDescription") @Nullable String url) {
|
||||||
List<String> urlList = new ArrayList<>();
|
List<String> urlList = new ArrayList<>();
|
||||||
if (url != null) {
|
if (url != null) {
|
||||||
urlList.add(url);
|
urlList.add(url);
|
||||||
@ -163,10 +165,10 @@ public class SendMailActions implements ThingActions {
|
|||||||
|
|
||||||
@RuleAction(label = "@text/sendHTMLAttachmentsMessageActionLabel", description = "@text/sendHTMLAttachmentsMessageActionDescription")
|
@RuleAction(label = "@text/sendHTMLAttachmentsMessageActionLabel", description = "@text/sendHTMLAttachmentsMessageActionDescription")
|
||||||
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendHtmlMailWithAttachments(
|
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean sendHtmlMailWithAttachments(
|
||||||
@ActionInput(name = "recipient") @Nullable String recipient,
|
@ActionInput(name = "recipient", label = "@text/actionInputRecipientLabel", description = "@text/actionInputRecipientDescription") @Nullable String recipient,
|
||||||
@ActionInput(name = "subject") @Nullable String subject,
|
@ActionInput(name = "subject", label = "@text/actionInputSubjectLabel", description = "@text/actionInputSubjectDescription") @Nullable String subject,
|
||||||
@ActionInput(name = "htmlContent") @Nullable String htmlContent,
|
@ActionInput(name = "htmlContent", label = "@text/actionInputHtmlContentLabel", description = "@text/actionInputHtmlContentDescription") @Nullable String htmlContent,
|
||||||
@ActionInput(name = "urlList", type = "List<String>") @Nullable List<String> urlList) {
|
@ActionInput(name = "urlList", type = "List<String>", label = "@text/actionInputUrlListLabel", description = "@text/actionInputUrlListDescription") @Nullable List<String> urlList) {
|
||||||
if (recipient == null) {
|
if (recipient == null) {
|
||||||
logger.warn("Cannot send mail as recipient is missing.");
|
logger.warn("Cannot send mail as recipient is missing.");
|
||||||
return false;
|
return false;
|
||||||
@ -245,7 +247,8 @@ public class SendMailActions implements ThingActions {
|
|||||||
|
|
||||||
@RuleAction(label = "@text/addHeaderActionLabel", description = "@text/addHeaderActionDescription")
|
@RuleAction(label = "@text/addHeaderActionLabel", description = "@text/addHeaderActionDescription")
|
||||||
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean addHeader(
|
public @ActionOutput(label = "Success", type = "java.lang.Boolean") Boolean addHeader(
|
||||||
@ActionInput(name = "name") @Nullable String name, @ActionInput(name = "value") @Nullable String value) {
|
@ActionInput(name = "name", label = "@text/actionInputHeaderNameLabel") @Nullable String name,
|
||||||
|
@ActionInput(name = "value", label = "@text/actionInputHeaderValueLabel") @Nullable String value) {
|
||||||
if (name != null && !name.isEmpty()) {
|
if (name != null && !name.isEmpty()) {
|
||||||
if (value != null && !value.isEmpty()) {
|
if (value != null && !value.isEmpty()) {
|
||||||
headers.put(name, value);
|
headers.put(name, value);
|
||||||
|
@ -72,3 +72,17 @@ sendHTMLMessageActionLabel = send a HTML mail
|
|||||||
sendHTMLMessageActionDescription = Sends a HTML mail.
|
sendHTMLMessageActionDescription = Sends a HTML mail.
|
||||||
sendMessageActionLabel = send a text mail
|
sendMessageActionLabel = send a text mail
|
||||||
sendMessageActionDescription = Sends a text mail.
|
sendMessageActionDescription = Sends a text mail.
|
||||||
|
actionInputRecipientLabel = Recipient
|
||||||
|
actionInputRecipientDescription = Recipient email address.
|
||||||
|
actionInputSubjectLabel = Subject
|
||||||
|
actionInputSubjectDescription = Subject of the mail.
|
||||||
|
actionInputTextLabel = Message
|
||||||
|
actionInputTextDescription = Content of the mail in text format.
|
||||||
|
actionInputUrlLabel = URL
|
||||||
|
actionInputUrlDescription = URL of the attachment.
|
||||||
|
actionInputUrlListLabel = URL List
|
||||||
|
actionInputUrlListDescription = List of URLs of the attachments.
|
||||||
|
actionInputHtmlContentLabel = HTML Message
|
||||||
|
actionInputHtmlContentDescription = Content of the mail in HTML format.
|
||||||
|
actionInputHeaderNameLabel = Header Name
|
||||||
|
actionInputHeaderValueLabel = Header Value
|
||||||
|
Loading…
Reference in New Issue
Block a user