refactor: split buspro ApiClient into domain clients
This commit is contained in:
1 parent
0a55544ca8
commit
b755a6f43e
52 files changed
+805
-695
No files matched your search
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
namespace App\BusProNet\Client;
|
||||
|
||||
use App\BusProNet\Exception\ApiClientException;
|
||||
use App\BusProNet\MessageType;
|
||||
use App\BusProNet\Model\Agency;
|
||||
use App\BusProNet\Model\BaseData;
|
||||
use App\BusProNet\Model\Notification;
|
||||
use App\BusProNet\Transport\XmlChannel;
|
||||
|
||||
/**
|
||||
* Lists that change rarely and that callers cache for long periods.
|
||||
*/
|
||||
class ReferenceDataClient
|
||||
{
|
||||
public function __construct(
|
||||
private readonly XmlChannel $channel,
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Agency[]|Notification
|
||||
*
|
||||
* @throws ApiClientException
|
||||
*/
|
||||
public function getAgencies(): array|Notification
|
||||
{
|
||||
return $this->channel->request(MessageType::Agencies);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws ApiClientException
|
||||
*/
|
||||
public function getBaseData(MessageType $type): Notification|BaseData
|
||||
{
|
||||
return $this->channel->request($type);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user