����JFIF��x�x����'
| Server IP : 78.140.185.180 / Your IP : 216.73.216.169 Web Server : LiteSpeed System : Linux cpanel13.v.fozzy.com 4.18.0-513.11.1.lve.el8.x86_64 #1 SMP Thu Jan 18 16:21:02 UTC 2024 x86_64 User : builderbox ( 1072) PHP Version : 7.3.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/builderbox/./././public_html/vendor/algolia/algoliasearch-client-php/src/ |
Upload File : |
<?php
namespace Algolia\AlgoliaSearch;
use Algolia\AlgoliaSearch\Config\InsightsConfig;
use Algolia\AlgoliaSearch\Insights\UserInsightsClient;
use Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper;
use Algolia\AlgoliaSearch\RetryStrategy\ClusterHosts;
final class InsightsClient
{
/**
* @var \Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper
*/
private $api;
/**
* @var \Algolia\AlgoliaSearch\Config\InsightsConfig
*/
private $config;
public function __construct(ApiWrapper $api, InsightsConfig $config)
{
$this->api = $api;
$this->config = $config;
}
public static function create($appId = null, $apiKey = null, $region = null)
{
$config = InsightsConfig::create($appId, $apiKey, $region);
return static::createWithConfig($config);
}
public static function createWithConfig(InsightsConfig $config)
{
$config = clone $config;
if ($hosts = $config->getHosts()) {
// If a list of hosts was passed, we ignore the cache
$clusterHosts = ClusterHosts::create($hosts);
} else {
$clusterHosts = ClusterHosts::createForInsights($config->getRegion());
}
$apiWrapper = new ApiWrapper(
Algolia::getHttpClient(),
$config,
$clusterHosts
);
return new static($apiWrapper, $config);
}
public function user($userToken)
{
return new UserInsightsClient($this, $userToken);
}
public function sendEvent($event, $requestOptions = [])
{
return $this->sendEvents([$event], $requestOptions);
}
public function sendEvents($events, $requestOptions = [])
{
$payload = ['events' => $events];
return $this->api->write('POST', api_path('/1/events'), $payload, $requestOptions);
}
}