vendor/typesense/typesense-php/src/Client.php line 84

Open in your IDE?
  1. <?php
  2. namespace Typesense;
  3. use Typesense\Exceptions\ConfigError;
  4. use Typesense\Lib\Configuration;
  5. /**
  6.  * Class Client
  7.  *
  8.  * @package \Typesense
  9.  * @date    4/5/20
  10.  * @author  Abdullah Al-Faqeir <abdullah@devloops.net>
  11.  */
  12. class Client
  13. {
  14.     /**
  15.      * @var Configuration
  16.      */
  17.     private Configuration $config;
  18.     /**
  19.      * @var Collections
  20.      */
  21.     public Collections $collections;
  22.     /**
  23.      * @var Aliases
  24.      */
  25.     public Aliases $aliases;
  26.     /**
  27.      * @var Keys
  28.      */
  29.     public Keys $keys;
  30.     /**
  31.      * @var Debug
  32.      */
  33.     public Debug $debug;
  34.     /**
  35.      * @var Metrics
  36.      */
  37.     public Metrics $metrics;
  38.     /**
  39.      * @var Health
  40.      */
  41.     public Health $health;
  42.     /**
  43.      * @var Operations
  44.      */
  45.     public Operations $operations;
  46.     /**
  47.      * @var MultiSearch
  48.      */
  49.     public MultiSearch $multiSearch;
  50.     /**
  51.      * @var Presets
  52.      */
  53.     public Presets $presets;
  54.     /**
  55.      * @var Analytics
  56.      */
  57.     public Analytics $analytics;
  58.     /**
  59.      * @var ApiCall
  60.      */
  61.     private ApiCall $apiCall;
  62.     /**
  63.      * Client constructor.
  64.      *
  65.      * @param array $config
  66.      *
  67.      * @throws ConfigError
  68.      */
  69.     public function __construct(array $config)
  70.     {
  71.         $this->config  = new Configuration($config);
  72.         $this->apiCall = new ApiCall($this->config);
  73.         $this->collections = new Collections($this->apiCall);
  74.         $this->aliases     = new Aliases($this->apiCall);
  75.         $this->keys        = new Keys($this->apiCall);
  76.         $this->debug       = new Debug($this->apiCall);
  77.         $this->metrics     = new Metrics($this->apiCall);
  78.         $this->health      = new Health($this->apiCall);
  79.         $this->operations  = new Operations($this->apiCall);
  80.         $this->multiSearch = new MultiSearch($this->apiCall);
  81.         $this->presets     = new Presets($this->apiCall);
  82.         $this->analytics   = new Analytics($this->apiCall);
  83.     }
  84.     /**
  85.      * @return Collections
  86.      */
  87.     public function getCollections(): Collections
  88.     {
  89.         return $this->collections;
  90.     }
  91.     /**
  92.      * @return Aliases
  93.      */
  94.     public function getAliases(): Aliases
  95.     {
  96.         return $this->aliases;
  97.     }
  98.     /**
  99.      * @return Keys
  100.      */
  101.     public function getKeys(): Keys
  102.     {
  103.         return $this->keys;
  104.     }
  105.     /**
  106.      * @return Debug
  107.      */
  108.     public function getDebug(): Debug
  109.     {
  110.         return $this->debug;
  111.     }
  112.     /**
  113.      * @return Metrics
  114.      */
  115.     public function getMetrics(): Metrics
  116.     {
  117.         return $this->metrics;
  118.     }
  119.     /**
  120.      * @return Health
  121.      */
  122.     public function getHealth(): Health
  123.     {
  124.         return $this->health;
  125.     }
  126.     /**
  127.      * @return Operations
  128.      */
  129.     public function getOperations(): Operations
  130.     {
  131.         return $this->operations;
  132.     }
  133.     /**
  134.      * @return MultiSearch
  135.      */
  136.     public function getMultiSearch(): MultiSearch
  137.     {
  138.         return $this->multiSearch;
  139.     }
  140.     /**
  141.      * @return Presets
  142.      */
  143.     public function getPresets(): Presets
  144.     {
  145.         return $this->presets;
  146.     }
  147.     /**
  148.      * @return Analytics
  149.      */
  150.     public function getAnalytics(): Analytics
  151.     {
  152.         return $this->analytics;
  153.     }
  154. }