Updated readme.md
This commit is contained in:
parent
18f54ed3db
commit
448bf70e48
28
README.md
28
README.md
@ -3,12 +3,12 @@
|
||||
JPushover
|
||||
================
|
||||
|
||||
A minimal (15 KB), zero-dependency convenient class for sending messages to [Pushover][1] in Java.
|
||||
A simple, minimal (18 KB), zero-dependency convenient class for sending messages to [Pushover][1] in Java.
|
||||
|
||||
Supports [Messages API][3] and [Glances API][4], synchronous and asynchronous sending.
|
||||
|
||||
Requires Java 11.
|
||||
|
||||
Supports [Messages API][3] and [Glances API][4].
|
||||
|
||||
Usage
|
||||
------------------
|
||||
|
||||
@ -41,13 +41,16 @@ JPushover.newGlance()
|
||||
When using the Message API you can additionally add available options from the official [Pushover documentation][2]
|
||||
|
||||
You can also validate a user and token using the following method
|
||||
|
||||
```
|
||||
boolean valid = JPushover.newMessage()
|
||||
.withToken("MyToken")
|
||||
.withUser("MyUser")
|
||||
.validate();
|
||||
```
|
||||
|
||||
If you want more information and/or the response from the Pushover API, use the PushoverResponse object.
|
||||
|
||||
```
|
||||
PushoverResponse PushoverResponse = JPushover.newMessage()
|
||||
.withToken("MyToken")
|
||||
@ -55,7 +58,24 @@ PushoverResponse PushoverResponse = JPushover.newMessage()
|
||||
.withMessage("MyMessage")
|
||||
.push();
|
||||
```
|
||||
The PushoverResponse will return the raw HTTP status code, along with the raw JSON response and a convenient boolean if the request was successful or not.
|
||||
|
||||
The PushoverResponse will return the raw HTTP status code, along with the raw JSON response and a convenient boolean if the request was successful or not. Additionally you get the rate limit information along with the response (rate limit, remaining, reset timestamp).
|
||||
|
||||
Sending a Message or Glance asynchronous is simple. Just call the pushAsync() method instead of push(). Examples:
|
||||
|
||||
```
|
||||
JPushover.newMessage()
|
||||
.withToken("MyToken")
|
||||
.withUser("MyUser")
|
||||
.withMessage("MyMessage")
|
||||
.pushAsync();
|
||||
|
||||
JPushover.newGlance()
|
||||
.withToken("MyToken")
|
||||
.withUser("MyUser")
|
||||
.withText("MyText")
|
||||
.pushAsync();
|
||||
```
|
||||
|
||||
[1]: https://pushover.net
|
||||
[2]: https://pushover.net/api
|
||||
|
3
pom.xml
3
pom.xml
@ -20,9 +20,6 @@
|
||||
<properties>
|
||||
<java.version>11</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<junit.platform.version>1.7.0-M1</junit.platform.version>
|
||||
<junit.version>5.7.0-M1</junit.version>
|
||||
<jackson.version>2.11.1</jackson.version>
|
||||
</properties>
|
||||
<scm>
|
||||
<connection>scm:git:git@github.com:svenkubiak/JPushover.git</connection>
|
||||
|
Loading…
x
Reference in New Issue
Block a user