Skip to content

Commit 44f5619

Browse files
committed
EA-1511: Implement Heartbeats
1 parent 13bac31 commit 44f5619

16 files changed

+720
-384
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
var/
55
build
66
.php_cs.cache
7+
tests/.phpunit.result.cache

README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,12 @@ https://docs.opsgenie.com/docs/alert-api
1212
* Create Alert
1313
* Get specific Alert (by alias) from API
1414
* Close Alert
15+
* Ping Heatbeat
1516

1617
## How-To-Use
1718

19+
Create / Get / Close Alert
20+
1821
````php
1922
# named constructor to create a client (for EU)
2023
$client = AlertApiClient::createForEUApi(getenv(UPSGENIE_TOKEN));
@@ -31,3 +34,17 @@ if($response->isSuccessful()){
3134
$client->closeAlert(new CloseAlertRequest($alert->getAlias()));
3235
}
3336
````
37+
38+
39+
Ping Heartbeat
40+
41+
````php
42+
$token = "xxx-xxx-xxx";
43+
$client = new HeartbeatApiClient(HttpClient::createForEUApi(getenv(UPSGENIE_TOKEN)));
44+
do {
45+
$result = $client->sendPing(new PingRequest('beat'));
46+
var_dump($result, $result->isSuccessful());
47+
sleep(60);
48+
} while(true);
49+
50+
````

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"guzzlehttp/guzzle": "^6.3"
1414
},
1515
"require-dev": {
16-
"phpunit/phpunit": "^7.0",
16+
"phpunit/phpunit": "^8.0",
1717
"friendsofphp/php-cs-fixer": "^2.12",
1818
"phpstan/phpstan": "^0.10.5"
1919
},

0 commit comments

Comments
 (0)