diff --git a/docs/intro.md b/docs/intro.md
index ab685f9..b213674 100644
--- a/docs/intro.md
+++ b/docs/intro.md
@@ -40,6 +40,7 @@ Intercom('show');
+
diff --git a/docs/quick-start/send-a-notification.md b/docs/quick-start/send-a-notification.md
index 5ad477f..05fa216 100644
--- a/docs/quick-start/send-a-notification.md
+++ b/docs/quick-start/send-a-notification.md
@@ -31,6 +31,7 @@ values={[
{ label: 'PHP', value: 'php' },
{ label: 'Go', value: 'go' },
{ label: 'C#', value: 'csharp' },
+{ label: 'Java', value: 'java' },
{ label: 'Ruby', value: 'ruby' }
]}>
@@ -79,6 +80,34 @@ Install the package:
dotnet add package NotificationAPI --version 0.5.0
```
+
+
+
+Add the following dependency to your Maven project:
+
+```xml
+
+ com.notificationapi
+ notificationapi-java-server-sdk
+ 0.2.0
+
+```
+
+For optimal functionality, you'll also need the following dependencies:
+
+```xml
+
+ org.apache.httpcomponents
+ httpclient
+ 4.5.14
+
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.15.2
+
+```
+
@@ -194,6 +223,7 @@ values={[
{ label: 'PHP', value: 'php' },
{ label: 'Go', value: 'go' },
{ label: 'C#', value: 'csharp' },
+{ label: 'Java', value: 'java' },
{ label: 'Ruby', value: 'ruby' }
]
}>
@@ -369,6 +399,40 @@ await notificationApi.Send(new SendNotificationData("order_tracking", user)
});
```
+
+
+
+```java
+// import
+import com.notificationapi.NotificationApi;
+import com.notificationapi.model.NotificationRequest;
+import com.notificationapi.model.User;
+import java.util.HashMap;
+import java.util.Map;
+
+// Initialize NotificationAPI (default US region)
+// If in the CA region, use the third parameter: "https://api.ca.notificationapi.com"
+// If in the EU region, use the third parameter: "https://api.eu.notificationapi.com"
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com");
+
+// Create user
+User user = new User("spongebob.squarepants")
+ .setEmail("spongebob@squarepants.com") // required for email notifications
+ .setNumber("+15005550006"); // optional phone number required to send SMS notifications
+
+// Create merge tags
+Map mergeTags = new HashMap<>();
+mergeTags.put("item", "Krabby Patty Burger");
+mergeTags.put("address", "124 Conch Street");
+mergeTags.put("orderId", "1234567890");
+
+// Create and send notification request
+NotificationRequest request = new NotificationRequest("order_tracking", user)
+ .setMergeTags(mergeTags);
+
+String response = api.send(request);
+```
+
diff --git a/docs/reference/server.md b/docs/reference/server.md
index 5049acc..3474db8 100644
--- a/docs/reference/server.md
+++ b/docs/reference/server.md
@@ -25,6 +25,7 @@ The server-side SDKs allow you to trigger sending notifications, setting user pr
- Laravel official
- Go official
- C# official
+- Java official
- Ruby documented
- Rust documented
- Any environment that supports HTTP calls
@@ -46,6 +47,7 @@ values={[
{ label: 'Laravel', value: 'laravel' },
{ label: 'Go', value: 'go' },
{ label: 'C#', value: 'csharp' },
+{ label: 'Java', value: 'java' },
{ label: 'Ruby', value: 'ruby' },
{ label: 'Rust', value: 'rust' }
]
@@ -464,6 +466,49 @@ using NotificationApi.Server;
var notificationApi = new NotificationApiServer("CLIENT_ID", "CLIENT_SECRET", false, "https://api.eu.notificationapi.com");
```
+
+
+
+1. Add the following dependency to your Maven project:
+
+```xml
+
+ com.notificationapi
+ notificationapi-java-server-sdk
+ 0.2.0
+
+```
+
+2. Import:
+
+```java
+import com.notificationapi.NotificationApi;
+```
+
+3. Initialize:
+
+```java
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com");
+```
+
+| Name | Type | Description |
+| ----------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| `CLIENT_ID`\* | string | Your NotificationAPI account clientId. You can get it from [here](https://app.notificationapi.com/environments). |
+| `CLIENT_SECRET`\* | string | Your NotificationAPI account client secret. You can get it from [here](https://app.notificationapi.com/environments). |
+| `baseURL` | string | To choose a different region than default (US). Use https://api.ca.notificationapi.com for Canada region, and https://api.eu.notificationapi.com for EU region. |
+
+\* required
+
+Region specific example:
+
+```java
+// For EU region
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.eu.notificationapi.com");
+
+// For CA region
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.ca.notificationapi.com");
+```
+
@@ -729,6 +774,7 @@ values={[
{ label: 'Laravel', value: 'laravel' },
{ label: 'Go', value: 'go' },
{ label: 'C#', value: 'csharp' },
+{ label: 'Java', value: 'java' },
{ label: 'Ruby', value: 'ruby' },
{ label: 'Rust', value: 'rust' }
]
@@ -900,6 +946,37 @@ await notificationApi.Send(new SendNotificationData("my_notification_id", user)
});
```
+
+
+
+```java
+import com.notificationapi.NotificationApi;
+import com.notificationapi.model.NotificationRequest;
+import com.notificationapi.model.User;
+import java.util.HashMap;
+import java.util.Map;
+
+// Initialize NotificationAPI
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com");
+
+// Create user
+User user = new User("spongebob.squarepants")
+ .setEmail("spongebob@squarepants.com")
+ .setNumber("+15005550006");
+
+// Create merge tags
+Map mergeTags = new HashMap<>();
+mergeTags.put("item", "Krabby Patty Burger");
+mergeTags.put("address", "124 Conch Street");
+mergeTags.put("orderId", "1234567890");
+
+// Create and send notification request
+NotificationRequest request = new NotificationRequest("order_tracking", user)
+ .setMergeTags(mergeTags);
+
+String response = api.send(request);
+```
+
@@ -1243,6 +1320,25 @@ await notificationApi.Identify(userId, new IdentifyUserData()
});
```
+
+
+
+```java
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com");
+
+User user = new User("spongebob.squarepants")
+ .setEmail("spongebob@squarepants.com")
+ .setNumber("+15005550006");
+
+List pushTokens = new ArrayList<>();
+pushTokens.add(new PushToken("FCM", "samplePushToken", new Device("com.example.app", "1234567890", "1234567890", "android", "Samsung", "SM-G930F")));
+
+List webPushTokens = new ArrayList<>();
+webPushTokens.add(new WebPushToken("https://fcm.googleapis.com/fcm/send/fCs_4iba0Ao:APA91bGFdaU7I3****JMH_KeZwk1Xi", new Keys("zP2xFu3hMc2vNH5E2nuKkyjpZydvCk9llRUY2kP4****9aSlKcoadSV2UbvMRQ", "CXEFun************tYe8g")));
+
+api.identifyUser(user, pushTokens, webPushTokens);
+```
+
@@ -1440,6 +1536,19 @@ await notificationApi.SetUserPreferences(userId, new SetUserPreferencesData(){
});
```
+
+
+
+```java
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com");
+
+UserPreferences preferences = new UserPreferences();
+preferences.addPreference(new NotificationPreference("new_order", NotificationChannel.INAPP_WEB, true));
+preferences.addPreference(new NotificationPreference("order_tracking", NotificationChannel.SMS, true));
+
+api.setUserPreferences("userId", preferences);
+```
+
@@ -1539,6 +1648,19 @@ await notificationApi.DeleteUserPreferences(new DeleteUserPreferencesData(){
});
```
+
+
+
+```java
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com");
+
+UserPreferences preferences = new UserPreferences();
+preferences.addPreference(new NotificationPreference("new_order", NotificationChannel.INAPP_WEB, true));
+preferences.addPreference(new NotificationPreference("order_tracking", NotificationChannel.SMS, true));
+
+api.deleteUserPreferences("userId", preferences);
+```
+
@@ -1550,6 +1672,7 @@ notificationapi.deleteUserPreferences({
```
+
#### Parameters
@@ -1665,6 +1788,19 @@ await notificationApi.DeleteUserPreferences("spongebob.squarepants", new Diction
});
```
+
+
+
+```java
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com");
+
+UserPreferences preferences = new UserPreferences();
+preferences.addPreference(new NotificationPreference("new_order", NotificationChannel.INAPP_WEB, true));
+preferences.addPreference(new NotificationPreference("order_tracking", NotificationChannel.SMS, true));
+
+api.updateInAppNotification("userId", "my_notification_id", preferences);
+```
+
@@ -1681,6 +1817,7 @@ notificationapi.delete_user_preferences('spongebob.squarepants', {
```
+
#### Parameters
@@ -1771,6 +1908,19 @@ await notificationApi.Retract(new RetractNotificationData(){
});
```
+
+
+
+```java
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com");
+
+RetractRequest request = new RetractRequest();
+request.setNotificationId("order_tracking");
+request.setUserId("spongebob.squarepants");
+
+api.retract(request);
+```
+
@@ -1863,6 +2013,18 @@ await notificationApi.UpdateSchedule("TRACKING_ID", new UpdateScheduleData(){
});
```
+
+
+
+```java
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com");
+
+UpdateScheduleRequest request = new UpdateScheduleRequest();
+request.setSchedule("2024-02-20T14:38:03.509Z");
+
+api.updateSchedule("TRACKING_ID", request);
+```
+
@@ -1870,7 +2032,7 @@ await notificationApi.UpdateSchedule("TRACKING_ID", new UpdateScheduleData(){
notificationapi.update_schedule(
tracking_id: '172cf2f4-18cd-4f1f-b2ac-e50c7d71891c',
{
- schedule: "2024-02-20T14:38:03.509Z",
+ schedule: "2024-02-20T14:38:03.509Z",
}
);
```
@@ -1944,6 +2106,18 @@ $notificationapi->deleteSchedule([
await notificationApi.DeleteSchedule("TRACKING_ID");
```
+
+
+
+```java
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com");
+
+DeleteScheduleRequest request = new DeleteScheduleRequest();
+request.setTrackingId("TRACKING_ID");
+
+api.deleteSchedule(request);
+```
+
@@ -2078,6 +2252,25 @@ var parameters = new Dictionary
await notificationApi.QueryLogs(parameters);
```
+
+
+
+```java
+NotificationApi api = new NotificationApi("CLIENT_ID", "CLIENT_SECRET", "https://api.notificationapi.com");
+
+QueryLogsRequest request = new QueryLogsRequest();
+request.setDateRangeFilter(new DateRangeFilter(1719600830559, 1719600840559));
+request.setNotificationFilter(Arrays.asList("order_tracking"));
+request.setChannelFilter(Arrays.asList("EMAIL"));
+request.setUserFilter(Arrays.asList("abcd-1234"));
+request.setStatusFilter(Arrays.asList("SUCCESS"));
+request.setTrackingIds(Arrays.asList("172cf2f4-18cd-4f1f-b2ac-e50c7d71891c"));
+request.setRequestFilter("request.mergeTags.item=\"Krabby Patty Burger\"");
+request.setEnvIdFilter("6ok6imq9unr2budgiebjdaa6oi");
+
+api.queryLogs(request);
+```
+