@@ -44,7 +44,7 @@ For more information about the API: [Novu Documentation](https://docs.novu.co)
4444<!-- Start Table of Contents [toc] -->
4545## Table of Contents
4646<!-- $toc-max-depth=2 -->
47- * [ openapi ] ( #openapi )
47+ * [ JAVA Novu SDK ] ( #java-novu-sdk )
4848 * [ SDK Installation] ( #sdk-installation )
4949 * [ SDK Example Usage] ( #sdk-example-usage )
5050 * [ Asynchronous Support] ( #asynchronous-support )
@@ -56,6 +56,7 @@ For more information about the API: [Novu Documentation](https://docs.novu.co)
5656 * [ Server Selection] ( #server-selection )
5757 * [ Custom HTTP Client] ( #custom-http-client )
5858 * [ Debugging] ( #debugging )
59+ * [ Jackson Configuration] ( #jackson-configuration )
5960* [ Development] ( #development )
6061 * [ Maturity] ( #maturity )
6162 * [ Contributions] ( #contributions )
@@ -73,15 +74,15 @@ The samples below show how a published SDK artifact is used:
7374
7475Gradle:
7576``` groovy
76- implementation 'co.novu:novu-java:3.14 .0'
77+ implementation 'co.novu:novu-java:3.15 .0'
7778```
7879
7980Maven:
8081``` xml
8182<dependency >
8283 <groupId >co.novu</groupId >
8384 <artifactId >novu-java</artifactId >
84- <version >3.14 .0</version >
85+ <version >3.15 .0</version >
8586</dependency >
8687```
8788
@@ -140,7 +141,7 @@ public class Application {
140141 .call();
141142
142143 if (res. triggerEventResponseDto(). isPresent()) {
143- // handle response
144+ System . out . println(res . triggerEventResponseDto() . get());
144145 }
145146 }
146147}
@@ -170,7 +171,7 @@ public class Application {
170171 .call();
171172
172173 if (res. boolean_(). isPresent()) {
173- // handle response
174+ System . out . println(res . boolean_() . get());
174175 }
175176 }
176177}
@@ -225,7 +226,7 @@ public class Application {
225226 .call();
226227
227228 if (res. triggerEventResponseDto(). isPresent()) {
228- // handle response
229+ System . out . println(res . triggerEventResponseDto() . get());
229230 }
230231 }
231232}
@@ -281,7 +282,7 @@ public class Application {
281282 .call();
282283
283284 if (res. triggerEventResponseDtos(). isPresent()) {
284- // handle response
285+ System . out . println(res . triggerEventResponseDtos() . get());
285286 }
286287 }
287288}
@@ -325,14 +326,23 @@ public class Application {
325326
326327 resFut. thenAccept(res - > {
327328 if (res. triggerEventResponseDto(). isPresent()) {
328- // handle response
329+ System . out . println(res . triggerEventResponseDto() . get());
329330 }
330331 });
331332 }
332333}
333334```
334335
335336[ comp-fut ] : https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html
337+
338+ #### Union Consumption Patterns
339+
340+ When a response field is a union model:
341+
342+ - Discriminated unions: branch on the discriminator (` switch ` ) and then narrow to the concrete type.
343+ - Non-discriminated unions: use generated accessors (for example ` string() ` , ` asLong() ` , ` simpleObject() ` ) to determine the active variant.
344+
345+ For full model-specific examples (including Java 11/16/21 variants), see each union model's ** Supported Types** section in the generated model docs.
336346<!-- End SDK Example Usage [usage] -->
337347
338348<!-- Start Asynchronous Support [async-support] -->
@@ -448,7 +458,7 @@ public class Application {
448458 .call();
449459
450460 if (res. triggerEventResponseDto(). isPresent()) {
451- // handle response
461+ System . out . println(res . triggerEventResponseDto() . get());
452462 }
453463 }
454464}
@@ -470,7 +480,7 @@ public class Application {
470480
471481### [ Activity] ( docs/sdks/activity/README.md )
472482
473- * [ track] ( docs/sdks/activity/README.md#track ) - Track activity and engagement events
483+ * [ track] ( docs/sdks/activity/README.md#track ) - Track provider activity and engagement events
474484
475485### [ ChannelConnections] ( docs/sdks/channelconnections/README.md )
476486
@@ -496,8 +506,19 @@ public class Application {
496506* [ get] ( docs/sdks/contexts/README.md#get ) - Retrieve a context
497507* [ delete] ( docs/sdks/contexts/README.md#delete ) - Delete a context
498508
509+ ### [ EnvironmentVariables] ( docs/sdks/environmentvariables/README.md )
510+
511+ * [ list] ( docs/sdks/environmentvariables/README.md#list ) - List all variables
512+ * [ create] ( docs/sdks/environmentvariables/README.md#create ) - Create a variable
513+ * [ retrieve] ( docs/sdks/environmentvariables/README.md#retrieve ) - Get environment variable
514+ * [ update] ( docs/sdks/environmentvariables/README.md#update ) - Update a variable
515+ * [ delete] ( docs/sdks/environmentvariables/README.md#delete ) - Delete environment variable
516+ * [ usage] ( docs/sdks/environmentvariables/README.md#usage ) - Retrieve a variable usage
517+
499518### [ Environments] ( docs/sdks/environments/README.md )
500519
520+ * [ diff] ( docs/sdks/environments/README.md#diff ) - Compare resources between environments
521+ * [ publish] ( docs/sdks/environments/README.md#publish ) - Publish resources to target environment
501522* [ create] ( docs/sdks/environments/README.md#create ) - Create an environment
502523* [ list] ( docs/sdks/environments/README.md#list ) - List all environments
503524* [ update] ( docs/sdks/environments/README.md#update ) - Update an environment
@@ -553,6 +574,26 @@ public class Application {
553574* [ removeCredentials] ( docs/sdks/subscribers/README.md#removecredentials ) - Delete provider credentials
554575* [ markAllMessages] ( docs/sdks/subscribers/README.md#markallmessages ) - Update all notifications state
555576
577+ #### [ Subscribers.Notifications] ( docs/sdks/subscribersnotifications1/README.md )
578+
579+ * [ list] ( docs/sdks/subscribersnotifications1/README.md#list ) - Retrieve subscriber notifications
580+ * [ delete] ( docs/sdks/subscribersnotifications1/README.md#delete ) - Delete a notification
581+ * [ completeAction] ( docs/sdks/subscribersnotifications1/README.md#completeaction ) - Complete a notification action
582+ * [ revertAction] ( docs/sdks/subscribersnotifications1/README.md#revertaction ) - Revert a notification action
583+ * [ archive] ( docs/sdks/subscribersnotifications1/README.md#archive ) - Archive a notification
584+ * [ markAsRead] ( docs/sdks/subscribersnotifications1/README.md#markasread ) - Mark a notification as read
585+ * [ snooze] ( docs/sdks/subscribersnotifications1/README.md#snooze ) - Snooze a notification
586+ * [ unarchive] ( docs/sdks/subscribersnotifications1/README.md#unarchive ) - Unarchive a notification
587+ * [ markAsUnread] ( docs/sdks/subscribersnotifications1/README.md#markasunread ) - Mark a notification as unread
588+ * [ unsnooze] ( docs/sdks/subscribersnotifications1/README.md#unsnooze ) - Unsnooze a notification
589+ * [ archiveAll] ( docs/sdks/subscribersnotifications1/README.md#archiveall ) - Archive all notifications
590+ * [ count] ( docs/sdks/subscribersnotifications1/README.md#count ) - Retrieve subscriber notifications count
591+ * [ deleteAll] ( docs/sdks/subscribersnotifications1/README.md#deleteall ) - Delete all notifications
592+ * [ markAllAsRead] ( docs/sdks/subscribersnotifications1/README.md#markallasread ) - Mark all notifications as read
593+ * [ archiveAllRead] ( docs/sdks/subscribersnotifications1/README.md#archiveallread ) - Archive all read notifications
594+ * [ markAsSeen] ( docs/sdks/subscribersnotifications1/README.md#markasseen ) - Mark notifications as seen
595+ * [ getUnseenCount] ( docs/sdks/subscribersnotifications1/README.md#getunseencount ) - Retrieve unseen notifications count
596+
556597### [ Subscribers.Credentials] ( docs/sdks/credentials/README.md )
557598
558599* [ upsert] ( docs/sdks/credentials/README.md#upsert ) - Upsert provider credentials
@@ -561,10 +602,6 @@ public class Application {
561602
562603* [ updateActionStatus] ( docs/sdks/subscribersmessages1/README.md#updateactionstatus ) - Update notification action status
563604
564- ### [ Subscribers.Notifications] ( docs/sdks/subscribersnotifications2/README.md )
565-
566- * [ getUnseenCount] ( docs/sdks/subscribersnotifications2/README.md#getunseencount ) - Retrieve unseen notifications count
567-
568605### [ Subscribers.Preferences] ( docs/sdks/preferences/README.md )
569606
570607* [ list] ( docs/sdks/preferences/README.md#list ) - Retrieve subscriber preferences
@@ -574,9 +611,9 @@ public class Application {
574611
575612* [ markAllAs] ( docs/sdks/subscribersmessages2/README.md#markallas ) - Update notifications state
576613
577- ### [ SubscribersNotifications] ( docs/sdks/subscribersnotifications1 /README.md )
614+ ### [ SubscribersNotifications] ( docs/sdks/subscribersnotifications2 /README.md )
578615
579- * [ getFeed] ( docs/sdks/subscribersnotifications1 /README.md#getfeed ) - Retrieve subscriber notifications
616+ * [ getFeed] ( docs/sdks/subscribersnotifications2 /README.md#getfeed ) - Retrieve subscriber notifications
580617
581618### [ SubscribersProperties] ( docs/sdks/subscribersproperties/README.md )
582619
@@ -632,6 +669,10 @@ public class Application {
632669
633670* [ get] ( docs/sdks/steps/README.md#get ) - Retrieve workflow step
634671
672+ ### [ WorkflowsSteps] ( docs/sdks/workflowssteps/README.md )
673+
674+ * [ generatePreview] ( docs/sdks/workflowssteps/README.md#generatepreview ) - Generate a step preview
675+
635676</details >
636677<!-- End Available Resources and Operations [operations] -->
637678
@@ -738,7 +779,7 @@ public class Application {
738779 .call();
739780
740781 if (res. triggerEventResponseDto(). isPresent()) {
741- // handle response
782+ System . out . println(res . triggerEventResponseDto() . get());
742783 }
743784 }
744785}
@@ -793,7 +834,7 @@ public class Application {
793834 .call();
794835
795836 if (res. triggerEventResponseDto(). isPresent()) {
796- // handle response
837+ System . out . println(res . triggerEventResponseDto() . get());
797838 }
798839 }
799840}
@@ -857,7 +898,7 @@ public class Application {
857898 .call();
858899
859900 if (res. triggerEventResponseDto(). isPresent()) {
860- // handle response
901+ System . out . println(res . triggerEventResponseDto() . get());
861902 }
862903 } catch (NovuException ex) { // all SDK exceptions inherit from NovuException
863904
@@ -912,9 +953,9 @@ public class Application {
912953many more subclasses in the JDK platform).
913954
914955** Inherit from [ ` NovuException ` ] ( ./src/main/java/models/errors/NovuException.java ) ** :
915- * [ ` co.novu.models.errors.PayloadValidationExceptionDto ` ] ( ./src/main/java/models/errors/co.novu.models.errors.PayloadValidationExceptionDto.java ) : Status code ` 400 ` . Applicable to 3 of 93 methods.*
916- * [ ` co.novu.models.errors.SubscriberResponseDtoException ` ] ( ./src/main/java/models/errors/co.novu.models.errors.SubscriberResponseDtoException.java ) : Created. Status code ` 409 ` . Applicable to 1 of 93 methods.*
917- * [ ` co.novu.models.errors.TopicResponseDtoException ` ] ( ./src/main/java/models/errors/co.novu.models.errors.TopicResponseDtoException.java ) : OK. Status code ` 409 ` . Applicable to 1 of 93 methods.*
956+ * [ ` co.novu.models.errors.PayloadValidationExceptionDto ` ] ( ./src/main/java/models/errors/co.novu.models.errors.PayloadValidationExceptionDto.java ) : Status code ` 400 ` . Applicable to 3 of 118 methods.*
957+ * [ ` co.novu.models.errors.SubscriberResponseDtoException ` ] ( ./src/main/java/models/errors/co.novu.models.errors.SubscriberResponseDtoException.java ) : Created. Status code ` 409 ` . Applicable to 1 of 118 methods.*
958+ * [ ` co.novu.models.errors.TopicResponseDtoException ` ] ( ./src/main/java/models/errors/co.novu.models.errors.TopicResponseDtoException.java ) : OK. Status code ` 409 ` . Applicable to 1 of 118 methods.*
918959
919960
920961</details >
@@ -972,7 +1013,7 @@ public class Application {
9721013 .call();
9731014
9741015 if (res. triggerEventResponseDto(). isPresent()) {
975- // handle response
1016+ System . out . println(res . triggerEventResponseDto() . get());
9761017 }
9771018 }
9781019}
@@ -1017,7 +1058,7 @@ public class Application {
10171058 .call();
10181059
10191060 if (res. triggerEventResponseDto(). isPresent()) {
1020- // handle response
1061+ System . out . println(res . triggerEventResponseDto() . get());
10211062 }
10221063 }
10231064}
@@ -1243,6 +1284,36 @@ __NOTE__: This is a convenience method that calls `HTTPClient.enableDebugLogging
12431284Another option is to set the System property ` -Djdk.httpclient.HttpClient.log=all ` . However, this option does not log request/response bodies.
12441285<!-- End Debugging [debug] -->
12451286
1287+ <!-- Start Jackson Configuration [jackson] -->
1288+ ## Jackson Configuration
1289+
1290+ The SDK ships with a pre-configured Jackson [ ` ObjectMapper ` ] [ jackson-databind ] accessible via
1291+ ` JSON.getMapper() ` . It is set up with type modules, strict deserializers, and the feature flags
1292+ needed for full SDK compatibility (including ISO-8601 ` OffsetDateTime ` serialization):
1293+
1294+ ``` java
1295+ import co.novu.utils.JSON ;
1296+
1297+ String json = JSON . getMapper(). writeValueAsString(response);
1298+ ```
1299+
1300+ To compose with your own ` ObjectMapper ` , register the provided ` NovuJavaJacksonModule ` , which
1301+ bundles all the same modules and feature flags as a single plug-and-play module:
1302+
1303+ ``` java
1304+ import co.novu.utils.NovuJavaJacksonModule ;
1305+ import com.fasterxml.jackson.databind.ObjectMapper ;
1306+
1307+ ObjectMapper myMapper = new ObjectMapper ()
1308+ .registerModule(new NovuJavaJacksonModule ());
1309+
1310+ String json = myMapper. writeValueAsString(response);
1311+ ```
1312+
1313+ [ jackson-databind ] : https://github.com/FasterXML/jackson-databind
1314+ [ jackson-jsr310 ] : https://github.com/FasterXML/jackson-modules-java8/tree/master/datetime
1315+ <!-- End Jackson Configuration [jackson] -->
1316+
12461317<!-- Placeholder for Future Speakeasy SDK Sections -->
12471318
12481319# Development
0 commit comments