diff --git a/README.md b/README.md index e48e3a4..792c00a 100644 --- a/README.md +++ b/README.md @@ -13,31 +13,37 @@ var client=PagerDutyEventClient.build() .authToken("AUTH_TOKEN") .create(); -var payload=PagerDutyEventPayload.build() - .summary("summary") - .source("source") +var bigInteger = new BigInteger("20988936657440586486151264256610222593863921"); +var payload = PagerDutyEventPayload.build() + .summary("test-summary") + .source("test-source") .severity(PagerDutySeverity.critical) .timestamp(ZonedDateTime.now(UTC)) - .component("component") - .group("group") - .type("class") - .customDetails("num-metric",1) - .customDetails("string-metric","val") + .component("test-component") + .group("test-group") + .type("test-class") + .customDetails("test-num-metric", 1) + .customDetails("test-boolean", true) + .customDetails("test-string", "val") + .customDetails("test-nested-json", """ + {"test": "json"}""") + .customDetails("test-big-decimal", new BigDecimal(bigInteger).add(BigDecimal.valueOf(0.123456789))) + .customDetails("test-big-integer", bigInteger) .link(PagerDutyLinkRef.build() - .href("https://github.com/comodal/pagerduty-client") - .text("Github pagerduty-client") - .create()) + .href("https://github.com/comodal/pagerduty-client") + .text("Github pagerduty-client") + .create()) .image(PagerDutyImageRef.build() - .src("https://www.pagerduty.com/wp-content/uploads/2016/05/pagerduty-logo-green.png") - .href("https://www.pagerduty.com/") - .alt("pagerduty") - .create()) + .src("https://www.pagerduty.com/wp-content/uploads/2016/05/pagerduty-logo-green.png") + .href("https://www.pagerduty.com/") + .alt("pagerduty") + .create()) .create(); -var triggerResponse=client.triggerDefaultRouteEvent(payload).join(); +var triggerResponse = client.triggerDefaultRouteEvent(payload).join(); System.out.println(triggerResponse); -var resolveResponse=client.resolveEvent(triggerResponse.getDedupeKey()).join(); +var resolveResponse = client.resolveEvent(triggerResponse.getDedupeKey()).join(); System.out.println(resolveResponse); ``` @@ -50,14 +56,18 @@ var client = PagerDutyEventClient.build() .authToken("AUTH_TOKEN") .create(); +var bigInteger = new BigInteger("20988936657440586486151264256610222593863921"); var payload = PagerDutyChangeEventPayload.build() .summary("test-summary") .source("test-source") .timestamp(ZonedDateTime.now(UTC)) .customDetails("test-num-metric", 1) - .customDetails("test-boolean", false) + .customDetails("test-boolean", true) .customDetails("test-string", "val") - .customDetails("test-json", "{\"test\": \"json\"}") + .customDetails("test-nested-json", """ + {"test": "json"}""") + .customDetails("test-big-decimal", new BigDecimal(bigInteger).add(BigDecimal.valueOf(0.123456789))) + .customDetails("test-big-integer", bigInteger) .link(PagerDutyLinkRef.build() .href("https://github.com/comodal/pagerduty-client") .text("Github pagerduty-client") diff --git a/systems.comodal.pagerduty_event_client_test/src/main/java/systems/comodal/test/pagerduty/Integ.java b/systems.comodal.pagerduty_event_client_test/src/main/java/systems/comodal/test/pagerduty/Integ.java index a8e002b..9e4e78e 100644 --- a/systems.comodal.pagerduty_event_client_test/src/main/java/systems/comodal/test/pagerduty/Integ.java +++ b/systems.comodal.pagerduty_event_client_test/src/main/java/systems/comodal/test/pagerduty/Integ.java @@ -7,7 +7,6 @@ import java.math.BigInteger; import java.time.ZonedDateTime; -import static java.math.BigDecimal.TEN; import static java.time.ZoneOffset.UTC; public final class Integ { @@ -22,7 +21,8 @@ public static void main(final String[] args) { .authToken("AUTH_TOKEN") .create(); - var payload = PagerDutyEventPayload.build() + final var bigInteger = new BigInteger("20988936657440586486151264256610222593863921"); + final var payload = PagerDutyEventPayload.build() .summary("test-summary") .source("test-source") .severity(PagerDutySeverity.critical) @@ -31,11 +31,12 @@ public static void main(final String[] args) { .group("test-group") .type("test-class") .customDetails("test-num-metric", 1) - .customDetails("test-boolean", false) + .customDetails("test-boolean", true) .customDetails("test-string", "val") - .customDetails("test-json", "{\"test\": \"json\"}") - .customDetails("test-big-decimal", BigDecimal.valueOf(Double.MAX_VALUE).multiply(TEN)) - .customDetails("test-big-integer", BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.TEN)) + .customDetails("test-nested-json", """ + {"test": "json"}""") + .customDetails("test-big-decimal", new BigDecimal(bigInteger).add(BigDecimal.valueOf(0.123456789))) + .customDetails("test-big-integer", bigInteger) .link(PagerDutyLinkRef.build() .href("https://github.com/comodal/pagerduty-client") .text("Github pagerduty-client")