Update README.md

This commit is contained in:
Sven Kubiak 2018-11-22 14:48:11 +01:00 committed by GitHub
parent 69632b331f
commit afce435b23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,15 +14,17 @@ Usage
1) Add the jpushover dependency to your pom.xml: 1) Add the jpushover dependency to your pom.xml:
```
<dependency> <dependency>
<groupId>de.svenkubiak</groupId> <groupId>de.svenkubiak</groupId>
<artifactId>jpushover</artifactId> <artifactId>jpushover</artifactId>
<version>x.x.x</version> <version>x.x.x</version>
</dependency> </dependency>
```
2) Use the JPushover object with the required informations were you want 2) Use the JPushover object with the required informations were you want
```
JPushover.newMessage() JPushover.newMessage()
.withToken("MyToken") .withToken("MyToken")
.withUser("MyUser") .withUser("MyUser")
@ -34,24 +36,25 @@ Usage
.withUser("MyUser") .withUser("MyUser")
.withText("MyText") .withText("MyText")
.push(); .push();
```
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 JPushoverResponse object. If you want more information and/or the response from the Pushover API, use the JPushoverResponse object.
```
JPushoverResponse jPushoverResponse = JPushover.newMessage() JPushoverResponse jPushoverResponse = JPushover.newMessage()
.withToken("MyToken") .withToken("MyToken")
.withUser("MyUser") .withUser("MyUser")
.withMessage("MyMessage") .withMessage("MyMessage")
.push(); .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. 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.
[1]: https://pushover.net [1]: https://pushover.net