From 06e34486acb09f6a28a322db0eee10ea1c564d01 Mon Sep 17 00:00:00 2001 From: Vitaly Bormotov Date: Tue, 27 Jun 2023 09:35:39 +0500 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D1=8B=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4=D1=8B=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=BA=D0=B8=20=D0=B4=D0=B0=D0=BD?= =?UTF-8?q?=D0=BD=D1=8B=D1=85=20=D0=B2=D0=B5=D0=B1-=D0=B0=D0=BD=D0=B0?= =?UTF-8?q?=D0=BB=D0=B8=D1=82=D0=B8=D0=BA=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Client.php | 12 +++ src/Model/Entity/WebAnalytics/ClientId.php | 62 +++++++++++++ src/Model/Entity/WebAnalytics/Customer.php | 46 +++++++++ src/Model/Entity/WebAnalytics/Order.php | 46 +++++++++ src/Model/Entity/WebAnalytics/Source.php | 93 +++++++++++++++++++ .../WebAnalytics/ClientIdUploadRequest.php | 43 +++++++++ .../WebAnalytics/SourcesUploadRequest.php | 43 +++++++++ .../WebAnalytics/ClientIdUploadResponse.php | 30 ++++++ .../WebAnalytics/SourcesUploadResponse.php | 30 ++++++ src/ResourceGroup/WebAnalytics.php | 81 ++++++++++++++++ 10 files changed, 486 insertions(+) create mode 100644 src/Model/Entity/WebAnalytics/ClientId.php create mode 100644 src/Model/Entity/WebAnalytics/Customer.php create mode 100644 src/Model/Entity/WebAnalytics/Order.php create mode 100644 src/Model/Entity/WebAnalytics/Source.php create mode 100644 src/Model/Request/WebAnalytics/ClientIdUploadRequest.php create mode 100644 src/Model/Request/WebAnalytics/SourcesUploadRequest.php create mode 100644 src/Model/Response/WebAnalytics/ClientIdUploadResponse.php create mode 100644 src/Model/Response/WebAnalytics/SourcesUploadResponse.php create mode 100644 src/ResourceGroup/WebAnalytics.php diff --git a/src/Client.php b/src/Client.php index 4615843..e80617f 100644 --- a/src/Client.php +++ b/src/Client.php @@ -40,6 +40,7 @@ use RetailCrm\Api\ResourceGroup\Tasks; use RetailCrm\Api\ResourceGroup\Telephony; use RetailCrm\Api\ResourceGroup\Users; use RetailCrm\Api\ResourceGroup\Verification; +use RetailCrm\Api\ResourceGroup\WebAnalytics; /** * Class Client @@ -125,6 +126,9 @@ class Client /** @var \RetailCrm\Api\ResourceGroup\CustomMethods */ public $customMethods; + /** @var \RetailCrm\Api\ResourceGroup\WebAnalytics */ + public $webAnalytics; + /** @var StreamFactoryInterface */ private $streamFactory; @@ -339,6 +343,14 @@ class Client $eventDispatcher, $logger ); + $this->webAnalytics = new WebAnalytics( + $url, + $httpClient, + $requestTransformer, + $responseTransformer, + $eventDispatcher, + $logger + ); } /** diff --git a/src/Model/Entity/WebAnalytics/ClientId.php b/src/Model/Entity/WebAnalytics/ClientId.php new file mode 100644 index 0000000..1a12a90 --- /dev/null +++ b/src/Model/Entity/WebAnalytics/ClientId.php @@ -0,0 +1,62 @@ +") + * @JMS\SerializedName("createdAt") + */ + public $createdAt; +} diff --git a/src/Model/Entity/WebAnalytics/Customer.php b/src/Model/Entity/WebAnalytics/Customer.php new file mode 100644 index 0000000..a00d81e --- /dev/null +++ b/src/Model/Entity/WebAnalytics/Customer.php @@ -0,0 +1,46 @@ +") + * @Form\SerializedName("clientIds") + * @Form\JsonField() + */ + public $clientIds; + + /** + * ClientIdUploadRequest constructor. + * + * @param \RetailCrm\Api\Model\Entity\WebAnalytics\ClientId[]|null $clientIds + */ + public function __construct(?array $clientIds = null) + { + if (null !== $clientIds) { + $this->clientIds = $clientIds; + } + } +} diff --git a/src/Model/Request/WebAnalytics/SourcesUploadRequest.php b/src/Model/Request/WebAnalytics/SourcesUploadRequest.php new file mode 100644 index 0000000..046e075 --- /dev/null +++ b/src/Model/Request/WebAnalytics/SourcesUploadRequest.php @@ -0,0 +1,43 @@ +") + * @Form\SerializedName("sources") + * @Form\JsonField() + */ + public $sources; + + /** + * SourcesUploadRequest constructor. + * + * @param \RetailCrm\Api\Model\Entity\WebAnalytics\Source[]|null $sources + */ + public function __construct(?array $sources = null) + { + if (null !== $sources) { + $this->sources = $sources; + } + } +} diff --git a/src/Model/Response/WebAnalytics/ClientIdUploadResponse.php b/src/Model/Response/WebAnalytics/ClientIdUploadResponse.php new file mode 100644 index 0000000..30b6b05 --- /dev/null +++ b/src/Model/Response/WebAnalytics/ClientIdUploadResponse.php @@ -0,0 +1,30 @@ +") + * @JMS\SerializedName("failedClientIds") + */ + public $failedClientIds; +} diff --git a/src/Model/Response/WebAnalytics/SourcesUploadResponse.php b/src/Model/Response/WebAnalytics/SourcesUploadResponse.php new file mode 100644 index 0000000..170d3c1 --- /dev/null +++ b/src/Model/Response/WebAnalytics/SourcesUploadResponse.php @@ -0,0 +1,30 @@ +") + * @JMS\SerializedName("failedSources") + */ + public $failedSources; +} diff --git a/src/ResourceGroup/WebAnalytics.php b/src/ResourceGroup/WebAnalytics.php new file mode 100644 index 0000000..cf85087 --- /dev/null +++ b/src/ResourceGroup/WebAnalytics.php @@ -0,0 +1,81 @@ +sendRequest( + RequestMethod::POST, + 'web-analytics/sources/upload', + $request, + SourcesUploadResponse::class + ); + + return $response; + } + + /** + * @param \RetailCrm\Api\Model\Request\WebAnalytics\ClientIdUploadRequest $request + * + * @return \RetailCrm\Api\Model\Response\WebAnalytics\ClientIdUploadResponse + * @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface + * @throws \RetailCrm\Api\Interfaces\ClientExceptionInterface + * @throws \RetailCrm\Api\Exception\Api\AccountDoesNotExistException + * @throws \RetailCrm\Api\Exception\Api\ApiErrorException + * @throws \RetailCrm\Api\Exception\Api\MissingCredentialsException + * @throws \RetailCrm\Api\Exception\Api\MissingParameterException + * @throws \RetailCrm\Api\Exception\Api\ValidationException + * @throws \RetailCrm\Api\Exception\Client\HandlerException + * @throws \RetailCrm\Api\Exception\Client\HttpClientException + */ + public function clientIdsUpload(ClientIdUploadRequest $request): ClientIdUploadResponse + { + /** @var ClientIdUploadResponse $response */ + $response = $this->sendRequest( + RequestMethod::POST, + 'web-analytics/client-ids/upload', + $request, + ClientIdUploadResponse::class + ); + + return $response; + } +}