JPushover11/README.md

50 lines
1.5 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-07 20:16:49 +01:00
[![Build Status](https://secure.travis-ci.org/svenkubiak/JPushover.png?branch=master)](http://travis-ci.org/svenkubiak/JPushover)
2015-01-07 13:16:55 +01:00
2015-01-08 08:35:01 +01:00
2015-01-07 13:16:55 +01:00
JPushover
================
2018-01-21 18:21:15 +01:00
Convenient class for sending messages to [Pushover][1] in Java.
2015-01-07 13:16:55 +01:00
Usage
------------------
1) Add the jpushover dependency to your pom.xml:
2018-01-21 18:20:28 +01:00
```
2018-01-21 18:22:05 +01:00
<dependency>
<groupId>de.svenkubiak</groupId>
2015-01-07 13:16:55 +01:00
<artifactId>jpushover</artifactId>
<version>x.x.x</version>
2018-01-21 18:22:05 +01:00
</dependency>
2018-01-21 18:20:28 +01:00
```
2015-01-07 20:29:25 +01:00
2) Use the JPushover object with the required informations were you want
2018-01-21 18:20:28 +01:00
```
2018-01-21 18:22:05 +01:00
JPushover.build()
.withToken("MyToken")
.withUser("MyUser")
.withMessage("MyMessage")
.push();
2018-01-21 18:20:28 +01:00
```
2015-01-07 20:29:25 +01:00
You can additionally add all 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
2016-10-20 08:35:08 +02:00
boolean valid = JPushover.build()
.withToken("MyToken")
.withUser("MyUser")
2015-01-09 08:32:32 +01:00
.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.
2015-01-07 13:16:55 +01:00
2015-12-10 11:17:36 +01:00
JPushoverResponse jPushoverResponse = JPushover.build()
2016-10-20 08:35:08 +02:00
.withToken("MyToken")
.withUser("MyUser")
.withMessage("MyMessage")
2015-01-07 13:16:55 +01:00
.push();
2015-12-10 11:17:36 +01:00
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
2018-01-21 18:20:28 +01:00
[2]: https://pushover.net/api