Skip to content

notifir/notifir-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

68 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Notifir Java

MIT Maven codecov Publish Stable Publish Unstable

Java client library for the Notifir.

Download

Get Notifir Java via Maven:

<dependency>
  <groupId>io.github.notifir</groupId>
  <artifactId>notifir</artifactId>
  <version>0.5.6</version>
</dependency>

or Gradle:

implementation 'io.github.notifir:notifir:0.5.6'

Usage

Initialization

The implementation is based on the Notifir API.

Create a Notifir instance by providing the required details, such as baseUrl, apiPublicKey and apiSecretKey.

Notifir auth = new Notifir(
    "{YOUR_BASE_URL}", 
    "{YOUR_API_PUBLIC_KEY}", 
    "{YOUR_API_SECRET_KEY}"
);

You can also customize API client using HttpOptions sent as the 4th parameter.

HttpOptions httpOptions = new HttpOptions();
httpOptions.setConnectTimeout(30);

Notifir auth = new Notifir(
    "{YOUR_BASE_URL}", 
    "{YOUR_API_PUBLIC_KEY}", 
    "{YOUR_API_SECRET_KEY}",
    httpOptions
);

Creating notifications

To create a notification you can use the following function: Request<NotificationResponse> createNotification(NotificationRequest notification)

Example

Notifir notifir = new Notifir(
  "https://localhost:3000/api", 
  "114ee1da-067b-11ed-be0f-6f24634ae754", 
  "114ee1da-067b-11ed-be0f-6f24634ae755"
);

try {
  NotificationRequest notification = NotificationRequest
    .builder()
    .type("test")
    .projectId("default")
    .userId("[email protected]")
    .payload(new HashMap<>())
    .build();

  NotificationResponse result = notifir.createNotification(notification).execute();
} catch (NotifirException e) {
  //Something happened
}

Documentation

For more information about Notifir check our documentation page.

What is Notifir?

Notifir is created to simplify the development of in-app notifications for your product. It provides the skeleton of the notification system. The essential functionality is available out of the box.

License

This project is licensed under the MIT license. See the LICENSE file for more info.