JPushover11/README.md

64 lines
1.7 KiB
Markdown
Raw Normal View History

2015-01-07 13:16:55 +01:00
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/de.svenkubiak/jpushover/badge.svg)](https://maven-badges.herokuapp.com/maven-central/de.svenkubiak/jpushover)
2015-01-08 08:35:01 +01:00
2015-01-07 13:16:55 +01:00
JPushover
================
A zero-dependency convenient class for sending messages to [Pushover][1] in Java.
2018-10-06 07:49:05 +02:00
Requires Java 11.
Support [Messages API][3] and [Glances API][4].
2015-01-07 13:16:55 +01:00
Usage
------------------
1) Add the jpushover dependency to your pom.xml:
2018-11-22 14:48:11 +01:00
```
<dependency>
<groupId>de.svenkubiak</groupId>
<artifactId>jpushover</artifactId>
<version>x.x.x</version>
</dependency>
```
2015-01-07 20:29:25 +01:00
2) Use the JPushover object with the required informations were you want
2018-11-22 14:48:11 +01:00
```
JPushover.newMessage()
.withToken("MyToken")
.withUser("MyUser")
.withMessage("MyMessage")
.push();
JPushover.newGlance()
.withToken("MyToken")
.withUser("MyUser")
.withText("MyText")
.push();
```
When using the Message API you can additionally add available options from the official [Pushover documentation][2]
2015-01-09 08:32:32 +01:00
You can also validate a user and token using the following method
2018-11-22 14:48:11 +01:00
```
boolean valid = JPushover.newMessage()
.withToken("MyToken")
.withUser("MyUser")
.validate();
```
2015-01-07 20:29:25 +01:00
If you want more information and/or the response from the Pushover API, use the JPushoverResponse object.
2018-11-22 14:48:11 +01:00
```
JPushoverResponse jPushoverResponse = JPushover.newMessage()
.withToken("MyToken")
.withUser("MyUser")
.withMessage("MyMessage")
.push();
```
The JPushoverResponse will return the raw HTTP status code, along with the raw JSON response and a convenient boolean if the request was successful or not.
2015-01-07 13:16:55 +01:00
2015-01-07 20:29:25 +01:00
[1]: https://pushover.net
[2]: https://pushover.net/api
[3]: https://pushover.net/api
2018-11-22 14:48:11 +01:00
[4]: https://pushover.net/api/glances