Updated readme.md

This commit is contained in:
Sven Kubiak 2020-07-27 12:04:12 +02:00
parent 18f54ed3db
commit 448bf70e48
2 changed files with 24 additions and 7 deletions

View File

@ -3,12 +3,12 @@
JPushover 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. Requires Java 11.
Supports [Messages API][3] and [Glances API][4].
Usage Usage
------------------ ------------------
@ -41,13 +41,16 @@ JPushover.newGlance()
When using the Message API you can additionally add available options from the official [Pushover documentation][2] 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 You can also validate a user and token using the following method
``` ```
boolean valid = JPushover.newMessage() boolean valid = JPushover.newMessage()
.withToken("MyToken") .withToken("MyToken")
.withUser("MyUser") .withUser("MyUser")
.validate(); .validate();
``` ```
If you want more information and/or the response from the Pushover API, use the PushoverResponse object. If you want more information and/or the response from the Pushover API, use the PushoverResponse object.
``` ```
PushoverResponse PushoverResponse = JPushover.newMessage() PushoverResponse PushoverResponse = JPushover.newMessage()
.withToken("MyToken") .withToken("MyToken")
@ -55,7 +58,24 @@ PushoverResponse PushoverResponse = JPushover.newMessage()
.withMessage("MyMessage") .withMessage("MyMessage")
.push(); .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 [1]: https://pushover.net
[2]: https://pushover.net/api [2]: https://pushover.net/api

View File

@ -20,9 +20,6 @@
<properties> <properties>
<java.version>11</java.version> <java.version>11</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <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> </properties>
<scm> <scm>
<connection>scm:git:git@github.com:svenkubiak/JPushover.git</connection> <connection>scm:git:git@github.com:svenkubiak/JPushover.git</connection>