| @@ 27-62 (lines=36) @@ | ||
| 24 | use Surfnet\StepupMiddlewareClient\Exception\ResourceReadException; |
|
| 25 | use Surfnet\StepupMiddlewareClient\Service\ApiService; |
|
| 26 | ||
| 27 | class RaLocationService |
|
| 28 | { |
|
| 29 | /** |
|
| 30 | * @var ApiService |
|
| 31 | */ |
|
| 32 | private $apiService; |
|
| 33 | ||
| 34 | /** |
|
| 35 | * @param ApiService $apiService |
|
| 36 | */ |
|
| 37 | public function __construct(ApiService $apiService) |
|
| 38 | { |
|
| 39 | $this->apiService = $apiService; |
|
| 40 | } |
|
| 41 | ||
| 42 | /** |
|
| 43 | * @param string $id The RA's locations ID. |
|
| 44 | * @return null|array |
|
| 45 | * @throws AccessDeniedToResourceException When the consumer isn't authorised to access given resource. |
|
| 46 | * @throws ResourceReadException When the server doesn't respond with the resource. |
|
| 47 | * @throws MalformedResponseException When the server doesn't respond with (well-formed) JSON. |
|
| 48 | */ |
|
| 49 | public function get($id) |
|
| 50 | { |
|
| 51 | return $this->apiService->read('ra-location/%s', [$id]); |
|
| 52 | } |
|
| 53 | ||
| 54 | /** |
|
| 55 | * @param RaLocationSearchQuery $searchQuery |
|
| 56 | * @return mixed|null |
|
| 57 | */ |
|
| 58 | public function search(RaLocationSearchQuery $searchQuery) |
|
| 59 | { |
|
| 60 | return $this->apiService->read('ra-location' . $searchQuery->toHttpQuery()); |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||
| 64 | ||
| @@ 24-59 (lines=36) @@ | ||
| 21 | use Surfnet\StepupMiddlewareClient\Identity\Dto\RaListingSearchQuery; |
|
| 22 | use Surfnet\StepupMiddlewareClient\Service\ApiService; |
|
| 23 | ||
| 24 | class RaListingService |
|
| 25 | { |
|
| 26 | /** |
|
| 27 | * @var ApiService |
|
| 28 | */ |
|
| 29 | private $apiService; |
|
| 30 | ||
| 31 | /** |
|
| 32 | * @param ApiService $apiService |
|
| 33 | */ |
|
| 34 | public function __construct(ApiService $apiService) |
|
| 35 | { |
|
| 36 | $this->apiService = $apiService; |
|
| 37 | } |
|
| 38 | ||
| 39 | /** |
|
| 40 | * @param string $id The RA's identity ID. |
|
| 41 | * @return null|array |
|
| 42 | * @throws AccessDeniedToResourceException When the consumer isn't authorised to access given resource. |
|
| 43 | * @throws ResourceReadException When the server doesn't respond with the resource. |
|
| 44 | * @throws MalformedResponseException When the server doesn't respond with (well-formed) JSON. |
|
| 45 | */ |
|
| 46 | public function get($id) |
|
| 47 | { |
|
| 48 | return $this->apiService->read('ra-listing/%s', [$id]); |
|
| 49 | } |
|
| 50 | ||
| 51 | /** |
|
| 52 | * @param RaListingSearchQuery $searchQuery |
|
| 53 | * @return mixed|null |
|
| 54 | */ |
|
| 55 | public function search(RaListingSearchQuery $searchQuery) |
|
| 56 | { |
|
| 57 | return $this->apiService->read('ra-listing' . $searchQuery->toHttpQuery()); |
|
| 58 | } |
|
| 59 | } |
|
| 60 | ||