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