40 lines
872 B
PHP
40 lines
872 B
PHP
<?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);
|
|
}
|
|
}
|