Skip to content

Commit

Permalink
clean up integ/readme examples.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpe42 committed Sep 22, 2023
1 parent 88eea8d commit 0c3f73e
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 25 deletions.
48 changes: 29 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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);
```

Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
Expand All @@ -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")
Expand Down

0 comments on commit 0c3f73e

Please sign in to comment.