@@ 9-44 (lines=36) @@ | ||
6 | use Psr\Http\Message\RequestInterface; |
|
7 | use RayRutjes\GetEventStore\StreamId; |
|
8 | ||
9 | final class DeletePersistentSubscriptionRequestFactory implements RequestFactoryInterface |
|
10 | { |
|
11 | /** |
|
12 | * @var StreamId |
|
13 | */ |
|
14 | private $streamId; |
|
15 | ||
16 | /** |
|
17 | * @var string |
|
18 | */ |
|
19 | private $groupName; |
|
20 | ||
21 | /** |
|
22 | * @param StreamId $streamId |
|
23 | * @param string $groupName |
|
24 | */ |
|
25 | public function __construct(StreamId $streamId, string $groupName) |
|
26 | { |
|
27 | $this->streamId = $streamId; |
|
28 | $this->groupName = $groupName; |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * @return RequestInterface |
|
33 | */ |
|
34 | public function buildRequest(): RequestInterface |
|
35 | { |
|
36 | return new Request( |
|
37 | 'DELETE', |
|
38 | sprintf('subscriptions/%s/%s', $this->streamId->toString(), $this->groupName), |
|
39 | [ |
|
40 | RequestHeader::CONTENT_TYPE => ContentType::JSON, |
|
41 | ] |
|
42 | ); |
|
43 | } |
|
44 | } |
|
45 |
@@ 9-44 (lines=36) @@ | ||
6 | use Psr\Http\Message\RequestInterface; |
|
7 | use RayRutjes\GetEventStore\StreamId; |
|
8 | ||
9 | final class GetPersistentSubscriptionInfoRequestFactory implements RequestFactoryInterface |
|
10 | { |
|
11 | /** |
|
12 | * @var StreamId |
|
13 | */ |
|
14 | private $streamId; |
|
15 | ||
16 | /** |
|
17 | * @var string |
|
18 | */ |
|
19 | private $groupName; |
|
20 | ||
21 | /** |
|
22 | * @param StreamId $streamId |
|
23 | * @param string $groupName |
|
24 | */ |
|
25 | public function __construct(StreamId $streamId, string $groupName) |
|
26 | { |
|
27 | $this->streamId = $streamId; |
|
28 | $this->groupName = $groupName; |
|
29 | } |
|
30 | ||
31 | /** |
|
32 | * @return RequestInterface |
|
33 | */ |
|
34 | public function buildRequest(): RequestInterface |
|
35 | { |
|
36 | return new Request( |
|
37 | 'GET', |
|
38 | sprintf('subscriptions/%s/%s/info', $this->streamId->toString(), $this->groupName), |
|
39 | [ |
|
40 | RequestHeader::CONTENT_TYPE => ContentType::JSON, |
|
41 | ] |
|
42 | ); |
|
43 | } |
|
44 | } |
|
45 |