diff --git a/clients/algoliasearch-client-php/composer.json b/clients/algoliasearch-client-php/composer.json index f7ff1822e9..4bd465a2e3 100644 --- a/clients/algoliasearch-client-php/composer.json +++ b/clients/algoliasearch-client-php/composer.json @@ -1,6 +1,6 @@ { "name": "algolia/algoliasearch-client-php", - "description": "API powering the Search feature of Algolia.", + "description": "API powering the features of Algolia.", "keywords": [ "openapitools", "openapi-generator", diff --git a/clients/algoliasearch-client-php/lib/Api/AbtestingApi.php b/clients/algoliasearch-client-php/lib/Api/AbtestingApi.php new file mode 100644 index 0000000000..2e9a51fc3b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/AbtestingApi.php @@ -0,0 +1,374 @@ +config = $config; + + $this->api = $apiWrapper; + $this->headerSelector = new HeaderSelector(); + } + + /** + * Instantiate the client with basic credentials and region + * + * @param string $appId Application ID + * @param string $apiKey Algolia API Key + * @param string $region Region + */ + public static function create($appId = null, $apiKey = null, $region = null) + { + $allowedRegions = explode('-', 'us-de'); + $config = AbTestingConfig::create($appId, $apiKey, $region, $allowedRegions); + + return static::createWithConfig($config); + } + + /** + * Instantiate the client with congiguration + * + * @param AbTestingConfig $config Configuration + */ + public static function createWithConfig(AbTestingConfig $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::createForAnalytics($config->getAppId()); + } + + $apiWrapper = new ApiWrapper( + Algolia::getHttpClient(), + $config, + $clusterHosts + ); + + return new static($apiWrapper, $config); + } + + /** + * @return AbTestingConfig + */ + public function getClientConfig() + { + return $this->config; + } + + /** + * Operation addABTests + * + * Creates a new A/B test with provided configuration. + * + * @param \Algolia\AlgoliaSearch\Model\AddABTestsRequest $addABTestsRequest addABTestsRequest (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\ABTestResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function addABTests($addABTestsRequest) + { + // verify the required parameter 'addABTestsRequest' is set + if ($addABTestsRequest === null || (is_array($addABTestsRequest) && count($addABTestsRequest) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $addABTestsRequest when calling addABTests' + ); + } + + $resourcePath = '/2/abtests'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + if (isset($addABTestsRequest)) { + $httpBody = $addABTestsRequest; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + } + /** + * Operation deleteABTest + * + * Deletes the A/B Test. + * + * @param int $id The A/B test ID. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\ABTestResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function deleteABTest($id) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling deleteABTest' + ); + } + + $resourcePath = '/2/abtests/{id}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + } + /** + * Operation getABTest + * + * Returns metadata and metrics for A/B test id. + * + * @param int $id The A/B test ID. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\ABTest|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getABTest($id) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling getABTest' + ); + } + + $resourcePath = '/2/abtests/{id}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation listABTests + * + * Fetch all existing A/B tests for App that are available for the current API Key. + * + * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\ListABTestsResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function listABTests($offset = 0, $limit = 10) + { + $resourcePath = '/2/abtests'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($offset)) { + $offset = ObjectSerializer::serializeCollection($offset, '', true); + } + if ($offset !== null) { + $queryParams['offset'] = $offset; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation stopABTest + * + * Marks the A/B test as stopped. + * + * @param int $id The A/B test ID. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\ABTestResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function stopABTest($id) + { + // verify the required parameter 'id' is set + if ($id === null || (is_array($id) && count($id) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $id when calling stopABTest' + ); + } + + $resourcePath = '/2/abtests/{id}/stop'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($id !== null) { + $resourcePath = str_replace( + '{' . 'id' . '}', + ObjectSerializer::toPathValue($id), + $resourcePath + ); + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + } + + private function sendRequest($method, $resourcePath, $query, $httpBody) + { + if ($method === 'GET') { + $request = $this->api->read( + $method, + $resourcePath . ($query ? "?{$query}" : '') + ); + } else { + $request = $this->api->write( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody + ); + } + + return $request; + } +} diff --git a/clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php b/clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php new file mode 100644 index 0000000000..27530eed23 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php @@ -0,0 +1,1701 @@ +config = $config; + + $this->api = $apiWrapper; + $this->headerSelector = new HeaderSelector(); + } + + /** + * Instantiate the client with basic credentials and region + * + * @param string $appId Application ID + * @param string $apiKey Algolia API Key + * @param string $region Region + */ + public static function create($appId = null, $apiKey = null, $region = null) + { + $allowedRegions = explode('-', 'us-de'); + $config = AnalyticsConfig::create($appId, $apiKey, $region, $allowedRegions); + + return static::createWithConfig($config); + } + + /** + * Instantiate the client with congiguration + * + * @param AnalyticsConfig $config Configuration + */ + public static function createWithConfig(AnalyticsConfig $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::createForAnalytics($config->getAppId()); + } + + $apiWrapper = new ApiWrapper( + Algolia::getHttpClient(), + $config, + $clusterHosts + ); + + return new static($apiWrapper, $config); + } + + /** + * @return AnalyticsConfig + */ + public function getClientConfig() + { + return $this->config; + } + + /** + * Operation getAverageClickPosition + * + * Returns the average click position. + * + * @param string $index The index name to target. (required) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetAverageClickPositionResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getAverageClickPosition($index, $startDate = null, $endDate = null, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getAverageClickPosition' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getAverageClickPosition, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getAverageClickPosition, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/clicks/averageClickPosition'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getClickPositions + * + * Returns the distribution of clicks per range of positions. + * + * @param string $index The index name to target. (required) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetClickPositionsResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getClickPositions($index, $startDate = null, $endDate = null, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getClickPositions' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getClickPositions, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getClickPositions, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/clicks/positions'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getClickThroughRate + * + * Returns a click-through rate (CTR). + * + * @param string $index The index name to target. (required) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetClickThroughRateResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getClickThroughRate($index, $startDate = null, $endDate = null, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getClickThroughRate' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getClickThroughRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getClickThroughRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/clicks/clickThroughRate'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getConversationRate + * + * Returns a conversion rate (CR). + * + * @param string $index The index name to target. (required) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetConversationRateResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getConversationRate($index, $startDate = null, $endDate = null, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getConversationRate' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getConversationRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getConversationRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/conversions/conversionRate'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getNoClickRate + * + * Returns the rate at which searches didn't lead to any clicks. + * + * @param string $index The index name to target. (required) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetNoClickRateResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getNoClickRate($index, $startDate = null, $endDate = null, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getNoClickRate' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getNoClickRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getNoClickRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/searches/noClickRate'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getNoResultsRate + * + * Returns the rate at which searches didn't return any results. + * + * @param string $index The index name to target. (required) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetNoResultsRateResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getNoResultsRate($index, $startDate = null, $endDate = null, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getNoResultsRate' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getNoResultsRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getNoResultsRate, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/searches/noResultRate'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getSearchesCount + * + * Returns the number of searches across the given time range. + * + * @param string $index The index name to target. (required) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetSearchesCountResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getSearchesCount($index, $startDate = null, $endDate = null, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getSearchesCount' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getSearchesCount, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getSearchesCount, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/searches/count'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getSearchesNoClicks + * + * Returns top searches that didn't lead to any clicks. + * + * @param string $index The index name to target. (required) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) + * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetSearchesNoClicksResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getSearchesNoClicks($index, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getSearchesNoClicks' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getSearchesNoClicks, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getSearchesNoClicks, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/searches/noClicks'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + if (is_array($offset)) { + $offset = ObjectSerializer::serializeCollection($offset, '', true); + } + if ($offset !== null) { + $queryParams['offset'] = $offset; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getSearchesNoResults + * + * Returns top searches that didn't return any results. + * + * @param string $index The index name to target. (required) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) + * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetSearchesNoResultsResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getSearchesNoResults($index, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getSearchesNoResults' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getSearchesNoResults, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getSearchesNoResults, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/searches/noResults'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + if (is_array($offset)) { + $offset = ObjectSerializer::serializeCollection($offset, '', true); + } + if ($offset !== null) { + $queryParams['offset'] = $offset; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getStatus + * + * Get latest update time of the analytics API. + * + * @param string $index The index name to target. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetStatusResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getStatus($index) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getStatus' + ); + } + + $resourcePath = '/2/status'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getTopCountries + * + * Returns top countries. + * + * @param string $index The index name to target. (required) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) + * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetTopCountriesResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getTopCountries($index, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getTopCountries' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopCountries, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopCountries, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/countries'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + if (is_array($offset)) { + $offset = ObjectSerializer::serializeCollection($offset, '', true); + } + if ($offset !== null) { + $queryParams['offset'] = $offset; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getTopFilterAttributes + * + * Returns top filter attributes. + * + * @param string $index The index name to target. (required) + * @param string $search The query term to search for. Must match the exact user input. (optional) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) + * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetTopFilterAttributesResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getTopFilterAttributes($index, $search = null, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getTopFilterAttributes' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopFilterAttributes, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopFilterAttributes, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/filters'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($search)) { + $search = ObjectSerializer::serializeCollection($search, '', true); + } + if ($search !== null) { + $queryParams['search'] = $search; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + if (is_array($offset)) { + $offset = ObjectSerializer::serializeCollection($offset, '', true); + } + if ($offset !== null) { + $queryParams['offset'] = $offset; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getTopFilterForAttribute + * + * Returns top filters for the given attribute. + * + * @param string $attribute The exact name of the attribute. (required) + * @param string $index The index name to target. (required) + * @param string $search The query term to search for. Must match the exact user input. (optional) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) + * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetTopFilterForAttributeResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getTopFilterForAttribute($attribute, $index, $search = null, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) + { + // verify the required parameter 'attribute' is set + if ($attribute === null || (is_array($attribute) && count($attribute) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $attribute when calling getTopFilterForAttribute' + ); + } + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getTopFilterForAttribute' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopFilterForAttribute, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopFilterForAttribute, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/filters/{attribute}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($search)) { + $search = ObjectSerializer::serializeCollection($search, '', true); + } + if ($search !== null) { + $queryParams['search'] = $search; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + if (is_array($offset)) { + $offset = ObjectSerializer::serializeCollection($offset, '', true); + } + if ($offset !== null) { + $queryParams['offset'] = $offset; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + // path params + if ($attribute !== null) { + $resourcePath = str_replace( + '{' . 'attribute' . '}', + ObjectSerializer::toPathValue($attribute), + $resourcePath + ); + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getTopFiltersNoResults + * + * Returns top filters with no results. + * + * @param string $index The index name to target. (required) + * @param string $search The query term to search for. Must match the exact user input. (optional) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) + * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetTopFiltersNoResultsResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getTopFiltersNoResults($index, $search = null, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getTopFiltersNoResults' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopFiltersNoResults, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopFiltersNoResults, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/filters/noResults'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($search)) { + $search = ObjectSerializer::serializeCollection($search, '', true); + } + if ($search !== null) { + $queryParams['search'] = $search; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + if (is_array($offset)) { + $offset = ObjectSerializer::serializeCollection($offset, '', true); + } + if ($offset !== null) { + $queryParams['offset'] = $offset; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getTopHits + * + * Returns top hits. + * + * @param string $index The index name to target. (required) + * @param string $search The query term to search for. Must match the exact user input. (optional) + * @param bool $clickAnalytics Whether to include the click-through and conversion rates for a search. (optional, default to false) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) + * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return OneOfGetTopHitsResponseGetTopHitsResponseWithAnalytics|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getTopHits($index, $search = null, $clickAnalytics = false, $startDate = null, $endDate = null, $limit = 10, $offset = 0, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getTopHits' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopHits, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopHits, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/hits'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($search)) { + $search = ObjectSerializer::serializeCollection($search, '', true); + } + if ($search !== null) { + $queryParams['search'] = $search; + } + // query params + if (is_array($clickAnalytics)) { + $clickAnalytics = ObjectSerializer::serializeCollection($clickAnalytics, '', true); + } + if ($clickAnalytics !== null) { + $queryParams['clickAnalytics'] = $clickAnalytics; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + if (is_array($offset)) { + $offset = ObjectSerializer::serializeCollection($offset, '', true); + } + if ($offset !== null) { + $queryParams['offset'] = $offset; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getTopSearches + * + * Returns top searches. + * + * @param string $index The index name to target. (required) + * @param bool $clickAnalytics Whether to include the click-through and conversion rates for a search. (optional, default to false) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $orderBy Reorder the results. (optional, default to 'searchCount') + * @param string $direction The sorting of the result. (optional, default to 'asc') + * @param int $limit Number of records to return. Limit is the size of the page. (optional, default to 10) + * @param int $offset Position of the starting record. Used for paging. 0 is the first record. (optional, default to 0) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return OneOfGetTopSearchesResponseGetTopSearchesResponseWithAnalytics|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getTopSearches($index, $clickAnalytics = false, $startDate = null, $endDate = null, $orderBy = 'searchCount', $direction = 'asc', $limit = 10, $offset = 0, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getTopSearches' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getTopSearches, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getTopSearches, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/searches'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($clickAnalytics)) { + $clickAnalytics = ObjectSerializer::serializeCollection($clickAnalytics, '', true); + } + if ($clickAnalytics !== null) { + $queryParams['clickAnalytics'] = $clickAnalytics; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($orderBy)) { + $orderBy = ObjectSerializer::serializeCollection($orderBy, '', true); + } + if ($orderBy !== null) { + $queryParams['orderBy'] = $orderBy; + } + // query params + if (is_array($direction)) { + $direction = ObjectSerializer::serializeCollection($direction, '', true); + } + if ($direction !== null) { + $queryParams['direction'] = $direction; + } + // query params + if (is_array($limit)) { + $limit = ObjectSerializer::serializeCollection($limit, '', true); + } + if ($limit !== null) { + $queryParams['limit'] = $limit; + } + // query params + if (is_array($offset)) { + $offset = ObjectSerializer::serializeCollection($offset, '', true); + } + if ($offset !== null) { + $queryParams['offset'] = $offset; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getUsersCount + * + * Returns the distinct count of users across the given time range. + * + * @param string $index The index name to target. (required) + * @param string $startDate The lower bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $endDate The upper bound timestamp (a date, a string like \"2006-01-02\") of the period to analyze. (optional) + * @param string $tags Filter metrics on the provided tags. Each tag must correspond to an analyticsTags set at search time. Multiple tags can be combined with the operators OR and AND. If a tag contains characters like spaces or parentheses, it should be URL encoded. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetUsersCountResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getUsersCount($index, $startDate = null, $endDate = null, $tags = null) + { + // verify the required parameter 'index' is set + if ($index === null || (is_array($index) && count($index) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $index when calling getUsersCount' + ); + } + if ($startDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $startDate)) { + throw new \InvalidArgumentException('invalid value for "startDate" when calling AnalyticsApi.getUsersCount, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + if ($endDate !== null && !preg_match('/^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/', $endDate)) { + throw new \InvalidArgumentException('invalid value for "endDate" when calling AnalyticsApi.getUsersCount, must conform to the pattern /^\\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$/.'); + } + + $resourcePath = '/2/users/count'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // query params + if (is_array($index)) { + $index = ObjectSerializer::serializeCollection($index, '', true); + } + if ($index !== null) { + $queryParams['index'] = $index; + } + // query params + if (is_array($startDate)) { + $startDate = ObjectSerializer::serializeCollection($startDate, '', true); + } + if ($startDate !== null) { + $queryParams['startDate'] = $startDate; + } + // query params + if (is_array($endDate)) { + $endDate = ObjectSerializer::serializeCollection($endDate, '', true); + } + if ($endDate !== null) { + $queryParams['endDate'] = $endDate; + } + // query params + if (is_array($tags)) { + $tags = ObjectSerializer::serializeCollection($tags, '', true); + } + if ($tags !== null) { + $queryParams['tags'] = $tags; + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + + private function sendRequest($method, $resourcePath, $query, $httpBody) + { + if ($method === 'GET') { + $request = $this->api->read( + $method, + $resourcePath . ($query ? "?{$query}" : '') + ); + } else { + $request = $this->api->write( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody + ); + } + + return $request; + } +} diff --git a/clients/algoliasearch-client-php/lib/Api/InsightsApi.php b/clients/algoliasearch-client-php/lib/Api/InsightsApi.php new file mode 100644 index 0000000000..56986c96fa --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/InsightsApi.php @@ -0,0 +1,161 @@ +config = $config; + + $this->api = $apiWrapper; + $this->headerSelector = new HeaderSelector(); + } + + /** + * Instantiate the client with basic credentials and region + * + * @param string $appId Application ID + * @param string $apiKey Algolia API Key + * @param string $region Region + */ + public static function create($appId = null, $apiKey = null, $region = null) + { + $allowedRegions = explode('-', 'us-de'); + $config = InsightsConfig::create($appId, $apiKey, $region, $allowedRegions); + + return static::createWithConfig($config); + } + + /** + * Instantiate the client with congiguration + * + * @param InsightsConfig $config Configuration + */ + 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->getAppId()); + } + + $apiWrapper = new ApiWrapper( + Algolia::getHttpClient(), + $config, + $clusterHosts + ); + + return new static($apiWrapper, $config); + } + + /** + * @return InsightsConfig + */ + public function getClientConfig() + { + return $this->config; + } + + /** + * Operation pushEvents + * + * Pushes an array of events. + * + * @param \Algolia\AlgoliaSearch\Model\InsightEvents $insightEvents insightEvents (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\PushEventsResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function pushEvents($insightEvents) + { + // verify the required parameter 'insightEvents' is set + if ($insightEvents === null || (is_array($insightEvents) && count($insightEvents) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $insightEvents when calling pushEvents' + ); + } + + $resourcePath = '/1/events'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + if (isset($insightEvents)) { + $httpBody = $insightEvents; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + } + + private function sendRequest($method, $resourcePath, $query, $httpBody) + { + if ($method === 'GET') { + $request = $this->api->read( + $method, + $resourcePath . ($query ? "?{$query}" : '') + ); + } else { + $request = $this->api->write( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody + ); + } + + return $request; + } +} diff --git a/clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php b/clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php new file mode 100644 index 0000000000..00979a65df --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php @@ -0,0 +1,305 @@ +config = $config; + + $this->api = $apiWrapper; + $this->headerSelector = new HeaderSelector(); + } + + /** + * Instantiate the client with basic credentials and region + * + * @param string $appId Application ID + * @param string $apiKey Algolia API Key + * @param string $region Region + */ + public static function create($appId = null, $apiKey = null, $region = null) + { + $allowedRegions = explode('-', 'us-eu'); + $config = PersonalizationConfig::create($appId, $apiKey, $region, $allowedRegions); + + return static::createWithConfig($config); + } + + /** + * Instantiate the client with congiguration + * + * @param PersonalizationConfig $config Configuration + */ + public static function createWithConfig(PersonalizationConfig $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::createForRecommendation($config->getAppId()); + } + + $apiWrapper = new ApiWrapper( + Algolia::getHttpClient(), + $config, + $clusterHosts + ); + + return new static($apiWrapper, $config); + } + + /** + * @return PersonalizationConfig + */ + public function getClientConfig() + { + return $this->config; + } + + /** + * Operation deleteUserProfile + * + * Delete the user profile and all its associated data. + * + * @param string $userToken userToken representing the user for which to fetch the Personalization profile. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\DeleteUserProfileResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function deleteUserProfile($userToken) + { + // verify the required parameter 'userToken' is set + if ($userToken === null || (is_array($userToken) && count($userToken) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $userToken when calling deleteUserProfile' + ); + } + + $resourcePath = '/1/profiles/{userToken}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($userToken !== null) { + $resourcePath = str_replace( + '{' . 'userToken' . '}', + ObjectSerializer::toPathValue($userToken), + $resourcePath + ); + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + } + /** + * Operation getPersonalizationStrategy + * + * Get the current personalization strategy. + * + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\PersonalizationStrategyObject|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getPersonalizationStrategy() + { + $resourcePath = '/1/strategies/personalization'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getUserTokenProfile + * + * Get the user profile built from Personalization strategy. + * + * @param string $userToken userToken representing the user for which to fetch the Personalization profile. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetUserTokenResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getUserTokenProfile($userToken) + { + // verify the required parameter 'userToken' is set + if ($userToken === null || (is_array($userToken) && count($userToken) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $userToken when calling getUserTokenProfile' + ); + } + + $resourcePath = '/1/profiles/personalization/{userToken}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($userToken !== null) { + $resourcePath = str_replace( + '{' . 'userToken' . '}', + ObjectSerializer::toPathValue($userToken), + $resourcePath + ); + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation setPersonalizationStrategy + * + * Set a new personalization strategy. + * + * @param \Algolia\AlgoliaSearch\Model\PersonalizationStrategyObject $personalizationStrategyObject personalizationStrategyObject (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\SetPersonalizationStrategyResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function setPersonalizationStrategy($personalizationStrategyObject) + { + // verify the required parameter 'personalizationStrategyObject' is set + if ($personalizationStrategyObject === null || (is_array($personalizationStrategyObject) && count($personalizationStrategyObject) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $personalizationStrategyObject when calling setPersonalizationStrategy' + ); + } + + $resourcePath = '/1/strategies/personalization'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + if (isset($personalizationStrategyObject)) { + $httpBody = $personalizationStrategyObject; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + } + + private function sendRequest($method, $resourcePath, $query, $httpBody) + { + if ($method === 'GET') { + $request = $this->api->read( + $method, + $resourcePath . ($query ? "?{$query}" : '') + ); + } else { + $request = $this->api->write( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody + ); + } + + return $request; + } +} diff --git a/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php b/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php new file mode 100644 index 0000000000..6c6cce5669 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php @@ -0,0 +1,460 @@ +config = $config; + + $this->api = $apiWrapper; + $this->headerSelector = new HeaderSelector(); + } + + /** + * Instantiate the client with basic credentials and region + * + * @param string $appId Application ID + * @param string $apiKey Algolia API Key + * @param string $region Region + */ + public static function create($appId = null, $apiKey = null, $region = null) + { + $allowedRegions = explode('-', 'us-eu'); + $config = QuerySuggestionsConfig::create($appId, $apiKey, $region, $allowedRegions); + + return static::createWithConfig($config); + } + + /** + * Instantiate the client with congiguration + * + * @param QuerySuggestionsConfig $config Configuration + */ + public static function createWithConfig(QuerySuggestionsConfig $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::createForQuerySuggestions($config->getAppId()); + } + + $apiWrapper = new ApiWrapper( + Algolia::getHttpClient(), + $config, + $clusterHosts + ); + + return new static($apiWrapper, $config); + } + + /** + * @return QuerySuggestionsConfig + */ + public function getClientConfig() + { + return $this->config; + } + + /** + * Operation createConfig + * + * @param \Algolia\AlgoliaSearch\Model\QuerySuggestionsIndexWithIndexParam $querySuggestionsIndexWithIndexParam querySuggestionsIndexWithIndexParam (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\SucessResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function createConfig($querySuggestionsIndexWithIndexParam) + { + // verify the required parameter 'querySuggestionsIndexWithIndexParam' is set + if ($querySuggestionsIndexWithIndexParam === null || (is_array($querySuggestionsIndexWithIndexParam) && count($querySuggestionsIndexWithIndexParam) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $querySuggestionsIndexWithIndexParam when calling createConfig' + ); + } + + $resourcePath = '/1/configs'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + if (isset($querySuggestionsIndexWithIndexParam)) { + $httpBody = $querySuggestionsIndexWithIndexParam; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + } + /** + * Operation deleteConfig + * + * @param string $indexName The index in which to perform the request. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\SucessResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function deleteConfig($indexName) + { + // verify the required parameter 'indexName' is set + if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $indexName when calling deleteConfig' + ); + } + + $resourcePath = '/1/configs/{indexName}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('DELETE', $resourcePath, $query, $httpBody); + } + /** + * Operation getAllConfigs + * + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\QuerySuggestionsIndex[]|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getAllConfigs() + { + $resourcePath = '/1/configs'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getConfig + * + * @param string $indexName The index in which to perform the request. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\QuerySuggestionsIndex|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getConfig($indexName) + { + // verify the required parameter 'indexName' is set + if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $indexName when calling getConfig' + ); + } + + $resourcePath = '/1/configs/{indexName}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getConfigStatus + * + * @param string $indexName The index in which to perform the request. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Status|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getConfigStatus($indexName) + { + // verify the required parameter 'indexName' is set + if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $indexName when calling getConfigStatus' + ); + } + + $resourcePath = '/1/configs/{indexName}/status'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation getLogFile + * + * @param string $indexName The index in which to perform the request. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\LogFile[]|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getLogFile($indexName) + { + // verify the required parameter 'indexName' is set + if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $indexName when calling getLogFile' + ); + } + + $resourcePath = '/1/logs/{indexName}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + [] + ); + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('GET', $resourcePath, $query, $httpBody); + } + /** + * Operation updateConfig + * + * @param string $indexName The index in which to perform the request. (required) + * @param \Algolia\AlgoliaSearch\Model\QuerySuggestionsIndexParam $querySuggestionsIndexParam querySuggestionsIndexParam (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\SucessResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function updateConfig($indexName, $querySuggestionsIndexParam) + { + // verify the required parameter 'indexName' is set + if ($indexName === null || (is_array($indexName) && count($indexName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $indexName when calling updateConfig' + ); + } + // verify the required parameter 'querySuggestionsIndexParam' is set + if ($querySuggestionsIndexParam === null || (is_array($querySuggestionsIndexParam) && count($querySuggestionsIndexParam) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $querySuggestionsIndexParam when calling updateConfig' + ); + } + + $resourcePath = '/1/configs/{indexName}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + if (isset($querySuggestionsIndexParam)) { + $httpBody = $querySuggestionsIndexParam; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('PUT', $resourcePath, $query, $httpBody); + } + + private function sendRequest($method, $resourcePath, $query, $httpBody) + { + if ($method === 'GET') { + $request = $this->api->read( + $method, + $resourcePath . ($query ? "?{$query}" : '') + ); + } else { + $request = $this->api->write( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody + ); + } + + return $request; + } +} diff --git a/clients/algoliasearch-client-php/lib/Api/RecommendApi.php b/clients/algoliasearch-client-php/lib/Api/RecommendApi.php new file mode 100644 index 0000000000..a9305a9de4 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/RecommendApi.php @@ -0,0 +1,159 @@ +config = $config; + + $this->api = $apiWrapper; + $this->headerSelector = new HeaderSelector(); + } + + /** + * Instantiate the client with basic credentials and region + * + * @param string $appId Application ID + * @param string $apiKey Algolia API Key + * @param string $region Region + */ + public static function create($appId = null, $apiKey = null, $region = null) + { + $allowedRegions = explode('-', 'us-de'); + $config = RecommendConfig::create($appId, $apiKey, $region, $allowedRegions); + + return static::createWithConfig($config); + } + + /** + * Instantiate the client with congiguration + * + * @param RecommendConfig $config Configuration + */ + public static function createWithConfig(RecommendConfig $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::createFromAppId($config->getAppId()); + } + + $apiWrapper = new ApiWrapper( + Algolia::getHttpClient(), + $config, + $clusterHosts + ); + + return new static($apiWrapper, $config); + } + + /** + * @return RecommendConfig + */ + public function getClientConfig() + { + return $this->config; + } + + /** + * Operation getRecommendations + * + * @param \Algolia\AlgoliaSearch\Model\GetRecommendations $getRecommendations getRecommendations (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\GetRecommendationsResponse|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase|\Algolia\AlgoliaSearch\Model\ErrorBase + */ + public function getRecommendations($getRecommendations) + { + // verify the required parameter 'getRecommendations' is set + if ($getRecommendations === null || (is_array($getRecommendations) && count($getRecommendations) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $getRecommendations when calling getRecommendations' + ); + } + + $resourcePath = '/1/indexes/*/recommendations'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + $headers = $this->headerSelector->selectHeaders( + ['application/json'], + ['application/json'] + ); + if (isset($getRecommendations)) { + $httpBody = $getRecommendations; + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('POST', $resourcePath, $query, $httpBody); + } + + private function sendRequest($method, $resourcePath, $query, $httpBody) + { + if ($method === 'GET') { + $request = $this->api->read( + $method, + $resourcePath . ($query ? "?{$query}" : '') + ); + } else { + $request = $this->api->write( + $method, + $resourcePath . ($query ? "?{$query}" : ''), + $httpBody + ); + } + + return $request; + } +} diff --git a/clients/algoliasearch-client-php/lib/Api/SearchApi.php b/clients/algoliasearch-client-php/lib/Api/SearchApi.php index c7ae5106ad..ed7473ff95 100644 --- a/clients/algoliasearch-client-php/lib/Api/SearchApi.php +++ b/clients/algoliasearch-client-php/lib/Api/SearchApi.php @@ -3,7 +3,7 @@ namespace Algolia\AlgoliaSearch\Api; use Algolia\AlgoliaSearch\Algolia; -use Algolia\AlgoliaSearch\Configuration\Configuration; +use Algolia\AlgoliaSearch\Configuration\SearchConfig; use Algolia\AlgoliaSearch\HeaderSelector; use Algolia\AlgoliaSearch\ObjectSerializer; use Algolia\AlgoliaSearch\RetryStrategy\ApiWrapper; @@ -24,7 +24,7 @@ class SearchApi protected $api; /** - * @var Configuration + * @var SearchConfig */ protected $config; @@ -34,10 +34,10 @@ class SearchApi protected $headerSelector; /** - * @param Configuration $config + * @param SearchConfig $config * @param ApiWrapperInterface $apiWrapper */ - public function __construct(ApiWrapperInterface $apiWrapper, Configuration $config) + public function __construct(ApiWrapperInterface $apiWrapper, SearchConfig $config) { $this->config = $config; @@ -53,15 +53,15 @@ public function __construct(ApiWrapperInterface $apiWrapper, Configuration $conf */ public static function create($appId = null, $apiKey = null) { - return static::createWithConfig(Configuration::create($appId, $apiKey)); + return static::createWithConfig(SearchConfig::create($appId, $apiKey)); } /** * Instantiate the client with congiguration * - * @param Configuration $config Configuration + * @param SearchConfig $config Configuration */ - public static function createWithConfig(Configuration $config) + public static function createWithConfig(SearchConfig $config) { $config = clone $config; @@ -87,9 +87,9 @@ public static function createWithConfig(Configuration $config) } /** - * @return Configuration + * @return SearchConfig */ - public function getConfig() + public function getClientConfig() { return $this->config; } diff --git a/clients/algoliasearch-client-php/lib/Configuration/AbTestingConfig.php b/clients/algoliasearch-client-php/lib/Configuration/AbTestingConfig.php new file mode 100644 index 0000000000..2b32133678 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Configuration/AbTestingConfig.php @@ -0,0 +1,7 @@ +getDefaultConfiguration(); - $this->config = $config; - } - - public static function create($appId = null, $apiKey = null) - { - $config = [ - 'appId' => null !== $appId ? $appId : getenv('ALGOLIA_APP_ID'), - 'apiKey' => null !== $apiKey ? $apiKey : getenv('ALGOLIA_API_KEY'), - ]; - - return new static($config); - } - - public function getDefaultConfiguration() - { - return [ - 'appId' => '', - 'apiKey' => '', - 'hosts' => null, - 'readTimeout' => $this->defaultReadTimeout, - 'writeTimeout' => $this->defaultWriteTimeout, - 'connectTimeout' => $this->defaultConnectTimeout, - 'defaultHeaders' => [], - ]; - } - - public function getAppId() - { - return $this->config['appId']; - } - - public function setAppId($appId) - { - $this->config['appId'] = $appId; - - return $this; - } - - public function getAlgoliaApiKey() - { - return $this->config['apiKey']; - } - - public function setAlgoliaApiKey($apiKey) - { - $this->config['apiKey'] = $apiKey; - - return $this; - } - - public function getHosts() - { - return $this->config['hosts']; - } - - public function setHosts($hosts) - { - $this->config['hosts'] = $hosts; - - return $this; - } - - public function getReadTimeout() - { - return $this->config['readTimeout']; - } - - public function setReadTimeout($readTimeout) - { - $this->config['readTimeout'] = $readTimeout; - - return $this; - } - - public function getWriteTimeout() - { - return $this->config['writeTimeout']; - } - - public function setWriteTimeout($writeTimeout) - { - $this->config['writeTimeout'] = $writeTimeout; - - return $this; - } - - public function getConnectTimeout() - { - return $this->config['connectTimeout']; - } - - public function setConnectTimeout($connectTimeout) - { - $this->config['connectTimeout'] = $connectTimeout; - - return $this; - } - - public function getDefaultHeaders() - { - return $this->config['defaultHeaders']; - } - - public function setDefaultHeaders(array $defaultHeaders) - { - $this->config['defaultHeaders'] = $defaultHeaders; - - return $this; - } - - /** - * Sets the user agent of the api client - * - * @param string $userAgent the user agent of the api client - * - * @throws \InvalidArgumentException - * - * @return $this - */ - public function setUserAgent($userAgent) - { - if (!is_string($userAgent)) { - throw new \InvalidArgumentException('User-agent must be a string.'); - } - - $this->userAgent = $userAgent; - - return $this; - } - - /** - * Gets the user agent of the api client - * - * @return string user agent - */ - public function getUserAgent() - { - return $this->userAgent; - } -} diff --git a/clients/algoliasearch-client-php/lib/Configuration/AnalyticsConfig.php b/clients/algoliasearch-client-php/lib/Configuration/AnalyticsConfig.php new file mode 100644 index 0000000000..5f12ef371f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Configuration/AnalyticsConfig.php @@ -0,0 +1,7 @@ + null !== $appId ? $appId : getenv('ALGOLIA_APP_ID'), + 'apiKey' => null !== $apiKey ? $apiKey : getenv('ALGOLIA_API_KEY'), + 'region' => null !== $region ? $region : 'us', + ]; + + return new static($config); + } + + public function getRegion() + { + return $this->config['region']; + } +} diff --git a/clients/algoliasearch-client-php/lib/Configuration/Configuration.php b/clients/algoliasearch-client-php/lib/Configuration/Configuration.php index d7cbebc643..f8aae6e002 100644 --- a/clients/algoliasearch-client-php/lib/Configuration/Configuration.php +++ b/clients/algoliasearch-client-php/lib/Configuration/Configuration.php @@ -9,7 +9,7 @@ * @category Class * @package Algolia\AlgoliaSearch */ -class Configuration extends AbstractConfig +abstract class Configuration { /** * Associate array to store API key(s) @@ -60,6 +60,14 @@ class Configuration extends AbstractConfig */ protected $tempFolderPath; + protected $config; + + protected $defaultReadTimeout = 5; + + protected $defaultWriteTimeout = 30; + + protected $defaultConnectTimeout = 2; + public function __construct(array $config = []) { $this->tempFolderPath = sys_get_temp_dir(); @@ -252,4 +260,131 @@ public function getApiKeyWithPrefix($apiKeyIdentifier) return $keyWithPrefix; } + + public function getDefaultConfiguration() + { + return [ + 'appId' => '', + 'apiKey' => '', + 'hosts' => null, + 'readTimeout' => $this->defaultReadTimeout, + 'writeTimeout' => $this->defaultWriteTimeout, + 'connectTimeout' => $this->defaultConnectTimeout, + 'defaultHeaders' => [], + ]; + } + + public function getAppId() + { + return $this->config['appId']; + } + + public function setAppId($appId) + { + $this->config['appId'] = $appId; + + return $this; + } + + public function getAlgoliaApiKey() + { + return $this->config['apiKey']; + } + + public function setAlgoliaApiKey($apiKey) + { + $this->config['apiKey'] = $apiKey; + + return $this; + } + + public function getHosts() + { + return $this->config['hosts']; + } + + public function setHosts($hosts) + { + $this->config['hosts'] = $hosts; + + return $this; + } + + public function getReadTimeout() + { + return $this->config['readTimeout']; + } + + public function setReadTimeout($readTimeout) + { + $this->config['readTimeout'] = $readTimeout; + + return $this; + } + + public function getWriteTimeout() + { + return $this->config['writeTimeout']; + } + + public function setWriteTimeout($writeTimeout) + { + $this->config['writeTimeout'] = $writeTimeout; + + return $this; + } + + public function getConnectTimeout() + { + return $this->config['connectTimeout']; + } + + public function setConnectTimeout($connectTimeout) + { + $this->config['connectTimeout'] = $connectTimeout; + + return $this; + } + + public function getDefaultHeaders() + { + return $this->config['defaultHeaders']; + } + + public function setDefaultHeaders(array $defaultHeaders) + { + $this->config['defaultHeaders'] = $defaultHeaders; + + return $this; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } } diff --git a/clients/algoliasearch-client-php/lib/Configuration/InsightsConfig.php b/clients/algoliasearch-client-php/lib/Configuration/InsightsConfig.php new file mode 100644 index 0000000000..6cbba26b83 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Configuration/InsightsConfig.php @@ -0,0 +1,7 @@ + null !== $appId ? $appId : getenv('ALGOLIA_APP_ID'), + 'apiKey' => null !== $apiKey ? $apiKey : getenv('ALGOLIA_API_KEY'), + ]; + + return new static($config); + } + + public function getDefaultConfiguration() + { + return [ + 'appId' => '', + 'apiKey' => '', + 'hosts' => null, + 'readTimeout' => $this->defaultReadTimeout, + 'writeTimeout' => $this->defaultWriteTimeout, + 'connectTimeout' => $this->defaultConnectTimeout, + 'waitTaskTimeBeforeRetry' => $this->defaultWaitTaskTimeBeforeRetry, + 'defaultHeaders' => [], + 'defaultForwardToReplicas' => null, + 'batchSize' => 1000, + ]; + } +} diff --git a/clients/algoliasearch-client-php/lib/Model/ABTest.php b/clients/algoliasearch-client-php/lib/Model/ABTest.php new file mode 100644 index 0000000000..367d549f80 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTest.php @@ -0,0 +1,525 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ABTest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ABTest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'abTestID' => 'int', + 'clickSignificance' => 'double', + 'conversionSignificance' => 'double', + 'endAt' => 'string', + 'createdAt' => 'string', + 'name' => 'string', + 'status' => 'string', + 'variants' => '\Algolia\AlgoliaSearch\Model\Variant[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'abTestID' => null, + 'clickSignificance' => 'double', + 'conversionSignificance' => 'double', + 'endAt' => null, + 'createdAt' => null, + 'name' => null, + 'status' => null, + 'variants' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'abTestID' => 'abTestID', + 'clickSignificance' => 'clickSignificance', + 'conversionSignificance' => 'conversionSignificance', + 'endAt' => 'endAt', + 'createdAt' => 'createdAt', + 'name' => 'name', + 'status' => 'status', + 'variants' => 'variants', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'abTestID' => 'setAbTestID', + 'clickSignificance' => 'setClickSignificance', + 'conversionSignificance' => 'setConversionSignificance', + 'endAt' => 'setEndAt', + 'createdAt' => 'setCreatedAt', + 'name' => 'setName', + 'status' => 'setStatus', + 'variants' => 'setVariants', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'abTestID' => 'getAbTestID', + 'clickSignificance' => 'getClickSignificance', + 'conversionSignificance' => 'getConversionSignificance', + 'endAt' => 'getEndAt', + 'createdAt' => 'getCreatedAt', + 'name' => 'getName', + 'status' => 'getStatus', + 'variants' => 'getVariants', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['abTestID'] = $data['abTestID'] ?? null; + $this->container['clickSignificance'] = $data['clickSignificance'] ?? null; + $this->container['conversionSignificance'] = $data['conversionSignificance'] ?? null; + $this->container['endAt'] = $data['endAt'] ?? null; + $this->container['createdAt'] = $data['createdAt'] ?? null; + $this->container['name'] = $data['name'] ?? null; + $this->container['status'] = $data['status'] ?? null; + $this->container['variants'] = $data['variants'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['abTestID'] === null) { + $invalidProperties[] = "'abTestID' can't be null"; + } + if ($this->container['clickSignificance'] === null) { + $invalidProperties[] = "'clickSignificance' can't be null"; + } + if ($this->container['conversionSignificance'] === null) { + $invalidProperties[] = "'conversionSignificance' can't be null"; + } + if ($this->container['endAt'] === null) { + $invalidProperties[] = "'endAt' can't be null"; + } + if ($this->container['createdAt'] === null) { + $invalidProperties[] = "'createdAt' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['variants'] === null) { + $invalidProperties[] = "'variants' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets abTestID + * + * @return int + */ + public function getAbTestID() + { + return $this->container['abTestID']; + } + + /** + * Sets abTestID + * + * @param int $abTestID the A/B test ID + * + * @return self + */ + public function setAbTestID($abTestID) + { + $this->container['abTestID'] = $abTestID; + + return $this; + } + + /** + * Gets clickSignificance + * + * @return float + */ + public function getClickSignificance() + { + return $this->container['clickSignificance']; + } + + /** + * Sets clickSignificance + * + * @param float $clickSignificance A/B test significance based on click data. Should be > 0.95 to be considered significant (no matter which variant is winning). + * + * @return self + */ + public function setClickSignificance($clickSignificance) + { + $this->container['clickSignificance'] = $clickSignificance; + + return $this; + } + + /** + * Gets conversionSignificance + * + * @return float + */ + public function getConversionSignificance() + { + return $this->container['conversionSignificance']; + } + + /** + * Sets conversionSignificance + * + * @param float $conversionSignificance A/B test significance based on conversion data. Should be > 0.95 to be considered significant (no matter which variant is winning). + * + * @return self + */ + public function setConversionSignificance($conversionSignificance) + { + $this->container['conversionSignificance'] = $conversionSignificance; + + return $this; + } + + /** + * Gets endAt + * + * @return string + */ + public function getEndAt() + { + return $this->container['endAt']; + } + + /** + * Sets endAt + * + * @param string $endAt end date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ + * + * @return self + */ + public function setEndAt($endAt) + { + $this->container['endAt'] = $endAt; + + return $this; + } + + /** + * Gets createdAt + * + * @return string + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string $createdAt end date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ + * + * @return self + */ + public function setCreatedAt($createdAt) + { + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name A/B test name + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets status + * + * @return string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status of the A/B test + * + * @return self + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets variants + * + * @return \Algolia\AlgoliaSearch\Model\Variant[] + */ + public function getVariants() + { + return $this->container['variants']; + } + + /** + * Sets variants + * + * @param \Algolia\AlgoliaSearch\Model\Variant[] $variants list of A/B test variant + * + * @return self + */ + public function setVariants($variants) + { + $this->container['variants'] = $variants; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/ABTestResponse.php b/clients/algoliasearch-client-php/lib/Model/ABTestResponse.php new file mode 100644 index 0000000000..9ed0975346 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTestResponse.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ABTestResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ABTestResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'index' => 'string', + 'abTestID' => 'int', + 'taskID' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'index' => null, + 'abTestID' => null, + 'taskID' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'index' => 'index', + 'abTestID' => 'abTestID', + 'taskID' => 'taskID', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'index' => 'setIndex', + 'abTestID' => 'setAbTestID', + 'taskID' => 'setTaskID', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'index' => 'getIndex', + 'abTestID' => 'getAbTestID', + 'taskID' => 'getTaskID', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['index'] = $data['index'] ?? null; + $this->container['abTestID'] = $data['abTestID'] ?? null; + $this->container['taskID'] = $data['taskID'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['index'] === null) { + $invalidProperties[] = "'index' can't be null"; + } + if ($this->container['abTestID'] === null) { + $invalidProperties[] = "'abTestID' can't be null"; + } + if ($this->container['taskID'] === null) { + $invalidProperties[] = "'taskID' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets index + * + * @return string + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param string $index the index performing the A/B test + * + * @return self + */ + public function setIndex($index) + { + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets abTestID + * + * @return int + */ + public function getAbTestID() + { + return $this->container['abTestID']; + } + + /** + * Sets abTestID + * + * @param int $abTestID the A/B test ID + * + * @return self + */ + public function setAbTestID($abTestID) + { + $this->container['abTestID'] = $abTestID; + + return $this; + } + + /** + * Gets taskID + * + * @return int + */ + public function getTaskID() + { + return $this->container['taskID']; + } + + /** + * Sets taskID + * + * @param int $taskID taskID of the task to wait for + * + * @return self + */ + public function setTaskID($taskID) + { + $this->container['taskID'] = $taskID; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/AbTestsVariant.php b/clients/algoliasearch-client-php/lib/Model/AbTestsVariant.php new file mode 100644 index 0000000000..9ac9af4509 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/AbTestsVariant.php @@ -0,0 +1,357 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class AbTestsVariant implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'abTestsVariant'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'index' => 'string', + 'trafficPercentage' => 'int', + 'description' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'index' => null, + 'trafficPercentage' => null, + 'description' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'index' => 'index', + 'trafficPercentage' => 'trafficPercentage', + 'description' => 'description', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'index' => 'setIndex', + 'trafficPercentage' => 'setTrafficPercentage', + 'description' => 'setDescription', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'index' => 'getIndex', + 'trafficPercentage' => 'getTrafficPercentage', + 'description' => 'getDescription', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['index'] = $data['index'] ?? null; + $this->container['trafficPercentage'] = $data['trafficPercentage'] ?? null; + $this->container['description'] = $data['description'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['index'] === null) { + $invalidProperties[] = "'index' can't be null"; + } + if ($this->container['trafficPercentage'] === null) { + $invalidProperties[] = "'trafficPercentage' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets index + * + * @return string + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param string $index the index performing the A/B test + * + * @return self + */ + public function setIndex($index) + { + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets trafficPercentage + * + * @return int + */ + public function getTrafficPercentage() + { + return $this->container['trafficPercentage']; + } + + /** + * Sets trafficPercentage + * + * @param int $trafficPercentage the traffic perfecentage for the A/B test + * + * @return self + */ + public function setTrafficPercentage($trafficPercentage) + { + $this->container['trafficPercentage'] = $trafficPercentage; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description the A/B test description + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/AbTestsVariantSearchParams.php b/clients/algoliasearch-client-php/lib/Model/AbTestsVariantSearchParams.php new file mode 100644 index 0000000000..7d11ce1870 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/AbTestsVariantSearchParams.php @@ -0,0 +1,390 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class AbTestsVariantSearchParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'abTestsVariantSearchParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'index' => 'string', + 'trafficPercentage' => 'int', + 'description' => 'string', + 'customSearchParameters' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'index' => null, + 'trafficPercentage' => null, + 'description' => null, + 'customSearchParameters' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'index' => 'index', + 'trafficPercentage' => 'trafficPercentage', + 'description' => 'description', + 'customSearchParameters' => 'customSearchParameters', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'index' => 'setIndex', + 'trafficPercentage' => 'setTrafficPercentage', + 'description' => 'setDescription', + 'customSearchParameters' => 'setCustomSearchParameters', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'index' => 'getIndex', + 'trafficPercentage' => 'getTrafficPercentage', + 'description' => 'getDescription', + 'customSearchParameters' => 'getCustomSearchParameters', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['index'] = $data['index'] ?? null; + $this->container['trafficPercentage'] = $data['trafficPercentage'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['customSearchParameters'] = $data['customSearchParameters'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['index'] === null) { + $invalidProperties[] = "'index' can't be null"; + } + if ($this->container['trafficPercentage'] === null) { + $invalidProperties[] = "'trafficPercentage' can't be null"; + } + if ($this->container['customSearchParameters'] === null) { + $invalidProperties[] = "'customSearchParameters' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets index + * + * @return string + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param string $index the index performing the A/B test + * + * @return self + */ + public function setIndex($index) + { + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets trafficPercentage + * + * @return int + */ + public function getTrafficPercentage() + { + return $this->container['trafficPercentage']; + } + + /** + * Sets trafficPercentage + * + * @param int $trafficPercentage the traffic perfecentage for the A/B test + * + * @return self + */ + public function setTrafficPercentage($trafficPercentage) + { + $this->container['trafficPercentage'] = $trafficPercentage; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description the A/B test description + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets customSearchParameters + * + * @return object + */ + public function getCustomSearchParameters() + { + return $this->container['customSearchParameters']; + } + + /** + * Sets customSearchParameters + * + * @param object $customSearchParameters customSearchParameters + * + * @return self + */ + public function setCustomSearchParameters($customSearchParameters) + { + $this->container['customSearchParameters'] = $customSearchParameters; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/AddABTestsRequest.php b/clients/algoliasearch-client-php/lib/Model/AddABTestsRequest.php new file mode 100644 index 0000000000..251027134a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/AddABTestsRequest.php @@ -0,0 +1,374 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class AddABTestsRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'addABTestsRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'variant' => '\Algolia\AlgoliaSearch\Model\AddABTestsVariant[]', + 'endAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'variant' => null, + 'endAt' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'name' => 'name', + 'variant' => 'variant', + 'endAt' => 'endAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'variant' => 'setVariant', + 'endAt' => 'setEndAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'variant' => 'getVariant', + 'endAt' => 'getEndAt', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['name'] = $data['name'] ?? null; + $this->container['variant'] = $data['variant'] ?? null; + $this->container['endAt'] = $data['endAt'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['variant'] === null) { + $invalidProperties[] = "'variant' can't be null"; + } + if ((count($this->container['variant']) > 2)) { + $invalidProperties[] = "invalid value for 'variant', number of items must be less than or equal to 2."; + } + + if ((count($this->container['variant']) < 2)) { + $invalidProperties[] = "invalid value for 'variant', number of items must be greater than or equal to 2."; + } + + if ($this->container['endAt'] === null) { + $invalidProperties[] = "'endAt' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name A/B test name + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets variant + * + * @return \Algolia\AlgoliaSearch\Model\AddABTestsVariant[] + */ + public function getVariant() + { + return $this->container['variant']; + } + + /** + * Sets variant + * + * @param \Algolia\AlgoliaSearch\Model\AddABTestsVariant[] $variant list of 2 variants for the A/B test + * + * @return self + */ + public function setVariant($variant) + { + if ((count($variant) > 2)) { + throw new \InvalidArgumentException('invalid value for $variant when calling AddABTestsRequest., number of items must be less than or equal to 2.'); + } + if ((count($variant) < 2)) { + throw new \InvalidArgumentException('invalid length for $variant when calling AddABTestsRequest., number of items must be greater than or equal to 2.'); + } + $this->container['variant'] = $variant; + + return $this; + } + + /** + * Gets endAt + * + * @return string + */ + public function getEndAt() + { + return $this->container['endAt']; + } + + /** + * Sets endAt + * + * @param string $endAt end date for the A/B test expressed as YYYY-MM-DDThh:mm:ssZ + * + * @return self + */ + public function setEndAt($endAt) + { + $this->container['endAt'] = $endAt; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/AddABTestsVariant.php b/clients/algoliasearch-client-php/lib/Model/AddABTestsVariant.php new file mode 100644 index 0000000000..5a91671eb2 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/AddABTestsVariant.php @@ -0,0 +1,390 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class AddABTestsVariant implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AddABTestsVariant'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'index' => 'string', + 'trafficPercentage' => 'int', + 'description' => 'string', + 'customSearchParameters' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'index' => null, + 'trafficPercentage' => null, + 'description' => null, + 'customSearchParameters' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'index' => 'index', + 'trafficPercentage' => 'trafficPercentage', + 'description' => 'description', + 'customSearchParameters' => 'customSearchParameters', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'index' => 'setIndex', + 'trafficPercentage' => 'setTrafficPercentage', + 'description' => 'setDescription', + 'customSearchParameters' => 'setCustomSearchParameters', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'index' => 'getIndex', + 'trafficPercentage' => 'getTrafficPercentage', + 'description' => 'getDescription', + 'customSearchParameters' => 'getCustomSearchParameters', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['index'] = $data['index'] ?? null; + $this->container['trafficPercentage'] = $data['trafficPercentage'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['customSearchParameters'] = $data['customSearchParameters'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['index'] === null) { + $invalidProperties[] = "'index' can't be null"; + } + if ($this->container['trafficPercentage'] === null) { + $invalidProperties[] = "'trafficPercentage' can't be null"; + } + if ($this->container['customSearchParameters'] === null) { + $invalidProperties[] = "'customSearchParameters' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets index + * + * @return string + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param string $index the index performing the A/B test + * + * @return self + */ + public function setIndex($index) + { + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets trafficPercentage + * + * @return int + */ + public function getTrafficPercentage() + { + return $this->container['trafficPercentage']; + } + + /** + * Sets trafficPercentage + * + * @param int $trafficPercentage the traffic perfecentage for the A/B test + * + * @return self + */ + public function setTrafficPercentage($trafficPercentage) + { + $this->container['trafficPercentage'] = $trafficPercentage; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description the A/B test description + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets customSearchParameters + * + * @return object + */ + public function getCustomSearchParameters() + { + return $this->container['customSearchParameters']; + } + + /** + * Sets customSearchParameters + * + * @param object $customSearchParameters customSearchParameters + * + * @return self + */ + public function setCustomSearchParameters($customSearchParameters) + { + $this->container['customSearchParameters'] = $customSearchParameters; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/CustomSearchParams.php b/clients/algoliasearch-client-php/lib/Model/CustomSearchParams.php new file mode 100644 index 0000000000..a74f44e250 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/CustomSearchParams.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CustomSearchParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'customSearchParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'customSearchParameters' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'customSearchParameters' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'customSearchParameters' => 'customSearchParameters', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'customSearchParameters' => 'setCustomSearchParameters', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'customSearchParameters' => 'getCustomSearchParameters', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['customSearchParameters'] = $data['customSearchParameters'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['customSearchParameters'] === null) { + $invalidProperties[] = "'customSearchParameters' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets customSearchParameters + * + * @return object + */ + public function getCustomSearchParameters() + { + return $this->container['customSearchParameters']; + } + + /** + * Sets customSearchParameters + * + * @param object $customSearchParameters customSearchParameters + * + * @return self + */ + public function setCustomSearchParameters($customSearchParameters) + { + $this->container['customSearchParameters'] = $customSearchParameters; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/DeleteUserProfileResponse.php b/clients/algoliasearch-client-php/lib/Model/DeleteUserProfileResponse.php new file mode 100644 index 0000000000..0fa26d0fb0 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/DeleteUserProfileResponse.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteUserProfileResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'deleteUserProfileResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'userToken' => 'string', + 'deletedUntil' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'userToken' => null, + 'deletedUntil' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'userToken' => 'userToken', + 'deletedUntil' => 'deletedUntil', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'userToken' => 'setUserToken', + 'deletedUntil' => 'setDeletedUntil', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'userToken' => 'getUserToken', + 'deletedUntil' => 'getDeletedUntil', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['userToken'] = $data['userToken'] ?? null; + $this->container['deletedUntil'] = $data['deletedUntil'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['userToken'] === null) { + $invalidProperties[] = "'userToken' can't be null"; + } + if ($this->container['deletedUntil'] === null) { + $invalidProperties[] = "'deletedUntil' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets userToken + * + * @return string + */ + public function getUserToken() + { + return $this->container['userToken']; + } + + /** + * Sets userToken + * + * @param string $userToken userToken representing the user for which to fetch the Personalization profile + * + * @return self + */ + public function setUserToken($userToken) + { + $this->container['userToken'] = $userToken; + + return $this; + } + + /** + * Gets deletedUntil + * + * @return string + */ + public function getDeletedUntil() + { + return $this->container['deletedUntil']; + } + + /** + * Sets deletedUntil + * + * @param string $deletedUntil A date until which the data can safely be considered as deleted for the given user. Any data received after the deletedUntil date will start building a new user profile. + * + * @return self + */ + public function setDeletedUntil($deletedUntil) + { + $this->container['deletedUntil'] = $deletedUntil; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/EventScoring.php b/clients/algoliasearch-client-php/lib/Model/EventScoring.php new file mode 100644 index 0000000000..f0d107ab89 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/EventScoring.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class EventScoring implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'eventScoring'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'score' => 'int', + 'eventName' => 'string', + 'eventType' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'score' => null, + 'eventName' => null, + 'eventType' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'score' => 'score', + 'eventName' => 'eventName', + 'eventType' => 'eventType', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'score' => 'setScore', + 'eventName' => 'setEventName', + 'eventType' => 'setEventType', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'score' => 'getScore', + 'eventName' => 'getEventName', + 'eventType' => 'getEventType', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['score'] = $data['score'] ?? null; + $this->container['eventName'] = $data['eventName'] ?? null; + $this->container['eventType'] = $data['eventType'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['score'] === null) { + $invalidProperties[] = "'score' can't be null"; + } + if ($this->container['eventName'] === null) { + $invalidProperties[] = "'eventName' can't be null"; + } + if ($this->container['eventType'] === null) { + $invalidProperties[] = "'eventType' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets score + * + * @return int + */ + public function getScore() + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param int $score the score for the event + * + * @return self + */ + public function setScore($score) + { + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets eventName + * + * @return string + */ + public function getEventName() + { + return $this->container['eventName']; + } + + /** + * Sets eventName + * + * @param string $eventName the name of the event + * + * @return self + */ + public function setEventName($eventName) + { + $this->container['eventName'] = $eventName; + + return $this; + } + + /** + * Gets eventType + * + * @return string + */ + public function getEventType() + { + return $this->container['eventType']; + } + + /** + * Sets eventType + * + * @param string $eventType the type of the event + * + * @return self + */ + public function setEventType($eventType) + { + $this->container['eventType'] = $eventType; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/FacetScoring.php b/clients/algoliasearch-client-php/lib/Model/FacetScoring.php new file mode 100644 index 0000000000..a976f22006 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/FacetScoring.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class FacetScoring implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'facetScoring'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'score' => 'int', + 'facetName' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'score' => null, + 'facetName' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'score' => 'score', + 'facetName' => 'facetName', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'score' => 'setScore', + 'facetName' => 'setFacetName', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'score' => 'getScore', + 'facetName' => 'getFacetName', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['score'] = $data['score'] ?? null; + $this->container['facetName'] = $data['facetName'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['score'] === null) { + $invalidProperties[] = "'score' can't be null"; + } + if ($this->container['facetName'] === null) { + $invalidProperties[] = "'facetName' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets score + * + * @return int + */ + public function getScore() + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param int $score the score for the event + * + * @return self + */ + public function setScore($score) + { + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets facetName + * + * @return string + */ + public function getFacetName() + { + return $this->container['facetName']; + } + + /** + * Sets facetName + * + * @param string $facetName the name of the facet + * + * @return self + */ + public function setFacetName($facetName) + { + $this->container['facetName'] = $facetName; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetAverageClickPositionResponse.php b/clients/algoliasearch-client-php/lib/Model/GetAverageClickPositionResponse.php new file mode 100644 index 0000000000..ec407539db --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetAverageClickPositionResponse.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetAverageClickPositionResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getAverageClickPositionResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'average' => 'double', + 'clickCount' => 'int', + 'dates' => '\Algolia\AlgoliaSearch\Model\GetAverageClickPositionResponseDates[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'average' => 'double', + 'clickCount' => null, + 'dates' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'average' => 'average', + 'clickCount' => 'clickCount', + 'dates' => 'dates', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'average' => 'setAverage', + 'clickCount' => 'setClickCount', + 'dates' => 'setDates', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'average' => 'getAverage', + 'clickCount' => 'getClickCount', + 'dates' => 'getDates', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['average'] = $data['average'] ?? null; + $this->container['clickCount'] = $data['clickCount'] ?? null; + $this->container['dates'] = $data['dates'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['average'] === null) { + $invalidProperties[] = "'average' can't be null"; + } + if ($this->container['clickCount'] === null) { + $invalidProperties[] = "'clickCount' can't be null"; + } + if ($this->container['dates'] === null) { + $invalidProperties[] = "'dates' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets average + * + * @return float + */ + public function getAverage() + { + return $this->container['average']; + } + + /** + * Sets average + * + * @param float $average the average of all the click count event + * + * @return self + */ + public function setAverage($average) + { + $this->container['average'] = $average; + + return $this; + } + + /** + * Gets clickCount + * + * @return int + */ + public function getClickCount() + { + return $this->container['clickCount']; + } + + /** + * Sets clickCount + * + * @param int $clickCount the number of click event + * + * @return self + */ + public function setClickCount($clickCount) + { + $this->container['clickCount'] = $clickCount; + + return $this; + } + + /** + * Gets dates + * + * @return \Algolia\AlgoliaSearch\Model\GetAverageClickPositionResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\GetAverageClickPositionResponseDates[] $dates a list of average click position with their date + * + * @return self + */ + public function setDates($dates) + { + $this->container['dates'] = $dates; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetAverageClickPositionResponseDates.php b/clients/algoliasearch-client-php/lib/Model/GetAverageClickPositionResponseDates.php new file mode 100644 index 0000000000..c55f093ff3 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetAverageClickPositionResponseDates.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetAverageClickPositionResponseDates implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getAverageClickPositionResponse_dates'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'average' => 'double', + 'clickCount' => 'int', + 'date' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'average' => 'double', + 'clickCount' => null, + 'date' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'average' => 'average', + 'clickCount' => 'clickCount', + 'date' => 'date', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'average' => 'setAverage', + 'clickCount' => 'setClickCount', + 'date' => 'setDate', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'average' => 'getAverage', + 'clickCount' => 'getClickCount', + 'date' => 'getDate', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['average'] = $data['average'] ?? null; + $this->container['clickCount'] = $data['clickCount'] ?? null; + $this->container['date'] = $data['date'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['average'] === null) { + $invalidProperties[] = "'average' can't be null"; + } + if ($this->container['clickCount'] === null) { + $invalidProperties[] = "'clickCount' can't be null"; + } + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets average + * + * @return float + */ + public function getAverage() + { + return $this->container['average']; + } + + /** + * Sets average + * + * @param float $average the average of all the click count event + * + * @return self + */ + public function setAverage($average) + { + $this->container['average'] = $average; + + return $this; + } + + /** + * Gets clickCount + * + * @return int + */ + public function getClickCount() + { + return $this->container['clickCount']; + } + + /** + * Sets clickCount + * + * @param int $clickCount the number of click event + * + * @return self + */ + public function setClickCount($clickCount) + { + $this->container['clickCount'] = $clickCount; + + return $this; + } + + /** + * Gets date + * + * @return string + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string $date date of the event + * + * @return self + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetClickPositionsResponse.php b/clients/algoliasearch-client-php/lib/Model/GetClickPositionsResponse.php new file mode 100644 index 0000000000..ad6264940c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetClickPositionsResponse.php @@ -0,0 +1,307 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetClickPositionsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getClickPositionsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'positions' => '\Algolia\AlgoliaSearch\Model\GetClickPositionsResponsePositions[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'positions' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'positions' => 'positions', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'positions' => 'setPositions', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'positions' => 'getPositions', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['positions'] = $data['positions'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['positions'] === null) { + $invalidProperties[] = "'positions' can't be null"; + } + if ((count($this->container['positions']) > 2)) { + $invalidProperties[] = "invalid value for 'positions', number of items must be less than or equal to 2."; + } + + if ((count($this->container['positions']) < 2)) { + $invalidProperties[] = "invalid value for 'positions', number of items must be greater than or equal to 2."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets positions + * + * @return \Algolia\AlgoliaSearch\Model\GetClickPositionsResponsePositions[] + */ + public function getPositions() + { + return $this->container['positions']; + } + + /** + * Sets positions + * + * @param \Algolia\AlgoliaSearch\Model\GetClickPositionsResponsePositions[] $positions a list of the click positions with their click count + * + * @return self + */ + public function setPositions($positions) + { + if ((count($positions) > 2)) { + throw new \InvalidArgumentException('invalid value for $positions when calling GetClickPositionsResponse., number of items must be less than or equal to 2.'); + } + if ((count($positions) < 2)) { + throw new \InvalidArgumentException('invalid length for $positions when calling GetClickPositionsResponse., number of items must be greater than or equal to 2.'); + } + $this->container['positions'] = $positions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetClickPositionsResponsePositions.php b/clients/algoliasearch-client-php/lib/Model/GetClickPositionsResponsePositions.php new file mode 100644 index 0000000000..be74a06fb1 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetClickPositionsResponsePositions.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetClickPositionsResponsePositions implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getClickPositionsResponse_positions'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'position' => 'int[]', + 'clickCount' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'position' => null, + 'clickCount' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'position' => 'position', + 'clickCount' => 'clickCount', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'position' => 'setPosition', + 'clickCount' => 'setClickCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'position' => 'getPosition', + 'clickCount' => 'getClickCount', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['position'] = $data['position'] ?? null; + $this->container['clickCount'] = $data['clickCount'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['position'] === null) { + $invalidProperties[] = "'position' can't be null"; + } + if ($this->container['clickCount'] === null) { + $invalidProperties[] = "'clickCount' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets position + * + * @return int[] + */ + public function getPosition() + { + return $this->container['position']; + } + + /** + * Sets position + * + * @param int[] $position Range of positions with the following pattern: Positions from 1 to 10 included are displayed in separated groups. Positions from 11 to 20 included are grouped together. Positions from 21 and up are grouped together. + * + * @return self + */ + public function setPosition($position) + { + $this->container['position'] = $position; + + return $this; + } + + /** + * Gets clickCount + * + * @return int + */ + public function getClickCount() + { + return $this->container['clickCount']; + } + + /** + * Sets clickCount + * + * @param int $clickCount the number of click event + * + * @return self + */ + public function setClickCount($clickCount) + { + $this->container['clickCount'] = $clickCount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetClickThroughRateResponse.php b/clients/algoliasearch-client-php/lib/Model/GetClickThroughRateResponse.php new file mode 100644 index 0000000000..d7e234ef19 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetClickThroughRateResponse.php @@ -0,0 +1,393 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetClickThroughRateResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getClickThroughRateResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rate' => 'double', + 'clickCount' => 'int', + 'trackedSearchCount' => 'int', + 'dates' => '\Algolia\AlgoliaSearch\Model\GetClickThroughRateResponseDates[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rate' => 'double', + 'clickCount' => null, + 'trackedSearchCount' => null, + 'dates' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'rate' => 'rate', + 'clickCount' => 'clickCount', + 'trackedSearchCount' => 'trackedSearchCount', + 'dates' => 'dates', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rate' => 'setRate', + 'clickCount' => 'setClickCount', + 'trackedSearchCount' => 'setTrackedSearchCount', + 'dates' => 'setDates', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rate' => 'getRate', + 'clickCount' => 'getClickCount', + 'trackedSearchCount' => 'getTrackedSearchCount', + 'dates' => 'getDates', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['rate'] = $data['rate'] ?? null; + $this->container['clickCount'] = $data['clickCount'] ?? null; + $this->container['trackedSearchCount'] = $data['trackedSearchCount'] ?? null; + $this->container['dates'] = $data['dates'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['rate'] === null) { + $invalidProperties[] = "'rate' can't be null"; + } + if ($this->container['clickCount'] === null) { + $invalidProperties[] = "'clickCount' can't be null"; + } + if ($this->container['trackedSearchCount'] === null) { + $invalidProperties[] = "'trackedSearchCount' can't be null"; + } + if ($this->container['dates'] === null) { + $invalidProperties[] = "'dates' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets rate + * + * @return float + */ + public function getRate() + { + return $this->container['rate']; + } + + /** + * Sets rate + * + * @param float $rate the click-through rate + * + * @return self + */ + public function setRate($rate) + { + $this->container['rate'] = $rate; + + return $this; + } + + /** + * Gets clickCount + * + * @return int + */ + public function getClickCount() + { + return $this->container['clickCount']; + } + + /** + * Sets clickCount + * + * @param int $clickCount the number of click event + * + * @return self + */ + public function setClickCount($clickCount) + { + $this->container['clickCount'] = $clickCount; + + return $this; + } + + /** + * Gets trackedSearchCount + * + * @return int + */ + public function getTrackedSearchCount() + { + return $this->container['trackedSearchCount']; + } + + /** + * Sets trackedSearchCount + * + * @param int $trackedSearchCount the number of tracked search click + * + * @return self + */ + public function setTrackedSearchCount($trackedSearchCount) + { + $this->container['trackedSearchCount'] = $trackedSearchCount; + + return $this; + } + + /** + * Gets dates + * + * @return \Algolia\AlgoliaSearch\Model\GetClickThroughRateResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\GetClickThroughRateResponseDates[] $dates a list of click-through rate events with their date + * + * @return self + */ + public function setDates($dates) + { + $this->container['dates'] = $dates; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetClickThroughRateResponseDates.php b/clients/algoliasearch-client-php/lib/Model/GetClickThroughRateResponseDates.php new file mode 100644 index 0000000000..af5e0f50ee --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetClickThroughRateResponseDates.php @@ -0,0 +1,393 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetClickThroughRateResponseDates implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getClickThroughRateResponse_dates'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rate' => 'double', + 'clickCount' => 'int', + 'trackedSearchCount' => 'int', + 'date' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rate' => 'double', + 'clickCount' => null, + 'trackedSearchCount' => null, + 'date' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'rate' => 'rate', + 'clickCount' => 'clickCount', + 'trackedSearchCount' => 'trackedSearchCount', + 'date' => 'date', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rate' => 'setRate', + 'clickCount' => 'setClickCount', + 'trackedSearchCount' => 'setTrackedSearchCount', + 'date' => 'setDate', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rate' => 'getRate', + 'clickCount' => 'getClickCount', + 'trackedSearchCount' => 'getTrackedSearchCount', + 'date' => 'getDate', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['rate'] = $data['rate'] ?? null; + $this->container['clickCount'] = $data['clickCount'] ?? null; + $this->container['trackedSearchCount'] = $data['trackedSearchCount'] ?? null; + $this->container['date'] = $data['date'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['rate'] === null) { + $invalidProperties[] = "'rate' can't be null"; + } + if ($this->container['clickCount'] === null) { + $invalidProperties[] = "'clickCount' can't be null"; + } + if ($this->container['trackedSearchCount'] === null) { + $invalidProperties[] = "'trackedSearchCount' can't be null"; + } + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets rate + * + * @return float + */ + public function getRate() + { + return $this->container['rate']; + } + + /** + * Sets rate + * + * @param float $rate the click-through rate + * + * @return self + */ + public function setRate($rate) + { + $this->container['rate'] = $rate; + + return $this; + } + + /** + * Gets clickCount + * + * @return int + */ + public function getClickCount() + { + return $this->container['clickCount']; + } + + /** + * Sets clickCount + * + * @param int $clickCount the number of click event + * + * @return self + */ + public function setClickCount($clickCount) + { + $this->container['clickCount'] = $clickCount; + + return $this; + } + + /** + * Gets trackedSearchCount + * + * @return int + */ + public function getTrackedSearchCount() + { + return $this->container['trackedSearchCount']; + } + + /** + * Sets trackedSearchCount + * + * @param int $trackedSearchCount the number of tracked search click + * + * @return self + */ + public function setTrackedSearchCount($trackedSearchCount) + { + $this->container['trackedSearchCount'] = $trackedSearchCount; + + return $this; + } + + /** + * Gets date + * + * @return string + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string $date date of the event + * + * @return self + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetConversationRateResponse.php b/clients/algoliasearch-client-php/lib/Model/GetConversationRateResponse.php new file mode 100644 index 0000000000..88c60cbe36 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetConversationRateResponse.php @@ -0,0 +1,393 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetConversationRateResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getConversationRateResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rate' => 'double', + 'trackedSearchCount' => 'int', + 'conversionCount' => 'int', + 'dates' => '\Algolia\AlgoliaSearch\Model\GetConversationRateResponseDates[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rate' => 'double', + 'trackedSearchCount' => null, + 'conversionCount' => null, + 'dates' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'rate' => 'rate', + 'trackedSearchCount' => 'trackedSearchCount', + 'conversionCount' => 'conversionCount', + 'dates' => 'dates', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rate' => 'setRate', + 'trackedSearchCount' => 'setTrackedSearchCount', + 'conversionCount' => 'setConversionCount', + 'dates' => 'setDates', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rate' => 'getRate', + 'trackedSearchCount' => 'getTrackedSearchCount', + 'conversionCount' => 'getConversionCount', + 'dates' => 'getDates', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['rate'] = $data['rate'] ?? null; + $this->container['trackedSearchCount'] = $data['trackedSearchCount'] ?? null; + $this->container['conversionCount'] = $data['conversionCount'] ?? null; + $this->container['dates'] = $data['dates'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['rate'] === null) { + $invalidProperties[] = "'rate' can't be null"; + } + if ($this->container['trackedSearchCount'] === null) { + $invalidProperties[] = "'trackedSearchCount' can't be null"; + } + if ($this->container['conversionCount'] === null) { + $invalidProperties[] = "'conversionCount' can't be null"; + } + if ($this->container['dates'] === null) { + $invalidProperties[] = "'dates' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets rate + * + * @return float + */ + public function getRate() + { + return $this->container['rate']; + } + + /** + * Sets rate + * + * @param float $rate the click-through rate + * + * @return self + */ + public function setRate($rate) + { + $this->container['rate'] = $rate; + + return $this; + } + + /** + * Gets trackedSearchCount + * + * @return int + */ + public function getTrackedSearchCount() + { + return $this->container['trackedSearchCount']; + } + + /** + * Sets trackedSearchCount + * + * @param int $trackedSearchCount the number of tracked search click + * + * @return self + */ + public function setTrackedSearchCount($trackedSearchCount) + { + $this->container['trackedSearchCount'] = $trackedSearchCount; + + return $this; + } + + /** + * Gets conversionCount + * + * @return int + */ + public function getConversionCount() + { + return $this->container['conversionCount']; + } + + /** + * Sets conversionCount + * + * @param int $conversionCount the number of converted clicks + * + * @return self + */ + public function setConversionCount($conversionCount) + { + $this->container['conversionCount'] = $conversionCount; + + return $this; + } + + /** + * Gets dates + * + * @return \Algolia\AlgoliaSearch\Model\GetConversationRateResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\GetConversationRateResponseDates[] $dates a list of conversion events with their date + * + * @return self + */ + public function setDates($dates) + { + $this->container['dates'] = $dates; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetConversationRateResponseDates.php b/clients/algoliasearch-client-php/lib/Model/GetConversationRateResponseDates.php new file mode 100644 index 0000000000..cc25e80af8 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetConversationRateResponseDates.php @@ -0,0 +1,393 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetConversationRateResponseDates implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getConversationRateResponse_dates'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rate' => 'double', + 'trackedSearchCount' => 'int', + 'conversionCount' => 'int', + 'date' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rate' => 'double', + 'trackedSearchCount' => null, + 'conversionCount' => null, + 'date' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'rate' => 'rate', + 'trackedSearchCount' => 'trackedSearchCount', + 'conversionCount' => 'conversionCount', + 'date' => 'date', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rate' => 'setRate', + 'trackedSearchCount' => 'setTrackedSearchCount', + 'conversionCount' => 'setConversionCount', + 'date' => 'setDate', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rate' => 'getRate', + 'trackedSearchCount' => 'getTrackedSearchCount', + 'conversionCount' => 'getConversionCount', + 'date' => 'getDate', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['rate'] = $data['rate'] ?? null; + $this->container['trackedSearchCount'] = $data['trackedSearchCount'] ?? null; + $this->container['conversionCount'] = $data['conversionCount'] ?? null; + $this->container['date'] = $data['date'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['rate'] === null) { + $invalidProperties[] = "'rate' can't be null"; + } + if ($this->container['trackedSearchCount'] === null) { + $invalidProperties[] = "'trackedSearchCount' can't be null"; + } + if ($this->container['conversionCount'] === null) { + $invalidProperties[] = "'conversionCount' can't be null"; + } + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets rate + * + * @return float + */ + public function getRate() + { + return $this->container['rate']; + } + + /** + * Sets rate + * + * @param float $rate the click-through rate + * + * @return self + */ + public function setRate($rate) + { + $this->container['rate'] = $rate; + + return $this; + } + + /** + * Gets trackedSearchCount + * + * @return int + */ + public function getTrackedSearchCount() + { + return $this->container['trackedSearchCount']; + } + + /** + * Sets trackedSearchCount + * + * @param int $trackedSearchCount the number of tracked search click + * + * @return self + */ + public function setTrackedSearchCount($trackedSearchCount) + { + $this->container['trackedSearchCount'] = $trackedSearchCount; + + return $this; + } + + /** + * Gets conversionCount + * + * @return int + */ + public function getConversionCount() + { + return $this->container['conversionCount']; + } + + /** + * Sets conversionCount + * + * @param int $conversionCount the number of converted clicks + * + * @return self + */ + public function setConversionCount($conversionCount) + { + $this->container['conversionCount'] = $conversionCount; + + return $this; + } + + /** + * Gets date + * + * @return string + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string $date date of the event + * + * @return self + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetNoClickRateResponse.php b/clients/algoliasearch-client-php/lib/Model/GetNoClickRateResponse.php new file mode 100644 index 0000000000..2bfcd52cb9 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetNoClickRateResponse.php @@ -0,0 +1,393 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetNoClickRateResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getNoClickRateResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rate' => 'double', + 'count' => 'int', + 'noClickCount' => 'int', + 'dates' => '\Algolia\AlgoliaSearch\Model\GetNoClickRateResponseDates[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rate' => 'double', + 'count' => null, + 'noClickCount' => null, + 'dates' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'rate' => 'rate', + 'count' => 'count', + 'noClickCount' => 'noClickCount', + 'dates' => 'dates', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rate' => 'setRate', + 'count' => 'setCount', + 'noClickCount' => 'setNoClickCount', + 'dates' => 'setDates', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rate' => 'getRate', + 'count' => 'getCount', + 'noClickCount' => 'getNoClickCount', + 'dates' => 'getDates', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['rate'] = $data['rate'] ?? null; + $this->container['count'] = $data['count'] ?? null; + $this->container['noClickCount'] = $data['noClickCount'] ?? null; + $this->container['dates'] = $data['dates'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['rate'] === null) { + $invalidProperties[] = "'rate' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['noClickCount'] === null) { + $invalidProperties[] = "'noClickCount' can't be null"; + } + if ($this->container['dates'] === null) { + $invalidProperties[] = "'dates' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets rate + * + * @return float + */ + public function getRate() + { + return $this->container['rate']; + } + + /** + * Sets rate + * + * @param float $rate the click-through rate + * + * @return self + */ + public function setRate($rate) + { + $this->container['rate'] = $rate; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of click event + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets noClickCount + * + * @return int + */ + public function getNoClickCount() + { + return $this->container['noClickCount']; + } + + /** + * Sets noClickCount + * + * @param int $noClickCount the number of click event + * + * @return self + */ + public function setNoClickCount($noClickCount) + { + $this->container['noClickCount'] = $noClickCount; + + return $this; + } + + /** + * Gets dates + * + * @return \Algolia\AlgoliaSearch\Model\GetNoClickRateResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\GetNoClickRateResponseDates[] $dates a list of searches without clicks with their date, rate and counts + * + * @return self + */ + public function setDates($dates) + { + $this->container['dates'] = $dates; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetNoClickRateResponseDates.php b/clients/algoliasearch-client-php/lib/Model/GetNoClickRateResponseDates.php new file mode 100644 index 0000000000..67ff2b7012 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetNoClickRateResponseDates.php @@ -0,0 +1,393 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetNoClickRateResponseDates implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getNoClickRateResponse_dates'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rate' => 'double', + 'count' => 'int', + 'noClickCount' => 'int', + 'date' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rate' => 'double', + 'count' => null, + 'noClickCount' => null, + 'date' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'rate' => 'rate', + 'count' => 'count', + 'noClickCount' => 'noClickCount', + 'date' => 'date', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rate' => 'setRate', + 'count' => 'setCount', + 'noClickCount' => 'setNoClickCount', + 'date' => 'setDate', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rate' => 'getRate', + 'count' => 'getCount', + 'noClickCount' => 'getNoClickCount', + 'date' => 'getDate', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['rate'] = $data['rate'] ?? null; + $this->container['count'] = $data['count'] ?? null; + $this->container['noClickCount'] = $data['noClickCount'] ?? null; + $this->container['date'] = $data['date'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['rate'] === null) { + $invalidProperties[] = "'rate' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['noClickCount'] === null) { + $invalidProperties[] = "'noClickCount' can't be null"; + } + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets rate + * + * @return float + */ + public function getRate() + { + return $this->container['rate']; + } + + /** + * Sets rate + * + * @param float $rate the click-through rate + * + * @return self + */ + public function setRate($rate) + { + $this->container['rate'] = $rate; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of click event + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets noClickCount + * + * @return int + */ + public function getNoClickCount() + { + return $this->container['noClickCount']; + } + + /** + * Sets noClickCount + * + * @param int $noClickCount the number of click event + * + * @return self + */ + public function setNoClickCount($noClickCount) + { + $this->container['noClickCount'] = $noClickCount; + + return $this; + } + + /** + * Gets date + * + * @return string + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string $date date of the event + * + * @return self + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetNoResultsRateResponse.php b/clients/algoliasearch-client-php/lib/Model/GetNoResultsRateResponse.php new file mode 100644 index 0000000000..105d76583f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetNoResultsRateResponse.php @@ -0,0 +1,393 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetNoResultsRateResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getNoResultsRateResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'rate' => 'double', + 'count' => 'int', + 'noResultCount' => 'int', + 'dates' => '\Algolia\AlgoliaSearch\Model\GetNoResultsRateResponseDates[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'rate' => 'double', + 'count' => null, + 'noResultCount' => null, + 'dates' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'rate' => 'rate', + 'count' => 'count', + 'noResultCount' => 'noResultCount', + 'dates' => 'dates', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'rate' => 'setRate', + 'count' => 'setCount', + 'noResultCount' => 'setNoResultCount', + 'dates' => 'setDates', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'rate' => 'getRate', + 'count' => 'getCount', + 'noResultCount' => 'getNoResultCount', + 'dates' => 'getDates', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['rate'] = $data['rate'] ?? null; + $this->container['count'] = $data['count'] ?? null; + $this->container['noResultCount'] = $data['noResultCount'] ?? null; + $this->container['dates'] = $data['dates'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['rate'] === null) { + $invalidProperties[] = "'rate' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['noResultCount'] === null) { + $invalidProperties[] = "'noResultCount' can't be null"; + } + if ($this->container['dates'] === null) { + $invalidProperties[] = "'dates' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets rate + * + * @return float + */ + public function getRate() + { + return $this->container['rate']; + } + + /** + * Sets rate + * + * @param float $rate the click-through rate + * + * @return self + */ + public function setRate($rate) + { + $this->container['rate'] = $rate; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets noResultCount + * + * @return int + */ + public function getNoResultCount() + { + return $this->container['noResultCount']; + } + + /** + * Sets noResultCount + * + * @param int $noResultCount the number of occurrences + * + * @return self + */ + public function setNoResultCount($noResultCount) + { + $this->container['noResultCount'] = $noResultCount; + + return $this; + } + + /** + * Gets dates + * + * @return \Algolia\AlgoliaSearch\Model\GetNoResultsRateResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\GetNoResultsRateResponseDates[] $dates a list of searches without results with their date, rate and counts + * + * @return self + */ + public function setDates($dates) + { + $this->container['dates'] = $dates; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetNoResultsRateResponseDates.php b/clients/algoliasearch-client-php/lib/Model/GetNoResultsRateResponseDates.php new file mode 100644 index 0000000000..cc440c6f5a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetNoResultsRateResponseDates.php @@ -0,0 +1,393 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetNoResultsRateResponseDates implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getNoResultsRateResponse_dates'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'date' => 'string', + 'noResultCount' => 'int', + 'count' => 'int', + 'rate' => 'double', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'date' => null, + 'noResultCount' => null, + 'count' => null, + 'rate' => 'double', + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'date' => 'date', + 'noResultCount' => 'noResultCount', + 'count' => 'count', + 'rate' => 'rate', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'date' => 'setDate', + 'noResultCount' => 'setNoResultCount', + 'count' => 'setCount', + 'rate' => 'setRate', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'date' => 'getDate', + 'noResultCount' => 'getNoResultCount', + 'count' => 'getCount', + 'rate' => 'getRate', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['date'] = $data['date'] ?? null; + $this->container['noResultCount'] = $data['noResultCount'] ?? null; + $this->container['count'] = $data['count'] ?? null; + $this->container['rate'] = $data['rate'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + if ($this->container['noResultCount'] === null) { + $invalidProperties[] = "'noResultCount' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['rate'] === null) { + $invalidProperties[] = "'rate' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets date + * + * @return string + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string $date date of the event + * + * @return self + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets noResultCount + * + * @return int + */ + public function getNoResultCount() + { + return $this->container['noResultCount']; + } + + /** + * Sets noResultCount + * + * @param int $noResultCount the number of occurrences + * + * @return self + */ + public function setNoResultCount($noResultCount) + { + $this->container['noResultCount'] = $noResultCount; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets rate + * + * @return float + */ + public function getRate() + { + return $this->container['rate']; + } + + /** + * Sets rate + * + * @param float $rate the click-through rate + * + * @return self + */ + public function setRate($rate) + { + $this->container['rate'] = $rate; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetRecommendations.php b/clients/algoliasearch-client-php/lib/Model/GetRecommendations.php new file mode 100644 index 0000000000..eb22e73e3d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetRecommendations.php @@ -0,0 +1,296 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetRecommendations implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getRecommendations'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'requests' => '\Algolia\AlgoliaSearch\Model\RecommendationRequest[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'requests' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'requests' => 'requests', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'requests' => 'setRequests', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'requests' => 'getRequests', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['requests'] = $data['requests'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['requests'] === null) { + $invalidProperties[] = "'requests' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets requests + * + * @return \Algolia\AlgoliaSearch\Model\RecommendationRequest[] + */ + public function getRequests() + { + return $this->container['requests']; + } + + /** + * Sets requests + * + * @param \Algolia\AlgoliaSearch\Model\RecommendationRequest[] $requests the `getRecommendations` requests + * + * @return self + */ + public function setRequests($requests) + { + $this->container['requests'] = $requests; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetRecommendationsResponse.php b/clients/algoliasearch-client-php/lib/Model/GetRecommendationsResponse.php new file mode 100644 index 0000000000..a8e38f3239 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetRecommendationsResponse.php @@ -0,0 +1,290 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetRecommendationsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getRecommendationsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'results' => '\Algolia\AlgoliaSearch\Model\RecommendationsResponse[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'results' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'results' => 'results', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'results' => 'setResults', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'results' => 'getResults', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['results'] = $data['results'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets results + * + * @return \Algolia\AlgoliaSearch\Model\RecommendationsResponse[]|null + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \Algolia\AlgoliaSearch\Model\RecommendationsResponse[]|null $results results + * + * @return self + */ + public function setResults($results) + { + $this->container['results'] = $results; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetSearchesCountResponse.php b/clients/algoliasearch-client-php/lib/Model/GetSearchesCountResponse.php new file mode 100644 index 0000000000..c69b2b71e3 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetSearchesCountResponse.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetSearchesCountResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getSearchesCountResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'count' => 'int', + 'dates' => '\Algolia\AlgoliaSearch\Model\GetSearchesCountResponseDates[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'count' => null, + 'dates' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'count' => 'count', + 'dates' => 'dates', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'count' => 'setCount', + 'dates' => 'setDates', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'count' => 'getCount', + 'dates' => 'getDates', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['count'] = $data['count'] ?? null; + $this->container['dates'] = $data['dates'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['dates'] === null) { + $invalidProperties[] = "'dates' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets dates + * + * @return \Algolia\AlgoliaSearch\Model\GetSearchesCountResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\GetSearchesCountResponseDates[] $dates a list of search events with their date and count + * + * @return self + */ + public function setDates($dates) + { + $this->container['dates'] = $dates; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetSearchesCountResponseDates.php b/clients/algoliasearch-client-php/lib/Model/GetSearchesCountResponseDates.php new file mode 100644 index 0000000000..50b609d54b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetSearchesCountResponseDates.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetSearchesCountResponseDates implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getSearchesCountResponse_dates'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'date' => 'string', + 'count' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'date' => null, + 'count' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'date' => 'date', + 'count' => 'count', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'date' => 'setDate', + 'count' => 'setCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'date' => 'getDate', + 'count' => 'getCount', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['date'] = $data['date'] ?? null; + $this->container['count'] = $data['count'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['date'] === null) { + $invalidProperties[] = "'date' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets date + * + * @return string + */ + public function getDate() + { + return $this->container['date']; + } + + /** + * Sets date + * + * @param string $date date of the event + * + * @return self + */ + public function setDate($date) + { + $this->container['date'] = $date; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetSearchesNoClicksResponse.php b/clients/algoliasearch-client-php/lib/Model/GetSearchesNoClicksResponse.php new file mode 100644 index 0000000000..f2be23a148 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetSearchesNoClicksResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetSearchesNoClicksResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getSearchesNoClicksResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'searches' => '\Algolia\AlgoliaSearch\Model\GetSearchesNoClicksResponseSearches[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'searches' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'searches' => 'searches', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'searches' => 'setSearches', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'searches' => 'getSearches', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['searches'] = $data['searches'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['searches'] === null) { + $invalidProperties[] = "'searches' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets searches + * + * @return \Algolia\AlgoliaSearch\Model\GetSearchesNoClicksResponseSearches[] + */ + public function getSearches() + { + return $this->container['searches']; + } + + /** + * Sets searches + * + * @param \Algolia\AlgoliaSearch\Model\GetSearchesNoClicksResponseSearches[] $searches a list of searches with no clicks and their count + * + * @return self + */ + public function setSearches($searches) + { + $this->container['searches'] = $searches; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetSearchesNoClicksResponseSearches.php b/clients/algoliasearch-client-php/lib/Model/GetSearchesNoClicksResponseSearches.php new file mode 100644 index 0000000000..2dc01d8049 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetSearchesNoClicksResponseSearches.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetSearchesNoClicksResponseSearches implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getSearchesNoClicksResponse_searches'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'search' => 'string', + 'count' => 'int', + 'withFilterCount' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'search' => null, + 'count' => null, + 'withFilterCount' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'search' => 'search', + 'count' => 'count', + 'withFilterCount' => 'withFilterCount', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'search' => 'setSearch', + 'count' => 'setCount', + 'withFilterCount' => 'setWithFilterCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'search' => 'getSearch', + 'count' => 'getCount', + 'withFilterCount' => 'getWithFilterCount', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['search'] = $data['search'] ?? null; + $this->container['count'] = $data['count'] ?? null; + $this->container['withFilterCount'] = $data['withFilterCount'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['search'] === null) { + $invalidProperties[] = "'search' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['withFilterCount'] === null) { + $invalidProperties[] = "'withFilterCount' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets search + * + * @return string + */ + public function getSearch() + { + return $this->container['search']; + } + + /** + * Sets search + * + * @param string $search the search query + * + * @return self + */ + public function setSearch($search) + { + $this->container['search'] = $search; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets withFilterCount + * + * @return int + */ + public function getWithFilterCount() + { + return $this->container['withFilterCount']; + } + + /** + * Sets withFilterCount + * + * @param int $withFilterCount the number of occurrences + * + * @return self + */ + public function setWithFilterCount($withFilterCount) + { + $this->container['withFilterCount'] = $withFilterCount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetSearchesNoResultsResponse.php b/clients/algoliasearch-client-php/lib/Model/GetSearchesNoResultsResponse.php new file mode 100644 index 0000000000..799e6d9aed --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetSearchesNoResultsResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetSearchesNoResultsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getSearchesNoResultsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'searches' => '\Algolia\AlgoliaSearch\Model\GetSearchesNoResultsResponseSearches[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'searches' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'searches' => 'searches', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'searches' => 'setSearches', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'searches' => 'getSearches', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['searches'] = $data['searches'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['searches'] === null) { + $invalidProperties[] = "'searches' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets searches + * + * @return \Algolia\AlgoliaSearch\Model\GetSearchesNoResultsResponseSearches[] + */ + public function getSearches() + { + return $this->container['searches']; + } + + /** + * Sets searches + * + * @param \Algolia\AlgoliaSearch\Model\GetSearchesNoResultsResponseSearches[] $searches a list of searches with no results and their count + * + * @return self + */ + public function setSearches($searches) + { + $this->container['searches'] = $searches; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetSearchesNoResultsResponseSearches.php b/clients/algoliasearch-client-php/lib/Model/GetSearchesNoResultsResponseSearches.php new file mode 100644 index 0000000000..e62d855602 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetSearchesNoResultsResponseSearches.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetSearchesNoResultsResponseSearches implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getSearchesNoResultsResponse_searches'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'search' => 'string', + 'count' => 'int', + 'nbHits' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'search' => null, + 'count' => null, + 'nbHits' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'search' => 'search', + 'count' => 'count', + 'nbHits' => 'nbHits', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'search' => 'setSearch', + 'count' => 'setCount', + 'nbHits' => 'setNbHits', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'search' => 'getSearch', + 'count' => 'getCount', + 'nbHits' => 'getNbHits', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['search'] = $data['search'] ?? null; + $this->container['count'] = $data['count'] ?? null; + $this->container['nbHits'] = $data['nbHits'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['search'] === null) { + $invalidProperties[] = "'search' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['nbHits'] === null) { + $invalidProperties[] = "'nbHits' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets search + * + * @return string + */ + public function getSearch() + { + return $this->container['search']; + } + + /** + * Sets search + * + * @param string $search the search query + * + * @return self + */ + public function setSearch($search) + { + $this->container['search'] = $search; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets nbHits + * + * @return int + */ + public function getNbHits() + { + return $this->container['nbHits']; + } + + /** + * Sets nbHits + * + * @param int $nbHits number of hits that the search query matched + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetStatusResponse.php b/clients/algoliasearch-client-php/lib/Model/GetStatusResponse.php new file mode 100644 index 0000000000..d6b6059123 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetStatusResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetStatusResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getStatusResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'updatedAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'updatedAt' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'updatedAt' => 'updatedAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'updatedAt' => 'setUpdatedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'updatedAt' => 'getUpdatedAt', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['updatedAt'] = $data['updatedAt'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['updatedAt'] === null) { + $invalidProperties[] = "'updatedAt' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets updatedAt + * + * @return string + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param string $updatedAt date of last update (ISO-8601 format) + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopCountriesResponse.php b/clients/algoliasearch-client-php/lib/Model/GetTopCountriesResponse.php new file mode 100644 index 0000000000..3f14dca7b0 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopCountriesResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopCountriesResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopCountriesResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'countries' => '\Algolia\AlgoliaSearch\Model\GetTopCountriesResponseCountries[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'countries' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'countries' => 'countries', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'countries' => 'setCountries', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'countries' => 'getCountries', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['countries'] = $data['countries'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['countries'] === null) { + $invalidProperties[] = "'countries' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets countries + * + * @return \Algolia\AlgoliaSearch\Model\GetTopCountriesResponseCountries[] + */ + public function getCountries() + { + return $this->container['countries']; + } + + /** + * Sets countries + * + * @param \Algolia\AlgoliaSearch\Model\GetTopCountriesResponseCountries[] $countries a list of countries with their count + * + * @return self + */ + public function setCountries($countries) + { + $this->container['countries'] = $countries; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopCountriesResponseCountries.php b/clients/algoliasearch-client-php/lib/Model/GetTopCountriesResponseCountries.php new file mode 100644 index 0000000000..9fb9efc54e --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopCountriesResponseCountries.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopCountriesResponseCountries implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopCountriesResponse_countries'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'country' => 'string', + 'count' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'country' => null, + 'count' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'country' => 'country', + 'count' => 'count', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'country' => 'setCountry', + 'count' => 'setCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'country' => 'getCountry', + 'count' => 'getCount', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['country'] = $data['country'] ?? null; + $this->container['count'] = $data['count'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['country'] === null) { + $invalidProperties[] = "'country' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets country + * + * @return string + */ + public function getCountry() + { + return $this->container['country']; + } + + /** + * Sets country + * + * @param string $country the country + * + * @return self + */ + public function setCountry($country) + { + $this->container['country'] = $country; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopFilterAttribute.php b/clients/algoliasearch-client-php/lib/Model/GetTopFilterAttribute.php new file mode 100644 index 0000000000..4b6c98432c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopFilterAttribute.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopFilterAttribute implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopFilterAttribute'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'attribute' => 'string', + 'count' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'attribute' => null, + 'count' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'attribute' => 'attribute', + 'count' => 'count', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'attribute' => 'setAttribute', + 'count' => 'setCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'attribute' => 'getAttribute', + 'count' => 'getCount', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['attribute'] = $data['attribute'] ?? null; + $this->container['count'] = $data['count'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['attribute'] === null) { + $invalidProperties[] = "'attribute' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets attribute + * + * @return string + */ + public function getAttribute() + { + return $this->container['attribute']; + } + + /** + * Sets attribute + * + * @param string $attribute the attribute + * + * @return self + */ + public function setAttribute($attribute) + { + $this->container['attribute'] = $attribute; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopFilterAttributesResponse.php b/clients/algoliasearch-client-php/lib/Model/GetTopFilterAttributesResponse.php new file mode 100644 index 0000000000..d2beebbb36 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopFilterAttributesResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopFilterAttributesResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopFilterAttributesResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'attributes' => '\Algolia\AlgoliaSearch\Model\GetTopFilterAttribute[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'attributes' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'attributes' => 'attributes', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'attributes' => 'setAttributes', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'attributes' => 'getAttributes', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['attributes'] = $data['attributes'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['attributes'] === null) { + $invalidProperties[] = "'attributes' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets attributes + * + * @return \Algolia\AlgoliaSearch\Model\GetTopFilterAttribute[] + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \Algolia\AlgoliaSearch\Model\GetTopFilterAttribute[] $attributes a list of attributes with their count + * + * @return self + */ + public function setAttributes($attributes) + { + $this->container['attributes'] = $attributes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopFilterForAttribute.php b/clients/algoliasearch-client-php/lib/Model/GetTopFilterForAttribute.php new file mode 100644 index 0000000000..2bbecff5be --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopFilterForAttribute.php @@ -0,0 +1,393 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopFilterForAttribute implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopFilterForAttribute'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'attribute' => 'string', + 'operator' => 'string', + 'value' => 'string', + 'count' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'attribute' => null, + 'operator' => null, + 'value' => null, + 'count' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'attribute' => 'attribute', + 'operator' => 'operator', + 'value' => 'value', + 'count' => 'count', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'attribute' => 'setAttribute', + 'operator' => 'setOperator', + 'value' => 'setValue', + 'count' => 'setCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'attribute' => 'getAttribute', + 'operator' => 'getOperator', + 'value' => 'getValue', + 'count' => 'getCount', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['attribute'] = $data['attribute'] ?? null; + $this->container['operator'] = $data['operator'] ?? null; + $this->container['value'] = $data['value'] ?? null; + $this->container['count'] = $data['count'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['attribute'] === null) { + $invalidProperties[] = "'attribute' can't be null"; + } + if ($this->container['operator'] === null) { + $invalidProperties[] = "'operator' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets attribute + * + * @return string + */ + public function getAttribute() + { + return $this->container['attribute']; + } + + /** + * Sets attribute + * + * @param string $attribute the attribute + * + * @return self + */ + public function setAttribute($attribute) + { + $this->container['attribute'] = $attribute; + + return $this; + } + + /** + * Gets operator + * + * @return string + */ + public function getOperator() + { + return $this->container['operator']; + } + + /** + * Sets operator + * + * @param string $operator the operator + * + * @return self + */ + public function setOperator($operator) + { + $this->container['operator'] = $operator; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value the value of the attribute + * + * @return self + */ + public function setValue($value) + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopFilterForAttributeResponse.php b/clients/algoliasearch-client-php/lib/Model/GetTopFilterForAttributeResponse.php new file mode 100644 index 0000000000..fd01bcaaa1 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopFilterForAttributeResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopFilterForAttributeResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopFilterForAttributeResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'values' => '\Algolia\AlgoliaSearch\Model\GetTopFilterForAttribute[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'values' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'values' => 'values', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'values' => 'setValues', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'values' => 'getValues', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['values'] = $data['values'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['values'] === null) { + $invalidProperties[] = "'values' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets values + * + * @return \Algolia\AlgoliaSearch\Model\GetTopFilterForAttribute[] + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param \Algolia\AlgoliaSearch\Model\GetTopFilterForAttribute[] $values a list of filters for the given attributes + * + * @return self + */ + public function setValues($values) + { + $this->container['values'] = $values; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopFiltersNoResultsResponse.php b/clients/algoliasearch-client-php/lib/Model/GetTopFiltersNoResultsResponse.php new file mode 100644 index 0000000000..c0d0433c4b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopFiltersNoResultsResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopFiltersNoResultsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopFiltersNoResultsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'values' => '\Algolia\AlgoliaSearch\Model\GetTopFiltersNoResultsValues[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'values' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'values' => 'values', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'values' => 'setValues', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'values' => 'getValues', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['values'] = $data['values'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['values'] === null) { + $invalidProperties[] = "'values' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets values + * + * @return \Algolia\AlgoliaSearch\Model\GetTopFiltersNoResultsValues[] + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param \Algolia\AlgoliaSearch\Model\GetTopFiltersNoResultsValues[] $values a list of filters without results + * + * @return self + */ + public function setValues($values) + { + $this->container['values'] = $values; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopFiltersNoResultsValue.php b/clients/algoliasearch-client-php/lib/Model/GetTopFiltersNoResultsValue.php new file mode 100644 index 0000000000..1c70c19d13 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopFiltersNoResultsValue.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopFiltersNoResultsValue implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopFiltersNoResultsValue'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'attribute' => 'string', + 'operator' => 'string', + 'value' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'attribute' => null, + 'operator' => null, + 'value' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'attribute' => 'attribute', + 'operator' => 'operator', + 'value' => 'value', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'attribute' => 'setAttribute', + 'operator' => 'setOperator', + 'value' => 'setValue', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'attribute' => 'getAttribute', + 'operator' => 'getOperator', + 'value' => 'getValue', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['attribute'] = $data['attribute'] ?? null; + $this->container['operator'] = $data['operator'] ?? null; + $this->container['value'] = $data['value'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['attribute'] === null) { + $invalidProperties[] = "'attribute' can't be null"; + } + if ($this->container['operator'] === null) { + $invalidProperties[] = "'operator' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets attribute + * + * @return string + */ + public function getAttribute() + { + return $this->container['attribute']; + } + + /** + * Sets attribute + * + * @param string $attribute the attribute + * + * @return self + */ + public function setAttribute($attribute) + { + $this->container['attribute'] = $attribute; + + return $this; + } + + /** + * Gets operator + * + * @return string + */ + public function getOperator() + { + return $this->container['operator']; + } + + /** + * Sets operator + * + * @param string $operator the operator + * + * @return self + */ + public function setOperator($operator) + { + $this->container['operator'] = $operator; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value the value of the attribute + * + * @return self + */ + public function setValue($value) + { + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopFiltersNoResultsValues.php b/clients/algoliasearch-client-php/lib/Model/GetTopFiltersNoResultsValues.php new file mode 100644 index 0000000000..ecf5b6f1c6 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopFiltersNoResultsValues.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopFiltersNoResultsValues implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopFiltersNoResultsValues'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'count' => 'int', + 'values' => '\Algolia\AlgoliaSearch\Model\GetTopFiltersNoResultsValue[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'count' => null, + 'values' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'count' => 'count', + 'values' => 'values', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'count' => 'setCount', + 'values' => 'setValues', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'count' => 'getCount', + 'values' => 'getValues', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['count'] = $data['count'] ?? null; + $this->container['values'] = $data['values'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['values'] === null) { + $invalidProperties[] = "'values' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets values + * + * @return \Algolia\AlgoliaSearch\Model\GetTopFiltersNoResultsValue[] + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param \Algolia\AlgoliaSearch\Model\GetTopFiltersNoResultsValue[] $values a list of filters without results + * + * @return self + */ + public function setValues($values) + { + $this->container['values'] = $values; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponse.php b/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponse.php new file mode 100644 index 0000000000..8a035b1f6c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopHitsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopHitsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hits' => '\Algolia\AlgoliaSearch\Model\GetTopHitsResponseHits[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hits' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'hits' => 'hits', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hits' => 'setHits', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hits' => 'getHits', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['hits'] = $data['hits'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['hits'] === null) { + $invalidProperties[] = "'hits' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets hits + * + * @return \Algolia\AlgoliaSearch\Model\GetTopHitsResponseHits[] + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\GetTopHitsResponseHits[] $hits a list of top hits with their count + * + * @return self + */ + public function setHits($hits) + { + $this->container['hits'] = $hits; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponseHits.php b/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponseHits.php new file mode 100644 index 0000000000..28ef3cb704 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponseHits.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopHitsResponseHits implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopHitsResponse_hits'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hit' => 'string', + 'count' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hit' => null, + 'count' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'hit' => 'hit', + 'count' => 'count', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hit' => 'setHit', + 'count' => 'setCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hit' => 'getHit', + 'count' => 'getCount', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['hit'] = $data['hit'] ?? null; + $this->container['count'] = $data['count'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['hit'] === null) { + $invalidProperties[] = "'hit' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets hit + * + * @return string + */ + public function getHit() + { + return $this->container['hit']; + } + + /** + * Sets hit + * + * @param string $hit the hit + * + * @return self + */ + public function setHit($hit) + { + $this->container['hit'] = $hit; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponseWithAnalytics.php b/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponseWithAnalytics.php new file mode 100644 index 0000000000..793d687fe2 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponseWithAnalytics.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopHitsResponseWithAnalytics implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopHitsResponseWithAnalytics'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hits' => '\Algolia\AlgoliaSearch\Model\GetTopHitsResponseWithAnalyticsHits[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hits' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'hits' => 'hits', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hits' => 'setHits', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hits' => 'getHits', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['hits'] = $data['hits'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['hits'] === null) { + $invalidProperties[] = "'hits' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets hits + * + * @return \Algolia\AlgoliaSearch\Model\GetTopHitsResponseWithAnalyticsHits[] + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\GetTopHitsResponseWithAnalyticsHits[] $hits a list of top hits with their count and analytics + * + * @return self + */ + public function setHits($hits) + { + $this->container['hits'] = $hits; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponseWithAnalyticsHits.php b/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponseWithAnalyticsHits.php new file mode 100644 index 0000000000..79c0f96e23 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopHitsResponseWithAnalyticsHits.php @@ -0,0 +1,492 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopHitsResponseWithAnalyticsHits implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopHitsResponseWithAnalytics_hits'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hit' => 'string', + 'count' => 'int', + 'clickThroughRate' => 'double', + 'conversionRate' => 'double', + 'trackedSearchCount' => 'int', + 'clickCount' => 'int', + 'conversionCount' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hit' => null, + 'count' => null, + 'clickThroughRate' => 'double', + 'conversionRate' => 'double', + 'trackedSearchCount' => null, + 'clickCount' => null, + 'conversionCount' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'hit' => 'hit', + 'count' => 'count', + 'clickThroughRate' => 'clickThroughRate', + 'conversionRate' => 'conversionRate', + 'trackedSearchCount' => 'trackedSearchCount', + 'clickCount' => 'clickCount', + 'conversionCount' => 'conversionCount', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hit' => 'setHit', + 'count' => 'setCount', + 'clickThroughRate' => 'setClickThroughRate', + 'conversionRate' => 'setConversionRate', + 'trackedSearchCount' => 'setTrackedSearchCount', + 'clickCount' => 'setClickCount', + 'conversionCount' => 'setConversionCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hit' => 'getHit', + 'count' => 'getCount', + 'clickThroughRate' => 'getClickThroughRate', + 'conversionRate' => 'getConversionRate', + 'trackedSearchCount' => 'getTrackedSearchCount', + 'clickCount' => 'getClickCount', + 'conversionCount' => 'getConversionCount', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['hit'] = $data['hit'] ?? null; + $this->container['count'] = $data['count'] ?? null; + $this->container['clickThroughRate'] = $data['clickThroughRate'] ?? null; + $this->container['conversionRate'] = $data['conversionRate'] ?? null; + $this->container['trackedSearchCount'] = $data['trackedSearchCount'] ?? null; + $this->container['clickCount'] = $data['clickCount'] ?? null; + $this->container['conversionCount'] = $data['conversionCount'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['hit'] === null) { + $invalidProperties[] = "'hit' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['clickThroughRate'] === null) { + $invalidProperties[] = "'clickThroughRate' can't be null"; + } + if ($this->container['conversionRate'] === null) { + $invalidProperties[] = "'conversionRate' can't be null"; + } + if ($this->container['trackedSearchCount'] === null) { + $invalidProperties[] = "'trackedSearchCount' can't be null"; + } + if ($this->container['clickCount'] === null) { + $invalidProperties[] = "'clickCount' can't be null"; + } + if ($this->container['conversionCount'] === null) { + $invalidProperties[] = "'conversionCount' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets hit + * + * @return string + */ + public function getHit() + { + return $this->container['hit']; + } + + /** + * Sets hit + * + * @param string $hit the hit + * + * @return self + */ + public function setHit($hit) + { + $this->container['hit'] = $hit; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets clickThroughRate + * + * @return float + */ + public function getClickThroughRate() + { + return $this->container['clickThroughRate']; + } + + /** + * Sets clickThroughRate + * + * @param float $clickThroughRate the click-through rate + * + * @return self + */ + public function setClickThroughRate($clickThroughRate) + { + $this->container['clickThroughRate'] = $clickThroughRate; + + return $this; + } + + /** + * Gets conversionRate + * + * @return float + */ + public function getConversionRate() + { + return $this->container['conversionRate']; + } + + /** + * Sets conversionRate + * + * @param float $conversionRate the conversion rate + * + * @return self + */ + public function setConversionRate($conversionRate) + { + $this->container['conversionRate'] = $conversionRate; + + return $this; + } + + /** + * Gets trackedSearchCount + * + * @return int + */ + public function getTrackedSearchCount() + { + return $this->container['trackedSearchCount']; + } + + /** + * Sets trackedSearchCount + * + * @param int $trackedSearchCount the number of tracked search click + * + * @return self + */ + public function setTrackedSearchCount($trackedSearchCount) + { + $this->container['trackedSearchCount'] = $trackedSearchCount; + + return $this; + } + + /** + * Gets clickCount + * + * @return int + */ + public function getClickCount() + { + return $this->container['clickCount']; + } + + /** + * Sets clickCount + * + * @param int $clickCount the number of click event + * + * @return self + */ + public function setClickCount($clickCount) + { + $this->container['clickCount'] = $clickCount; + + return $this; + } + + /** + * Gets conversionCount + * + * @return int + */ + public function getConversionCount() + { + return $this->container['conversionCount']; + } + + /** + * Sets conversionCount + * + * @param int $conversionCount the number of converted clicks + * + * @return self + */ + public function setConversionCount($conversionCount) + { + $this->container['conversionCount'] = $conversionCount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopSearchesResponse.php b/clients/algoliasearch-client-php/lib/Model/GetTopSearchesResponse.php new file mode 100644 index 0000000000..3d8c6f9479 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopSearchesResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopSearchesResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopSearchesResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'searches' => '\Algolia\AlgoliaSearch\Model\GetSearchesNoResultsResponseSearches[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'searches' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'searches' => 'searches', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'searches' => 'setSearches', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'searches' => 'getSearches', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['searches'] = $data['searches'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['searches'] === null) { + $invalidProperties[] = "'searches' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets searches + * + * @return \Algolia\AlgoliaSearch\Model\GetSearchesNoResultsResponseSearches[] + */ + public function getSearches() + { + return $this->container['searches']; + } + + /** + * Sets searches + * + * @param \Algolia\AlgoliaSearch\Model\GetSearchesNoResultsResponseSearches[] $searches a list of top searches with their count + * + * @return self + */ + public function setSearches($searches) + { + $this->container['searches'] = $searches; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopSearchesResponseWithAnalytics.php b/clients/algoliasearch-client-php/lib/Model/GetTopSearchesResponseWithAnalytics.php new file mode 100644 index 0000000000..0d0db16e04 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopSearchesResponseWithAnalytics.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopSearchesResponseWithAnalytics implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopSearchesResponseWithAnalytics'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'searches' => '\Algolia\AlgoliaSearch\Model\GetTopSearchesResponseWithAnalyticsSearches[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'searches' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'searches' => 'searches', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'searches' => 'setSearches', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'searches' => 'getSearches', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['searches'] = $data['searches'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['searches'] === null) { + $invalidProperties[] = "'searches' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets searches + * + * @return \Algolia\AlgoliaSearch\Model\GetTopSearchesResponseWithAnalyticsSearches[] + */ + public function getSearches() + { + return $this->container['searches']; + } + + /** + * Sets searches + * + * @param \Algolia\AlgoliaSearch\Model\GetTopSearchesResponseWithAnalyticsSearches[] $searches a list of top searches with their count and analytics + * + * @return self + */ + public function setSearches($searches) + { + $this->container['searches'] = $searches; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetTopSearchesResponseWithAnalyticsSearches.php b/clients/algoliasearch-client-php/lib/Model/GetTopSearchesResponseWithAnalyticsSearches.php new file mode 100644 index 0000000000..78f499d88c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetTopSearchesResponseWithAnalyticsSearches.php @@ -0,0 +1,558 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopSearchesResponseWithAnalyticsSearches implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopSearchesResponseWithAnalytics_searches'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'search' => 'string', + 'count' => 'int', + 'clickThroughRate' => 'double', + 'averageClickPosition' => 'int', + 'conversionRate' => 'double', + 'trackedSearchCount' => 'int', + 'clickCount' => 'int', + 'conversionCount' => 'int', + 'nbHits' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'search' => null, + 'count' => null, + 'clickThroughRate' => 'double', + 'averageClickPosition' => null, + 'conversionRate' => 'double', + 'trackedSearchCount' => null, + 'clickCount' => null, + 'conversionCount' => null, + 'nbHits' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'search' => 'search', + 'count' => 'count', + 'clickThroughRate' => 'clickThroughRate', + 'averageClickPosition' => 'averageClickPosition', + 'conversionRate' => 'conversionRate', + 'trackedSearchCount' => 'trackedSearchCount', + 'clickCount' => 'clickCount', + 'conversionCount' => 'conversionCount', + 'nbHits' => 'nbHits', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'search' => 'setSearch', + 'count' => 'setCount', + 'clickThroughRate' => 'setClickThroughRate', + 'averageClickPosition' => 'setAverageClickPosition', + 'conversionRate' => 'setConversionRate', + 'trackedSearchCount' => 'setTrackedSearchCount', + 'clickCount' => 'setClickCount', + 'conversionCount' => 'setConversionCount', + 'nbHits' => 'setNbHits', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'search' => 'getSearch', + 'count' => 'getCount', + 'clickThroughRate' => 'getClickThroughRate', + 'averageClickPosition' => 'getAverageClickPosition', + 'conversionRate' => 'getConversionRate', + 'trackedSearchCount' => 'getTrackedSearchCount', + 'clickCount' => 'getClickCount', + 'conversionCount' => 'getConversionCount', + 'nbHits' => 'getNbHits', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['search'] = $data['search'] ?? null; + $this->container['count'] = $data['count'] ?? null; + $this->container['clickThroughRate'] = $data['clickThroughRate'] ?? null; + $this->container['averageClickPosition'] = $data['averageClickPosition'] ?? null; + $this->container['conversionRate'] = $data['conversionRate'] ?? null; + $this->container['trackedSearchCount'] = $data['trackedSearchCount'] ?? null; + $this->container['clickCount'] = $data['clickCount'] ?? null; + $this->container['conversionCount'] = $data['conversionCount'] ?? null; + $this->container['nbHits'] = $data['nbHits'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['search'] === null) { + $invalidProperties[] = "'search' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['clickThroughRate'] === null) { + $invalidProperties[] = "'clickThroughRate' can't be null"; + } + if ($this->container['averageClickPosition'] === null) { + $invalidProperties[] = "'averageClickPosition' can't be null"; + } + if ($this->container['conversionRate'] === null) { + $invalidProperties[] = "'conversionRate' can't be null"; + } + if ($this->container['trackedSearchCount'] === null) { + $invalidProperties[] = "'trackedSearchCount' can't be null"; + } + if ($this->container['clickCount'] === null) { + $invalidProperties[] = "'clickCount' can't be null"; + } + if ($this->container['conversionCount'] === null) { + $invalidProperties[] = "'conversionCount' can't be null"; + } + if ($this->container['nbHits'] === null) { + $invalidProperties[] = "'nbHits' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets search + * + * @return string + */ + public function getSearch() + { + return $this->container['search']; + } + + /** + * Sets search + * + * @param string $search the search query + * + * @return self + */ + public function setSearch($search) + { + $this->container['search'] = $search; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets clickThroughRate + * + * @return float + */ + public function getClickThroughRate() + { + return $this->container['clickThroughRate']; + } + + /** + * Sets clickThroughRate + * + * @param float $clickThroughRate the click-through rate + * + * @return self + */ + public function setClickThroughRate($clickThroughRate) + { + $this->container['clickThroughRate'] = $clickThroughRate; + + return $this; + } + + /** + * Gets averageClickPosition + * + * @return int + */ + public function getAverageClickPosition() + { + return $this->container['averageClickPosition']; + } + + /** + * Sets averageClickPosition + * + * @param int $averageClickPosition the average position of all the click count event + * + * @return self + */ + public function setAverageClickPosition($averageClickPosition) + { + $this->container['averageClickPosition'] = $averageClickPosition; + + return $this; + } + + /** + * Gets conversionRate + * + * @return float + */ + public function getConversionRate() + { + return $this->container['conversionRate']; + } + + /** + * Sets conversionRate + * + * @param float $conversionRate the conversion rate + * + * @return self + */ + public function setConversionRate($conversionRate) + { + $this->container['conversionRate'] = $conversionRate; + + return $this; + } + + /** + * Gets trackedSearchCount + * + * @return int + */ + public function getTrackedSearchCount() + { + return $this->container['trackedSearchCount']; + } + + /** + * Sets trackedSearchCount + * + * @param int $trackedSearchCount the number of tracked search click + * + * @return self + */ + public function setTrackedSearchCount($trackedSearchCount) + { + $this->container['trackedSearchCount'] = $trackedSearchCount; + + return $this; + } + + /** + * Gets clickCount + * + * @return int + */ + public function getClickCount() + { + return $this->container['clickCount']; + } + + /** + * Sets clickCount + * + * @param int $clickCount the number of click event + * + * @return self + */ + public function setClickCount($clickCount) + { + $this->container['clickCount'] = $clickCount; + + return $this; + } + + /** + * Gets conversionCount + * + * @return int + */ + public function getConversionCount() + { + return $this->container['conversionCount']; + } + + /** + * Sets conversionCount + * + * @param int $conversionCount the number of converted clicks + * + * @return self + */ + public function setConversionCount($conversionCount) + { + $this->container['conversionCount'] = $conversionCount; + + return $this; + } + + /** + * Gets nbHits + * + * @return int + */ + public function getNbHits() + { + return $this->container['nbHits']; + } + + /** + * Sets nbHits + * + * @param int $nbHits number of hits that the search query matched + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetUserTokenResponse.php b/clients/algoliasearch-client-php/lib/Model/GetUserTokenResponse.php new file mode 100644 index 0000000000..ada51dd20d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetUserTokenResponse.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetUserTokenResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getUserTokenResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'userToken' => 'string', + 'lastEventAt' => 'string', + 'scores' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'userToken' => null, + 'lastEventAt' => null, + 'scores' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'userToken' => 'userToken', + 'lastEventAt' => 'lastEventAt', + 'scores' => 'scores', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'userToken' => 'setUserToken', + 'lastEventAt' => 'setLastEventAt', + 'scores' => 'setScores', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'userToken' => 'getUserToken', + 'lastEventAt' => 'getLastEventAt', + 'scores' => 'getScores', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['userToken'] = $data['userToken'] ?? null; + $this->container['lastEventAt'] = $data['lastEventAt'] ?? null; + $this->container['scores'] = $data['scores'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['userToken'] === null) { + $invalidProperties[] = "'userToken' can't be null"; + } + if ($this->container['lastEventAt'] === null) { + $invalidProperties[] = "'lastEventAt' can't be null"; + } + if ($this->container['scores'] === null) { + $invalidProperties[] = "'scores' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets userToken + * + * @return string + */ + public function getUserToken() + { + return $this->container['userToken']; + } + + /** + * Sets userToken + * + * @param string $userToken userToken representing the user for which to fetch the Personalization profile + * + * @return self + */ + public function setUserToken($userToken) + { + $this->container['userToken'] = $userToken; + + return $this; + } + + /** + * Gets lastEventAt + * + * @return string + */ + public function getLastEventAt() + { + return $this->container['lastEventAt']; + } + + /** + * Sets lastEventAt + * + * @param string $lastEventAt Date of last event update. (ISO-8601 format) + * + * @return self + */ + public function setLastEventAt($lastEventAt) + { + $this->container['lastEventAt'] = $lastEventAt; + + return $this; + } + + /** + * Gets scores + * + * @return object + */ + public function getScores() + { + return $this->container['scores']; + } + + /** + * Sets scores + * + * @param object $scores the userToken scores + * + * @return self + */ + public function setScores($scores) + { + $this->container['scores'] = $scores; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/GetUsersCountResponse.php b/clients/algoliasearch-client-php/lib/Model/GetUsersCountResponse.php new file mode 100644 index 0000000000..cb0f65544c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/GetUsersCountResponse.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetUsersCountResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getUsersCountResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'count' => 'int', + 'dates' => '\Algolia\AlgoliaSearch\Model\GetSearchesCountResponseDates[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'count' => null, + 'dates' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'count' => 'count', + 'dates' => 'dates', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'count' => 'setCount', + 'dates' => 'setDates', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'count' => 'getCount', + 'dates' => 'getDates', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['count'] = $data['count'] ?? null; + $this->container['dates'] = $data['dates'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['dates'] === null) { + $invalidProperties[] = "'dates' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count the number of occurrences + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets dates + * + * @return \Algolia\AlgoliaSearch\Model\GetSearchesCountResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\GetSearchesCountResponseDates[] $dates a list of users count with their date + * + * @return self + */ + public function setDates($dates) + { + $this->container['dates'] = $dates; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/IndexName.php b/clients/algoliasearch-client-php/lib/Model/IndexName.php new file mode 100644 index 0000000000..53adbac337 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/IndexName.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class IndexName implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'IndexName'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'indexName' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'indexName' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'indexName' => 'indexName', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'indexName' => 'setIndexName', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'indexName' => 'getIndexName', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['indexName'] = $data['indexName'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['indexName'] === null) { + $invalidProperties[] = "'indexName' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets indexName + * + * @return string + */ + public function getIndexName() + { + return $this->container['indexName']; + } + + /** + * Sets indexName + * + * @param string $indexName index name to target + * + * @return self + */ + public function setIndexName($indexName) + { + $this->container['indexName'] = $indexName; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/InsightEvent.php b/clients/algoliasearch-client-php/lib/Model/InsightEvent.php new file mode 100644 index 0000000000..a3e9fd6e04 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/InsightEvent.php @@ -0,0 +1,582 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class InsightEvent implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InsightEvent'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'eventType' => 'string', + 'eventName' => 'string', + 'index' => 'string', + 'userToken' => 'string', + 'timestamp' => 'int', + 'queryID' => 'string', + 'objectIDs' => 'string[]', + 'filters' => 'string[]', + 'positions' => 'int[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'eventType' => null, + 'eventName' => null, + 'index' => null, + 'userToken' => null, + 'timestamp' => null, + 'queryID' => null, + 'objectIDs' => null, + 'filters' => null, + 'positions' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'eventType' => 'eventType', + 'eventName' => 'eventName', + 'index' => 'index', + 'userToken' => 'userToken', + 'timestamp' => 'timestamp', + 'queryID' => 'queryID', + 'objectIDs' => 'objectIDs', + 'filters' => 'filters', + 'positions' => 'positions', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'eventType' => 'setEventType', + 'eventName' => 'setEventName', + 'index' => 'setIndex', + 'userToken' => 'setUserToken', + 'timestamp' => 'setTimestamp', + 'queryID' => 'setQueryID', + 'objectIDs' => 'setObjectIDs', + 'filters' => 'setFilters', + 'positions' => 'setPositions', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'eventType' => 'getEventType', + 'eventName' => 'getEventName', + 'index' => 'getIndex', + 'userToken' => 'getUserToken', + 'timestamp' => 'getTimestamp', + 'queryID' => 'getQueryID', + 'objectIDs' => 'getObjectIDs', + 'filters' => 'getFilters', + 'positions' => 'getPositions', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + const EVENT_TYPE_CLICK = 'click'; + const EVENT_TYPE_CONVERSION = 'conversion'; + const EVENT_TYPE_VIEW = 'view'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getEventTypeAllowableValues() + { + return [ + self::EVENT_TYPE_CLICK, + self::EVENT_TYPE_CONVERSION, + self::EVENT_TYPE_VIEW, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['eventType'] = $data['eventType'] ?? null; + $this->container['eventName'] = $data['eventName'] ?? null; + $this->container['index'] = $data['index'] ?? null; + $this->container['userToken'] = $data['userToken'] ?? null; + $this->container['timestamp'] = $data['timestamp'] ?? null; + $this->container['queryID'] = $data['queryID'] ?? null; + $this->container['objectIDs'] = $data['objectIDs'] ?? null; + $this->container['filters'] = $data['filters'] ?? null; + $this->container['positions'] = $data['positions'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['eventType'] === null) { + $invalidProperties[] = "'eventType' can't be null"; + } + $allowedValues = $this->getEventTypeAllowableValues(); + if (!is_null($this->container['eventType']) && !in_array($this->container['eventType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'eventType', must be one of '%s'", + $this->container['eventType'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['eventName'] === null) { + $invalidProperties[] = "'eventName' can't be null"; + } + if ($this->container['index'] === null) { + $invalidProperties[] = "'index' can't be null"; + } + if ($this->container['userToken'] === null) { + $invalidProperties[] = "'userToken' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets eventType + * + * @return string + */ + public function getEventType() + { + return $this->container['eventType']; + } + + /** + * Sets eventType + * + * @param string $eventType an eventType can be a click, a conversion, or a view + * + * @return self + */ + public function setEventType($eventType) + { + $allowedValues = $this->getEventTypeAllowableValues(); + if (!in_array($eventType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'eventType', must be one of '%s'", + $eventType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['eventType'] = $eventType; + + return $this; + } + + /** + * Gets eventName + * + * @return string + */ + public function getEventName() + { + return $this->container['eventName']; + } + + /** + * Sets eventName + * + * @param string $eventName a user-defined string used to categorize events + * + * @return self + */ + public function setEventName($eventName) + { + $this->container['eventName'] = $eventName; + + return $this; + } + + /** + * Gets index + * + * @return string + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param string $index name of the targeted index + * + * @return self + */ + public function setIndex($index) + { + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets userToken + * + * @return string + */ + public function getUserToken() + { + return $this->container['userToken']; + } + + /** + * Sets userToken + * + * @param string $userToken A user identifier. Depending if the user is logged-in or not, several strategies can be used from a sessionId to a technical identifier. + * + * @return self + */ + public function setUserToken($userToken) + { + $this->container['userToken'] = $userToken; + + return $this; + } + + /** + * Gets timestamp + * + * @return int|null + */ + public function getTimestamp() + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param int|null $timestamp time of the event expressed in milliseconds since the Unix epoch + * + * @return self + */ + public function setTimestamp($timestamp) + { + $this->container['timestamp'] = $timestamp; + + return $this; + } + + /** + * Gets queryID + * + * @return string|null + */ + public function getQueryID() + { + return $this->container['queryID']; + } + + /** + * Sets queryID + * + * @param string|null $queryID Algolia queryID. This is required when an event is tied to a search. + * + * @return self + */ + public function setQueryID($queryID) + { + $this->container['queryID'] = $queryID; + + return $this; + } + + /** + * Gets objectIDs + * + * @return string[]|null + */ + public function getObjectIDs() + { + return $this->container['objectIDs']; + } + + /** + * Sets objectIDs + * + * @param string[]|null $objectIDs An array of index objectID. Limited to 20 objects. An event can’t have both objectIDs and filters at the same time. + * + * @return self + */ + public function setObjectIDs($objectIDs) + { + $this->container['objectIDs'] = $objectIDs; + + return $this; + } + + /** + * Gets filters + * + * @return string[]|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param string[]|null $filters An array of filters. Limited to 10 filters. An event can’t have both objectIDs and filters at the same time. + * + * @return self + */ + public function setFilters($filters) + { + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets positions + * + * @return int[]|null + */ + public function getPositions() + { + return $this->container['positions']; + } + + /** + * Sets positions + * + * @param int[]|null $positions Position of the click in the list of Algolia search results. This field is required if a queryID is provided. One position must be provided for each objectID. + * + * @return self + */ + public function setPositions($positions) + { + $this->container['positions'] = $positions; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/InsightEvents.php b/clients/algoliasearch-client-php/lib/Model/InsightEvents.php new file mode 100644 index 0000000000..82e03abbd3 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/InsightEvents.php @@ -0,0 +1,296 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class InsightEvents implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InsightEvents'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'events' => '\Algolia\AlgoliaSearch\Model\InsightEvent[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'events' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'events' => 'events', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'events' => 'setEvents', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'events' => 'getEvents', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['events'] = $data['events'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['events'] === null) { + $invalidProperties[] = "'events' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets events + * + * @return \Algolia\AlgoliaSearch\Model\InsightEvent[] + */ + public function getEvents() + { + return $this->container['events']; + } + + /** + * Sets events + * + * @param \Algolia\AlgoliaSearch\Model\InsightEvent[] $events array of events sent + * + * @return self + */ + public function setEvents($events) + { + $this->container['events'] = $events; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/ListABTestsResponse.php b/clients/algoliasearch-client-php/lib/Model/ListABTestsResponse.php new file mode 100644 index 0000000000..7cd41af6e9 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ListABTestsResponse.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ListABTestsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'listABTestsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'abtests' => '\Algolia\AlgoliaSearch\Model\ABTest[]', + 'count' => 'int', + 'total' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'abtests' => null, + 'count' => null, + 'total' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'abtests' => 'abtests', + 'count' => 'count', + 'total' => 'total', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'abtests' => 'setAbtests', + 'count' => 'setCount', + 'total' => 'setTotal', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'abtests' => 'getAbtests', + 'count' => 'getCount', + 'total' => 'getTotal', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['abtests'] = $data['abtests'] ?? null; + $this->container['count'] = $data['count'] ?? null; + $this->container['total'] = $data['total'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['abtests'] === null) { + $invalidProperties[] = "'abtests' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if ($this->container['total'] === null) { + $invalidProperties[] = "'total' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets abtests + * + * @return \Algolia\AlgoliaSearch\Model\ABTest[] + */ + public function getAbtests() + { + return $this->container['abtests']; + } + + /** + * Sets abtests + * + * @param \Algolia\AlgoliaSearch\Model\ABTest[] $abtests list of A/B tests + * + * @return self + */ + public function setAbtests($abtests) + { + $this->container['abtests'] = $abtests; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count number of A/B tests found for the app + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets total + * + * @return int + */ + public function getTotal() + { + return $this->container['total']; + } + + /** + * Sets total + * + * @param int $total number of A/B tests retrievable + * + * @return self + */ + public function setTotal($total) + { + $this->container['total'] = $total; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/LogFile.php b/clients/algoliasearch-client-php/lib/Model/LogFile.php new file mode 100644 index 0000000000..321cd2857c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/LogFile.php @@ -0,0 +1,430 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class LogFile implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'LogFile'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'timestamp' => 'string', + 'level' => 'string', + 'message' => 'string', + 'contextLevel' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'timestamp' => null, + 'level' => null, + 'message' => null, + 'contextLevel' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'timestamp' => 'timestamp', + 'level' => 'level', + 'message' => 'message', + 'contextLevel' => 'contextLevel', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'timestamp' => 'setTimestamp', + 'level' => 'setLevel', + 'message' => 'setMessage', + 'contextLevel' => 'setContextLevel', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'timestamp' => 'getTimestamp', + 'level' => 'getLevel', + 'message' => 'getMessage', + 'contextLevel' => 'getContextLevel', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + const LEVEL_INFO = 'INFO'; + const LEVEL_SKIP = 'SKIP'; + const LEVEL_ERROR = 'ERROR'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLevelAllowableValues() + { + return [ + self::LEVEL_INFO, + self::LEVEL_SKIP, + self::LEVEL_ERROR, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['timestamp'] = $data['timestamp'] ?? null; + $this->container['level'] = $data['level'] ?? null; + $this->container['message'] = $data['message'] ?? null; + $this->container['contextLevel'] = $data['contextLevel'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['timestamp'] === null) { + $invalidProperties[] = "'timestamp' can't be null"; + } + if ($this->container['level'] === null) { + $invalidProperties[] = "'level' can't be null"; + } + $allowedValues = $this->getLevelAllowableValues(); + if (!is_null($this->container['level']) && !in_array($this->container['level'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'level', must be one of '%s'", + $this->container['level'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + if ($this->container['contextLevel'] === null) { + $invalidProperties[] = "'contextLevel' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets timestamp + * + * @return string + */ + public function getTimestamp() + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param string $timestamp date and time of creation of the record + * + * @return self + */ + public function setTimestamp($timestamp) + { + $this->container['timestamp'] = $timestamp; + + return $this; + } + + /** + * Gets level + * + * @return string + */ + public function getLevel() + { + return $this->container['level']; + } + + /** + * Sets level + * + * @param string $level type of the record, can be one of three values (INFO, SKIP or ERROR) + * + * @return self + */ + public function setLevel($level) + { + $allowedValues = $this->getLevelAllowableValues(); + if (!in_array($level, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'level', must be one of '%s'", + $level, + implode("', '", $allowedValues) + ) + ); + } + $this->container['level'] = $level; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message detailed description of what happened + * + * @return self + */ + public function setMessage($message) + { + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets contextLevel + * + * @return int + */ + public function getContextLevel() + { + return $this->container['contextLevel']; + } + + /** + * Sets contextLevel + * + * @param int $contextLevel indicates the hierarchy of the records. For example, a record with contextLevel=1 belongs to a preceding record with contextLevel=0. + * + * @return self + */ + public function setContextLevel($contextLevel) + { + $this->container['contextLevel'] = $contextLevel; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/PersonalizationStrategyObject.php b/clients/algoliasearch-client-php/lib/Model/PersonalizationStrategyObject.php new file mode 100644 index 0000000000..746d941183 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/PersonalizationStrategyObject.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonalizationStrategyObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'personalizationStrategyObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'eventScoring' => '\Algolia\AlgoliaSearch\Model\EventScoring[]', + 'facetScoring' => '\Algolia\AlgoliaSearch\Model\FacetScoring[]', + 'personalizationImpact' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'eventScoring' => null, + 'facetScoring' => null, + 'personalizationImpact' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'eventScoring' => 'eventScoring', + 'facetScoring' => 'facetScoring', + 'personalizationImpact' => 'personalizationImpact', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'eventScoring' => 'setEventScoring', + 'facetScoring' => 'setFacetScoring', + 'personalizationImpact' => 'setPersonalizationImpact', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'eventScoring' => 'getEventScoring', + 'facetScoring' => 'getFacetScoring', + 'personalizationImpact' => 'getPersonalizationImpact', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['eventScoring'] = $data['eventScoring'] ?? null; + $this->container['facetScoring'] = $data['facetScoring'] ?? null; + $this->container['personalizationImpact'] = $data['personalizationImpact'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['eventScoring'] === null) { + $invalidProperties[] = "'eventScoring' can't be null"; + } + if ($this->container['facetScoring'] === null) { + $invalidProperties[] = "'facetScoring' can't be null"; + } + if ($this->container['personalizationImpact'] === null) { + $invalidProperties[] = "'personalizationImpact' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets eventScoring + * + * @return \Algolia\AlgoliaSearch\Model\EventScoring[] + */ + public function getEventScoring() + { + return $this->container['eventScoring']; + } + + /** + * Sets eventScoring + * + * @param \Algolia\AlgoliaSearch\Model\EventScoring[] $eventScoring scores associated with the events + * + * @return self + */ + public function setEventScoring($eventScoring) + { + $this->container['eventScoring'] = $eventScoring; + + return $this; + } + + /** + * Gets facetScoring + * + * @return \Algolia\AlgoliaSearch\Model\FacetScoring[] + */ + public function getFacetScoring() + { + return $this->container['facetScoring']; + } + + /** + * Sets facetScoring + * + * @param \Algolia\AlgoliaSearch\Model\FacetScoring[] $facetScoring scores associated with the facets + * + * @return self + */ + public function setFacetScoring($facetScoring) + { + $this->container['facetScoring'] = $facetScoring; + + return $this; + } + + /** + * Gets personalizationImpact + * + * @return int + */ + public function getPersonalizationImpact() + { + return $this->container['personalizationImpact']; + } + + /** + * Sets personalizationImpact + * + * @param int $personalizationImpact the impact that personalization has on search results: a number between 0 (personalization disabled) and 100 (personalization fully enabled) + * + * @return self + */ + public function setPersonalizationImpact($personalizationImpact) + { + $this->container['personalizationImpact'] = $personalizationImpact; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/PushEventsResponse.php b/clients/algoliasearch-client-php/lib/Model/PushEventsResponse.php new file mode 100644 index 0000000000..b3c5b2a229 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/PushEventsResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PushEventsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'pushEventsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['message'] = $data['message'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message a message confirming the event push + * + * @return self + */ + public function setMessage($message) + { + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/QuerySuggestionsIndex.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestionsIndex.php new file mode 100644 index 0000000000..d3d86d5abe --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestionsIndex.php @@ -0,0 +1,393 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class QuerySuggestionsIndex implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QuerySuggestionsIndex'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'indexName' => 'string', + 'sourceIndices' => '\Algolia\AlgoliaSearch\Model\SourceIndexWithReplicas[]', + 'languages' => 'string[]', + 'exclude' => 'string[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'indexName' => null, + 'sourceIndices' => null, + 'languages' => null, + 'exclude' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'indexName' => 'indexName', + 'sourceIndices' => 'sourceIndices', + 'languages' => 'languages', + 'exclude' => 'exclude', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'indexName' => 'setIndexName', + 'sourceIndices' => 'setSourceIndices', + 'languages' => 'setLanguages', + 'exclude' => 'setExclude', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'indexName' => 'getIndexName', + 'sourceIndices' => 'getSourceIndices', + 'languages' => 'getLanguages', + 'exclude' => 'getExclude', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['indexName'] = $data['indexName'] ?? null; + $this->container['sourceIndices'] = $data['sourceIndices'] ?? null; + $this->container['languages'] = $data['languages'] ?? null; + $this->container['exclude'] = $data['exclude'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['indexName'] === null) { + $invalidProperties[] = "'indexName' can't be null"; + } + if ($this->container['sourceIndices'] === null) { + $invalidProperties[] = "'sourceIndices' can't be null"; + } + if ($this->container['languages'] === null) { + $invalidProperties[] = "'languages' can't be null"; + } + if ($this->container['exclude'] === null) { + $invalidProperties[] = "'exclude' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets indexName + * + * @return string + */ + public function getIndexName() + { + return $this->container['indexName']; + } + + /** + * Sets indexName + * + * @param string $indexName index name to target + * + * @return self + */ + public function setIndexName($indexName) + { + $this->container['indexName'] = $indexName; + + return $this; + } + + /** + * Gets sourceIndices + * + * @return \Algolia\AlgoliaSearch\Model\SourceIndexWithReplicas[] + */ + public function getSourceIndices() + { + return $this->container['sourceIndices']; + } + + /** + * Sets sourceIndices + * + * @param \Algolia\AlgoliaSearch\Model\SourceIndexWithReplicas[] $sourceIndices list of source indices used to generate a Query Suggestions index + * + * @return self + */ + public function setSourceIndices($sourceIndices) + { + $this->container['sourceIndices'] = $sourceIndices; + + return $this; + } + + /** + * Gets languages + * + * @return string[] + */ + public function getLanguages() + { + return $this->container['languages']; + } + + /** + * Sets languages + * + * @param string[] $languages De-duplicate singular and plural suggestions. For example, let's say your index contains English content, and that two suggestions “shoe” and “shoes” end up in your Query Suggestions index. If the English language is configured, only the most popular of those two suggestions would remain. + * + * @return self + */ + public function setLanguages($languages) + { + $this->container['languages'] = $languages; + + return $this; + } + + /** + * Gets exclude + * + * @return string[] + */ + public function getExclude() + { + return $this->container['exclude']; + } + + /** + * Sets exclude + * + * @param string[] $exclude list of words and patterns to exclude from the Query Suggestions index + * + * @return self + */ + public function setExclude($exclude) + { + $this->container['exclude'] = $exclude; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/QuerySuggestionsIndexParam.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestionsIndexParam.php new file mode 100644 index 0000000000..a657792718 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestionsIndexParam.php @@ -0,0 +1,354 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class QuerySuggestionsIndexParam implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QuerySuggestionsIndexParam'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sourceIndices' => '\Algolia\AlgoliaSearch\Model\SourceIndex[]', + 'languages' => 'string[]', + 'exclude' => 'string[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sourceIndices' => null, + 'languages' => null, + 'exclude' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'sourceIndices' => 'sourceIndices', + 'languages' => 'languages', + 'exclude' => 'exclude', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sourceIndices' => 'setSourceIndices', + 'languages' => 'setLanguages', + 'exclude' => 'setExclude', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sourceIndices' => 'getSourceIndices', + 'languages' => 'getLanguages', + 'exclude' => 'getExclude', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['sourceIndices'] = $data['sourceIndices'] ?? null; + $this->container['languages'] = $data['languages'] ?? null; + $this->container['exclude'] = $data['exclude'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['sourceIndices'] === null) { + $invalidProperties[] = "'sourceIndices' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets sourceIndices + * + * @return \Algolia\AlgoliaSearch\Model\SourceIndex[] + */ + public function getSourceIndices() + { + return $this->container['sourceIndices']; + } + + /** + * Sets sourceIndices + * + * @param \Algolia\AlgoliaSearch\Model\SourceIndex[] $sourceIndices list of source indices used to generate a Query Suggestions index + * + * @return self + */ + public function setSourceIndices($sourceIndices) + { + $this->container['sourceIndices'] = $sourceIndices; + + return $this; + } + + /** + * Gets languages + * + * @return string[]|null + */ + public function getLanguages() + { + return $this->container['languages']; + } + + /** + * Sets languages + * + * @param string[]|null $languages De-duplicate singular and plural suggestions. For example, let's say your index contains English content, and that two suggestions “shoe” and “shoes” end up in your Query Suggestions index. If the English language is configured, only the most popular of those two suggestions would remain. + * + * @return self + */ + public function setLanguages($languages) + { + $this->container['languages'] = $languages; + + return $this; + } + + /** + * Gets exclude + * + * @return string[]|null + */ + public function getExclude() + { + return $this->container['exclude']; + } + + /** + * Sets exclude + * + * @param string[]|null $exclude list of words and patterns to exclude from the Query Suggestions index + * + * @return self + */ + public function setExclude($exclude) + { + $this->container['exclude'] = $exclude; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/QuerySuggestionsIndexWithIndexParam.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestionsIndexWithIndexParam.php new file mode 100644 index 0000000000..6ddaf4b39f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestionsIndexWithIndexParam.php @@ -0,0 +1,387 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class QuerySuggestionsIndexWithIndexParam implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QuerySuggestionsIndexWithIndexParam'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'sourceIndices' => '\Algolia\AlgoliaSearch\Model\SourceIndex[]', + 'languages' => 'string[]', + 'exclude' => 'string[]', + 'indexName' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'sourceIndices' => null, + 'languages' => null, + 'exclude' => null, + 'indexName' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'sourceIndices' => 'sourceIndices', + 'languages' => 'languages', + 'exclude' => 'exclude', + 'indexName' => 'indexName', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'sourceIndices' => 'setSourceIndices', + 'languages' => 'setLanguages', + 'exclude' => 'setExclude', + 'indexName' => 'setIndexName', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'sourceIndices' => 'getSourceIndices', + 'languages' => 'getLanguages', + 'exclude' => 'getExclude', + 'indexName' => 'getIndexName', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['sourceIndices'] = $data['sourceIndices'] ?? null; + $this->container['languages'] = $data['languages'] ?? null; + $this->container['exclude'] = $data['exclude'] ?? null; + $this->container['indexName'] = $data['indexName'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['sourceIndices'] === null) { + $invalidProperties[] = "'sourceIndices' can't be null"; + } + if ($this->container['indexName'] === null) { + $invalidProperties[] = "'indexName' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets sourceIndices + * + * @return \Algolia\AlgoliaSearch\Model\SourceIndex[] + */ + public function getSourceIndices() + { + return $this->container['sourceIndices']; + } + + /** + * Sets sourceIndices + * + * @param \Algolia\AlgoliaSearch\Model\SourceIndex[] $sourceIndices list of source indices used to generate a Query Suggestions index + * + * @return self + */ + public function setSourceIndices($sourceIndices) + { + $this->container['sourceIndices'] = $sourceIndices; + + return $this; + } + + /** + * Gets languages + * + * @return string[]|null + */ + public function getLanguages() + { + return $this->container['languages']; + } + + /** + * Sets languages + * + * @param string[]|null $languages De-duplicate singular and plural suggestions. For example, let's say your index contains English content, and that two suggestions “shoe” and “shoes” end up in your Query Suggestions index. If the English language is configured, only the most popular of those two suggestions would remain. + * + * @return self + */ + public function setLanguages($languages) + { + $this->container['languages'] = $languages; + + return $this; + } + + /** + * Gets exclude + * + * @return string[]|null + */ + public function getExclude() + { + return $this->container['exclude']; + } + + /** + * Sets exclude + * + * @param string[]|null $exclude list of words and patterns to exclude from the Query Suggestions index + * + * @return self + */ + public function setExclude($exclude) + { + $this->container['exclude'] = $exclude; + + return $this; + } + + /** + * Gets indexName + * + * @return string + */ + public function getIndexName() + { + return $this->container['indexName']; + } + + /** + * Sets indexName + * + * @param string $indexName index name to target + * + * @return self + */ + public function setIndexName($indexName) + { + $this->container['indexName'] = $indexName; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/RecommendHits.php b/clients/algoliasearch-client-php/lib/Model/RecommendHits.php new file mode 100644 index 0000000000..79323dd78c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/RecommendHits.php @@ -0,0 +1,290 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RecommendHits implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'recommendHits'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hits' => '\Algolia\AlgoliaSearch\Model\RecommendRecord[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hits' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'hits' => 'hits', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hits' => 'setHits', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hits' => 'getHits', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['hits'] = $data['hits'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets hits + * + * @return \Algolia\AlgoliaSearch\Model\RecommendRecord[]|null + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\RecommendRecord[]|null $hits hits + * + * @return self + */ + public function setHits($hits) + { + $this->container['hits'] = $hits; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/RecommendRecord.php b/clients/algoliasearch-client-php/lib/Model/RecommendRecord.php new file mode 100644 index 0000000000..d3c5b65cde --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/RecommendRecord.php @@ -0,0 +1,463 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RecommendRecord implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'recommendRecord'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'objectID' => 'string', + 'highlightResult' => '\Algolia\AlgoliaSearch\Model\HighlightResult', + 'snippetResult' => '\Algolia\AlgoliaSearch\Model\SnippetResult', + 'rankingInfo' => '\Algolia\AlgoliaSearch\Model\RankingInfo', + 'distinctSeqID' => 'int', + 'score' => 'double', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'objectID' => null, + 'highlightResult' => null, + 'snippetResult' => null, + 'rankingInfo' => null, + 'distinctSeqID' => null, + 'score' => 'double', + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'objectID' => 'objectID', + 'highlightResult' => '_highlightResult', + 'snippetResult' => '_snippetResult', + 'rankingInfo' => '_rankingInfo', + 'distinctSeqID' => '_distinctSeqID', + 'score' => '_score', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'objectID' => 'setObjectID', + 'highlightResult' => 'setHighlightResult', + 'snippetResult' => 'setSnippetResult', + 'rankingInfo' => 'setRankingInfo', + 'distinctSeqID' => 'setDistinctSeqID', + 'score' => 'setScore', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'objectID' => 'getObjectID', + 'highlightResult' => 'getHighlightResult', + 'snippetResult' => 'getSnippetResult', + 'rankingInfo' => 'getRankingInfo', + 'distinctSeqID' => 'getDistinctSeqID', + 'score' => 'getScore', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['objectID'] = $data['objectID'] ?? null; + $this->container['highlightResult'] = $data['highlightResult'] ?? null; + $this->container['snippetResult'] = $data['snippetResult'] ?? null; + $this->container['rankingInfo'] = $data['rankingInfo'] ?? null; + $this->container['distinctSeqID'] = $data['distinctSeqID'] ?? null; + $this->container['score'] = $data['score'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['objectID'] === null) { + $invalidProperties[] = "'objectID' can't be null"; + } + if ($this->container['score'] === null) { + $invalidProperties[] = "'score' can't be null"; + } + if (($this->container['score'] > 100)) { + $invalidProperties[] = "invalid value for 'score', must be smaller than or equal to 100."; + } + + if (($this->container['score'] < 0)) { + $invalidProperties[] = "invalid value for 'score', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets objectID + * + * @return string + */ + public function getObjectID() + { + return $this->container['objectID']; + } + + /** + * Sets objectID + * + * @param string $objectID unique identifier of the object + * + * @return self + */ + public function setObjectID($objectID) + { + $this->container['objectID'] = $objectID; + + return $this; + } + + /** + * Gets highlightResult + * + * @return \Algolia\AlgoliaSearch\Model\HighlightResult|null + */ + public function getHighlightResult() + { + return $this->container['highlightResult']; + } + + /** + * Sets highlightResult + * + * @param \Algolia\AlgoliaSearch\Model\HighlightResult|null $highlightResult highlightResult + * + * @return self + */ + public function setHighlightResult($highlightResult) + { + $this->container['highlightResult'] = $highlightResult; + + return $this; + } + + /** + * Gets snippetResult + * + * @return \Algolia\AlgoliaSearch\Model\SnippetResult|null + */ + public function getSnippetResult() + { + return $this->container['snippetResult']; + } + + /** + * Sets snippetResult + * + * @param \Algolia\AlgoliaSearch\Model\SnippetResult|null $snippetResult snippetResult + * + * @return self + */ + public function setSnippetResult($snippetResult) + { + $this->container['snippetResult'] = $snippetResult; + + return $this; + } + + /** + * Gets rankingInfo + * + * @return \Algolia\AlgoliaSearch\Model\RankingInfo|null + */ + public function getRankingInfo() + { + return $this->container['rankingInfo']; + } + + /** + * Sets rankingInfo + * + * @param \Algolia\AlgoliaSearch\Model\RankingInfo|null $rankingInfo rankingInfo + * + * @return self + */ + public function setRankingInfo($rankingInfo) + { + $this->container['rankingInfo'] = $rankingInfo; + + return $this; + } + + /** + * Gets distinctSeqID + * + * @return int|null + */ + public function getDistinctSeqID() + { + return $this->container['distinctSeqID']; + } + + /** + * Sets distinctSeqID + * + * @param int|null $distinctSeqID distinctSeqID + * + * @return self + */ + public function setDistinctSeqID($distinctSeqID) + { + $this->container['distinctSeqID'] = $distinctSeqID; + + return $this; + } + + /** + * Gets score + * + * @return float + */ + public function getScore() + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param float $score the recommendation score + * + * @return self + */ + public function setScore($score) + { + if (($score > 100)) { + throw new \InvalidArgumentException('invalid value for $score when calling RecommendRecord., must be smaller than or equal to 100.'); + } + if (($score < 0)) { + throw new \InvalidArgumentException('invalid value for $score when calling RecommendRecord., must be bigger than or equal to 0.'); + } + + $this->container['score'] = $score; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/RecommendationRequest.php b/clients/algoliasearch-client-php/lib/Model/RecommendationRequest.php new file mode 100644 index 0000000000..d72630b8e5 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/RecommendationRequest.php @@ -0,0 +1,532 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RecommendationRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'recommendationRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'indexName' => 'string', + 'objectID' => 'string', + 'model' => 'string', + 'threshold' => 'int', + 'maxRecommendations' => 'int', + 'queryParameters' => '\Algolia\AlgoliaSearch\Model\SearchParams', + 'fallbackParameters' => '\Algolia\AlgoliaSearch\Model\SearchParams', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'indexName' => null, + 'objectID' => null, + 'model' => null, + 'threshold' => null, + 'maxRecommendations' => null, + 'queryParameters' => null, + 'fallbackParameters' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'indexName' => 'indexName', + 'objectID' => 'objectID', + 'model' => 'model', + 'threshold' => 'threshold', + 'maxRecommendations' => 'maxRecommendations', + 'queryParameters' => 'queryParameters', + 'fallbackParameters' => 'fallbackParameters', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'indexName' => 'setIndexName', + 'objectID' => 'setObjectID', + 'model' => 'setModel', + 'threshold' => 'setThreshold', + 'maxRecommendations' => 'setMaxRecommendations', + 'queryParameters' => 'setQueryParameters', + 'fallbackParameters' => 'setFallbackParameters', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'indexName' => 'getIndexName', + 'objectID' => 'getObjectID', + 'model' => 'getModel', + 'threshold' => 'getThreshold', + 'maxRecommendations' => 'getMaxRecommendations', + 'queryParameters' => 'getQueryParameters', + 'fallbackParameters' => 'getFallbackParameters', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + const MODEL_RELATED_PRODUCTS = 'related-products'; + const MODEL_BOUGHT_TOGETHER = 'bought-together'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getModelAllowableValues() + { + return [ + self::MODEL_RELATED_PRODUCTS, + self::MODEL_BOUGHT_TOGETHER, + ]; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['indexName'] = $data['indexName'] ?? null; + $this->container['objectID'] = $data['objectID'] ?? null; + $this->container['model'] = $data['model'] ?? null; + $this->container['threshold'] = $data['threshold'] ?? null; + $this->container['maxRecommendations'] = $data['maxRecommendations'] ?? 0; + $this->container['queryParameters'] = $data['queryParameters'] ?? null; + $this->container['fallbackParameters'] = $data['fallbackParameters'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['indexName'] === null) { + $invalidProperties[] = "'indexName' can't be null"; + } + if ($this->container['objectID'] === null) { + $invalidProperties[] = "'objectID' can't be null"; + } + if ($this->container['model'] === null) { + $invalidProperties[] = "'model' can't be null"; + } + $allowedValues = $this->getModelAllowableValues(); + if (!is_null($this->container['model']) && !in_array($this->container['model'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'model', must be one of '%s'", + $this->container['model'], + implode("', '", $allowedValues) + ); + } + + if ($this->container['threshold'] === null) { + $invalidProperties[] = "'threshold' can't be null"; + } + if (($this->container['threshold'] > 100)) { + $invalidProperties[] = "invalid value for 'threshold', must be smaller than or equal to 100."; + } + + if (($this->container['threshold'] < 0)) { + $invalidProperties[] = "invalid value for 'threshold', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets indexName + * + * @return string + */ + public function getIndexName() + { + return $this->container['indexName']; + } + + /** + * Sets indexName + * + * @param string $indexName the Algolia index name + * + * @return self + */ + public function setIndexName($indexName) + { + $this->container['indexName'] = $indexName; + + return $this; + } + + /** + * Gets objectID + * + * @return string + */ + public function getObjectID() + { + return $this->container['objectID']; + } + + /** + * Sets objectID + * + * @param string $objectID unique identifier of the object + * + * @return self + */ + public function setObjectID($objectID) + { + $this->container['objectID'] = $objectID; + + return $this; + } + + /** + * Gets model + * + * @return string + */ + public function getModel() + { + return $this->container['model']; + } + + /** + * Sets model + * + * @param string $model the recommendation model to use + * + * @return self + */ + public function setModel($model) + { + $allowedValues = $this->getModelAllowableValues(); + if (!in_array($model, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'model', must be one of '%s'", + $model, + implode("', '", $allowedValues) + ) + ); + } + $this->container['model'] = $model; + + return $this; + } + + /** + * Gets threshold + * + * @return int + */ + public function getThreshold() + { + return $this->container['threshold']; + } + + /** + * Sets threshold + * + * @param int $threshold the threshold to use when filtering recommendations by their score + * + * @return self + */ + public function setThreshold($threshold) + { + if (($threshold > 100)) { + throw new \InvalidArgumentException('invalid value for $threshold when calling RecommendationRequest., must be smaller than or equal to 100.'); + } + if (($threshold < 0)) { + throw new \InvalidArgumentException('invalid value for $threshold when calling RecommendationRequest., must be bigger than or equal to 0.'); + } + + $this->container['threshold'] = $threshold; + + return $this; + } + + /** + * Gets maxRecommendations + * + * @return int|null + */ + public function getMaxRecommendations() + { + return $this->container['maxRecommendations']; + } + + /** + * Sets maxRecommendations + * + * @param int|null $maxRecommendations The max number of recommendations to retrieve. If it's set to 0, all the recommendations of the objectID may be returned. + * + * @return self + */ + public function setMaxRecommendations($maxRecommendations) + { + $this->container['maxRecommendations'] = $maxRecommendations; + + return $this; + } + + /** + * Gets queryParameters + * + * @return \Algolia\AlgoliaSearch\Model\SearchParams|null + */ + public function getQueryParameters() + { + return $this->container['queryParameters']; + } + + /** + * Sets queryParameters + * + * @param \Algolia\AlgoliaSearch\Model\SearchParams|null $queryParameters queryParameters + * + * @return self + */ + public function setQueryParameters($queryParameters) + { + $this->container['queryParameters'] = $queryParameters; + + return $this; + } + + /** + * Gets fallbackParameters + * + * @return \Algolia\AlgoliaSearch\Model\SearchParams|null + */ + public function getFallbackParameters() + { + return $this->container['fallbackParameters']; + } + + /** + * Sets fallbackParameters + * + * @param \Algolia\AlgoliaSearch\Model\SearchParams|null $fallbackParameters fallbackParameters + * + * @return self + */ + public function setFallbackParameters($fallbackParameters) + { + $this->container['fallbackParameters'] = $fallbackParameters; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/RecommendationsResponse.php b/clients/algoliasearch-client-php/lib/Model/RecommendationsResponse.php new file mode 100644 index 0000000000..3bdf0b5864 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/RecommendationsResponse.php @@ -0,0 +1,1049 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RecommendationsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'recommendationsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'abTestID' => 'int', + 'abTestVariantID' => 'int', + 'aroundLatLng' => 'string', + 'automaticRadius' => 'string', + 'exhaustiveFacetsCount' => 'bool', + 'exhaustiveNbHits' => 'bool', + 'exhaustiveTypo' => 'bool', + 'facets' => 'array>', + 'facetsStats' => 'array', + 'hitsPerPage' => 'int', + 'index' => 'string', + 'indexUsed' => 'string', + 'message' => 'string', + 'nbHits' => 'int', + 'nbPages' => 'int', + 'nbSortedHits' => 'int', + 'page' => 'int', + 'params' => 'string', + 'parsedQuery' => 'string', + 'processingTimeMS' => 'int', + 'query' => 'string', + 'queryAfterRemoval' => 'string', + 'serverUsed' => 'string', + 'userData' => 'object', + 'hits' => '\Algolia\AlgoliaSearch\Model\RecommendRecord[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'abTestID' => null, + 'abTestVariantID' => null, + 'aroundLatLng' => null, + 'automaticRadius' => null, + 'exhaustiveFacetsCount' => null, + 'exhaustiveNbHits' => null, + 'exhaustiveTypo' => null, + 'facets' => null, + 'facetsStats' => null, + 'hitsPerPage' => null, + 'index' => null, + 'indexUsed' => null, + 'message' => null, + 'nbHits' => null, + 'nbPages' => null, + 'nbSortedHits' => null, + 'page' => null, + 'params' => null, + 'parsedQuery' => null, + 'processingTimeMS' => null, + 'query' => null, + 'queryAfterRemoval' => null, + 'serverUsed' => null, + 'userData' => null, + 'hits' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'abTestID' => 'abTestID', + 'abTestVariantID' => 'abTestVariantID', + 'aroundLatLng' => 'aroundLatLng', + 'automaticRadius' => 'automaticRadius', + 'exhaustiveFacetsCount' => 'exhaustiveFacetsCount', + 'exhaustiveNbHits' => 'exhaustiveNbHits', + 'exhaustiveTypo' => 'exhaustiveTypo', + 'facets' => 'facets', + 'facetsStats' => 'facets_stats', + 'hitsPerPage' => 'hitsPerPage', + 'index' => 'index', + 'indexUsed' => 'indexUsed', + 'message' => 'message', + 'nbHits' => 'nbHits', + 'nbPages' => 'nbPages', + 'nbSortedHits' => 'nbSortedHits', + 'page' => 'page', + 'params' => 'params', + 'parsedQuery' => 'parsedQuery', + 'processingTimeMS' => 'processingTimeMS', + 'query' => 'query', + 'queryAfterRemoval' => 'queryAfterRemoval', + 'serverUsed' => 'serverUsed', + 'userData' => 'userData', + 'hits' => 'hits', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'abTestID' => 'setAbTestID', + 'abTestVariantID' => 'setAbTestVariantID', + 'aroundLatLng' => 'setAroundLatLng', + 'automaticRadius' => 'setAutomaticRadius', + 'exhaustiveFacetsCount' => 'setExhaustiveFacetsCount', + 'exhaustiveNbHits' => 'setExhaustiveNbHits', + 'exhaustiveTypo' => 'setExhaustiveTypo', + 'facets' => 'setFacets', + 'facetsStats' => 'setFacetsStats', + 'hitsPerPage' => 'setHitsPerPage', + 'index' => 'setIndex', + 'indexUsed' => 'setIndexUsed', + 'message' => 'setMessage', + 'nbHits' => 'setNbHits', + 'nbPages' => 'setNbPages', + 'nbSortedHits' => 'setNbSortedHits', + 'page' => 'setPage', + 'params' => 'setParams', + 'parsedQuery' => 'setParsedQuery', + 'processingTimeMS' => 'setProcessingTimeMS', + 'query' => 'setQuery', + 'queryAfterRemoval' => 'setQueryAfterRemoval', + 'serverUsed' => 'setServerUsed', + 'userData' => 'setUserData', + 'hits' => 'setHits', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'abTestID' => 'getAbTestID', + 'abTestVariantID' => 'getAbTestVariantID', + 'aroundLatLng' => 'getAroundLatLng', + 'automaticRadius' => 'getAutomaticRadius', + 'exhaustiveFacetsCount' => 'getExhaustiveFacetsCount', + 'exhaustiveNbHits' => 'getExhaustiveNbHits', + 'exhaustiveTypo' => 'getExhaustiveTypo', + 'facets' => 'getFacets', + 'facetsStats' => 'getFacetsStats', + 'hitsPerPage' => 'getHitsPerPage', + 'index' => 'getIndex', + 'indexUsed' => 'getIndexUsed', + 'message' => 'getMessage', + 'nbHits' => 'getNbHits', + 'nbPages' => 'getNbPages', + 'nbSortedHits' => 'getNbSortedHits', + 'page' => 'getPage', + 'params' => 'getParams', + 'parsedQuery' => 'getParsedQuery', + 'processingTimeMS' => 'getProcessingTimeMS', + 'query' => 'getQuery', + 'queryAfterRemoval' => 'getQueryAfterRemoval', + 'serverUsed' => 'getServerUsed', + 'userData' => 'getUserData', + 'hits' => 'getHits', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['abTestID'] = $data['abTestID'] ?? null; + $this->container['abTestVariantID'] = $data['abTestVariantID'] ?? null; + $this->container['aroundLatLng'] = $data['aroundLatLng'] ?? null; + $this->container['automaticRadius'] = $data['automaticRadius'] ?? null; + $this->container['exhaustiveFacetsCount'] = $data['exhaustiveFacetsCount'] ?? null; + $this->container['exhaustiveNbHits'] = $data['exhaustiveNbHits'] ?? null; + $this->container['exhaustiveTypo'] = $data['exhaustiveTypo'] ?? null; + $this->container['facets'] = $data['facets'] ?? null; + $this->container['facetsStats'] = $data['facetsStats'] ?? null; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + $this->container['index'] = $data['index'] ?? null; + $this->container['indexUsed'] = $data['indexUsed'] ?? null; + $this->container['message'] = $data['message'] ?? null; + $this->container['nbHits'] = $data['nbHits'] ?? null; + $this->container['nbPages'] = $data['nbPages'] ?? null; + $this->container['nbSortedHits'] = $data['nbSortedHits'] ?? null; + $this->container['page'] = $data['page'] ?? 0; + $this->container['params'] = $data['params'] ?? null; + $this->container['parsedQuery'] = $data['parsedQuery'] ?? null; + $this->container['processingTimeMS'] = $data['processingTimeMS'] ?? null; + $this->container['query'] = $data['query'] ?? ''; + $this->container['queryAfterRemoval'] = $data['queryAfterRemoval'] ?? null; + $this->container['serverUsed'] = $data['serverUsed'] ?? null; + $this->container['userData'] = $data['userData'] ?? null; + $this->container['hits'] = $data['hits'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['aroundLatLng']) && !preg_match('/^(-?\\d+(\\.\\d+)?),\\s*(-?\\d+(\\.\\d+)?)$/', $this->container['aroundLatLng'])) { + $invalidProperties[] = "invalid value for 'aroundLatLng', must be conform to the pattern /^(-?\\d+(\\.\\d+)?),\\s*(-?\\d+(\\.\\d+)?)$/."; + } + + if ($this->container['exhaustiveNbHits'] === null) { + $invalidProperties[] = "'exhaustiveNbHits' can't be null"; + } + if ($this->container['exhaustiveTypo'] === null) { + $invalidProperties[] = "'exhaustiveTypo' can't be null"; + } + if ($this->container['hitsPerPage'] === null) { + $invalidProperties[] = "'hitsPerPage' can't be null"; + } + if ($this->container['nbHits'] === null) { + $invalidProperties[] = "'nbHits' can't be null"; + } + if ($this->container['nbPages'] === null) { + $invalidProperties[] = "'nbPages' can't be null"; + } + if ($this->container['page'] === null) { + $invalidProperties[] = "'page' can't be null"; + } + if ($this->container['params'] === null) { + $invalidProperties[] = "'params' can't be null"; + } + if ($this->container['processingTimeMS'] === null) { + $invalidProperties[] = "'processingTimeMS' can't be null"; + } + if ($this->container['query'] === null) { + $invalidProperties[] = "'query' can't be null"; + } + if ($this->container['hits'] === null) { + $invalidProperties[] = "'hits' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets abTestID + * + * @return int|null + */ + public function getAbTestID() + { + return $this->container['abTestID']; + } + + /** + * Sets abTestID + * + * @param int|null $abTestID if a search encounters an index that is being A/B tested, abTestID reports the ongoing A/B test ID + * + * @return self + */ + public function setAbTestID($abTestID) + { + $this->container['abTestID'] = $abTestID; + + return $this; + } + + /** + * Gets abTestVariantID + * + * @return int|null + */ + public function getAbTestVariantID() + { + return $this->container['abTestVariantID']; + } + + /** + * Sets abTestVariantID + * + * @param int|null $abTestVariantID if a search encounters an index that is being A/B tested, abTestVariantID reports the variant ID of the index used + * + * @return self + */ + public function setAbTestVariantID($abTestVariantID) + { + $this->container['abTestVariantID'] = $abTestVariantID; + + return $this; + } + + /** + * Gets aroundLatLng + * + * @return string|null + */ + public function getAroundLatLng() + { + return $this->container['aroundLatLng']; + } + + /** + * Sets aroundLatLng + * + * @param string|null $aroundLatLng the computed geo location + * + * @return self + */ + public function setAroundLatLng($aroundLatLng) + { + if (!is_null($aroundLatLng) && (!preg_match('/^(-?\\d+(\\.\\d+)?),\\s*(-?\\d+(\\.\\d+)?)$/', $aroundLatLng))) { + throw new \InvalidArgumentException("invalid value for $aroundLatLng when calling RecommendationsResponse., must conform to the pattern /^(-?\\d+(\\.\\d+)?),\\s*(-?\\d+(\\.\\d+)?)$/."); + } + + $this->container['aroundLatLng'] = $aroundLatLng; + + return $this; + } + + /** + * Gets automaticRadius + * + * @return string|null + */ + public function getAutomaticRadius() + { + return $this->container['automaticRadius']; + } + + /** + * Sets automaticRadius + * + * @param string|null $automaticRadius The automatically computed radius. For legacy reasons, this parameter is a string and not an integer. + * + * @return self + */ + public function setAutomaticRadius($automaticRadius) + { + $this->container['automaticRadius'] = $automaticRadius; + + return $this; + } + + /** + * Gets exhaustiveFacetsCount + * + * @return bool|null + */ + public function getExhaustiveFacetsCount() + { + return $this->container['exhaustiveFacetsCount']; + } + + /** + * Sets exhaustiveFacetsCount + * + * @param bool|null $exhaustiveFacetsCount whether the facet count is exhaustive or approximate + * + * @return self + */ + public function setExhaustiveFacetsCount($exhaustiveFacetsCount) + { + $this->container['exhaustiveFacetsCount'] = $exhaustiveFacetsCount; + + return $this; + } + + /** + * Gets exhaustiveNbHits + * + * @return bool + */ + public function getExhaustiveNbHits() + { + return $this->container['exhaustiveNbHits']; + } + + /** + * Sets exhaustiveNbHits + * + * @param bool $exhaustiveNbHits Indicate if the nbHits count was exhaustive or approximate + * + * @return self + */ + public function setExhaustiveNbHits($exhaustiveNbHits) + { + $this->container['exhaustiveNbHits'] = $exhaustiveNbHits; + + return $this; + } + + /** + * Gets exhaustiveTypo + * + * @return bool + */ + public function getExhaustiveTypo() + { + return $this->container['exhaustiveTypo']; + } + + /** + * Sets exhaustiveTypo + * + * @param bool $exhaustiveTypo Indicate if the typo-tolerence search was exhaustive or approximate (only included when typo-tolerance is enabled) + * + * @return self + */ + public function setExhaustiveTypo($exhaustiveTypo) + { + $this->container['exhaustiveTypo'] = $exhaustiveTypo; + + return $this; + } + + /** + * Gets facets + * + * @return array>|null + */ + public function getFacets() + { + return $this->container['facets']; + } + + /** + * Sets facets + * + * @param array>|null $facets a mapping of each facet name to the corresponding facet counts + * + * @return self + */ + public function setFacets($facets) + { + $this->container['facets'] = $facets; + + return $this; + } + + /** + * Gets facetsStats + * + * @return array|null + */ + public function getFacetsStats() + { + return $this->container['facetsStats']; + } + + /** + * Sets facetsStats + * + * @param array|null $facetsStats statistics for numerical facets + * + * @return self + */ + public function setFacetsStats($facetsStats) + { + $this->container['facetsStats'] = $facetsStats; + + return $this; + } + + /** + * Gets hitsPerPage + * + * @return int + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int $hitsPerPage set the number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Gets index + * + * @return string|null + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param string|null $index index name used for the query + * + * @return self + */ + public function setIndex($index) + { + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets indexUsed + * + * @return string|null + */ + public function getIndexUsed() + { + return $this->container['indexUsed']; + } + + /** + * Sets indexUsed + * + * @param string|null $indexUsed Index name used for the query. In the case of an A/B test, the targeted index isn't always the index used by the query. + * + * @return self + */ + public function setIndexUsed($indexUsed) + { + $this->container['indexUsed'] = $indexUsed; + + return $this; + } + + /** + * Gets message + * + * @return string|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message used to return warnings about the query + * + * @return self + */ + public function setMessage($message) + { + $this->container['message'] = $message; + + return $this; + } + + /** + * Gets nbHits + * + * @return int + */ + public function getNbHits() + { + return $this->container['nbHits']; + } + + /** + * Sets nbHits + * + * @param int $nbHits number of hits that the search query matched + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + + /** + * Gets nbPages + * + * @return int + */ + public function getNbPages() + { + return $this->container['nbPages']; + } + + /** + * Sets nbPages + * + * @param int $nbPages Number of pages available for the current query + * + * @return self + */ + public function setNbPages($nbPages) + { + $this->container['nbPages'] = $nbPages; + + return $this; + } + + /** + * Gets nbSortedHits + * + * @return int|null + */ + public function getNbSortedHits() + { + return $this->container['nbSortedHits']; + } + + /** + * Sets nbSortedHits + * + * @param int|null $nbSortedHits The number of hits selected and sorted by the relevant sort algorithm + * + * @return self + */ + public function setNbSortedHits($nbSortedHits) + { + $this->container['nbSortedHits'] = $nbSortedHits; + + return $this; + } + + /** + * Gets page + * + * @return int + */ + public function getPage() + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param int $page specify the page to retrieve + * + * @return self + */ + public function setPage($page) + { + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets params + * + * @return string + */ + public function getParams() + { + return $this->container['params']; + } + + /** + * Sets params + * + * @param string $params a url-encoded string of all search parameters + * + * @return self + */ + public function setParams($params) + { + $this->container['params'] = $params; + + return $this; + } + + /** + * Gets parsedQuery + * + * @return string|null + */ + public function getParsedQuery() + { + return $this->container['parsedQuery']; + } + + /** + * Sets parsedQuery + * + * @param string|null $parsedQuery the query string that will be searched, after normalization + * + * @return self + */ + public function setParsedQuery($parsedQuery) + { + $this->container['parsedQuery'] = $parsedQuery; + + return $this; + } + + /** + * Gets processingTimeMS + * + * @return int + */ + public function getProcessingTimeMS() + { + return $this->container['processingTimeMS']; + } + + /** + * Sets processingTimeMS + * + * @param int $processingTimeMS time the server took to process the request, in milliseconds + * + * @return self + */ + public function setProcessingTimeMS($processingTimeMS) + { + $this->container['processingTimeMS'] = $processingTimeMS; + + return $this; + } + + /** + * Gets query + * + * @return string + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param string $query the text to search in the index + * + * @return self + */ + public function setQuery($query) + { + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets queryAfterRemoval + * + * @return string|null + */ + public function getQueryAfterRemoval() + { + return $this->container['queryAfterRemoval']; + } + + /** + * Sets queryAfterRemoval + * + * @param string|null $queryAfterRemoval a markup text indicating which parts of the original query have been removed in order to retrieve a non-empty result set + * + * @return self + */ + public function setQueryAfterRemoval($queryAfterRemoval) + { + $this->container['queryAfterRemoval'] = $queryAfterRemoval; + + return $this; + } + + /** + * Gets serverUsed + * + * @return string|null + */ + public function getServerUsed() + { + return $this->container['serverUsed']; + } + + /** + * Sets serverUsed + * + * @param string|null $serverUsed actual host name of the server that processed the request + * + * @return self + */ + public function setServerUsed($serverUsed) + { + $this->container['serverUsed'] = $serverUsed; + + return $this; + } + + /** + * Gets userData + * + * @return object|null + */ + public function getUserData() + { + return $this->container['userData']; + } + + /** + * Sets userData + * + * @param object|null $userData lets you store custom data in your indices + * + * @return self + */ + public function setUserData($userData) + { + $this->container['userData'] = $userData; + + return $this; + } + + /** + * Gets hits + * + * @return \Algolia\AlgoliaSearch\Model\RecommendRecord[] + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\RecommendRecord[] $hits hits + * + * @return self + */ + public function setHits($hits) + { + $this->container['hits'] = $hits; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/SearchParams.php b/clients/algoliasearch-client-php/lib/Model/SearchParams.php index ec002c5001..8753205295 100644 --- a/clients/algoliasearch-client-php/lib/Model/SearchParams.php +++ b/clients/algoliasearch-client-php/lib/Model/SearchParams.php @@ -31,7 +31,6 @@ class SearchParams implements ModelInterface, ArrayAccess, \JsonSerializable * @var string[] */ protected static $openAPITypes = [ - 'params' => 'string', 'similarQuery' => 'string', 'filters' => 'string', 'facetFilters' => 'string[]', @@ -119,7 +118,6 @@ class SearchParams implements ModelInterface, ArrayAccess, \JsonSerializable * @psalm-var array */ protected static $openAPIFormats = [ - 'params' => null, 'similarQuery' => null, 'filters' => null, 'facetFilters' => null, @@ -226,7 +224,6 @@ public static function openAPIFormats() * @var string[] */ protected static $attributeMap = [ - 'params' => 'params', 'similarQuery' => 'similarQuery', 'filters' => 'filters', 'facetFilters' => 'facetFilters', @@ -312,7 +309,6 @@ public static function openAPIFormats() * @var string[] */ protected static $setters = [ - 'params' => 'setParams', 'similarQuery' => 'setSimilarQuery', 'filters' => 'setFilters', 'facetFilters' => 'setFacetFilters', @@ -398,7 +394,6 @@ public static function openAPIFormats() * @var string[] */ protected static $getters = [ - 'params' => 'getParams', 'similarQuery' => 'getSimilarQuery', 'filters' => 'getFilters', 'facetFilters' => 'getFacetFilters', @@ -639,7 +634,6 @@ public function getAdvancedSyntaxFeaturesAllowableValues() */ public function __construct(array $data = null) { - $this->container['params'] = $data['params'] ?? ''; $this->container['similarQuery'] = $data['similarQuery'] ?? ''; $this->container['filters'] = $data['filters'] ?? ''; $this->container['facetFilters'] = $data['facetFilters'] ?? null; @@ -813,30 +807,6 @@ public function valid() return count($this->listInvalidProperties()) === 0; } - /** - * Gets params - * - * @return string|null - */ - public function getParams() - { - return $this->container['params']; - } - - /** - * Sets params - * - * @param string|null $params search parameters as URL-encoded query string - * - * @return self - */ - public function setParams($params) - { - $this->container['params'] = $params; - - return $this; - } - /** * Gets similarQuery * diff --git a/clients/algoliasearch-client-php/lib/Model/SetPersonalizationStrategyResponse.php b/clients/algoliasearch-client-php/lib/Model/SetPersonalizationStrategyResponse.php new file mode 100644 index 0000000000..e7c8487322 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/SetPersonalizationStrategyResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SetPersonalizationStrategyResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'setPersonalizationStrategyResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'message' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'message' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'message' => 'message', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'message' => 'setMessage', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'message' => 'getMessage', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['message'] = $data['message'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message a message confirming the strategy update + * + * @return self + */ + public function setMessage($message) + { + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/SourceIndex.php b/clients/algoliasearch-client-php/lib/Model/SourceIndex.php new file mode 100644 index 0000000000..694af304e5 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/SourceIndex.php @@ -0,0 +1,474 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SourceIndex implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SourceIndex'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'indexName' => 'string', + 'analyticsTags' => 'string[]', + 'facets' => 'object[]', + 'minHits' => 'int', + 'minLetters' => 'int', + 'generate' => 'string[][]', + 'external' => '\Algolia\AlgoliaSearch\Model\SourceIndexExternal[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'indexName' => null, + 'analyticsTags' => null, + 'facets' => null, + 'minHits' => null, + 'minLetters' => null, + 'generate' => null, + 'external' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'indexName' => 'indexName', + 'analyticsTags' => 'analyticsTags', + 'facets' => 'facets', + 'minHits' => 'minHits', + 'minLetters' => 'minLetters', + 'generate' => 'generate', + 'external' => 'external', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'indexName' => 'setIndexName', + 'analyticsTags' => 'setAnalyticsTags', + 'facets' => 'setFacets', + 'minHits' => 'setMinHits', + 'minLetters' => 'setMinLetters', + 'generate' => 'setGenerate', + 'external' => 'setExternal', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'indexName' => 'getIndexName', + 'analyticsTags' => 'getAnalyticsTags', + 'facets' => 'getFacets', + 'minHits' => 'getMinHits', + 'minLetters' => 'getMinLetters', + 'generate' => 'getGenerate', + 'external' => 'getExternal', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['indexName'] = $data['indexName'] ?? null; + $this->container['analyticsTags'] = $data['analyticsTags'] ?? null; + $this->container['facets'] = $data['facets'] ?? null; + $this->container['minHits'] = $data['minHits'] ?? null; + $this->container['minLetters'] = $data['minLetters'] ?? null; + $this->container['generate'] = $data['generate'] ?? null; + $this->container['external'] = $data['external'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['indexName'] === null) { + $invalidProperties[] = "'indexName' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets indexName + * + * @return string + */ + public function getIndexName() + { + return $this->container['indexName']; + } + + /** + * Sets indexName + * + * @param string $indexName source index name + * + * @return self + */ + public function setIndexName($indexName) + { + $this->container['indexName'] = $indexName; + + return $this; + } + + /** + * Gets analyticsTags + * + * @return string[]|null + */ + public function getAnalyticsTags() + { + return $this->container['analyticsTags']; + } + + /** + * Sets analyticsTags + * + * @param string[]|null $analyticsTags list of analytics tags to filter the popular searches per tag + * + * @return self + */ + public function setAnalyticsTags($analyticsTags) + { + $this->container['analyticsTags'] = $analyticsTags; + + return $this; + } + + /** + * Gets facets + * + * @return object[]|null + */ + public function getFacets() + { + return $this->container['facets']; + } + + /** + * Sets facets + * + * @param object[]|null $facets list of facets to define as categories for the query suggestions + * + * @return self + */ + public function setFacets($facets) + { + $this->container['facets'] = $facets; + + return $this; + } + + /** + * Gets minHits + * + * @return int|null + */ + public function getMinHits() + { + return $this->container['minHits']; + } + + /** + * Sets minHits + * + * @param int|null $minHits Minimum number of hits (e.g., matching records in the source index) to generate a suggestions. + * + * @return self + */ + public function setMinHits($minHits) + { + $this->container['minHits'] = $minHits; + + return $this; + } + + /** + * Gets minLetters + * + * @return int|null + */ + public function getMinLetters() + { + return $this->container['minLetters']; + } + + /** + * Sets minLetters + * + * @param int|null $minLetters minimum number of required letters for a suggestion to remain + * + * @return self + */ + public function setMinLetters($minLetters) + { + $this->container['minLetters'] = $minLetters; + + return $this; + } + + /** + * Gets generate + * + * @return string[][]|null + */ + public function getGenerate() + { + return $this->container['generate']; + } + + /** + * Sets generate + * + * @param string[][]|null $generate List of facet attributes used to generate Query Suggestions. The resulting suggestions are every combination of the facets in the nested list (e.g., (facetA and facetB) and facetC). + * + * @return self + */ + public function setGenerate($generate) + { + $this->container['generate'] = $generate; + + return $this; + } + + /** + * Gets external + * + * @return \Algolia\AlgoliaSearch\Model\SourceIndexExternal[]|null + */ + public function getExternal() + { + return $this->container['external']; + } + + /** + * Sets external + * + * @param \Algolia\AlgoliaSearch\Model\SourceIndexExternal[]|null $external list of external indices to use to generate custom Query Suggestions + * + * @return self + */ + public function setExternal($external) + { + $this->container['external'] = $external; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/SourceIndexExternal.php b/clients/algoliasearch-client-php/lib/Model/SourceIndexExternal.php new file mode 100644 index 0000000000..77019cf1ef --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/SourceIndexExternal.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SourceIndexExternal implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SourceIndexExternal'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'query' => 'string', + 'count' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'query' => null, + 'count' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'query' => 'query', + 'count' => 'count', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'query' => 'setQuery', + 'count' => 'setCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'query' => 'getQuery', + 'count' => 'getCount', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['query'] = $data['query'] ?? null; + $this->container['count'] = $data['count'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['query'] === null) { + $invalidProperties[] = "'query' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets query + * + * @return string + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param string $query The suggestion you would like to add + * + * @return self + */ + public function setQuery($query) + { + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count The measure of the suggestion relative popularity + * + * @return self + */ + public function setCount($count) + { + $this->container['count'] = $count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/SourceIndexWithReplicas.php b/clients/algoliasearch-client-php/lib/Model/SourceIndexWithReplicas.php new file mode 100644 index 0000000000..0a3789713f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/SourceIndexWithReplicas.php @@ -0,0 +1,525 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SourceIndexWithReplicas implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SourceIndexWithReplicas'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'indexName' => 'string', + 'replicas' => 'bool', + 'analyticsTags' => 'string[]', + 'facets' => 'object[]', + 'minHits' => 'int', + 'minLetters' => 'int', + 'generate' => 'string[][]', + 'external' => '\Algolia\AlgoliaSearch\Model\SourceIndexExternal[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'indexName' => null, + 'replicas' => null, + 'analyticsTags' => null, + 'facets' => null, + 'minHits' => null, + 'minLetters' => null, + 'generate' => null, + 'external' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'indexName' => 'indexName', + 'replicas' => 'replicas', + 'analyticsTags' => 'analyticsTags', + 'facets' => 'facets', + 'minHits' => 'minHits', + 'minLetters' => 'minLetters', + 'generate' => 'generate', + 'external' => 'external', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'indexName' => 'setIndexName', + 'replicas' => 'setReplicas', + 'analyticsTags' => 'setAnalyticsTags', + 'facets' => 'setFacets', + 'minHits' => 'setMinHits', + 'minLetters' => 'setMinLetters', + 'generate' => 'setGenerate', + 'external' => 'setExternal', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'indexName' => 'getIndexName', + 'replicas' => 'getReplicas', + 'analyticsTags' => 'getAnalyticsTags', + 'facets' => 'getFacets', + 'minHits' => 'getMinHits', + 'minLetters' => 'getMinLetters', + 'generate' => 'getGenerate', + 'external' => 'getExternal', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['indexName'] = $data['indexName'] ?? null; + $this->container['replicas'] = $data['replicas'] ?? null; + $this->container['analyticsTags'] = $data['analyticsTags'] ?? null; + $this->container['facets'] = $data['facets'] ?? null; + $this->container['minHits'] = $data['minHits'] ?? null; + $this->container['minLetters'] = $data['minLetters'] ?? null; + $this->container['generate'] = $data['generate'] ?? null; + $this->container['external'] = $data['external'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['indexName'] === null) { + $invalidProperties[] = "'indexName' can't be null"; + } + if ($this->container['replicas'] === null) { + $invalidProperties[] = "'replicas' can't be null"; + } + if ($this->container['analyticsTags'] === null) { + $invalidProperties[] = "'analyticsTags' can't be null"; + } + if ($this->container['facets'] === null) { + $invalidProperties[] = "'facets' can't be null"; + } + if ($this->container['minHits'] === null) { + $invalidProperties[] = "'minHits' can't be null"; + } + if ($this->container['minLetters'] === null) { + $invalidProperties[] = "'minLetters' can't be null"; + } + if ($this->container['generate'] === null) { + $invalidProperties[] = "'generate' can't be null"; + } + if ($this->container['external'] === null) { + $invalidProperties[] = "'external' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets indexName + * + * @return string + */ + public function getIndexName() + { + return $this->container['indexName']; + } + + /** + * Sets indexName + * + * @param string $indexName source index name + * + * @return self + */ + public function setIndexName($indexName) + { + $this->container['indexName'] = $indexName; + + return $this; + } + + /** + * Gets replicas + * + * @return bool + */ + public function getReplicas() + { + return $this->container['replicas']; + } + + /** + * Sets replicas + * + * @param bool $replicas true if the Query Suggestions index is a replicas + * + * @return self + */ + public function setReplicas($replicas) + { + $this->container['replicas'] = $replicas; + + return $this; + } + + /** + * Gets analyticsTags + * + * @return string[] + */ + public function getAnalyticsTags() + { + return $this->container['analyticsTags']; + } + + /** + * Sets analyticsTags + * + * @param string[] $analyticsTags list of analytics tags to filter the popular searches per tag + * + * @return self + */ + public function setAnalyticsTags($analyticsTags) + { + $this->container['analyticsTags'] = $analyticsTags; + + return $this; + } + + /** + * Gets facets + * + * @return object[] + */ + public function getFacets() + { + return $this->container['facets']; + } + + /** + * Sets facets + * + * @param object[] $facets list of facets to define as categories for the query suggestions + * + * @return self + */ + public function setFacets($facets) + { + $this->container['facets'] = $facets; + + return $this; + } + + /** + * Gets minHits + * + * @return int + */ + public function getMinHits() + { + return $this->container['minHits']; + } + + /** + * Sets minHits + * + * @param int $minHits Minimum number of hits (e.g., matching records in the source index) to generate a suggestions. + * + * @return self + */ + public function setMinHits($minHits) + { + $this->container['minHits'] = $minHits; + + return $this; + } + + /** + * Gets minLetters + * + * @return int + */ + public function getMinLetters() + { + return $this->container['minLetters']; + } + + /** + * Sets minLetters + * + * @param int $minLetters minimum number of required letters for a suggestion to remain + * + * @return self + */ + public function setMinLetters($minLetters) + { + $this->container['minLetters'] = $minLetters; + + return $this; + } + + /** + * Gets generate + * + * @return string[][] + */ + public function getGenerate() + { + return $this->container['generate']; + } + + /** + * Sets generate + * + * @param string[][] $generate List of facet attributes used to generate Query Suggestions. The resulting suggestions are every combination of the facets in the nested list (e.g., (facetA and facetB) and facetC). + * + * @return self + */ + public function setGenerate($generate) + { + $this->container['generate'] = $generate; + + return $this; + } + + /** + * Gets external + * + * @return \Algolia\AlgoliaSearch\Model\SourceIndexExternal[] + */ + public function getExternal() + { + return $this->container['external']; + } + + /** + * Sets external + * + * @param \Algolia\AlgoliaSearch\Model\SourceIndexExternal[] $external list of external indices to use to generate custom Query Suggestions + * + * @return self + */ + public function setExternal($external) + { + $this->container['external'] = $external; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Status.php b/clients/algoliasearch-client-php/lib/Model/Status.php new file mode 100644 index 0000000000..a5deb8d041 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Status.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Status implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Status'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'indexName' => 'string', + 'isRunning' => 'bool', + 'lastBuiltAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'indexName' => null, + 'isRunning' => null, + 'lastBuiltAt' => 'data-time', + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'indexName' => 'indexName', + 'isRunning' => 'isRunning', + 'lastBuiltAt' => 'lastBuiltAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'indexName' => 'setIndexName', + 'isRunning' => 'setIsRunning', + 'lastBuiltAt' => 'setLastBuiltAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'indexName' => 'getIndexName', + 'isRunning' => 'getIsRunning', + 'lastBuiltAt' => 'getLastBuiltAt', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['indexName'] = $data['indexName'] ?? null; + $this->container['isRunning'] = $data['isRunning'] ?? null; + $this->container['lastBuiltAt'] = $data['lastBuiltAt'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['indexName'] === null) { + $invalidProperties[] = "'indexName' can't be null"; + } + if ($this->container['isRunning'] === null) { + $invalidProperties[] = "'isRunning' can't be null"; + } + if ($this->container['lastBuiltAt'] === null) { + $invalidProperties[] = "'lastBuiltAt' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets indexName + * + * @return string + */ + public function getIndexName() + { + return $this->container['indexName']; + } + + /** + * Sets indexName + * + * @param string $indexName the targeted index name + * + * @return self + */ + public function setIndexName($indexName) + { + $this->container['indexName'] = $indexName; + + return $this; + } + + /** + * Gets isRunning + * + * @return bool + */ + public function getIsRunning() + { + return $this->container['isRunning']; + } + + /** + * Sets isRunning + * + * @param bool $isRunning true if the Query Suggestions index is running + * + * @return self + */ + public function setIsRunning($isRunning) + { + $this->container['isRunning'] = $isRunning; + + return $this; + } + + /** + * Gets lastBuiltAt + * + * @return string + */ + public function getLastBuiltAt() + { + return $this->container['lastBuiltAt']; + } + + /** + * Sets lastBuiltAt + * + * @param string $lastBuiltAt date and time of the last build + * + * @return self + */ + public function setLastBuiltAt($lastBuiltAt) + { + $this->container['lastBuiltAt'] = $lastBuiltAt; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/SucessResponse.php b/clients/algoliasearch-client-php/lib/Model/SucessResponse.php new file mode 100644 index 0000000000..32ce446a55 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/SucessResponse.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SucessResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SucessResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'int', + 'message' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => null, + 'message' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'status' => 'status', + 'message' => 'message', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + 'message' => 'setMessage', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + 'message' => 'getMessage', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['status'] = $data['status'] ?? null; + $this->container['message'] = $data['message'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['message'] === null) { + $invalidProperties[] = "'message' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets status + * + * @return int + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param int $status the status code + * + * @return self + */ + public function setStatus($status) + { + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets message + * + * @return string + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string $message message of the response + * + * @return self + */ + public function setMessage($message) + { + $this->container['message'] = $message; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/Model/Variant.php b/clients/algoliasearch-client-php/lib/Model/Variant.php new file mode 100644 index 0000000000..8ba679d40a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Variant.php @@ -0,0 +1,657 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Variant implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'variant'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'averageClickPosition' => 'int', + 'clickCount' => 'int', + 'clickThroughRate' => 'double', + 'conversionCount' => 'int', + 'conversionRate' => 'double', + 'description' => 'string', + 'index' => 'string', + 'noResultCount' => 'int', + 'searchCount' => 'int', + 'trackedSearchCount' => 'int', + 'trafficPercentage' => 'int', + 'userCount' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'averageClickPosition' => null, + 'clickCount' => null, + 'clickThroughRate' => 'double', + 'conversionCount' => null, + 'conversionRate' => 'double', + 'description' => null, + 'index' => null, + 'noResultCount' => null, + 'searchCount' => null, + 'trackedSearchCount' => null, + 'trafficPercentage' => null, + 'userCount' => null, + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'averageClickPosition' => 'averageClickPosition', + 'clickCount' => 'clickCount', + 'clickThroughRate' => 'clickThroughRate', + 'conversionCount' => 'conversionCount', + 'conversionRate' => 'conversionRate', + 'description' => 'description', + 'index' => 'index', + 'noResultCount' => 'noResultCount', + 'searchCount' => 'searchCount', + 'trackedSearchCount' => 'trackedSearchCount', + 'trafficPercentage' => 'trafficPercentage', + 'userCount' => 'userCount', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'averageClickPosition' => 'setAverageClickPosition', + 'clickCount' => 'setClickCount', + 'clickThroughRate' => 'setClickThroughRate', + 'conversionCount' => 'setConversionCount', + 'conversionRate' => 'setConversionRate', + 'description' => 'setDescription', + 'index' => 'setIndex', + 'noResultCount' => 'setNoResultCount', + 'searchCount' => 'setSearchCount', + 'trackedSearchCount' => 'setTrackedSearchCount', + 'trafficPercentage' => 'setTrafficPercentage', + 'userCount' => 'setUserCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'averageClickPosition' => 'getAverageClickPosition', + 'clickCount' => 'getClickCount', + 'clickThroughRate' => 'getClickThroughRate', + 'conversionCount' => 'getConversionCount', + 'conversionRate' => 'getConversionRate', + 'description' => 'getDescription', + 'index' => 'getIndex', + 'noResultCount' => 'getNoResultCount', + 'searchCount' => 'getSearchCount', + 'trackedSearchCount' => 'getTrackedSearchCount', + 'trafficPercentage' => 'getTrafficPercentage', + 'userCount' => 'getUserCount', + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->container['averageClickPosition'] = $data['averageClickPosition'] ?? null; + $this->container['clickCount'] = $data['clickCount'] ?? null; + $this->container['clickThroughRate'] = $data['clickThroughRate'] ?? null; + $this->container['conversionCount'] = $data['conversionCount'] ?? null; + $this->container['conversionRate'] = $data['conversionRate'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['index'] = $data['index'] ?? null; + $this->container['noResultCount'] = $data['noResultCount'] ?? null; + $this->container['searchCount'] = $data['searchCount'] ?? null; + $this->container['trackedSearchCount'] = $data['trackedSearchCount'] ?? null; + $this->container['trafficPercentage'] = $data['trafficPercentage'] ?? null; + $this->container['userCount'] = $data['userCount'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['averageClickPosition'] === null) { + $invalidProperties[] = "'averageClickPosition' can't be null"; + } + if ($this->container['clickCount'] === null) { + $invalidProperties[] = "'clickCount' can't be null"; + } + if ($this->container['clickThroughRate'] === null) { + $invalidProperties[] = "'clickThroughRate' can't be null"; + } + if ($this->container['conversionCount'] === null) { + $invalidProperties[] = "'conversionCount' can't be null"; + } + if ($this->container['conversionRate'] === null) { + $invalidProperties[] = "'conversionRate' can't be null"; + } + if ($this->container['description'] === null) { + $invalidProperties[] = "'description' can't be null"; + } + if ($this->container['index'] === null) { + $invalidProperties[] = "'index' can't be null"; + } + if ($this->container['noResultCount'] === null) { + $invalidProperties[] = "'noResultCount' can't be null"; + } + if ($this->container['searchCount'] === null) { + $invalidProperties[] = "'searchCount' can't be null"; + } + if ($this->container['trackedSearchCount'] === null) { + $invalidProperties[] = "'trackedSearchCount' can't be null"; + } + if ($this->container['trafficPercentage'] === null) { + $invalidProperties[] = "'trafficPercentage' can't be null"; + } + if ($this->container['userCount'] === null) { + $invalidProperties[] = "'userCount' can't be null"; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + /** + * Gets averageClickPosition + * + * @return int + */ + public function getAverageClickPosition() + { + return $this->container['averageClickPosition']; + } + + /** + * Sets averageClickPosition + * + * @param int $averageClickPosition average click position for the variant + * + * @return self + */ + public function setAverageClickPosition($averageClickPosition) + { + $this->container['averageClickPosition'] = $averageClickPosition; + + return $this; + } + + /** + * Gets clickCount + * + * @return int + */ + public function getClickCount() + { + return $this->container['clickCount']; + } + + /** + * Sets clickCount + * + * @param int $clickCount distinct click count for the variant + * + * @return self + */ + public function setClickCount($clickCount) + { + $this->container['clickCount'] = $clickCount; + + return $this; + } + + /** + * Gets clickThroughRate + * + * @return float + */ + public function getClickThroughRate() + { + return $this->container['clickThroughRate']; + } + + /** + * Sets clickThroughRate + * + * @param float $clickThroughRate click through rate for the variant + * + * @return self + */ + public function setClickThroughRate($clickThroughRate) + { + $this->container['clickThroughRate'] = $clickThroughRate; + + return $this; + } + + /** + * Gets conversionCount + * + * @return int + */ + public function getConversionCount() + { + return $this->container['conversionCount']; + } + + /** + * Sets conversionCount + * + * @param int $conversionCount distinct conversion count for the variant + * + * @return self + */ + public function setConversionCount($conversionCount) + { + $this->container['conversionCount'] = $conversionCount; + + return $this; + } + + /** + * Gets conversionRate + * + * @return float + */ + public function getConversionRate() + { + return $this->container['conversionRate']; + } + + /** + * Sets conversionRate + * + * @param float $conversionRate conversion rate for the variant + * + * @return self + */ + public function setConversionRate($conversionRate) + { + $this->container['conversionRate'] = $conversionRate; + + return $this; + } + + /** + * Gets description + * + * @return string + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string $description the A/B test description + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets index + * + * @return string + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param string $index the index performing the A/B test + * + * @return self + */ + public function setIndex($index) + { + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets noResultCount + * + * @return int + */ + public function getNoResultCount() + { + return $this->container['noResultCount']; + } + + /** + * Sets noResultCount + * + * @param int $noResultCount the number of occurrences + * + * @return self + */ + public function setNoResultCount($noResultCount) + { + $this->container['noResultCount'] = $noResultCount; + + return $this; + } + + /** + * Gets searchCount + * + * @return int + */ + public function getSearchCount() + { + return $this->container['searchCount']; + } + + /** + * Sets searchCount + * + * @param int $searchCount the number of search during the A/B test + * + * @return self + */ + public function setSearchCount($searchCount) + { + $this->container['searchCount'] = $searchCount; + + return $this; + } + + /** + * Gets trackedSearchCount + * + * @return int + */ + public function getTrackedSearchCount() + { + return $this->container['trackedSearchCount']; + } + + /** + * Sets trackedSearchCount + * + * @param int $trackedSearchCount the number of tracked search click + * + * @return self + */ + public function setTrackedSearchCount($trackedSearchCount) + { + $this->container['trackedSearchCount'] = $trackedSearchCount; + + return $this; + } + + /** + * Gets trafficPercentage + * + * @return int + */ + public function getTrafficPercentage() + { + return $this->container['trafficPercentage']; + } + + /** + * Sets trafficPercentage + * + * @param int $trafficPercentage the traffic perfecentage for the A/B test + * + * @return self + */ + public function setTrafficPercentage($trafficPercentage) + { + $this->container['trafficPercentage'] = $trafficPercentage; + + return $this; + } + + /** + * Gets userCount + * + * @return int + */ + public function getUserCount() + { + return $this->container['userCount']; + } + + /** + * Sets userCount + * + * @param int $userCount the number of user during the A/B test + * + * @return self + */ + public function setUserCount($userCount) + { + $this->container['userCount'] = $userCount; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param int $offset Offset + * + * @return bool + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param int $offset Offset + * + * @return mixed|null + */ + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value) + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param int $offset Offset + * + * @return void + */ + public function offsetUnset($offset) + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource + */ + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + diff --git a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php index d2ac6a6623..f02eca5c7e 100644 --- a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php +++ b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php @@ -2,7 +2,7 @@ namespace Algolia\AlgoliaSearch\RequestOptions; -use Algolia\AlgoliaSearch\Configuration\AbstractConfig; +use Algolia\AlgoliaSearch\Configuration\Configuration; use Algolia\AlgoliaSearch\Support\UserAgent; final class RequestOptionsFactory @@ -22,7 +22,7 @@ final class RequestOptionsFactory 'createIfNotExists', ]; - public function __construct(AbstractConfig $config) + public function __construct(Configuration $config) { $this->config = $config; } diff --git a/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php b/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php index b52ba94c24..ce4d782241 100644 --- a/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php +++ b/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php @@ -3,7 +3,7 @@ namespace Algolia\AlgoliaSearch\RetryStrategy; use Algolia\AlgoliaSearch\Algolia; -use Algolia\AlgoliaSearch\Configuration\AbstractConfig; +use Algolia\AlgoliaSearch\Configuration\Configuration; use Algolia\AlgoliaSearch\Exceptions\AlgoliaException; use Algolia\AlgoliaSearch\Exceptions\BadRequestException; use Algolia\AlgoliaSearch\Exceptions\NotFoundException; @@ -29,7 +29,7 @@ final class ApiWrapper implements ApiWrapperInterface private $http; /** - * @var AbstractConfig + * @var Configuration */ private $config; @@ -55,7 +55,7 @@ final class ApiWrapper implements ApiWrapperInterface public function __construct( HttpClientInterface $http, - AbstractConfig $config, + Configuration $config, ClusterHosts $clusterHosts, RequestOptionsFactory $RqstOptsFactory = null, LoggerInterface $logger = null diff --git a/clients/algoliasearch-client-php/lib/RetryStrategy/ClusterHosts.php b/clients/algoliasearch-client-php/lib/RetryStrategy/ClusterHosts.php index 8c5a423ed0..57ce7a90a9 100644 --- a/clients/algoliasearch-client-php/lib/RetryStrategy/ClusterHosts.php +++ b/clients/algoliasearch-client-php/lib/RetryStrategy/ClusterHosts.php @@ -93,6 +93,11 @@ public static function createForRecommendation($region) return static::create('recommendation.'.$region.'.algolia.com'); } + public static function createForQuerySuggestions($region) + { + return static::create('query-suggestions.'.$region.'.algolia.com'); + } + public static function createFromCache($cacheKey) { if (!Algolia::isCacheEnabled()) { diff --git a/openapitools.json b/openapitools.json index 4b292eb426..e9a1a771f6 100644 --- a/openapitools.json +++ b/openapitools.json @@ -181,13 +181,129 @@ "templateDir": "#{cwd}/templates/php/", "config": "#{cwd}/openapitools.json", "output": "#{cwd}/clients/algoliasearch-client-php", - "apiPackage": "", "glob": "specs/search/spec.yml", "gitHost": "algolia", "gitUserId": "algolia", "gitRepoId": "algoliasearch-client-php", "invokerPackage": "Algolia\\AlgoliaSearch", "additionalProperties": { + "configClassname": "SearchConfig", + "clusterHostsMethod":"createFromAppId", + "useCache": true, + "variableNamingConvention": "camelCase", + "packageName": "algoliasearch-client-php" + } + }, + "php-recommend": { + "generatorName": "php", + "templateDir": "#{cwd}/templates/php/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-php", + "glob": "specs/recommend/spec.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "additionalProperties": { + "configClassname": "RecommendConfig", + "clusterHostsMethod":"createFromAppId", + "hasRegionalHost": true, + "allowedRegions": "us-de", + "variableNamingConvention": "camelCase", + "packageName": "algoliasearch-client-php" + } + }, + "php-personalization": { + "generatorName": "php", + "templateDir": "#{cwd}/templates/php/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-php", + "glob": "specs/personalization/spec.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "additionalProperties": { + "configClassname": "PersonalizationConfig", + "clusterHostsMethod":"createForRecommendation", + "hasRegionalHost": true, + "allowedRegions": "us-eu", + "variableNamingConvention": "camelCase", + "packageName": "algoliasearch-client-php" + } + }, + "php-analytics": { + "generatorName": "php", + "templateDir": "#{cwd}/templates/php/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-php", + "glob": "specs/analytics/spec.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "additionalProperties": { + "configClassname": "AnalyticsConfig", + "clusterHostsMethod":"createForAnalytics", + "hasRegionalHost": true, + "allowedRegions": "us-de", + "variableNamingConvention": "camelCase", + "packageName": "algoliasearch-client-php" + } + }, + "php-insights": { + "generatorName": "php", + "templateDir": "#{cwd}/templates/php/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-php", + "glob": "specs/insights/spec.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "additionalProperties": { + "configClassname": "InsightsConfig", + "clusterHostsMethod":"createForInsights", + "hasRegionalHost": true, + "allowedRegions": "us-de", + "variableNamingConvention": "camelCase", + "packageName": "algoliasearch-client-php" + } + }, + "php-abtesting": { + "generatorName": "php", + "templateDir": "#{cwd}/templates/php/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-php", + "glob": "specs/abtesting/spec.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "additionalProperties": { + "configClassname": "AbTestingConfig", + "clusterHostsMethod":"createForAnalytics", + "hasRegionalHost": true, + "allowedRegions": "us-de", + "variableNamingConvention": "camelCase", + "packageName": "algoliasearch-client-php" + } + }, + "php-query-suggestions": { + "generatorName": "php", + "templateDir": "#{cwd}/templates/php/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-php", + "glob": "specs/query-suggestions/spec.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "additionalProperties": { + "configClassname": "QuerySuggestionsConfig", + "clusterHostsMethod":"createForQuerySuggestions", + "hasRegionalHost": true, + "allowedRegions": "us-eu", "variableNamingConvention": "camelCase", "packageName": "algoliasearch-client-php" } diff --git a/playground/php/src/abtesting.php b/playground/php/src/abtesting.php new file mode 100644 index 0000000000..bfb6356276 --- /dev/null +++ b/playground/php/src/abtesting.php @@ -0,0 +1,27 @@ + 'testing', + 'variants' => [ + [ + 'index' => 'test1', + 'trafficPercentage' => 30, + 'description' => 'a description', + ], + [ + 'index' => 'test2', + 'trafficPercentage' => 50, + ], + ], + 'endAt' => '2022-02-01', +]; + +var_dump( + $client->addABTests($abTest) +); diff --git a/playground/php/src/analytics.php b/playground/php/src/analytics.php new file mode 100644 index 0000000000..807977921b --- /dev/null +++ b/playground/php/src/analytics.php @@ -0,0 +1,15 @@ +getTopFilterForAttribute( + 'myAttribute1,myAttribute2', + $indexName + ) +); diff --git a/playground/php/src/insights.php b/playground/php/src/insights.php new file mode 100644 index 0000000000..cc18646d4d --- /dev/null +++ b/playground/php/src/insights.php @@ -0,0 +1,23 @@ + 'click', + 'eventName' => 'foo', + 'index' => 'sending_events', + 'userToken' => 'bar', + 'objectIDs' => ['one', 'two'], + 'timestamp' => $twoDaysAgoMs, +]; + +var_dump( + $client->pushEvents([$event]) +); diff --git a/playground/php/src/personalization.php b/playground/php/src/personalization.php new file mode 100644 index 0000000000..fcd77c8aa4 --- /dev/null +++ b/playground/php/src/personalization.php @@ -0,0 +1,11 @@ +deleteUserProfile('userToken') +); diff --git a/playground/php/src/query-suggestions.php b/playground/php/src/query-suggestions.php new file mode 100644 index 0000000000..cac6136a4b --- /dev/null +++ b/playground/php/src/query-suggestions.php @@ -0,0 +1,9 @@ +getAllConfigs()); diff --git a/playground/php/src/recommend.php b/playground/php/src/recommend.php new file mode 100644 index 0000000000..073f1e27f6 --- /dev/null +++ b/playground/php/src/recommend.php @@ -0,0 +1,22 @@ +getRecommendations( + [ + 'requests' => [ + [ + 'indexName' => $indexName, + 'model' => 'bought-together', + 'objectID' => $query, + 'threshold' => 0 + ] + ] + ] +)); diff --git a/scripts/post-gen/php.sh b/scripts/post-gen/php.sh index 74a7dc8764..e550b0c355 100755 --- a/scripts/post-gen/php.sh +++ b/scripts/post-gen/php.sh @@ -18,7 +18,7 @@ lint_client() { else PHP="php8" fi - PHP_CS_FIXER_IGNORE_ENV=1 $PHP vendor/bin/php-cs-fixer fix lib/ -v --using-cache=no --allow-risky=yes + PHP_CS_FIXER_IGNORE_ENV=1 $PHP vendor/bin/php-cs-fixer fix lib/ --using-cache=no --allow-risky=yes } lint_client diff --git a/templates/php/Configuration.mustache b/templates/php/Configuration.mustache index dad3b4dd00..2e0fb46f4e 100644 --- a/templates/php/Configuration.mustache +++ b/templates/php/Configuration.mustache @@ -9,7 +9,7 @@ namespace {{invokerPackage}}\Configuration; * @category Class * @package {{invokerPackage}} */ -class Configuration extends AbstractConfig +abstract class Configuration { /** * Associate array to store API key(s) @@ -60,6 +60,14 @@ class Configuration extends AbstractConfig */ protected $tempFolderPath; + protected $config; + + protected $defaultReadTimeout = 5; + + protected $defaultWriteTimeout = 30; + + protected $defaultConnectTimeout = 2; + public function __construct(array $config = []) { $this->tempFolderPath = sys_get_temp_dir(); @@ -246,4 +254,131 @@ class Configuration extends AbstractConfig return $keyWithPrefix; } + + public function getDefaultConfiguration() + { + return [ + 'appId' => '', + 'apiKey' => '', + 'hosts' => null, + 'readTimeout' => $this->defaultReadTimeout, + 'writeTimeout' => $this->defaultWriteTimeout, + 'connectTimeout' => $this->defaultConnectTimeout, + 'defaultHeaders' => [], + ]; + } + + public function getAppId() + { + return $this->config['appId']; + } + + public function setAppId($appId) + { + $this->config['appId'] = $appId; + + return $this; + } + + public function getAlgoliaApiKey() + { + return $this->config['apiKey']; + } + + public function setAlgoliaApiKey($apiKey) + { + $this->config['apiKey'] = $apiKey; + + return $this; + } + + public function getHosts() + { + return $this->config['hosts']; + } + + public function setHosts($hosts) + { + $this->config['hosts'] = $hosts; + + return $this; + } + + public function getReadTimeout() + { + return $this->config['readTimeout']; + } + + public function setReadTimeout($readTimeout) + { + $this->config['readTimeout'] = $readTimeout; + + return $this; + } + + public function getWriteTimeout() + { + return $this->config['writeTimeout']; + } + + public function setWriteTimeout($writeTimeout) + { + $this->config['writeTimeout'] = $writeTimeout; + + return $this; + } + + public function getConnectTimeout() + { + return $this->config['connectTimeout']; + } + + public function setConnectTimeout($connectTimeout) + { + $this->config['connectTimeout'] = $connectTimeout; + + return $this; + } + + public function getDefaultHeaders() + { + return $this->config['defaultHeaders']; + } + + public function setDefaultHeaders(array $defaultHeaders) + { + $this->config['defaultHeaders'] = $defaultHeaders; + + return $this; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } } diff --git a/templates/php/api.mustache b/templates/php/api.mustache index b6b23880c3..f6d0508239 100644 --- a/templates/php/api.mustache +++ b/templates/php/api.mustache @@ -9,7 +9,7 @@ use GuzzleHttp\RequestOptions; use GuzzleHttp\Utils; use {{invokerPackage}}\Algolia; use {{invokerPackage}}\ApiException; -use {{invokerPackage}}\Configuration\Configuration; +use {{invokerPackage}}\Configuration\{{configClassname}}; use {{invokerPackage}}\HeaderSelector; use {{invokerPackage}}\ObjectSerializer; use {{invokerPackage}}\RetryStrategy\ApiWrapper; @@ -30,7 +30,7 @@ use {{invokerPackage}}\RetryStrategy\ClusterHosts; protected $api; /** - * @var Configuration + * @var {{configClassname}} */ protected $config; @@ -40,10 +40,10 @@ use {{invokerPackage}}\RetryStrategy\ClusterHosts; protected $headerSelector; /** - * @param Configuration $config + * @param {{configClassname}} $config * @param ApiWrapperInterface $apiWrapper */ - public function __construct(ApiWrapperInterface $apiWrapper, Configuration $config) + public function __construct(ApiWrapperInterface $apiWrapper, {{configClassname}} $config) { $this->config = $config; @@ -51,6 +51,24 @@ use {{invokerPackage}}\RetryStrategy\ClusterHosts; $this->headerSelector = new HeaderSelector(); } + {{#hasRegionalHost}} + /** + * Instantiate the client with basic credentials and region + * + * @param string $appId Application ID + * @param string $apiKey Algolia API Key + * @param string $region Region + */ + public static function create($appId = null, $apiKey = null, $region = null) + { + $allowedRegions = explode('-', '{{{allowedRegions}}}'); + $config = {{configClassname}}::create($appId, $apiKey, $region, $allowedRegions); + + return static::createWithConfig($config); + } + {{/hasRegionalHost}} + + {{^hasRegionalHost}} /** * Instantiate the client with basic credentials * @@ -59,18 +77,20 @@ use {{invokerPackage}}\RetryStrategy\ClusterHosts; */ public static function create($appId = null, $apiKey = null) { - return static::createWithConfig(Configuration::create($appId, $apiKey)); + return static::createWithConfig({{configClassname}}::create($appId, $apiKey)); } - + {{/hasRegionalHost}} + /** * Instantiate the client with congiguration * - * @param Configuration $config Configuration + * @param {{configClassname}} $config Configuration */ - public static function createWithConfig(Configuration $config) + public static function createWithConfig({{configClassname}} $config) { $config = clone $config; + {{#useCache}} $cacheKey = sprintf('%s-clusterHosts-%s', __CLASS__, $config->getAppId()); if ($hosts = $config->getHosts()) { @@ -79,9 +99,19 @@ use {{invokerPackage}}\RetryStrategy\ClusterHosts; } elseif (false === ($clusterHosts = ClusterHosts::createFromCache($cacheKey))) { // We'll try to restore the ClusterHost from cache, if we cannot // we create a new instance and set the cache key - $clusterHosts = ClusterHosts::createFromAppId($config->getAppId()) + $clusterHosts = ClusterHosts::{{clusterHostsMethod}}($config->getAppId()) ->setCacheKey($cacheKey); } + {{/useCache}} + + {{^useCache}} + if ($hosts = $config->getHosts()) { + // If a list of hosts was passed, we ignore the cache + $clusterHosts = ClusterHosts::create($hosts); + } else { + $clusterHosts = ClusterHosts::{{clusterHostsMethod}}($config->getAppId()); + } + {{/useCache}} $apiWrapper = new ApiWrapper( Algolia::getHttpClient(), @@ -93,9 +123,9 @@ use {{invokerPackage}}\RetryStrategy\ClusterHosts; } /** - * @return Configuration + * @return {{configClassname}} */ - public function getConfig() + public function getClientConfig() { return $this->config; } diff --git a/templates/php/composer.mustache b/templates/php/composer.mustache index dc58dcb590..3cfdb1bfa6 100644 --- a/templates/php/composer.mustache +++ b/templates/php/composer.mustache @@ -5,7 +5,7 @@ {{#artifactVersion}} "version": "{{.}}", {{/artifactVersion}} - "description": "{{{appDescription}}}", + "description": "API powering the features of Algolia.", "keywords": [ "openapitools", "openapi-generator",