55namespace Thenativeweb \Eventsourcingdb ;
66
77use DateTimeImmutable ;
8- use Exception ;
98use GuzzleHttp \Client as HttpClient ;
10- use GuzzleHttp \Exception \GuzzleException ;
119use RuntimeException ;
12- use Thenativeweb \Eventsourcingdb \Stream \Utils ;
10+ use Thenativeweb \Eventsourcingdb \Stream \NdJson ;
1311
1412final readonly class Client
1513{
@@ -25,9 +23,6 @@ public function __construct(string $url, string $apiToken)
2523 ]);
2624 }
2725
28- /**
29- * @throws GuzzleException
30- */
3126 public function ping (): void
3227 {
3328 $ response = $ this ->httpClient ->get ('/api/v1/ping ' );
@@ -48,9 +43,6 @@ public function ping(): void
4843 }
4944 }
5045
51- /**
52- * @throws GuzzleException
53- */
5446 public function verifyApiToken (): void
5547 {
5648 $ response = $ this ->httpClient ->post (
@@ -78,10 +70,6 @@ public function verifyApiToken(): void
7870 }
7971 }
8072
81- /**
82- * @return iterable<CloudEvent>
83- * @throws Exception|GuzzleException
84- */
8573 public function writeEvents (array $ events , array $ preconditions = []): iterable
8674 {
8775 $ requestBody = [
@@ -143,10 +131,6 @@ public function writeEvents(array $events, array $preconditions = []): iterable
143131 }
144132 }
145133
146- /**
147- * @return iterable<CloudEvent>
148- * @throws Exception|GuzzleException
149- */
150134 public function readEvents (string $ subject , ReadEventsOptions $ readEventsOptions ): iterable
151135 {
152136 $ requestBody = [
@@ -173,7 +157,7 @@ public function readEvents(string $subject, ReadEventsOptions $readEventsOptions
173157 ));
174158 }
175159
176- foreach (Utils:: readNdJson ($ response ->getBody ()) as $ eventLine ) {
160+ foreach (NdJson:: readStream ($ response ->getBody ()) as $ eventLine ) {
177161 switch ($ eventLine ->type ) {
178162 case 'event ' :
179163 $ cloudEvent = new CloudEvent (
0 commit comments