From 10d89f091e9218dcd049ffde2714b7bc1c556a8f Mon Sep 17 00:00:00 2001 From: yaroslav Date: Fri, 11 Dec 2020 04:14:47 +0200 Subject: [PATCH 1/5] add-audience-device-client: added AudienceDeviceClient and abstract RelationClient --- src/RelationClient.php | 31 +++++++++++++++++++++++++++++++ src/RelationClientInterface.php | 25 +++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 src/RelationClient.php create mode 100644 src/RelationClientInterface.php diff --git a/src/RelationClient.php b/src/RelationClient.php new file mode 100644 index 0000000..47ccf43 --- /dev/null +++ b/src/RelationClient.php @@ -0,0 +1,31 @@ + Date: Tue, 15 Dec 2020 17:31:08 +0200 Subject: [PATCH 2/5] add-audience-device-client: added getByGivenPath to client to make it easier to move between pages from response --- src/Client.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/Client.php b/src/Client.php index 0911c50..c9524e3 100644 --- a/src/Client.php +++ b/src/Client.php @@ -119,6 +119,25 @@ public function findAll($filters = [], $pageSize = 10, $page = 1) ->getContents(), true); } + /** + * @param string $path + * + * @return array + * @throws EntityFetchException + */ + public function getByGivenPath(string $path): array + { + try { + $response = $this->httpClient->get($path, [ + 'headers' => $this->getHeaders(), + ]); + } catch (BadResponseException $e) { + throw new EntityFetchException($e->getMessage(), $e->getCode(), $e); + } + + return json_decode($response->getBody()->getContents(), true); + } + /** * @param bool $patch * @return array From 54a212f526bc38fb72484290df059117535747ee Mon Sep 17 00:00:00 2001 From: yaroslav Date: Wed, 30 Dec 2020 15:21:27 +0200 Subject: [PATCH 3/5] add-audience-device-client: fixed interface --- src/RelationClientInterface.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/RelationClientInterface.php b/src/RelationClientInterface.php index 9bcf970..bac6cf0 100644 --- a/src/RelationClientInterface.php +++ b/src/RelationClientInterface.php @@ -2,7 +2,7 @@ namespace LiveStyled; -use LiveStyled\Exception\TransferException; +use LiveStyled\Exception\EntityFetchException; interface RelationClientInterface { @@ -17,9 +17,8 @@ public function create($data); * @param array $filters * @param int $pageSize * @param int $page - * * @return array - * @throws TransferException + * @throws EntityFetchException */ - public function findAll($filters = [], $pageSize = 10, $page = 0): array; + public function findAll($filters = [], $pageSize = 10, $page = 1); } \ No newline at end of file From 1254284414b556e71925ea6db40c5e7d390cec4d Mon Sep 17 00:00:00 2001 From: yaroslav Date: Tue, 12 Jan 2021 15:30:58 +0200 Subject: [PATCH 4/5] add-audience-device-client: added relation client --- src/UserManagement/AudienceDeviceClient.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UserManagement/AudienceDeviceClient.php b/src/UserManagement/AudienceDeviceClient.php index 4395e04..545c4b3 100644 --- a/src/UserManagement/AudienceDeviceClient.php +++ b/src/UserManagement/AudienceDeviceClient.php @@ -3,10 +3,10 @@ namespace LiveStyled\UserManagement; -use LiveStyled\Client; use LiveStyled\CrudClient; +use LiveStyled\RelationClient; -class AudienceDeviceClient extends Client implements CrudClient +class AudienceDeviceClient extends RelationClient implements CrudClient { protected function getPath() { From 74ca5cfb842ac7331c5d1d1af476e6a0b3d70828 Mon Sep 17 00:00:00 2001 From: yaroslav Date: Tue, 12 Jan 2021 15:50:59 +0200 Subject: [PATCH 5/5] add-audience-device-client: removed redundant interface --- src/RelationClientInterface.php | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 src/RelationClientInterface.php diff --git a/src/RelationClientInterface.php b/src/RelationClientInterface.php deleted file mode 100644 index bac6cf0..0000000 --- a/src/RelationClientInterface.php +++ /dev/null @@ -1,24 +0,0 @@ -