Skip to content

Commit 267b9c7

Browse files
committed
added new exception type and unwrapped example for webhooks
1 parent 547f84d commit 267b9c7

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
namespace Examples\Unwrapped;
3+
require_once (dirname(__FILE__).'/../bootstrap.php');
4+
5+
//pull in API key config
6+
$configFile = file_get_contents(dirname(__FILE__) . '/../example-config.json');
7+
$config = json_decode($configFile, true);
8+
9+
use SparkPost\SparkPost;
10+
use GuzzleHttp\Client;
11+
use Ivory\HttpAdapter\Guzzle6HttpAdapter;
12+
13+
$httpAdapter = new Guzzle6HttpAdapter(new Client());
14+
$sparky = new SparkPost($httpAdapter, ['key'=>$config['api-key']]);
15+
16+
try {
17+
$sparky->setupUnwrapped('webhooks');
18+
19+
$results = $sparky->webhooks->get();
20+
21+
echo 'Congrats you can use your SDK!';
22+
} catch (\Exception $exception) {
23+
echo $exception->getMessage();
24+
}
25+
?>
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<?php
2+
3+
namespace SparkPost;
4+
5+
class APIResponseException extends \Exception {
6+
7+
}
8+
9+
?>

0 commit comments

Comments
 (0)