[pushover] Add support to send an Image URL directly (#11027)

* Added support to send an Image URL directly
* Add support for data URI scheme

Signed-off-by: Christoph Weitkamp <github@christophweitkamp.de>
This commit is contained in:
Christoph Weitkamp
2021-07-25 09:34:04 +02:00
committed by GitHub
parent cf6729adef
commit 65b4db7526
5 changed files with 69 additions and 19 deletions

View File

@@ -46,7 +46,7 @@ One has to pass a `null` value if it should be skipped or the default value for
- `sendMonospaceMessage(String message, @Nullable String title)` - This method is used to send a monospace message.
- `sendAttachmentMessage(String message, @Nullable String title, String attachment, @Nullable String contentType)` - This method is used to send a message with an attachment. It takes a (local) path to the attachment (parameter `attachment` **mandatory**) and an optional `contentType` to define the content-type of the attachment (default: `image/jpeg`).
- `sendAttachmentMessage(String message, @Nullable String title, String attachment, @Nullable String contentType)` - This method is used to send a message with an attachment. It takes a local path or URL to the attachment (parameter `attachment` **mandatory**). Additionally you can pass a data URI scheme to this parameter. Optionally pass a `contentType` to define the content-type of the attachment (default: `image/jpeg` or guessed from image data).
- `sendURLMessage(String message, @Nullable String title, String url, @Nullable String urlTitle)` - This method is used to send a message with an URL. A supplementary `url` to show with the message and a `urlTitle` for the URL, otherwise just the URL is shown.
@@ -76,6 +76,16 @@ val actions = getActions("pushover", "pushover:pushover-account:account")
actions.sendHtmlMessage("Hello <font color='green'>World</font>!", "openHAB")
```
```java
val actions = getActions("pushover", "pushover:pushover-account:account")
// send message with attachment
actions.sendAttachmentMessage("Hello World!", "openHAB", "/path/to/my-local-image.png", "image/png")
actions.sendAttachmentMessage("Hello World!", "openHAB", "https://www.openhab.org/openhab-logo-square.png", null)
actions.sendAttachmentMessage("Hello World!", "openHAB", "data:[<media type>][;base64],<data>", null)
// in case you want to send the content of an Image Item (RawType)
actions.sendAttachmentMessage("Hello World!", "openHAB", myImageItem.state.toFullString, null)
```
```java
val actions = getActions("pushover", "pushover:pushover-account:account")
// send priority message