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; + } +}