1 | <?php |
||
20 | final class HttpClient implements ClientInterface |
||
21 | { |
||
22 | /** |
||
23 | * @var Client |
||
24 | */ |
||
25 | private $httpClient; |
||
26 | |||
27 | /** |
||
28 | * @param string $baseUri |
||
29 | * @param UserCredentials $credentials |
||
30 | * @param float $connectTimeout |
||
31 | * @param array $httpClientOptions |
||
32 | */ |
||
33 | public function __construct( |
||
51 | |||
52 | /** |
||
53 | * @param string $streamId |
||
54 | * @param int $expectedVersion |
||
55 | * @param array $events |
||
56 | */ |
||
57 | public function appendToStream(string $streamId, int $expectedVersion, array $events) |
||
75 | |||
76 | /** |
||
77 | * @param RequestInterface $request |
||
78 | * @param ResponseInspector $inspector |
||
79 | * |
||
80 | * @return ResponseInterface |
||
81 | * |
||
82 | * @internal |
||
83 | */ |
||
84 | public function send(RequestInterface $request, ResponseInspector $inspector): ResponseInterface |
||
96 | |||
97 | /** |
||
98 | * @param $e |
||
99 | */ |
||
100 | private function handleTransferException(TransferException $e) |
||
104 | |||
105 | /** |
||
106 | * @param string $streamId |
||
107 | */ |
||
108 | public function deleteStream(string $streamId) |
||
120 | |||
121 | /** |
||
122 | * With great power comes great responsibility. |
||
123 | * |
||
124 | * @return EventRecordCollection |
||
125 | */ |
||
126 | public function readAllEvents(): EventRecordCollection |
||
132 | |||
133 | /** |
||
134 | * @param string $streamId |
||
135 | * |
||
136 | * @return EventRecordCollection |
||
137 | */ |
||
138 | public function readAllEventsFromStream(string $streamId): EventRecordCollection |
||
151 | |||
152 | /** |
||
153 | * Retrieves events recorded since a given version of the stream. |
||
154 | * Does not include the event with number corresponding to the given version. |
||
155 | * |
||
156 | * @param string $streamId |
||
157 | * @param int $version |
||
158 | * |
||
159 | * @return EventRecordCollection |
||
160 | */ |
||
161 | public function readStreamUpToVersion(string $streamId, int $version): EventRecordCollection |
||
194 | |||
195 | /** |
||
196 | * @param string $streamId |
||
197 | * @param string $groupName |
||
198 | * @param PersistentSubscriptionSettings $settings |
||
199 | */ |
||
200 | public function createPersistentSubscription( |
||
209 | |||
210 | /** |
||
211 | * @param string $streamId |
||
212 | * @param string $groupName |
||
213 | * @param PersistentSubscriptionSettings $settings |
||
214 | */ |
||
215 | public function updatePersistentSubscription(string $streamId, string $groupName, PersistentSubscriptionSettings $settings) |
||
221 | |||
222 | /** |
||
223 | * @param string $streamId |
||
224 | * @param string $groupName |
||
225 | */ |
||
226 | public function deletePersistentSubscription(string $streamId, string $groupName) |
||
232 | |||
233 | /** |
||
234 | * @param string $streamId |
||
235 | * @param string $groupName |
||
236 | * @param callable $messageHandler |
||
237 | * @param int $bufferSize |
||
238 | * @param bool $autoAck |
||
239 | */ |
||
240 | public function readStreamViaPersistentSubscription( |
||
249 | } |
||
250 |