diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml index 5d0c437c85..1398e38277 100644 --- a/.github/actions/setup/action.yml +++ b/.github/actions/setup/action.yml @@ -40,6 +40,9 @@ runs: echo "::set-output name=JAVA_CLIENT_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- clients/algoliasearch-client-java-2 | wc -l)" echo "::set-output name=JAVA_TEMPLATE_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- templates/java | wc -l)" + echo "::set-output name=PHP_CLIENT_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- clients/algoliasearch-client-php | wc -l)" + echo "::set-output name=PHP_TEMPLATE_CHANGED::$(git diff --shortstat origin/${{ github.base_ref }}..HEAD -- templates/php | wc -l)" + - name: Compute specs matrix id: spec-matrix shell: bash @@ -91,6 +94,23 @@ runs: echo "::set-output name=MATRIX::$matrix" echo "::set-output name=RUN_CLIENT::$run" + - name: Compute the PHP client build matrix + id: php-matrix + shell: bash + run: | + base_changed=${{ github.ref == 'refs/heads/main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.COMMON_SPECS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.PHP_TEMPLATE_CHANGED > 0 }} + + matrix=$(./scripts/ci/create-client-matrix.sh php $base_changed ${{ github.base_ref }}) + + if [[ $matrix == '{"client":["no-run"]}' ]]; then + run="false" + else + run="true" + fi + + echo "::set-output name=MATRIX::$matrix" + echo "::set-output name=RUN_CLIENT::$run" + outputs: RUN_SPECS: description: Whether to run specs or not @@ -116,6 +136,14 @@ outputs: description: Generate the matrix for the Java client value: ${{ steps.java-matrix.outputs.MATRIX }} + RUN_PHP: + description: Whether to run php client or not + value: ${{ steps.php-matrix.outputs.RUN_CLIENT }} + + PHP_MATRIX: + description: Generate the matrix for the PHP client + value: ${{ steps.php-matrix.outputs.MATRIX }} + RUN_CTS: description: Determine if the `cts` job should run value: ${{ github.ref_name == 'main' || steps.diff.outputs.GITHUB_ACTIONS_CHANGED > 0 || steps.diff.outputs.SCRIPTS_CHANGED > 0 || steps.diff.outputs.SPECS_CHANGED > 0 || steps.diff.outputs.TESTS_CHANGED > 0 || steps.diff.outputs.JS_CLIENT_CHANGED > 0 || steps.diff.outputs.JS_TEMPLATE_CHANGED > 0 || steps.diff.outputs.JAVA_CLIENT_CHANGED > 0 || steps.diff.outputs.JAVA_TEMPLATE_CHANGED > 0 }} diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 42b34bff83..48573bdbf5 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -36,6 +36,9 @@ jobs: RUN_JAVA: ${{ steps.setup.outputs.RUN_JAVA }} JAVA_MATRIX: ${{ steps.setup.outputs.JAVA_MATRIX }} + RUN_PHP: ${{ steps.setup.outputs.RUN_PHP }} + PHP_MATRIX: ${{ steps.setup.outputs.PHP_MATRIX }} + RUN_CTS: ${{ steps.setup.outputs.RUN_CTS }} specs: @@ -134,11 +137,43 @@ jobs: if: steps.cache.outputs.cache-hit != 'true' run: yarn build:clients java ${{ matrix.client.name }} + client_php: + runs-on: ubuntu-20.04 + needs: + - setup + - specs + if: ${{ always() && needs.setup.outputs.RUN_PHP == 'true' }} + strategy: + matrix: ${{ fromJSON(needs.setup.outputs.PHP_MATRIX) }} + steps: + - uses: actions/checkout@v2 + + - name: Restore cache + uses: ./.github/actions/cache + with: + job: client + language: php + spec: ${{ matrix.client.name }} + + - name: Generate ${{ matrix.client.name }} client + if: steps.cache.outputs.cache-hit != 'true' + run: yarn generate php ${{ matrix.client.name }} + + - name: Check diff with pushed client + if: steps.cache.outputs.cache-hit != 'true' + run: exit $(git status --porcelain ${{ matrix.client.folder }} | wc -l) + + - name: Build ${{ matrix.client.name }} client + if: steps.cache.outputs.cache-hit != 'true' + run: yarn build:clients php ${{ matrix.client.name }} + cts: runs-on: ubuntu-20.04 needs: - client_javascript - client_java + - client_php + if: ${{ always() && needs.setup.outputs.RUN_CTS == 'true' }} steps: - uses: actions/checkout@v2 diff --git a/Dockerfile b/Dockerfile index e2624523f4..a77397c415 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,9 @@ ENV JAVA_HOME=/usr/lib/jvm/default-jvm # Java formatter ADD https://github.com/google/google-java-format/releases/download/v1.13.0/google-java-format-1.13.0-all-deps.jar /tmp/java-formatter.jar +# PHP dependencies +RUN apk add -U composer php8 php8-tokenizer + WORKDIR /app CMD ["bash"] diff --git a/clients/algoliasearch-client-php/.gitignore b/clients/algoliasearch-client-php/.gitignore new file mode 100644 index 0000000000..aa44c17b5e --- /dev/null +++ b/clients/algoliasearch-client-php/.gitignore @@ -0,0 +1,13 @@ +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore + +composer.phar +/vendor/ + +# php-cs-fixer cache +.php_cs.cache + +# PHPUnit cache +.phpunit.result.cache + +.openapi-generator/ +composer.lock diff --git a/clients/algoliasearch-client-php/.openapi-generator-ignore b/clients/algoliasearch-client-php/.openapi-generator-ignore new file mode 100644 index 0000000000..69d2c37844 --- /dev/null +++ b/clients/algoliasearch-client-php/.openapi-generator-ignore @@ -0,0 +1,16 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +docs/** +test/** + +.travis.yml +phpunit.xml.dist +README.md +git_push.sh +.php_cs + +lib/HeaderSelector.php diff --git a/clients/algoliasearch-client-php/.php-cs-fixer.php b/clients/algoliasearch-client-php/.php-cs-fixer.php new file mode 100644 index 0000000000..90c95dcf68 --- /dev/null +++ b/clients/algoliasearch-client-php/.php-cs-fixer.php @@ -0,0 +1,63 @@ +setUsingCache(true) + ->setRules([ + 'array_syntax' => [ 'syntax' => 'short' ], + 'blank_line_after_namespace' => false, + 'blank_line_after_opening_tag' => true, + 'blank_line_before_statement' => true, + 'braces' => false, + 'cast_spaces' => true, + 'combine_consecutive_unsets' => true, + 'echo_tag_syntax' => true, + 'general_phpdoc_tag_rename' => true, + 'mb_str_functions' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_short_bool_cast' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'normalize_index_brace' => true, + 'not_operator_with_space' => false, + 'object_operator_without_whitespace' => true, + 'ordered_imports' => true, + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_inline_tag_normalizer' => true, + 'phpdoc_order' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_tag_type' => true, + 'protected_to_private' => true, + '@PSR2' => true, + 'short_scalar_cast' => true, + 'single_blank_line_at_eof' => false, + 'single_blank_line_before_namespace' => true, + 'single_quote' => true, + 'space_after_semicolon' => true, + 'standardize_not_equals' => true, + 'strict_comparison' => true, + 'strict_param' => true, + 'ternary_operator_spaces' => true, + 'trailing_comma_in_multiline' => true, + 'trim_array_spaces' => true, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) + ); diff --git a/clients/algoliasearch-client-php/composer.json b/clients/algoliasearch-client-php/composer.json new file mode 100644 index 0000000000..4bd465a2e3 --- /dev/null +++ b/clients/algoliasearch-client-php/composer.json @@ -0,0 +1,44 @@ +{ + "name": "algolia/algoliasearch-client-php", + "description": "API powering the features of Algolia.", + "keywords": [ + "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI-Generator contributors", + "homepage": "https://openapi-generator.tech" + } + ], + "require": { + "php": "^7.3 || ^8.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^7.3", + "guzzlehttp/psr7": "^2.0", + "psr/http-message": "^1.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.5.0" + }, + "autoload": { + "psr-4": { "Algolia\\AlgoliaSearch\\" : "lib/" }, + "files": [ + "lib/Http/Psr7/functions.php" + ] + }, + "autoload-dev": { + "psr-4": { "Algolia\\AlgoliaSearch\\Test\\" : "test/" } + } +} diff --git a/clients/algoliasearch-client-php/lib/Algolia.php b/clients/algoliasearch-client-php/lib/Algolia.php new file mode 100644 index 0000000000..91d4adee66 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Algolia.php @@ -0,0 +1,105 @@ +config = $config; + + $this->api = $apiWrapper; + } + + /** + * 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\ABTesting\AddABTestsRequest $addABTestsRequest addABTestsRequest (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\ABTesting\ABTestResponse|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\ABTesting\ABTestResponse|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\ABTesting\ABTest|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\ABTesting\ListABTestsResponse|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase + */ + public function listABTests($offset = 0, $limit = 10) + { + $resourcePath = '/2/abtests'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($offset !== null) { + if ('form' === 'form' && is_array($offset)) { + foreach ($offset as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['offset'] = $offset; + } + } + + if ($limit !== null) { + if ('form' === 'form' && is_array($limit)) { + foreach ($limit as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['limit'] = $limit; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\ABTesting\ABTestResponse|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\ErrorBase|\Algolia\AlgoliaSearch\Model\ABTesting\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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..02b866ba4a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/AnalyticsApi.php @@ -0,0 +1,1961 @@ +config = $config; + + $this->api = $apiWrapper; + } + + /** + * 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\Analytics\GetAverageClickPositionResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetClickPositionsResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetClickThroughRateResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetConversationRateResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetNoClickRateResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetNoResultsRateResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetSearchesCountResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetSearchesNoClicksResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($limit !== null) { + if ('form' === 'form' && is_array($limit)) { + foreach ($limit as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['limit'] = $limit; + } + } + + if ($offset !== null) { + if ('form' === 'form' && is_array($offset)) { + foreach ($offset as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['offset'] = $offset; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetSearchesNoResultsResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($limit !== null) { + if ('form' === 'form' && is_array($limit)) { + foreach ($limit as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['limit'] = $limit; + } + } + + if ($offset !== null) { + if ('form' === 'form' && is_array($offset)) { + foreach ($offset as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['offset'] = $offset; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetStatusResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetTopCountriesResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($limit !== null) { + if ('form' === 'form' && is_array($limit)) { + foreach ($limit as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['limit'] = $limit; + } + } + + if ($offset !== null) { + if ('form' === 'form' && is_array($offset)) { + foreach ($offset as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['offset'] = $offset; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetTopFilterAttributesResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($search !== null) { + if ('form' === 'form' && is_array($search)) { + foreach ($search as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['search'] = $search; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($limit !== null) { + if ('form' === 'form' && is_array($limit)) { + foreach ($limit as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['limit'] = $limit; + } + } + + if ($offset !== null) { + if ('form' === 'form' && is_array($offset)) { + foreach ($offset as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['offset'] = $offset; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetTopFilterForAttributeResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($search !== null) { + if ('form' === 'form' && is_array($search)) { + foreach ($search as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['search'] = $search; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($limit !== null) { + if ('form' === 'form' && is_array($limit)) { + foreach ($limit as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['limit'] = $limit; + } + } + + if ($offset !== null) { + if ('form' === 'form' && is_array($offset)) { + foreach ($offset as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['offset'] = $offset; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + // path params + if ($attribute !== null) { + $resourcePath = str_replace( + '{' . 'attribute' . '}', + ObjectSerializer::toPathValue($attribute), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetTopFiltersNoResultsResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($search !== null) { + if ('form' === 'form' && is_array($search)) { + foreach ($search as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['search'] = $search; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($limit !== null) { + if ('form' === 'form' && is_array($limit)) { + foreach ($limit as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['limit'] = $limit; + } + } + + if ($offset !== null) { + if ('form' === 'form' && is_array($offset)) { + foreach ($offset as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['offset'] = $offset; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($search !== null) { + if ('form' === 'form' && is_array($search)) { + foreach ($search as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['search'] = $search; + } + } + + if ($clickAnalytics !== null) { + if ('form' === 'form' && is_array($clickAnalytics)) { + foreach ($clickAnalytics as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['clickAnalytics'] = $clickAnalytics; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($limit !== null) { + if ('form' === 'form' && is_array($limit)) { + foreach ($limit as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['limit'] = $limit; + } + } + + if ($offset !== null) { + if ('form' === 'form' && is_array($offset)) { + foreach ($offset as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['offset'] = $offset; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($clickAnalytics !== null) { + if ('form' === 'form' && is_array($clickAnalytics)) { + foreach ($clickAnalytics as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['clickAnalytics'] = $clickAnalytics; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($orderBy !== null) { + if ('form' === 'form' && is_array($orderBy)) { + foreach ($orderBy as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['orderBy'] = $orderBy; + } + } + + if ($direction !== null) { + if ('form' === 'form' && is_array($direction)) { + foreach ($direction as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['direction'] = $direction; + } + } + + if ($limit !== null) { + if ('form' === 'form' && is_array($limit)) { + foreach ($limit as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['limit'] = $limit; + } + } + + if ($offset !== null) { + if ('form' === 'form' && is_array($offset)) { + foreach ($offset as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['offset'] = $offset; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Analytics\GetUsersCountResponse|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\ErrorBase|\Algolia\AlgoliaSearch\Model\Analytics\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 = []; + + if ($index !== null) { + if ('form' === 'form' && is_array($index)) { + foreach ($index as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['index'] = $index; + } + } + + if ($startDate !== null) { + if ('form' === 'form' && is_array($startDate)) { + foreach ($startDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['startDate'] = $startDate; + } + } + + if ($endDate !== null) { + if ('form' === 'form' && is_array($endDate)) { + foreach ($endDate as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['endDate'] = $endDate; + } + } + + if ($tags !== null) { + if ('form' === 'form' && is_array($tags)) { + foreach ($tags as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['tags'] = $tags; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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..3d6ac06bd4 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/InsightsApi.php @@ -0,0 +1,154 @@ +config = $config; + + $this->api = $apiWrapper; + } + + /** + * 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\Insights\InsightEvents $insightEvents insightEvents (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Insights\PushEventsResponse|\Algolia\AlgoliaSearch\Model\Insights\ErrorBase|\Algolia\AlgoliaSearch\Model\Insights\ErrorBase|\Algolia\AlgoliaSearch\Model\Insights\ErrorBase|\Algolia\AlgoliaSearch\Model\Insights\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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..4c94a8e159 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/PersonalizationApi.php @@ -0,0 +1,298 @@ +config = $config; + + $this->api = $apiWrapper; + } + + /** + * 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\Personalization\DeleteUserProfileResponse|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Personalization\PersonalizationStrategyParams|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase + */ + public function getPersonalizationStrategy() + { + $resourcePath = '/1/strategies/personalization'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Personalization\GetUserTokenResponse|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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\Personalization\PersonalizationStrategyParams $personalizationStrategyParams personalizationStrategyParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Personalization\SetPersonalizationStrategyResponse|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase|\Algolia\AlgoliaSearch\Model\Personalization\ErrorBase + */ + public function setPersonalizationStrategy($personalizationStrategyParams) + { + // verify the required parameter 'personalizationStrategyParams' is set + if ($personalizationStrategyParams === null || (is_array($personalizationStrategyParams) && count($personalizationStrategyParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $personalizationStrategyParams when calling setPersonalizationStrategy' + ); + } + + $resourcePath = '/1/strategies/personalization'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($personalizationStrategyParams)) { + $httpBody = $personalizationStrategyParams; + } + + $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..91d4035d0f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/QuerySuggestionsApi.php @@ -0,0 +1,467 @@ +config = $config; + + $this->api = $apiWrapper; + } + + /** + * 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 + * + * Create a configuration of a Query Suggestions index. + * + * @param \Algolia\AlgoliaSearch\Model\QuerySuggestions\QuerySuggestionsIndexWithIndexParam $querySuggestionsIndexWithIndexParam querySuggestionsIndexWithIndexParam (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\QuerySuggestions\SucessResponse|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 + * + * Delete a configuration of a Query Suggestion's index. + * + * @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\QuerySuggestions\SucessResponse|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 + * + * Get all the configurations of Query Suggestions. + * + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\QuerySuggestions\QuerySuggestionsIndex[]|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase + */ + public function getAllConfigs() + { + $resourcePath = '/1/configs'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 + * + * Get the configuration of a single Query Suggestions index. + * + * @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\QuerySuggestions\QuerySuggestionsIndex|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 + * + * Get the status of a Query Suggestion's index. + * + * @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\QuerySuggestions\Status|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 + * + * Get the log file of the last build of a single Query Suggestion index. + * + * @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\QuerySuggestions\LogFile[]|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 + * + * Update the configuration of a Query Suggestions index. + * + * @param string $indexName The index in which to perform the request. (required) + * @param \Algolia\AlgoliaSearch\Model\QuerySuggestions\QuerySuggestionsIndexParam $querySuggestionsIndexParam querySuggestionsIndexParam (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\QuerySuggestions\SucessResponse|\Algolia\AlgoliaSearch\Model\QuerySuggestions\ErrorBase|\Algolia\AlgoliaSearch\Model\QuerySuggestions\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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..a23c1a4d25 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/RecommendApi.php @@ -0,0 +1,154 @@ +config = $config; + + $this->api = $apiWrapper; + } + + /** + * 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 + * + * Returns recommendations for a specific model and objectID. + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\GetRecommendations $getRecommendations getRecommendations (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Recommend\GetRecommendationsResponse|\Algolia\AlgoliaSearch\Model\Recommend\ErrorBase|\Algolia\AlgoliaSearch\Model\Recommend\ErrorBase|\Algolia\AlgoliaSearch\Model\Recommend\ErrorBase|\Algolia\AlgoliaSearch\Model\Recommend\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 = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 new file mode 100644 index 0000000000..a35526eb4d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Api/SearchApi.php @@ -0,0 +1,3594 @@ +config = $config; + + $this->api = $apiWrapper; + } + + /** + * Instantiate the client with basic credentials + * + * @param string $appId Application ID + * @param string $apiKey Algolia API Key + */ + public static function create($appId = null, $apiKey = null) + { + return static::createWithConfig(SearchConfig::create($appId, $apiKey)); + } + + /** + * Instantiate the client with congiguration + * + * @param SearchConfig $config Configuration + */ + public static function createWithConfig(SearchConfig $config) + { + $config = clone $config; + + $cacheKey = sprintf('%s-clusterHosts-%s', __CLASS__, $config->getAppId()); + + if ($hosts = $config->getHosts()) { + // If a list of hosts was passed, we ignore the cache + $clusterHosts = ClusterHosts::create($hosts); + } 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()) + ->setCacheKey($cacheKey); + } + + $apiWrapper = new ApiWrapper( + Algolia::getHttpClient(), + $config, + $clusterHosts + ); + + return new static($apiWrapper, $config); + } + + /** + * @return SearchConfig + */ + public function getClientConfig() + { + return $this->config; + } + + /** + * Operation addApiKey + * + * Create a new API key. + * + * @param \Algolia\AlgoliaSearch\Model\Search\ApiKey $apiKey apiKey (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\AddApiKeyResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function addApiKey($apiKey) + { + // verify the required parameter 'apiKey' is set + if ($apiKey === null || (is_array($apiKey) && count($apiKey) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $apiKey when calling addApiKey' + ); + } + + $resourcePath = '/1/keys'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($apiKey)) { + $httpBody = $apiKey; + } + + $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 addOrUpdateObject + * + * Add or replace an object with a given object ID. + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $objectID Unique identifier of an object. (required) + * @param object $body The Algolia object. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtWithObjectIdResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function addOrUpdateObject($indexName, $objectID, $body) + { + // 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 addOrUpdateObject' + ); + } + // verify the required parameter 'objectID' is set + if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $objectID when calling addOrUpdateObject' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling addOrUpdateObject' + ); + } + + $resourcePath = '/1/indexes/{indexName}/{objectID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($objectID !== null) { + $resourcePath = str_replace( + '{' . 'objectID' . '}', + ObjectSerializer::toPathValue($objectID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($body)) { + $httpBody = $body; + } + + $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); + } + /** + * Operation appendSource + * + * Add a single source. + * + * @param \Algolia\AlgoliaSearch\Model\Search\Source $source The source to add. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\CreatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function appendSource($source) + { + // verify the required parameter 'source' is set + if ($source === null || (is_array($source) && count($source) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $source when calling appendSource' + ); + } + + $resourcePath = '/1/security/sources/append'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($source)) { + $httpBody = $source; + } + + $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 assignUserId + * + * Assign or Move userID + * + * @param string $xAlgoliaUserID userID to assign. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\AssignUserIdParams $assignUserIdParams assignUserIdParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\CreatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function assignUserId($xAlgoliaUserID, $assignUserIdParams) + { + // verify the required parameter 'xAlgoliaUserID' is set + if ($xAlgoliaUserID === null || (is_array($xAlgoliaUserID) && count($xAlgoliaUserID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $xAlgoliaUserID when calling assignUserId' + ); + } + if (!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $xAlgoliaUserID)) { + throw new \InvalidArgumentException('invalid value for "xAlgoliaUserID" when calling SearchApi.assignUserId, must conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/.'); + } + + // verify the required parameter 'assignUserIdParams' is set + if ($assignUserIdParams === null || (is_array($assignUserIdParams) && count($assignUserIdParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $assignUserIdParams when calling assignUserId' + ); + } + + $resourcePath = '/1/clusters/mapping'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($xAlgoliaUserID !== null) { + if ('form' === 'form' && is_array($xAlgoliaUserID)) { + foreach ($xAlgoliaUserID as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['X-Algolia-User-ID'] = $xAlgoliaUserID; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($assignUserIdParams)) { + $httpBody = $assignUserIdParams; + } + + $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 batch + * + * Performs multiple write operations in a single API call. + * + * @param string $indexName The index in which to perform the request. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\BatchWriteParams $batchWriteParams batchWriteParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\BatchResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function batch($indexName, $batchWriteParams) + { + // 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 batch' + ); + } + // verify the required parameter 'batchWriteParams' is set + if ($batchWriteParams === null || (is_array($batchWriteParams) && count($batchWriteParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batchWriteParams when calling batch' + ); + } + + $resourcePath = '/1/indexes/{indexName}/batch'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($batchWriteParams)) { + $httpBody = $batchWriteParams; + } + + $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 batchAssignUserIds + * + * Batch assign userIDs + * + * @param string $xAlgoliaUserID userID to assign. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\BatchAssignUserIdsParams $batchAssignUserIdsParams batchAssignUserIdsParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\CreatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function batchAssignUserIds($xAlgoliaUserID, $batchAssignUserIdsParams) + { + // verify the required parameter 'xAlgoliaUserID' is set + if ($xAlgoliaUserID === null || (is_array($xAlgoliaUserID) && count($xAlgoliaUserID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $xAlgoliaUserID when calling batchAssignUserIds' + ); + } + if (!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $xAlgoliaUserID)) { + throw new \InvalidArgumentException('invalid value for "xAlgoliaUserID" when calling SearchApi.batchAssignUserIds, must conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/.'); + } + + // verify the required parameter 'batchAssignUserIdsParams' is set + if ($batchAssignUserIdsParams === null || (is_array($batchAssignUserIdsParams) && count($batchAssignUserIdsParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batchAssignUserIdsParams when calling batchAssignUserIds' + ); + } + + $resourcePath = '/1/clusters/mapping/batch'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($xAlgoliaUserID !== null) { + if ('form' === 'form' && is_array($xAlgoliaUserID)) { + foreach ($xAlgoliaUserID as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['X-Algolia-User-ID'] = $xAlgoliaUserID; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($batchAssignUserIdsParams)) { + $httpBody = $batchAssignUserIdsParams; + } + + $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 batchDictionaryEntries + * + * Send a batch of dictionary entries. + * + * @param string $dictionaryName The dictionary to search in. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\BatchDictionaryEntries $batchDictionaryEntries batchDictionaryEntries (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function batchDictionaryEntries($dictionaryName, $batchDictionaryEntries) + { + // verify the required parameter 'dictionaryName' is set + if ($dictionaryName === null || (is_array($dictionaryName) && count($dictionaryName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $dictionaryName when calling batchDictionaryEntries' + ); + } + // verify the required parameter 'batchDictionaryEntries' is set + if ($batchDictionaryEntries === null || (is_array($batchDictionaryEntries) && count($batchDictionaryEntries) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batchDictionaryEntries when calling batchDictionaryEntries' + ); + } + + $resourcePath = '/1/dictionaries/{dictionaryName}/batch'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($dictionaryName !== null) { + $resourcePath = str_replace( + '{' . 'dictionaryName' . '}', + ObjectSerializer::toPathValue($dictionaryName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($batchDictionaryEntries)) { + $httpBody = $batchDictionaryEntries; + } + + $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 batchRules + * + * Batch Rules. + * + * @param string $indexName The index in which to perform the request. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\Rule[] $rule rule (required) + * @param bool $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * @param bool $clearExistingRules When true, existing Rules are cleared before adding this batch. When false, existing Rules are kept. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function batchRules($indexName, $rule, $forwardToReplicas = null, $clearExistingRules = null) + { + // 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 batchRules' + ); + } + // verify the required parameter 'rule' is set + if ($rule === null || (is_array($rule) && count($rule) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rule when calling batchRules' + ); + } + + $resourcePath = '/1/indexes/{indexName}/rules/batch'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($forwardToReplicas !== null) { + if ('form' === 'form' && is_array($forwardToReplicas)) { + foreach ($forwardToReplicas as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['forwardToReplicas'] = $forwardToReplicas; + } + } + + if ($clearExistingRules !== null) { + if ('form' === 'form' && is_array($clearExistingRules)) { + foreach ($clearExistingRules as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['clearExistingRules'] = $clearExistingRules; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($rule)) { + $httpBody = $rule; + } + + $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 browse + * + * Retrieve all index content. + * + * @param string $indexName The index in which to perform the request. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\BrowseRequest $browseRequest browseRequest (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\BrowseResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function browse($indexName, $browseRequest = null) + { + // 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 browse' + ); + } + + $resourcePath = '/1/indexes/{indexName}/browse'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($browseRequest)) { + $httpBody = $browseRequest; + } + + $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 clearAllSynonyms + * + * Clear all synonyms. + * + * @param string $indexName The index in which to perform the request. (required) + * @param bool $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function clearAllSynonyms($indexName, $forwardToReplicas = null) + { + // 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 clearAllSynonyms' + ); + } + + $resourcePath = '/1/indexes/{indexName}/synonyms/clear'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($forwardToReplicas !== null) { + if ('form' === 'form' && is_array($forwardToReplicas)) { + foreach ($forwardToReplicas as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['forwardToReplicas'] = $forwardToReplicas; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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); + } + /** + * Operation clearObjects + * + * clear all objects from an index. + * + * @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\Search\UpdatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function clearObjects($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 clearObjects' + ); + } + + $resourcePath = '/1/indexes/{indexName}/clear'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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); + } + /** + * Operation clearRules + * + * Clear Rules. + * + * @param string $indexName The index in which to perform the request. (required) + * @param bool $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function clearRules($indexName, $forwardToReplicas = null) + { + // 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 clearRules' + ); + } + + $resourcePath = '/1/indexes/{indexName}/rules/clear'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($forwardToReplicas !== null) { + if ('form' === 'form' && is_array($forwardToReplicas)) { + foreach ($forwardToReplicas as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['forwardToReplicas'] = $forwardToReplicas; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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); + } + /** + * Operation deleteApiKey + * + * Delete an API key. + * + * @param string $key API Key string. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\DeleteApiKeyResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function deleteApiKey($key) + { + // verify the required parameter 'key' is set + if ($key === null || (is_array($key) && count($key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $key when calling deleteApiKey' + ); + } + + $resourcePath = '/1/keys/{key}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($key !== null) { + $resourcePath = str_replace( + '{' . 'key' . '}', + ObjectSerializer::toPathValue($key), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 deleteBy + * + * Delete all records matching the query. + * + * @param string $indexName The index in which to perform the request. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\SearchParams $searchParams searchParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\DeletedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function deleteBy($indexName, $searchParams) + { + // 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 deleteBy' + ); + } + // verify the required parameter 'searchParams' is set + if ($searchParams === null || (is_array($searchParams) && count($searchParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $searchParams when calling deleteBy' + ); + } + + $resourcePath = '/1/indexes/{indexName}/deleteByQuery'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($searchParams)) { + $httpBody = $searchParams; + } + + $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 deleteIndex + * + * Delete index. + * + * @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\Search\DeletedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function deleteIndex($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 deleteIndex' + ); + } + + $resourcePath = '/1/indexes/{indexName}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 deleteObject + * + * Delete object. + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $objectID Unique identifier of an object. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\DeletedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function deleteObject($indexName, $objectID) + { + // 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 deleteObject' + ); + } + // verify the required parameter 'objectID' is set + if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $objectID when calling deleteObject' + ); + } + + $resourcePath = '/1/indexes/{indexName}/{objectID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($objectID !== null) { + $resourcePath = str_replace( + '{' . 'objectID' . '}', + ObjectSerializer::toPathValue($objectID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 deleteRule + * + * Delete a rule. + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $objectID Unique identifier of an object. (required) + * @param bool $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function deleteRule($indexName, $objectID, $forwardToReplicas = null) + { + // 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 deleteRule' + ); + } + // verify the required parameter 'objectID' is set + if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $objectID when calling deleteRule' + ); + } + + $resourcePath = '/1/indexes/{indexName}/rules/{objectID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($forwardToReplicas !== null) { + if ('form' === 'form' && is_array($forwardToReplicas)) { + foreach ($forwardToReplicas as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['forwardToReplicas'] = $forwardToReplicas; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($objectID !== null) { + $resourcePath = str_replace( + '{' . 'objectID' . '}', + ObjectSerializer::toPathValue($objectID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 deleteSource + * + * Remove a single source. + * + * @param string $source The IP range of the source. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\DeleteSourceResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function deleteSource($source) + { + // verify the required parameter 'source' is set + if ($source === null || (is_array($source) && count($source) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $source when calling deleteSource' + ); + } + + $resourcePath = '/1/security/sources/{source}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($source !== null) { + $resourcePath = str_replace( + '{' . 'source' . '}', + ObjectSerializer::toPathValue($source), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 deleteSynonym + * + * Delete synonym. + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $objectID Unique identifier of an object. (required) + * @param bool $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\DeletedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function deleteSynonym($indexName, $objectID, $forwardToReplicas = null) + { + // 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 deleteSynonym' + ); + } + // verify the required parameter 'objectID' is set + if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $objectID when calling deleteSynonym' + ); + } + + $resourcePath = '/1/indexes/{indexName}/synonyms/{objectID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($forwardToReplicas !== null) { + if ('form' === 'form' && is_array($forwardToReplicas)) { + foreach ($forwardToReplicas as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['forwardToReplicas'] = $forwardToReplicas; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($objectID !== null) { + $resourcePath = str_replace( + '{' . 'objectID' . '}', + ObjectSerializer::toPathValue($objectID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getApiKey + * + * Get an API key. + * + * @param string $key API Key string. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\Key|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getApiKey($key) + { + // verify the required parameter 'key' is set + if ($key === null || (is_array($key) && count($key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $key when calling getApiKey' + ); + } + + $resourcePath = '/1/keys/{key}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($key !== null) { + $resourcePath = str_replace( + '{' . 'key' . '}', + ObjectSerializer::toPathValue($key), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getDictionaryLanguages + * + * List dictionaries supported per language. + * + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return array|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getDictionaryLanguages() + { + $resourcePath = '/1/dictionaries/*/languages'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getDictionarySettings + * + * Retrieve dictionaries settings. The API stores languages whose standard entries are disabled. Fetch settings does not return false values. + * + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\GetDictionarySettingsResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getDictionarySettings() + { + $resourcePath = '/1/dictionaries/*/settings'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getLogs + * + * Return the lastest log entries. + * + * @param int $offset First entry to retrieve (zero-based). Log entries are sorted by decreasing date, therefore 0 designates the most recent log entry. (optional, default to 0) + * @param int $length Maximum number of entries to retrieve. The maximum allowed value is 1000. (optional, default to 10) + * @param string $indexName Index for which log entries should be retrieved. When omitted, log entries are retrieved across all indices. (optional, default to 'null') + * @param string $type Type of log entries to retrieve. When omitted, all log entries are retrieved. (optional, default to 'all') + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\GetLogsResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getLogs($offset = 0, $length = 10, $indexName = 'null', $type = 'all') + { + if ($length !== null && $length > 1000) { + throw new \InvalidArgumentException('invalid value for "$length" when calling SearchApi.getLogs, must be smaller than or equal to 1000.'); + } + + $resourcePath = '/1/logs'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($offset !== null) { + if ('form' === 'form' && is_array($offset)) { + foreach ($offset as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['offset'] = $offset; + } + } + + if ($length !== null) { + if ('form' === 'form' && is_array($length)) { + foreach ($length as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['length'] = $length; + } + } + + if ($indexName !== null) { + if ('form' === 'form' && is_array($indexName)) { + foreach ($indexName as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['indexName'] = $indexName; + } + } + + if ($type !== null) { + if ('form' === 'form' && is_array($type)) { + foreach ($type as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['type'] = $type; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getObject + * + * Retrieve one object from the index. + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $objectID Unique identifier of an object. (required) + * @param string[] $attributesToRetrieve List of attributes to retrieve. If not specified, all retrievable attributes are returned. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return array|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getObject($indexName, $objectID, $attributesToRetrieve = null) + { + // 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 getObject' + ); + } + // verify the required parameter 'objectID' is set + if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $objectID when calling getObject' + ); + } + + $resourcePath = '/1/indexes/{indexName}/{objectID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($attributesToRetrieve !== null) { + if ('form' === 'form' && is_array($attributesToRetrieve)) { + foreach ($attributesToRetrieve as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['attributesToRetrieve'] = $attributesToRetrieve; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($objectID !== null) { + $resourcePath = str_replace( + '{' . 'objectID' . '}', + ObjectSerializer::toPathValue($objectID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getObjects + * + * Retrieve one or more objects. + * + * @param \Algolia\AlgoliaSearch\Model\Search\GetObjectsParams $getObjectsParams getObjectsParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\GetObjectsResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getObjects($getObjectsParams) + { + // verify the required parameter 'getObjectsParams' is set + if ($getObjectsParams === null || (is_array($getObjectsParams) && count($getObjectsParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $getObjectsParams when calling getObjects' + ); + } + + $resourcePath = '/1/indexes/*/objects'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($getObjectsParams)) { + $httpBody = $getObjectsParams; + } + + $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 getRule + * + * Get a rule. + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $objectID Unique identifier of an object. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\Rule|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getRule($indexName, $objectID) + { + // 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 getRule' + ); + } + // verify the required parameter 'objectID' is set + if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $objectID when calling getRule' + ); + } + + $resourcePath = '/1/indexes/{indexName}/rules/{objectID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($objectID !== null) { + $resourcePath = str_replace( + '{' . 'objectID' . '}', + ObjectSerializer::toPathValue($objectID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getSettings + * + * Retrieve settings of a given indexName. + * + * @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\Search\IndexSettings|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getSettings($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 getSettings' + ); + } + + $resourcePath = '/1/indexes/{indexName}/settings'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getSources + * + * List all allowed sources. + * + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\Source[]|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getSources() + { + $resourcePath = '/1/security/sources'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getSynonym + * + * Get synonym. + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $objectID Unique identifier of an object. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\SynonymHit|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getSynonym($indexName, $objectID) + { + // 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 getSynonym' + ); + } + // verify the required parameter 'objectID' is set + if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $objectID when calling getSynonym' + ); + } + + $resourcePath = '/1/indexes/{indexName}/synonyms/{objectID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($objectID !== null) { + $resourcePath = str_replace( + '{' . 'objectID' . '}', + ObjectSerializer::toPathValue($objectID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getTask + * + * Check the current status of a given task. + * + * @param string $indexName The index in which to perform the request. (required) + * @param int $taskID Unique identifier of an task. Numeric value (up to 64bits) (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\GetTaskResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getTask($indexName, $taskID) + { + // 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 getTask' + ); + } + // verify the required parameter 'taskID' is set + if ($taskID === null || (is_array($taskID) && count($taskID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $taskID when calling getTask' + ); + } + + $resourcePath = '/1/indexes/{indexName}/task/{taskID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($taskID !== null) { + $resourcePath = str_replace( + '{' . 'taskID' . '}', + ObjectSerializer::toPathValue($taskID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getTopUserIds + * + * Get top userID + * + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\GetTopUserIdsResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getTopUserIds() + { + $resourcePath = '/1/clusters/mapping/top'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 getUserId + * + * Get userID + * + * @param string $userID userID to assign. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UserId|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function getUserId($userID) + { + // verify the required parameter 'userID' is set + if ($userID === null || (is_array($userID) && count($userID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $userID when calling getUserId' + ); + } + if (!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $userID)) { + throw new \InvalidArgumentException('invalid value for "userID" when calling SearchApi.getUserId, must conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/.'); + } + + $resourcePath = '/1/clusters/mapping/{userID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($userID !== null) { + $resourcePath = str_replace( + '{' . 'userID' . '}', + ObjectSerializer::toPathValue($userID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 hasPendingMappings + * + * Has pending mappings + * + * @param bool $getClusters Whether to get clusters or not. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\CreatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function hasPendingMappings($getClusters = null) + { + $resourcePath = '/1/clusters/mapping/pending'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($getClusters !== null) { + if ('form' === 'form' && is_array($getClusters)) { + foreach ($getClusters as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['getClusters'] = $getClusters; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 listApiKeys + * + * Get the full list of API Keys. + * + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\ListApiKeysResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function listApiKeys() + { + $resourcePath = '/1/keys'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 listClusters + * + * List clusters + * + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\ListClustersResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function listClusters() + { + $resourcePath = '/1/clusters'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 listIndices + * + * List existing indexes. + * + * @param int $page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\ListIndicesResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function listIndices($page = null) + { + $resourcePath = '/1/indexes'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($page !== null) { + if ('form' === 'form' && is_array($page)) { + foreach ($page as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['page'] = $page; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 listUserIds + * + * List userIDs + * + * @param int $page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional) + * @param int $hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\ListUserIdsResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function listUserIds($page = null, $hitsPerPage = 100) + { + $resourcePath = '/1/clusters/mapping'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($page !== null) { + if ('form' === 'form' && is_array($page)) { + foreach ($page as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['page'] = $page; + } + } + + if ($hitsPerPage !== null) { + if ('form' === 'form' && is_array($hitsPerPage)) { + foreach ($hitsPerPage as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['hitsPerPage'] = $hitsPerPage; + } + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 multipleBatch + * + * Perform multiple write operations. + * + * @param \Algolia\AlgoliaSearch\Model\Search\BatchParams $batchParams batchParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\MultipleBatchResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function multipleBatch($batchParams) + { + // verify the required parameter 'batchParams' is set + if ($batchParams === null || (is_array($batchParams) && count($batchParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $batchParams when calling multipleBatch' + ); + } + + $resourcePath = '/1/indexes/*/batch'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($batchParams)) { + $httpBody = $batchParams; + } + + $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 multipleQueries + * + * Get search results for the given requests. + * + * @param \Algolia\AlgoliaSearch\Model\Search\MultipleQueriesParams $multipleQueriesParams multipleQueriesParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\MultipleQueriesResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function multipleQueries($multipleQueriesParams) + { + // verify the required parameter 'multipleQueriesParams' is set + if ($multipleQueriesParams === null || (is_array($multipleQueriesParams) && count($multipleQueriesParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $multipleQueriesParams when calling multipleQueries' + ); + } + + $resourcePath = '/1/indexes/*/queries'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($multipleQueriesParams)) { + $httpBody = $multipleQueriesParams; + } + + $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 operationIndex + * + * Copy/move index. + * + * @param string $indexName The index in which to perform the request. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\OperationIndexParams $operationIndexParams operationIndexParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function operationIndex($indexName, $operationIndexParams) + { + // 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 operationIndex' + ); + } + // verify the required parameter 'operationIndexParams' is set + if ($operationIndexParams === null || (is_array($operationIndexParams) && count($operationIndexParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $operationIndexParams when calling operationIndex' + ); + } + + $resourcePath = '/1/indexes/{indexName}/operation'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($operationIndexParams)) { + $httpBody = $operationIndexParams; + } + + $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 partialUpdateObject + * + * Partially update an object. + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $objectID Unique identifier of an object. (required) + * @param array[] $oneOfStringBuiltInOperation List of attributes to update. (required) + * @param bool $createIfNotExists Creates the record if it does not exist yet. (optional, default to true) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtWithObjectIdResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function partialUpdateObject($indexName, $objectID, $oneOfStringBuiltInOperation, $createIfNotExists = true) + { + // 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 partialUpdateObject' + ); + } + // verify the required parameter 'objectID' is set + if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $objectID when calling partialUpdateObject' + ); + } + // verify the required parameter 'oneOfStringBuiltInOperation' is set + if ($oneOfStringBuiltInOperation === null || (is_array($oneOfStringBuiltInOperation) && count($oneOfStringBuiltInOperation) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $oneOfStringBuiltInOperation when calling partialUpdateObject' + ); + } + + $resourcePath = '/1/indexes/{indexName}/{objectID}/partial'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($createIfNotExists !== null) { + if ('form' === 'form' && is_array($createIfNotExists)) { + foreach ($createIfNotExists as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['createIfNotExists'] = $createIfNotExists; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($objectID !== null) { + $resourcePath = str_replace( + '{' . 'objectID' . '}', + ObjectSerializer::toPathValue($objectID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($oneOfStringBuiltInOperation)) { + $httpBody = $oneOfStringBuiltInOperation; + } + + $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 removeUserId + * + * Remove userID + * + * @param string $userID userID to assign. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\RemoveUserIdResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function removeUserId($userID) + { + // verify the required parameter 'userID' is set + if ($userID === null || (is_array($userID) && count($userID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $userID when calling removeUserId' + ); + } + if (!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $userID)) { + throw new \InvalidArgumentException('invalid value for "userID" when calling SearchApi.removeUserId, must conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/.'); + } + + $resourcePath = '/1/clusters/mapping/{userID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($userID !== null) { + $resourcePath = str_replace( + '{' . 'userID' . '}', + ObjectSerializer::toPathValue($userID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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 replaceSources + * + * Replace all allowed sources. + * + * @param \Algolia\AlgoliaSearch\Model\Search\Source[] $source The sources to allow. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\ReplaceSourceResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function replaceSources($source) + { + // verify the required parameter 'source' is set + if ($source === null || (is_array($source) && count($source) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $source when calling replaceSources' + ); + } + + $resourcePath = '/1/security/sources'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($source)) { + $httpBody = $source; + } + + $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); + } + /** + * Operation restoreApiKey + * + * Restore an API key. + * + * @param string $key API Key string. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\AddApiKeyResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function restoreApiKey($key) + { + // verify the required parameter 'key' is set + if ($key === null || (is_array($key) && count($key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $key when calling restoreApiKey' + ); + } + + $resourcePath = '/1/keys/{key}/restore'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($key !== null) { + $resourcePath = str_replace( + '{' . 'key' . '}', + ObjectSerializer::toPathValue($key), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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); + } + /** + * Operation saveObject + * + * Add an object to the index. + * + * @param string $indexName The index in which to perform the request. (required) + * @param object $body The Algolia record. (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\SaveObjectResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function saveObject($indexName, $body) + { + // 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 saveObject' + ); + } + // verify the required parameter 'body' is set + if ($body === null || (is_array($body) && count($body) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $body when calling saveObject' + ); + } + + $resourcePath = '/1/indexes/{indexName}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($body)) { + $httpBody = $body; + } + + $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 saveRule + * + * Save/Update a rule. + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $objectID Unique identifier of an object. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\Rule $rule rule (required) + * @param bool $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedRuleResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function saveRule($indexName, $objectID, $rule, $forwardToReplicas = null) + { + // 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 saveRule' + ); + } + // verify the required parameter 'objectID' is set + if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $objectID when calling saveRule' + ); + } + // verify the required parameter 'rule' is set + if ($rule === null || (is_array($rule) && count($rule) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $rule when calling saveRule' + ); + } + + $resourcePath = '/1/indexes/{indexName}/rules/{objectID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($forwardToReplicas !== null) { + if ('form' === 'form' && is_array($forwardToReplicas)) { + foreach ($forwardToReplicas as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['forwardToReplicas'] = $forwardToReplicas; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($objectID !== null) { + $resourcePath = str_replace( + '{' . 'objectID' . '}', + ObjectSerializer::toPathValue($objectID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($rule)) { + $httpBody = $rule; + } + + $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); + } + /** + * Operation saveSynonym + * + * Save synonym. + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $objectID Unique identifier of an object. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\SynonymHit $synonymHit synonymHit (required) + * @param bool $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\SaveSynonymResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function saveSynonym($indexName, $objectID, $synonymHit, $forwardToReplicas = null) + { + // 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 saveSynonym' + ); + } + // verify the required parameter 'objectID' is set + if ($objectID === null || (is_array($objectID) && count($objectID) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $objectID when calling saveSynonym' + ); + } + // verify the required parameter 'synonymHit' is set + if ($synonymHit === null || (is_array($synonymHit) && count($synonymHit) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $synonymHit when calling saveSynonym' + ); + } + + $resourcePath = '/1/indexes/{indexName}/synonyms/{objectID}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($forwardToReplicas !== null) { + if ('form' === 'form' && is_array($forwardToReplicas)) { + foreach ($forwardToReplicas as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['forwardToReplicas'] = $forwardToReplicas; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($objectID !== null) { + $resourcePath = str_replace( + '{' . 'objectID' . '}', + ObjectSerializer::toPathValue($objectID), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($synonymHit)) { + $httpBody = $synonymHit; + } + + $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); + } + /** + * Operation saveSynonyms + * + * Save a batch of synonyms. + * + * @param string $indexName The index in which to perform the request. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\SynonymHit[] $synonymHit synonymHit (required) + * @param bool $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * @param bool $replaceExistingSynonyms Replace all synonyms of the index with the ones sent with this request. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function saveSynonyms($indexName, $synonymHit, $forwardToReplicas = null, $replaceExistingSynonyms = null) + { + // 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 saveSynonyms' + ); + } + // verify the required parameter 'synonymHit' is set + if ($synonymHit === null || (is_array($synonymHit) && count($synonymHit) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $synonymHit when calling saveSynonyms' + ); + } + + $resourcePath = '/1/indexes/{indexName}/synonyms/batch'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($forwardToReplicas !== null) { + if ('form' === 'form' && is_array($forwardToReplicas)) { + foreach ($forwardToReplicas as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['forwardToReplicas'] = $forwardToReplicas; + } + } + + if ($replaceExistingSynonyms !== null) { + if ('form' === 'form' && is_array($replaceExistingSynonyms)) { + foreach ($replaceExistingSynonyms as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['replaceExistingSynonyms'] = $replaceExistingSynonyms; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($synonymHit)) { + $httpBody = $synonymHit; + } + + $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 search + * + * Get search results. + * + * @param string $indexName The index in which to perform the request. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\SearchParams $searchParams searchParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\SearchResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function search($indexName, $searchParams) + { + // 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 search' + ); + } + // verify the required parameter 'searchParams' is set + if ($searchParams === null || (is_array($searchParams) && count($searchParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $searchParams when calling search' + ); + } + + $resourcePath = '/1/indexes/{indexName}/query'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($searchParams)) { + $httpBody = $searchParams; + } + + $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 searchDictionaryEntries + * + * Search the dictionary entries. + * + * @param string $dictionaryName The dictionary to search in. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\SearchDictionaryEntries $searchDictionaryEntries searchDictionaryEntries (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function searchDictionaryEntries($dictionaryName, $searchDictionaryEntries) + { + // verify the required parameter 'dictionaryName' is set + if ($dictionaryName === null || (is_array($dictionaryName) && count($dictionaryName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $dictionaryName when calling searchDictionaryEntries' + ); + } + // verify the required parameter 'searchDictionaryEntries' is set + if ($searchDictionaryEntries === null || (is_array($searchDictionaryEntries) && count($searchDictionaryEntries) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $searchDictionaryEntries when calling searchDictionaryEntries' + ); + } + + $resourcePath = '/1/dictionaries/{dictionaryName}/search'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($dictionaryName !== null) { + $resourcePath = str_replace( + '{' . 'dictionaryName' . '}', + ObjectSerializer::toPathValue($dictionaryName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($searchDictionaryEntries)) { + $httpBody = $searchDictionaryEntries; + } + + $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 searchForFacetValues + * + * Search for values of a given facet + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $facetName The facet name. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\SearchForFacetValuesRequest $searchForFacetValuesRequest searchForFacetValuesRequest (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\SearchForFacetValuesResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function searchForFacetValues($indexName, $facetName, $searchForFacetValuesRequest = null) + { + // 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 searchForFacetValues' + ); + } + // verify the required parameter 'facetName' is set + if ($facetName === null || (is_array($facetName) && count($facetName) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $facetName when calling searchForFacetValues' + ); + } + + $resourcePath = '/1/indexes/{indexName}/facets/{facetName}/query'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + // path params + if ($facetName !== null) { + $resourcePath = str_replace( + '{' . 'facetName' . '}', + ObjectSerializer::toPathValue($facetName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($searchForFacetValuesRequest)) { + $httpBody = $searchForFacetValuesRequest; + } + + $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 searchRules + * + * Search for rules. + * + * @param string $indexName The index in which to perform the request. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\SearchRulesParams $searchRulesParams searchRulesParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\SearchRulesResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function searchRules($indexName, $searchRulesParams) + { + // 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 searchRules' + ); + } + // verify the required parameter 'searchRulesParams' is set + if ($searchRulesParams === null || (is_array($searchRulesParams) && count($searchRulesParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $searchRulesParams when calling searchRules' + ); + } + + $resourcePath = '/1/indexes/{indexName}/rules/search'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($searchRulesParams)) { + $httpBody = $searchRulesParams; + } + + $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 searchSynonyms + * + * Get all synonyms that match a query. + * + * @param string $indexName The index in which to perform the request. (required) + * @param string $query Search for specific synonyms matching this string. (optional, default to '') + * @param \Algolia\AlgoliaSearch\Model\Search\SynonymType $type Only search for specific types of synonyms. (optional) + * @param int $page Requested page (zero-based). When specified, will retrieve a specific page; the page size is implicitly set to 100. When null, will retrieve all indices (no pagination). (optional, default to 0) + * @param int $hitsPerPage Maximum number of objects to retrieve. (optional, default to 100) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\SearchSynonymsResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function searchSynonyms($indexName, $query = '', $type = null, $page = 0, $hitsPerPage = 100) + { + // 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 searchSynonyms' + ); + } + + $resourcePath = '/1/indexes/{indexName}/synonyms/search'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($query !== null) { + if ('form' === 'form' && is_array($query)) { + foreach ($query as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['query'] = $query; + } + } + + if ($type !== null) { + if ('form' === 'form' && is_array($type)) { + foreach ($type as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['type'] = $type; + } + } + + if ($page !== null) { + if ('form' === 'form' && is_array($page)) { + foreach ($page as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['page'] = $page; + } + } + + if ($hitsPerPage !== null) { + if ('form' === 'form' && is_array($hitsPerPage)) { + foreach ($hitsPerPage as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['hitsPerPage'] = $hitsPerPage; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = '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); + } + /** + * Operation searchUserIds + * + * Search userID + * + * @param \Algolia\AlgoliaSearch\Model\Search\SearchUserIdsParams $searchUserIdsParams searchUserIdsParams (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\SearchUserIdsResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function searchUserIds($searchUserIdsParams) + { + // verify the required parameter 'searchUserIdsParams' is set + if ($searchUserIdsParams === null || (is_array($searchUserIdsParams) && count($searchUserIdsParams) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $searchUserIdsParams when calling searchUserIds' + ); + } + + $resourcePath = '/1/clusters/mapping/search'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($searchUserIdsParams)) { + $httpBody = $searchUserIdsParams; + } + + $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 setDictionarySettings + * + * Set dictionary settings. + * + * @param \Algolia\AlgoliaSearch\Model\Search\DictionarySettingsRequest $dictionarySettingsRequest dictionarySettingsRequest (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function setDictionarySettings($dictionarySettingsRequest) + { + // verify the required parameter 'dictionarySettingsRequest' is set + if ($dictionarySettingsRequest === null || (is_array($dictionarySettingsRequest) && count($dictionarySettingsRequest) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $dictionarySettingsRequest when calling setDictionarySettings' + ); + } + + $resourcePath = '/1/dictionaries/*/settings'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($dictionarySettingsRequest)) { + $httpBody = $dictionarySettingsRequest; + } + + $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); + } + /** + * Operation setSettings + * + * Update settings of a given indexName. + * + * @param string $indexName The index in which to perform the request. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\IndexSettings $indexSettings indexSettings (required) + * @param bool $forwardToReplicas When true, changes are also propagated to replicas of the given indexName. (optional) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdatedAtResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function setSettings($indexName, $indexSettings, $forwardToReplicas = null) + { + // 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 setSettings' + ); + } + // verify the required parameter 'indexSettings' is set + if ($indexSettings === null || (is_array($indexSettings) && count($indexSettings) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $indexSettings when calling setSettings' + ); + } + + $resourcePath = '/1/indexes/{indexName}/settings'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + + if ($forwardToReplicas !== null) { + if ('form' === 'form' && is_array($forwardToReplicas)) { + foreach ($forwardToReplicas as $key => $value) { + $queryParams[$key] = $value; + } + } else { + $queryParams['forwardToReplicas'] = $forwardToReplicas; + } + } + // path params + if ($indexName !== null) { + $resourcePath = str_replace( + '{' . 'indexName' . '}', + ObjectSerializer::toPathValue($indexName), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($indexSettings)) { + $httpBody = $indexSettings; + } + + $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); + } + /** + * Operation updateApiKey + * + * Update an API key. + * + * @param string $key API Key string. (required) + * @param \Algolia\AlgoliaSearch\Model\Search\ApiKey $apiKey apiKey (required) + * + * @throws \Algolia\AlgoliaSearch\ApiException on non-2xx response + * @throws \InvalidArgumentException + * + * @return \Algolia\AlgoliaSearch\Model\Search\UpdateApiKeyResponse|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase|\Algolia\AlgoliaSearch\Model\Search\ErrorBase + */ + public function updateApiKey($key, $apiKey) + { + // verify the required parameter 'key' is set + if ($key === null || (is_array($key) && count($key) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $key when calling updateApiKey' + ); + } + // verify the required parameter 'apiKey' is set + if ($apiKey === null || (is_array($apiKey) && count($apiKey) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $apiKey when calling updateApiKey' + ); + } + + $resourcePath = '/1/keys/{key}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + // path params + if ($key !== null) { + $resourcePath = str_replace( + '{' . 'key' . '}', + ObjectSerializer::toPathValue($key), + $resourcePath + ); + } + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + if (isset($apiKey)) { + $httpBody = $apiKey; + } + + $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/ApiException.php b/clients/algoliasearch-client-php/lib/ApiException.php new file mode 100644 index 0000000000..d484a88eb5 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/ApiException.php @@ -0,0 +1,92 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/clients/algoliasearch-client-php/lib/Cache/FileCacheDriver.php b/clients/algoliasearch-client-php/lib/Cache/FileCacheDriver.php new file mode 100644 index 0000000000..86bcba64c9 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Cache/FileCacheDriver.php @@ -0,0 +1,117 @@ +directory = rtrim($directory, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR; + } + + /** + * @inheritdoc + */ + public function get($key, $default = null) + { + if (!$this->has($key)) { + return $default; + } + + return file_get_contents($this->getFilenameFromKey($key)); + } + + /** + * @inheritdoc + */ + public function set($key, $value, $ttl = null) + { + return file_put_contents($this->getFilenameFromKey($key), $value); + } + + /** + * @inheritdoc + */ + public function delete($key) + { + return @unlink($this->getFilenameFromKey($key)); + } + + /** + * @inheritdoc + */ + public function clear() + { + $result = true; + foreach (glob($this->directory.self::PREFIX.'*') as $file) { + $result &= @unlink($file); + } + + return $result; + } + + /** + * @inheritdoc + */ + public function getMultiple($keys, $default = null) + { + $result = []; + foreach ($keys as $key) { + $result[$key] = $this->get($key, $default); + } + + return $result; + } + + /** + * @inheritdoc + */ + public function setMultiple($values, $ttl = null) + { + $result = true; + foreach ($values as $key => $value) { + $result &= $this->set($key, $value, $ttl); + } + + return $result; + } + + /** + * @inheritdoc + */ + public function deleteMultiple($keys) + { + $result = true; + foreach ($keys as $key) { + $result &= $this->delete($key); + } + + return $result; + } + + /** + * @inheritdoc + */ + public function has($key) + { + return file_exists($this->getFilenameFromKey($key)); + } + + /** + * @param string $key + * + * @return string + */ + private function getFilenameFromKey($key) + { + $name = $this->directory.self::PREFIX.$key; + + return str_replace('\\', '-', $name); + } +} diff --git a/clients/algoliasearch-client-php/lib/Cache/NullCacheDriver.php b/clients/algoliasearch-client-php/lib/Cache/NullCacheDriver.php new file mode 100644 index 0000000000..ffb8dc6a5a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Cache/NullCacheDriver.php @@ -0,0 +1,78 @@ + 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 new file mode 100644 index 0000000000..3ff4f0d094 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Configuration/Configuration.php @@ -0,0 +1,274 @@ +setAlgoliaApiKey($config['apiKey']); + $this->setApiKey('X-Algolia-API-Key', $config['apiKey']); + } + + if (isset($config['appId'])) { + $this->setAppId($config['appId']); + $this->setApiKey('X-Algolia-Application-Id', $config['appId']); + } + + $config += $this->getDefaultConfiguration(); + $this->config = $config; + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + 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/Exceptions/AlgoliaException.php b/clients/algoliasearch-client-php/lib/Exceptions/AlgoliaException.php new file mode 100644 index 0000000000..0334990688 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Exceptions/AlgoliaException.php @@ -0,0 +1,7 @@ +request = $request; + + return $this; + } + + public function getRequest() + { + return $this->request; + } +} diff --git a/clients/algoliasearch-client-php/lib/Exceptions/RetriableException.php b/clients/algoliasearch-client-php/lib/Exceptions/RetriableException.php new file mode 100644 index 0000000000..71ff5d4b09 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Exceptions/RetriableException.php @@ -0,0 +1,7 @@ +client = $client ?: static::buildClient(); + } + + public function sendRequest(RequestInterface $request, $timeout, $connectTimeout) + { + try { + $response = $this->client->send($request, [ + 'timeout' => $timeout, + 'connect_timeout' => $connectTimeout, + ]); + } catch (RequestException $e) { + if ($e->hasResponse()) { + return $e->getResponse(); + } + + return new Response( + 0, + [], + null, + '1.1', + $e->getMessage() + ); + } catch (ConnectException $e) { + return new Response( + 0, + [], + null, + '1.1', + $e->getMessage() + ); + } + + return $response; + } + + private static function buildClient(array $config = []) + { + $handlerStack = new HandlerStack(\GuzzleHttp\choose_handler()); + $handlerStack->push(Middleware::prepareBody(), 'prepare_body'); + $config = array_merge(['handler' => $handlerStack], $config); + + return new GuzzleClient($config); + } +} diff --git a/clients/algoliasearch-client-php/lib/Http/HttpClientInterface.php b/clients/algoliasearch-client-php/lib/Http/HttpClientInterface.php new file mode 100644 index 0000000000..1e4985365d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Http/HttpClientInterface.php @@ -0,0 +1,24 @@ +hwm = $hwm; + } + + public function __toString() + { + return $this->getContents(); + } + + public function getContents() + { + $buffer = $this->buffer; + $this->buffer = ''; + + return $buffer; + } + + public function close() + { + $this->buffer = ''; + } + + public function detach() + { + $this->close(); + } + + public function getSize() + { + return mb_strlen($this->buffer); + } + + public function isReadable() + { + return true; + } + + public function isWritable() + { + return true; + } + + public function isSeekable() + { + return false; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + throw new \RuntimeException('Cannot seek a BufferStream'); + } + + public function eof() + { + return 0 === mb_strlen($this->buffer); + } + + public function tell() + { + throw new \RuntimeException('Cannot determine the position of a BufferStream'); + } + + /** + * Reads data from the buffer. + */ + public function read($length) + { + $currentLength = mb_strlen($this->buffer); + + if ($length >= $currentLength) { + // No need to slice the buffer because we don't have enough data. + $result = $this->buffer; + $this->buffer = ''; + } else { + // Slice up the result to provide a subset of the buffer. + $result = mb_substr($this->buffer, 0, $length); + $this->buffer = mb_substr($this->buffer, $length); + } + + return $result; + } + + /** + * Writes data to the buffer. + */ + public function write($string) + { + $this->buffer .= $string; + + // TODO: What should happen here? + if (mb_strlen($this->buffer) >= $this->hwm) { + return false; + } + + return mb_strlen($string); + } + + public function getMetadata($key = null) + { + if ('hwm' === $key) { + return $this->hwm; + } + + return $key ? null : []; + } +} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php b/clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php new file mode 100644 index 0000000000..86786edb6f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Http/Psr7/PumpStream.php @@ -0,0 +1,169 @@ +source = $source; + $this->size = isset($options['size']) ? $options['size'] : null; + $this->metadata = isset($options['metadata']) ? $options['metadata'] : []; + $this->buffer = new BufferStream(); + } + + public function __toString() + { + try { + return copy_to_string($this); + } catch (\Exception $e) { + return ''; + } + } + + public function close() + { + $this->detach(); + } + + public function detach() + { + $this->tellPos = false; + $this->source = null; + } + + public function getSize() + { + return $this->size; + } + + public function tell() + { + return $this->tellPos; + } + + public function eof() + { + return !$this->source; + } + + public function isSeekable() + { + return false; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + throw new \RuntimeException('Cannot seek a PumpStream'); + } + + public function isWritable() + { + return false; + } + + public function write($string) + { + throw new \RuntimeException('Cannot write to a PumpStream'); + } + + public function isReadable() + { + return true; + } + + public function read($length) + { + $data = $this->buffer->read($length); + $readLen = mb_strlen($data); + $this->tellPos += $readLen; + $remaining = $length - $readLen; + + if ($remaining) { + $this->pump($remaining); + $data .= $this->buffer->read($remaining); + $this->tellPos += mb_strlen($data) - $readLen; + } + + return $data; + } + + public function getContents() + { + $result = ''; + while (!$this->eof()) { + $result .= $this->read(1000000); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!$key) { + return $this->metadata; + } + + return isset($this->metadata[$key]) ? $this->metadata[$key] : null; + } + + private function pump($length) + { + if ($this->source) { + do { + $data = call_user_func($this->source, $length); + if (false === $data || null === $data) { + $this->source = null; + + return; + } + $this->buffer->write($data); + $length -= mb_strlen($data); + } while ($length > 0); + } + } +} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/Request.php b/clients/algoliasearch-client-php/lib/Http/Psr7/Request.php new file mode 100644 index 0000000000..43a6ba024c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Http/Psr7/Request.php @@ -0,0 +1,308 @@ + array of values */ + private $headers = []; + + /** @var array Map of lowercase header name => original name at registration */ + private $headerNames = []; + + /** @var string */ + private $protocol = '1.1'; + + /** @var StreamInterface */ + private $stream; + + /** + * @param string $method HTTP method + * @param string|UriInterface $uri URI + * @param array $headers Request headers + * @param string|resource|StreamInterface|null $body Request body + * @param string $version Protocol version + */ + public function __construct( + $method, + $uri, + array $headers = [], + $body = null, + $version = '1.1' + ) { + if (!($uri instanceof UriInterface)) { + $uri = new Uri($uri); + } + + $this->method = mb_strtoupper($method); + $this->uri = $uri; + $this->setHeaders($headers); + $this->protocol = $version; + + if (!$this->hasHeader('Host')) { + $this->updateHostFromUri(); + } + + if ('' !== $body && null !== $body) { + $this->stream = stream_for($body); + } + } + + public function getRequestTarget() + { + if (null !== $this->requestTarget) { + return $this->requestTarget; + } + + $target = $this->uri->getPath(); + if ('' === $target) { + $target = '/'; + } + if ('' !== $this->uri->getQuery()) { + $target .= '?'.$this->uri->getQuery(); + } + + return $target; + } + + public function withRequestTarget($requestTarget) + { + if (preg_match('#\s#', $requestTarget)) { + throw new InvalidArgumentException('Invalid request target provided; cannot contain whitespace'); + } + + $new = clone $this; + $new->requestTarget = $requestTarget; + + return $new; + } + + public function getMethod() + { + return $this->method; + } + + public function withMethod($method) + { + $new = clone $this; + $new->method = mb_strtoupper($method); + + return $new; + } + + public function getUri() + { + return $this->uri; + } + + public function withUri(UriInterface $uri, $preserveHost = false) + { + if ($uri === $this->uri) { + return $this; + } + + $new = clone $this; + $new->uri = $uri; + + if (!$preserveHost) { + $new->updateHostFromUri(); + } + + return $new; + } + + private function updateHostFromUri() + { + $host = $this->uri->getHost(); + + if ('' === $host) { + return; + } + + if (null !== ($port = $this->uri->getPort())) { + $host .= ':'.$port; + } + + if (isset($this->headerNames['host'])) { + $header = $this->headerNames['host']; + } else { + $header = 'Host'; + $this->headerNames['host'] = 'Host'; + } + // Ensure Host is the first header. + // See: http://tools.ietf.org/html/rfc7230#section-5.4 + $this->headers = [$header => [$host]] + $this->headers; + } + + public function getProtocolVersion() + { + return $this->protocol; + } + + public function withProtocolVersion($version) + { + if ($this->protocol === $version) { + return $this; + } + $new = clone $this; + $new->protocol = $version; + + return $new; + } + + public function getHeaders() + { + return $this->headers; + } + + public function hasHeader($header) + { + return isset($this->headerNames[mb_strtolower($header)]); + } + + public function getHeader($header) + { + $header = mb_strtolower($header); + if (!isset($this->headerNames[$header])) { + return []; + } + $header = $this->headerNames[$header]; + + return $this->headers[$header]; + } + + public function getHeaderLine($header) + { + return implode(', ', $this->getHeader($header)); + } + + public function withHeader($header, $value) + { + if (!is_array($value)) { + $value = [$value]; + } + $value = $this->trimHeaderValues($value); + $normalized = mb_strtolower($header); + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + unset($new->headers[$new->headerNames[$normalized]]); + } + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + + return $new; + } + + public function withAddedHeader($header, $value) + { + if (!is_array($value)) { + $value = [$value]; + } + $value = $this->trimHeaderValues($value); + $normalized = mb_strtolower($header); + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $new->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + } + + return $new; + } + + public function withoutHeader($header) + { + $normalized = mb_strtolower($header); + if (!isset($this->headerNames[$normalized])) { + return $this; + } + $header = $this->headerNames[$normalized]; + $new = clone $this; + unset($new->headers[$header], $new->headerNames[$normalized]); + + return $new; + } + + public function getBody() + { + if (!$this->stream) { + $this->stream = stream_for(''); + } + + return $this->stream; + } + + public function withBody(StreamInterface $body) + { + if ($body === $this->stream) { + return $this; + } + $new = clone $this; + $new->stream = $body; + + return $new; + } + + private function setHeaders(array $headers) + { + $this->headerNames = $this->headers = []; + foreach ($headers as $header => $value) { + if (!is_array($value)) { + $value = [$value]; + } + $value = $this->trimHeaderValues($value); + $normalized = mb_strtolower($header); + if (isset($this->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $this->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $this->headerNames[$normalized] = $header; + $this->headers[$header] = $value; + } + } + } + + /** + * Trims whitespace from the header values. + * + * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. + * + * header-field = field-name ":" OWS field-value OWS + * OWS = *( SP / HTAB ) + * + * @param string[] $values Header values + * + * @return string[] Trimmed header values + * + * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 + */ + private function trimHeaderValues(array $values) + { + return array_map(function ($value) { + return trim($value, " \t"); + }, $values); + } +} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/Response.php b/clients/algoliasearch-client-php/lib/Http/Psr7/Response.php new file mode 100644 index 0000000000..ee338a823b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Http/Psr7/Response.php @@ -0,0 +1,314 @@ + array of values */ + private $headers = []; + + /** @var array Map of lowercase header name => original name at registration */ + private $headerNames = []; + + /** @var string */ + private $protocol = '1.1'; + + /** @var StreamInterface */ + private $stream; + + /** @var array Map of standard HTTP status code/reason phrases */ + private static $phrases = [ + 100 => 'Continue', + 101 => 'Switching Protocols', + 102 => 'Processing', + 200 => 'OK', + 201 => 'Created', + 202 => 'Accepted', + 203 => 'Non-Authoritative Information', + 204 => 'No Content', + 205 => 'Reset Content', + 206 => 'Partial Content', + 207 => 'Multi-status', + 208 => 'Already Reported', + 300 => 'Multiple Choices', + 301 => 'Moved Permanently', + 302 => 'Found', + 303 => 'See Other', + 304 => 'Not Modified', + 305 => 'Use Proxy', + 306 => 'Switch Proxy', + 307 => 'Temporary Redirect', + 400 => 'Bad Request', + 401 => 'Unauthorized', + 402 => 'Payment Required', + 403 => 'Forbidden', + 404 => 'Not Found', + 405 => 'Method Not Allowed', + 406 => 'Not Acceptable', + 407 => 'Proxy Authentication Required', + 408 => 'Request Time-out', + 409 => 'Conflict', + 410 => 'Gone', + 411 => 'Length Required', + 412 => 'Precondition Failed', + 413 => 'Request Entity Too Large', + 414 => 'Request-URI Too Large', + 415 => 'Unsupported Media Type', + 416 => 'Requested range not satisfiable', + 417 => 'Expectation Failed', + 418 => 'I\'m a teapot', + 422 => 'Unprocessable Entity', + 423 => 'Locked', + 424 => 'Failed Dependency', + 425 => 'Unordered Collection', + 426 => 'Upgrade Required', + 428 => 'Precondition Required', + 429 => 'Too Many Requests', + 431 => 'Request Header Fields Too Large', + 451 => 'Unavailable For Legal Reasons', + 500 => 'Internal Server Error', + 501 => 'Not Implemented', + 502 => 'Bad Gateway', + 503 => 'Service Unavailable', + 504 => 'Gateway Time-out', + 505 => 'HTTP Version not supported', + 506 => 'Variant Also Negotiates', + 507 => 'Insufficient Storage', + 508 => 'Loop Detected', + 511 => 'Network Authentication Required', + ]; + + /** @var string */ + private $reasonPhrase = ''; + + /** @var int */ + private $statusCode = 200; + + /** + * @param int $status Status code + * @param array $headers Response headers + * @param string|resource|StreamInterface|null $body Response body + * @param string $version Protocol version + * @param string|null $reason Reason phrase (when empty a default will be used based on the status code) + */ + public function __construct( + $status = 200, + array $headers = [], + $body = null, + $version = '1.1', + $reason = null + ) { + $this->statusCode = (int) $status; + + if ('' !== $body && null !== $body) { + $this->stream = stream_for($body); + } + + $this->setHeaders($headers); + if ('' === $reason && isset(self::$phrases[$this->statusCode])) { + $this->reasonPhrase = self::$phrases[$this->statusCode]; + } else { + $this->reasonPhrase = (string) $reason; + } + + $this->protocol = $version; + } + + public function getStatusCode() + { + return $this->statusCode; + } + + public function getReasonPhrase() + { + return $this->reasonPhrase; + } + + public function withStatus($code, $reasonPhrase = '') + { + $new = clone $this; + $new->statusCode = (int) $code; + if ('' === $reasonPhrase && isset(self::$phrases[$new->statusCode])) { + $reasonPhrase = self::$phrases[$new->statusCode]; + } + $new->reasonPhrase = $reasonPhrase; + + return $new; + } + + public function getProtocolVersion() + { + return $this->protocol; + } + + public function withProtocolVersion($version) + { + if ($this->protocol === $version) { + return $this; + } + + $new = clone $this; + $new->protocol = $version; + + return $new; + } + + public function getHeaders() + { + return $this->headers; + } + + public function hasHeader($header) + { + return isset($this->headerNames[mb_strtolower($header)]); + } + + public function getHeader($header) + { + $header = mb_strtolower($header); + + if (!isset($this->headerNames[$header])) { + return []; + } + + $header = $this->headerNames[$header]; + + return $this->headers[$header]; + } + + public function getHeaderLine($header) + { + return implode(', ', $this->getHeader($header)); + } + + public function withHeader($header, $value) + { + if (!is_array($value)) { + $value = [$value]; + } + + $value = $this->trimHeaderValues($value); + $normalized = mb_strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + unset($new->headers[$new->headerNames[$normalized]]); + } + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + + return $new; + } + + public function withAddedHeader($header, $value) + { + if (!is_array($value)) { + $value = [$value]; + } + + $value = $this->trimHeaderValues($value); + $normalized = mb_strtolower($header); + + $new = clone $this; + if (isset($new->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $new->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $new->headerNames[$normalized] = $header; + $new->headers[$header] = $value; + } + + return $new; + } + + public function withoutHeader($header) + { + $normalized = mb_strtolower($header); + + if (!isset($this->headerNames[$normalized])) { + return $this; + } + + $header = $this->headerNames[$normalized]; + + $new = clone $this; + unset($new->headers[$header], $new->headerNames[$normalized]); + + return $new; + } + + public function getBody() + { + if (!$this->stream) { + $this->stream = stream_for(''); + } + + return $this->stream; + } + + public function withBody(StreamInterface $body) + { + if ($body === $this->stream) { + return $this; + } + + $new = clone $this; + $new->stream = $body; + + return $new; + } + + private function setHeaders(array $headers) + { + $this->headerNames = $this->headers = []; + foreach ($headers as $header => $value) { + if (!is_array($value)) { + $value = [$value]; + } + + $value = $this->trimHeaderValues($value); + $normalized = mb_strtolower($header); + if (isset($this->headerNames[$normalized])) { + $header = $this->headerNames[$normalized]; + $this->headers[$header] = array_merge($this->headers[$header], $value); + } else { + $this->headerNames[$normalized] = $header; + $this->headers[$header] = $value; + } + } + } + + /** + * Trims whitespace from the header values. + * + * Spaces and tabs ought to be excluded by parsers when extracting the field value from a header field. + * + * header-field = field-name ":" OWS field-value OWS + * OWS = *( SP / HTAB ) + * + * @param string[] $values Header values + * + * @return string[] Trimmed header values + * + * @see https://tools.ietf.org/html/rfc7230#section-3.2.4 + */ + private function trimHeaderValues(array $values) + { + return array_map(function ($value) { + return trim($value, " \t"); + }, $values); + } +} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/Stream.php b/clients/algoliasearch-client-php/lib/Http/Psr7/Stream.php new file mode 100644 index 0000000000..818864e06d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Http/Psr7/Stream.php @@ -0,0 +1,278 @@ + [ + 'r' => true, 'w+' => true, 'r+' => true, 'x+' => true, 'c+' => true, + 'rb' => true, 'w+b' => true, 'r+b' => true, 'x+b' => true, + 'c+b' => true, 'rt' => true, 'w+t' => true, 'r+t' => true, + 'x+t' => true, 'c+t' => true, 'a+' => true, + ], + 'write' => [ + 'w' => true, 'w+' => true, 'rw' => true, 'r+' => true, 'x+' => true, + 'c+' => true, 'wb' => true, 'w+b' => true, 'r+b' => true, + 'x+b' => true, 'c+b' => true, 'w+t' => true, 'r+t' => true, + 'x+t' => true, 'c+t' => true, 'a' => true, 'a+' => true, + ], + ]; + + /** + * This constructor accepts an associative array of options. + * + * - size: (int) If a read stream would otherwise have an indeterminate + * size, but the size is known due to foreknowledge, then you can + * provide that size, in bytes. + * - metadata: (array) Any additional metadata to return when the metadata + * of the stream is accessed. + * + * @param resource $stream stream resource to wrap + * @param array $options associative array of options + * + * @throws \InvalidArgumentException if the stream is not a stream resource + */ + public function __construct($stream, $options = []) + { + if (!is_resource($stream)) { + throw new \InvalidArgumentException('Stream must be a resource'); + } + + if (isset($options['size'])) { + $this->size = $options['size']; + } + + $this->customMetadata = isset($options['metadata']) + ? $options['metadata'] + : []; + + $this->stream = $stream; + $meta = stream_get_meta_data($this->stream); + $this->seekable = $meta['seekable']; + $this->readable = isset(self::$readWriteHash['read'][$meta['mode']]); + $this->writable = isset(self::$readWriteHash['write'][$meta['mode']]); + $this->uri = $this->getMetadata('uri'); + } + + /** + * Closes the stream when the destructed. + */ + public function __destruct() + { + $this->close(); + } + + public function __toString() + { + try { + $this->seek(0); + + return (string) stream_get_contents($this->stream); + } catch (\Exception $e) { + return ''; + } + } + + public function getContents() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $contents = stream_get_contents($this->stream); + + if (false === $contents) { + throw new \RuntimeException('Unable to read stream contents'); + } + + return $contents; + } + + public function close() + { + if (isset($this->stream)) { + if (is_resource($this->stream)) { + fclose($this->stream); + } + $this->detach(); + } + } + + public function detach() + { + if (!isset($this->stream)) { + return null; + } + + $result = $this->stream; + unset($this->stream); + $this->size = $this->uri = null; + $this->readable = $this->writable = $this->seekable = false; + + return $result; + } + + public function getSize() + { + if (null !== $this->size) { + return $this->size; + } + + if (!isset($this->stream)) { + return null; + } + + // Clear the stat cache if the stream has a URI + if ($this->uri) { + clearstatcache(true, $this->uri); + } + + $stats = fstat($this->stream); + if (isset($stats['size'])) { + $this->size = $stats['size']; + + return $this->size; + } + + return null; + } + + public function isReadable() + { + return $this->readable; + } + + public function isWritable() + { + return $this->writable; + } + + public function isSeekable() + { + return $this->seekable; + } + + public function eof() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + return feof($this->stream); + } + + public function tell() + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + + $result = ftell($this->stream); + + if (false === $result) { + throw new \RuntimeException('Unable to determine stream position'); + } + + return $result; + } + + public function rewind() + { + $this->seek(0); + } + + public function seek($offset, $whence = SEEK_SET) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->seekable) { + throw new \RuntimeException('Stream is not seekable'); + } + if (-1 === fseek($this->stream, $offset, $whence)) { + throw new \RuntimeException('Unable to seek to stream position '.$offset.' with whence '.var_export($whence, true)); + } + } + + public function read($length) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->readable) { + throw new \RuntimeException('Cannot read from non-readable stream'); + } + if ($length < 0) { + throw new \RuntimeException('Length parameter cannot be negative'); + } + + if (0 === $length) { + return ''; + } + + $string = fread($this->stream, $length); + if (false === $string) { + throw new \RuntimeException('Unable to read from stream'); + } + + return $string; + } + + public function write($string) + { + if (!isset($this->stream)) { + throw new \RuntimeException('Stream is detached'); + } + if (!$this->writable) { + throw new \RuntimeException('Cannot write to a non-writable stream'); + } + + // We can't know the size after writing anything + $this->size = null; + $result = fwrite($this->stream, $string); + + if (false === $result) { + throw new \RuntimeException('Unable to write to stream'); + } + + return $result; + } + + public function getMetadata($key = null) + { + if (!isset($this->stream)) { + return $key ? null : []; + } elseif (!$key) { + return $this->customMetadata + stream_get_meta_data($this->stream); + } elseif (isset($this->customMetadata[$key])) { + return $this->customMetadata[$key]; + } + + $meta = stream_get_meta_data($this->stream); + + return isset($meta[$key]) ? $meta[$key] : null; + } +} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/Uri.php b/clients/algoliasearch-client-php/lib/Http/Psr7/Uri.php new file mode 100644 index 0000000000..9d532477ac --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Http/Psr7/Uri.php @@ -0,0 +1,716 @@ + 80, + 'https' => 443, + 'ftp' => 21, + 'gopher' => 70, + 'nntp' => 119, + 'news' => 119, + 'telnet' => 23, + 'tn3270' => 23, + 'imap' => 143, + 'pop' => 110, + 'ldap' => 389, + ]; + + private static $charUnreserved = 'a-zA-Z0-9_\-\.~'; + + private static $charSubDelims = '!\$&\'\(\)\*\+,;='; + + private static $replaceQuery = ['=' => '%3D', '&' => '%26']; + + /** @var string Uri scheme. */ + private $scheme = ''; + + /** @var string Uri user info. */ + private $userInfo = ''; + + /** @var string Uri host. */ + private $host = ''; + + /** @var int|null Uri port. */ + private $port; + + /** @var string Uri path. */ + private $path = ''; + + /** @var string Uri query string. */ + private $query = ''; + + /** @var string Uri fragment. */ + private $fragment = ''; + + /** + * @param string $uri URI to parse + */ + public function __construct($uri = '') + { + // weak type check to also accept null until we can add scalar type hints + if ('' !== $uri) { + $parts = parse_url($uri); + if (false === $parts) { + throw new \InvalidArgumentException("Unable to parse URI: $uri"); + } + $this->applyParts($parts); + } + } + + public function __toString() + { + return self::composeComponents( + $this->scheme, + $this->getAuthority(), + $this->path, + $this->query, + $this->fragment + ); + } + + /** + * Composes a URI reference string from its various components. + * + * Usually this method does not need to be called manually but instead is used indirectly via + * `Psr\Http\Message\UriInterface::__toString`. + * + * PSR-7 UriInterface treats an empty component the same as a missing component as + * getQuery(), getFragment() etc. always return a string. This explains the slight + * difference to RFC 3986 Section 5.3. + * + * Another adjustment is that the authority separator is added even when the authority is missing/empty + * for the "file" scheme. This is because PHP stream functions like `file_get_contents` only work with + * `file:///myfile` but not with `file:/myfile` although they are equivalent according to RFC 3986. But + * `file:///` is the more common syntax for the file scheme anyway (Chrome for example redirects to + * that format). + * + * @param string $scheme + * @param string $authority + * @param string $path + * @param string $query + * @param string $fragment + * + * @return string + * + * @see https://tools.ietf.org/html/rfc3986#section-5.3 + */ + public static function composeComponents($scheme, $authority, $path, $query, $fragment) + { + $uri = ''; + + // weak type checks to also accept null until we can add scalar type hints + if ('' !== $scheme) { + $uri .= $scheme.':'; + } + + if ('' !== $authority || 'file' === $scheme) { + $uri .= '//'.$authority; + } + + $uri .= $path; + + if ('' !== $query) { + $uri .= '?'.$query; + } + + if ('' !== $fragment) { + $uri .= '#'.$fragment; + } + + return $uri; + } + + /** + * Whether the URI has the default port of the current scheme. + * + * `Psr\Http\Message\UriInterface::getPort` may return null or the standard port. This method can be used + * independently of the implementation. + * + * @return bool + */ + public static function isDefaultPort(UriInterface $uri) + { + return null === $uri->getPort() + || (isset(self::$defaultPorts[$uri->getScheme()]) && $uri->getPort() === self::$defaultPorts[$uri->getScheme()]); + } + + /** + * Whether the URI is absolute, i.e. it has a scheme. + * + * An instance of UriInterface can either be an absolute URI or a relative reference. This method returns true + * if it is the former. An absolute URI has a scheme. A relative reference is used to express a URI relative + * to another URI, the base URI. Relative references can be divided into several forms: + * - network-path references, e.g. '//example.com/path' + * - absolute-path references, e.g. '/path' + * - relative-path references, e.g. 'subpath' + * + * @return bool + * + * @see Uri::isNetworkPathReference + * @see Uri::isAbsolutePathReference + * @see Uri::isRelativePathReference + * @see https://tools.ietf.org/html/rfc3986#section-4 + */ + public static function isAbsolute(UriInterface $uri) + { + return '' !== $uri->getScheme(); + } + + /** + * Whether the URI is a network-path reference. + * + * A relative reference that begins with two slash characters is termed an network-path reference. + * + * @return bool + * + * @see https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isNetworkPathReference(UriInterface $uri) + { + return '' === $uri->getScheme() && '' !== $uri->getAuthority(); + } + + /** + * Whether the URI is a absolute-path reference. + * + * A relative reference that begins with a single slash character is termed an absolute-path reference. + * + * @return bool + * + * @see https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isAbsolutePathReference(UriInterface $uri) + { + $path = $uri->getPath(); + + return '' === $uri->getScheme() + && '' === $uri->getAuthority() + && isset($path[0]) + && '/' === $path[0]; + } + + /** + * Whether the URI is a relative-path reference. + * + * A relative reference that does not begin with a slash character is termed a relative-path reference. + * + * @return bool + * + * @see https://tools.ietf.org/html/rfc3986#section-4.2 + */ + public static function isRelativePathReference(UriInterface $uri) + { + $path = $uri->getPath(); + + return '' === $uri->getScheme() + && '' === $uri->getAuthority() + && (!isset($path[0]) || '/' !== $path[0]); + } + + /** + * Whether the URI is a same-document reference. + * + * A same-document reference refers to a URI that is, aside from its fragment + * component, identical to the base URI. When no base URI is given, only an empty + * URI reference (apart from its fragment) is considered a same-document reference. + * + * @param UriInterface $uri The URI to check + * @param UriInterface|null $base An optional base URI to compare against + * + * @return bool + * + * @see https://tools.ietf.org/html/rfc3986#section-4.4 + */ + public static function isSameDocumentReference(UriInterface $uri, UriInterface $base = null) + { + if (null !== $base) { + $uri = UriResolver::resolve($base, $uri); + + return ($uri->getScheme() === $base->getScheme()) + && ($uri->getAuthority() === $base->getAuthority()) + && ($uri->getPath() === $base->getPath()) + && ($uri->getQuery() === $base->getQuery()); + } + + return '' === $uri->getScheme() && '' === $uri->getAuthority() && '' === $uri->getPath() && '' === $uri->getQuery(); + } + + /** + * Removes dot segments from a path and returns the new path. + * + * @param string $path + * + * @return string + * + * @deprecated since version 1.4. Use UriResolver::removeDotSegments instead. + * @see UriResolver::removeDotSegments + */ + public static function removeDotSegments($path) + { + return UriResolver::removeDotSegments($path); + } + + /** + * Converts the relative URI into a new URI that is resolved against the base URI. + * + * @param UriInterface $base Base URI + * @param string|UriInterface $rel Relative URI + * + * @return UriInterface + * + * @deprecated since version 1.4. Use UriResolver::resolve instead. + * @see UriResolver::resolve + */ + public static function resolve(UriInterface $base, $rel) + { + if (!($rel instanceof UriInterface)) { + $rel = new self($rel); + } + + return UriResolver::resolve($base, $rel); + } + + /** + * Creates a new URI with a specific query string value removed. + * + * Any existing query string values that exactly match the provided key are + * removed. + * + * @param uriInterface $uri URI to use as a base + * @param string $key query string key to remove + * + * @return UriInterface + */ + public static function withoutQueryValue(UriInterface $uri, $key) + { + $current = $uri->getQuery(); + if ('' === $current) { + return $uri; + } + + $decodedKey = rawurldecode($key); + $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) { + $parts = explode('=', $part); + + return rawurldecode($parts[0]) !== $decodedKey; + }); + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a new URI with a specific query string value. + * + * Any existing query string values that exactly match the provided key are + * removed and replaced with the given key value pair. + * + * A value of null will set the query string key without a value, e.g. "key" + * instead of "key=value". + * + * @param UriInterface $uri URI to use as a base + * @param string $key key to set + * @param string|null $value Value to set + * + * @return UriInterface + */ + public static function withQueryValue(UriInterface $uri, $key, $value) + { + $current = $uri->getQuery(); + + if ('' === $current) { + $result = []; + } else { + $decodedKey = rawurldecode($key); + $result = array_filter(explode('&', $current), function ($part) use ($decodedKey) { + $parts = explode('=', $part); + + return rawurldecode($parts[0]) !== $decodedKey; + }); + } + + // Query string separators ("=", "&") within the key or value need to be encoded + // (while preventing double-encoding) before setting the query string. All other + // chars that need percent-encoding will be encoded by withQuery(). + $key = strtr($key, self::$replaceQuery); + + if (null !== $value) { + $result[] = $key.'='.strtr($value, self::$replaceQuery); + } else { + $result[] = $key; + } + + return $uri->withQuery(implode('&', $result)); + } + + /** + * Creates a URI from a hash of `parse_url` components. + * + * @throws \InvalidArgumentException if the components do not form a valid URI + * + * @return UriInterface + * + * @see http://php.net/manual/en/function.parse-url.php + * + */ + public static function fromParts(array $parts) + { + $uri = new self(); + $uri->applyParts($parts); + $uri->validateState(); + + return $uri; + } + + public function getScheme() + { + return $this->scheme; + } + + public function getAuthority() + { + $authority = $this->host; + if ('' !== $this->userInfo) { + $authority = $this->userInfo.'@'.$authority; + } + + if (null !== $this->port) { + $authority .= ':'.$this->port; + } + + return $authority; + } + + public function getUserInfo() + { + return $this->userInfo; + } + + public function getHost() + { + return $this->host; + } + + public function getPort() + { + return $this->port; + } + + public function getPath() + { + return $this->path; + } + + public function getQuery() + { + return $this->query; + } + + public function getFragment() + { + return $this->fragment; + } + + public function withScheme($scheme) + { + $scheme = $this->filterScheme($scheme); + + if ($this->scheme === $scheme) { + return $this; + } + + $new = clone $this; + $new->scheme = $scheme; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withUserInfo($user, $password = null) + { + $info = $user; + if ('' !== $password) { + $info .= ':'.$password; + } + + if ($this->userInfo === $info) { + return $this; + } + + $new = clone $this; + $new->userInfo = $info; + $new->validateState(); + + return $new; + } + + public function withHost($host) + { + $host = $this->filterHost($host); + + if ($this->host === $host) { + return $this; + } + + $new = clone $this; + $new->host = $host; + $new->validateState(); + + return $new; + } + + public function withPort($port) + { + $port = $this->filterPort($port); + + if ($this->port === $port) { + return $this; + } + + $new = clone $this; + $new->port = $port; + $new->removeDefaultPort(); + $new->validateState(); + + return $new; + } + + public function withPath($path) + { + $path = $this->filterPath($path); + + if ($this->path === $path) { + return $this; + } + + $new = clone $this; + $new->path = $path; + $new->validateState(); + + return $new; + } + + public function withQuery($query) + { + $query = $this->filterQueryAndFragment($query); + + if ($this->query === $query) { + return $this; + } + + $new = clone $this; + $new->query = $query; + + return $new; + } + + public function withFragment($fragment) + { + $fragment = $this->filterQueryAndFragment($fragment); + + if ($this->fragment === $fragment) { + return $this; + } + + $new = clone $this; + $new->fragment = $fragment; + + return $new; + } + + /** + * Apply parse_url parts to a URI. + * + * @param array $parts array of parse_url parts to apply + */ + private function applyParts(array $parts) + { + $this->scheme = isset($parts['scheme']) + ? $this->filterScheme($parts['scheme']) + : ''; + $this->userInfo = isset($parts['user']) ? $parts['user'] : ''; + $this->host = isset($parts['host']) + ? $this->filterHost($parts['host']) + : ''; + $this->port = isset($parts['port']) + ? $this->filterPort($parts['port']) + : null; + $this->path = isset($parts['path']) + ? $this->filterPath($parts['path']) + : ''; + $this->query = isset($parts['query']) + ? $this->filterQueryAndFragment($parts['query']) + : ''; + $this->fragment = isset($parts['fragment']) + ? $this->filterQueryAndFragment($parts['fragment']) + : ''; + if (isset($parts['pass'])) { + $this->userInfo .= ':'.$parts['pass']; + } + + $this->removeDefaultPort(); + } + + /** + * @param string $scheme + * + * @throws \InvalidArgumentException if the scheme is invalid + * + * @return string + * + */ + private function filterScheme($scheme) + { + if (!is_string($scheme)) { + throw new \InvalidArgumentException('Scheme must be a string'); + } + + return mb_strtolower($scheme); + } + + /** + * @param string $host + * + * @throws \InvalidArgumentException if the host is invalid + * + * @return string + * + */ + private function filterHost($host) + { + if (!is_string($host)) { + throw new \InvalidArgumentException('Host must be a string'); + } + + return mb_strtolower($host); + } + + /** + * @param int|null $port + * + * @throws \InvalidArgumentException if the port is invalid + * + * @return int|null + * + */ + private function filterPort($port) + { + if (null === $port) { + return null; + } + + $port = (int) $port; + if (1 > $port || 0xffff < $port) { + throw new \InvalidArgumentException(sprintf('Invalid port: %d. Must be between 1 and 65535', $port)); + } + + return $port; + } + + private function removeDefaultPort() + { + if (null !== $this->port && self::isDefaultPort($this)) { + $this->port = null; + } + } + + /** + * Filters the path of a URI. + * + * @param string $path + * + * @throws \InvalidArgumentException if the path is invalid + * + * @return string + * + */ + private function filterPath($path) + { + if (!is_string($path)) { + throw new \InvalidArgumentException('Path must be a string'); + } + + return preg_replace_callback( + '/(?:[^'.self::$charUnreserved.self::$charSubDelims.'%:@\/]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $path + ); + } + + /** + * Filters the query string or fragment of a URI. + * + * @param string $str + * + * @throws \InvalidArgumentException if the query or fragment is invalid + * + * @return string + * + */ + private function filterQueryAndFragment($str) + { + if (!is_string($str)) { + throw new \InvalidArgumentException('Query and fragment must be a string'); + } + + return preg_replace_callback( + '/(?:[^'.self::$charUnreserved.self::$charSubDelims.'%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/', + [$this, 'rawurlencodeMatchZero'], + $str + ); + } + + private function rawurlencodeMatchZero(array $match) + { + return rawurlencode($match[0]); + } + + private function validateState() + { + if ('' === $this->host && ('http' === $this->scheme || 'https' === $this->scheme)) { + $this->host = self::HTTP_DEFAULT_HOST; + } + + if ('' === $this->getAuthority()) { + if (0 === mb_strpos($this->path, '//')) { + throw new \InvalidArgumentException('The path of a URI without an authority must not start with two slashes "//"'); + } + $parts = explode('/', $this->path, 2); + if ('' === $this->scheme && false !== mb_strpos($parts[0], ':')) { + throw new \InvalidArgumentException('A relative URI must not have a path beginning with a segment containing a colon'); + } + } elseif (isset($this->path[0]) && '/' !== $this->path[0]) { + @trigger_error( + 'The path of a URI with an authority must start with a slash "/" or be empty. Automagically fixing the URI '. + 'by adding a leading slash to the path is deprecated since version 1.4 and will throw an exception instead.', + E_USER_DEPRECATED + ); + $this->path = '/'.$this->path; + //throw new \InvalidArgumentException('The path of a URI with an authority must start with a slash "/" or be empty'); + } + } +} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/UriResolver.php b/clients/algoliasearch-client-php/lib/Http/Psr7/UriResolver.php new file mode 100644 index 0000000000..048328fe60 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Http/Psr7/UriResolver.php @@ -0,0 +1,227 @@ +getScheme()) { + return $rel->withPath(self::removeDotSegments($rel->getPath())); + } + + if ('' !== $rel->getAuthority()) { + $targetAuthority = $rel->getAuthority(); + $targetPath = self::removeDotSegments($rel->getPath()); + $targetQuery = $rel->getQuery(); + } else { + $targetAuthority = $base->getAuthority(); + if ('' === $rel->getPath()) { + $targetPath = $base->getPath(); + $targetQuery = '' !== $rel->getQuery() ? $rel->getQuery() : $base->getQuery(); + } else { + $path = $rel->getPath(); + if ('/' === $path[0]) { + $targetPath = $rel->getPath(); + } else { + if ('' !== $targetAuthority && '' === $base->getPath()) { + $targetPath = '/'.$rel->getPath(); + } else { + $lastSlashPos = mb_strrpos($base->getPath(), '/'); + if (false === $lastSlashPos) { + $targetPath = $rel->getPath(); + } else { + $targetPath = mb_substr($base->getPath(), 0, $lastSlashPos + 1).$rel->getPath(); + } + } + } + $targetPath = self::removeDotSegments($targetPath); + $targetQuery = $rel->getQuery(); + } + } + + return new Uri(Uri::composeComponents( + $base->getScheme(), + $targetAuthority, + $targetPath, + $targetQuery, + $rel->getFragment() + )); + } + + /** + * Returns the target URI as a relative reference from the base URI. + * + * This method is the counterpart to resolve(): + * + * (string) $target === (string) UriResolver::resolve($base, UriResolver::relativize($base, $target)) + * + * One use-case is to use the current request URI as base URI and then generate relative links in your documents + * to reduce the document size or offer self-contained downloadable document archives. + * + * $base = new Uri('http://example.com/a/b/'); + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/c')); // prints 'c'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/x/y')); // prints '../x/y'. + * echo UriResolver::relativize($base, new Uri('http://example.com/a/b/?q')); // prints '?q'. + * echo UriResolver::relativize($base, new Uri('http://example.org/a/b/')); // prints '//example.org/a/b/'. + * + * This method also accepts a target that is already relative and will try to relativize it further. Only a + * relative-path reference will be returned as-is. + * + * echo UriResolver::relativize($base, new Uri('/a/b/c')); // prints 'c' as well + * + * @param UriInterface $base Base URI + * @param UriInterface $target Target URI + * + * @return UriInterface The relative URI reference + */ + public static function relativize(UriInterface $base, UriInterface $target) + { + if ('' !== $target->getScheme() && + ($base->getScheme() !== $target->getScheme() || '' === $target->getAuthority() && '' !== $base->getAuthority()) + ) { + return $target; + } + + if (Uri::isRelativePathReference($target)) { + // As the target is already highly relative we return it as-is. It would be possible to resolve + // the target with `$target = self::resolve($base, $target);` and then try make it more relative + // by removing a duplicate query. But let's not do that automatically. + return $target; + } + + if ('' !== $target->getAuthority() && $base->getAuthority() !== $target->getAuthority()) { + return $target->withScheme(''); + } + + // We must remove the path before removing the authority because if the path starts with two slashes, the URI + // would turn invalid. And we also cannot set a relative path before removing the authority, as that is also + // invalid. + $emptyPathUri = $target->withScheme('')->withPath('')->withUserInfo('')->withPort(null)->withHost(''); + + if ($base->getPath() !== $target->getPath()) { + return $emptyPathUri->withPath(self::getRelativePath($base, $target)); + } + + if ($base->getQuery() === $target->getQuery()) { + // Only the target fragment is left. And it must be returned even if base and target fragment are the same. + return $emptyPathUri->withQuery(''); + } + + // If the base URI has a query but the target has none, we cannot return an empty path reference as it would + // inherit the base query component when resolving. + if ('' === $target->getQuery()) { + $segments = explode('/', $target->getPath()); + $lastSegment = end($segments); + + return $emptyPathUri->withPath('' === $lastSegment ? './' : $lastSegment); + } + + return $emptyPathUri; + } + + private static function getRelativePath(UriInterface $base, UriInterface $target) + { + $sourceSegments = explode('/', $base->getPath()); + $targetSegments = explode('/', $target->getPath()); + array_pop($sourceSegments); + $targetLastSegment = array_pop($targetSegments); + foreach ($sourceSegments as $i => $segment) { + if (isset($targetSegments[$i]) && $segment === $targetSegments[$i]) { + unset($sourceSegments[$i], $targetSegments[$i]); + } else { + break; + } + } + $targetSegments[] = $targetLastSegment; + $relativePath = str_repeat('../', count($sourceSegments)).implode('/', $targetSegments); + + // A reference to am empty last segment or an empty first sub-segment must be prefixed with "./". + // This also applies to a segment with a colon character (e.g., "file:colon") that cannot be used + // as the first segment of a relative-path reference, as it would be mistaken for a scheme name. + $pathParts = explode('/', $relativePath, 2); + if ('' === $relativePath || false !== mb_strpos($pathParts[0], ':')) { + $relativePath = "./$relativePath"; + } elseif ('/' === $relativePath[0]) { + if ('' !== $base->getAuthority() && '' === $base->getPath()) { + // In this case an extra slash is added by resolve() automatically. So we must not add one here. + $relativePath = ".$relativePath"; + } else { + $relativePath = "./$relativePath"; + } + } + + return $relativePath; + } + + private function __construct() + { + // cannot be instantiated + } +} diff --git a/clients/algoliasearch-client-php/lib/Http/Psr7/functions.php b/clients/algoliasearch-client-php/lib/Http/Psr7/functions.php new file mode 100644 index 0000000000..646e75341b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Http/Psr7/functions.php @@ -0,0 +1,82 @@ +valid()) { + return false; + } + $result = $resource->current(); + $resource->next(); + + return $result; + }, $options); + } elseif (method_exists($resource, '__toString')) { + return stream_for((string) $resource, $options); + } + + break; + case 'NULL': + return new Stream(fopen('php://temp', 'r+'), $options); + } + if (is_callable($resource)) { + return new PumpStream($resource, $options); + } + + throw new \InvalidArgumentException('Invalid resource type: '.gettype($resource)); +} + +/** + * @internal + */ +function copy_to_string(StreamInterface $stream, $maxLen = -1) +{ + $buffer = ''; + if (-1 === $maxLen) { + while (!$stream->eof()) { + $buf = $stream->read(1048576); + // Using a loose equality here to match on '' and false. + if (null === $buf) { + break; + } + $buffer .= $buf; + } + + return $buffer; + } + $len = 0; + while (!$stream->eof() && $len < $maxLen) { + $buf = $stream->read($maxLen - $len); + // Using a loose equality here to match on '' and false. + if (null === $buf) { + break; + } + $buffer .= $buf; + $len = mb_strlen($buffer); + } + + return $buffer; +} diff --git a/clients/algoliasearch-client-php/lib/Log/DebugLogger.php b/clients/algoliasearch-client-php/lib/Log/DebugLogger.php new file mode 100644 index 0000000000..61c81ff1e1 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Log/DebugLogger.php @@ -0,0 +1,57 @@ + $level, + 'message' => $message, + 'context' => $context, + ]; + + if (function_exists('dump')) { + dump($logMessage); + } else { + var_dump($logMessage); + } + } + } +} diff --git a/clients/algoliasearch-client-php/lib/Model/ABTesting/ABTest.php b/clients/algoliasearch-client-php/lib/Model/ABTesting/ABTest.php new file mode 100644 index 0000000000..1c04101ecd --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTesting/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\ABTesting\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\ABTesting\Variant[] + */ + public function getVariants() + { + return $this->container['variants']; + } + + /** + * Sets variants + * + * @param \Algolia\AlgoliaSearch\Model\ABTesting\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/ABTesting/ABTestResponse.php b/clients/algoliasearch-client-php/lib/Model/ABTesting/ABTestResponse.php new file mode 100644 index 0000000000..9f06fb35b6 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTesting/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/ABTesting/AbTestsVariant.php b/clients/algoliasearch-client-php/lib/Model/ABTesting/AbTestsVariant.php new file mode 100644 index 0000000000..c3b9edc582 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTesting/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/ABTesting/AbTestsVariantSearchParams.php b/clients/algoliasearch-client-php/lib/Model/ABTesting/AbTestsVariantSearchParams.php new file mode 100644 index 0000000000..3c8b82dc01 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTesting/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/ABTesting/AddABTestsRequest.php b/clients/algoliasearch-client-php/lib/Model/ABTesting/AddABTestsRequest.php new file mode 100644 index 0000000000..21b1be00c1 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTesting/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\ABTesting\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\ABTesting\AddABTestsVariant[] + */ + public function getVariant() + { + return $this->container['variant']; + } + + /** + * Sets variant + * + * @param \Algolia\AlgoliaSearch\Model\ABTesting\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/ABTesting/AddABTestsVariant.php b/clients/algoliasearch-client-php/lib/Model/ABTesting/AddABTestsVariant.php new file mode 100644 index 0000000000..cab9c1032a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTesting/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/ABTesting/CustomSearchParams.php b/clients/algoliasearch-client-php/lib/Model/ABTesting/CustomSearchParams.php new file mode 100644 index 0000000000..9e0f1916b9 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTesting/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/ABTesting/ErrorBase.php b/clients/algoliasearch-client-php/lib/Model/ABTesting/ErrorBase.php new file mode 100644 index 0000000000..d081f8e488 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTesting/ErrorBase.php @@ -0,0 +1,292 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ErrorBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorBase'; + + /** + * 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 = []; + + 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|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @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/ABTesting/ListABTestsResponse.php b/clients/algoliasearch-client-php/lib/Model/ABTesting/ListABTestsResponse.php new file mode 100644 index 0000000000..a1db3cb096 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTesting/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\ABTesting\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\ABTesting\ABTest[] + */ + public function getAbtests() + { + return $this->container['abtests']; + } + + /** + * Sets abtests + * + * @param \Algolia\AlgoliaSearch\Model\ABTesting\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/ABTesting/ModelInterface.php b/clients/algoliasearch-client-php/lib/Model/ABTesting/ModelInterface.php new file mode 100644 index 0000000000..64735ed387 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/ABTesting/ModelInterface.php @@ -0,0 +1,68 @@ + + * @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/Model/Analytics/ErrorBase.php b/clients/algoliasearch-client-php/lib/Model/Analytics/ErrorBase.php new file mode 100644 index 0000000000..e9772dc544 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/ErrorBase.php @@ -0,0 +1,292 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ErrorBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorBase'; + + /** + * 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 = []; + + 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|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @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/Analytics/GetAverageClickPositionResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetAverageClickPositionResponse.php new file mode 100644 index 0000000000..7086b8db65 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetAverageClickPositionResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetAverageClickPositionResponseDates.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetAverageClickPositionResponseDates.php new file mode 100644 index 0000000000..0d1fffe98f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetClickPositionsResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetClickPositionsResponse.php new file mode 100644 index 0000000000..87a5bab6ad --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetClickPositionsResponsePositions[] + */ + public function getPositions() + { + return $this->container['positions']; + } + + /** + * Sets positions + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetClickPositionsResponsePositions.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetClickPositionsResponsePositions.php new file mode 100644 index 0000000000..f288f8c02b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetClickThroughRateResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetClickThroughRateResponse.php new file mode 100644 index 0000000000..619cd3bd72 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetClickThroughRateResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetClickThroughRateResponseDates.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetClickThroughRateResponseDates.php new file mode 100644 index 0000000000..9f326e26fb --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetConversationRateResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetConversationRateResponse.php new file mode 100644 index 0000000000..009f49921d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetConversationRateResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetConversationRateResponseDates.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetConversationRateResponseDates.php new file mode 100644 index 0000000000..4f534db2cb --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetNoClickRateResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetNoClickRateResponse.php new file mode 100644 index 0000000000..a43c2e8654 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetNoClickRateResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetNoClickRateResponseDates.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetNoClickRateResponseDates.php new file mode 100644 index 0000000000..edaab024c0 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetNoResultsRateResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetNoResultsRateResponse.php new file mode 100644 index 0000000000..368008f3f5 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetNoResultsRateResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetNoResultsRateResponseDates.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetNoResultsRateResponseDates.php new file mode 100644 index 0000000000..6102718321 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetSearchesCountResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetSearchesCountResponse.php new file mode 100644 index 0000000000..c21703a4f1 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetSearchesCountResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetSearchesCountResponseDates.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetSearchesCountResponseDates.php new file mode 100644 index 0000000000..1844e0be6c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetSearchesNoClicksResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetSearchesNoClicksResponse.php new file mode 100644 index 0000000000..571a34b771 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetSearchesNoClicksResponseSearches[] + */ + public function getSearches() + { + return $this->container['searches']; + } + + /** + * Sets searches + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetSearchesNoClicksResponseSearches.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetSearchesNoClicksResponseSearches.php new file mode 100644 index 0000000000..6e86fe5922 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetSearchesNoResultsResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetSearchesNoResultsResponse.php new file mode 100644 index 0000000000..f7c7c56825 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetSearchesNoResultsResponseSearches[] + */ + public function getSearches() + { + return $this->container['searches']; + } + + /** + * Sets searches + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetSearchesNoResultsResponseSearches.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetSearchesNoResultsResponseSearches.php new file mode 100644 index 0000000000..5004bede36 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetStatusResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetStatusResponse.php new file mode 100644 index 0000000000..463a427e09 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetTopCountriesResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopCountriesResponse.php new file mode 100644 index 0000000000..51b18ec878 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetTopCountriesResponseCountries[] + */ + public function getCountries() + { + return $this->container['countries']; + } + + /** + * Sets countries + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetTopCountriesResponseCountries.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopCountriesResponseCountries.php new file mode 100644 index 0000000000..00a7c2edbe --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetTopFilterAttribute.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopFilterAttribute.php new file mode 100644 index 0000000000..b45373b193 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetTopFilterAttributesResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopFilterAttributesResponse.php new file mode 100644 index 0000000000..a7025dfe6e --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetTopFilterAttribute[] + */ + public function getAttributes() + { + return $this->container['attributes']; + } + + /** + * Sets attributes + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetTopFilterForAttribute.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopFilterForAttribute.php new file mode 100644 index 0000000000..4283697f8c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetTopFilterForAttributeResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopFilterForAttributeResponse.php new file mode 100644 index 0000000000..0562d616e2 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetTopFilterForAttribute[] + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetTopFiltersNoResultsResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopFiltersNoResultsResponse.php new file mode 100644 index 0000000000..3e00ac1872 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetTopFiltersNoResultsValues[] + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetTopFiltersNoResultsValue.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopFiltersNoResultsValue.php new file mode 100644 index 0000000000..0913305c66 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetTopFiltersNoResultsValues.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopFiltersNoResultsValues.php new file mode 100644 index 0000000000..07a14e9f0a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetTopFiltersNoResultsValue[] + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetTopHitsResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopHitsResponse.php new file mode 100644 index 0000000000..9b5bb6a7c8 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetTopHitsResponseHits[] + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetTopHitsResponseHits.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopHitsResponseHits.php new file mode 100644 index 0000000000..c6e34f692a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetTopHitsResponseWithAnalytics.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopHitsResponseWithAnalytics.php new file mode 100644 index 0000000000..3db5efa120 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetTopHitsResponseWithAnalyticsHits[] + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetTopHitsResponseWithAnalyticsHits.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopHitsResponseWithAnalyticsHits.php new file mode 100644 index 0000000000..e1b91a4845 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetTopSearchesResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopSearchesResponse.php new file mode 100644 index 0000000000..d4bb901798 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetSearchesNoResultsResponseSearches[] + */ + public function getSearches() + { + return $this->container['searches']; + } + + /** + * Sets searches + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetTopSearchesResponseWithAnalytics.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopSearchesResponseWithAnalytics.php new file mode 100644 index 0000000000..8921e44f87 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetTopSearchesResponseWithAnalyticsSearches[] + */ + public function getSearches() + { + return $this->container['searches']; + } + + /** + * Sets searches + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/GetTopSearchesResponseWithAnalyticsSearches.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetTopSearchesResponseWithAnalyticsSearches.php new file mode 100644 index 0000000000..7946edc82a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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/Analytics/GetUsersCountResponse.php b/clients/algoliasearch-client-php/lib/Model/Analytics/GetUsersCountResponse.php new file mode 100644 index 0000000000..d1eb1b9108 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/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\Analytics\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\Analytics\GetSearchesCountResponseDates[] + */ + public function getDates() + { + return $this->container['dates']; + } + + /** + * Sets dates + * + * @param \Algolia\AlgoliaSearch\Model\Analytics\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/Analytics/ModelInterface.php b/clients/algoliasearch-client-php/lib/Model/Analytics/ModelInterface.php new file mode 100644 index 0000000000..bdaf7d79cb --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Analytics/ModelInterface.php @@ -0,0 +1,68 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ErrorBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorBase'; + + /** + * 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 = []; + + 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|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @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/Insights/InsightEvent.php b/clients/algoliasearch-client-php/lib/Model/Insights/InsightEvent.php new file mode 100644 index 0000000000..f8382746c5 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Insights/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/Insights/InsightEvents.php b/clients/algoliasearch-client-php/lib/Model/Insights/InsightEvents.php new file mode 100644 index 0000000000..57d467c7cc --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Insights/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\Insights\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\Insights\InsightEvent[] + */ + public function getEvents() + { + return $this->container['events']; + } + + /** + * Sets events + * + * @param \Algolia\AlgoliaSearch\Model\Insights\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/Insights/ModelInterface.php b/clients/algoliasearch-client-php/lib/Model/Insights/ModelInterface.php new file mode 100644 index 0000000000..e5b904db40 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Insights/ModelInterface.php @@ -0,0 +1,68 @@ + + * @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/Personalization/DeleteUserProfileResponse.php b/clients/algoliasearch-client-php/lib/Model/Personalization/DeleteUserProfileResponse.php new file mode 100644 index 0000000000..fb62ef21ea --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Personalization/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/Personalization/ErrorBase.php b/clients/algoliasearch-client-php/lib/Model/Personalization/ErrorBase.php new file mode 100644 index 0000000000..a2b8963dd2 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Personalization/ErrorBase.php @@ -0,0 +1,292 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ErrorBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorBase'; + + /** + * 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 = []; + + 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|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @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/Personalization/EventScoring.php b/clients/algoliasearch-client-php/lib/Model/Personalization/EventScoring.php new file mode 100644 index 0000000000..9b0bb392aa --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Personalization/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/Personalization/FacetScoring.php b/clients/algoliasearch-client-php/lib/Model/Personalization/FacetScoring.php new file mode 100644 index 0000000000..80dbc3fd2e --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Personalization/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/Personalization/GetUserTokenResponse.php b/clients/algoliasearch-client-php/lib/Model/Personalization/GetUserTokenResponse.php new file mode 100644 index 0000000000..26a7f9c1ac --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Personalization/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/Personalization/ModelInterface.php b/clients/algoliasearch-client-php/lib/Model/Personalization/ModelInterface.php new file mode 100644 index 0000000000..12b1045eab --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Personalization/ModelInterface.php @@ -0,0 +1,68 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class PersonalizationStrategyParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'personalizationStrategyParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'eventScoring' => '\Algolia\AlgoliaSearch\Model\Personalization\EventScoring[]', + 'facetScoring' => '\Algolia\AlgoliaSearch\Model\Personalization\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\Personalization\EventScoring[] + */ + public function getEventScoring() + { + return $this->container['eventScoring']; + } + + /** + * Sets eventScoring + * + * @param \Algolia\AlgoliaSearch\Model\Personalization\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\Personalization\FacetScoring[] + */ + public function getFacetScoring() + { + return $this->container['facetScoring']; + } + + /** + * Sets facetScoring + * + * @param \Algolia\AlgoliaSearch\Model\Personalization\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/Personalization/SetPersonalizationStrategyResponse.php b/clients/algoliasearch-client-php/lib/Model/Personalization/SetPersonalizationStrategyResponse.php new file mode 100644 index 0000000000..81fa40477a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Personalization/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/QuerySuggestions/ErrorBase.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/ErrorBase.php new file mode 100644 index 0000000000..8459fa4153 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/ErrorBase.php @@ -0,0 +1,292 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ErrorBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorBase'; + + /** + * 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 = []; + + 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|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @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/QuerySuggestions/IndexName.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/IndexName.php new file mode 100644 index 0000000000..dee3f5a0fc --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/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/QuerySuggestions/LogFile.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/LogFile.php new file mode 100644 index 0000000000..4a7d6cb9f2 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/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/QuerySuggestions/ModelInterface.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/ModelInterface.php new file mode 100644 index 0000000000..a60beb770c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/ModelInterface.php @@ -0,0 +1,68 @@ + + * @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\QuerySuggestions\SourceIndiceWithReplicas[]', + '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\QuerySuggestions\SourceIndiceWithReplicas[] + */ + public function getSourceIndices() + { + return $this->container['sourceIndices']; + } + + /** + * Sets sourceIndices + * + * @param \Algolia\AlgoliaSearch\Model\QuerySuggestions\SourceIndiceWithReplicas[] $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/QuerySuggestions/QuerySuggestionsIndexParam.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/QuerySuggestionsIndexParam.php new file mode 100644 index 0000000000..f96eee4ece --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/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\QuerySuggestions\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\QuerySuggestions\SourceIndex[] + */ + public function getSourceIndices() + { + return $this->container['sourceIndices']; + } + + /** + * Sets sourceIndices + * + * @param \Algolia\AlgoliaSearch\Model\QuerySuggestions\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/QuerySuggestions/QuerySuggestionsIndexWithIndexParam.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/QuerySuggestionsIndexWithIndexParam.php new file mode 100644 index 0000000000..5e24cee355 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/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\QuerySuggestions\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\QuerySuggestions\SourceIndex[] + */ + public function getSourceIndices() + { + return $this->container['sourceIndices']; + } + + /** + * Sets sourceIndices + * + * @param \Algolia\AlgoliaSearch\Model\QuerySuggestions\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/QuerySuggestions/SourceIndex.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/SourceIndex.php new file mode 100644 index 0000000000..1e42b978d6 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/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\QuerySuggestions\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\QuerySuggestions\SourceIndexExternal[]|null + */ + public function getExternal() + { + return $this->container['external']; + } + + /** + * Sets external + * + * @param \Algolia\AlgoliaSearch\Model\QuerySuggestions\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/QuerySuggestions/SourceIndexExternal.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/SourceIndexExternal.php new file mode 100644 index 0000000000..0fd072d082 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/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/QuerySuggestions/SourceIndiceWithReplicas.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/SourceIndiceWithReplicas.php new file mode 100644 index 0000000000..1e6a28298a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/SourceIndiceWithReplicas.php @@ -0,0 +1,527 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SourceIndiceWithReplicas implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SourceIndiceWithReplicas'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'replicas' => 'bool', + 'indexName' => 'string', + 'analyticsTags' => 'string[]', + 'facets' => 'object[]', + 'minHits' => 'int', + 'minLetters' => 'int', + 'generate' => 'string[][]', + 'external' => '\Algolia\AlgoliaSearch\Model\QuerySuggestions\SourceIndexExternal[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'replicas' => null, + '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 = [ + 'replicas' => 'replicas', + '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 = [ + 'replicas' => 'setReplicas', + '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 = [ + 'replicas' => 'getReplicas', + '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['replicas'] = $data['replicas'] ?? 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['replicas'] === null) { + $invalidProperties[] = "'replicas' can't be null"; + } + if ($this->container['indexName'] === null) { + $invalidProperties[] = "'indexName' 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 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 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[] + */ + 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\QuerySuggestions\SourceIndexExternal[] + */ + public function getExternal() + { + return $this->container['external']; + } + + /** + * Sets external + * + * @param \Algolia\AlgoliaSearch\Model\QuerySuggestions\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/QuerySuggestions/Status.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/Status.php new file mode 100644 index 0000000000..cfaa020367 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/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/QuerySuggestions/SucessResponse.php b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/SucessResponse.php new file mode 100644 index 0000000000..79cf72b5a8 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/QuerySuggestions/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/Recommend/BaseSearchParams.php b/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchParams.php new file mode 100644 index 0000000000..da224ce58d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchParams.php @@ -0,0 +1,1243 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BaseSearchParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'baseSearchParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'similarQuery' => 'string', + 'filters' => 'string', + 'facetFilters' => 'string[]', + 'optionalFilters' => 'string[]', + 'numericFilters' => 'string[]', + 'tagFilters' => 'string[]', + 'sumOrFiltersScores' => 'bool', + 'facets' => 'string[]', + 'maxValuesPerFacet' => 'int', + 'facetingAfterDistinct' => 'bool', + 'sortFacetValuesBy' => 'string', + 'page' => 'int', + 'offset' => 'int', + 'length' => 'int', + 'aroundLatLng' => 'string', + 'aroundLatLngViaIP' => 'bool', + 'aroundRadius' => 'OneOfIntegerString', + 'aroundPrecision' => 'int', + 'minimumAroundRadius' => 'int', + 'insideBoundingBox' => 'float[]', + 'insidePolygon' => 'float[]', + 'naturalLanguages' => 'string[]', + 'ruleContexts' => 'string[]', + 'personalizationImpact' => 'int', + 'userToken' => 'string', + 'getRankingInfo' => 'bool', + 'clickAnalytics' => 'bool', + 'analytics' => 'bool', + 'analyticsTags' => 'string[]', + 'percentileComputation' => 'bool', + 'enableABTest' => 'bool', + 'enableReRanking' => 'bool', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'similarQuery' => null, + 'filters' => null, + 'facetFilters' => null, + 'optionalFilters' => null, + 'numericFilters' => null, + 'tagFilters' => null, + 'sumOrFiltersScores' => null, + 'facets' => null, + 'maxValuesPerFacet' => null, + 'facetingAfterDistinct' => null, + 'sortFacetValuesBy' => null, + 'page' => null, + 'offset' => null, + 'length' => null, + 'aroundLatLng' => null, + 'aroundLatLngViaIP' => null, + 'aroundRadius' => null, + 'aroundPrecision' => null, + 'minimumAroundRadius' => null, + 'insideBoundingBox' => null, + 'insidePolygon' => null, + 'naturalLanguages' => null, + 'ruleContexts' => null, + 'personalizationImpact' => null, + 'userToken' => null, + 'getRankingInfo' => null, + 'clickAnalytics' => null, + 'analytics' => null, + 'analyticsTags' => null, + 'percentileComputation' => null, + 'enableABTest' => null, + 'enableReRanking' => 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 = [ + 'similarQuery' => 'similarQuery', + 'filters' => 'filters', + 'facetFilters' => 'facetFilters', + 'optionalFilters' => 'optionalFilters', + 'numericFilters' => 'numericFilters', + 'tagFilters' => 'tagFilters', + 'sumOrFiltersScores' => 'sumOrFiltersScores', + 'facets' => 'facets', + 'maxValuesPerFacet' => 'maxValuesPerFacet', + 'facetingAfterDistinct' => 'facetingAfterDistinct', + 'sortFacetValuesBy' => 'sortFacetValuesBy', + 'page' => 'page', + 'offset' => 'offset', + 'length' => 'length', + 'aroundLatLng' => 'aroundLatLng', + 'aroundLatLngViaIP' => 'aroundLatLngViaIP', + 'aroundRadius' => 'aroundRadius', + 'aroundPrecision' => 'aroundPrecision', + 'minimumAroundRadius' => 'minimumAroundRadius', + 'insideBoundingBox' => 'insideBoundingBox', + 'insidePolygon' => 'insidePolygon', + 'naturalLanguages' => 'naturalLanguages', + 'ruleContexts' => 'ruleContexts', + 'personalizationImpact' => 'personalizationImpact', + 'userToken' => 'userToken', + 'getRankingInfo' => 'getRankingInfo', + 'clickAnalytics' => 'clickAnalytics', + 'analytics' => 'analytics', + 'analyticsTags' => 'analyticsTags', + 'percentileComputation' => 'percentileComputation', + 'enableABTest' => 'enableABTest', + 'enableReRanking' => 'enableReRanking', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'similarQuery' => 'setSimilarQuery', + 'filters' => 'setFilters', + 'facetFilters' => 'setFacetFilters', + 'optionalFilters' => 'setOptionalFilters', + 'numericFilters' => 'setNumericFilters', + 'tagFilters' => 'setTagFilters', + 'sumOrFiltersScores' => 'setSumOrFiltersScores', + 'facets' => 'setFacets', + 'maxValuesPerFacet' => 'setMaxValuesPerFacet', + 'facetingAfterDistinct' => 'setFacetingAfterDistinct', + 'sortFacetValuesBy' => 'setSortFacetValuesBy', + 'page' => 'setPage', + 'offset' => 'setOffset', + 'length' => 'setLength', + 'aroundLatLng' => 'setAroundLatLng', + 'aroundLatLngViaIP' => 'setAroundLatLngViaIP', + 'aroundRadius' => 'setAroundRadius', + 'aroundPrecision' => 'setAroundPrecision', + 'minimumAroundRadius' => 'setMinimumAroundRadius', + 'insideBoundingBox' => 'setInsideBoundingBox', + 'insidePolygon' => 'setInsidePolygon', + 'naturalLanguages' => 'setNaturalLanguages', + 'ruleContexts' => 'setRuleContexts', + 'personalizationImpact' => 'setPersonalizationImpact', + 'userToken' => 'setUserToken', + 'getRankingInfo' => 'setGetRankingInfo', + 'clickAnalytics' => 'setClickAnalytics', + 'analytics' => 'setAnalytics', + 'analyticsTags' => 'setAnalyticsTags', + 'percentileComputation' => 'setPercentileComputation', + 'enableABTest' => 'setEnableABTest', + 'enableReRanking' => 'setEnableReRanking', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'similarQuery' => 'getSimilarQuery', + 'filters' => 'getFilters', + 'facetFilters' => 'getFacetFilters', + 'optionalFilters' => 'getOptionalFilters', + 'numericFilters' => 'getNumericFilters', + 'tagFilters' => 'getTagFilters', + 'sumOrFiltersScores' => 'getSumOrFiltersScores', + 'facets' => 'getFacets', + 'maxValuesPerFacet' => 'getMaxValuesPerFacet', + 'facetingAfterDistinct' => 'getFacetingAfterDistinct', + 'sortFacetValuesBy' => 'getSortFacetValuesBy', + 'page' => 'getPage', + 'offset' => 'getOffset', + 'length' => 'getLength', + 'aroundLatLng' => 'getAroundLatLng', + 'aroundLatLngViaIP' => 'getAroundLatLngViaIP', + 'aroundRadius' => 'getAroundRadius', + 'aroundPrecision' => 'getAroundPrecision', + 'minimumAroundRadius' => 'getMinimumAroundRadius', + 'insideBoundingBox' => 'getInsideBoundingBox', + 'insidePolygon' => 'getInsidePolygon', + 'naturalLanguages' => 'getNaturalLanguages', + 'ruleContexts' => 'getRuleContexts', + 'personalizationImpact' => 'getPersonalizationImpact', + 'userToken' => 'getUserToken', + 'getRankingInfo' => 'getGetRankingInfo', + 'clickAnalytics' => 'getClickAnalytics', + 'analytics' => 'getAnalytics', + 'analyticsTags' => 'getAnalyticsTags', + 'percentileComputation' => 'getPercentileComputation', + 'enableABTest' => 'getEnableABTest', + 'enableReRanking' => 'getEnableReRanking', + ]; + + /** + * 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['similarQuery'] = $data['similarQuery'] ?? ''; + $this->container['filters'] = $data['filters'] ?? ''; + $this->container['facetFilters'] = $data['facetFilters'] ?? null; + $this->container['optionalFilters'] = $data['optionalFilters'] ?? null; + $this->container['numericFilters'] = $data['numericFilters'] ?? null; + $this->container['tagFilters'] = $data['tagFilters'] ?? null; + $this->container['sumOrFiltersScores'] = $data['sumOrFiltersScores'] ?? false; + $this->container['facets'] = $data['facets'] ?? null; + $this->container['maxValuesPerFacet'] = $data['maxValuesPerFacet'] ?? 100; + $this->container['facetingAfterDistinct'] = $data['facetingAfterDistinct'] ?? false; + $this->container['sortFacetValuesBy'] = $data['sortFacetValuesBy'] ?? 'count'; + $this->container['page'] = $data['page'] ?? 0; + $this->container['offset'] = $data['offset'] ?? null; + $this->container['length'] = $data['length'] ?? null; + $this->container['aroundLatLng'] = $data['aroundLatLng'] ?? ''; + $this->container['aroundLatLngViaIP'] = $data['aroundLatLngViaIP'] ?? false; + $this->container['aroundRadius'] = $data['aroundRadius'] ?? null; + $this->container['aroundPrecision'] = $data['aroundPrecision'] ?? 10; + $this->container['minimumAroundRadius'] = $data['minimumAroundRadius'] ?? null; + $this->container['insideBoundingBox'] = $data['insideBoundingBox'] ?? null; + $this->container['insidePolygon'] = $data['insidePolygon'] ?? null; + $this->container['naturalLanguages'] = $data['naturalLanguages'] ?? null; + $this->container['ruleContexts'] = $data['ruleContexts'] ?? null; + $this->container['personalizationImpact'] = $data['personalizationImpact'] ?? 100; + $this->container['userToken'] = $data['userToken'] ?? null; + $this->container['getRankingInfo'] = $data['getRankingInfo'] ?? false; + $this->container['clickAnalytics'] = $data['clickAnalytics'] ?? false; + $this->container['analytics'] = $data['analytics'] ?? true; + $this->container['analyticsTags'] = $data['analyticsTags'] ?? null; + $this->container['percentileComputation'] = $data['percentileComputation'] ?? true; + $this->container['enableABTest'] = $data['enableABTest'] ?? true; + $this->container['enableReRanking'] = $data['enableReRanking'] ?? true; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['length']) && ($this->container['length'] > 1000)) { + $invalidProperties[] = "invalid value for 'length', must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['length']) && ($this->container['length'] < 1)) { + $invalidProperties[] = "invalid value for 'length', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['minimumAroundRadius']) && ($this->container['minimumAroundRadius'] < 1)) { + $invalidProperties[] = "invalid value for 'minimumAroundRadius', must be bigger than or equal to 1."; + } + + 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 similarQuery + * + * @return string|null + */ + public function getSimilarQuery() + { + return $this->container['similarQuery']; + } + + /** + * Sets similarQuery + * + * @param string|null $similarQuery overrides the query parameter and performs a more generic search that can be used to find \"similar\" results + * + * @return self + */ + public function setSimilarQuery($similarQuery) + { + $this->container['similarQuery'] = $similarQuery; + + return $this; + } + + /** + * Gets filters + * + * @return string|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param string|null $filters filter the query with numeric, facet and/or tag filters + * + * @return self + */ + public function setFilters($filters) + { + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets facetFilters + * + * @return string[]|null + */ + public function getFacetFilters() + { + return $this->container['facetFilters']; + } + + /** + * Sets facetFilters + * + * @param string[]|null $facetFilters filter hits by facet value + * + * @return self + */ + public function setFacetFilters($facetFilters) + { + $this->container['facetFilters'] = $facetFilters; + + return $this; + } + + /** + * Gets optionalFilters + * + * @return string[]|null + */ + public function getOptionalFilters() + { + return $this->container['optionalFilters']; + } + + /** + * Sets optionalFilters + * + * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * + * @return self + */ + public function setOptionalFilters($optionalFilters) + { + $this->container['optionalFilters'] = $optionalFilters; + + return $this; + } + + /** + * Gets numericFilters + * + * @return string[]|null + */ + public function getNumericFilters() + { + return $this->container['numericFilters']; + } + + /** + * Sets numericFilters + * + * @param string[]|null $numericFilters filter on numeric attributes + * + * @return self + */ + public function setNumericFilters($numericFilters) + { + $this->container['numericFilters'] = $numericFilters; + + return $this; + } + + /** + * Gets tagFilters + * + * @return string[]|null + */ + public function getTagFilters() + { + return $this->container['tagFilters']; + } + + /** + * Sets tagFilters + * + * @param string[]|null $tagFilters filter hits by tags + * + * @return self + */ + public function setTagFilters($tagFilters) + { + $this->container['tagFilters'] = $tagFilters; + + return $this; + } + + /** + * Gets sumOrFiltersScores + * + * @return bool|null + */ + public function getSumOrFiltersScores() + { + return $this->container['sumOrFiltersScores']; + } + + /** + * Sets sumOrFiltersScores + * + * @param bool|null $sumOrFiltersScores determines how to calculate the total score for filtering + * + * @return self + */ + public function setSumOrFiltersScores($sumOrFiltersScores) + { + $this->container['sumOrFiltersScores'] = $sumOrFiltersScores; + + return $this; + } + + /** + * Gets facets + * + * @return string[]|null + */ + public function getFacets() + { + return $this->container['facets']; + } + + /** + * Sets facets + * + * @param string[]|null $facets retrieve facets and their facet values + * + * @return self + */ + public function setFacets($facets) + { + $this->container['facets'] = $facets; + + return $this; + } + + /** + * Gets maxValuesPerFacet + * + * @return int|null + */ + public function getMaxValuesPerFacet() + { + return $this->container['maxValuesPerFacet']; + } + + /** + * Sets maxValuesPerFacet + * + * @param int|null $maxValuesPerFacet maximum number of facet values to return for each facet during a regular search + * + * @return self + */ + public function setMaxValuesPerFacet($maxValuesPerFacet) + { + $this->container['maxValuesPerFacet'] = $maxValuesPerFacet; + + return $this; + } + + /** + * Gets facetingAfterDistinct + * + * @return bool|null + */ + public function getFacetingAfterDistinct() + { + return $this->container['facetingAfterDistinct']; + } + + /** + * Sets facetingAfterDistinct + * + * @param bool|null $facetingAfterDistinct force faceting to be applied after de-duplication (via the Distinct setting) + * + * @return self + */ + public function setFacetingAfterDistinct($facetingAfterDistinct) + { + $this->container['facetingAfterDistinct'] = $facetingAfterDistinct; + + return $this; + } + + /** + * Gets sortFacetValuesBy + * + * @return string|null + */ + public function getSortFacetValuesBy() + { + return $this->container['sortFacetValuesBy']; + } + + /** + * Sets sortFacetValuesBy + * + * @param string|null $sortFacetValuesBy controls how facet values are fetched + * + * @return self + */ + public function setSortFacetValuesBy($sortFacetValuesBy) + { + $this->container['sortFacetValuesBy'] = $sortFacetValuesBy; + + return $this; + } + + /** + * Gets page + * + * @return int|null + */ + public function getPage() + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param int|null $page specify the page to retrieve + * + * @return self + */ + public function setPage($page) + { + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets offset + * + * @return int|null + */ + public function getOffset() + { + return $this->container['offset']; + } + + /** + * Sets offset + * + * @param int|null $offset specify the offset of the first hit to return + * + * @return self + */ + public function setOffset($offset) + { + $this->container['offset'] = $offset; + + return $this; + } + + /** + * Gets length + * + * @return int|null + */ + public function getLength() + { + return $this->container['length']; + } + + /** + * Sets length + * + * @param int|null $length set the number of hits to retrieve (used only with offset) + * + * @return self + */ + public function setLength($length) + { + if (!is_null($length) && ($length > 1000)) { + throw new \InvalidArgumentException('invalid value for $length when calling BaseSearchParams., must be smaller than or equal to 1000.'); + } + if (!is_null($length) && ($length < 1)) { + throw new \InvalidArgumentException('invalid value for $length when calling BaseSearchParams., must be bigger than or equal to 1.'); + } + + $this->container['length'] = $length; + + return $this; + } + + /** + * Gets aroundLatLng + * + * @return string|null + */ + public function getAroundLatLng() + { + return $this->container['aroundLatLng']; + } + + /** + * Sets aroundLatLng + * + * @param string|null $aroundLatLng search for entries around a central geolocation, enabling a geo search within a circular area + * + * @return self + */ + public function setAroundLatLng($aroundLatLng) + { + $this->container['aroundLatLng'] = $aroundLatLng; + + return $this; + } + + /** + * Gets aroundLatLngViaIP + * + * @return bool|null + */ + public function getAroundLatLngViaIP() + { + return $this->container['aroundLatLngViaIP']; + } + + /** + * Sets aroundLatLngViaIP + * + * @param bool|null $aroundLatLngViaIP search for entries around a given location automatically computed from the requester's IP address + * + * @return self + */ + public function setAroundLatLngViaIP($aroundLatLngViaIP) + { + $this->container['aroundLatLngViaIP'] = $aroundLatLngViaIP; + + return $this; + } + + /** + * Gets aroundRadius + * + * @return OneOfIntegerString|null + */ + public function getAroundRadius() + { + return $this->container['aroundRadius']; + } + + /** + * Sets aroundRadius + * + * @param OneOfIntegerString|null $aroundRadius define the maximum radius for a geo search (in meters) + * + * @return self + */ + public function setAroundRadius($aroundRadius) + { + $this->container['aroundRadius'] = $aroundRadius; + + return $this; + } + + /** + * Gets aroundPrecision + * + * @return int|null + */ + public function getAroundPrecision() + { + return $this->container['aroundPrecision']; + } + + /** + * Sets aroundPrecision + * + * @param int|null $aroundPrecision precision of geo search (in meters), to add grouping by geo location to the ranking formula + * + * @return self + */ + public function setAroundPrecision($aroundPrecision) + { + $this->container['aroundPrecision'] = $aroundPrecision; + + return $this; + } + + /** + * Gets minimumAroundRadius + * + * @return int|null + */ + public function getMinimumAroundRadius() + { + return $this->container['minimumAroundRadius']; + } + + /** + * Sets minimumAroundRadius + * + * @param int|null $minimumAroundRadius minimum radius (in meters) used for a geo search when aroundRadius is not set + * + * @return self + */ + public function setMinimumAroundRadius($minimumAroundRadius) + { + if (!is_null($minimumAroundRadius) && ($minimumAroundRadius < 1)) { + throw new \InvalidArgumentException('invalid value for $minimumAroundRadius when calling BaseSearchParams., must be bigger than or equal to 1.'); + } + + $this->container['minimumAroundRadius'] = $minimumAroundRadius; + + return $this; + } + + /** + * Gets insideBoundingBox + * + * @return float[]|null + */ + public function getInsideBoundingBox() + { + return $this->container['insideBoundingBox']; + } + + /** + * Sets insideBoundingBox + * + * @param float[]|null $insideBoundingBox search inside a rectangular area (in geo coordinates) + * + * @return self + */ + public function setInsideBoundingBox($insideBoundingBox) + { + $this->container['insideBoundingBox'] = $insideBoundingBox; + + return $this; + } + + /** + * Gets insidePolygon + * + * @return float[]|null + */ + public function getInsidePolygon() + { + return $this->container['insidePolygon']; + } + + /** + * Sets insidePolygon + * + * @param float[]|null $insidePolygon search inside a polygon (in geo coordinates) + * + * @return self + */ + public function setInsidePolygon($insidePolygon) + { + $this->container['insidePolygon'] = $insidePolygon; + + return $this; + } + + /** + * Gets naturalLanguages + * + * @return string[]|null + */ + public function getNaturalLanguages() + { + return $this->container['naturalLanguages']; + } + + /** + * Sets naturalLanguages + * + * @param string[]|null $naturalLanguages This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. + * + * @return self + */ + public function setNaturalLanguages($naturalLanguages) + { + $this->container['naturalLanguages'] = $naturalLanguages; + + return $this; + } + + /** + * Gets ruleContexts + * + * @return string[]|null + */ + public function getRuleContexts() + { + return $this->container['ruleContexts']; + } + + /** + * Sets ruleContexts + * + * @param string[]|null $ruleContexts enables contextual rules + * + * @return self + */ + public function setRuleContexts($ruleContexts) + { + $this->container['ruleContexts'] = $ruleContexts; + + return $this; + } + + /** + * Gets personalizationImpact + * + * @return int|null + */ + public function getPersonalizationImpact() + { + return $this->container['personalizationImpact']; + } + + /** + * Sets personalizationImpact + * + * @param int|null $personalizationImpact define the impact of the Personalization feature + * + * @return self + */ + public function setPersonalizationImpact($personalizationImpact) + { + $this->container['personalizationImpact'] = $personalizationImpact; + + return $this; + } + + /** + * Gets userToken + * + * @return string|null + */ + public function getUserToken() + { + return $this->container['userToken']; + } + + /** + * Sets userToken + * + * @param string|null $userToken associates a certain user token with the current search + * + * @return self + */ + public function setUserToken($userToken) + { + $this->container['userToken'] = $userToken; + + return $this; + } + + /** + * Gets getRankingInfo + * + * @return bool|null + */ + public function getGetRankingInfo() + { + return $this->container['getRankingInfo']; + } + + /** + * Sets getRankingInfo + * + * @param bool|null $getRankingInfo retrieve detailed ranking information + * + * @return self + */ + public function setGetRankingInfo($getRankingInfo) + { + $this->container['getRankingInfo'] = $getRankingInfo; + + return $this; + } + + /** + * Gets clickAnalytics + * + * @return bool|null + */ + public function getClickAnalytics() + { + return $this->container['clickAnalytics']; + } + + /** + * Sets clickAnalytics + * + * @param bool|null $clickAnalytics enable the Click Analytics feature + * + * @return self + */ + public function setClickAnalytics($clickAnalytics) + { + $this->container['clickAnalytics'] = $clickAnalytics; + + return $this; + } + + /** + * Gets analytics + * + * @return bool|null + */ + public function getAnalytics() + { + return $this->container['analytics']; + } + + /** + * Sets analytics + * + * @param bool|null $analytics whether the current query will be taken into account in the Analytics + * + * @return self + */ + public function setAnalytics($analytics) + { + $this->container['analytics'] = $analytics; + + return $this; + } + + /** + * Gets analyticsTags + * + * @return string[]|null + */ + public function getAnalyticsTags() + { + return $this->container['analyticsTags']; + } + + /** + * Sets analyticsTags + * + * @param string[]|null $analyticsTags list of tags to apply to the query for analytics purposes + * + * @return self + */ + public function setAnalyticsTags($analyticsTags) + { + $this->container['analyticsTags'] = $analyticsTags; + + return $this; + } + + /** + * Gets percentileComputation + * + * @return bool|null + */ + public function getPercentileComputation() + { + return $this->container['percentileComputation']; + } + + /** + * Sets percentileComputation + * + * @param bool|null $percentileComputation whether to include or exclude a query from the processing-time percentile computation + * + * @return self + */ + public function setPercentileComputation($percentileComputation) + { + $this->container['percentileComputation'] = $percentileComputation; + + return $this; + } + + /** + * Gets enableABTest + * + * @return bool|null + */ + public function getEnableABTest() + { + return $this->container['enableABTest']; + } + + /** + * Sets enableABTest + * + * @param bool|null $enableABTest whether this search should participate in running AB tests + * + * @return self + */ + public function setEnableABTest($enableABTest) + { + $this->container['enableABTest'] = $enableABTest; + + return $this; + } + + /** + * Gets enableReRanking + * + * @return bool|null + */ + public function getEnableReRanking() + { + return $this->container['enableReRanking']; + } + + /** + * Sets enableReRanking + * + * @param bool|null $enableReRanking whether this search should use AI Re-Ranking + * + * @return self + */ + public function setEnableReRanking($enableReRanking) + { + $this->container['enableReRanking'] = $enableReRanking; + + 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/Recommend/BaseSearchResponse.php b/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchResponse.php new file mode 100644 index 0000000000..319c0ce6a9 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchResponse.php @@ -0,0 +1,1016 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BaseSearchResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'baseSearchResponse'; + + /** + * 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', + ]; + + /** + * 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, + ]; + + /** + * 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', + ]; + + /** + * 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', + ]; + + /** + * 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', + ]; + + /** + * 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; + } + + /** + * 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"; + } + + 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 BaseSearchResponse., 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; + } + /** + * 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/Recommend/BaseSearchResponseFacetsStats.php b/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchResponseFacetsStats.php new file mode 100644 index 0000000000..80bc80570e --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/BaseSearchResponseFacetsStats.php @@ -0,0 +1,380 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BaseSearchResponseFacetsStats implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'baseSearchResponse_facets_stats'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'min' => 'int', + 'max' => 'int', + 'avg' => 'int', + 'sum' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'min' => null, + 'max' => null, + 'avg' => null, + 'sum' => 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 = [ + 'min' => 'min', + 'max' => 'max', + 'avg' => 'avg', + 'sum' => 'sum', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'min' => 'setMin', + 'max' => 'setMax', + 'avg' => 'setAvg', + 'sum' => 'setSum', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'min' => 'getMin', + 'max' => 'getMax', + 'avg' => 'getAvg', + 'sum' => 'getSum', + ]; + + /** + * 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['min'] = $data['min'] ?? null; + $this->container['max'] = $data['max'] ?? null; + $this->container['avg'] = $data['avg'] ?? null; + $this->container['sum'] = $data['sum'] ?? 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 min + * + * @return int|null + */ + public function getMin() + { + return $this->container['min']; + } + + /** + * Sets min + * + * @param int|null $min the minimum value in the result set + * + * @return self + */ + public function setMin($min) + { + $this->container['min'] = $min; + + return $this; + } + + /** + * Gets max + * + * @return int|null + */ + public function getMax() + { + return $this->container['max']; + } + + /** + * Sets max + * + * @param int|null $max the maximum value in the result set + * + * @return self + */ + public function setMax($max) + { + $this->container['max'] = $max; + + return $this; + } + + /** + * Gets avg + * + * @return int|null + */ + public function getAvg() + { + return $this->container['avg']; + } + + /** + * Sets avg + * + * @param int|null $avg the average facet value in the result set + * + * @return self + */ + public function setAvg($avg) + { + $this->container['avg'] = $avg; + + return $this; + } + + /** + * Gets sum + * + * @return int|null + */ + public function getSum() + { + return $this->container['sum']; + } + + /** + * Sets sum + * + * @param int|null $sum the sum of all values in the result set + * + * @return self + */ + public function setSum($sum) + { + $this->container['sum'] = $sum; + + 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/Recommend/ErrorBase.php b/clients/algoliasearch-client-php/lib/Model/Recommend/ErrorBase.php new file mode 100644 index 0000000000..c4d818464f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/ErrorBase.php @@ -0,0 +1,292 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ErrorBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorBase'; + + /** + * 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 = []; + + 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|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @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/Recommend/GetRecommendations.php b/clients/algoliasearch-client-php/lib/Model/Recommend/GetRecommendations.php new file mode 100644 index 0000000000..9fe2ebcdac --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/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\Recommend\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\Recommend\RecommendationRequest[] + */ + public function getRequests() + { + return $this->container['requests']; + } + + /** + * Sets requests + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\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/Recommend/GetRecommendationsResponse.php b/clients/algoliasearch-client-php/lib/Model/Recommend/GetRecommendationsResponse.php new file mode 100644 index 0000000000..e5c5aba8ef --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/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\Recommend\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\Recommend\RecommendationsResponse[]|null + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\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/Recommend/HighlightResult.php b/clients/algoliasearch-client-php/lib/Model/Recommend/HighlightResult.php new file mode 100644 index 0000000000..73958efd3b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/HighlightResult.php @@ -0,0 +1,419 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class HighlightResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'highlightResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'value' => 'string', + 'matchLevel' => 'string', + 'matchedWords' => 'string[]', + 'fullyHighlighted' => 'bool', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'matchLevel' => null, + 'matchedWords' => null, + 'fullyHighlighted' => 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 = [ + 'value' => 'value', + 'matchLevel' => 'matchLevel', + 'matchedWords' => 'matchedWords', + 'fullyHighlighted' => 'fullyHighlighted', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'matchLevel' => 'setMatchLevel', + 'matchedWords' => 'setMatchedWords', + 'fullyHighlighted' => 'setFullyHighlighted', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'matchLevel' => 'getMatchLevel', + 'matchedWords' => 'getMatchedWords', + 'fullyHighlighted' => 'getFullyHighlighted', + ]; + + /** + * 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 MATCH_LEVEL_NONE = 'none'; + const MATCH_LEVEL_PARTIAL = 'partial'; + const MATCH_LEVEL_FULL = 'full'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMatchLevelAllowableValues() + { + return [ + self::MATCH_LEVEL_NONE, + self::MATCH_LEVEL_PARTIAL, + self::MATCH_LEVEL_FULL, + ]; + } + + /** + * 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['value'] = $data['value'] ?? null; + $this->container['matchLevel'] = $data['matchLevel'] ?? null; + $this->container['matchedWords'] = $data['matchedWords'] ?? null; + $this->container['fullyHighlighted'] = $data['fullyHighlighted'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getMatchLevelAllowableValues(); + if (!is_null($this->container['matchLevel']) && !in_array($this->container['matchLevel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'matchLevel', must be one of '%s'", + $this->container['matchLevel'], + implode("', '", $allowedValues) + ); + } + + 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 value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value markup text with occurrences highlighted + * + * @return self + */ + public function setValue($value) + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets matchLevel + * + * @return string|null + */ + public function getMatchLevel() + { + return $this->container['matchLevel']; + } + + /** + * Sets matchLevel + * + * @param string|null $matchLevel indicates how well the attribute matched the search query + * + * @return self + */ + public function setMatchLevel($matchLevel) + { + $allowedValues = $this->getMatchLevelAllowableValues(); + if (!is_null($matchLevel) && !in_array($matchLevel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'matchLevel', must be one of '%s'", + $matchLevel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['matchLevel'] = $matchLevel; + + return $this; + } + + /** + * Gets matchedWords + * + * @return string[]|null + */ + public function getMatchedWords() + { + return $this->container['matchedWords']; + } + + /** + * Sets matchedWords + * + * @param string[]|null $matchedWords list of words from the query that matched the object + * + * @return self + */ + public function setMatchedWords($matchedWords) + { + $this->container['matchedWords'] = $matchedWords; + + return $this; + } + + /** + * Gets fullyHighlighted + * + * @return bool|null + */ + public function getFullyHighlighted() + { + return $this->container['fullyHighlighted']; + } + + /** + * Sets fullyHighlighted + * + * @param bool|null $fullyHighlighted whether the entire attribute value is highlighted + * + * @return self + */ + public function setFullyHighlighted($fullyHighlighted) + { + $this->container['fullyHighlighted'] = $fullyHighlighted; + + 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/Recommend/IndexSettingsAsSearchParams.php b/clients/algoliasearch-client-php/lib/Model/Recommend/IndexSettingsAsSearchParams.php new file mode 100644 index 0000000000..cbbda45cd2 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/IndexSettingsAsSearchParams.php @@ -0,0 +1,1817 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class IndexSettingsAsSearchParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'indexSettingsAsSearchParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'searchableAttributes' => 'string[]', + 'attributesForFaceting' => 'string[]', + 'unretrievableAttributes' => 'string[]', + 'attributesToRetrieve' => 'string[]', + 'restrictSearchableAttributes' => 'string[]', + 'ranking' => 'string[]', + 'customRanking' => 'string[]', + 'relevancyStrictness' => 'int', + 'attributesToHighlight' => 'string[]', + 'attributesToSnippet' => 'string[]', + 'highlightPreTag' => 'string', + 'highlightPostTag' => 'string', + 'snippetEllipsisText' => 'string', + 'restrictHighlightAndSnippetArrays' => 'bool', + 'hitsPerPage' => 'int', + 'minWordSizefor1Typo' => 'int', + 'minWordSizefor2Typos' => 'int', + 'typoTolerance' => 'string', + 'allowTyposOnNumericTokens' => 'bool', + 'disableTypoToleranceOnAttributes' => 'string[]', + 'separatorsToIndex' => 'string', + 'ignorePlurals' => 'string', + 'removeStopWords' => 'string', + 'keepDiacriticsOnCharacters' => 'string', + 'queryLanguages' => 'string[]', + 'decompoundQuery' => 'bool', + 'enableRules' => 'bool', + 'enablePersonalization' => 'bool', + 'queryType' => 'string', + 'removeWordsIfNoResults' => 'string', + 'advancedSyntax' => 'bool', + 'optionalWords' => 'string[]', + 'disableExactOnAttributes' => 'string[]', + 'exactOnSingleWordQuery' => 'string', + 'alternativesAsExact' => 'string[]', + 'advancedSyntaxFeatures' => 'string[]', + 'distinct' => 'int', + 'synonyms' => 'bool', + 'replaceSynonymsInHighlight' => 'bool', + 'minProximity' => 'int', + 'responseFields' => 'string[]', + 'maxFacetHits' => 'int', + 'attributeCriteriaComputedByMinProximity' => 'bool', + 'renderingContent' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'searchableAttributes' => null, + 'attributesForFaceting' => null, + 'unretrievableAttributes' => null, + 'attributesToRetrieve' => null, + 'restrictSearchableAttributes' => null, + 'ranking' => null, + 'customRanking' => null, + 'relevancyStrictness' => null, + 'attributesToHighlight' => null, + 'attributesToSnippet' => null, + 'highlightPreTag' => null, + 'highlightPostTag' => null, + 'snippetEllipsisText' => null, + 'restrictHighlightAndSnippetArrays' => null, + 'hitsPerPage' => null, + 'minWordSizefor1Typo' => null, + 'minWordSizefor2Typos' => null, + 'typoTolerance' => null, + 'allowTyposOnNumericTokens' => null, + 'disableTypoToleranceOnAttributes' => null, + 'separatorsToIndex' => null, + 'ignorePlurals' => null, + 'removeStopWords' => null, + 'keepDiacriticsOnCharacters' => null, + 'queryLanguages' => null, + 'decompoundQuery' => null, + 'enableRules' => null, + 'enablePersonalization' => null, + 'queryType' => null, + 'removeWordsIfNoResults' => null, + 'advancedSyntax' => null, + 'optionalWords' => null, + 'disableExactOnAttributes' => null, + 'exactOnSingleWordQuery' => null, + 'alternativesAsExact' => null, + 'advancedSyntaxFeatures' => null, + 'distinct' => null, + 'synonyms' => null, + 'replaceSynonymsInHighlight' => null, + 'minProximity' => null, + 'responseFields' => null, + 'maxFacetHits' => null, + 'attributeCriteriaComputedByMinProximity' => null, + 'renderingContent' => 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 = [ + 'searchableAttributes' => 'searchableAttributes', + 'attributesForFaceting' => 'attributesForFaceting', + 'unretrievableAttributes' => 'unretrievableAttributes', + 'attributesToRetrieve' => 'attributesToRetrieve', + 'restrictSearchableAttributes' => 'restrictSearchableAttributes', + 'ranking' => 'ranking', + 'customRanking' => 'customRanking', + 'relevancyStrictness' => 'relevancyStrictness', + 'attributesToHighlight' => 'attributesToHighlight', + 'attributesToSnippet' => 'attributesToSnippet', + 'highlightPreTag' => 'highlightPreTag', + 'highlightPostTag' => 'highlightPostTag', + 'snippetEllipsisText' => 'snippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'restrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'hitsPerPage', + 'minWordSizefor1Typo' => 'minWordSizefor1Typo', + 'minWordSizefor2Typos' => 'minWordSizefor2Typos', + 'typoTolerance' => 'typoTolerance', + 'allowTyposOnNumericTokens' => 'allowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'disableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'separatorsToIndex', + 'ignorePlurals' => 'ignorePlurals', + 'removeStopWords' => 'removeStopWords', + 'keepDiacriticsOnCharacters' => 'keepDiacriticsOnCharacters', + 'queryLanguages' => 'queryLanguages', + 'decompoundQuery' => 'decompoundQuery', + 'enableRules' => 'enableRules', + 'enablePersonalization' => 'enablePersonalization', + 'queryType' => 'queryType', + 'removeWordsIfNoResults' => 'removeWordsIfNoResults', + 'advancedSyntax' => 'advancedSyntax', + 'optionalWords' => 'optionalWords', + 'disableExactOnAttributes' => 'disableExactOnAttributes', + 'exactOnSingleWordQuery' => 'exactOnSingleWordQuery', + 'alternativesAsExact' => 'alternativesAsExact', + 'advancedSyntaxFeatures' => 'advancedSyntaxFeatures', + 'distinct' => 'distinct', + 'synonyms' => 'synonyms', + 'replaceSynonymsInHighlight' => 'replaceSynonymsInHighlight', + 'minProximity' => 'minProximity', + 'responseFields' => 'responseFields', + 'maxFacetHits' => 'maxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'attributeCriteriaComputedByMinProximity', + 'renderingContent' => 'renderingContent', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'searchableAttributes' => 'setSearchableAttributes', + 'attributesForFaceting' => 'setAttributesForFaceting', + 'unretrievableAttributes' => 'setUnretrievableAttributes', + 'attributesToRetrieve' => 'setAttributesToRetrieve', + 'restrictSearchableAttributes' => 'setRestrictSearchableAttributes', + 'ranking' => 'setRanking', + 'customRanking' => 'setCustomRanking', + 'relevancyStrictness' => 'setRelevancyStrictness', + 'attributesToHighlight' => 'setAttributesToHighlight', + 'attributesToSnippet' => 'setAttributesToSnippet', + 'highlightPreTag' => 'setHighlightPreTag', + 'highlightPostTag' => 'setHighlightPostTag', + 'snippetEllipsisText' => 'setSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'setRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'setHitsPerPage', + 'minWordSizefor1Typo' => 'setMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'setMinWordSizefor2Typos', + 'typoTolerance' => 'setTypoTolerance', + 'allowTyposOnNumericTokens' => 'setAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'setDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'setSeparatorsToIndex', + 'ignorePlurals' => 'setIgnorePlurals', + 'removeStopWords' => 'setRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'setKeepDiacriticsOnCharacters', + 'queryLanguages' => 'setQueryLanguages', + 'decompoundQuery' => 'setDecompoundQuery', + 'enableRules' => 'setEnableRules', + 'enablePersonalization' => 'setEnablePersonalization', + 'queryType' => 'setQueryType', + 'removeWordsIfNoResults' => 'setRemoveWordsIfNoResults', + 'advancedSyntax' => 'setAdvancedSyntax', + 'optionalWords' => 'setOptionalWords', + 'disableExactOnAttributes' => 'setDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'setExactOnSingleWordQuery', + 'alternativesAsExact' => 'setAlternativesAsExact', + 'advancedSyntaxFeatures' => 'setAdvancedSyntaxFeatures', + 'distinct' => 'setDistinct', + 'synonyms' => 'setSynonyms', + 'replaceSynonymsInHighlight' => 'setReplaceSynonymsInHighlight', + 'minProximity' => 'setMinProximity', + 'responseFields' => 'setResponseFields', + 'maxFacetHits' => 'setMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'setAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'setRenderingContent', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'searchableAttributes' => 'getSearchableAttributes', + 'attributesForFaceting' => 'getAttributesForFaceting', + 'unretrievableAttributes' => 'getUnretrievableAttributes', + 'attributesToRetrieve' => 'getAttributesToRetrieve', + 'restrictSearchableAttributes' => 'getRestrictSearchableAttributes', + 'ranking' => 'getRanking', + 'customRanking' => 'getCustomRanking', + 'relevancyStrictness' => 'getRelevancyStrictness', + 'attributesToHighlight' => 'getAttributesToHighlight', + 'attributesToSnippet' => 'getAttributesToSnippet', + 'highlightPreTag' => 'getHighlightPreTag', + 'highlightPostTag' => 'getHighlightPostTag', + 'snippetEllipsisText' => 'getSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'getRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'getHitsPerPage', + 'minWordSizefor1Typo' => 'getMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'getMinWordSizefor2Typos', + 'typoTolerance' => 'getTypoTolerance', + 'allowTyposOnNumericTokens' => 'getAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'getDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'getSeparatorsToIndex', + 'ignorePlurals' => 'getIgnorePlurals', + 'removeStopWords' => 'getRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'getKeepDiacriticsOnCharacters', + 'queryLanguages' => 'getQueryLanguages', + 'decompoundQuery' => 'getDecompoundQuery', + 'enableRules' => 'getEnableRules', + 'enablePersonalization' => 'getEnablePersonalization', + 'queryType' => 'getQueryType', + 'removeWordsIfNoResults' => 'getRemoveWordsIfNoResults', + 'advancedSyntax' => 'getAdvancedSyntax', + 'optionalWords' => 'getOptionalWords', + 'disableExactOnAttributes' => 'getDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'getExactOnSingleWordQuery', + 'alternativesAsExact' => 'getAlternativesAsExact', + 'advancedSyntaxFeatures' => 'getAdvancedSyntaxFeatures', + 'distinct' => 'getDistinct', + 'synonyms' => 'getSynonyms', + 'replaceSynonymsInHighlight' => 'getReplaceSynonymsInHighlight', + 'minProximity' => 'getMinProximity', + 'responseFields' => 'getResponseFields', + 'maxFacetHits' => 'getMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'getAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'getRenderingContent', + ]; + + /** + * 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 TYPO_TOLERANCE_TRUE = 'true'; + const TYPO_TOLERANCE_FALSE = 'false'; + const TYPO_TOLERANCE_MIN = 'min'; + const TYPO_TOLERANCE_STRICT = 'strict'; + const QUERY_TYPE_PREFIX_LAST = 'prefixLast'; + const QUERY_TYPE_PREFIX_ALL = 'prefixAll'; + const QUERY_TYPE_PREFIX_NONE = 'prefixNone'; + const REMOVE_WORDS_IF_NO_RESULTS_NONE = 'none'; + const REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS = 'lastWords'; + const REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS = 'firstWords'; + const REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL = 'allOptional'; + const EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE = 'attribute'; + const EXACT_ON_SINGLE_WORD_QUERY_NONE = 'none'; + const EXACT_ON_SINGLE_WORD_QUERY_WORD = 'word'; + const ALTERNATIVES_AS_EXACT_IGNORE_PLURALS = 'ignorePlurals'; + const ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM = 'singleWordSynonym'; + const ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM = 'multiWordsSynonym'; + const ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE = 'exactPhrase'; + const ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS = 'excludeWords'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypoToleranceAllowableValues() + { + return [ + self::TYPO_TOLERANCE_TRUE, + self::TYPO_TOLERANCE_FALSE, + self::TYPO_TOLERANCE_MIN, + self::TYPO_TOLERANCE_STRICT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getQueryTypeAllowableValues() + { + return [ + self::QUERY_TYPE_PREFIX_LAST, + self::QUERY_TYPE_PREFIX_ALL, + self::QUERY_TYPE_PREFIX_NONE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRemoveWordsIfNoResultsAllowableValues() + { + return [ + self::REMOVE_WORDS_IF_NO_RESULTS_NONE, + self::REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExactOnSingleWordQueryAllowableValues() + { + return [ + self::EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE, + self::EXACT_ON_SINGLE_WORD_QUERY_NONE, + self::EXACT_ON_SINGLE_WORD_QUERY_WORD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativesAsExactAllowableValues() + { + return [ + self::ALTERNATIVES_AS_EXACT_IGNORE_PLURALS, + self::ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM, + self::ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAdvancedSyntaxFeaturesAllowableValues() + { + return [ + self::ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE, + self::ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS, + ]; + } + + /** + * 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['searchableAttributes'] = $data['searchableAttributes'] ?? null; + $this->container['attributesForFaceting'] = $data['attributesForFaceting'] ?? null; + $this->container['unretrievableAttributes'] = $data['unretrievableAttributes'] ?? null; + $this->container['attributesToRetrieve'] = $data['attributesToRetrieve'] ?? null; + $this->container['restrictSearchableAttributes'] = $data['restrictSearchableAttributes'] ?? null; + $this->container['ranking'] = $data['ranking'] ?? null; + $this->container['customRanking'] = $data['customRanking'] ?? null; + $this->container['relevancyStrictness'] = $data['relevancyStrictness'] ?? 100; + $this->container['attributesToHighlight'] = $data['attributesToHighlight'] ?? null; + $this->container['attributesToSnippet'] = $data['attributesToSnippet'] ?? null; + $this->container['highlightPreTag'] = $data['highlightPreTag'] ?? ''; + $this->container['highlightPostTag'] = $data['highlightPostTag'] ?? ''; + $this->container['snippetEllipsisText'] = $data['snippetEllipsisText'] ?? '…'; + $this->container['restrictHighlightAndSnippetArrays'] = $data['restrictHighlightAndSnippetArrays'] ?? false; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + $this->container['minWordSizefor1Typo'] = $data['minWordSizefor1Typo'] ?? 4; + $this->container['minWordSizefor2Typos'] = $data['minWordSizefor2Typos'] ?? 8; + $this->container['typoTolerance'] = $data['typoTolerance'] ?? 'true'; + $this->container['allowTyposOnNumericTokens'] = $data['allowTyposOnNumericTokens'] ?? true; + $this->container['disableTypoToleranceOnAttributes'] = $data['disableTypoToleranceOnAttributes'] ?? null; + $this->container['separatorsToIndex'] = $data['separatorsToIndex'] ?? ''; + $this->container['ignorePlurals'] = $data['ignorePlurals'] ?? 'false'; + $this->container['removeStopWords'] = $data['removeStopWords'] ?? 'false'; + $this->container['keepDiacriticsOnCharacters'] = $data['keepDiacriticsOnCharacters'] ?? ''; + $this->container['queryLanguages'] = $data['queryLanguages'] ?? null; + $this->container['decompoundQuery'] = $data['decompoundQuery'] ?? true; + $this->container['enableRules'] = $data['enableRules'] ?? true; + $this->container['enablePersonalization'] = $data['enablePersonalization'] ?? false; + $this->container['queryType'] = $data['queryType'] ?? 'prefixLast'; + $this->container['removeWordsIfNoResults'] = $data['removeWordsIfNoResults'] ?? 'none'; + $this->container['advancedSyntax'] = $data['advancedSyntax'] ?? false; + $this->container['optionalWords'] = $data['optionalWords'] ?? null; + $this->container['disableExactOnAttributes'] = $data['disableExactOnAttributes'] ?? null; + $this->container['exactOnSingleWordQuery'] = $data['exactOnSingleWordQuery'] ?? 'attribute'; + $this->container['alternativesAsExact'] = $data['alternativesAsExact'] ?? null; + $this->container['advancedSyntaxFeatures'] = $data['advancedSyntaxFeatures'] ?? null; + $this->container['distinct'] = $data['distinct'] ?? 0; + $this->container['synonyms'] = $data['synonyms'] ?? true; + $this->container['replaceSynonymsInHighlight'] = $data['replaceSynonymsInHighlight'] ?? false; + $this->container['minProximity'] = $data['minProximity'] ?? 1; + $this->container['responseFields'] = $data['responseFields'] ?? null; + $this->container['maxFacetHits'] = $data['maxFacetHits'] ?? 10; + $this->container['attributeCriteriaComputedByMinProximity'] = $data['attributeCriteriaComputedByMinProximity'] ?? false; + $this->container['renderingContent'] = $data['renderingContent'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($this->container['typoTolerance']) && !in_array($this->container['typoTolerance'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'typoTolerance', must be one of '%s'", + $this->container['typoTolerance'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($this->container['queryType']) && !in_array($this->container['queryType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'queryType', must be one of '%s'", + $this->container['queryType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($this->container['removeWordsIfNoResults']) && !in_array($this->container['removeWordsIfNoResults'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $this->container['removeWordsIfNoResults'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($this->container['exactOnSingleWordQuery']) && !in_array($this->container['exactOnSingleWordQuery'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $this->container['exactOnSingleWordQuery'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] > 4)) { + $invalidProperties[] = "invalid value for 'distinct', must be smaller than or equal to 4."; + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] < 0)) { + $invalidProperties[] = "invalid value for 'distinct', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] > 7)) { + $invalidProperties[] = "invalid value for 'minProximity', must be smaller than or equal to 7."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] < 1)) { + $invalidProperties[] = "invalid value for 'minProximity', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['maxFacetHits']) && ($this->container['maxFacetHits'] > 100)) { + $invalidProperties[] = "invalid value for 'maxFacetHits', must be smaller than or equal to 100."; + } + + 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 searchableAttributes + * + * @return string[]|null + */ + public function getSearchableAttributes() + { + return $this->container['searchableAttributes']; + } + + /** + * Sets searchableAttributes + * + * @param string[]|null $searchableAttributes the complete list of attributes used for searching + * + * @return self + */ + public function setSearchableAttributes($searchableAttributes) + { + $this->container['searchableAttributes'] = $searchableAttributes; + + return $this; + } + + /** + * Gets attributesForFaceting + * + * @return string[]|null + */ + public function getAttributesForFaceting() + { + return $this->container['attributesForFaceting']; + } + + /** + * Sets attributesForFaceting + * + * @param string[]|null $attributesForFaceting the complete list of attributes that will be used for faceting + * + * @return self + */ + public function setAttributesForFaceting($attributesForFaceting) + { + $this->container['attributesForFaceting'] = $attributesForFaceting; + + return $this; + } + + /** + * Gets unretrievableAttributes + * + * @return string[]|null + */ + public function getUnretrievableAttributes() + { + return $this->container['unretrievableAttributes']; + } + + /** + * Sets unretrievableAttributes + * + * @param string[]|null $unretrievableAttributes list of attributes that can't be retrieved at query time + * + * @return self + */ + public function setUnretrievableAttributes($unretrievableAttributes) + { + $this->container['unretrievableAttributes'] = $unretrievableAttributes; + + return $this; + } + + /** + * Gets attributesToRetrieve + * + * @return string[]|null + */ + public function getAttributesToRetrieve() + { + return $this->container['attributesToRetrieve']; + } + + /** + * Sets attributesToRetrieve + * + * @param string[]|null $attributesToRetrieve this parameter controls which attributes to retrieve and which not to retrieve + * + * @return self + */ + public function setAttributesToRetrieve($attributesToRetrieve) + { + $this->container['attributesToRetrieve'] = $attributesToRetrieve; + + return $this; + } + + /** + * Gets restrictSearchableAttributes + * + * @return string[]|null + */ + public function getRestrictSearchableAttributes() + { + return $this->container['restrictSearchableAttributes']; + } + + /** + * Sets restrictSearchableAttributes + * + * @param string[]|null $restrictSearchableAttributes restricts a given query to look in only a subset of your searchable attributes + * + * @return self + */ + public function setRestrictSearchableAttributes($restrictSearchableAttributes) + { + $this->container['restrictSearchableAttributes'] = $restrictSearchableAttributes; + + return $this; + } + + /** + * Gets ranking + * + * @return string[]|null + */ + public function getRanking() + { + return $this->container['ranking']; + } + + /** + * Sets ranking + * + * @param string[]|null $ranking controls how Algolia should sort your results + * + * @return self + */ + public function setRanking($ranking) + { + $this->container['ranking'] = $ranking; + + return $this; + } + + /** + * Gets customRanking + * + * @return string[]|null + */ + public function getCustomRanking() + { + return $this->container['customRanking']; + } + + /** + * Sets customRanking + * + * @param string[]|null $customRanking specifies the custom ranking criterion + * + * @return self + */ + public function setCustomRanking($customRanking) + { + $this->container['customRanking'] = $customRanking; + + return $this; + } + + /** + * Gets relevancyStrictness + * + * @return int|null + */ + public function getRelevancyStrictness() + { + return $this->container['relevancyStrictness']; + } + + /** + * Sets relevancyStrictness + * + * @param int|null $relevancyStrictness controls the relevancy threshold below which less relevant results aren't included in the results + * + * @return self + */ + public function setRelevancyStrictness($relevancyStrictness) + { + $this->container['relevancyStrictness'] = $relevancyStrictness; + + return $this; + } + + /** + * Gets attributesToHighlight + * + * @return string[]|null + */ + public function getAttributesToHighlight() + { + return $this->container['attributesToHighlight']; + } + + /** + * Sets attributesToHighlight + * + * @param string[]|null $attributesToHighlight list of attributes to highlight + * + * @return self + */ + public function setAttributesToHighlight($attributesToHighlight) + { + $this->container['attributesToHighlight'] = $attributesToHighlight; + + return $this; + } + + /** + * Gets attributesToSnippet + * + * @return string[]|null + */ + public function getAttributesToSnippet() + { + return $this->container['attributesToSnippet']; + } + + /** + * Sets attributesToSnippet + * + * @param string[]|null $attributesToSnippet list of attributes to snippet, with an optional maximum number of words to snippet + * + * @return self + */ + public function setAttributesToSnippet($attributesToSnippet) + { + $this->container['attributesToSnippet'] = $attributesToSnippet; + + return $this; + } + + /** + * Gets highlightPreTag + * + * @return string|null + */ + public function getHighlightPreTag() + { + return $this->container['highlightPreTag']; + } + + /** + * Sets highlightPreTag + * + * @param string|null $highlightPreTag the HTML string to insert before the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPreTag($highlightPreTag) + { + $this->container['highlightPreTag'] = $highlightPreTag; + + return $this; + } + + /** + * Gets highlightPostTag + * + * @return string|null + */ + public function getHighlightPostTag() + { + return $this->container['highlightPostTag']; + } + + /** + * Sets highlightPostTag + * + * @param string|null $highlightPostTag the HTML string to insert after the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPostTag($highlightPostTag) + { + $this->container['highlightPostTag'] = $highlightPostTag; + + return $this; + } + + /** + * Gets snippetEllipsisText + * + * @return string|null + */ + public function getSnippetEllipsisText() + { + return $this->container['snippetEllipsisText']; + } + + /** + * Sets snippetEllipsisText + * + * @param string|null $snippetEllipsisText string used as an ellipsis indicator when a snippet is truncated + * + * @return self + */ + public function setSnippetEllipsisText($snippetEllipsisText) + { + $this->container['snippetEllipsisText'] = $snippetEllipsisText; + + return $this; + } + + /** + * Gets restrictHighlightAndSnippetArrays + * + * @return bool|null + */ + public function getRestrictHighlightAndSnippetArrays() + { + return $this->container['restrictHighlightAndSnippetArrays']; + } + + /** + * Sets restrictHighlightAndSnippetArrays + * + * @param bool|null $restrictHighlightAndSnippetArrays restrict highlighting and snippeting to items that matched the query + * + * @return self + */ + public function setRestrictHighlightAndSnippetArrays($restrictHighlightAndSnippetArrays) + { + $this->container['restrictHighlightAndSnippetArrays'] = $restrictHighlightAndSnippetArrays; + + return $this; + } + + /** + * Gets hitsPerPage + * + * @return int|null + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int|null $hitsPerPage set the number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Gets minWordSizefor1Typo + * + * @return int|null + */ + public function getMinWordSizefor1Typo() + { + return $this->container['minWordSizefor1Typo']; + } + + /** + * Sets minWordSizefor1Typo + * + * @param int|null $minWordSizefor1Typo minimum number of characters a word in the query string must contain to accept matches with 1 typo + * + * @return self + */ + public function setMinWordSizefor1Typo($minWordSizefor1Typo) + { + $this->container['minWordSizefor1Typo'] = $minWordSizefor1Typo; + + return $this; + } + + /** + * Gets minWordSizefor2Typos + * + * @return int|null + */ + public function getMinWordSizefor2Typos() + { + return $this->container['minWordSizefor2Typos']; + } + + /** + * Sets minWordSizefor2Typos + * + * @param int|null $minWordSizefor2Typos minimum number of characters a word in the query string must contain to accept matches with 2 typos + * + * @return self + */ + public function setMinWordSizefor2Typos($minWordSizefor2Typos) + { + $this->container['minWordSizefor2Typos'] = $minWordSizefor2Typos; + + return $this; + } + + /** + * Gets typoTolerance + * + * @return string|null + */ + public function getTypoTolerance() + { + return $this->container['typoTolerance']; + } + + /** + * Sets typoTolerance + * + * @param string|null $typoTolerance controls whether typo tolerance is enabled and how it is applied + * + * @return self + */ + public function setTypoTolerance($typoTolerance) + { + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($typoTolerance) && !in_array($typoTolerance, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'typoTolerance', must be one of '%s'", + $typoTolerance, + implode("', '", $allowedValues) + ) + ); + } + $this->container['typoTolerance'] = $typoTolerance; + + return $this; + } + + /** + * Gets allowTyposOnNumericTokens + * + * @return bool|null + */ + public function getAllowTyposOnNumericTokens() + { + return $this->container['allowTyposOnNumericTokens']; + } + + /** + * Sets allowTyposOnNumericTokens + * + * @param bool|null $allowTyposOnNumericTokens whether to allow typos on numbers (\"numeric tokens\") in the query string + * + * @return self + */ + public function setAllowTyposOnNumericTokens($allowTyposOnNumericTokens) + { + $this->container['allowTyposOnNumericTokens'] = $allowTyposOnNumericTokens; + + return $this; + } + + /** + * Gets disableTypoToleranceOnAttributes + * + * @return string[]|null + */ + public function getDisableTypoToleranceOnAttributes() + { + return $this->container['disableTypoToleranceOnAttributes']; + } + + /** + * Sets disableTypoToleranceOnAttributes + * + * @param string[]|null $disableTypoToleranceOnAttributes list of attributes on which you want to disable typo tolerance + * + * @return self + */ + public function setDisableTypoToleranceOnAttributes($disableTypoToleranceOnAttributes) + { + $this->container['disableTypoToleranceOnAttributes'] = $disableTypoToleranceOnAttributes; + + return $this; + } + + /** + * Gets separatorsToIndex + * + * @return string|null + */ + public function getSeparatorsToIndex() + { + return $this->container['separatorsToIndex']; + } + + /** + * Sets separatorsToIndex + * + * @param string|null $separatorsToIndex control which separators are indexed + * + * @return self + */ + public function setSeparatorsToIndex($separatorsToIndex) + { + $this->container['separatorsToIndex'] = $separatorsToIndex; + + return $this; + } + + /** + * Gets ignorePlurals + * + * @return string|null + */ + public function getIgnorePlurals() + { + return $this->container['ignorePlurals']; + } + + /** + * Sets ignorePlurals + * + * @param string|null $ignorePlurals treats singular, plurals, and other forms of declensions as matching terms + * + * @return self + */ + public function setIgnorePlurals($ignorePlurals) + { + $this->container['ignorePlurals'] = $ignorePlurals; + + return $this; + } + + /** + * Gets removeStopWords + * + * @return string|null + */ + public function getRemoveStopWords() + { + return $this->container['removeStopWords']; + } + + /** + * Sets removeStopWords + * + * @param string|null $removeStopWords removes stop (common) words from the query before executing it + * + * @return self + */ + public function setRemoveStopWords($removeStopWords) + { + $this->container['removeStopWords'] = $removeStopWords; + + return $this; + } + + /** + * Gets keepDiacriticsOnCharacters + * + * @return string|null + */ + public function getKeepDiacriticsOnCharacters() + { + return $this->container['keepDiacriticsOnCharacters']; + } + + /** + * Sets keepDiacriticsOnCharacters + * + * @param string|null $keepDiacriticsOnCharacters list of characters that the engine shouldn't automatically normalize + * + * @return self + */ + public function setKeepDiacriticsOnCharacters($keepDiacriticsOnCharacters) + { + $this->container['keepDiacriticsOnCharacters'] = $keepDiacriticsOnCharacters; + + return $this; + } + + /** + * Gets queryLanguages + * + * @return string[]|null + */ + public function getQueryLanguages() + { + return $this->container['queryLanguages']; + } + + /** + * Sets queryLanguages + * + * @param string[]|null $queryLanguages sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection + * + * @return self + */ + public function setQueryLanguages($queryLanguages) + { + $this->container['queryLanguages'] = $queryLanguages; + + return $this; + } + + /** + * Gets decompoundQuery + * + * @return bool|null + */ + public function getDecompoundQuery() + { + return $this->container['decompoundQuery']; + } + + /** + * Sets decompoundQuery + * + * @param bool|null $decompoundQuery splits compound words into their composing atoms in the query + * + * @return self + */ + public function setDecompoundQuery($decompoundQuery) + { + $this->container['decompoundQuery'] = $decompoundQuery; + + return $this; + } + + /** + * Gets enableRules + * + * @return bool|null + */ + public function getEnableRules() + { + return $this->container['enableRules']; + } + + /** + * Sets enableRules + * + * @param bool|null $enableRules whether Rules should be globally enabled + * + * @return self + */ + public function setEnableRules($enableRules) + { + $this->container['enableRules'] = $enableRules; + + return $this; + } + + /** + * Gets enablePersonalization + * + * @return bool|null + */ + public function getEnablePersonalization() + { + return $this->container['enablePersonalization']; + } + + /** + * Sets enablePersonalization + * + * @param bool|null $enablePersonalization enable the Personalization feature + * + * @return self + */ + public function setEnablePersonalization($enablePersonalization) + { + $this->container['enablePersonalization'] = $enablePersonalization; + + return $this; + } + + /** + * Gets queryType + * + * @return string|null + */ + public function getQueryType() + { + return $this->container['queryType']; + } + + /** + * Sets queryType + * + * @param string|null $queryType controls if and how query words are interpreted as prefixes + * + * @return self + */ + public function setQueryType($queryType) + { + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($queryType) && !in_array($queryType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'queryType', must be one of '%s'", + $queryType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['queryType'] = $queryType; + + return $this; + } + + /** + * Gets removeWordsIfNoResults + * + * @return string|null + */ + public function getRemoveWordsIfNoResults() + { + return $this->container['removeWordsIfNoResults']; + } + + /** + * Sets removeWordsIfNoResults + * + * @param string|null $removeWordsIfNoResults selects a strategy to remove words from the query when it doesn't match any hits + * + * @return self + */ + public function setRemoveWordsIfNoResults($removeWordsIfNoResults) + { + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($removeWordsIfNoResults) && !in_array($removeWordsIfNoResults, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $removeWordsIfNoResults, + implode("', '", $allowedValues) + ) + ); + } + $this->container['removeWordsIfNoResults'] = $removeWordsIfNoResults; + + return $this; + } + + /** + * Gets advancedSyntax + * + * @return bool|null + */ + public function getAdvancedSyntax() + { + return $this->container['advancedSyntax']; + } + + /** + * Sets advancedSyntax + * + * @param bool|null $advancedSyntax enables the advanced query syntax + * + * @return self + */ + public function setAdvancedSyntax($advancedSyntax) + { + $this->container['advancedSyntax'] = $advancedSyntax; + + return $this; + } + + /** + * Gets optionalWords + * + * @return string[]|null + */ + public function getOptionalWords() + { + return $this->container['optionalWords']; + } + + /** + * Sets optionalWords + * + * @param string[]|null $optionalWords a list of words that should be considered as optional when found in the query + * + * @return self + */ + public function setOptionalWords($optionalWords) + { + $this->container['optionalWords'] = $optionalWords; + + return $this; + } + + /** + * Gets disableExactOnAttributes + * + * @return string[]|null + */ + public function getDisableExactOnAttributes() + { + return $this->container['disableExactOnAttributes']; + } + + /** + * Sets disableExactOnAttributes + * + * @param string[]|null $disableExactOnAttributes list of attributes on which you want to disable the exact ranking criterion + * + * @return self + */ + public function setDisableExactOnAttributes($disableExactOnAttributes) + { + $this->container['disableExactOnAttributes'] = $disableExactOnAttributes; + + return $this; + } + + /** + * Gets exactOnSingleWordQuery + * + * @return string|null + */ + public function getExactOnSingleWordQuery() + { + return $this->container['exactOnSingleWordQuery']; + } + + /** + * Sets exactOnSingleWordQuery + * + * @param string|null $exactOnSingleWordQuery controls how the exact ranking criterion is computed when the query contains only one word + * + * @return self + */ + public function setExactOnSingleWordQuery($exactOnSingleWordQuery) + { + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($exactOnSingleWordQuery) && !in_array($exactOnSingleWordQuery, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $exactOnSingleWordQuery, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exactOnSingleWordQuery'] = $exactOnSingleWordQuery; + + return $this; + } + + /** + * Gets alternativesAsExact + * + * @return string[]|null + */ + public function getAlternativesAsExact() + { + return $this->container['alternativesAsExact']; + } + + /** + * Sets alternativesAsExact + * + * @param string[]|null $alternativesAsExact list of alternatives that should be considered an exact match by the exact ranking criterion + * + * @return self + */ + public function setAlternativesAsExact($alternativesAsExact) + { + $allowedValues = $this->getAlternativesAsExactAllowableValues(); + if (!is_null($alternativesAsExact) && array_diff($alternativesAsExact, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternativesAsExact', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternativesAsExact'] = $alternativesAsExact; + + return $this; + } + + /** + * Gets advancedSyntaxFeatures + * + * @return string[]|null + */ + public function getAdvancedSyntaxFeatures() + { + return $this->container['advancedSyntaxFeatures']; + } + + /** + * Sets advancedSyntaxFeatures + * + * @param string[]|null $advancedSyntaxFeatures allows you to specify which advanced syntax features are active when ‘advancedSyntax' is enabled + * + * @return self + */ + public function setAdvancedSyntaxFeatures($advancedSyntaxFeatures) + { + $allowedValues = $this->getAdvancedSyntaxFeaturesAllowableValues(); + if (!is_null($advancedSyntaxFeatures) && array_diff($advancedSyntaxFeatures, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'advancedSyntaxFeatures', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['advancedSyntaxFeatures'] = $advancedSyntaxFeatures; + + return $this; + } + + /** + * Gets distinct + * + * @return int|null + */ + public function getDistinct() + { + return $this->container['distinct']; + } + + /** + * Sets distinct + * + * @param int|null $distinct enables de-duplication or grouping of results + * + * @return self + */ + public function setDistinct($distinct) + { + if (!is_null($distinct) && ($distinct > 4)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling IndexSettingsAsSearchParams., must be smaller than or equal to 4.'); + } + if (!is_null($distinct) && ($distinct < 0)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling IndexSettingsAsSearchParams., must be bigger than or equal to 0.'); + } + + $this->container['distinct'] = $distinct; + + return $this; + } + + /** + * Gets synonyms + * + * @return bool|null + */ + public function getSynonyms() + { + return $this->container['synonyms']; + } + + /** + * Sets synonyms + * + * @param bool|null $synonyms whether to take into account an index's synonyms for a particular search + * + * @return self + */ + public function setSynonyms($synonyms) + { + $this->container['synonyms'] = $synonyms; + + return $this; + } + + /** + * Gets replaceSynonymsInHighlight + * + * @return bool|null + */ + public function getReplaceSynonymsInHighlight() + { + return $this->container['replaceSynonymsInHighlight']; + } + + /** + * Sets replaceSynonymsInHighlight + * + * @param bool|null $replaceSynonymsInHighlight whether to highlight and snippet the original word that matches the synonym or the synonym itself + * + * @return self + */ + public function setReplaceSynonymsInHighlight($replaceSynonymsInHighlight) + { + $this->container['replaceSynonymsInHighlight'] = $replaceSynonymsInHighlight; + + return $this; + } + + /** + * Gets minProximity + * + * @return int|null + */ + public function getMinProximity() + { + return $this->container['minProximity']; + } + + /** + * Sets minProximity + * + * @param int|null $minProximity precision of the proximity ranking criterion + * + * @return self + */ + public function setMinProximity($minProximity) + { + if (!is_null($minProximity) && ($minProximity > 7)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling IndexSettingsAsSearchParams., must be smaller than or equal to 7.'); + } + if (!is_null($minProximity) && ($minProximity < 1)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling IndexSettingsAsSearchParams., must be bigger than or equal to 1.'); + } + + $this->container['minProximity'] = $minProximity; + + return $this; + } + + /** + * Gets responseFields + * + * @return string[]|null + */ + public function getResponseFields() + { + return $this->container['responseFields']; + } + + /** + * Sets responseFields + * + * @param string[]|null $responseFields Choose which fields to return in the API response. This parameters applies to search and browse queries. + * + * @return self + */ + public function setResponseFields($responseFields) + { + $this->container['responseFields'] = $responseFields; + + return $this; + } + + /** + * Gets maxFacetHits + * + * @return int|null + */ + public function getMaxFacetHits() + { + return $this->container['maxFacetHits']; + } + + /** + * Sets maxFacetHits + * + * @param int|null $maxFacetHits Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. + * + * @return self + */ + public function setMaxFacetHits($maxFacetHits) + { + if (!is_null($maxFacetHits) && ($maxFacetHits > 100)) { + throw new \InvalidArgumentException('invalid value for $maxFacetHits when calling IndexSettingsAsSearchParams., must be smaller than or equal to 100.'); + } + + $this->container['maxFacetHits'] = $maxFacetHits; + + return $this; + } + + /** + * Gets attributeCriteriaComputedByMinProximity + * + * @return bool|null + */ + public function getAttributeCriteriaComputedByMinProximity() + { + return $this->container['attributeCriteriaComputedByMinProximity']; + } + + /** + * Sets attributeCriteriaComputedByMinProximity + * + * @param bool|null $attributeCriteriaComputedByMinProximity when attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage + * + * @return self + */ + public function setAttributeCriteriaComputedByMinProximity($attributeCriteriaComputedByMinProximity) + { + $this->container['attributeCriteriaComputedByMinProximity'] = $attributeCriteriaComputedByMinProximity; + + return $this; + } + + /** + * Gets renderingContent + * + * @return object|null + */ + public function getRenderingContent() + { + return $this->container['renderingContent']; + } + + /** + * Sets renderingContent + * + * @param object|null $renderingContent Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * + * @return self + */ + public function setRenderingContent($renderingContent) + { + $this->container['renderingContent'] = $renderingContent; + + 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/Recommend/ModelInterface.php b/clients/algoliasearch-client-php/lib/Model/Recommend/ModelInterface.php new file mode 100644 index 0000000000..124b81ee45 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/ModelInterface.php @@ -0,0 +1,68 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RankingInfo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'rankingInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'filters' => 'int', + 'firstMatchedWord' => 'int', + 'geoDistance' => 'int', + 'geoPrecision' => 'int', + 'matchedGeoLocation' => 'array', + 'nbExactWords' => 'int', + 'nbTypos' => 'int', + 'promoted' => 'bool', + 'proximityDistance' => 'int', + 'userScore' => 'int', + 'word' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'filters' => null, + 'firstMatchedWord' => null, + 'geoDistance' => null, + 'geoPrecision' => null, + 'matchedGeoLocation' => null, + 'nbExactWords' => null, + 'nbTypos' => null, + 'promoted' => null, + 'proximityDistance' => null, + 'userScore' => null, + 'word' => 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 = [ + 'filters' => 'filters', + 'firstMatchedWord' => 'firstMatchedWord', + 'geoDistance' => 'geoDistance', + 'geoPrecision' => 'geoPrecision', + 'matchedGeoLocation' => 'matchedGeoLocation', + 'nbExactWords' => 'nbExactWords', + 'nbTypos' => 'nbTypos', + 'promoted' => 'promoted', + 'proximityDistance' => 'proximityDistance', + 'userScore' => 'userScore', + 'word' => 'word', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'filters' => 'setFilters', + 'firstMatchedWord' => 'setFirstMatchedWord', + 'geoDistance' => 'setGeoDistance', + 'geoPrecision' => 'setGeoPrecision', + 'matchedGeoLocation' => 'setMatchedGeoLocation', + 'nbExactWords' => 'setNbExactWords', + 'nbTypos' => 'setNbTypos', + 'promoted' => 'setPromoted', + 'proximityDistance' => 'setProximityDistance', + 'userScore' => 'setUserScore', + 'word' => 'setWord', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'filters' => 'getFilters', + 'firstMatchedWord' => 'getFirstMatchedWord', + 'geoDistance' => 'getGeoDistance', + 'geoPrecision' => 'getGeoPrecision', + 'matchedGeoLocation' => 'getMatchedGeoLocation', + 'nbExactWords' => 'getNbExactWords', + 'nbTypos' => 'getNbTypos', + 'promoted' => 'getPromoted', + 'proximityDistance' => 'getProximityDistance', + 'userScore' => 'getUserScore', + 'word' => 'getWord', + ]; + + /** + * 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['filters'] = $data['filters'] ?? null; + $this->container['firstMatchedWord'] = $data['firstMatchedWord'] ?? null; + $this->container['geoDistance'] = $data['geoDistance'] ?? null; + $this->container['geoPrecision'] = $data['geoPrecision'] ?? null; + $this->container['matchedGeoLocation'] = $data['matchedGeoLocation'] ?? null; + $this->container['nbExactWords'] = $data['nbExactWords'] ?? null; + $this->container['nbTypos'] = $data['nbTypos'] ?? null; + $this->container['promoted'] = $data['promoted'] ?? null; + $this->container['proximityDistance'] = $data['proximityDistance'] ?? null; + $this->container['userScore'] = $data['userScore'] ?? null; + $this->container['word'] = $data['word'] ?? 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 filters + * + * @return int|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param int|null $filters this field is reserved for advanced usage + * + * @return self + */ + public function setFilters($filters) + { + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets firstMatchedWord + * + * @return int|null + */ + public function getFirstMatchedWord() + { + return $this->container['firstMatchedWord']; + } + + /** + * Sets firstMatchedWord + * + * @param int|null $firstMatchedWord position of the most important matched attribute in the attributes to index list + * + * @return self + */ + public function setFirstMatchedWord($firstMatchedWord) + { + $this->container['firstMatchedWord'] = $firstMatchedWord; + + return $this; + } + + /** + * Gets geoDistance + * + * @return int|null + */ + public function getGeoDistance() + { + return $this->container['geoDistance']; + } + + /** + * Sets geoDistance + * + * @param int|null $geoDistance distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters) + * + * @return self + */ + public function setGeoDistance($geoDistance) + { + $this->container['geoDistance'] = $geoDistance; + + return $this; + } + + /** + * Gets geoPrecision + * + * @return int|null + */ + public function getGeoPrecision() + { + return $this->container['geoPrecision']; + } + + /** + * Sets geoPrecision + * + * @param int|null $geoPrecision precision used when computing the geo distance, in meters + * + * @return self + */ + public function setGeoPrecision($geoPrecision) + { + $this->container['geoPrecision'] = $geoPrecision; + + return $this; + } + + /** + * Gets matchedGeoLocation + * + * @return array|null + */ + public function getMatchedGeoLocation() + { + return $this->container['matchedGeoLocation']; + } + + /** + * Sets matchedGeoLocation + * + * @param array|null $matchedGeoLocation matchedGeoLocation + * + * @return self + */ + public function setMatchedGeoLocation($matchedGeoLocation) + { + $this->container['matchedGeoLocation'] = $matchedGeoLocation; + + return $this; + } + + /** + * Gets nbExactWords + * + * @return int|null + */ + public function getNbExactWords() + { + return $this->container['nbExactWords']; + } + + /** + * Sets nbExactWords + * + * @param int|null $nbExactWords number of exactly matched words + * + * @return self + */ + public function setNbExactWords($nbExactWords) + { + $this->container['nbExactWords'] = $nbExactWords; + + return $this; + } + + /** + * Gets nbTypos + * + * @return int|null + */ + public function getNbTypos() + { + return $this->container['nbTypos']; + } + + /** + * Sets nbTypos + * + * @param int|null $nbTypos number of typos encountered when matching the record + * + * @return self + */ + public function setNbTypos($nbTypos) + { + $this->container['nbTypos'] = $nbTypos; + + return $this; + } + + /** + * Gets promoted + * + * @return bool|null + */ + public function getPromoted() + { + return $this->container['promoted']; + } + + /** + * Sets promoted + * + * @param bool|null $promoted present and set to true if a Rule promoted the hit + * + * @return self + */ + public function setPromoted($promoted) + { + $this->container['promoted'] = $promoted; + + return $this; + } + + /** + * Gets proximityDistance + * + * @return int|null + */ + public function getProximityDistance() + { + return $this->container['proximityDistance']; + } + + /** + * Sets proximityDistance + * + * @param int|null $proximityDistance when the query contains more than one word, the sum of the distances between matched words (in meters) + * + * @return self + */ + public function setProximityDistance($proximityDistance) + { + $this->container['proximityDistance'] = $proximityDistance; + + return $this; + } + + /** + * Gets userScore + * + * @return int|null + */ + public function getUserScore() + { + return $this->container['userScore']; + } + + /** + * Sets userScore + * + * @param int|null $userScore custom ranking for the object, expressed as a single integer value + * + * @return self + */ + public function setUserScore($userScore) + { + $this->container['userScore'] = $userScore; + + return $this; + } + + /** + * Gets word + * + * @return int|null + */ + public function getWord() + { + return $this->container['word']; + } + + /** + * Sets word + * + * @param int|null $word number of matched words, including prefixes and typos + * + * @return self + */ + public function setWord($word) + { + $this->container['word'] = $word; + + 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/Recommend/RankingInfoMatchedGeoLocation.php b/clients/algoliasearch-client-php/lib/Model/Recommend/RankingInfoMatchedGeoLocation.php new file mode 100644 index 0000000000..770ad75ff7 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/RankingInfoMatchedGeoLocation.php @@ -0,0 +1,350 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RankingInfoMatchedGeoLocation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'rankingInfo_matchedGeoLocation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'lat' => 'double', + 'lng' => 'double', + 'distance' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'lat' => 'double', + 'lng' => 'double', + 'distance' => 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 = [ + 'lat' => 'lat', + 'lng' => 'lng', + 'distance' => 'distance', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'lat' => 'setLat', + 'lng' => 'setLng', + 'distance' => 'setDistance', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'lat' => 'getLat', + 'lng' => 'getLng', + 'distance' => 'getDistance', + ]; + + /** + * 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['lat'] = $data['lat'] ?? null; + $this->container['lng'] = $data['lng'] ?? null; + $this->container['distance'] = $data['distance'] ?? 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 lat + * + * @return float|null + */ + public function getLat() + { + return $this->container['lat']; + } + + /** + * Sets lat + * + * @param float|null $lat latitude of the matched location + * + * @return self + */ + public function setLat($lat) + { + $this->container['lat'] = $lat; + + return $this; + } + + /** + * Gets lng + * + * @return float|null + */ + public function getLng() + { + return $this->container['lng']; + } + + /** + * Sets lng + * + * @param float|null $lng longitude of the matched location + * + * @return self + */ + public function setLng($lng) + { + $this->container['lng'] = $lng; + + return $this; + } + + /** + * Gets distance + * + * @return int|null + */ + public function getDistance() + { + return $this->container['distance']; + } + + /** + * Sets distance + * + * @param int|null $distance distance between the matched location and the search location (in meters) + * + * @return self + */ + public function setDistance($distance) + { + $this->container['distance'] = $distance; + + 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/Recommend/RecommendHit.php b/clients/algoliasearch-client-php/lib/Model/Recommend/RecommendHit.php new file mode 100644 index 0000000000..b4fc8f74f0 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/RecommendHit.php @@ -0,0 +1,463 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RecommendHit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'recommendHit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'objectID' => 'string', + 'highlightResult' => '\Algolia\AlgoliaSearch\Model\Recommend\HighlightResult', + 'snippetResult' => '\Algolia\AlgoliaSearch\Model\Recommend\SnippetResult', + 'rankingInfo' => '\Algolia\AlgoliaSearch\Model\Recommend\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\Recommend\HighlightResult|null + */ + public function getHighlightResult() + { + return $this->container['highlightResult']; + } + + /** + * Sets highlightResult + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\HighlightResult|null $highlightResult highlightResult + * + * @return self + */ + public function setHighlightResult($highlightResult) + { + $this->container['highlightResult'] = $highlightResult; + + return $this; + } + + /** + * Gets snippetResult + * + * @return \Algolia\AlgoliaSearch\Model\Recommend\SnippetResult|null + */ + public function getSnippetResult() + { + return $this->container['snippetResult']; + } + + /** + * Sets snippetResult + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\SnippetResult|null $snippetResult snippetResult + * + * @return self + */ + public function setSnippetResult($snippetResult) + { + $this->container['snippetResult'] = $snippetResult; + + return $this; + } + + /** + * Gets rankingInfo + * + * @return \Algolia\AlgoliaSearch\Model\Recommend\RankingInfo|null + */ + public function getRankingInfo() + { + return $this->container['rankingInfo']; + } + + /** + * Sets rankingInfo + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\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 RecommendHit., must be smaller than or equal to 100.'); + } + if (($score < 0)) { + throw new \InvalidArgumentException('invalid value for $score when calling RecommendHit., 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/Recommend/RecommendHits.php b/clients/algoliasearch-client-php/lib/Model/Recommend/RecommendHits.php new file mode 100644 index 0000000000..c4f66e5325 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/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\Recommend\RecommendHit[]', + ]; + + /** + * 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\Recommend\RecommendHit[]|null + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\RecommendHit[]|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/Recommend/RecommendationRequest.php b/clients/algoliasearch-client-php/lib/Model/Recommend/RecommendationRequest.php new file mode 100644 index 0000000000..8e6800bbec --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/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\Recommend\SearchParams', + 'fallbackParameters' => '\Algolia\AlgoliaSearch\Model\Recommend\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\Recommend\SearchParams|null + */ + public function getQueryParameters() + { + return $this->container['queryParameters']; + } + + /** + * Sets queryParameters + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\SearchParams|null $queryParameters queryParameters + * + * @return self + */ + public function setQueryParameters($queryParameters) + { + $this->container['queryParameters'] = $queryParameters; + + return $this; + } + + /** + * Gets fallbackParameters + * + * @return \Algolia\AlgoliaSearch\Model\Recommend\SearchParams|null + */ + public function getFallbackParameters() + { + return $this->container['fallbackParameters']; + } + + /** + * Sets fallbackParameters + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\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/Recommend/RecommendationsResponse.php b/clients/algoliasearch-client-php/lib/Model/Recommend/RecommendationsResponse.php new file mode 100644 index 0000000000..9aa697d6aa --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/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\Recommend\RecommendHit[]', + ]; + + /** + * 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\Recommend\RecommendHit[] + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\Recommend\RecommendHit[] $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/Recommend/RequiredSearchParams.php b/clients/algoliasearch-client-php/lib/Model/Recommend/RequiredSearchParams.php new file mode 100644 index 0000000000..332adc5732 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/RequiredSearchParams.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RequiredSearchParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'requiredSearchParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'query' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'query' => 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', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'query' => 'setQuery', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'query' => 'getQuery', + ]; + + /** + * 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'] ?? ''; + } + + /** + * 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"; + } + + 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 text to search in the index + * + * @return self + */ + public function setQuery($query) + { + $this->container['query'] = $query; + + 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/Recommend/SearchParams.php b/clients/algoliasearch-client-php/lib/Model/Recommend/SearchParams.php new file mode 100644 index 0000000000..870f3f6c51 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/SearchParams.php @@ -0,0 +1,2833 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'similarQuery' => 'string', + 'filters' => 'string', + 'facetFilters' => 'string[]', + 'optionalFilters' => 'string[]', + 'numericFilters' => 'string[]', + 'tagFilters' => 'string[]', + 'sumOrFiltersScores' => 'bool', + 'facets' => 'string[]', + 'maxValuesPerFacet' => 'int', + 'facetingAfterDistinct' => 'bool', + 'sortFacetValuesBy' => 'string', + 'page' => 'int', + 'offset' => 'int', + 'length' => 'int', + 'aroundLatLng' => 'string', + 'aroundLatLngViaIP' => 'bool', + 'aroundRadius' => 'OneOfIntegerString', + 'aroundPrecision' => 'int', + 'minimumAroundRadius' => 'int', + 'insideBoundingBox' => 'float[]', + 'insidePolygon' => 'float[]', + 'naturalLanguages' => 'string[]', + 'ruleContexts' => 'string[]', + 'personalizationImpact' => 'int', + 'userToken' => 'string', + 'getRankingInfo' => 'bool', + 'clickAnalytics' => 'bool', + 'analytics' => 'bool', + 'analyticsTags' => 'string[]', + 'percentileComputation' => 'bool', + 'enableABTest' => 'bool', + 'enableReRanking' => 'bool', + 'query' => 'string', + 'searchableAttributes' => 'string[]', + 'attributesForFaceting' => 'string[]', + 'unretrievableAttributes' => 'string[]', + 'attributesToRetrieve' => 'string[]', + 'restrictSearchableAttributes' => 'string[]', + 'ranking' => 'string[]', + 'customRanking' => 'string[]', + 'relevancyStrictness' => 'int', + 'attributesToHighlight' => 'string[]', + 'attributesToSnippet' => 'string[]', + 'highlightPreTag' => 'string', + 'highlightPostTag' => 'string', + 'snippetEllipsisText' => 'string', + 'restrictHighlightAndSnippetArrays' => 'bool', + 'hitsPerPage' => 'int', + 'minWordSizefor1Typo' => 'int', + 'minWordSizefor2Typos' => 'int', + 'typoTolerance' => 'string', + 'allowTyposOnNumericTokens' => 'bool', + 'disableTypoToleranceOnAttributes' => 'string[]', + 'separatorsToIndex' => 'string', + 'ignorePlurals' => 'string', + 'removeStopWords' => 'string', + 'keepDiacriticsOnCharacters' => 'string', + 'queryLanguages' => 'string[]', + 'decompoundQuery' => 'bool', + 'enableRules' => 'bool', + 'enablePersonalization' => 'bool', + 'queryType' => 'string', + 'removeWordsIfNoResults' => 'string', + 'advancedSyntax' => 'bool', + 'optionalWords' => 'string[]', + 'disableExactOnAttributes' => 'string[]', + 'exactOnSingleWordQuery' => 'string', + 'alternativesAsExact' => 'string[]', + 'advancedSyntaxFeatures' => 'string[]', + 'distinct' => 'int', + 'synonyms' => 'bool', + 'replaceSynonymsInHighlight' => 'bool', + 'minProximity' => 'int', + 'responseFields' => 'string[]', + 'maxFacetHits' => 'int', + 'attributeCriteriaComputedByMinProximity' => 'bool', + 'renderingContent' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'similarQuery' => null, + 'filters' => null, + 'facetFilters' => null, + 'optionalFilters' => null, + 'numericFilters' => null, + 'tagFilters' => null, + 'sumOrFiltersScores' => null, + 'facets' => null, + 'maxValuesPerFacet' => null, + 'facetingAfterDistinct' => null, + 'sortFacetValuesBy' => null, + 'page' => null, + 'offset' => null, + 'length' => null, + 'aroundLatLng' => null, + 'aroundLatLngViaIP' => null, + 'aroundRadius' => null, + 'aroundPrecision' => null, + 'minimumAroundRadius' => null, + 'insideBoundingBox' => null, + 'insidePolygon' => null, + 'naturalLanguages' => null, + 'ruleContexts' => null, + 'personalizationImpact' => null, + 'userToken' => null, + 'getRankingInfo' => null, + 'clickAnalytics' => null, + 'analytics' => null, + 'analyticsTags' => null, + 'percentileComputation' => null, + 'enableABTest' => null, + 'enableReRanking' => null, + 'query' => null, + 'searchableAttributes' => null, + 'attributesForFaceting' => null, + 'unretrievableAttributes' => null, + 'attributesToRetrieve' => null, + 'restrictSearchableAttributes' => null, + 'ranking' => null, + 'customRanking' => null, + 'relevancyStrictness' => null, + 'attributesToHighlight' => null, + 'attributesToSnippet' => null, + 'highlightPreTag' => null, + 'highlightPostTag' => null, + 'snippetEllipsisText' => null, + 'restrictHighlightAndSnippetArrays' => null, + 'hitsPerPage' => null, + 'minWordSizefor1Typo' => null, + 'minWordSizefor2Typos' => null, + 'typoTolerance' => null, + 'allowTyposOnNumericTokens' => null, + 'disableTypoToleranceOnAttributes' => null, + 'separatorsToIndex' => null, + 'ignorePlurals' => null, + 'removeStopWords' => null, + 'keepDiacriticsOnCharacters' => null, + 'queryLanguages' => null, + 'decompoundQuery' => null, + 'enableRules' => null, + 'enablePersonalization' => null, + 'queryType' => null, + 'removeWordsIfNoResults' => null, + 'advancedSyntax' => null, + 'optionalWords' => null, + 'disableExactOnAttributes' => null, + 'exactOnSingleWordQuery' => null, + 'alternativesAsExact' => null, + 'advancedSyntaxFeatures' => null, + 'distinct' => null, + 'synonyms' => null, + 'replaceSynonymsInHighlight' => null, + 'minProximity' => null, + 'responseFields' => null, + 'maxFacetHits' => null, + 'attributeCriteriaComputedByMinProximity' => null, + 'renderingContent' => 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 = [ + 'similarQuery' => 'similarQuery', + 'filters' => 'filters', + 'facetFilters' => 'facetFilters', + 'optionalFilters' => 'optionalFilters', + 'numericFilters' => 'numericFilters', + 'tagFilters' => 'tagFilters', + 'sumOrFiltersScores' => 'sumOrFiltersScores', + 'facets' => 'facets', + 'maxValuesPerFacet' => 'maxValuesPerFacet', + 'facetingAfterDistinct' => 'facetingAfterDistinct', + 'sortFacetValuesBy' => 'sortFacetValuesBy', + 'page' => 'page', + 'offset' => 'offset', + 'length' => 'length', + 'aroundLatLng' => 'aroundLatLng', + 'aroundLatLngViaIP' => 'aroundLatLngViaIP', + 'aroundRadius' => 'aroundRadius', + 'aroundPrecision' => 'aroundPrecision', + 'minimumAroundRadius' => 'minimumAroundRadius', + 'insideBoundingBox' => 'insideBoundingBox', + 'insidePolygon' => 'insidePolygon', + 'naturalLanguages' => 'naturalLanguages', + 'ruleContexts' => 'ruleContexts', + 'personalizationImpact' => 'personalizationImpact', + 'userToken' => 'userToken', + 'getRankingInfo' => 'getRankingInfo', + 'clickAnalytics' => 'clickAnalytics', + 'analytics' => 'analytics', + 'analyticsTags' => 'analyticsTags', + 'percentileComputation' => 'percentileComputation', + 'enableABTest' => 'enableABTest', + 'enableReRanking' => 'enableReRanking', + 'query' => 'query', + 'searchableAttributes' => 'searchableAttributes', + 'attributesForFaceting' => 'attributesForFaceting', + 'unretrievableAttributes' => 'unretrievableAttributes', + 'attributesToRetrieve' => 'attributesToRetrieve', + 'restrictSearchableAttributes' => 'restrictSearchableAttributes', + 'ranking' => 'ranking', + 'customRanking' => 'customRanking', + 'relevancyStrictness' => 'relevancyStrictness', + 'attributesToHighlight' => 'attributesToHighlight', + 'attributesToSnippet' => 'attributesToSnippet', + 'highlightPreTag' => 'highlightPreTag', + 'highlightPostTag' => 'highlightPostTag', + 'snippetEllipsisText' => 'snippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'restrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'hitsPerPage', + 'minWordSizefor1Typo' => 'minWordSizefor1Typo', + 'minWordSizefor2Typos' => 'minWordSizefor2Typos', + 'typoTolerance' => 'typoTolerance', + 'allowTyposOnNumericTokens' => 'allowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'disableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'separatorsToIndex', + 'ignorePlurals' => 'ignorePlurals', + 'removeStopWords' => 'removeStopWords', + 'keepDiacriticsOnCharacters' => 'keepDiacriticsOnCharacters', + 'queryLanguages' => 'queryLanguages', + 'decompoundQuery' => 'decompoundQuery', + 'enableRules' => 'enableRules', + 'enablePersonalization' => 'enablePersonalization', + 'queryType' => 'queryType', + 'removeWordsIfNoResults' => 'removeWordsIfNoResults', + 'advancedSyntax' => 'advancedSyntax', + 'optionalWords' => 'optionalWords', + 'disableExactOnAttributes' => 'disableExactOnAttributes', + 'exactOnSingleWordQuery' => 'exactOnSingleWordQuery', + 'alternativesAsExact' => 'alternativesAsExact', + 'advancedSyntaxFeatures' => 'advancedSyntaxFeatures', + 'distinct' => 'distinct', + 'synonyms' => 'synonyms', + 'replaceSynonymsInHighlight' => 'replaceSynonymsInHighlight', + 'minProximity' => 'minProximity', + 'responseFields' => 'responseFields', + 'maxFacetHits' => 'maxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'attributeCriteriaComputedByMinProximity', + 'renderingContent' => 'renderingContent', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'similarQuery' => 'setSimilarQuery', + 'filters' => 'setFilters', + 'facetFilters' => 'setFacetFilters', + 'optionalFilters' => 'setOptionalFilters', + 'numericFilters' => 'setNumericFilters', + 'tagFilters' => 'setTagFilters', + 'sumOrFiltersScores' => 'setSumOrFiltersScores', + 'facets' => 'setFacets', + 'maxValuesPerFacet' => 'setMaxValuesPerFacet', + 'facetingAfterDistinct' => 'setFacetingAfterDistinct', + 'sortFacetValuesBy' => 'setSortFacetValuesBy', + 'page' => 'setPage', + 'offset' => 'setOffset', + 'length' => 'setLength', + 'aroundLatLng' => 'setAroundLatLng', + 'aroundLatLngViaIP' => 'setAroundLatLngViaIP', + 'aroundRadius' => 'setAroundRadius', + 'aroundPrecision' => 'setAroundPrecision', + 'minimumAroundRadius' => 'setMinimumAroundRadius', + 'insideBoundingBox' => 'setInsideBoundingBox', + 'insidePolygon' => 'setInsidePolygon', + 'naturalLanguages' => 'setNaturalLanguages', + 'ruleContexts' => 'setRuleContexts', + 'personalizationImpact' => 'setPersonalizationImpact', + 'userToken' => 'setUserToken', + 'getRankingInfo' => 'setGetRankingInfo', + 'clickAnalytics' => 'setClickAnalytics', + 'analytics' => 'setAnalytics', + 'analyticsTags' => 'setAnalyticsTags', + 'percentileComputation' => 'setPercentileComputation', + 'enableABTest' => 'setEnableABTest', + 'enableReRanking' => 'setEnableReRanking', + 'query' => 'setQuery', + 'searchableAttributes' => 'setSearchableAttributes', + 'attributesForFaceting' => 'setAttributesForFaceting', + 'unretrievableAttributes' => 'setUnretrievableAttributes', + 'attributesToRetrieve' => 'setAttributesToRetrieve', + 'restrictSearchableAttributes' => 'setRestrictSearchableAttributes', + 'ranking' => 'setRanking', + 'customRanking' => 'setCustomRanking', + 'relevancyStrictness' => 'setRelevancyStrictness', + 'attributesToHighlight' => 'setAttributesToHighlight', + 'attributesToSnippet' => 'setAttributesToSnippet', + 'highlightPreTag' => 'setHighlightPreTag', + 'highlightPostTag' => 'setHighlightPostTag', + 'snippetEllipsisText' => 'setSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'setRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'setHitsPerPage', + 'minWordSizefor1Typo' => 'setMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'setMinWordSizefor2Typos', + 'typoTolerance' => 'setTypoTolerance', + 'allowTyposOnNumericTokens' => 'setAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'setDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'setSeparatorsToIndex', + 'ignorePlurals' => 'setIgnorePlurals', + 'removeStopWords' => 'setRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'setKeepDiacriticsOnCharacters', + 'queryLanguages' => 'setQueryLanguages', + 'decompoundQuery' => 'setDecompoundQuery', + 'enableRules' => 'setEnableRules', + 'enablePersonalization' => 'setEnablePersonalization', + 'queryType' => 'setQueryType', + 'removeWordsIfNoResults' => 'setRemoveWordsIfNoResults', + 'advancedSyntax' => 'setAdvancedSyntax', + 'optionalWords' => 'setOptionalWords', + 'disableExactOnAttributes' => 'setDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'setExactOnSingleWordQuery', + 'alternativesAsExact' => 'setAlternativesAsExact', + 'advancedSyntaxFeatures' => 'setAdvancedSyntaxFeatures', + 'distinct' => 'setDistinct', + 'synonyms' => 'setSynonyms', + 'replaceSynonymsInHighlight' => 'setReplaceSynonymsInHighlight', + 'minProximity' => 'setMinProximity', + 'responseFields' => 'setResponseFields', + 'maxFacetHits' => 'setMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'setAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'setRenderingContent', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'similarQuery' => 'getSimilarQuery', + 'filters' => 'getFilters', + 'facetFilters' => 'getFacetFilters', + 'optionalFilters' => 'getOptionalFilters', + 'numericFilters' => 'getNumericFilters', + 'tagFilters' => 'getTagFilters', + 'sumOrFiltersScores' => 'getSumOrFiltersScores', + 'facets' => 'getFacets', + 'maxValuesPerFacet' => 'getMaxValuesPerFacet', + 'facetingAfterDistinct' => 'getFacetingAfterDistinct', + 'sortFacetValuesBy' => 'getSortFacetValuesBy', + 'page' => 'getPage', + 'offset' => 'getOffset', + 'length' => 'getLength', + 'aroundLatLng' => 'getAroundLatLng', + 'aroundLatLngViaIP' => 'getAroundLatLngViaIP', + 'aroundRadius' => 'getAroundRadius', + 'aroundPrecision' => 'getAroundPrecision', + 'minimumAroundRadius' => 'getMinimumAroundRadius', + 'insideBoundingBox' => 'getInsideBoundingBox', + 'insidePolygon' => 'getInsidePolygon', + 'naturalLanguages' => 'getNaturalLanguages', + 'ruleContexts' => 'getRuleContexts', + 'personalizationImpact' => 'getPersonalizationImpact', + 'userToken' => 'getUserToken', + 'getRankingInfo' => 'getGetRankingInfo', + 'clickAnalytics' => 'getClickAnalytics', + 'analytics' => 'getAnalytics', + 'analyticsTags' => 'getAnalyticsTags', + 'percentileComputation' => 'getPercentileComputation', + 'enableABTest' => 'getEnableABTest', + 'enableReRanking' => 'getEnableReRanking', + 'query' => 'getQuery', + 'searchableAttributes' => 'getSearchableAttributes', + 'attributesForFaceting' => 'getAttributesForFaceting', + 'unretrievableAttributes' => 'getUnretrievableAttributes', + 'attributesToRetrieve' => 'getAttributesToRetrieve', + 'restrictSearchableAttributes' => 'getRestrictSearchableAttributes', + 'ranking' => 'getRanking', + 'customRanking' => 'getCustomRanking', + 'relevancyStrictness' => 'getRelevancyStrictness', + 'attributesToHighlight' => 'getAttributesToHighlight', + 'attributesToSnippet' => 'getAttributesToSnippet', + 'highlightPreTag' => 'getHighlightPreTag', + 'highlightPostTag' => 'getHighlightPostTag', + 'snippetEllipsisText' => 'getSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'getRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'getHitsPerPage', + 'minWordSizefor1Typo' => 'getMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'getMinWordSizefor2Typos', + 'typoTolerance' => 'getTypoTolerance', + 'allowTyposOnNumericTokens' => 'getAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'getDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'getSeparatorsToIndex', + 'ignorePlurals' => 'getIgnorePlurals', + 'removeStopWords' => 'getRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'getKeepDiacriticsOnCharacters', + 'queryLanguages' => 'getQueryLanguages', + 'decompoundQuery' => 'getDecompoundQuery', + 'enableRules' => 'getEnableRules', + 'enablePersonalization' => 'getEnablePersonalization', + 'queryType' => 'getQueryType', + 'removeWordsIfNoResults' => 'getRemoveWordsIfNoResults', + 'advancedSyntax' => 'getAdvancedSyntax', + 'optionalWords' => 'getOptionalWords', + 'disableExactOnAttributes' => 'getDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'getExactOnSingleWordQuery', + 'alternativesAsExact' => 'getAlternativesAsExact', + 'advancedSyntaxFeatures' => 'getAdvancedSyntaxFeatures', + 'distinct' => 'getDistinct', + 'synonyms' => 'getSynonyms', + 'replaceSynonymsInHighlight' => 'getReplaceSynonymsInHighlight', + 'minProximity' => 'getMinProximity', + 'responseFields' => 'getResponseFields', + 'maxFacetHits' => 'getMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'getAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'getRenderingContent', + ]; + + /** + * 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 TYPO_TOLERANCE_TRUE = 'true'; + const TYPO_TOLERANCE_FALSE = 'false'; + const TYPO_TOLERANCE_MIN = 'min'; + const TYPO_TOLERANCE_STRICT = 'strict'; + const QUERY_TYPE_PREFIX_LAST = 'prefixLast'; + const QUERY_TYPE_PREFIX_ALL = 'prefixAll'; + const QUERY_TYPE_PREFIX_NONE = 'prefixNone'; + const REMOVE_WORDS_IF_NO_RESULTS_NONE = 'none'; + const REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS = 'lastWords'; + const REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS = 'firstWords'; + const REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL = 'allOptional'; + const EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE = 'attribute'; + const EXACT_ON_SINGLE_WORD_QUERY_NONE = 'none'; + const EXACT_ON_SINGLE_WORD_QUERY_WORD = 'word'; + const ALTERNATIVES_AS_EXACT_IGNORE_PLURALS = 'ignorePlurals'; + const ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM = 'singleWordSynonym'; + const ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM = 'multiWordsSynonym'; + const ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE = 'exactPhrase'; + const ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS = 'excludeWords'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypoToleranceAllowableValues() + { + return [ + self::TYPO_TOLERANCE_TRUE, + self::TYPO_TOLERANCE_FALSE, + self::TYPO_TOLERANCE_MIN, + self::TYPO_TOLERANCE_STRICT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getQueryTypeAllowableValues() + { + return [ + self::QUERY_TYPE_PREFIX_LAST, + self::QUERY_TYPE_PREFIX_ALL, + self::QUERY_TYPE_PREFIX_NONE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRemoveWordsIfNoResultsAllowableValues() + { + return [ + self::REMOVE_WORDS_IF_NO_RESULTS_NONE, + self::REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExactOnSingleWordQueryAllowableValues() + { + return [ + self::EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE, + self::EXACT_ON_SINGLE_WORD_QUERY_NONE, + self::EXACT_ON_SINGLE_WORD_QUERY_WORD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativesAsExactAllowableValues() + { + return [ + self::ALTERNATIVES_AS_EXACT_IGNORE_PLURALS, + self::ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM, + self::ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAdvancedSyntaxFeaturesAllowableValues() + { + return [ + self::ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE, + self::ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS, + ]; + } + + /** + * 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['similarQuery'] = $data['similarQuery'] ?? ''; + $this->container['filters'] = $data['filters'] ?? ''; + $this->container['facetFilters'] = $data['facetFilters'] ?? null; + $this->container['optionalFilters'] = $data['optionalFilters'] ?? null; + $this->container['numericFilters'] = $data['numericFilters'] ?? null; + $this->container['tagFilters'] = $data['tagFilters'] ?? null; + $this->container['sumOrFiltersScores'] = $data['sumOrFiltersScores'] ?? false; + $this->container['facets'] = $data['facets'] ?? null; + $this->container['maxValuesPerFacet'] = $data['maxValuesPerFacet'] ?? 100; + $this->container['facetingAfterDistinct'] = $data['facetingAfterDistinct'] ?? false; + $this->container['sortFacetValuesBy'] = $data['sortFacetValuesBy'] ?? 'count'; + $this->container['page'] = $data['page'] ?? 0; + $this->container['offset'] = $data['offset'] ?? null; + $this->container['length'] = $data['length'] ?? null; + $this->container['aroundLatLng'] = $data['aroundLatLng'] ?? ''; + $this->container['aroundLatLngViaIP'] = $data['aroundLatLngViaIP'] ?? false; + $this->container['aroundRadius'] = $data['aroundRadius'] ?? null; + $this->container['aroundPrecision'] = $data['aroundPrecision'] ?? 10; + $this->container['minimumAroundRadius'] = $data['minimumAroundRadius'] ?? null; + $this->container['insideBoundingBox'] = $data['insideBoundingBox'] ?? null; + $this->container['insidePolygon'] = $data['insidePolygon'] ?? null; + $this->container['naturalLanguages'] = $data['naturalLanguages'] ?? null; + $this->container['ruleContexts'] = $data['ruleContexts'] ?? null; + $this->container['personalizationImpact'] = $data['personalizationImpact'] ?? 100; + $this->container['userToken'] = $data['userToken'] ?? null; + $this->container['getRankingInfo'] = $data['getRankingInfo'] ?? false; + $this->container['clickAnalytics'] = $data['clickAnalytics'] ?? false; + $this->container['analytics'] = $data['analytics'] ?? true; + $this->container['analyticsTags'] = $data['analyticsTags'] ?? null; + $this->container['percentileComputation'] = $data['percentileComputation'] ?? true; + $this->container['enableABTest'] = $data['enableABTest'] ?? true; + $this->container['enableReRanking'] = $data['enableReRanking'] ?? true; + $this->container['query'] = $data['query'] ?? ''; + $this->container['searchableAttributes'] = $data['searchableAttributes'] ?? null; + $this->container['attributesForFaceting'] = $data['attributesForFaceting'] ?? null; + $this->container['unretrievableAttributes'] = $data['unretrievableAttributes'] ?? null; + $this->container['attributesToRetrieve'] = $data['attributesToRetrieve'] ?? null; + $this->container['restrictSearchableAttributes'] = $data['restrictSearchableAttributes'] ?? null; + $this->container['ranking'] = $data['ranking'] ?? null; + $this->container['customRanking'] = $data['customRanking'] ?? null; + $this->container['relevancyStrictness'] = $data['relevancyStrictness'] ?? 100; + $this->container['attributesToHighlight'] = $data['attributesToHighlight'] ?? null; + $this->container['attributesToSnippet'] = $data['attributesToSnippet'] ?? null; + $this->container['highlightPreTag'] = $data['highlightPreTag'] ?? ''; + $this->container['highlightPostTag'] = $data['highlightPostTag'] ?? ''; + $this->container['snippetEllipsisText'] = $data['snippetEllipsisText'] ?? '…'; + $this->container['restrictHighlightAndSnippetArrays'] = $data['restrictHighlightAndSnippetArrays'] ?? false; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + $this->container['minWordSizefor1Typo'] = $data['minWordSizefor1Typo'] ?? 4; + $this->container['minWordSizefor2Typos'] = $data['minWordSizefor2Typos'] ?? 8; + $this->container['typoTolerance'] = $data['typoTolerance'] ?? 'true'; + $this->container['allowTyposOnNumericTokens'] = $data['allowTyposOnNumericTokens'] ?? true; + $this->container['disableTypoToleranceOnAttributes'] = $data['disableTypoToleranceOnAttributes'] ?? null; + $this->container['separatorsToIndex'] = $data['separatorsToIndex'] ?? ''; + $this->container['ignorePlurals'] = $data['ignorePlurals'] ?? 'false'; + $this->container['removeStopWords'] = $data['removeStopWords'] ?? 'false'; + $this->container['keepDiacriticsOnCharacters'] = $data['keepDiacriticsOnCharacters'] ?? ''; + $this->container['queryLanguages'] = $data['queryLanguages'] ?? null; + $this->container['decompoundQuery'] = $data['decompoundQuery'] ?? true; + $this->container['enableRules'] = $data['enableRules'] ?? true; + $this->container['enablePersonalization'] = $data['enablePersonalization'] ?? false; + $this->container['queryType'] = $data['queryType'] ?? 'prefixLast'; + $this->container['removeWordsIfNoResults'] = $data['removeWordsIfNoResults'] ?? 'none'; + $this->container['advancedSyntax'] = $data['advancedSyntax'] ?? false; + $this->container['optionalWords'] = $data['optionalWords'] ?? null; + $this->container['disableExactOnAttributes'] = $data['disableExactOnAttributes'] ?? null; + $this->container['exactOnSingleWordQuery'] = $data['exactOnSingleWordQuery'] ?? 'attribute'; + $this->container['alternativesAsExact'] = $data['alternativesAsExact'] ?? null; + $this->container['advancedSyntaxFeatures'] = $data['advancedSyntaxFeatures'] ?? null; + $this->container['distinct'] = $data['distinct'] ?? 0; + $this->container['synonyms'] = $data['synonyms'] ?? true; + $this->container['replaceSynonymsInHighlight'] = $data['replaceSynonymsInHighlight'] ?? false; + $this->container['minProximity'] = $data['minProximity'] ?? 1; + $this->container['responseFields'] = $data['responseFields'] ?? null; + $this->container['maxFacetHits'] = $data['maxFacetHits'] ?? 10; + $this->container['attributeCriteriaComputedByMinProximity'] = $data['attributeCriteriaComputedByMinProximity'] ?? false; + $this->container['renderingContent'] = $data['renderingContent'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['length']) && ($this->container['length'] > 1000)) { + $invalidProperties[] = "invalid value for 'length', must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['length']) && ($this->container['length'] < 1)) { + $invalidProperties[] = "invalid value for 'length', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['minimumAroundRadius']) && ($this->container['minimumAroundRadius'] < 1)) { + $invalidProperties[] = "invalid value for 'minimumAroundRadius', must be bigger than or equal to 1."; + } + + if ($this->container['query'] === null) { + $invalidProperties[] = "'query' can't be null"; + } + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($this->container['typoTolerance']) && !in_array($this->container['typoTolerance'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'typoTolerance', must be one of '%s'", + $this->container['typoTolerance'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($this->container['queryType']) && !in_array($this->container['queryType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'queryType', must be one of '%s'", + $this->container['queryType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($this->container['removeWordsIfNoResults']) && !in_array($this->container['removeWordsIfNoResults'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $this->container['removeWordsIfNoResults'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($this->container['exactOnSingleWordQuery']) && !in_array($this->container['exactOnSingleWordQuery'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $this->container['exactOnSingleWordQuery'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] > 4)) { + $invalidProperties[] = "invalid value for 'distinct', must be smaller than or equal to 4."; + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] < 0)) { + $invalidProperties[] = "invalid value for 'distinct', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] > 7)) { + $invalidProperties[] = "invalid value for 'minProximity', must be smaller than or equal to 7."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] < 1)) { + $invalidProperties[] = "invalid value for 'minProximity', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['maxFacetHits']) && ($this->container['maxFacetHits'] > 100)) { + $invalidProperties[] = "invalid value for 'maxFacetHits', must be smaller than or equal to 100."; + } + + 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 similarQuery + * + * @return string|null + */ + public function getSimilarQuery() + { + return $this->container['similarQuery']; + } + + /** + * Sets similarQuery + * + * @param string|null $similarQuery overrides the query parameter and performs a more generic search that can be used to find \"similar\" results + * + * @return self + */ + public function setSimilarQuery($similarQuery) + { + $this->container['similarQuery'] = $similarQuery; + + return $this; + } + + /** + * Gets filters + * + * @return string|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param string|null $filters filter the query with numeric, facet and/or tag filters + * + * @return self + */ + public function setFilters($filters) + { + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets facetFilters + * + * @return string[]|null + */ + public function getFacetFilters() + { + return $this->container['facetFilters']; + } + + /** + * Sets facetFilters + * + * @param string[]|null $facetFilters filter hits by facet value + * + * @return self + */ + public function setFacetFilters($facetFilters) + { + $this->container['facetFilters'] = $facetFilters; + + return $this; + } + + /** + * Gets optionalFilters + * + * @return string[]|null + */ + public function getOptionalFilters() + { + return $this->container['optionalFilters']; + } + + /** + * Sets optionalFilters + * + * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * + * @return self + */ + public function setOptionalFilters($optionalFilters) + { + $this->container['optionalFilters'] = $optionalFilters; + + return $this; + } + + /** + * Gets numericFilters + * + * @return string[]|null + */ + public function getNumericFilters() + { + return $this->container['numericFilters']; + } + + /** + * Sets numericFilters + * + * @param string[]|null $numericFilters filter on numeric attributes + * + * @return self + */ + public function setNumericFilters($numericFilters) + { + $this->container['numericFilters'] = $numericFilters; + + return $this; + } + + /** + * Gets tagFilters + * + * @return string[]|null + */ + public function getTagFilters() + { + return $this->container['tagFilters']; + } + + /** + * Sets tagFilters + * + * @param string[]|null $tagFilters filter hits by tags + * + * @return self + */ + public function setTagFilters($tagFilters) + { + $this->container['tagFilters'] = $tagFilters; + + return $this; + } + + /** + * Gets sumOrFiltersScores + * + * @return bool|null + */ + public function getSumOrFiltersScores() + { + return $this->container['sumOrFiltersScores']; + } + + /** + * Sets sumOrFiltersScores + * + * @param bool|null $sumOrFiltersScores determines how to calculate the total score for filtering + * + * @return self + */ + public function setSumOrFiltersScores($sumOrFiltersScores) + { + $this->container['sumOrFiltersScores'] = $sumOrFiltersScores; + + return $this; + } + + /** + * Gets facets + * + * @return string[]|null + */ + public function getFacets() + { + return $this->container['facets']; + } + + /** + * Sets facets + * + * @param string[]|null $facets retrieve facets and their facet values + * + * @return self + */ + public function setFacets($facets) + { + $this->container['facets'] = $facets; + + return $this; + } + + /** + * Gets maxValuesPerFacet + * + * @return int|null + */ + public function getMaxValuesPerFacet() + { + return $this->container['maxValuesPerFacet']; + } + + /** + * Sets maxValuesPerFacet + * + * @param int|null $maxValuesPerFacet maximum number of facet values to return for each facet during a regular search + * + * @return self + */ + public function setMaxValuesPerFacet($maxValuesPerFacet) + { + $this->container['maxValuesPerFacet'] = $maxValuesPerFacet; + + return $this; + } + + /** + * Gets facetingAfterDistinct + * + * @return bool|null + */ + public function getFacetingAfterDistinct() + { + return $this->container['facetingAfterDistinct']; + } + + /** + * Sets facetingAfterDistinct + * + * @param bool|null $facetingAfterDistinct force faceting to be applied after de-duplication (via the Distinct setting) + * + * @return self + */ + public function setFacetingAfterDistinct($facetingAfterDistinct) + { + $this->container['facetingAfterDistinct'] = $facetingAfterDistinct; + + return $this; + } + + /** + * Gets sortFacetValuesBy + * + * @return string|null + */ + public function getSortFacetValuesBy() + { + return $this->container['sortFacetValuesBy']; + } + + /** + * Sets sortFacetValuesBy + * + * @param string|null $sortFacetValuesBy controls how facet values are fetched + * + * @return self + */ + public function setSortFacetValuesBy($sortFacetValuesBy) + { + $this->container['sortFacetValuesBy'] = $sortFacetValuesBy; + + return $this; + } + + /** + * Gets page + * + * @return int|null + */ + public function getPage() + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param int|null $page specify the page to retrieve + * + * @return self + */ + public function setPage($page) + { + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets offset + * + * @return int|null + */ + public function getOffset() + { + return $this->container['offset']; + } + + /** + * Sets offset + * + * @param int|null $offset specify the offset of the first hit to return + * + * @return self + */ + public function setOffset($offset) + { + $this->container['offset'] = $offset; + + return $this; + } + + /** + * Gets length + * + * @return int|null + */ + public function getLength() + { + return $this->container['length']; + } + + /** + * Sets length + * + * @param int|null $length set the number of hits to retrieve (used only with offset) + * + * @return self + */ + public function setLength($length) + { + if (!is_null($length) && ($length > 1000)) { + throw new \InvalidArgumentException('invalid value for $length when calling SearchParams., must be smaller than or equal to 1000.'); + } + if (!is_null($length) && ($length < 1)) { + throw new \InvalidArgumentException('invalid value for $length when calling SearchParams., must be bigger than or equal to 1.'); + } + + $this->container['length'] = $length; + + return $this; + } + + /** + * Gets aroundLatLng + * + * @return string|null + */ + public function getAroundLatLng() + { + return $this->container['aroundLatLng']; + } + + /** + * Sets aroundLatLng + * + * @param string|null $aroundLatLng search for entries around a central geolocation, enabling a geo search within a circular area + * + * @return self + */ + public function setAroundLatLng($aroundLatLng) + { + $this->container['aroundLatLng'] = $aroundLatLng; + + return $this; + } + + /** + * Gets aroundLatLngViaIP + * + * @return bool|null + */ + public function getAroundLatLngViaIP() + { + return $this->container['aroundLatLngViaIP']; + } + + /** + * Sets aroundLatLngViaIP + * + * @param bool|null $aroundLatLngViaIP search for entries around a given location automatically computed from the requester's IP address + * + * @return self + */ + public function setAroundLatLngViaIP($aroundLatLngViaIP) + { + $this->container['aroundLatLngViaIP'] = $aroundLatLngViaIP; + + return $this; + } + + /** + * Gets aroundRadius + * + * @return OneOfIntegerString|null + */ + public function getAroundRadius() + { + return $this->container['aroundRadius']; + } + + /** + * Sets aroundRadius + * + * @param OneOfIntegerString|null $aroundRadius define the maximum radius for a geo search (in meters) + * + * @return self + */ + public function setAroundRadius($aroundRadius) + { + $this->container['aroundRadius'] = $aroundRadius; + + return $this; + } + + /** + * Gets aroundPrecision + * + * @return int|null + */ + public function getAroundPrecision() + { + return $this->container['aroundPrecision']; + } + + /** + * Sets aroundPrecision + * + * @param int|null $aroundPrecision precision of geo search (in meters), to add grouping by geo location to the ranking formula + * + * @return self + */ + public function setAroundPrecision($aroundPrecision) + { + $this->container['aroundPrecision'] = $aroundPrecision; + + return $this; + } + + /** + * Gets minimumAroundRadius + * + * @return int|null + */ + public function getMinimumAroundRadius() + { + return $this->container['minimumAroundRadius']; + } + + /** + * Sets minimumAroundRadius + * + * @param int|null $minimumAroundRadius minimum radius (in meters) used for a geo search when aroundRadius is not set + * + * @return self + */ + public function setMinimumAroundRadius($minimumAroundRadius) + { + if (!is_null($minimumAroundRadius) && ($minimumAroundRadius < 1)) { + throw new \InvalidArgumentException('invalid value for $minimumAroundRadius when calling SearchParams., must be bigger than or equal to 1.'); + } + + $this->container['minimumAroundRadius'] = $minimumAroundRadius; + + return $this; + } + + /** + * Gets insideBoundingBox + * + * @return float[]|null + */ + public function getInsideBoundingBox() + { + return $this->container['insideBoundingBox']; + } + + /** + * Sets insideBoundingBox + * + * @param float[]|null $insideBoundingBox search inside a rectangular area (in geo coordinates) + * + * @return self + */ + public function setInsideBoundingBox($insideBoundingBox) + { + $this->container['insideBoundingBox'] = $insideBoundingBox; + + return $this; + } + + /** + * Gets insidePolygon + * + * @return float[]|null + */ + public function getInsidePolygon() + { + return $this->container['insidePolygon']; + } + + /** + * Sets insidePolygon + * + * @param float[]|null $insidePolygon search inside a polygon (in geo coordinates) + * + * @return self + */ + public function setInsidePolygon($insidePolygon) + { + $this->container['insidePolygon'] = $insidePolygon; + + return $this; + } + + /** + * Gets naturalLanguages + * + * @return string[]|null + */ + public function getNaturalLanguages() + { + return $this->container['naturalLanguages']; + } + + /** + * Sets naturalLanguages + * + * @param string[]|null $naturalLanguages This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. + * + * @return self + */ + public function setNaturalLanguages($naturalLanguages) + { + $this->container['naturalLanguages'] = $naturalLanguages; + + return $this; + } + + /** + * Gets ruleContexts + * + * @return string[]|null + */ + public function getRuleContexts() + { + return $this->container['ruleContexts']; + } + + /** + * Sets ruleContexts + * + * @param string[]|null $ruleContexts enables contextual rules + * + * @return self + */ + public function setRuleContexts($ruleContexts) + { + $this->container['ruleContexts'] = $ruleContexts; + + return $this; + } + + /** + * Gets personalizationImpact + * + * @return int|null + */ + public function getPersonalizationImpact() + { + return $this->container['personalizationImpact']; + } + + /** + * Sets personalizationImpact + * + * @param int|null $personalizationImpact define the impact of the Personalization feature + * + * @return self + */ + public function setPersonalizationImpact($personalizationImpact) + { + $this->container['personalizationImpact'] = $personalizationImpact; + + return $this; + } + + /** + * Gets userToken + * + * @return string|null + */ + public function getUserToken() + { + return $this->container['userToken']; + } + + /** + * Sets userToken + * + * @param string|null $userToken associates a certain user token with the current search + * + * @return self + */ + public function setUserToken($userToken) + { + $this->container['userToken'] = $userToken; + + return $this; + } + + /** + * Gets getRankingInfo + * + * @return bool|null + */ + public function getGetRankingInfo() + { + return $this->container['getRankingInfo']; + } + + /** + * Sets getRankingInfo + * + * @param bool|null $getRankingInfo retrieve detailed ranking information + * + * @return self + */ + public function setGetRankingInfo($getRankingInfo) + { + $this->container['getRankingInfo'] = $getRankingInfo; + + return $this; + } + + /** + * Gets clickAnalytics + * + * @return bool|null + */ + public function getClickAnalytics() + { + return $this->container['clickAnalytics']; + } + + /** + * Sets clickAnalytics + * + * @param bool|null $clickAnalytics enable the Click Analytics feature + * + * @return self + */ + public function setClickAnalytics($clickAnalytics) + { + $this->container['clickAnalytics'] = $clickAnalytics; + + return $this; + } + + /** + * Gets analytics + * + * @return bool|null + */ + public function getAnalytics() + { + return $this->container['analytics']; + } + + /** + * Sets analytics + * + * @param bool|null $analytics whether the current query will be taken into account in the Analytics + * + * @return self + */ + public function setAnalytics($analytics) + { + $this->container['analytics'] = $analytics; + + return $this; + } + + /** + * Gets analyticsTags + * + * @return string[]|null + */ + public function getAnalyticsTags() + { + return $this->container['analyticsTags']; + } + + /** + * Sets analyticsTags + * + * @param string[]|null $analyticsTags list of tags to apply to the query for analytics purposes + * + * @return self + */ + public function setAnalyticsTags($analyticsTags) + { + $this->container['analyticsTags'] = $analyticsTags; + + return $this; + } + + /** + * Gets percentileComputation + * + * @return bool|null + */ + public function getPercentileComputation() + { + return $this->container['percentileComputation']; + } + + /** + * Sets percentileComputation + * + * @param bool|null $percentileComputation whether to include or exclude a query from the processing-time percentile computation + * + * @return self + */ + public function setPercentileComputation($percentileComputation) + { + $this->container['percentileComputation'] = $percentileComputation; + + return $this; + } + + /** + * Gets enableABTest + * + * @return bool|null + */ + public function getEnableABTest() + { + return $this->container['enableABTest']; + } + + /** + * Sets enableABTest + * + * @param bool|null $enableABTest whether this search should participate in running AB tests + * + * @return self + */ + public function setEnableABTest($enableABTest) + { + $this->container['enableABTest'] = $enableABTest; + + return $this; + } + + /** + * Gets enableReRanking + * + * @return bool|null + */ + public function getEnableReRanking() + { + return $this->container['enableReRanking']; + } + + /** + * Sets enableReRanking + * + * @param bool|null $enableReRanking whether this search should use AI Re-Ranking + * + * @return self + */ + public function setEnableReRanking($enableReRanking) + { + $this->container['enableReRanking'] = $enableReRanking; + + 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 searchableAttributes + * + * @return string[]|null + */ + public function getSearchableAttributes() + { + return $this->container['searchableAttributes']; + } + + /** + * Sets searchableAttributes + * + * @param string[]|null $searchableAttributes the complete list of attributes used for searching + * + * @return self + */ + public function setSearchableAttributes($searchableAttributes) + { + $this->container['searchableAttributes'] = $searchableAttributes; + + return $this; + } + + /** + * Gets attributesForFaceting + * + * @return string[]|null + */ + public function getAttributesForFaceting() + { + return $this->container['attributesForFaceting']; + } + + /** + * Sets attributesForFaceting + * + * @param string[]|null $attributesForFaceting the complete list of attributes that will be used for faceting + * + * @return self + */ + public function setAttributesForFaceting($attributesForFaceting) + { + $this->container['attributesForFaceting'] = $attributesForFaceting; + + return $this; + } + + /** + * Gets unretrievableAttributes + * + * @return string[]|null + */ + public function getUnretrievableAttributes() + { + return $this->container['unretrievableAttributes']; + } + + /** + * Sets unretrievableAttributes + * + * @param string[]|null $unretrievableAttributes list of attributes that can't be retrieved at query time + * + * @return self + */ + public function setUnretrievableAttributes($unretrievableAttributes) + { + $this->container['unretrievableAttributes'] = $unretrievableAttributes; + + return $this; + } + + /** + * Gets attributesToRetrieve + * + * @return string[]|null + */ + public function getAttributesToRetrieve() + { + return $this->container['attributesToRetrieve']; + } + + /** + * Sets attributesToRetrieve + * + * @param string[]|null $attributesToRetrieve this parameter controls which attributes to retrieve and which not to retrieve + * + * @return self + */ + public function setAttributesToRetrieve($attributesToRetrieve) + { + $this->container['attributesToRetrieve'] = $attributesToRetrieve; + + return $this; + } + + /** + * Gets restrictSearchableAttributes + * + * @return string[]|null + */ + public function getRestrictSearchableAttributes() + { + return $this->container['restrictSearchableAttributes']; + } + + /** + * Sets restrictSearchableAttributes + * + * @param string[]|null $restrictSearchableAttributes restricts a given query to look in only a subset of your searchable attributes + * + * @return self + */ + public function setRestrictSearchableAttributes($restrictSearchableAttributes) + { + $this->container['restrictSearchableAttributes'] = $restrictSearchableAttributes; + + return $this; + } + + /** + * Gets ranking + * + * @return string[]|null + */ + public function getRanking() + { + return $this->container['ranking']; + } + + /** + * Sets ranking + * + * @param string[]|null $ranking controls how Algolia should sort your results + * + * @return self + */ + public function setRanking($ranking) + { + $this->container['ranking'] = $ranking; + + return $this; + } + + /** + * Gets customRanking + * + * @return string[]|null + */ + public function getCustomRanking() + { + return $this->container['customRanking']; + } + + /** + * Sets customRanking + * + * @param string[]|null $customRanking specifies the custom ranking criterion + * + * @return self + */ + public function setCustomRanking($customRanking) + { + $this->container['customRanking'] = $customRanking; + + return $this; + } + + /** + * Gets relevancyStrictness + * + * @return int|null + */ + public function getRelevancyStrictness() + { + return $this->container['relevancyStrictness']; + } + + /** + * Sets relevancyStrictness + * + * @param int|null $relevancyStrictness controls the relevancy threshold below which less relevant results aren't included in the results + * + * @return self + */ + public function setRelevancyStrictness($relevancyStrictness) + { + $this->container['relevancyStrictness'] = $relevancyStrictness; + + return $this; + } + + /** + * Gets attributesToHighlight + * + * @return string[]|null + */ + public function getAttributesToHighlight() + { + return $this->container['attributesToHighlight']; + } + + /** + * Sets attributesToHighlight + * + * @param string[]|null $attributesToHighlight list of attributes to highlight + * + * @return self + */ + public function setAttributesToHighlight($attributesToHighlight) + { + $this->container['attributesToHighlight'] = $attributesToHighlight; + + return $this; + } + + /** + * Gets attributesToSnippet + * + * @return string[]|null + */ + public function getAttributesToSnippet() + { + return $this->container['attributesToSnippet']; + } + + /** + * Sets attributesToSnippet + * + * @param string[]|null $attributesToSnippet list of attributes to snippet, with an optional maximum number of words to snippet + * + * @return self + */ + public function setAttributesToSnippet($attributesToSnippet) + { + $this->container['attributesToSnippet'] = $attributesToSnippet; + + return $this; + } + + /** + * Gets highlightPreTag + * + * @return string|null + */ + public function getHighlightPreTag() + { + return $this->container['highlightPreTag']; + } + + /** + * Sets highlightPreTag + * + * @param string|null $highlightPreTag the HTML string to insert before the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPreTag($highlightPreTag) + { + $this->container['highlightPreTag'] = $highlightPreTag; + + return $this; + } + + /** + * Gets highlightPostTag + * + * @return string|null + */ + public function getHighlightPostTag() + { + return $this->container['highlightPostTag']; + } + + /** + * Sets highlightPostTag + * + * @param string|null $highlightPostTag the HTML string to insert after the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPostTag($highlightPostTag) + { + $this->container['highlightPostTag'] = $highlightPostTag; + + return $this; + } + + /** + * Gets snippetEllipsisText + * + * @return string|null + */ + public function getSnippetEllipsisText() + { + return $this->container['snippetEllipsisText']; + } + + /** + * Sets snippetEllipsisText + * + * @param string|null $snippetEllipsisText string used as an ellipsis indicator when a snippet is truncated + * + * @return self + */ + public function setSnippetEllipsisText($snippetEllipsisText) + { + $this->container['snippetEllipsisText'] = $snippetEllipsisText; + + return $this; + } + + /** + * Gets restrictHighlightAndSnippetArrays + * + * @return bool|null + */ + public function getRestrictHighlightAndSnippetArrays() + { + return $this->container['restrictHighlightAndSnippetArrays']; + } + + /** + * Sets restrictHighlightAndSnippetArrays + * + * @param bool|null $restrictHighlightAndSnippetArrays restrict highlighting and snippeting to items that matched the query + * + * @return self + */ + public function setRestrictHighlightAndSnippetArrays($restrictHighlightAndSnippetArrays) + { + $this->container['restrictHighlightAndSnippetArrays'] = $restrictHighlightAndSnippetArrays; + + return $this; + } + + /** + * Gets hitsPerPage + * + * @return int|null + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int|null $hitsPerPage set the number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Gets minWordSizefor1Typo + * + * @return int|null + */ + public function getMinWordSizefor1Typo() + { + return $this->container['minWordSizefor1Typo']; + } + + /** + * Sets minWordSizefor1Typo + * + * @param int|null $minWordSizefor1Typo minimum number of characters a word in the query string must contain to accept matches with 1 typo + * + * @return self + */ + public function setMinWordSizefor1Typo($minWordSizefor1Typo) + { + $this->container['minWordSizefor1Typo'] = $minWordSizefor1Typo; + + return $this; + } + + /** + * Gets minWordSizefor2Typos + * + * @return int|null + */ + public function getMinWordSizefor2Typos() + { + return $this->container['minWordSizefor2Typos']; + } + + /** + * Sets minWordSizefor2Typos + * + * @param int|null $minWordSizefor2Typos minimum number of characters a word in the query string must contain to accept matches with 2 typos + * + * @return self + */ + public function setMinWordSizefor2Typos($minWordSizefor2Typos) + { + $this->container['minWordSizefor2Typos'] = $minWordSizefor2Typos; + + return $this; + } + + /** + * Gets typoTolerance + * + * @return string|null + */ + public function getTypoTolerance() + { + return $this->container['typoTolerance']; + } + + /** + * Sets typoTolerance + * + * @param string|null $typoTolerance controls whether typo tolerance is enabled and how it is applied + * + * @return self + */ + public function setTypoTolerance($typoTolerance) + { + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($typoTolerance) && !in_array($typoTolerance, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'typoTolerance', must be one of '%s'", + $typoTolerance, + implode("', '", $allowedValues) + ) + ); + } + $this->container['typoTolerance'] = $typoTolerance; + + return $this; + } + + /** + * Gets allowTyposOnNumericTokens + * + * @return bool|null + */ + public function getAllowTyposOnNumericTokens() + { + return $this->container['allowTyposOnNumericTokens']; + } + + /** + * Sets allowTyposOnNumericTokens + * + * @param bool|null $allowTyposOnNumericTokens whether to allow typos on numbers (\"numeric tokens\") in the query string + * + * @return self + */ + public function setAllowTyposOnNumericTokens($allowTyposOnNumericTokens) + { + $this->container['allowTyposOnNumericTokens'] = $allowTyposOnNumericTokens; + + return $this; + } + + /** + * Gets disableTypoToleranceOnAttributes + * + * @return string[]|null + */ + public function getDisableTypoToleranceOnAttributes() + { + return $this->container['disableTypoToleranceOnAttributes']; + } + + /** + * Sets disableTypoToleranceOnAttributes + * + * @param string[]|null $disableTypoToleranceOnAttributes list of attributes on which you want to disable typo tolerance + * + * @return self + */ + public function setDisableTypoToleranceOnAttributes($disableTypoToleranceOnAttributes) + { + $this->container['disableTypoToleranceOnAttributes'] = $disableTypoToleranceOnAttributes; + + return $this; + } + + /** + * Gets separatorsToIndex + * + * @return string|null + */ + public function getSeparatorsToIndex() + { + return $this->container['separatorsToIndex']; + } + + /** + * Sets separatorsToIndex + * + * @param string|null $separatorsToIndex control which separators are indexed + * + * @return self + */ + public function setSeparatorsToIndex($separatorsToIndex) + { + $this->container['separatorsToIndex'] = $separatorsToIndex; + + return $this; + } + + /** + * Gets ignorePlurals + * + * @return string|null + */ + public function getIgnorePlurals() + { + return $this->container['ignorePlurals']; + } + + /** + * Sets ignorePlurals + * + * @param string|null $ignorePlurals treats singular, plurals, and other forms of declensions as matching terms + * + * @return self + */ + public function setIgnorePlurals($ignorePlurals) + { + $this->container['ignorePlurals'] = $ignorePlurals; + + return $this; + } + + /** + * Gets removeStopWords + * + * @return string|null + */ + public function getRemoveStopWords() + { + return $this->container['removeStopWords']; + } + + /** + * Sets removeStopWords + * + * @param string|null $removeStopWords removes stop (common) words from the query before executing it + * + * @return self + */ + public function setRemoveStopWords($removeStopWords) + { + $this->container['removeStopWords'] = $removeStopWords; + + return $this; + } + + /** + * Gets keepDiacriticsOnCharacters + * + * @return string|null + */ + public function getKeepDiacriticsOnCharacters() + { + return $this->container['keepDiacriticsOnCharacters']; + } + + /** + * Sets keepDiacriticsOnCharacters + * + * @param string|null $keepDiacriticsOnCharacters list of characters that the engine shouldn't automatically normalize + * + * @return self + */ + public function setKeepDiacriticsOnCharacters($keepDiacriticsOnCharacters) + { + $this->container['keepDiacriticsOnCharacters'] = $keepDiacriticsOnCharacters; + + return $this; + } + + /** + * Gets queryLanguages + * + * @return string[]|null + */ + public function getQueryLanguages() + { + return $this->container['queryLanguages']; + } + + /** + * Sets queryLanguages + * + * @param string[]|null $queryLanguages sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection + * + * @return self + */ + public function setQueryLanguages($queryLanguages) + { + $this->container['queryLanguages'] = $queryLanguages; + + return $this; + } + + /** + * Gets decompoundQuery + * + * @return bool|null + */ + public function getDecompoundQuery() + { + return $this->container['decompoundQuery']; + } + + /** + * Sets decompoundQuery + * + * @param bool|null $decompoundQuery splits compound words into their composing atoms in the query + * + * @return self + */ + public function setDecompoundQuery($decompoundQuery) + { + $this->container['decompoundQuery'] = $decompoundQuery; + + return $this; + } + + /** + * Gets enableRules + * + * @return bool|null + */ + public function getEnableRules() + { + return $this->container['enableRules']; + } + + /** + * Sets enableRules + * + * @param bool|null $enableRules whether Rules should be globally enabled + * + * @return self + */ + public function setEnableRules($enableRules) + { + $this->container['enableRules'] = $enableRules; + + return $this; + } + + /** + * Gets enablePersonalization + * + * @return bool|null + */ + public function getEnablePersonalization() + { + return $this->container['enablePersonalization']; + } + + /** + * Sets enablePersonalization + * + * @param bool|null $enablePersonalization enable the Personalization feature + * + * @return self + */ + public function setEnablePersonalization($enablePersonalization) + { + $this->container['enablePersonalization'] = $enablePersonalization; + + return $this; + } + + /** + * Gets queryType + * + * @return string|null + */ + public function getQueryType() + { + return $this->container['queryType']; + } + + /** + * Sets queryType + * + * @param string|null $queryType controls if and how query words are interpreted as prefixes + * + * @return self + */ + public function setQueryType($queryType) + { + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($queryType) && !in_array($queryType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'queryType', must be one of '%s'", + $queryType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['queryType'] = $queryType; + + return $this; + } + + /** + * Gets removeWordsIfNoResults + * + * @return string|null + */ + public function getRemoveWordsIfNoResults() + { + return $this->container['removeWordsIfNoResults']; + } + + /** + * Sets removeWordsIfNoResults + * + * @param string|null $removeWordsIfNoResults selects a strategy to remove words from the query when it doesn't match any hits + * + * @return self + */ + public function setRemoveWordsIfNoResults($removeWordsIfNoResults) + { + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($removeWordsIfNoResults) && !in_array($removeWordsIfNoResults, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $removeWordsIfNoResults, + implode("', '", $allowedValues) + ) + ); + } + $this->container['removeWordsIfNoResults'] = $removeWordsIfNoResults; + + return $this; + } + + /** + * Gets advancedSyntax + * + * @return bool|null + */ + public function getAdvancedSyntax() + { + return $this->container['advancedSyntax']; + } + + /** + * Sets advancedSyntax + * + * @param bool|null $advancedSyntax enables the advanced query syntax + * + * @return self + */ + public function setAdvancedSyntax($advancedSyntax) + { + $this->container['advancedSyntax'] = $advancedSyntax; + + return $this; + } + + /** + * Gets optionalWords + * + * @return string[]|null + */ + public function getOptionalWords() + { + return $this->container['optionalWords']; + } + + /** + * Sets optionalWords + * + * @param string[]|null $optionalWords a list of words that should be considered as optional when found in the query + * + * @return self + */ + public function setOptionalWords($optionalWords) + { + $this->container['optionalWords'] = $optionalWords; + + return $this; + } + + /** + * Gets disableExactOnAttributes + * + * @return string[]|null + */ + public function getDisableExactOnAttributes() + { + return $this->container['disableExactOnAttributes']; + } + + /** + * Sets disableExactOnAttributes + * + * @param string[]|null $disableExactOnAttributes list of attributes on which you want to disable the exact ranking criterion + * + * @return self + */ + public function setDisableExactOnAttributes($disableExactOnAttributes) + { + $this->container['disableExactOnAttributes'] = $disableExactOnAttributes; + + return $this; + } + + /** + * Gets exactOnSingleWordQuery + * + * @return string|null + */ + public function getExactOnSingleWordQuery() + { + return $this->container['exactOnSingleWordQuery']; + } + + /** + * Sets exactOnSingleWordQuery + * + * @param string|null $exactOnSingleWordQuery controls how the exact ranking criterion is computed when the query contains only one word + * + * @return self + */ + public function setExactOnSingleWordQuery($exactOnSingleWordQuery) + { + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($exactOnSingleWordQuery) && !in_array($exactOnSingleWordQuery, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $exactOnSingleWordQuery, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exactOnSingleWordQuery'] = $exactOnSingleWordQuery; + + return $this; + } + + /** + * Gets alternativesAsExact + * + * @return string[]|null + */ + public function getAlternativesAsExact() + { + return $this->container['alternativesAsExact']; + } + + /** + * Sets alternativesAsExact + * + * @param string[]|null $alternativesAsExact list of alternatives that should be considered an exact match by the exact ranking criterion + * + * @return self + */ + public function setAlternativesAsExact($alternativesAsExact) + { + $allowedValues = $this->getAlternativesAsExactAllowableValues(); + if (!is_null($alternativesAsExact) && array_diff($alternativesAsExact, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternativesAsExact', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternativesAsExact'] = $alternativesAsExact; + + return $this; + } + + /** + * Gets advancedSyntaxFeatures + * + * @return string[]|null + */ + public function getAdvancedSyntaxFeatures() + { + return $this->container['advancedSyntaxFeatures']; + } + + /** + * Sets advancedSyntaxFeatures + * + * @param string[]|null $advancedSyntaxFeatures allows you to specify which advanced syntax features are active when ‘advancedSyntax' is enabled + * + * @return self + */ + public function setAdvancedSyntaxFeatures($advancedSyntaxFeatures) + { + $allowedValues = $this->getAdvancedSyntaxFeaturesAllowableValues(); + if (!is_null($advancedSyntaxFeatures) && array_diff($advancedSyntaxFeatures, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'advancedSyntaxFeatures', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['advancedSyntaxFeatures'] = $advancedSyntaxFeatures; + + return $this; + } + + /** + * Gets distinct + * + * @return int|null + */ + public function getDistinct() + { + return $this->container['distinct']; + } + + /** + * Sets distinct + * + * @param int|null $distinct enables de-duplication or grouping of results + * + * @return self + */ + public function setDistinct($distinct) + { + if (!is_null($distinct) && ($distinct > 4)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling SearchParams., must be smaller than or equal to 4.'); + } + if (!is_null($distinct) && ($distinct < 0)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling SearchParams., must be bigger than or equal to 0.'); + } + + $this->container['distinct'] = $distinct; + + return $this; + } + + /** + * Gets synonyms + * + * @return bool|null + */ + public function getSynonyms() + { + return $this->container['synonyms']; + } + + /** + * Sets synonyms + * + * @param bool|null $synonyms whether to take into account an index's synonyms for a particular search + * + * @return self + */ + public function setSynonyms($synonyms) + { + $this->container['synonyms'] = $synonyms; + + return $this; + } + + /** + * Gets replaceSynonymsInHighlight + * + * @return bool|null + */ + public function getReplaceSynonymsInHighlight() + { + return $this->container['replaceSynonymsInHighlight']; + } + + /** + * Sets replaceSynonymsInHighlight + * + * @param bool|null $replaceSynonymsInHighlight whether to highlight and snippet the original word that matches the synonym or the synonym itself + * + * @return self + */ + public function setReplaceSynonymsInHighlight($replaceSynonymsInHighlight) + { + $this->container['replaceSynonymsInHighlight'] = $replaceSynonymsInHighlight; + + return $this; + } + + /** + * Gets minProximity + * + * @return int|null + */ + public function getMinProximity() + { + return $this->container['minProximity']; + } + + /** + * Sets minProximity + * + * @param int|null $minProximity precision of the proximity ranking criterion + * + * @return self + */ + public function setMinProximity($minProximity) + { + if (!is_null($minProximity) && ($minProximity > 7)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling SearchParams., must be smaller than or equal to 7.'); + } + if (!is_null($minProximity) && ($minProximity < 1)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling SearchParams., must be bigger than or equal to 1.'); + } + + $this->container['minProximity'] = $minProximity; + + return $this; + } + + /** + * Gets responseFields + * + * @return string[]|null + */ + public function getResponseFields() + { + return $this->container['responseFields']; + } + + /** + * Sets responseFields + * + * @param string[]|null $responseFields Choose which fields to return in the API response. This parameters applies to search and browse queries. + * + * @return self + */ + public function setResponseFields($responseFields) + { + $this->container['responseFields'] = $responseFields; + + return $this; + } + + /** + * Gets maxFacetHits + * + * @return int|null + */ + public function getMaxFacetHits() + { + return $this->container['maxFacetHits']; + } + + /** + * Sets maxFacetHits + * + * @param int|null $maxFacetHits Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. + * + * @return self + */ + public function setMaxFacetHits($maxFacetHits) + { + if (!is_null($maxFacetHits) && ($maxFacetHits > 100)) { + throw new \InvalidArgumentException('invalid value for $maxFacetHits when calling SearchParams., must be smaller than or equal to 100.'); + } + + $this->container['maxFacetHits'] = $maxFacetHits; + + return $this; + } + + /** + * Gets attributeCriteriaComputedByMinProximity + * + * @return bool|null + */ + public function getAttributeCriteriaComputedByMinProximity() + { + return $this->container['attributeCriteriaComputedByMinProximity']; + } + + /** + * Sets attributeCriteriaComputedByMinProximity + * + * @param bool|null $attributeCriteriaComputedByMinProximity when attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage + * + * @return self + */ + public function setAttributeCriteriaComputedByMinProximity($attributeCriteriaComputedByMinProximity) + { + $this->container['attributeCriteriaComputedByMinProximity'] = $attributeCriteriaComputedByMinProximity; + + return $this; + } + + /** + * Gets renderingContent + * + * @return object|null + */ + public function getRenderingContent() + { + return $this->container['renderingContent']; + } + + /** + * Sets renderingContent + * + * @param object|null $renderingContent Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * + * @return self + */ + public function setRenderingContent($renderingContent) + { + $this->container['renderingContent'] = $renderingContent; + + 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/Recommend/SnippetResult.php b/clients/algoliasearch-client-php/lib/Model/Recommend/SnippetResult.php new file mode 100644 index 0000000000..dcb14d9751 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Recommend/SnippetResult.php @@ -0,0 +1,357 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SnippetResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'snippetResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'value' => 'string', + 'matchLevel' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'matchLevel' => 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 = [ + 'value' => 'value', + 'matchLevel' => 'matchLevel', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'matchLevel' => 'setMatchLevel', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'matchLevel' => 'getMatchLevel', + ]; + + /** + * 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 MATCH_LEVEL_NONE = 'none'; + const MATCH_LEVEL_PARTIAL = 'partial'; + const MATCH_LEVEL_FULL = 'full'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMatchLevelAllowableValues() + { + return [ + self::MATCH_LEVEL_NONE, + self::MATCH_LEVEL_PARTIAL, + self::MATCH_LEVEL_FULL, + ]; + } + + /** + * 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['value'] = $data['value'] ?? null; + $this->container['matchLevel'] = $data['matchLevel'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getMatchLevelAllowableValues(); + if (!is_null($this->container['matchLevel']) && !in_array($this->container['matchLevel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'matchLevel', must be one of '%s'", + $this->container['matchLevel'], + implode("', '", $allowedValues) + ); + } + + 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 value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value markup text with occurrences highlighted + * + * @return self + */ + public function setValue($value) + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets matchLevel + * + * @return string|null + */ + public function getMatchLevel() + { + return $this->container['matchLevel']; + } + + /** + * Sets matchLevel + * + * @param string|null $matchLevel indicates how well the attribute matched the search query + * + * @return self + */ + public function setMatchLevel($matchLevel) + { + $allowedValues = $this->getMatchLevelAllowableValues(); + if (!is_null($matchLevel) && !in_array($matchLevel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'matchLevel', must be one of '%s'", + $matchLevel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['matchLevel'] = $matchLevel; + + 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/Search/Action.php b/clients/algoliasearch-client-php/lib/Model/Search/Action.php new file mode 100644 index 0000000000..140b709201 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Action.php @@ -0,0 +1,50 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class AddApiKeyResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'addApiKeyResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'key' => 'string', + 'createdAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'key' => null, + 'createdAt' => 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 = [ + 'key' => 'key', + 'createdAt' => 'createdAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'key' => 'setKey', + 'createdAt' => 'setCreatedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'key' => 'getKey', + 'createdAt' => 'getCreatedAt', + ]; + + /** + * 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['key'] = $data['key'] ?? null; + $this->container['createdAt'] = $data['createdAt'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['key'] === null) { + $invalidProperties[] = "'key' can't be null"; + } + if ($this->container['createdAt'] === null) { + $invalidProperties[] = "'createdAt' 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 key + * + * @return string + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string $key key string + * + * @return self + */ + public function setKey($key) + { + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets createdAt + * + * @return string + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string $createdAt date of creation (ISO-8601 format) + * + * @return self + */ + public function setCreatedAt($createdAt) + { + $this->container['createdAt'] = $createdAt; + + 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/Search/Anchoring.php b/clients/algoliasearch-client-php/lib/Model/Search/Anchoring.php new file mode 100644 index 0000000000..31a36bab9e --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Anchoring.php @@ -0,0 +1,41 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ApiKey implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'apiKey'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'acl' => 'string[]', + 'description' => 'string', + 'indexes' => 'string[]', + 'maxHitsPerQuery' => 'int', + 'maxQueriesPerIPPerHour' => 'int', + 'queryParameters' => 'string', + 'referers' => 'string[]', + 'validity' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'acl' => null, + 'description' => null, + 'indexes' => null, + 'maxHitsPerQuery' => null, + 'maxQueriesPerIPPerHour' => null, + 'queryParameters' => null, + 'referers' => null, + 'validity' => 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 = [ + 'acl' => 'acl', + 'description' => 'description', + 'indexes' => 'indexes', + 'maxHitsPerQuery' => 'maxHitsPerQuery', + 'maxQueriesPerIPPerHour' => 'maxQueriesPerIPPerHour', + 'queryParameters' => 'queryParameters', + 'referers' => 'referers', + 'validity' => 'validity', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'acl' => 'setAcl', + 'description' => 'setDescription', + 'indexes' => 'setIndexes', + 'maxHitsPerQuery' => 'setMaxHitsPerQuery', + 'maxQueriesPerIPPerHour' => 'setMaxQueriesPerIPPerHour', + 'queryParameters' => 'setQueryParameters', + 'referers' => 'setReferers', + 'validity' => 'setValidity', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'acl' => 'getAcl', + 'description' => 'getDescription', + 'indexes' => 'getIndexes', + 'maxHitsPerQuery' => 'getMaxHitsPerQuery', + 'maxQueriesPerIPPerHour' => 'getMaxQueriesPerIPPerHour', + 'queryParameters' => 'getQueryParameters', + 'referers' => 'getReferers', + 'validity' => 'getValidity', + ]; + + /** + * 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 ACL_ADD_OBJECT = 'addObject'; + const ACL_ANALYTICS = 'analytics'; + const ACL_BROWSE = 'browse'; + const ACL_DELETE_OBJECT = 'deleteObject'; + const ACL_DELETE_INDEX = 'deleteIndex'; + const ACL_EDIT_SETTINGS = 'editSettings'; + const ACL_LIST_INDEXES = 'listIndexes'; + const ACL_LOGS = 'logs'; + const ACL_PERSONALIZATION = 'personalization'; + const ACL_RECOMMENDATION = 'recommendation'; + const ACL_SEARCH = 'search'; + const ACL_SEE_UNRETRIEVABLE_ATTRIBUTES = 'seeUnretrievableAttributes'; + const ACL_SETTINGS = 'settings'; + const ACL_USAGE = 'usage'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAclAllowableValues() + { + return [ + self::ACL_ADD_OBJECT, + self::ACL_ANALYTICS, + self::ACL_BROWSE, + self::ACL_DELETE_OBJECT, + self::ACL_DELETE_INDEX, + self::ACL_EDIT_SETTINGS, + self::ACL_LIST_INDEXES, + self::ACL_LOGS, + self::ACL_PERSONALIZATION, + self::ACL_RECOMMENDATION, + self::ACL_SEARCH, + self::ACL_SEE_UNRETRIEVABLE_ATTRIBUTES, + self::ACL_SETTINGS, + self::ACL_USAGE, + ]; + } + + /** + * 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['acl'] = $data['acl'] ?? null; + $this->container['description'] = $data['description'] ?? ''; + $this->container['indexes'] = $data['indexes'] ?? null; + $this->container['maxHitsPerQuery'] = $data['maxHitsPerQuery'] ?? 0; + $this->container['maxQueriesPerIPPerHour'] = $data['maxQueriesPerIPPerHour'] ?? 0; + $this->container['queryParameters'] = $data['queryParameters'] ?? ''; + $this->container['referers'] = $data['referers'] ?? null; + $this->container['validity'] = $data['validity'] ?? 0; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['acl'] === null) { + $invalidProperties[] = "'acl' 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 acl + * + * @return string[] + */ + public function getAcl() + { + return $this->container['acl']; + } + + /** + * Sets acl + * + * @param string[] $acl set of permissions associated with the key + * + * @return self + */ + public function setAcl($acl) + { + $allowedValues = $this->getAclAllowableValues(); + if (array_diff($acl, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'acl', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['acl'] = $acl; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description A comment used to identify a key more easily in the dashboard. It is not interpreted by the API. + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets indexes + * + * @return string[]|null + */ + public function getIndexes() + { + return $this->container['indexes']; + } + + /** + * Sets indexes + * + * @param string[]|null $indexes Restrict this new API key to a list of indices or index patterns. If the list is empty, all indices are allowed. + * + * @return self + */ + public function setIndexes($indexes) + { + $this->container['indexes'] = $indexes; + + return $this; + } + + /** + * Gets maxHitsPerQuery + * + * @return int|null + */ + public function getMaxHitsPerQuery() + { + return $this->container['maxHitsPerQuery']; + } + + /** + * Sets maxHitsPerQuery + * + * @param int|null $maxHitsPerQuery Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. + * + * @return self + */ + public function setMaxHitsPerQuery($maxHitsPerQuery) + { + $this->container['maxHitsPerQuery'] = $maxHitsPerQuery; + + return $this; + } + + /** + * Gets maxQueriesPerIPPerHour + * + * @return int|null + */ + public function getMaxQueriesPerIPPerHour() + { + return $this->container['maxQueriesPerIPPerHour']; + } + + /** + * Sets maxQueriesPerIPPerHour + * + * @param int|null $maxQueriesPerIPPerHour maximum number of API calls per hour allowed from a given IP address or a user token + * + * @return self + */ + public function setMaxQueriesPerIPPerHour($maxQueriesPerIPPerHour) + { + $this->container['maxQueriesPerIPPerHour'] = $maxQueriesPerIPPerHour; + + return $this; + } + + /** + * Gets queryParameters + * + * @return string|null + */ + public function getQueryParameters() + { + return $this->container['queryParameters']; + } + + /** + * Sets queryParameters + * + * @param string|null $queryParameters URL-encoded query string. Force some query parameters to be applied for each query made with this API key. + * + * @return self + */ + public function setQueryParameters($queryParameters) + { + $this->container['queryParameters'] = $queryParameters; + + return $this; + } + + /** + * Gets referers + * + * @return string[]|null + */ + public function getReferers() + { + return $this->container['referers']; + } + + /** + * Sets referers + * + * @param string[]|null $referers Restrict this new API key to specific referers. If empty or blank, defaults to all referers. + * + * @return self + */ + public function setReferers($referers) + { + $this->container['referers'] = $referers; + + return $this; + } + + /** + * Gets validity + * + * @return int|null + */ + public function getValidity() + { + return $this->container['validity']; + } + + /** + * Sets validity + * + * @param int|null $validity Validity limit for this key in seconds. The key will automatically be removed after this period of time. + * + * @return self + */ + public function setValidity($validity) + { + $this->container['validity'] = $validity; + + 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/Search/AssignUserIdParams.php b/clients/algoliasearch-client-php/lib/Model/Search/AssignUserIdParams.php new file mode 100644 index 0000000000..6e64c9bf36 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/AssignUserIdParams.php @@ -0,0 +1,296 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class AssignUserIdParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'assignUserIdParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cluster' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cluster' => 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 = [ + 'cluster' => 'cluster', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cluster' => 'setCluster', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cluster' => 'getCluster', + ]; + + /** + * 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['cluster'] = $data['cluster'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['cluster'] === null) { + $invalidProperties[] = "'cluster' 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 cluster + * + * @return string + */ + public function getCluster() + { + return $this->container['cluster']; + } + + /** + * Sets cluster + * + * @param string $cluster name of the cluster + * + * @return self + */ + public function setCluster($cluster) + { + $this->container['cluster'] = $cluster; + + 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/Search/AutomaticFacetFilter.php b/clients/algoliasearch-client-php/lib/Model/Search/AutomaticFacetFilter.php new file mode 100644 index 0000000000..7bcb2ec044 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/AutomaticFacetFilter.php @@ -0,0 +1,356 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class AutomaticFacetFilter implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'automaticFacetFilter'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'facet' => 'string', + 'score' => 'int', + 'disjunctive' => 'bool', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'facet' => null, + 'score' => null, + 'disjunctive' => 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 = [ + 'facet' => 'facet', + 'score' => 'score', + 'disjunctive' => 'disjunctive', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'facet' => 'setFacet', + 'score' => 'setScore', + 'disjunctive' => 'setDisjunctive', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'facet' => 'getFacet', + 'score' => 'getScore', + 'disjunctive' => 'getDisjunctive', + ]; + + /** + * 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['facet'] = $data['facet'] ?? null; + $this->container['score'] = $data['score'] ?? 1; + $this->container['disjunctive'] = $data['disjunctive'] ?? false; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['facet'] === null) { + $invalidProperties[] = "'facet' 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 facet + * + * @return string + */ + public function getFacet() + { + return $this->container['facet']; + } + + /** + * Sets facet + * + * @param string $facet Attribute to filter on. This must match a facet placeholder in the Rule's pattern. + * + * @return self + */ + public function setFacet($facet) + { + $this->container['facet'] = $facet; + + return $this; + } + + /** + * Gets score + * + * @return int|null + */ + public function getScore() + { + return $this->container['score']; + } + + /** + * Sets score + * + * @param int|null $score Score for the filter. Typically used for optional or disjunctive filters. + * + * @return self + */ + public function setScore($score) + { + $this->container['score'] = $score; + + return $this; + } + + /** + * Gets disjunctive + * + * @return bool|null + */ + public function getDisjunctive() + { + return $this->container['disjunctive']; + } + + /** + * Sets disjunctive + * + * @param bool|null $disjunctive whether the filter is disjunctive (true) or conjunctive (false) + * + * @return self + */ + public function setDisjunctive($disjunctive) + { + $this->container['disjunctive'] = $disjunctive; + + 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/Search/BaseBrowseResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/BaseBrowseResponse.php new file mode 100644 index 0000000000..04c0c4538d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BaseBrowseResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BaseBrowseResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'baseBrowseResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cursor' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cursor' => 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 = [ + 'cursor' => 'cursor', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cursor' => 'setCursor', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cursor' => 'getCursor', + ]; + + /** + * 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['cursor'] = $data['cursor'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['cursor'] === null) { + $invalidProperties[] = "'cursor' 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 cursor + * + * @return string + */ + public function getCursor() + { + return $this->container['cursor']; + } + + /** + * Sets cursor + * + * @param string $cursor Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. + * + * @return self + */ + public function setCursor($cursor) + { + $this->container['cursor'] = $cursor; + + 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/Search/BaseIndexSettings.php b/clients/algoliasearch-client-php/lib/Model/Search/BaseIndexSettings.php new file mode 100644 index 0000000000..70cf2af3ba --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BaseIndexSettings.php @@ -0,0 +1,620 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BaseIndexSettings implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'baseIndexSettings'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'replicas' => 'string[]', + 'paginationLimitedTo' => 'int', + 'disableTypoToleranceOnWords' => 'string[]', + 'attributesToTransliterate' => 'string[]', + 'camelCaseAttributes' => 'string[]', + 'decompoundedAttributes' => 'object', + 'indexLanguages' => 'string[]', + 'filterPromotes' => 'bool', + 'disablePrefixOnAttributes' => 'string[]', + 'allowCompressionOfIntegerArray' => 'bool', + 'numericAttributesForFiltering' => 'string[]', + 'userData' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'replicas' => null, + 'paginationLimitedTo' => null, + 'disableTypoToleranceOnWords' => null, + 'attributesToTransliterate' => null, + 'camelCaseAttributes' => null, + 'decompoundedAttributes' => null, + 'indexLanguages' => null, + 'filterPromotes' => null, + 'disablePrefixOnAttributes' => null, + 'allowCompressionOfIntegerArray' => null, + 'numericAttributesForFiltering' => null, + 'userData' => 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 = [ + 'replicas' => 'replicas', + 'paginationLimitedTo' => 'paginationLimitedTo', + 'disableTypoToleranceOnWords' => 'disableTypoToleranceOnWords', + 'attributesToTransliterate' => 'attributesToTransliterate', + 'camelCaseAttributes' => 'camelCaseAttributes', + 'decompoundedAttributes' => 'decompoundedAttributes', + 'indexLanguages' => 'indexLanguages', + 'filterPromotes' => 'filterPromotes', + 'disablePrefixOnAttributes' => 'disablePrefixOnAttributes', + 'allowCompressionOfIntegerArray' => 'allowCompressionOfIntegerArray', + 'numericAttributesForFiltering' => 'numericAttributesForFiltering', + 'userData' => 'userData', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'replicas' => 'setReplicas', + 'paginationLimitedTo' => 'setPaginationLimitedTo', + 'disableTypoToleranceOnWords' => 'setDisableTypoToleranceOnWords', + 'attributesToTransliterate' => 'setAttributesToTransliterate', + 'camelCaseAttributes' => 'setCamelCaseAttributes', + 'decompoundedAttributes' => 'setDecompoundedAttributes', + 'indexLanguages' => 'setIndexLanguages', + 'filterPromotes' => 'setFilterPromotes', + 'disablePrefixOnAttributes' => 'setDisablePrefixOnAttributes', + 'allowCompressionOfIntegerArray' => 'setAllowCompressionOfIntegerArray', + 'numericAttributesForFiltering' => 'setNumericAttributesForFiltering', + 'userData' => 'setUserData', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'replicas' => 'getReplicas', + 'paginationLimitedTo' => 'getPaginationLimitedTo', + 'disableTypoToleranceOnWords' => 'getDisableTypoToleranceOnWords', + 'attributesToTransliterate' => 'getAttributesToTransliterate', + 'camelCaseAttributes' => 'getCamelCaseAttributes', + 'decompoundedAttributes' => 'getDecompoundedAttributes', + 'indexLanguages' => 'getIndexLanguages', + 'filterPromotes' => 'getFilterPromotes', + 'disablePrefixOnAttributes' => 'getDisablePrefixOnAttributes', + 'allowCompressionOfIntegerArray' => 'getAllowCompressionOfIntegerArray', + 'numericAttributesForFiltering' => 'getNumericAttributesForFiltering', + 'userData' => 'getUserData', + ]; + + /** + * 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['replicas'] = $data['replicas'] ?? null; + $this->container['paginationLimitedTo'] = $data['paginationLimitedTo'] ?? 1000; + $this->container['disableTypoToleranceOnWords'] = $data['disableTypoToleranceOnWords'] ?? null; + $this->container['attributesToTransliterate'] = $data['attributesToTransliterate'] ?? null; + $this->container['camelCaseAttributes'] = $data['camelCaseAttributes'] ?? null; + $this->container['decompoundedAttributes'] = $data['decompoundedAttributes'] ?? null; + $this->container['indexLanguages'] = $data['indexLanguages'] ?? null; + $this->container['filterPromotes'] = $data['filterPromotes'] ?? false; + $this->container['disablePrefixOnAttributes'] = $data['disablePrefixOnAttributes'] ?? null; + $this->container['allowCompressionOfIntegerArray'] = $data['allowCompressionOfIntegerArray'] ?? false; + $this->container['numericAttributesForFiltering'] = $data['numericAttributesForFiltering'] ?? null; + $this->container['userData'] = $data['userData'] ?? 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 replicas + * + * @return string[]|null + */ + public function getReplicas() + { + return $this->container['replicas']; + } + + /** + * Sets replicas + * + * @param string[]|null $replicas creates replicas, exact copies of an index + * + * @return self + */ + public function setReplicas($replicas) + { + $this->container['replicas'] = $replicas; + + return $this; + } + + /** + * Gets paginationLimitedTo + * + * @return int|null + */ + public function getPaginationLimitedTo() + { + return $this->container['paginationLimitedTo']; + } + + /** + * Sets paginationLimitedTo + * + * @param int|null $paginationLimitedTo set the maximum number of hits accessible via pagination + * + * @return self + */ + public function setPaginationLimitedTo($paginationLimitedTo) + { + $this->container['paginationLimitedTo'] = $paginationLimitedTo; + + return $this; + } + + /** + * Gets disableTypoToleranceOnWords + * + * @return string[]|null + */ + public function getDisableTypoToleranceOnWords() + { + return $this->container['disableTypoToleranceOnWords']; + } + + /** + * Sets disableTypoToleranceOnWords + * + * @param string[]|null $disableTypoToleranceOnWords a list of words for which you want to turn off typo tolerance + * + * @return self + */ + public function setDisableTypoToleranceOnWords($disableTypoToleranceOnWords) + { + $this->container['disableTypoToleranceOnWords'] = $disableTypoToleranceOnWords; + + return $this; + } + + /** + * Gets attributesToTransliterate + * + * @return string[]|null + */ + public function getAttributesToTransliterate() + { + return $this->container['attributesToTransliterate']; + } + + /** + * Sets attributesToTransliterate + * + * @param string[]|null $attributesToTransliterate specify on which attributes to apply transliteration + * + * @return self + */ + public function setAttributesToTransliterate($attributesToTransliterate) + { + $this->container['attributesToTransliterate'] = $attributesToTransliterate; + + return $this; + } + + /** + * Gets camelCaseAttributes + * + * @return string[]|null + */ + public function getCamelCaseAttributes() + { + return $this->container['camelCaseAttributes']; + } + + /** + * Sets camelCaseAttributes + * + * @param string[]|null $camelCaseAttributes list of attributes on which to do a decomposition of camel case words + * + * @return self + */ + public function setCamelCaseAttributes($camelCaseAttributes) + { + $this->container['camelCaseAttributes'] = $camelCaseAttributes; + + return $this; + } + + /** + * Gets decompoundedAttributes + * + * @return object|null + */ + public function getDecompoundedAttributes() + { + return $this->container['decompoundedAttributes']; + } + + /** + * Sets decompoundedAttributes + * + * @param object|null $decompoundedAttributes specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding + * + * @return self + */ + public function setDecompoundedAttributes($decompoundedAttributes) + { + $this->container['decompoundedAttributes'] = $decompoundedAttributes; + + return $this; + } + + /** + * Gets indexLanguages + * + * @return string[]|null + */ + public function getIndexLanguages() + { + return $this->container['indexLanguages']; + } + + /** + * Sets indexLanguages + * + * @param string[]|null $indexLanguages sets the languages at the index level for language-specific processing such as tokenization and normalization + * + * @return self + */ + public function setIndexLanguages($indexLanguages) + { + $this->container['indexLanguages'] = $indexLanguages; + + return $this; + } + + /** + * Gets filterPromotes + * + * @return bool|null + */ + public function getFilterPromotes() + { + return $this->container['filterPromotes']; + } + + /** + * Sets filterPromotes + * + * @param bool|null $filterPromotes whether promoted results should match the filters of the current search, except for geographic filters + * + * @return self + */ + public function setFilterPromotes($filterPromotes) + { + $this->container['filterPromotes'] = $filterPromotes; + + return $this; + } + + /** + * Gets disablePrefixOnAttributes + * + * @return string[]|null + */ + public function getDisablePrefixOnAttributes() + { + return $this->container['disablePrefixOnAttributes']; + } + + /** + * Sets disablePrefixOnAttributes + * + * @param string[]|null $disablePrefixOnAttributes list of attributes on which you want to disable prefix matching + * + * @return self + */ + public function setDisablePrefixOnAttributes($disablePrefixOnAttributes) + { + $this->container['disablePrefixOnAttributes'] = $disablePrefixOnAttributes; + + return $this; + } + + /** + * Gets allowCompressionOfIntegerArray + * + * @return bool|null + */ + public function getAllowCompressionOfIntegerArray() + { + return $this->container['allowCompressionOfIntegerArray']; + } + + /** + * Sets allowCompressionOfIntegerArray + * + * @param bool|null $allowCompressionOfIntegerArray enables compression of large integer arrays + * + * @return self + */ + public function setAllowCompressionOfIntegerArray($allowCompressionOfIntegerArray) + { + $this->container['allowCompressionOfIntegerArray'] = $allowCompressionOfIntegerArray; + + return $this; + } + + /** + * Gets numericAttributesForFiltering + * + * @return string[]|null + */ + public function getNumericAttributesForFiltering() + { + return $this->container['numericAttributesForFiltering']; + } + + /** + * Sets numericAttributesForFiltering + * + * @param string[]|null $numericAttributesForFiltering list of numeric attributes that can be used as numerical filters + * + * @return self + */ + public function setNumericAttributesForFiltering($numericAttributesForFiltering) + { + $this->container['numericAttributesForFiltering'] = $numericAttributesForFiltering; + + 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; + } + /** + * 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/Search/BaseSearchParams.php b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchParams.php new file mode 100644 index 0000000000..fe93e52d3a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchParams.php @@ -0,0 +1,1243 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BaseSearchParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'baseSearchParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'similarQuery' => 'string', + 'filters' => 'string', + 'facetFilters' => 'string[]', + 'optionalFilters' => 'string[]', + 'numericFilters' => 'string[]', + 'tagFilters' => 'string[]', + 'sumOrFiltersScores' => 'bool', + 'facets' => 'string[]', + 'maxValuesPerFacet' => 'int', + 'facetingAfterDistinct' => 'bool', + 'sortFacetValuesBy' => 'string', + 'page' => 'int', + 'offset' => 'int', + 'length' => 'int', + 'aroundLatLng' => 'string', + 'aroundLatLngViaIP' => 'bool', + 'aroundRadius' => 'OneOfIntegerString', + 'aroundPrecision' => 'int', + 'minimumAroundRadius' => 'int', + 'insideBoundingBox' => 'float[]', + 'insidePolygon' => 'float[]', + 'naturalLanguages' => 'string[]', + 'ruleContexts' => 'string[]', + 'personalizationImpact' => 'int', + 'userToken' => 'string', + 'getRankingInfo' => 'bool', + 'clickAnalytics' => 'bool', + 'analytics' => 'bool', + 'analyticsTags' => 'string[]', + 'percentileComputation' => 'bool', + 'enableABTest' => 'bool', + 'enableReRanking' => 'bool', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'similarQuery' => null, + 'filters' => null, + 'facetFilters' => null, + 'optionalFilters' => null, + 'numericFilters' => null, + 'tagFilters' => null, + 'sumOrFiltersScores' => null, + 'facets' => null, + 'maxValuesPerFacet' => null, + 'facetingAfterDistinct' => null, + 'sortFacetValuesBy' => null, + 'page' => null, + 'offset' => null, + 'length' => null, + 'aroundLatLng' => null, + 'aroundLatLngViaIP' => null, + 'aroundRadius' => null, + 'aroundPrecision' => null, + 'minimumAroundRadius' => null, + 'insideBoundingBox' => null, + 'insidePolygon' => null, + 'naturalLanguages' => null, + 'ruleContexts' => null, + 'personalizationImpact' => null, + 'userToken' => null, + 'getRankingInfo' => null, + 'clickAnalytics' => null, + 'analytics' => null, + 'analyticsTags' => null, + 'percentileComputation' => null, + 'enableABTest' => null, + 'enableReRanking' => 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 = [ + 'similarQuery' => 'similarQuery', + 'filters' => 'filters', + 'facetFilters' => 'facetFilters', + 'optionalFilters' => 'optionalFilters', + 'numericFilters' => 'numericFilters', + 'tagFilters' => 'tagFilters', + 'sumOrFiltersScores' => 'sumOrFiltersScores', + 'facets' => 'facets', + 'maxValuesPerFacet' => 'maxValuesPerFacet', + 'facetingAfterDistinct' => 'facetingAfterDistinct', + 'sortFacetValuesBy' => 'sortFacetValuesBy', + 'page' => 'page', + 'offset' => 'offset', + 'length' => 'length', + 'aroundLatLng' => 'aroundLatLng', + 'aroundLatLngViaIP' => 'aroundLatLngViaIP', + 'aroundRadius' => 'aroundRadius', + 'aroundPrecision' => 'aroundPrecision', + 'minimumAroundRadius' => 'minimumAroundRadius', + 'insideBoundingBox' => 'insideBoundingBox', + 'insidePolygon' => 'insidePolygon', + 'naturalLanguages' => 'naturalLanguages', + 'ruleContexts' => 'ruleContexts', + 'personalizationImpact' => 'personalizationImpact', + 'userToken' => 'userToken', + 'getRankingInfo' => 'getRankingInfo', + 'clickAnalytics' => 'clickAnalytics', + 'analytics' => 'analytics', + 'analyticsTags' => 'analyticsTags', + 'percentileComputation' => 'percentileComputation', + 'enableABTest' => 'enableABTest', + 'enableReRanking' => 'enableReRanking', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'similarQuery' => 'setSimilarQuery', + 'filters' => 'setFilters', + 'facetFilters' => 'setFacetFilters', + 'optionalFilters' => 'setOptionalFilters', + 'numericFilters' => 'setNumericFilters', + 'tagFilters' => 'setTagFilters', + 'sumOrFiltersScores' => 'setSumOrFiltersScores', + 'facets' => 'setFacets', + 'maxValuesPerFacet' => 'setMaxValuesPerFacet', + 'facetingAfterDistinct' => 'setFacetingAfterDistinct', + 'sortFacetValuesBy' => 'setSortFacetValuesBy', + 'page' => 'setPage', + 'offset' => 'setOffset', + 'length' => 'setLength', + 'aroundLatLng' => 'setAroundLatLng', + 'aroundLatLngViaIP' => 'setAroundLatLngViaIP', + 'aroundRadius' => 'setAroundRadius', + 'aroundPrecision' => 'setAroundPrecision', + 'minimumAroundRadius' => 'setMinimumAroundRadius', + 'insideBoundingBox' => 'setInsideBoundingBox', + 'insidePolygon' => 'setInsidePolygon', + 'naturalLanguages' => 'setNaturalLanguages', + 'ruleContexts' => 'setRuleContexts', + 'personalizationImpact' => 'setPersonalizationImpact', + 'userToken' => 'setUserToken', + 'getRankingInfo' => 'setGetRankingInfo', + 'clickAnalytics' => 'setClickAnalytics', + 'analytics' => 'setAnalytics', + 'analyticsTags' => 'setAnalyticsTags', + 'percentileComputation' => 'setPercentileComputation', + 'enableABTest' => 'setEnableABTest', + 'enableReRanking' => 'setEnableReRanking', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'similarQuery' => 'getSimilarQuery', + 'filters' => 'getFilters', + 'facetFilters' => 'getFacetFilters', + 'optionalFilters' => 'getOptionalFilters', + 'numericFilters' => 'getNumericFilters', + 'tagFilters' => 'getTagFilters', + 'sumOrFiltersScores' => 'getSumOrFiltersScores', + 'facets' => 'getFacets', + 'maxValuesPerFacet' => 'getMaxValuesPerFacet', + 'facetingAfterDistinct' => 'getFacetingAfterDistinct', + 'sortFacetValuesBy' => 'getSortFacetValuesBy', + 'page' => 'getPage', + 'offset' => 'getOffset', + 'length' => 'getLength', + 'aroundLatLng' => 'getAroundLatLng', + 'aroundLatLngViaIP' => 'getAroundLatLngViaIP', + 'aroundRadius' => 'getAroundRadius', + 'aroundPrecision' => 'getAroundPrecision', + 'minimumAroundRadius' => 'getMinimumAroundRadius', + 'insideBoundingBox' => 'getInsideBoundingBox', + 'insidePolygon' => 'getInsidePolygon', + 'naturalLanguages' => 'getNaturalLanguages', + 'ruleContexts' => 'getRuleContexts', + 'personalizationImpact' => 'getPersonalizationImpact', + 'userToken' => 'getUserToken', + 'getRankingInfo' => 'getGetRankingInfo', + 'clickAnalytics' => 'getClickAnalytics', + 'analytics' => 'getAnalytics', + 'analyticsTags' => 'getAnalyticsTags', + 'percentileComputation' => 'getPercentileComputation', + 'enableABTest' => 'getEnableABTest', + 'enableReRanking' => 'getEnableReRanking', + ]; + + /** + * 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['similarQuery'] = $data['similarQuery'] ?? ''; + $this->container['filters'] = $data['filters'] ?? ''; + $this->container['facetFilters'] = $data['facetFilters'] ?? null; + $this->container['optionalFilters'] = $data['optionalFilters'] ?? null; + $this->container['numericFilters'] = $data['numericFilters'] ?? null; + $this->container['tagFilters'] = $data['tagFilters'] ?? null; + $this->container['sumOrFiltersScores'] = $data['sumOrFiltersScores'] ?? false; + $this->container['facets'] = $data['facets'] ?? null; + $this->container['maxValuesPerFacet'] = $data['maxValuesPerFacet'] ?? 100; + $this->container['facetingAfterDistinct'] = $data['facetingAfterDistinct'] ?? false; + $this->container['sortFacetValuesBy'] = $data['sortFacetValuesBy'] ?? 'count'; + $this->container['page'] = $data['page'] ?? 0; + $this->container['offset'] = $data['offset'] ?? null; + $this->container['length'] = $data['length'] ?? null; + $this->container['aroundLatLng'] = $data['aroundLatLng'] ?? ''; + $this->container['aroundLatLngViaIP'] = $data['aroundLatLngViaIP'] ?? false; + $this->container['aroundRadius'] = $data['aroundRadius'] ?? null; + $this->container['aroundPrecision'] = $data['aroundPrecision'] ?? 10; + $this->container['minimumAroundRadius'] = $data['minimumAroundRadius'] ?? null; + $this->container['insideBoundingBox'] = $data['insideBoundingBox'] ?? null; + $this->container['insidePolygon'] = $data['insidePolygon'] ?? null; + $this->container['naturalLanguages'] = $data['naturalLanguages'] ?? null; + $this->container['ruleContexts'] = $data['ruleContexts'] ?? null; + $this->container['personalizationImpact'] = $data['personalizationImpact'] ?? 100; + $this->container['userToken'] = $data['userToken'] ?? null; + $this->container['getRankingInfo'] = $data['getRankingInfo'] ?? false; + $this->container['clickAnalytics'] = $data['clickAnalytics'] ?? false; + $this->container['analytics'] = $data['analytics'] ?? true; + $this->container['analyticsTags'] = $data['analyticsTags'] ?? null; + $this->container['percentileComputation'] = $data['percentileComputation'] ?? true; + $this->container['enableABTest'] = $data['enableABTest'] ?? true; + $this->container['enableReRanking'] = $data['enableReRanking'] ?? true; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['length']) && ($this->container['length'] > 1000)) { + $invalidProperties[] = "invalid value for 'length', must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['length']) && ($this->container['length'] < 1)) { + $invalidProperties[] = "invalid value for 'length', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['minimumAroundRadius']) && ($this->container['minimumAroundRadius'] < 1)) { + $invalidProperties[] = "invalid value for 'minimumAroundRadius', must be bigger than or equal to 1."; + } + + 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 similarQuery + * + * @return string|null + */ + public function getSimilarQuery() + { + return $this->container['similarQuery']; + } + + /** + * Sets similarQuery + * + * @param string|null $similarQuery overrides the query parameter and performs a more generic search that can be used to find \"similar\" results + * + * @return self + */ + public function setSimilarQuery($similarQuery) + { + $this->container['similarQuery'] = $similarQuery; + + return $this; + } + + /** + * Gets filters + * + * @return string|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param string|null $filters filter the query with numeric, facet and/or tag filters + * + * @return self + */ + public function setFilters($filters) + { + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets facetFilters + * + * @return string[]|null + */ + public function getFacetFilters() + { + return $this->container['facetFilters']; + } + + /** + * Sets facetFilters + * + * @param string[]|null $facetFilters filter hits by facet value + * + * @return self + */ + public function setFacetFilters($facetFilters) + { + $this->container['facetFilters'] = $facetFilters; + + return $this; + } + + /** + * Gets optionalFilters + * + * @return string[]|null + */ + public function getOptionalFilters() + { + return $this->container['optionalFilters']; + } + + /** + * Sets optionalFilters + * + * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * + * @return self + */ + public function setOptionalFilters($optionalFilters) + { + $this->container['optionalFilters'] = $optionalFilters; + + return $this; + } + + /** + * Gets numericFilters + * + * @return string[]|null + */ + public function getNumericFilters() + { + return $this->container['numericFilters']; + } + + /** + * Sets numericFilters + * + * @param string[]|null $numericFilters filter on numeric attributes + * + * @return self + */ + public function setNumericFilters($numericFilters) + { + $this->container['numericFilters'] = $numericFilters; + + return $this; + } + + /** + * Gets tagFilters + * + * @return string[]|null + */ + public function getTagFilters() + { + return $this->container['tagFilters']; + } + + /** + * Sets tagFilters + * + * @param string[]|null $tagFilters filter hits by tags + * + * @return self + */ + public function setTagFilters($tagFilters) + { + $this->container['tagFilters'] = $tagFilters; + + return $this; + } + + /** + * Gets sumOrFiltersScores + * + * @return bool|null + */ + public function getSumOrFiltersScores() + { + return $this->container['sumOrFiltersScores']; + } + + /** + * Sets sumOrFiltersScores + * + * @param bool|null $sumOrFiltersScores determines how to calculate the total score for filtering + * + * @return self + */ + public function setSumOrFiltersScores($sumOrFiltersScores) + { + $this->container['sumOrFiltersScores'] = $sumOrFiltersScores; + + return $this; + } + + /** + * Gets facets + * + * @return string[]|null + */ + public function getFacets() + { + return $this->container['facets']; + } + + /** + * Sets facets + * + * @param string[]|null $facets retrieve facets and their facet values + * + * @return self + */ + public function setFacets($facets) + { + $this->container['facets'] = $facets; + + return $this; + } + + /** + * Gets maxValuesPerFacet + * + * @return int|null + */ + public function getMaxValuesPerFacet() + { + return $this->container['maxValuesPerFacet']; + } + + /** + * Sets maxValuesPerFacet + * + * @param int|null $maxValuesPerFacet maximum number of facet values to return for each facet during a regular search + * + * @return self + */ + public function setMaxValuesPerFacet($maxValuesPerFacet) + { + $this->container['maxValuesPerFacet'] = $maxValuesPerFacet; + + return $this; + } + + /** + * Gets facetingAfterDistinct + * + * @return bool|null + */ + public function getFacetingAfterDistinct() + { + return $this->container['facetingAfterDistinct']; + } + + /** + * Sets facetingAfterDistinct + * + * @param bool|null $facetingAfterDistinct force faceting to be applied after de-duplication (via the Distinct setting) + * + * @return self + */ + public function setFacetingAfterDistinct($facetingAfterDistinct) + { + $this->container['facetingAfterDistinct'] = $facetingAfterDistinct; + + return $this; + } + + /** + * Gets sortFacetValuesBy + * + * @return string|null + */ + public function getSortFacetValuesBy() + { + return $this->container['sortFacetValuesBy']; + } + + /** + * Sets sortFacetValuesBy + * + * @param string|null $sortFacetValuesBy controls how facet values are fetched + * + * @return self + */ + public function setSortFacetValuesBy($sortFacetValuesBy) + { + $this->container['sortFacetValuesBy'] = $sortFacetValuesBy; + + return $this; + } + + /** + * Gets page + * + * @return int|null + */ + public function getPage() + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param int|null $page specify the page to retrieve + * + * @return self + */ + public function setPage($page) + { + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets offset + * + * @return int|null + */ + public function getOffset() + { + return $this->container['offset']; + } + + /** + * Sets offset + * + * @param int|null $offset specify the offset of the first hit to return + * + * @return self + */ + public function setOffset($offset) + { + $this->container['offset'] = $offset; + + return $this; + } + + /** + * Gets length + * + * @return int|null + */ + public function getLength() + { + return $this->container['length']; + } + + /** + * Sets length + * + * @param int|null $length set the number of hits to retrieve (used only with offset) + * + * @return self + */ + public function setLength($length) + { + if (!is_null($length) && ($length > 1000)) { + throw new \InvalidArgumentException('invalid value for $length when calling BaseSearchParams., must be smaller than or equal to 1000.'); + } + if (!is_null($length) && ($length < 1)) { + throw new \InvalidArgumentException('invalid value for $length when calling BaseSearchParams., must be bigger than or equal to 1.'); + } + + $this->container['length'] = $length; + + return $this; + } + + /** + * Gets aroundLatLng + * + * @return string|null + */ + public function getAroundLatLng() + { + return $this->container['aroundLatLng']; + } + + /** + * Sets aroundLatLng + * + * @param string|null $aroundLatLng search for entries around a central geolocation, enabling a geo search within a circular area + * + * @return self + */ + public function setAroundLatLng($aroundLatLng) + { + $this->container['aroundLatLng'] = $aroundLatLng; + + return $this; + } + + /** + * Gets aroundLatLngViaIP + * + * @return bool|null + */ + public function getAroundLatLngViaIP() + { + return $this->container['aroundLatLngViaIP']; + } + + /** + * Sets aroundLatLngViaIP + * + * @param bool|null $aroundLatLngViaIP search for entries around a given location automatically computed from the requester's IP address + * + * @return self + */ + public function setAroundLatLngViaIP($aroundLatLngViaIP) + { + $this->container['aroundLatLngViaIP'] = $aroundLatLngViaIP; + + return $this; + } + + /** + * Gets aroundRadius + * + * @return OneOfIntegerString|null + */ + public function getAroundRadius() + { + return $this->container['aroundRadius']; + } + + /** + * Sets aroundRadius + * + * @param OneOfIntegerString|null $aroundRadius define the maximum radius for a geo search (in meters) + * + * @return self + */ + public function setAroundRadius($aroundRadius) + { + $this->container['aroundRadius'] = $aroundRadius; + + return $this; + } + + /** + * Gets aroundPrecision + * + * @return int|null + */ + public function getAroundPrecision() + { + return $this->container['aroundPrecision']; + } + + /** + * Sets aroundPrecision + * + * @param int|null $aroundPrecision precision of geo search (in meters), to add grouping by geo location to the ranking formula + * + * @return self + */ + public function setAroundPrecision($aroundPrecision) + { + $this->container['aroundPrecision'] = $aroundPrecision; + + return $this; + } + + /** + * Gets minimumAroundRadius + * + * @return int|null + */ + public function getMinimumAroundRadius() + { + return $this->container['minimumAroundRadius']; + } + + /** + * Sets minimumAroundRadius + * + * @param int|null $minimumAroundRadius minimum radius (in meters) used for a geo search when aroundRadius is not set + * + * @return self + */ + public function setMinimumAroundRadius($minimumAroundRadius) + { + if (!is_null($minimumAroundRadius) && ($minimumAroundRadius < 1)) { + throw new \InvalidArgumentException('invalid value for $minimumAroundRadius when calling BaseSearchParams., must be bigger than or equal to 1.'); + } + + $this->container['minimumAroundRadius'] = $minimumAroundRadius; + + return $this; + } + + /** + * Gets insideBoundingBox + * + * @return float[]|null + */ + public function getInsideBoundingBox() + { + return $this->container['insideBoundingBox']; + } + + /** + * Sets insideBoundingBox + * + * @param float[]|null $insideBoundingBox search inside a rectangular area (in geo coordinates) + * + * @return self + */ + public function setInsideBoundingBox($insideBoundingBox) + { + $this->container['insideBoundingBox'] = $insideBoundingBox; + + return $this; + } + + /** + * Gets insidePolygon + * + * @return float[]|null + */ + public function getInsidePolygon() + { + return $this->container['insidePolygon']; + } + + /** + * Sets insidePolygon + * + * @param float[]|null $insidePolygon search inside a polygon (in geo coordinates) + * + * @return self + */ + public function setInsidePolygon($insidePolygon) + { + $this->container['insidePolygon'] = $insidePolygon; + + return $this; + } + + /** + * Gets naturalLanguages + * + * @return string[]|null + */ + public function getNaturalLanguages() + { + return $this->container['naturalLanguages']; + } + + /** + * Sets naturalLanguages + * + * @param string[]|null $naturalLanguages This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. + * + * @return self + */ + public function setNaturalLanguages($naturalLanguages) + { + $this->container['naturalLanguages'] = $naturalLanguages; + + return $this; + } + + /** + * Gets ruleContexts + * + * @return string[]|null + */ + public function getRuleContexts() + { + return $this->container['ruleContexts']; + } + + /** + * Sets ruleContexts + * + * @param string[]|null $ruleContexts enables contextual rules + * + * @return self + */ + public function setRuleContexts($ruleContexts) + { + $this->container['ruleContexts'] = $ruleContexts; + + return $this; + } + + /** + * Gets personalizationImpact + * + * @return int|null + */ + public function getPersonalizationImpact() + { + return $this->container['personalizationImpact']; + } + + /** + * Sets personalizationImpact + * + * @param int|null $personalizationImpact define the impact of the Personalization feature + * + * @return self + */ + public function setPersonalizationImpact($personalizationImpact) + { + $this->container['personalizationImpact'] = $personalizationImpact; + + return $this; + } + + /** + * Gets userToken + * + * @return string|null + */ + public function getUserToken() + { + return $this->container['userToken']; + } + + /** + * Sets userToken + * + * @param string|null $userToken associates a certain user token with the current search + * + * @return self + */ + public function setUserToken($userToken) + { + $this->container['userToken'] = $userToken; + + return $this; + } + + /** + * Gets getRankingInfo + * + * @return bool|null + */ + public function getGetRankingInfo() + { + return $this->container['getRankingInfo']; + } + + /** + * Sets getRankingInfo + * + * @param bool|null $getRankingInfo retrieve detailed ranking information + * + * @return self + */ + public function setGetRankingInfo($getRankingInfo) + { + $this->container['getRankingInfo'] = $getRankingInfo; + + return $this; + } + + /** + * Gets clickAnalytics + * + * @return bool|null + */ + public function getClickAnalytics() + { + return $this->container['clickAnalytics']; + } + + /** + * Sets clickAnalytics + * + * @param bool|null $clickAnalytics enable the Click Analytics feature + * + * @return self + */ + public function setClickAnalytics($clickAnalytics) + { + $this->container['clickAnalytics'] = $clickAnalytics; + + return $this; + } + + /** + * Gets analytics + * + * @return bool|null + */ + public function getAnalytics() + { + return $this->container['analytics']; + } + + /** + * Sets analytics + * + * @param bool|null $analytics whether the current query will be taken into account in the Analytics + * + * @return self + */ + public function setAnalytics($analytics) + { + $this->container['analytics'] = $analytics; + + return $this; + } + + /** + * Gets analyticsTags + * + * @return string[]|null + */ + public function getAnalyticsTags() + { + return $this->container['analyticsTags']; + } + + /** + * Sets analyticsTags + * + * @param string[]|null $analyticsTags list of tags to apply to the query for analytics purposes + * + * @return self + */ + public function setAnalyticsTags($analyticsTags) + { + $this->container['analyticsTags'] = $analyticsTags; + + return $this; + } + + /** + * Gets percentileComputation + * + * @return bool|null + */ + public function getPercentileComputation() + { + return $this->container['percentileComputation']; + } + + /** + * Sets percentileComputation + * + * @param bool|null $percentileComputation whether to include or exclude a query from the processing-time percentile computation + * + * @return self + */ + public function setPercentileComputation($percentileComputation) + { + $this->container['percentileComputation'] = $percentileComputation; + + return $this; + } + + /** + * Gets enableABTest + * + * @return bool|null + */ + public function getEnableABTest() + { + return $this->container['enableABTest']; + } + + /** + * Sets enableABTest + * + * @param bool|null $enableABTest whether this search should participate in running AB tests + * + * @return self + */ + public function setEnableABTest($enableABTest) + { + $this->container['enableABTest'] = $enableABTest; + + return $this; + } + + /** + * Gets enableReRanking + * + * @return bool|null + */ + public function getEnableReRanking() + { + return $this->container['enableReRanking']; + } + + /** + * Sets enableReRanking + * + * @param bool|null $enableReRanking whether this search should use AI Re-Ranking + * + * @return self + */ + public function setEnableReRanking($enableReRanking) + { + $this->container['enableReRanking'] = $enableReRanking; + + 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/Search/BaseSearchResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponse.php new file mode 100644 index 0000000000..0fb2fe876b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponse.php @@ -0,0 +1,1016 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BaseSearchResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'baseSearchResponse'; + + /** + * 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', + ]; + + /** + * 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, + ]; + + /** + * 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', + ]; + + /** + * 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', + ]; + + /** + * 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', + ]; + + /** + * 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; + } + + /** + * 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"; + } + + 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 BaseSearchResponse., 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; + } + /** + * 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/Search/BaseSearchResponseFacetsStats.php b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponseFacetsStats.php new file mode 100644 index 0000000000..0b74f01d81 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BaseSearchResponseFacetsStats.php @@ -0,0 +1,380 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BaseSearchResponseFacetsStats implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'baseSearchResponse_facets_stats'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'min' => 'int', + 'max' => 'int', + 'avg' => 'int', + 'sum' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'min' => null, + 'max' => null, + 'avg' => null, + 'sum' => 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 = [ + 'min' => 'min', + 'max' => 'max', + 'avg' => 'avg', + 'sum' => 'sum', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'min' => 'setMin', + 'max' => 'setMax', + 'avg' => 'setAvg', + 'sum' => 'setSum', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'min' => 'getMin', + 'max' => 'getMax', + 'avg' => 'getAvg', + 'sum' => 'getSum', + ]; + + /** + * 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['min'] = $data['min'] ?? null; + $this->container['max'] = $data['max'] ?? null; + $this->container['avg'] = $data['avg'] ?? null; + $this->container['sum'] = $data['sum'] ?? 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 min + * + * @return int|null + */ + public function getMin() + { + return $this->container['min']; + } + + /** + * Sets min + * + * @param int|null $min the minimum value in the result set + * + * @return self + */ + public function setMin($min) + { + $this->container['min'] = $min; + + return $this; + } + + /** + * Gets max + * + * @return int|null + */ + public function getMax() + { + return $this->container['max']; + } + + /** + * Sets max + * + * @param int|null $max the maximum value in the result set + * + * @return self + */ + public function setMax($max) + { + $this->container['max'] = $max; + + return $this; + } + + /** + * Gets avg + * + * @return int|null + */ + public function getAvg() + { + return $this->container['avg']; + } + + /** + * Sets avg + * + * @param int|null $avg the average facet value in the result set + * + * @return self + */ + public function setAvg($avg) + { + $this->container['avg'] = $avg; + + return $this; + } + + /** + * Gets sum + * + * @return int|null + */ + public function getSum() + { + return $this->container['sum']; + } + + /** + * Sets sum + * + * @param int|null $sum the sum of all values in the result set + * + * @return self + */ + public function setSum($sum) + { + $this->container['sum'] = $sum; + + 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/Search/BatchAssignUserIdsParams.php b/clients/algoliasearch-client-php/lib/Model/Search/BatchAssignUserIdsParams.php new file mode 100644 index 0000000000..d301d87606 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BatchAssignUserIdsParams.php @@ -0,0 +1,329 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BatchAssignUserIdsParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'batchAssignUserIdsParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'cluster' => 'string', + 'users' => 'string[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'cluster' => null, + 'users' => 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 = [ + 'cluster' => 'cluster', + 'users' => 'users', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'cluster' => 'setCluster', + 'users' => 'setUsers', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'cluster' => 'getCluster', + 'users' => 'getUsers', + ]; + + /** + * 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['cluster'] = $data['cluster'] ?? null; + $this->container['users'] = $data['users'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['cluster'] === null) { + $invalidProperties[] = "'cluster' can't be null"; + } + if ($this->container['users'] === null) { + $invalidProperties[] = "'users' 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 cluster + * + * @return string + */ + public function getCluster() + { + return $this->container['cluster']; + } + + /** + * Sets cluster + * + * @param string $cluster name of the cluster + * + * @return self + */ + public function setCluster($cluster) + { + $this->container['cluster'] = $cluster; + + return $this; + } + + /** + * Gets users + * + * @return string[] + */ + public function getUsers() + { + return $this->container['users']; + } + + /** + * Sets users + * + * @param string[] $users userIDs to assign. Note you cannot move users with this method. + * + * @return self + */ + public function setUsers($users) + { + $this->container['users'] = $users; + + 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/Search/BatchDictionaryEntries.php b/clients/algoliasearch-client-php/lib/Model/Search/BatchDictionaryEntries.php new file mode 100644 index 0000000000..152b06608f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BatchDictionaryEntries.php @@ -0,0 +1,326 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BatchDictionaryEntries implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'batchDictionaryEntries'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'clearExistingDictionaryEntries' => 'bool', + 'requests' => '\Algolia\AlgoliaSearch\Model\Search\BatchDictionaryEntriesRequest[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'clearExistingDictionaryEntries' => null, + '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 = [ + 'clearExistingDictionaryEntries' => 'clearExistingDictionaryEntries', + 'requests' => 'requests', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'clearExistingDictionaryEntries' => 'setClearExistingDictionaryEntries', + 'requests' => 'setRequests', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'clearExistingDictionaryEntries' => 'getClearExistingDictionaryEntries', + '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['clearExistingDictionaryEntries'] = $data['clearExistingDictionaryEntries'] ?? false; + $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 clearExistingDictionaryEntries + * + * @return bool|null + */ + public function getClearExistingDictionaryEntries() + { + return $this->container['clearExistingDictionaryEntries']; + } + + /** + * Sets clearExistingDictionaryEntries + * + * @param bool|null $clearExistingDictionaryEntries when `true`, start the batch by removing all the custom entries from the dictionary + * + * @return self + */ + public function setClearExistingDictionaryEntries($clearExistingDictionaryEntries) + { + $this->container['clearExistingDictionaryEntries'] = $clearExistingDictionaryEntries; + + return $this; + } + + /** + * Gets requests + * + * @return \Algolia\AlgoliaSearch\Model\Search\BatchDictionaryEntriesRequest[] + */ + public function getRequests() + { + return $this->container['requests']; + } + + /** + * Sets requests + * + * @param \Algolia\AlgoliaSearch\Model\Search\BatchDictionaryEntriesRequest[] $requests List of operations to batch. Each operation is described by an `action` and a `body`. + * + * @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/Search/BatchDictionaryEntriesRequest.php b/clients/algoliasearch-client-php/lib/Model/Search/BatchDictionaryEntriesRequest.php new file mode 100644 index 0000000000..51805d05da --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BatchDictionaryEntriesRequest.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BatchDictionaryEntriesRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'batchDictionaryEntriesRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'action' => '\Algolia\AlgoliaSearch\Model\Search\DictionaryAction', + 'body' => '\Algolia\AlgoliaSearch\Model\Search\DictionaryEntry', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'action' => null, + 'body' => 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 = [ + 'action' => 'action', + 'body' => 'body', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'action' => 'setAction', + 'body' => 'setBody', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'action' => 'getAction', + 'body' => 'getBody', + ]; + + /** + * 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['action'] = $data['action'] ?? null; + $this->container['body'] = $data['body'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['action'] === null) { + $invalidProperties[] = "'action' can't be null"; + } + if ($this->container['body'] === null) { + $invalidProperties[] = "'body' 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 action + * + * @return \Algolia\AlgoliaSearch\Model\Search\DictionaryAction + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \Algolia\AlgoliaSearch\Model\Search\DictionaryAction $action action + * + * @return self + */ + public function setAction($action) + { + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets body + * + * @return \Algolia\AlgoliaSearch\Model\Search\DictionaryEntry + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param \Algolia\AlgoliaSearch\Model\Search\DictionaryEntry $body body + * + * @return self + */ + public function setBody($body) + { + $this->container['body'] = $body; + + 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/Search/BatchParams.php b/clients/algoliasearch-client-php/lib/Model/Search/BatchParams.php new file mode 100644 index 0000000000..a9bf58ead0 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BatchParams.php @@ -0,0 +1,292 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BatchParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'batchParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'requests' => '\Algolia\AlgoliaSearch\Model\Search\Operation[]', + ]; + + /** + * 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 = []; + + 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\Search\Operation[]|null + */ + public function getRequests() + { + return $this->container['requests']; + } + + /** + * Sets requests + * + * @param \Algolia\AlgoliaSearch\Model\Search\Operation[]|null $requests 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/Search/BatchResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/BatchResponse.php new file mode 100644 index 0000000000..de52770710 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BatchResponse.php @@ -0,0 +1,320 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BatchResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'batchResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'taskID' => 'int', + 'objectIDs' => 'string[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'taskID' => null, + 'objectIDs' => 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 = [ + 'taskID' => 'taskID', + 'objectIDs' => 'objectIDs', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'taskID' => 'setTaskID', + 'objectIDs' => 'setObjectIDs', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'taskID' => 'getTaskID', + 'objectIDs' => 'getObjectIDs', + ]; + + /** + * 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['taskID'] = $data['taskID'] ?? null; + $this->container['objectIDs'] = $data['objectIDs'] ?? 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 taskID + * + * @return int|null + */ + public function getTaskID() + { + return $this->container['taskID']; + } + + /** + * Sets taskID + * + * @param int|null $taskID taskID of the task to wait for + * + * @return self + */ + public function setTaskID($taskID) + { + $this->container['taskID'] = $taskID; + + return $this; + } + + /** + * Gets objectIDs + * + * @return string[]|null + */ + public function getObjectIDs() + { + return $this->container['objectIDs']; + } + + /** + * Sets objectIDs + * + * @param string[]|null $objectIDs list of objectID + * + * @return self + */ + public function setObjectIDs($objectIDs) + { + $this->container['objectIDs'] = $objectIDs; + + 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/Search/BatchWriteParams.php b/clients/algoliasearch-client-php/lib/Model/Search/BatchWriteParams.php new file mode 100644 index 0000000000..4567f9264d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BatchWriteParams.php @@ -0,0 +1,292 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BatchWriteParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'batchWriteParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'requests' => '\Algolia\AlgoliaSearch\Model\Search\Operation[]', + ]; + + /** + * 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 = []; + + 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\Search\Operation[]|null + */ + public function getRequests() + { + return $this->container['requests']; + } + + /** + * Sets requests + * + * @param \Algolia\AlgoliaSearch\Model\Search\Operation[]|null $requests 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/Search/BrowseRequest.php b/clients/algoliasearch-client-php/lib/Model/Search/BrowseRequest.php new file mode 100644 index 0000000000..ba0ee35fd8 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BrowseRequest.php @@ -0,0 +1,320 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BrowseRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'browseRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'params' => 'string', + 'cursor' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'params' => null, + 'cursor' => 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 = [ + 'params' => 'params', + 'cursor' => 'cursor', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'params' => 'setParams', + 'cursor' => 'setCursor', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'params' => 'getParams', + 'cursor' => 'getCursor', + ]; + + /** + * 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['params'] = $data['params'] ?? ''; + $this->container['cursor'] = $data['cursor'] ?? 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 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 cursor + * + * @return string|null + */ + public function getCursor() + { + return $this->container['cursor']; + } + + /** + * Sets cursor + * + * @param string|null $cursor Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. + * + * @return self + */ + public function setCursor($cursor) + { + $this->container['cursor'] = $cursor; + + 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/Search/BrowseResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/BrowseResponse.php new file mode 100644 index 0000000000..20ccbca580 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BrowseResponse.php @@ -0,0 +1,1082 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BrowseResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'browseResponse'; + + /** + * 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\Search\Hit[]', + 'cursor' => 'string', + ]; + + /** + * 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, + 'cursor' => 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', + 'cursor' => 'cursor', + ]; + + /** + * 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', + 'cursor' => 'setCursor', + ]; + + /** + * 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', + 'cursor' => 'getCursor', + ]; + + /** + * 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; + $this->container['cursor'] = $data['cursor'] ?? 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"; + } + if ($this->container['cursor'] === null) { + $invalidProperties[] = "'cursor' 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 BrowseResponse., 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\Search\Hit[] + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\Search\Hit[] $hits hits + * + * @return self + */ + public function setHits($hits) + { + $this->container['hits'] = $hits; + + return $this; + } + + /** + * Gets cursor + * + * @return string + */ + public function getCursor() + { + return $this->container['cursor']; + } + + /** + * Sets cursor + * + * @param string $cursor Cursor indicating the location to resume browsing from. Must match the value returned by the previous call. + * + * @return self + */ + public function setCursor($cursor) + { + $this->container['cursor'] = $cursor; + + 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/Search/BuiltInOperation.php b/clients/algoliasearch-client-php/lib/Model/Search/BuiltInOperation.php new file mode 100644 index 0000000000..3b431c5987 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/BuiltInOperation.php @@ -0,0 +1,374 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class BuiltInOperation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'builtInOperation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'operation' => 'string', + 'value' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'operation' => 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 = [ + 'operation' => '_operation', + 'value' => 'value', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'operation' => 'setOperation', + 'value' => 'setValue', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'operation' => 'getOperation', + '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; + } + + const OPERATION_INCREMENT = 'Increment'; + const OPERATION_DECREMENT = 'Decrement'; + const OPERATION_ADD = 'Add'; + const OPERATION_REMOVE = 'Remove'; + const OPERATION_ADD_UNIQUE = 'AddUnique'; + const OPERATION_INCREMENT_FROM = 'IncrementFrom'; + const OPERATION_INCREMENT_SET = 'IncrementSet'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getOperationAllowableValues() + { + return [ + self::OPERATION_INCREMENT, + self::OPERATION_DECREMENT, + self::OPERATION_ADD, + self::OPERATION_REMOVE, + self::OPERATION_ADD_UNIQUE, + self::OPERATION_INCREMENT_FROM, + self::OPERATION_INCREMENT_SET, + ]; + } + + /** + * 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['operation'] = $data['operation'] ?? 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['operation'] === null) { + $invalidProperties[] = "'operation' can't be null"; + } + $allowedValues = $this->getOperationAllowableValues(); + if (!is_null($this->container['operation']) && !in_array($this->container['operation'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'operation', must be one of '%s'", + $this->container['operation'], + implode("', '", $allowedValues) + ); + } + + 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 operation + * + * @return string + */ + public function getOperation() + { + return $this->container['operation']; + } + + /** + * Sets operation + * + * @param string $operation the operation to apply on the attribute + * + * @return self + */ + public function setOperation($operation) + { + $allowedValues = $this->getOperationAllowableValues(); + if (!in_array($operation, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'operation', must be one of '%s'", + $operation, + implode("', '", $allowedValues) + ) + ); + } + $this->container['operation'] = $operation; + + return $this; + } + + /** + * Gets value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value the right-hand side argument to the operation, for example, increment or decrement step, value to add or remove + * + * @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/Search/Condition.php b/clients/algoliasearch-client-php/lib/Model/Search/Condition.php new file mode 100644 index 0000000000..df7aaba06d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Condition.php @@ -0,0 +1,380 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Condition implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'condition'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'pattern' => 'string', + 'anchoring' => '\Algolia\AlgoliaSearch\Model\Search\Anchoring', + 'alternatives' => 'bool', + 'context' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'pattern' => null, + 'anchoring' => null, + 'alternatives' => null, + 'context' => 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 = [ + 'pattern' => 'pattern', + 'anchoring' => 'anchoring', + 'alternatives' => 'alternatives', + 'context' => 'context', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'pattern' => 'setPattern', + 'anchoring' => 'setAnchoring', + 'alternatives' => 'setAlternatives', + 'context' => 'setContext', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'pattern' => 'getPattern', + 'anchoring' => 'getAnchoring', + 'alternatives' => 'getAlternatives', + 'context' => 'getContext', + ]; + + /** + * 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['pattern'] = $data['pattern'] ?? null; + $this->container['anchoring'] = $data['anchoring'] ?? null; + $this->container['alternatives'] = $data['alternatives'] ?? false; + $this->container['context'] = $data['context'] ?? 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 pattern + * + * @return string|null + */ + public function getPattern() + { + return $this->container['pattern']; + } + + /** + * Sets pattern + * + * @param string|null $pattern Query pattern syntax + * + * @return self + */ + public function setPattern($pattern) + { + $this->container['pattern'] = $pattern; + + return $this; + } + + /** + * Gets anchoring + * + * @return \Algolia\AlgoliaSearch\Model\Search\Anchoring|null + */ + public function getAnchoring() + { + return $this->container['anchoring']; + } + + /** + * Sets anchoring + * + * @param \Algolia\AlgoliaSearch\Model\Search\Anchoring|null $anchoring anchoring + * + * @return self + */ + public function setAnchoring($anchoring) + { + $this->container['anchoring'] = $anchoring; + + return $this; + } + + /** + * Gets alternatives + * + * @return bool|null + */ + public function getAlternatives() + { + return $this->container['alternatives']; + } + + /** + * Sets alternatives + * + * @param bool|null $alternatives whether the pattern matches on plurals, synonyms, and typos + * + * @return self + */ + public function setAlternatives($alternatives) + { + $this->container['alternatives'] = $alternatives; + + return $this; + } + + /** + * Gets context + * + * @return string|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param string|null $context rule context format: [A-Za-z0-9_-]+) + * + * @return self + */ + public function setContext($context) + { + $this->container['context'] = $context; + + 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/Search/Consequence.php b/clients/algoliasearch-client-php/lib/Model/Search/Consequence.php new file mode 100644 index 0000000000..7926cdeb2c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Consequence.php @@ -0,0 +1,412 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Consequence implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'consequence'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'params' => '\Algolia\AlgoliaSearch\Model\Search\ConsequenceParams', + 'promote' => '\Algolia\AlgoliaSearch\Model\Search\Promote[]', + 'filterPromotes' => 'bool', + 'hide' => '\Algolia\AlgoliaSearch\Model\Search\ConsequenceHide[]', + 'userData' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'params' => null, + 'promote' => null, + 'filterPromotes' => null, + 'hide' => null, + 'userData' => 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 = [ + 'params' => 'params', + 'promote' => 'promote', + 'filterPromotes' => 'filterPromotes', + 'hide' => 'hide', + 'userData' => 'userData', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'params' => 'setParams', + 'promote' => 'setPromote', + 'filterPromotes' => 'setFilterPromotes', + 'hide' => 'setHide', + 'userData' => 'setUserData', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'params' => 'getParams', + 'promote' => 'getPromote', + 'filterPromotes' => 'getFilterPromotes', + 'hide' => 'getHide', + 'userData' => 'getUserData', + ]; + + /** + * 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['params'] = $data['params'] ?? null; + $this->container['promote'] = $data['promote'] ?? null; + $this->container['filterPromotes'] = $data['filterPromotes'] ?? false; + $this->container['hide'] = $data['hide'] ?? null; + $this->container['userData'] = $data['userData'] ?? 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 params + * + * @return \Algolia\AlgoliaSearch\Model\Search\ConsequenceParams|null + */ + public function getParams() + { + return $this->container['params']; + } + + /** + * Sets params + * + * @param \Algolia\AlgoliaSearch\Model\Search\ConsequenceParams|null $params params + * + * @return self + */ + public function setParams($params) + { + $this->container['params'] = $params; + + return $this; + } + + /** + * Gets promote + * + * @return \Algolia\AlgoliaSearch\Model\Search\Promote[]|null + */ + public function getPromote() + { + return $this->container['promote']; + } + + /** + * Sets promote + * + * @param \Algolia\AlgoliaSearch\Model\Search\Promote[]|null $promote objects to promote as hits + * + * @return self + */ + public function setPromote($promote) + { + $this->container['promote'] = $promote; + + return $this; + } + + /** + * Gets filterPromotes + * + * @return bool|null + */ + public function getFilterPromotes() + { + return $this->container['filterPromotes']; + } + + /** + * Sets filterPromotes + * + * @param bool|null $filterPromotes Only use in combination with the promote consequence. When true, promoted results will be restricted to match the filters of the current search. When false, the promoted results will show up regardless of the filters. + * + * @return self + */ + public function setFilterPromotes($filterPromotes) + { + $this->container['filterPromotes'] = $filterPromotes; + + return $this; + } + + /** + * Gets hide + * + * @return \Algolia\AlgoliaSearch\Model\Search\ConsequenceHide[]|null + */ + public function getHide() + { + return $this->container['hide']; + } + + /** + * Sets hide + * + * @param \Algolia\AlgoliaSearch\Model\Search\ConsequenceHide[]|null $hide Objects to hide from hits. Each object must contain an objectID field. By default, you can hide up to 50 items per rule. + * + * @return self + */ + public function setHide($hide) + { + $this->container['hide'] = $hide; + + return $this; + } + + /** + * Gets userData + * + * @return object|null + */ + public function getUserData() + { + return $this->container['userData']; + } + + /** + * Sets userData + * + * @param object|null $userData Custom JSON object that will be appended to the userData array in the response. This object isn't interpreted by the API. It's limited to 1kB of minified JSON. + * + * @return self + */ + public function setUserData($userData) + { + $this->container['userData'] = $userData; + + 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/Search/ConsequenceHide.php b/clients/algoliasearch-client-php/lib/Model/Search/ConsequenceHide.php new file mode 100644 index 0000000000..f99d024a5f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/ConsequenceHide.php @@ -0,0 +1,296 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ConsequenceHide implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'consequence_hide'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'objectID' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'objectID' => 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 = [ + 'objectID' => 'objectID', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'objectID' => 'setObjectID', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'objectID' => 'getObjectID', + ]; + + /** + * 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; + } + + /** + * 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"; + } + + 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; + } + /** + * 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/Search/ConsequenceParams.php b/clients/algoliasearch-client-php/lib/Model/Search/ConsequenceParams.php new file mode 100644 index 0000000000..e9275da4a1 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/ConsequenceParams.php @@ -0,0 +1,2890 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ConsequenceParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'consequenceParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'query' => 'string', + 'automaticFacetFilters' => '\Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]', + 'automaticOptionalFacetFilters' => '\Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]', + 'similarQuery' => 'string', + 'filters' => 'string', + 'facetFilters' => 'string[]', + 'optionalFilters' => 'string[]', + 'numericFilters' => 'string[]', + 'tagFilters' => 'string[]', + 'sumOrFiltersScores' => 'bool', + 'facets' => 'string[]', + 'maxValuesPerFacet' => 'int', + 'facetingAfterDistinct' => 'bool', + 'sortFacetValuesBy' => 'string', + 'page' => 'int', + 'offset' => 'int', + 'length' => 'int', + 'aroundLatLng' => 'string', + 'aroundLatLngViaIP' => 'bool', + 'aroundRadius' => 'OneOfIntegerString', + 'aroundPrecision' => 'int', + 'minimumAroundRadius' => 'int', + 'insideBoundingBox' => 'float[]', + 'insidePolygon' => 'float[]', + 'naturalLanguages' => 'string[]', + 'ruleContexts' => 'string[]', + 'personalizationImpact' => 'int', + 'userToken' => 'string', + 'getRankingInfo' => 'bool', + 'clickAnalytics' => 'bool', + 'analytics' => 'bool', + 'analyticsTags' => 'string[]', + 'percentileComputation' => 'bool', + 'enableABTest' => 'bool', + 'enableReRanking' => 'bool', + 'searchableAttributes' => 'string[]', + 'attributesForFaceting' => 'string[]', + 'unretrievableAttributes' => 'string[]', + 'attributesToRetrieve' => 'string[]', + 'restrictSearchableAttributes' => 'string[]', + 'ranking' => 'string[]', + 'customRanking' => 'string[]', + 'relevancyStrictness' => 'int', + 'attributesToHighlight' => 'string[]', + 'attributesToSnippet' => 'string[]', + 'highlightPreTag' => 'string', + 'highlightPostTag' => 'string', + 'snippetEllipsisText' => 'string', + 'restrictHighlightAndSnippetArrays' => 'bool', + 'hitsPerPage' => 'int', + 'minWordSizefor1Typo' => 'int', + 'minWordSizefor2Typos' => 'int', + 'typoTolerance' => 'string', + 'allowTyposOnNumericTokens' => 'bool', + 'disableTypoToleranceOnAttributes' => 'string[]', + 'separatorsToIndex' => 'string', + 'ignorePlurals' => 'string', + 'removeStopWords' => 'string', + 'keepDiacriticsOnCharacters' => 'string', + 'queryLanguages' => 'string[]', + 'decompoundQuery' => 'bool', + 'enableRules' => 'bool', + 'enablePersonalization' => 'bool', + 'queryType' => 'string', + 'removeWordsIfNoResults' => 'string', + 'advancedSyntax' => 'bool', + 'optionalWords' => 'string[]', + 'disableExactOnAttributes' => 'string[]', + 'exactOnSingleWordQuery' => 'string', + 'alternativesAsExact' => 'string[]', + 'advancedSyntaxFeatures' => 'string[]', + 'distinct' => 'int', + 'synonyms' => 'bool', + 'replaceSynonymsInHighlight' => 'bool', + 'minProximity' => 'int', + 'responseFields' => 'string[]', + 'maxFacetHits' => 'int', + 'attributeCriteriaComputedByMinProximity' => 'bool', + 'renderingContent' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'query' => null, + 'automaticFacetFilters' => null, + 'automaticOptionalFacetFilters' => null, + 'similarQuery' => null, + 'filters' => null, + 'facetFilters' => null, + 'optionalFilters' => null, + 'numericFilters' => null, + 'tagFilters' => null, + 'sumOrFiltersScores' => null, + 'facets' => null, + 'maxValuesPerFacet' => null, + 'facetingAfterDistinct' => null, + 'sortFacetValuesBy' => null, + 'page' => null, + 'offset' => null, + 'length' => null, + 'aroundLatLng' => null, + 'aroundLatLngViaIP' => null, + 'aroundRadius' => null, + 'aroundPrecision' => null, + 'minimumAroundRadius' => null, + 'insideBoundingBox' => null, + 'insidePolygon' => null, + 'naturalLanguages' => null, + 'ruleContexts' => null, + 'personalizationImpact' => null, + 'userToken' => null, + 'getRankingInfo' => null, + 'clickAnalytics' => null, + 'analytics' => null, + 'analyticsTags' => null, + 'percentileComputation' => null, + 'enableABTest' => null, + 'enableReRanking' => null, + 'searchableAttributes' => null, + 'attributesForFaceting' => null, + 'unretrievableAttributes' => null, + 'attributesToRetrieve' => null, + 'restrictSearchableAttributes' => null, + 'ranking' => null, + 'customRanking' => null, + 'relevancyStrictness' => null, + 'attributesToHighlight' => null, + 'attributesToSnippet' => null, + 'highlightPreTag' => null, + 'highlightPostTag' => null, + 'snippetEllipsisText' => null, + 'restrictHighlightAndSnippetArrays' => null, + 'hitsPerPage' => null, + 'minWordSizefor1Typo' => null, + 'minWordSizefor2Typos' => null, + 'typoTolerance' => null, + 'allowTyposOnNumericTokens' => null, + 'disableTypoToleranceOnAttributes' => null, + 'separatorsToIndex' => null, + 'ignorePlurals' => null, + 'removeStopWords' => null, + 'keepDiacriticsOnCharacters' => null, + 'queryLanguages' => null, + 'decompoundQuery' => null, + 'enableRules' => null, + 'enablePersonalization' => null, + 'queryType' => null, + 'removeWordsIfNoResults' => null, + 'advancedSyntax' => null, + 'optionalWords' => null, + 'disableExactOnAttributes' => null, + 'exactOnSingleWordQuery' => null, + 'alternativesAsExact' => null, + 'advancedSyntaxFeatures' => null, + 'distinct' => null, + 'synonyms' => null, + 'replaceSynonymsInHighlight' => null, + 'minProximity' => null, + 'responseFields' => null, + 'maxFacetHits' => null, + 'attributeCriteriaComputedByMinProximity' => null, + 'renderingContent' => 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', + 'automaticFacetFilters' => 'automaticFacetFilters', + 'automaticOptionalFacetFilters' => 'automaticOptionalFacetFilters', + 'similarQuery' => 'similarQuery', + 'filters' => 'filters', + 'facetFilters' => 'facetFilters', + 'optionalFilters' => 'optionalFilters', + 'numericFilters' => 'numericFilters', + 'tagFilters' => 'tagFilters', + 'sumOrFiltersScores' => 'sumOrFiltersScores', + 'facets' => 'facets', + 'maxValuesPerFacet' => 'maxValuesPerFacet', + 'facetingAfterDistinct' => 'facetingAfterDistinct', + 'sortFacetValuesBy' => 'sortFacetValuesBy', + 'page' => 'page', + 'offset' => 'offset', + 'length' => 'length', + 'aroundLatLng' => 'aroundLatLng', + 'aroundLatLngViaIP' => 'aroundLatLngViaIP', + 'aroundRadius' => 'aroundRadius', + 'aroundPrecision' => 'aroundPrecision', + 'minimumAroundRadius' => 'minimumAroundRadius', + 'insideBoundingBox' => 'insideBoundingBox', + 'insidePolygon' => 'insidePolygon', + 'naturalLanguages' => 'naturalLanguages', + 'ruleContexts' => 'ruleContexts', + 'personalizationImpact' => 'personalizationImpact', + 'userToken' => 'userToken', + 'getRankingInfo' => 'getRankingInfo', + 'clickAnalytics' => 'clickAnalytics', + 'analytics' => 'analytics', + 'analyticsTags' => 'analyticsTags', + 'percentileComputation' => 'percentileComputation', + 'enableABTest' => 'enableABTest', + 'enableReRanking' => 'enableReRanking', + 'searchableAttributes' => 'searchableAttributes', + 'attributesForFaceting' => 'attributesForFaceting', + 'unretrievableAttributes' => 'unretrievableAttributes', + 'attributesToRetrieve' => 'attributesToRetrieve', + 'restrictSearchableAttributes' => 'restrictSearchableAttributes', + 'ranking' => 'ranking', + 'customRanking' => 'customRanking', + 'relevancyStrictness' => 'relevancyStrictness', + 'attributesToHighlight' => 'attributesToHighlight', + 'attributesToSnippet' => 'attributesToSnippet', + 'highlightPreTag' => 'highlightPreTag', + 'highlightPostTag' => 'highlightPostTag', + 'snippetEllipsisText' => 'snippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'restrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'hitsPerPage', + 'minWordSizefor1Typo' => 'minWordSizefor1Typo', + 'minWordSizefor2Typos' => 'minWordSizefor2Typos', + 'typoTolerance' => 'typoTolerance', + 'allowTyposOnNumericTokens' => 'allowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'disableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'separatorsToIndex', + 'ignorePlurals' => 'ignorePlurals', + 'removeStopWords' => 'removeStopWords', + 'keepDiacriticsOnCharacters' => 'keepDiacriticsOnCharacters', + 'queryLanguages' => 'queryLanguages', + 'decompoundQuery' => 'decompoundQuery', + 'enableRules' => 'enableRules', + 'enablePersonalization' => 'enablePersonalization', + 'queryType' => 'queryType', + 'removeWordsIfNoResults' => 'removeWordsIfNoResults', + 'advancedSyntax' => 'advancedSyntax', + 'optionalWords' => 'optionalWords', + 'disableExactOnAttributes' => 'disableExactOnAttributes', + 'exactOnSingleWordQuery' => 'exactOnSingleWordQuery', + 'alternativesAsExact' => 'alternativesAsExact', + 'advancedSyntaxFeatures' => 'advancedSyntaxFeatures', + 'distinct' => 'distinct', + 'synonyms' => 'synonyms', + 'replaceSynonymsInHighlight' => 'replaceSynonymsInHighlight', + 'minProximity' => 'minProximity', + 'responseFields' => 'responseFields', + 'maxFacetHits' => 'maxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'attributeCriteriaComputedByMinProximity', + 'renderingContent' => 'renderingContent', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'query' => 'setQuery', + 'automaticFacetFilters' => 'setAutomaticFacetFilters', + 'automaticOptionalFacetFilters' => 'setAutomaticOptionalFacetFilters', + 'similarQuery' => 'setSimilarQuery', + 'filters' => 'setFilters', + 'facetFilters' => 'setFacetFilters', + 'optionalFilters' => 'setOptionalFilters', + 'numericFilters' => 'setNumericFilters', + 'tagFilters' => 'setTagFilters', + 'sumOrFiltersScores' => 'setSumOrFiltersScores', + 'facets' => 'setFacets', + 'maxValuesPerFacet' => 'setMaxValuesPerFacet', + 'facetingAfterDistinct' => 'setFacetingAfterDistinct', + 'sortFacetValuesBy' => 'setSortFacetValuesBy', + 'page' => 'setPage', + 'offset' => 'setOffset', + 'length' => 'setLength', + 'aroundLatLng' => 'setAroundLatLng', + 'aroundLatLngViaIP' => 'setAroundLatLngViaIP', + 'aroundRadius' => 'setAroundRadius', + 'aroundPrecision' => 'setAroundPrecision', + 'minimumAroundRadius' => 'setMinimumAroundRadius', + 'insideBoundingBox' => 'setInsideBoundingBox', + 'insidePolygon' => 'setInsidePolygon', + 'naturalLanguages' => 'setNaturalLanguages', + 'ruleContexts' => 'setRuleContexts', + 'personalizationImpact' => 'setPersonalizationImpact', + 'userToken' => 'setUserToken', + 'getRankingInfo' => 'setGetRankingInfo', + 'clickAnalytics' => 'setClickAnalytics', + 'analytics' => 'setAnalytics', + 'analyticsTags' => 'setAnalyticsTags', + 'percentileComputation' => 'setPercentileComputation', + 'enableABTest' => 'setEnableABTest', + 'enableReRanking' => 'setEnableReRanking', + 'searchableAttributes' => 'setSearchableAttributes', + 'attributesForFaceting' => 'setAttributesForFaceting', + 'unretrievableAttributes' => 'setUnretrievableAttributes', + 'attributesToRetrieve' => 'setAttributesToRetrieve', + 'restrictSearchableAttributes' => 'setRestrictSearchableAttributes', + 'ranking' => 'setRanking', + 'customRanking' => 'setCustomRanking', + 'relevancyStrictness' => 'setRelevancyStrictness', + 'attributesToHighlight' => 'setAttributesToHighlight', + 'attributesToSnippet' => 'setAttributesToSnippet', + 'highlightPreTag' => 'setHighlightPreTag', + 'highlightPostTag' => 'setHighlightPostTag', + 'snippetEllipsisText' => 'setSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'setRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'setHitsPerPage', + 'minWordSizefor1Typo' => 'setMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'setMinWordSizefor2Typos', + 'typoTolerance' => 'setTypoTolerance', + 'allowTyposOnNumericTokens' => 'setAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'setDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'setSeparatorsToIndex', + 'ignorePlurals' => 'setIgnorePlurals', + 'removeStopWords' => 'setRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'setKeepDiacriticsOnCharacters', + 'queryLanguages' => 'setQueryLanguages', + 'decompoundQuery' => 'setDecompoundQuery', + 'enableRules' => 'setEnableRules', + 'enablePersonalization' => 'setEnablePersonalization', + 'queryType' => 'setQueryType', + 'removeWordsIfNoResults' => 'setRemoveWordsIfNoResults', + 'advancedSyntax' => 'setAdvancedSyntax', + 'optionalWords' => 'setOptionalWords', + 'disableExactOnAttributes' => 'setDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'setExactOnSingleWordQuery', + 'alternativesAsExact' => 'setAlternativesAsExact', + 'advancedSyntaxFeatures' => 'setAdvancedSyntaxFeatures', + 'distinct' => 'setDistinct', + 'synonyms' => 'setSynonyms', + 'replaceSynonymsInHighlight' => 'setReplaceSynonymsInHighlight', + 'minProximity' => 'setMinProximity', + 'responseFields' => 'setResponseFields', + 'maxFacetHits' => 'setMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'setAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'setRenderingContent', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'query' => 'getQuery', + 'automaticFacetFilters' => 'getAutomaticFacetFilters', + 'automaticOptionalFacetFilters' => 'getAutomaticOptionalFacetFilters', + 'similarQuery' => 'getSimilarQuery', + 'filters' => 'getFilters', + 'facetFilters' => 'getFacetFilters', + 'optionalFilters' => 'getOptionalFilters', + 'numericFilters' => 'getNumericFilters', + 'tagFilters' => 'getTagFilters', + 'sumOrFiltersScores' => 'getSumOrFiltersScores', + 'facets' => 'getFacets', + 'maxValuesPerFacet' => 'getMaxValuesPerFacet', + 'facetingAfterDistinct' => 'getFacetingAfterDistinct', + 'sortFacetValuesBy' => 'getSortFacetValuesBy', + 'page' => 'getPage', + 'offset' => 'getOffset', + 'length' => 'getLength', + 'aroundLatLng' => 'getAroundLatLng', + 'aroundLatLngViaIP' => 'getAroundLatLngViaIP', + 'aroundRadius' => 'getAroundRadius', + 'aroundPrecision' => 'getAroundPrecision', + 'minimumAroundRadius' => 'getMinimumAroundRadius', + 'insideBoundingBox' => 'getInsideBoundingBox', + 'insidePolygon' => 'getInsidePolygon', + 'naturalLanguages' => 'getNaturalLanguages', + 'ruleContexts' => 'getRuleContexts', + 'personalizationImpact' => 'getPersonalizationImpact', + 'userToken' => 'getUserToken', + 'getRankingInfo' => 'getGetRankingInfo', + 'clickAnalytics' => 'getClickAnalytics', + 'analytics' => 'getAnalytics', + 'analyticsTags' => 'getAnalyticsTags', + 'percentileComputation' => 'getPercentileComputation', + 'enableABTest' => 'getEnableABTest', + 'enableReRanking' => 'getEnableReRanking', + 'searchableAttributes' => 'getSearchableAttributes', + 'attributesForFaceting' => 'getAttributesForFaceting', + 'unretrievableAttributes' => 'getUnretrievableAttributes', + 'attributesToRetrieve' => 'getAttributesToRetrieve', + 'restrictSearchableAttributes' => 'getRestrictSearchableAttributes', + 'ranking' => 'getRanking', + 'customRanking' => 'getCustomRanking', + 'relevancyStrictness' => 'getRelevancyStrictness', + 'attributesToHighlight' => 'getAttributesToHighlight', + 'attributesToSnippet' => 'getAttributesToSnippet', + 'highlightPreTag' => 'getHighlightPreTag', + 'highlightPostTag' => 'getHighlightPostTag', + 'snippetEllipsisText' => 'getSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'getRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'getHitsPerPage', + 'minWordSizefor1Typo' => 'getMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'getMinWordSizefor2Typos', + 'typoTolerance' => 'getTypoTolerance', + 'allowTyposOnNumericTokens' => 'getAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'getDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'getSeparatorsToIndex', + 'ignorePlurals' => 'getIgnorePlurals', + 'removeStopWords' => 'getRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'getKeepDiacriticsOnCharacters', + 'queryLanguages' => 'getQueryLanguages', + 'decompoundQuery' => 'getDecompoundQuery', + 'enableRules' => 'getEnableRules', + 'enablePersonalization' => 'getEnablePersonalization', + 'queryType' => 'getQueryType', + 'removeWordsIfNoResults' => 'getRemoveWordsIfNoResults', + 'advancedSyntax' => 'getAdvancedSyntax', + 'optionalWords' => 'getOptionalWords', + 'disableExactOnAttributes' => 'getDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'getExactOnSingleWordQuery', + 'alternativesAsExact' => 'getAlternativesAsExact', + 'advancedSyntaxFeatures' => 'getAdvancedSyntaxFeatures', + 'distinct' => 'getDistinct', + 'synonyms' => 'getSynonyms', + 'replaceSynonymsInHighlight' => 'getReplaceSynonymsInHighlight', + 'minProximity' => 'getMinProximity', + 'responseFields' => 'getResponseFields', + 'maxFacetHits' => 'getMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'getAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'getRenderingContent', + ]; + + /** + * 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 TYPO_TOLERANCE_TRUE = 'true'; + const TYPO_TOLERANCE_FALSE = 'false'; + const TYPO_TOLERANCE_MIN = 'min'; + const TYPO_TOLERANCE_STRICT = 'strict'; + const QUERY_TYPE_PREFIX_LAST = 'prefixLast'; + const QUERY_TYPE_PREFIX_ALL = 'prefixAll'; + const QUERY_TYPE_PREFIX_NONE = 'prefixNone'; + const REMOVE_WORDS_IF_NO_RESULTS_NONE = 'none'; + const REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS = 'lastWords'; + const REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS = 'firstWords'; + const REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL = 'allOptional'; + const EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE = 'attribute'; + const EXACT_ON_SINGLE_WORD_QUERY_NONE = 'none'; + const EXACT_ON_SINGLE_WORD_QUERY_WORD = 'word'; + const ALTERNATIVES_AS_EXACT_IGNORE_PLURALS = 'ignorePlurals'; + const ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM = 'singleWordSynonym'; + const ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM = 'multiWordsSynonym'; + const ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE = 'exactPhrase'; + const ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS = 'excludeWords'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypoToleranceAllowableValues() + { + return [ + self::TYPO_TOLERANCE_TRUE, + self::TYPO_TOLERANCE_FALSE, + self::TYPO_TOLERANCE_MIN, + self::TYPO_TOLERANCE_STRICT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getQueryTypeAllowableValues() + { + return [ + self::QUERY_TYPE_PREFIX_LAST, + self::QUERY_TYPE_PREFIX_ALL, + self::QUERY_TYPE_PREFIX_NONE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRemoveWordsIfNoResultsAllowableValues() + { + return [ + self::REMOVE_WORDS_IF_NO_RESULTS_NONE, + self::REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExactOnSingleWordQueryAllowableValues() + { + return [ + self::EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE, + self::EXACT_ON_SINGLE_WORD_QUERY_NONE, + self::EXACT_ON_SINGLE_WORD_QUERY_WORD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativesAsExactAllowableValues() + { + return [ + self::ALTERNATIVES_AS_EXACT_IGNORE_PLURALS, + self::ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM, + self::ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAdvancedSyntaxFeaturesAllowableValues() + { + return [ + self::ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE, + self::ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS, + ]; + } + + /** + * 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['automaticFacetFilters'] = $data['automaticFacetFilters'] ?? null; + $this->container['automaticOptionalFacetFilters'] = $data['automaticOptionalFacetFilters'] ?? null; + $this->container['similarQuery'] = $data['similarQuery'] ?? ''; + $this->container['filters'] = $data['filters'] ?? ''; + $this->container['facetFilters'] = $data['facetFilters'] ?? null; + $this->container['optionalFilters'] = $data['optionalFilters'] ?? null; + $this->container['numericFilters'] = $data['numericFilters'] ?? null; + $this->container['tagFilters'] = $data['tagFilters'] ?? null; + $this->container['sumOrFiltersScores'] = $data['sumOrFiltersScores'] ?? false; + $this->container['facets'] = $data['facets'] ?? null; + $this->container['maxValuesPerFacet'] = $data['maxValuesPerFacet'] ?? 100; + $this->container['facetingAfterDistinct'] = $data['facetingAfterDistinct'] ?? false; + $this->container['sortFacetValuesBy'] = $data['sortFacetValuesBy'] ?? 'count'; + $this->container['page'] = $data['page'] ?? 0; + $this->container['offset'] = $data['offset'] ?? null; + $this->container['length'] = $data['length'] ?? null; + $this->container['aroundLatLng'] = $data['aroundLatLng'] ?? ''; + $this->container['aroundLatLngViaIP'] = $data['aroundLatLngViaIP'] ?? false; + $this->container['aroundRadius'] = $data['aroundRadius'] ?? null; + $this->container['aroundPrecision'] = $data['aroundPrecision'] ?? 10; + $this->container['minimumAroundRadius'] = $data['minimumAroundRadius'] ?? null; + $this->container['insideBoundingBox'] = $data['insideBoundingBox'] ?? null; + $this->container['insidePolygon'] = $data['insidePolygon'] ?? null; + $this->container['naturalLanguages'] = $data['naturalLanguages'] ?? null; + $this->container['ruleContexts'] = $data['ruleContexts'] ?? null; + $this->container['personalizationImpact'] = $data['personalizationImpact'] ?? 100; + $this->container['userToken'] = $data['userToken'] ?? null; + $this->container['getRankingInfo'] = $data['getRankingInfo'] ?? false; + $this->container['clickAnalytics'] = $data['clickAnalytics'] ?? false; + $this->container['analytics'] = $data['analytics'] ?? true; + $this->container['analyticsTags'] = $data['analyticsTags'] ?? null; + $this->container['percentileComputation'] = $data['percentileComputation'] ?? true; + $this->container['enableABTest'] = $data['enableABTest'] ?? true; + $this->container['enableReRanking'] = $data['enableReRanking'] ?? true; + $this->container['searchableAttributes'] = $data['searchableAttributes'] ?? null; + $this->container['attributesForFaceting'] = $data['attributesForFaceting'] ?? null; + $this->container['unretrievableAttributes'] = $data['unretrievableAttributes'] ?? null; + $this->container['attributesToRetrieve'] = $data['attributesToRetrieve'] ?? null; + $this->container['restrictSearchableAttributes'] = $data['restrictSearchableAttributes'] ?? null; + $this->container['ranking'] = $data['ranking'] ?? null; + $this->container['customRanking'] = $data['customRanking'] ?? null; + $this->container['relevancyStrictness'] = $data['relevancyStrictness'] ?? 100; + $this->container['attributesToHighlight'] = $data['attributesToHighlight'] ?? null; + $this->container['attributesToSnippet'] = $data['attributesToSnippet'] ?? null; + $this->container['highlightPreTag'] = $data['highlightPreTag'] ?? ''; + $this->container['highlightPostTag'] = $data['highlightPostTag'] ?? ''; + $this->container['snippetEllipsisText'] = $data['snippetEllipsisText'] ?? '…'; + $this->container['restrictHighlightAndSnippetArrays'] = $data['restrictHighlightAndSnippetArrays'] ?? false; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + $this->container['minWordSizefor1Typo'] = $data['minWordSizefor1Typo'] ?? 4; + $this->container['minWordSizefor2Typos'] = $data['minWordSizefor2Typos'] ?? 8; + $this->container['typoTolerance'] = $data['typoTolerance'] ?? 'true'; + $this->container['allowTyposOnNumericTokens'] = $data['allowTyposOnNumericTokens'] ?? true; + $this->container['disableTypoToleranceOnAttributes'] = $data['disableTypoToleranceOnAttributes'] ?? null; + $this->container['separatorsToIndex'] = $data['separatorsToIndex'] ?? ''; + $this->container['ignorePlurals'] = $data['ignorePlurals'] ?? 'false'; + $this->container['removeStopWords'] = $data['removeStopWords'] ?? 'false'; + $this->container['keepDiacriticsOnCharacters'] = $data['keepDiacriticsOnCharacters'] ?? ''; + $this->container['queryLanguages'] = $data['queryLanguages'] ?? null; + $this->container['decompoundQuery'] = $data['decompoundQuery'] ?? true; + $this->container['enableRules'] = $data['enableRules'] ?? true; + $this->container['enablePersonalization'] = $data['enablePersonalization'] ?? false; + $this->container['queryType'] = $data['queryType'] ?? 'prefixLast'; + $this->container['removeWordsIfNoResults'] = $data['removeWordsIfNoResults'] ?? 'none'; + $this->container['advancedSyntax'] = $data['advancedSyntax'] ?? false; + $this->container['optionalWords'] = $data['optionalWords'] ?? null; + $this->container['disableExactOnAttributes'] = $data['disableExactOnAttributes'] ?? null; + $this->container['exactOnSingleWordQuery'] = $data['exactOnSingleWordQuery'] ?? 'attribute'; + $this->container['alternativesAsExact'] = $data['alternativesAsExact'] ?? null; + $this->container['advancedSyntaxFeatures'] = $data['advancedSyntaxFeatures'] ?? null; + $this->container['distinct'] = $data['distinct'] ?? 0; + $this->container['synonyms'] = $data['synonyms'] ?? true; + $this->container['replaceSynonymsInHighlight'] = $data['replaceSynonymsInHighlight'] ?? false; + $this->container['minProximity'] = $data['minProximity'] ?? 1; + $this->container['responseFields'] = $data['responseFields'] ?? null; + $this->container['maxFacetHits'] = $data['maxFacetHits'] ?? 10; + $this->container['attributeCriteriaComputedByMinProximity'] = $data['attributeCriteriaComputedByMinProximity'] ?? false; + $this->container['renderingContent'] = $data['renderingContent'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['length']) && ($this->container['length'] > 1000)) { + $invalidProperties[] = "invalid value for 'length', must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['length']) && ($this->container['length'] < 1)) { + $invalidProperties[] = "invalid value for 'length', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['minimumAroundRadius']) && ($this->container['minimumAroundRadius'] < 1)) { + $invalidProperties[] = "invalid value for 'minimumAroundRadius', must be bigger than or equal to 1."; + } + + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($this->container['typoTolerance']) && !in_array($this->container['typoTolerance'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'typoTolerance', must be one of '%s'", + $this->container['typoTolerance'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($this->container['queryType']) && !in_array($this->container['queryType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'queryType', must be one of '%s'", + $this->container['queryType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($this->container['removeWordsIfNoResults']) && !in_array($this->container['removeWordsIfNoResults'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $this->container['removeWordsIfNoResults'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($this->container['exactOnSingleWordQuery']) && !in_array($this->container['exactOnSingleWordQuery'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $this->container['exactOnSingleWordQuery'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] > 4)) { + $invalidProperties[] = "invalid value for 'distinct', must be smaller than or equal to 4."; + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] < 0)) { + $invalidProperties[] = "invalid value for 'distinct', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] > 7)) { + $invalidProperties[] = "invalid value for 'minProximity', must be smaller than or equal to 7."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] < 1)) { + $invalidProperties[] = "invalid value for 'minProximity', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['maxFacetHits']) && ($this->container['maxFacetHits'] > 100)) { + $invalidProperties[] = "invalid value for 'maxFacetHits', must be smaller than or equal to 100."; + } + + 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|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param string|null $query query string + * + * @return self + */ + public function setQuery($query) + { + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets automaticFacetFilters + * + * @return \Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]|null + */ + public function getAutomaticFacetFilters() + { + return $this->container['automaticFacetFilters']; + } + + /** + * Sets automaticFacetFilters + * + * @param \Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]|null $automaticFacetFilters names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern + * + * @return self + */ + public function setAutomaticFacetFilters($automaticFacetFilters) + { + $this->container['automaticFacetFilters'] = $automaticFacetFilters; + + return $this; + } + + /** + * Gets automaticOptionalFacetFilters + * + * @return \Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]|null + */ + public function getAutomaticOptionalFacetFilters() + { + return $this->container['automaticOptionalFacetFilters']; + } + + /** + * Sets automaticOptionalFacetFilters + * + * @param \Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]|null $automaticOptionalFacetFilters same syntax as automaticFacetFilters, but the engine treats the filters as optional + * + * @return self + */ + public function setAutomaticOptionalFacetFilters($automaticOptionalFacetFilters) + { + $this->container['automaticOptionalFacetFilters'] = $automaticOptionalFacetFilters; + + return $this; + } + + /** + * Gets similarQuery + * + * @return string|null + */ + public function getSimilarQuery() + { + return $this->container['similarQuery']; + } + + /** + * Sets similarQuery + * + * @param string|null $similarQuery overrides the query parameter and performs a more generic search that can be used to find \"similar\" results + * + * @return self + */ + public function setSimilarQuery($similarQuery) + { + $this->container['similarQuery'] = $similarQuery; + + return $this; + } + + /** + * Gets filters + * + * @return string|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param string|null $filters filter the query with numeric, facet and/or tag filters + * + * @return self + */ + public function setFilters($filters) + { + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets facetFilters + * + * @return string[]|null + */ + public function getFacetFilters() + { + return $this->container['facetFilters']; + } + + /** + * Sets facetFilters + * + * @param string[]|null $facetFilters filter hits by facet value + * + * @return self + */ + public function setFacetFilters($facetFilters) + { + $this->container['facetFilters'] = $facetFilters; + + return $this; + } + + /** + * Gets optionalFilters + * + * @return string[]|null + */ + public function getOptionalFilters() + { + return $this->container['optionalFilters']; + } + + /** + * Sets optionalFilters + * + * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * + * @return self + */ + public function setOptionalFilters($optionalFilters) + { + $this->container['optionalFilters'] = $optionalFilters; + + return $this; + } + + /** + * Gets numericFilters + * + * @return string[]|null + */ + public function getNumericFilters() + { + return $this->container['numericFilters']; + } + + /** + * Sets numericFilters + * + * @param string[]|null $numericFilters filter on numeric attributes + * + * @return self + */ + public function setNumericFilters($numericFilters) + { + $this->container['numericFilters'] = $numericFilters; + + return $this; + } + + /** + * Gets tagFilters + * + * @return string[]|null + */ + public function getTagFilters() + { + return $this->container['tagFilters']; + } + + /** + * Sets tagFilters + * + * @param string[]|null $tagFilters filter hits by tags + * + * @return self + */ + public function setTagFilters($tagFilters) + { + $this->container['tagFilters'] = $tagFilters; + + return $this; + } + + /** + * Gets sumOrFiltersScores + * + * @return bool|null + */ + public function getSumOrFiltersScores() + { + return $this->container['sumOrFiltersScores']; + } + + /** + * Sets sumOrFiltersScores + * + * @param bool|null $sumOrFiltersScores determines how to calculate the total score for filtering + * + * @return self + */ + public function setSumOrFiltersScores($sumOrFiltersScores) + { + $this->container['sumOrFiltersScores'] = $sumOrFiltersScores; + + return $this; + } + + /** + * Gets facets + * + * @return string[]|null + */ + public function getFacets() + { + return $this->container['facets']; + } + + /** + * Sets facets + * + * @param string[]|null $facets retrieve facets and their facet values + * + * @return self + */ + public function setFacets($facets) + { + $this->container['facets'] = $facets; + + return $this; + } + + /** + * Gets maxValuesPerFacet + * + * @return int|null + */ + public function getMaxValuesPerFacet() + { + return $this->container['maxValuesPerFacet']; + } + + /** + * Sets maxValuesPerFacet + * + * @param int|null $maxValuesPerFacet maximum number of facet values to return for each facet during a regular search + * + * @return self + */ + public function setMaxValuesPerFacet($maxValuesPerFacet) + { + $this->container['maxValuesPerFacet'] = $maxValuesPerFacet; + + return $this; + } + + /** + * Gets facetingAfterDistinct + * + * @return bool|null + */ + public function getFacetingAfterDistinct() + { + return $this->container['facetingAfterDistinct']; + } + + /** + * Sets facetingAfterDistinct + * + * @param bool|null $facetingAfterDistinct force faceting to be applied after de-duplication (via the Distinct setting) + * + * @return self + */ + public function setFacetingAfterDistinct($facetingAfterDistinct) + { + $this->container['facetingAfterDistinct'] = $facetingAfterDistinct; + + return $this; + } + + /** + * Gets sortFacetValuesBy + * + * @return string|null + */ + public function getSortFacetValuesBy() + { + return $this->container['sortFacetValuesBy']; + } + + /** + * Sets sortFacetValuesBy + * + * @param string|null $sortFacetValuesBy controls how facet values are fetched + * + * @return self + */ + public function setSortFacetValuesBy($sortFacetValuesBy) + { + $this->container['sortFacetValuesBy'] = $sortFacetValuesBy; + + return $this; + } + + /** + * Gets page + * + * @return int|null + */ + public function getPage() + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param int|null $page specify the page to retrieve + * + * @return self + */ + public function setPage($page) + { + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets offset + * + * @return int|null + */ + public function getOffset() + { + return $this->container['offset']; + } + + /** + * Sets offset + * + * @param int|null $offset specify the offset of the first hit to return + * + * @return self + */ + public function setOffset($offset) + { + $this->container['offset'] = $offset; + + return $this; + } + + /** + * Gets length + * + * @return int|null + */ + public function getLength() + { + return $this->container['length']; + } + + /** + * Sets length + * + * @param int|null $length set the number of hits to retrieve (used only with offset) + * + * @return self + */ + public function setLength($length) + { + if (!is_null($length) && ($length > 1000)) { + throw new \InvalidArgumentException('invalid value for $length when calling ConsequenceParams., must be smaller than or equal to 1000.'); + } + if (!is_null($length) && ($length < 1)) { + throw new \InvalidArgumentException('invalid value for $length when calling ConsequenceParams., must be bigger than or equal to 1.'); + } + + $this->container['length'] = $length; + + return $this; + } + + /** + * Gets aroundLatLng + * + * @return string|null + */ + public function getAroundLatLng() + { + return $this->container['aroundLatLng']; + } + + /** + * Sets aroundLatLng + * + * @param string|null $aroundLatLng search for entries around a central geolocation, enabling a geo search within a circular area + * + * @return self + */ + public function setAroundLatLng($aroundLatLng) + { + $this->container['aroundLatLng'] = $aroundLatLng; + + return $this; + } + + /** + * Gets aroundLatLngViaIP + * + * @return bool|null + */ + public function getAroundLatLngViaIP() + { + return $this->container['aroundLatLngViaIP']; + } + + /** + * Sets aroundLatLngViaIP + * + * @param bool|null $aroundLatLngViaIP search for entries around a given location automatically computed from the requester's IP address + * + * @return self + */ + public function setAroundLatLngViaIP($aroundLatLngViaIP) + { + $this->container['aroundLatLngViaIP'] = $aroundLatLngViaIP; + + return $this; + } + + /** + * Gets aroundRadius + * + * @return OneOfIntegerString|null + */ + public function getAroundRadius() + { + return $this->container['aroundRadius']; + } + + /** + * Sets aroundRadius + * + * @param OneOfIntegerString|null $aroundRadius define the maximum radius for a geo search (in meters) + * + * @return self + */ + public function setAroundRadius($aroundRadius) + { + $this->container['aroundRadius'] = $aroundRadius; + + return $this; + } + + /** + * Gets aroundPrecision + * + * @return int|null + */ + public function getAroundPrecision() + { + return $this->container['aroundPrecision']; + } + + /** + * Sets aroundPrecision + * + * @param int|null $aroundPrecision precision of geo search (in meters), to add grouping by geo location to the ranking formula + * + * @return self + */ + public function setAroundPrecision($aroundPrecision) + { + $this->container['aroundPrecision'] = $aroundPrecision; + + return $this; + } + + /** + * Gets minimumAroundRadius + * + * @return int|null + */ + public function getMinimumAroundRadius() + { + return $this->container['minimumAroundRadius']; + } + + /** + * Sets minimumAroundRadius + * + * @param int|null $minimumAroundRadius minimum radius (in meters) used for a geo search when aroundRadius is not set + * + * @return self + */ + public function setMinimumAroundRadius($minimumAroundRadius) + { + if (!is_null($minimumAroundRadius) && ($minimumAroundRadius < 1)) { + throw new \InvalidArgumentException('invalid value for $minimumAroundRadius when calling ConsequenceParams., must be bigger than or equal to 1.'); + } + + $this->container['minimumAroundRadius'] = $minimumAroundRadius; + + return $this; + } + + /** + * Gets insideBoundingBox + * + * @return float[]|null + */ + public function getInsideBoundingBox() + { + return $this->container['insideBoundingBox']; + } + + /** + * Sets insideBoundingBox + * + * @param float[]|null $insideBoundingBox search inside a rectangular area (in geo coordinates) + * + * @return self + */ + public function setInsideBoundingBox($insideBoundingBox) + { + $this->container['insideBoundingBox'] = $insideBoundingBox; + + return $this; + } + + /** + * Gets insidePolygon + * + * @return float[]|null + */ + public function getInsidePolygon() + { + return $this->container['insidePolygon']; + } + + /** + * Sets insidePolygon + * + * @param float[]|null $insidePolygon search inside a polygon (in geo coordinates) + * + * @return self + */ + public function setInsidePolygon($insidePolygon) + { + $this->container['insidePolygon'] = $insidePolygon; + + return $this; + } + + /** + * Gets naturalLanguages + * + * @return string[]|null + */ + public function getNaturalLanguages() + { + return $this->container['naturalLanguages']; + } + + /** + * Sets naturalLanguages + * + * @param string[]|null $naturalLanguages This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. + * + * @return self + */ + public function setNaturalLanguages($naturalLanguages) + { + $this->container['naturalLanguages'] = $naturalLanguages; + + return $this; + } + + /** + * Gets ruleContexts + * + * @return string[]|null + */ + public function getRuleContexts() + { + return $this->container['ruleContexts']; + } + + /** + * Sets ruleContexts + * + * @param string[]|null $ruleContexts enables contextual rules + * + * @return self + */ + public function setRuleContexts($ruleContexts) + { + $this->container['ruleContexts'] = $ruleContexts; + + return $this; + } + + /** + * Gets personalizationImpact + * + * @return int|null + */ + public function getPersonalizationImpact() + { + return $this->container['personalizationImpact']; + } + + /** + * Sets personalizationImpact + * + * @param int|null $personalizationImpact define the impact of the Personalization feature + * + * @return self + */ + public function setPersonalizationImpact($personalizationImpact) + { + $this->container['personalizationImpact'] = $personalizationImpact; + + return $this; + } + + /** + * Gets userToken + * + * @return string|null + */ + public function getUserToken() + { + return $this->container['userToken']; + } + + /** + * Sets userToken + * + * @param string|null $userToken associates a certain user token with the current search + * + * @return self + */ + public function setUserToken($userToken) + { + $this->container['userToken'] = $userToken; + + return $this; + } + + /** + * Gets getRankingInfo + * + * @return bool|null + */ + public function getGetRankingInfo() + { + return $this->container['getRankingInfo']; + } + + /** + * Sets getRankingInfo + * + * @param bool|null $getRankingInfo retrieve detailed ranking information + * + * @return self + */ + public function setGetRankingInfo($getRankingInfo) + { + $this->container['getRankingInfo'] = $getRankingInfo; + + return $this; + } + + /** + * Gets clickAnalytics + * + * @return bool|null + */ + public function getClickAnalytics() + { + return $this->container['clickAnalytics']; + } + + /** + * Sets clickAnalytics + * + * @param bool|null $clickAnalytics enable the Click Analytics feature + * + * @return self + */ + public function setClickAnalytics($clickAnalytics) + { + $this->container['clickAnalytics'] = $clickAnalytics; + + return $this; + } + + /** + * Gets analytics + * + * @return bool|null + */ + public function getAnalytics() + { + return $this->container['analytics']; + } + + /** + * Sets analytics + * + * @param bool|null $analytics whether the current query will be taken into account in the Analytics + * + * @return self + */ + public function setAnalytics($analytics) + { + $this->container['analytics'] = $analytics; + + return $this; + } + + /** + * Gets analyticsTags + * + * @return string[]|null + */ + public function getAnalyticsTags() + { + return $this->container['analyticsTags']; + } + + /** + * Sets analyticsTags + * + * @param string[]|null $analyticsTags list of tags to apply to the query for analytics purposes + * + * @return self + */ + public function setAnalyticsTags($analyticsTags) + { + $this->container['analyticsTags'] = $analyticsTags; + + return $this; + } + + /** + * Gets percentileComputation + * + * @return bool|null + */ + public function getPercentileComputation() + { + return $this->container['percentileComputation']; + } + + /** + * Sets percentileComputation + * + * @param bool|null $percentileComputation whether to include or exclude a query from the processing-time percentile computation + * + * @return self + */ + public function setPercentileComputation($percentileComputation) + { + $this->container['percentileComputation'] = $percentileComputation; + + return $this; + } + + /** + * Gets enableABTest + * + * @return bool|null + */ + public function getEnableABTest() + { + return $this->container['enableABTest']; + } + + /** + * Sets enableABTest + * + * @param bool|null $enableABTest whether this search should participate in running AB tests + * + * @return self + */ + public function setEnableABTest($enableABTest) + { + $this->container['enableABTest'] = $enableABTest; + + return $this; + } + + /** + * Gets enableReRanking + * + * @return bool|null + */ + public function getEnableReRanking() + { + return $this->container['enableReRanking']; + } + + /** + * Sets enableReRanking + * + * @param bool|null $enableReRanking whether this search should use AI Re-Ranking + * + * @return self + */ + public function setEnableReRanking($enableReRanking) + { + $this->container['enableReRanking'] = $enableReRanking; + + return $this; + } + + /** + * Gets searchableAttributes + * + * @return string[]|null + */ + public function getSearchableAttributes() + { + return $this->container['searchableAttributes']; + } + + /** + * Sets searchableAttributes + * + * @param string[]|null $searchableAttributes the complete list of attributes used for searching + * + * @return self + */ + public function setSearchableAttributes($searchableAttributes) + { + $this->container['searchableAttributes'] = $searchableAttributes; + + return $this; + } + + /** + * Gets attributesForFaceting + * + * @return string[]|null + */ + public function getAttributesForFaceting() + { + return $this->container['attributesForFaceting']; + } + + /** + * Sets attributesForFaceting + * + * @param string[]|null $attributesForFaceting the complete list of attributes that will be used for faceting + * + * @return self + */ + public function setAttributesForFaceting($attributesForFaceting) + { + $this->container['attributesForFaceting'] = $attributesForFaceting; + + return $this; + } + + /** + * Gets unretrievableAttributes + * + * @return string[]|null + */ + public function getUnretrievableAttributes() + { + return $this->container['unretrievableAttributes']; + } + + /** + * Sets unretrievableAttributes + * + * @param string[]|null $unretrievableAttributes list of attributes that can't be retrieved at query time + * + * @return self + */ + public function setUnretrievableAttributes($unretrievableAttributes) + { + $this->container['unretrievableAttributes'] = $unretrievableAttributes; + + return $this; + } + + /** + * Gets attributesToRetrieve + * + * @return string[]|null + */ + public function getAttributesToRetrieve() + { + return $this->container['attributesToRetrieve']; + } + + /** + * Sets attributesToRetrieve + * + * @param string[]|null $attributesToRetrieve this parameter controls which attributes to retrieve and which not to retrieve + * + * @return self + */ + public function setAttributesToRetrieve($attributesToRetrieve) + { + $this->container['attributesToRetrieve'] = $attributesToRetrieve; + + return $this; + } + + /** + * Gets restrictSearchableAttributes + * + * @return string[]|null + */ + public function getRestrictSearchableAttributes() + { + return $this->container['restrictSearchableAttributes']; + } + + /** + * Sets restrictSearchableAttributes + * + * @param string[]|null $restrictSearchableAttributes restricts a given query to look in only a subset of your searchable attributes + * + * @return self + */ + public function setRestrictSearchableAttributes($restrictSearchableAttributes) + { + $this->container['restrictSearchableAttributes'] = $restrictSearchableAttributes; + + return $this; + } + + /** + * Gets ranking + * + * @return string[]|null + */ + public function getRanking() + { + return $this->container['ranking']; + } + + /** + * Sets ranking + * + * @param string[]|null $ranking controls how Algolia should sort your results + * + * @return self + */ + public function setRanking($ranking) + { + $this->container['ranking'] = $ranking; + + return $this; + } + + /** + * Gets customRanking + * + * @return string[]|null + */ + public function getCustomRanking() + { + return $this->container['customRanking']; + } + + /** + * Sets customRanking + * + * @param string[]|null $customRanking specifies the custom ranking criterion + * + * @return self + */ + public function setCustomRanking($customRanking) + { + $this->container['customRanking'] = $customRanking; + + return $this; + } + + /** + * Gets relevancyStrictness + * + * @return int|null + */ + public function getRelevancyStrictness() + { + return $this->container['relevancyStrictness']; + } + + /** + * Sets relevancyStrictness + * + * @param int|null $relevancyStrictness controls the relevancy threshold below which less relevant results aren't included in the results + * + * @return self + */ + public function setRelevancyStrictness($relevancyStrictness) + { + $this->container['relevancyStrictness'] = $relevancyStrictness; + + return $this; + } + + /** + * Gets attributesToHighlight + * + * @return string[]|null + */ + public function getAttributesToHighlight() + { + return $this->container['attributesToHighlight']; + } + + /** + * Sets attributesToHighlight + * + * @param string[]|null $attributesToHighlight list of attributes to highlight + * + * @return self + */ + public function setAttributesToHighlight($attributesToHighlight) + { + $this->container['attributesToHighlight'] = $attributesToHighlight; + + return $this; + } + + /** + * Gets attributesToSnippet + * + * @return string[]|null + */ + public function getAttributesToSnippet() + { + return $this->container['attributesToSnippet']; + } + + /** + * Sets attributesToSnippet + * + * @param string[]|null $attributesToSnippet list of attributes to snippet, with an optional maximum number of words to snippet + * + * @return self + */ + public function setAttributesToSnippet($attributesToSnippet) + { + $this->container['attributesToSnippet'] = $attributesToSnippet; + + return $this; + } + + /** + * Gets highlightPreTag + * + * @return string|null + */ + public function getHighlightPreTag() + { + return $this->container['highlightPreTag']; + } + + /** + * Sets highlightPreTag + * + * @param string|null $highlightPreTag the HTML string to insert before the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPreTag($highlightPreTag) + { + $this->container['highlightPreTag'] = $highlightPreTag; + + return $this; + } + + /** + * Gets highlightPostTag + * + * @return string|null + */ + public function getHighlightPostTag() + { + return $this->container['highlightPostTag']; + } + + /** + * Sets highlightPostTag + * + * @param string|null $highlightPostTag the HTML string to insert after the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPostTag($highlightPostTag) + { + $this->container['highlightPostTag'] = $highlightPostTag; + + return $this; + } + + /** + * Gets snippetEllipsisText + * + * @return string|null + */ + public function getSnippetEllipsisText() + { + return $this->container['snippetEllipsisText']; + } + + /** + * Sets snippetEllipsisText + * + * @param string|null $snippetEllipsisText string used as an ellipsis indicator when a snippet is truncated + * + * @return self + */ + public function setSnippetEllipsisText($snippetEllipsisText) + { + $this->container['snippetEllipsisText'] = $snippetEllipsisText; + + return $this; + } + + /** + * Gets restrictHighlightAndSnippetArrays + * + * @return bool|null + */ + public function getRestrictHighlightAndSnippetArrays() + { + return $this->container['restrictHighlightAndSnippetArrays']; + } + + /** + * Sets restrictHighlightAndSnippetArrays + * + * @param bool|null $restrictHighlightAndSnippetArrays restrict highlighting and snippeting to items that matched the query + * + * @return self + */ + public function setRestrictHighlightAndSnippetArrays($restrictHighlightAndSnippetArrays) + { + $this->container['restrictHighlightAndSnippetArrays'] = $restrictHighlightAndSnippetArrays; + + return $this; + } + + /** + * Gets hitsPerPage + * + * @return int|null + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int|null $hitsPerPage set the number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Gets minWordSizefor1Typo + * + * @return int|null + */ + public function getMinWordSizefor1Typo() + { + return $this->container['minWordSizefor1Typo']; + } + + /** + * Sets minWordSizefor1Typo + * + * @param int|null $minWordSizefor1Typo minimum number of characters a word in the query string must contain to accept matches with 1 typo + * + * @return self + */ + public function setMinWordSizefor1Typo($minWordSizefor1Typo) + { + $this->container['minWordSizefor1Typo'] = $minWordSizefor1Typo; + + return $this; + } + + /** + * Gets minWordSizefor2Typos + * + * @return int|null + */ + public function getMinWordSizefor2Typos() + { + return $this->container['minWordSizefor2Typos']; + } + + /** + * Sets minWordSizefor2Typos + * + * @param int|null $minWordSizefor2Typos minimum number of characters a word in the query string must contain to accept matches with 2 typos + * + * @return self + */ + public function setMinWordSizefor2Typos($minWordSizefor2Typos) + { + $this->container['minWordSizefor2Typos'] = $minWordSizefor2Typos; + + return $this; + } + + /** + * Gets typoTolerance + * + * @return string|null + */ + public function getTypoTolerance() + { + return $this->container['typoTolerance']; + } + + /** + * Sets typoTolerance + * + * @param string|null $typoTolerance controls whether typo tolerance is enabled and how it is applied + * + * @return self + */ + public function setTypoTolerance($typoTolerance) + { + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($typoTolerance) && !in_array($typoTolerance, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'typoTolerance', must be one of '%s'", + $typoTolerance, + implode("', '", $allowedValues) + ) + ); + } + $this->container['typoTolerance'] = $typoTolerance; + + return $this; + } + + /** + * Gets allowTyposOnNumericTokens + * + * @return bool|null + */ + public function getAllowTyposOnNumericTokens() + { + return $this->container['allowTyposOnNumericTokens']; + } + + /** + * Sets allowTyposOnNumericTokens + * + * @param bool|null $allowTyposOnNumericTokens whether to allow typos on numbers (\"numeric tokens\") in the query string + * + * @return self + */ + public function setAllowTyposOnNumericTokens($allowTyposOnNumericTokens) + { + $this->container['allowTyposOnNumericTokens'] = $allowTyposOnNumericTokens; + + return $this; + } + + /** + * Gets disableTypoToleranceOnAttributes + * + * @return string[]|null + */ + public function getDisableTypoToleranceOnAttributes() + { + return $this->container['disableTypoToleranceOnAttributes']; + } + + /** + * Sets disableTypoToleranceOnAttributes + * + * @param string[]|null $disableTypoToleranceOnAttributes list of attributes on which you want to disable typo tolerance + * + * @return self + */ + public function setDisableTypoToleranceOnAttributes($disableTypoToleranceOnAttributes) + { + $this->container['disableTypoToleranceOnAttributes'] = $disableTypoToleranceOnAttributes; + + return $this; + } + + /** + * Gets separatorsToIndex + * + * @return string|null + */ + public function getSeparatorsToIndex() + { + return $this->container['separatorsToIndex']; + } + + /** + * Sets separatorsToIndex + * + * @param string|null $separatorsToIndex control which separators are indexed + * + * @return self + */ + public function setSeparatorsToIndex($separatorsToIndex) + { + $this->container['separatorsToIndex'] = $separatorsToIndex; + + return $this; + } + + /** + * Gets ignorePlurals + * + * @return string|null + */ + public function getIgnorePlurals() + { + return $this->container['ignorePlurals']; + } + + /** + * Sets ignorePlurals + * + * @param string|null $ignorePlurals treats singular, plurals, and other forms of declensions as matching terms + * + * @return self + */ + public function setIgnorePlurals($ignorePlurals) + { + $this->container['ignorePlurals'] = $ignorePlurals; + + return $this; + } + + /** + * Gets removeStopWords + * + * @return string|null + */ + public function getRemoveStopWords() + { + return $this->container['removeStopWords']; + } + + /** + * Sets removeStopWords + * + * @param string|null $removeStopWords removes stop (common) words from the query before executing it + * + * @return self + */ + public function setRemoveStopWords($removeStopWords) + { + $this->container['removeStopWords'] = $removeStopWords; + + return $this; + } + + /** + * Gets keepDiacriticsOnCharacters + * + * @return string|null + */ + public function getKeepDiacriticsOnCharacters() + { + return $this->container['keepDiacriticsOnCharacters']; + } + + /** + * Sets keepDiacriticsOnCharacters + * + * @param string|null $keepDiacriticsOnCharacters list of characters that the engine shouldn't automatically normalize + * + * @return self + */ + public function setKeepDiacriticsOnCharacters($keepDiacriticsOnCharacters) + { + $this->container['keepDiacriticsOnCharacters'] = $keepDiacriticsOnCharacters; + + return $this; + } + + /** + * Gets queryLanguages + * + * @return string[]|null + */ + public function getQueryLanguages() + { + return $this->container['queryLanguages']; + } + + /** + * Sets queryLanguages + * + * @param string[]|null $queryLanguages sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection + * + * @return self + */ + public function setQueryLanguages($queryLanguages) + { + $this->container['queryLanguages'] = $queryLanguages; + + return $this; + } + + /** + * Gets decompoundQuery + * + * @return bool|null + */ + public function getDecompoundQuery() + { + return $this->container['decompoundQuery']; + } + + /** + * Sets decompoundQuery + * + * @param bool|null $decompoundQuery splits compound words into their composing atoms in the query + * + * @return self + */ + public function setDecompoundQuery($decompoundQuery) + { + $this->container['decompoundQuery'] = $decompoundQuery; + + return $this; + } + + /** + * Gets enableRules + * + * @return bool|null + */ + public function getEnableRules() + { + return $this->container['enableRules']; + } + + /** + * Sets enableRules + * + * @param bool|null $enableRules whether Rules should be globally enabled + * + * @return self + */ + public function setEnableRules($enableRules) + { + $this->container['enableRules'] = $enableRules; + + return $this; + } + + /** + * Gets enablePersonalization + * + * @return bool|null + */ + public function getEnablePersonalization() + { + return $this->container['enablePersonalization']; + } + + /** + * Sets enablePersonalization + * + * @param bool|null $enablePersonalization enable the Personalization feature + * + * @return self + */ + public function setEnablePersonalization($enablePersonalization) + { + $this->container['enablePersonalization'] = $enablePersonalization; + + return $this; + } + + /** + * Gets queryType + * + * @return string|null + */ + public function getQueryType() + { + return $this->container['queryType']; + } + + /** + * Sets queryType + * + * @param string|null $queryType controls if and how query words are interpreted as prefixes + * + * @return self + */ + public function setQueryType($queryType) + { + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($queryType) && !in_array($queryType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'queryType', must be one of '%s'", + $queryType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['queryType'] = $queryType; + + return $this; + } + + /** + * Gets removeWordsIfNoResults + * + * @return string|null + */ + public function getRemoveWordsIfNoResults() + { + return $this->container['removeWordsIfNoResults']; + } + + /** + * Sets removeWordsIfNoResults + * + * @param string|null $removeWordsIfNoResults selects a strategy to remove words from the query when it doesn't match any hits + * + * @return self + */ + public function setRemoveWordsIfNoResults($removeWordsIfNoResults) + { + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($removeWordsIfNoResults) && !in_array($removeWordsIfNoResults, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $removeWordsIfNoResults, + implode("', '", $allowedValues) + ) + ); + } + $this->container['removeWordsIfNoResults'] = $removeWordsIfNoResults; + + return $this; + } + + /** + * Gets advancedSyntax + * + * @return bool|null + */ + public function getAdvancedSyntax() + { + return $this->container['advancedSyntax']; + } + + /** + * Sets advancedSyntax + * + * @param bool|null $advancedSyntax enables the advanced query syntax + * + * @return self + */ + public function setAdvancedSyntax($advancedSyntax) + { + $this->container['advancedSyntax'] = $advancedSyntax; + + return $this; + } + + /** + * Gets optionalWords + * + * @return string[]|null + */ + public function getOptionalWords() + { + return $this->container['optionalWords']; + } + + /** + * Sets optionalWords + * + * @param string[]|null $optionalWords a list of words that should be considered as optional when found in the query + * + * @return self + */ + public function setOptionalWords($optionalWords) + { + $this->container['optionalWords'] = $optionalWords; + + return $this; + } + + /** + * Gets disableExactOnAttributes + * + * @return string[]|null + */ + public function getDisableExactOnAttributes() + { + return $this->container['disableExactOnAttributes']; + } + + /** + * Sets disableExactOnAttributes + * + * @param string[]|null $disableExactOnAttributes list of attributes on which you want to disable the exact ranking criterion + * + * @return self + */ + public function setDisableExactOnAttributes($disableExactOnAttributes) + { + $this->container['disableExactOnAttributes'] = $disableExactOnAttributes; + + return $this; + } + + /** + * Gets exactOnSingleWordQuery + * + * @return string|null + */ + public function getExactOnSingleWordQuery() + { + return $this->container['exactOnSingleWordQuery']; + } + + /** + * Sets exactOnSingleWordQuery + * + * @param string|null $exactOnSingleWordQuery controls how the exact ranking criterion is computed when the query contains only one word + * + * @return self + */ + public function setExactOnSingleWordQuery($exactOnSingleWordQuery) + { + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($exactOnSingleWordQuery) && !in_array($exactOnSingleWordQuery, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $exactOnSingleWordQuery, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exactOnSingleWordQuery'] = $exactOnSingleWordQuery; + + return $this; + } + + /** + * Gets alternativesAsExact + * + * @return string[]|null + */ + public function getAlternativesAsExact() + { + return $this->container['alternativesAsExact']; + } + + /** + * Sets alternativesAsExact + * + * @param string[]|null $alternativesAsExact list of alternatives that should be considered an exact match by the exact ranking criterion + * + * @return self + */ + public function setAlternativesAsExact($alternativesAsExact) + { + $allowedValues = $this->getAlternativesAsExactAllowableValues(); + if (!is_null($alternativesAsExact) && array_diff($alternativesAsExact, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternativesAsExact', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternativesAsExact'] = $alternativesAsExact; + + return $this; + } + + /** + * Gets advancedSyntaxFeatures + * + * @return string[]|null + */ + public function getAdvancedSyntaxFeatures() + { + return $this->container['advancedSyntaxFeatures']; + } + + /** + * Sets advancedSyntaxFeatures + * + * @param string[]|null $advancedSyntaxFeatures allows you to specify which advanced syntax features are active when ‘advancedSyntax' is enabled + * + * @return self + */ + public function setAdvancedSyntaxFeatures($advancedSyntaxFeatures) + { + $allowedValues = $this->getAdvancedSyntaxFeaturesAllowableValues(); + if (!is_null($advancedSyntaxFeatures) && array_diff($advancedSyntaxFeatures, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'advancedSyntaxFeatures', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['advancedSyntaxFeatures'] = $advancedSyntaxFeatures; + + return $this; + } + + /** + * Gets distinct + * + * @return int|null + */ + public function getDistinct() + { + return $this->container['distinct']; + } + + /** + * Sets distinct + * + * @param int|null $distinct enables de-duplication or grouping of results + * + * @return self + */ + public function setDistinct($distinct) + { + if (!is_null($distinct) && ($distinct > 4)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling ConsequenceParams., must be smaller than or equal to 4.'); + } + if (!is_null($distinct) && ($distinct < 0)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling ConsequenceParams., must be bigger than or equal to 0.'); + } + + $this->container['distinct'] = $distinct; + + return $this; + } + + /** + * Gets synonyms + * + * @return bool|null + */ + public function getSynonyms() + { + return $this->container['synonyms']; + } + + /** + * Sets synonyms + * + * @param bool|null $synonyms whether to take into account an index's synonyms for a particular search + * + * @return self + */ + public function setSynonyms($synonyms) + { + $this->container['synonyms'] = $synonyms; + + return $this; + } + + /** + * Gets replaceSynonymsInHighlight + * + * @return bool|null + */ + public function getReplaceSynonymsInHighlight() + { + return $this->container['replaceSynonymsInHighlight']; + } + + /** + * Sets replaceSynonymsInHighlight + * + * @param bool|null $replaceSynonymsInHighlight whether to highlight and snippet the original word that matches the synonym or the synonym itself + * + * @return self + */ + public function setReplaceSynonymsInHighlight($replaceSynonymsInHighlight) + { + $this->container['replaceSynonymsInHighlight'] = $replaceSynonymsInHighlight; + + return $this; + } + + /** + * Gets minProximity + * + * @return int|null + */ + public function getMinProximity() + { + return $this->container['minProximity']; + } + + /** + * Sets minProximity + * + * @param int|null $minProximity precision of the proximity ranking criterion + * + * @return self + */ + public function setMinProximity($minProximity) + { + if (!is_null($minProximity) && ($minProximity > 7)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling ConsequenceParams., must be smaller than or equal to 7.'); + } + if (!is_null($minProximity) && ($minProximity < 1)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling ConsequenceParams., must be bigger than or equal to 1.'); + } + + $this->container['minProximity'] = $minProximity; + + return $this; + } + + /** + * Gets responseFields + * + * @return string[]|null + */ + public function getResponseFields() + { + return $this->container['responseFields']; + } + + /** + * Sets responseFields + * + * @param string[]|null $responseFields Choose which fields to return in the API response. This parameters applies to search and browse queries. + * + * @return self + */ + public function setResponseFields($responseFields) + { + $this->container['responseFields'] = $responseFields; + + return $this; + } + + /** + * Gets maxFacetHits + * + * @return int|null + */ + public function getMaxFacetHits() + { + return $this->container['maxFacetHits']; + } + + /** + * Sets maxFacetHits + * + * @param int|null $maxFacetHits Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. + * + * @return self + */ + public function setMaxFacetHits($maxFacetHits) + { + if (!is_null($maxFacetHits) && ($maxFacetHits > 100)) { + throw new \InvalidArgumentException('invalid value for $maxFacetHits when calling ConsequenceParams., must be smaller than or equal to 100.'); + } + + $this->container['maxFacetHits'] = $maxFacetHits; + + return $this; + } + + /** + * Gets attributeCriteriaComputedByMinProximity + * + * @return bool|null + */ + public function getAttributeCriteriaComputedByMinProximity() + { + return $this->container['attributeCriteriaComputedByMinProximity']; + } + + /** + * Sets attributeCriteriaComputedByMinProximity + * + * @param bool|null $attributeCriteriaComputedByMinProximity when attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage + * + * @return self + */ + public function setAttributeCriteriaComputedByMinProximity($attributeCriteriaComputedByMinProximity) + { + $this->container['attributeCriteriaComputedByMinProximity'] = $attributeCriteriaComputedByMinProximity; + + return $this; + } + + /** + * Gets renderingContent + * + * @return object|null + */ + public function getRenderingContent() + { + return $this->container['renderingContent']; + } + + /** + * Sets renderingContent + * + * @param object|null $renderingContent Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * + * @return self + */ + public function setRenderingContent($renderingContent) + { + $this->container['renderingContent'] = $renderingContent; + + 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/Search/CreatedAtObject.php b/clients/algoliasearch-client-php/lib/Model/Search/CreatedAtObject.php new file mode 100644 index 0000000000..c3ff8c1ab1 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/CreatedAtObject.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreatedAtObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'createdAtObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'createdAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'createdAt' => 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 = [ + 'createdAt' => 'createdAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'createdAt' => 'setCreatedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'createdAt' => 'getCreatedAt', + ]; + + /** + * 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['createdAt'] = $data['createdAt'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['createdAt'] === null) { + $invalidProperties[] = "'createdAt' 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 createdAt + * + * @return string + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string $createdAt date of creation (ISO-8601 format) + * + * @return self + */ + public function setCreatedAt($createdAt) + { + $this->container['createdAt'] = $createdAt; + + 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/Search/CreatedAtResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/CreatedAtResponse.php new file mode 100644 index 0000000000..f3d812bdff --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/CreatedAtResponse.php @@ -0,0 +1,296 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class CreatedAtResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'createdAtResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'createdAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'createdAt' => 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 = [ + 'createdAt' => 'createdAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'createdAt' => 'setCreatedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'createdAt' => 'getCreatedAt', + ]; + + /** + * 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['createdAt'] = $data['createdAt'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['createdAt'] === null) { + $invalidProperties[] = "'createdAt' 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 createdAt + * + * @return string + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string $createdAt date of creation (ISO-8601 format) + * + * @return self + */ + public function setCreatedAt($createdAt) + { + $this->container['createdAt'] = $createdAt; + + 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/Search/DeleteApiKeyResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/DeleteApiKeyResponse.php new file mode 100644 index 0000000000..a9e775cbc2 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/DeleteApiKeyResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteApiKeyResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'deleteApiKeyResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'deletedAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'deletedAt' => 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 = [ + 'deletedAt' => 'deletedAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'deletedAt' => 'setDeletedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'deletedAt' => 'getDeletedAt', + ]; + + /** + * 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['deletedAt'] = $data['deletedAt'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['deletedAt'] === null) { + $invalidProperties[] = "'deletedAt' 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 deletedAt + * + * @return string + */ + public function getDeletedAt() + { + return $this->container['deletedAt']; + } + + /** + * Sets deletedAt + * + * @param string $deletedAt date of deletion (ISO-8601 format) + * + * @return self + */ + public function setDeletedAt($deletedAt) + { + $this->container['deletedAt'] = $deletedAt; + + 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/Search/DeleteSourceResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/DeleteSourceResponse.php new file mode 100644 index 0000000000..dd5abb00d8 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/DeleteSourceResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeleteSourceResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'deleteSourceResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'deletedAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'deletedAt' => 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 = [ + 'deletedAt' => 'deletedAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'deletedAt' => 'setDeletedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'deletedAt' => 'getDeletedAt', + ]; + + /** + * 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['deletedAt'] = $data['deletedAt'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['deletedAt'] === null) { + $invalidProperties[] = "'deletedAt' 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 deletedAt + * + * @return string + */ + public function getDeletedAt() + { + return $this->container['deletedAt']; + } + + /** + * Sets deletedAt + * + * @param string $deletedAt date of deletion (ISO-8601 format) + * + * @return self + */ + public function setDeletedAt($deletedAt) + { + $this->container['deletedAt'] = $deletedAt; + + 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/Search/DeletedAtResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/DeletedAtResponse.php new file mode 100644 index 0000000000..7d351ea9f3 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/DeletedAtResponse.php @@ -0,0 +1,329 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DeletedAtResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'deletedAtResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'taskID' => 'int', + 'deletedAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'taskID' => null, + 'deletedAt' => 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 = [ + 'taskID' => 'taskID', + 'deletedAt' => 'deletedAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'taskID' => 'setTaskID', + 'deletedAt' => 'setDeletedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'taskID' => 'getTaskID', + 'deletedAt' => 'getDeletedAt', + ]; + + /** + * 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['taskID'] = $data['taskID'] ?? null; + $this->container['deletedAt'] = $data['deletedAt'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['taskID'] === null) { + $invalidProperties[] = "'taskID' can't be null"; + } + if ($this->container['deletedAt'] === null) { + $invalidProperties[] = "'deletedAt' 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 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; + } + + /** + * Gets deletedAt + * + * @return string + */ + public function getDeletedAt() + { + return $this->container['deletedAt']; + } + + /** + * Sets deletedAt + * + * @param string $deletedAt date of deletion (ISO-8601 format) + * + * @return self + */ + public function setDeletedAt($deletedAt) + { + $this->container['deletedAt'] = $deletedAt; + + 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/Search/DictionaryAction.php b/clients/algoliasearch-client-php/lib/Model/Search/DictionaryAction.php new file mode 100644 index 0000000000..e99f0de71a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/DictionaryAction.php @@ -0,0 +1,35 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DictionaryEntry implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'dictionaryEntry'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'objectID' => 'string', + 'language' => 'string', + 'word' => 'string', + 'words' => 'string[]', + 'decomposition' => 'string[]', + 'state' => '\Algolia\AlgoliaSearch\Model\Search\DictionaryEntryState', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'objectID' => null, + 'language' => null, + 'word' => null, + 'words' => null, + 'decomposition' => null, + 'state' => 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 = [ + 'objectID' => 'objectID', + 'language' => 'language', + 'word' => 'word', + 'words' => 'words', + 'decomposition' => 'decomposition', + 'state' => 'state', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'objectID' => 'setObjectID', + 'language' => 'setLanguage', + 'word' => 'setWord', + 'words' => 'setWords', + 'decomposition' => 'setDecomposition', + 'state' => 'setState', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'objectID' => 'getObjectID', + 'language' => 'getLanguage', + 'word' => 'getWord', + 'words' => 'getWords', + 'decomposition' => 'getDecomposition', + 'state' => 'getState', + ]; + + /** + * 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['language'] = $data['language'] ?? null; + $this->container['word'] = $data['word'] ?? null; + $this->container['words'] = $data['words'] ?? null; + $this->container['decomposition'] = $data['decomposition'] ?? null; + $this->container['state'] = $data['state'] ?? 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['language'] === null) { + $invalidProperties[] = "'language' 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 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 language + * + * @return string + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param string $language Language ISO code supported by the dictionary (e.g., \"en\" for English). + * + * @return self + */ + public function setLanguage($language) + { + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets word + * + * @return string|null + */ + public function getWord() + { + return $this->container['word']; + } + + /** + * Sets word + * + * @param string|null $word the word of the dictionary entry + * + * @return self + */ + public function setWord($word) + { + $this->container['word'] = $word; + + return $this; + } + + /** + * Gets words + * + * @return string[]|null + */ + public function getWords() + { + return $this->container['words']; + } + + /** + * Sets words + * + * @param string[]|null $words the words of the dictionary entry + * + * @return self + */ + public function setWords($words) + { + $this->container['words'] = $words; + + return $this; + } + + /** + * Gets decomposition + * + * @return string[]|null + */ + public function getDecomposition() + { + return $this->container['decomposition']; + } + + /** + * Sets decomposition + * + * @param string[]|null $decomposition a decomposition of the word of the dictionary entry + * + * @return self + */ + public function setDecomposition($decomposition) + { + $this->container['decomposition'] = $decomposition; + + return $this; + } + + /** + * Gets state + * + * @return \Algolia\AlgoliaSearch\Model\Search\DictionaryEntryState|null + */ + public function getState() + { + return $this->container['state']; + } + + /** + * Sets state + * + * @param \Algolia\AlgoliaSearch\Model\Search\DictionaryEntryState|null $state state + * + * @return self + */ + public function setState($state) + { + $this->container['state'] = $state; + + 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/Search/DictionaryEntryState.php b/clients/algoliasearch-client-php/lib/Model/Search/DictionaryEntryState.php new file mode 100644 index 0000000000..dfe9245cec --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/DictionaryEntryState.php @@ -0,0 +1,35 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DictionaryLanguage implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'dictionaryLanguage'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'nbCustomEntires' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'nbCustomEntires' => 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 = [ + 'nbCustomEntires' => 'nbCustomEntires', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'nbCustomEntires' => 'setNbCustomEntires', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'nbCustomEntires' => 'getNbCustomEntires', + ]; + + /** + * 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['nbCustomEntires'] = $data['nbCustomEntires'] ?? 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 nbCustomEntires + * + * @return int|null + */ + public function getNbCustomEntires() + { + return $this->container['nbCustomEntires']; + } + + /** + * Sets nbCustomEntires + * + * @param int|null $nbCustomEntires When nbCustomEntries is set to 0, the user didn't customize the dictionary. The dictionary is still supported with standard, Algolia-provided entries. + * + * @return self + */ + public function setNbCustomEntires($nbCustomEntires) + { + $this->container['nbCustomEntires'] = $nbCustomEntires; + + 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/Search/DictionarySettingsRequest.php b/clients/algoliasearch-client-php/lib/Model/Search/DictionarySettingsRequest.php new file mode 100644 index 0000000000..a3f4436e69 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/DictionarySettingsRequest.php @@ -0,0 +1,296 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class DictionarySettingsRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'dictionarySettingsRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'disableStandardEntries' => '\Algolia\AlgoliaSearch\Model\Search\StandardEntries', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'disableStandardEntries' => 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 = [ + 'disableStandardEntries' => 'disableStandardEntries', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'disableStandardEntries' => 'setDisableStandardEntries', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'disableStandardEntries' => 'getDisableStandardEntries', + ]; + + /** + * 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['disableStandardEntries'] = $data['disableStandardEntries'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['disableStandardEntries'] === null) { + $invalidProperties[] = "'disableStandardEntries' 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 disableStandardEntries + * + * @return \Algolia\AlgoliaSearch\Model\Search\StandardEntries + */ + public function getDisableStandardEntries() + { + return $this->container['disableStandardEntries']; + } + + /** + * Sets disableStandardEntries + * + * @param \Algolia\AlgoliaSearch\Model\Search\StandardEntries $disableStandardEntries disableStandardEntries + * + * @return self + */ + public function setDisableStandardEntries($disableStandardEntries) + { + $this->container['disableStandardEntries'] = $disableStandardEntries; + + 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/Search/ErrorBase.php b/clients/algoliasearch-client-php/lib/Model/Search/ErrorBase.php new file mode 100644 index 0000000000..459e0af8de --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/ErrorBase.php @@ -0,0 +1,292 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ErrorBase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ErrorBase'; + + /** + * 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 = []; + + 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|null + */ + public function getMessage() + { + return $this->container['message']; + } + + /** + * Sets message + * + * @param string|null $message message + * + * @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/Search/GetDictionarySettingsResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/GetDictionarySettingsResponse.php new file mode 100644 index 0000000000..d5d29f36cd --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/GetDictionarySettingsResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetDictionarySettingsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getDictionarySettingsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'disableStandardEntries' => '\Algolia\AlgoliaSearch\Model\Search\StandardEntries', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'disableStandardEntries' => 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 = [ + 'disableStandardEntries' => 'disableStandardEntries', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'disableStandardEntries' => 'setDisableStandardEntries', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'disableStandardEntries' => 'getDisableStandardEntries', + ]; + + /** + * 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['disableStandardEntries'] = $data['disableStandardEntries'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['disableStandardEntries'] === null) { + $invalidProperties[] = "'disableStandardEntries' 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 disableStandardEntries + * + * @return \Algolia\AlgoliaSearch\Model\Search\StandardEntries + */ + public function getDisableStandardEntries() + { + return $this->container['disableStandardEntries']; + } + + /** + * Sets disableStandardEntries + * + * @param \Algolia\AlgoliaSearch\Model\Search\StandardEntries $disableStandardEntries disableStandardEntries + * + * @return self + */ + public function setDisableStandardEntries($disableStandardEntries) + { + $this->container['disableStandardEntries'] = $disableStandardEntries; + + 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/Search/GetLogsResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/GetLogsResponse.php new file mode 100644 index 0000000000..b8ef502bd2 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/GetLogsResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetLogsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getLogsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'logs' => '\Algolia\AlgoliaSearch\Model\Search\GetLogsResponseLogs[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'logs' => 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 = [ + 'logs' => 'logs', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'logs' => 'setLogs', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'logs' => 'getLogs', + ]; + + /** + * 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['logs'] = $data['logs'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['logs'] === null) { + $invalidProperties[] = "'logs' 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 logs + * + * @return \Algolia\AlgoliaSearch\Model\Search\GetLogsResponseLogs[] + */ + public function getLogs() + { + return $this->container['logs']; + } + + /** + * Sets logs + * + * @param \Algolia\AlgoliaSearch\Model\Search\GetLogsResponseLogs[] $logs logs + * + * @return self + */ + public function setLogs($logs) + { + $this->container['logs'] = $logs; + + 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/Search/GetLogsResponseInnerQueries.php b/clients/algoliasearch-client-php/lib/Model/Search/GetLogsResponseInnerQueries.php new file mode 100644 index 0000000000..a10c2ec634 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/GetLogsResponseInnerQueries.php @@ -0,0 +1,350 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetLogsResponseInnerQueries implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getLogsResponse_inner_queries'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'indexName' => 'string', + 'userToken' => 'string', + 'queryId' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'indexName' => null, + 'userToken' => null, + 'queryId' => 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' => 'index_name', + 'userToken' => 'user_token', + 'queryId' => 'query_id', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'indexName' => 'setIndexName', + 'userToken' => 'setUserToken', + 'queryId' => 'setQueryId', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'indexName' => 'getIndexName', + 'userToken' => 'getUserToken', + 'queryId' => 'getQueryId', + ]; + + /** + * 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['userToken'] = $data['userToken'] ?? null; + $this->container['queryId'] = $data['queryId'] ?? 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 indexName + * + * @return string|null + */ + public function getIndexName() + { + return $this->container['indexName']; + } + + /** + * Sets indexName + * + * @param string|null $indexName index targeted by the query + * + * @return self + */ + public function setIndexName($indexName) + { + $this->container['indexName'] = $indexName; + + return $this; + } + + /** + * Gets userToken + * + * @return string|null + */ + public function getUserToken() + { + return $this->container['userToken']; + } + + /** + * Sets userToken + * + * @param string|null $userToken user identifier + * + * @return self + */ + public function setUserToken($userToken) + { + $this->container['userToken'] = $userToken; + + return $this; + } + + /** + * Gets queryId + * + * @return string|null + */ + public function getQueryId() + { + return $this->container['queryId']; + } + + /** + * Sets queryId + * + * @param string|null $queryId queryID for the given query + * + * @return self + */ + public function setQueryId($queryId) + { + $this->container['queryId'] = $queryId; + + 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/Search/GetLogsResponseLogs.php b/clients/algoliasearch-client-php/lib/Model/Search/GetLogsResponseLogs.php new file mode 100644 index 0000000000..200873c17b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/GetLogsResponseLogs.php @@ -0,0 +1,744 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetLogsResponseLogs implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getLogsResponse_logs'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'timestamp' => 'string', + 'method' => 'string', + 'answerCode' => 'string', + 'queryBody' => 'string', + 'answer' => 'string', + 'url' => 'string', + 'ip' => 'string', + 'queryHeaders' => 'string', + 'sha1' => 'string', + 'nbApiCalls' => 'string', + 'processingTimeMs' => 'string', + 'index' => 'string', + 'queryParams' => 'string', + 'queryNbHits' => 'string', + 'innerQueries' => '\Algolia\AlgoliaSearch\Model\Search\GetLogsResponseInnerQueries[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'timestamp' => null, + 'method' => null, + 'answerCode' => null, + 'queryBody' => null, + 'answer' => null, + 'url' => null, + 'ip' => null, + 'queryHeaders' => null, + 'sha1' => null, + 'nbApiCalls' => null, + 'processingTimeMs' => null, + 'index' => null, + 'queryParams' => null, + 'queryNbHits' => null, + 'innerQueries' => 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', + 'method' => 'method', + 'answerCode' => 'answer_code', + 'queryBody' => 'query_body', + 'answer' => 'answer', + 'url' => 'url', + 'ip' => 'ip', + 'queryHeaders' => 'query_headers', + 'sha1' => 'sha1', + 'nbApiCalls' => 'nb_api_calls', + 'processingTimeMs' => 'processing_time_ms', + 'index' => 'index', + 'queryParams' => 'query_params', + 'queryNbHits' => 'query_nb_hits', + 'innerQueries' => 'inner_queries', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'timestamp' => 'setTimestamp', + 'method' => 'setMethod', + 'answerCode' => 'setAnswerCode', + 'queryBody' => 'setQueryBody', + 'answer' => 'setAnswer', + 'url' => 'setUrl', + 'ip' => 'setIp', + 'queryHeaders' => 'setQueryHeaders', + 'sha1' => 'setSha1', + 'nbApiCalls' => 'setNbApiCalls', + 'processingTimeMs' => 'setProcessingTimeMs', + 'index' => 'setIndex', + 'queryParams' => 'setQueryParams', + 'queryNbHits' => 'setQueryNbHits', + 'innerQueries' => 'setInnerQueries', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'timestamp' => 'getTimestamp', + 'method' => 'getMethod', + 'answerCode' => 'getAnswerCode', + 'queryBody' => 'getQueryBody', + 'answer' => 'getAnswer', + 'url' => 'getUrl', + 'ip' => 'getIp', + 'queryHeaders' => 'getQueryHeaders', + 'sha1' => 'getSha1', + 'nbApiCalls' => 'getNbApiCalls', + 'processingTimeMs' => 'getProcessingTimeMs', + 'index' => 'getIndex', + 'queryParams' => 'getQueryParams', + 'queryNbHits' => 'getQueryNbHits', + 'innerQueries' => 'getInnerQueries', + ]; + + /** + * 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['timestamp'] = $data['timestamp'] ?? null; + $this->container['method'] = $data['method'] ?? null; + $this->container['answerCode'] = $data['answerCode'] ?? null; + $this->container['queryBody'] = $data['queryBody'] ?? null; + $this->container['answer'] = $data['answer'] ?? null; + $this->container['url'] = $data['url'] ?? null; + $this->container['ip'] = $data['ip'] ?? null; + $this->container['queryHeaders'] = $data['queryHeaders'] ?? null; + $this->container['sha1'] = $data['sha1'] ?? null; + $this->container['nbApiCalls'] = $data['nbApiCalls'] ?? null; + $this->container['processingTimeMs'] = $data['processingTimeMs'] ?? null; + $this->container['index'] = $data['index'] ?? null; + $this->container['queryParams'] = $data['queryParams'] ?? null; + $this->container['queryNbHits'] = $data['queryNbHits'] ?? null; + $this->container['innerQueries'] = $data['innerQueries'] ?? 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['method'] === null) { + $invalidProperties[] = "'method' can't be null"; + } + if ($this->container['answerCode'] === null) { + $invalidProperties[] = "'answerCode' can't be null"; + } + if ($this->container['queryBody'] === null) { + $invalidProperties[] = "'queryBody' can't be null"; + } + if ($this->container['answer'] === null) { + $invalidProperties[] = "'answer' can't be null"; + } + if ($this->container['url'] === null) { + $invalidProperties[] = "'url' can't be null"; + } + if ($this->container['ip'] === null) { + $invalidProperties[] = "'ip' can't be null"; + } + if ($this->container['queryHeaders'] === null) { + $invalidProperties[] = "'queryHeaders' can't be null"; + } + if ($this->container['sha1'] === null) { + $invalidProperties[] = "'sha1' can't be null"; + } + if ($this->container['nbApiCalls'] === null) { + $invalidProperties[] = "'nbApiCalls' can't be null"; + } + if ($this->container['processingTimeMs'] === null) { + $invalidProperties[] = "'processingTimeMs' 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 timestamp in ISO-8601 format + * + * @return self + */ + public function setTimestamp($timestamp) + { + $this->container['timestamp'] = $timestamp; + + return $this; + } + + /** + * Gets method + * + * @return string + */ + public function getMethod() + { + return $this->container['method']; + } + + /** + * Sets method + * + * @param string $method HTTP method of the perfomed request + * + * @return self + */ + public function setMethod($method) + { + $this->container['method'] = $method; + + return $this; + } + + /** + * Gets answerCode + * + * @return string + */ + public function getAnswerCode() + { + return $this->container['answerCode']; + } + + /** + * Sets answerCode + * + * @param string $answerCode HTTP response code + * + * @return self + */ + public function setAnswerCode($answerCode) + { + $this->container['answerCode'] = $answerCode; + + return $this; + } + + /** + * Gets queryBody + * + * @return string + */ + public function getQueryBody() + { + return $this->container['queryBody']; + } + + /** + * Sets queryBody + * + * @param string $queryBody Request body. Truncated after 1000 characters. + * + * @return self + */ + public function setQueryBody($queryBody) + { + $this->container['queryBody'] = $queryBody; + + return $this; + } + + /** + * Gets answer + * + * @return string + */ + public function getAnswer() + { + return $this->container['answer']; + } + + /** + * Sets answer + * + * @param string $answer Answer body. Truncated after 1000 characters. + * + * @return self + */ + public function setAnswer($answer) + { + $this->container['answer'] = $answer; + + return $this; + } + + /** + * Gets url + * + * @return string + */ + public function getUrl() + { + return $this->container['url']; + } + + /** + * Sets url + * + * @param string $url request URL + * + * @return self + */ + public function setUrl($url) + { + $this->container['url'] = $url; + + return $this; + } + + /** + * Gets ip + * + * @return string + */ + public function getIp() + { + return $this->container['ip']; + } + + /** + * Sets ip + * + * @param string $ip IP of the client which perfomed the request + * + * @return self + */ + public function setIp($ip) + { + $this->container['ip'] = $ip; + + return $this; + } + + /** + * Gets queryHeaders + * + * @return string + */ + public function getQueryHeaders() + { + return $this->container['queryHeaders']; + } + + /** + * Sets queryHeaders + * + * @param string $queryHeaders request Headers (API Key is obfuscated) + * + * @return self + */ + public function setQueryHeaders($queryHeaders) + { + $this->container['queryHeaders'] = $queryHeaders; + + return $this; + } + + /** + * Gets sha1 + * + * @return string + */ + public function getSha1() + { + return $this->container['sha1']; + } + + /** + * Sets sha1 + * + * @param string $sha1 SHA1 signature of the log entry + * + * @return self + */ + public function setSha1($sha1) + { + $this->container['sha1'] = $sha1; + + return $this; + } + + /** + * Gets nbApiCalls + * + * @return string + */ + public function getNbApiCalls() + { + return $this->container['nbApiCalls']; + } + + /** + * Sets nbApiCalls + * + * @param string $nbApiCalls number of API calls + * + * @return self + */ + public function setNbApiCalls($nbApiCalls) + { + $this->container['nbApiCalls'] = $nbApiCalls; + + return $this; + } + + /** + * Gets processingTimeMs + * + * @return string + */ + public function getProcessingTimeMs() + { + return $this->container['processingTimeMs']; + } + + /** + * Sets processingTimeMs + * + * @param string $processingTimeMs Processing time for the query. It doesn't include network time. + * + * @return self + */ + public function setProcessingTimeMs($processingTimeMs) + { + $this->container['processingTimeMs'] = $processingTimeMs; + + return $this; + } + + /** + * Gets index + * + * @return string|null + */ + public function getIndex() + { + return $this->container['index']; + } + + /** + * Sets index + * + * @param string|null $index index targeted by the query + * + * @return self + */ + public function setIndex($index) + { + $this->container['index'] = $index; + + return $this; + } + + /** + * Gets queryParams + * + * @return string|null + */ + public function getQueryParams() + { + return $this->container['queryParams']; + } + + /** + * Sets queryParams + * + * @param string|null $queryParams query parameters sent with the request + * + * @return self + */ + public function setQueryParams($queryParams) + { + $this->container['queryParams'] = $queryParams; + + return $this; + } + + /** + * Gets queryNbHits + * + * @return string|null + */ + public function getQueryNbHits() + { + return $this->container['queryNbHits']; + } + + /** + * Sets queryNbHits + * + * @param string|null $queryNbHits number of hits returned for the query + * + * @return self + */ + public function setQueryNbHits($queryNbHits) + { + $this->container['queryNbHits'] = $queryNbHits; + + return $this; + } + + /** + * Gets innerQueries + * + * @return \Algolia\AlgoliaSearch\Model\Search\GetLogsResponseInnerQueries[]|null + */ + public function getInnerQueries() + { + return $this->container['innerQueries']; + } + + /** + * Sets innerQueries + * + * @param \Algolia\AlgoliaSearch\Model\Search\GetLogsResponseInnerQueries[]|null $innerQueries array of all performed queries for the given request + * + * @return self + */ + public function setInnerQueries($innerQueries) + { + $this->container['innerQueries'] = $innerQueries; + + 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/Search/GetObjectsParams.php b/clients/algoliasearch-client-php/lib/Model/Search/GetObjectsParams.php new file mode 100644 index 0000000000..6501009716 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/GetObjectsParams.php @@ -0,0 +1,292 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetObjectsParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getObjectsParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'requests' => '\Algolia\AlgoliaSearch\Model\Search\MultipleGetObjectsParams[]', + ]; + + /** + * 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 = []; + + 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\Search\MultipleGetObjectsParams[]|null + */ + public function getRequests() + { + return $this->container['requests']; + } + + /** + * Sets requests + * + * @param \Algolia\AlgoliaSearch\Model\Search\MultipleGetObjectsParams[]|null $requests 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/Search/GetObjectsResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/GetObjectsResponse.php new file mode 100644 index 0000000000..f83202728e --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/GetObjectsResponse.php @@ -0,0 +1,290 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetObjectsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getObjectsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'results' => 'object[]', + ]; + + /** + * 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 object[]|null + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param object[]|null $results list of results fetched + * + * @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/Search/GetTaskResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/GetTaskResponse.php new file mode 100644 index 0000000000..d9018e05db --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/GetTaskResponse.php @@ -0,0 +1,328 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTaskResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTaskResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'status' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'status' => 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', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'status' => 'setStatus', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'status' => 'getStatus', + ]; + + /** + * 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 STATUS_PUBLISHED = 'published'; + const STATUS_NOT_PUBLISHED = 'notPublished'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getStatusAllowableValues() + { + return [ + self::STATUS_PUBLISHED, + self::STATUS_NOT_PUBLISHED, + ]; + } + + /** + * 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; + } + + /** + * 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"; + } + $allowedValues = $this->getStatusAllowableValues(); + if (!is_null($this->container['status']) && !in_array($this->container['status'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'status', must be one of '%s'", + $this->container['status'], + implode("', '", $allowedValues) + ); + } + + 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 string + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param string $status status + * + * @return self + */ + public function setStatus($status) + { + $allowedValues = $this->getStatusAllowableValues(); + if (!in_array($status, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'status', must be one of '%s'", + $status, + implode("', '", $allowedValues) + ) + ); + } + $this->container['status'] = $status; + + 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/Search/GetTopUserIdsResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/GetTopUserIdsResponse.php new file mode 100644 index 0000000000..c816c7de50 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/GetTopUserIdsResponse.php @@ -0,0 +1,296 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class GetTopUserIdsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'getTopUserIdsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'topUsers' => 'array[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'topUsers' => 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 = [ + 'topUsers' => 'topUsers', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'topUsers' => 'setTopUsers', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'topUsers' => 'getTopUsers', + ]; + + /** + * 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['topUsers'] = $data['topUsers'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['topUsers'] === null) { + $invalidProperties[] = "'topUsers' 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 topUsers + * + * @return array[] + */ + public function getTopUsers() + { + return $this->container['topUsers']; + } + + /** + * Sets topUsers + * + * @param array[] $topUsers Mapping of cluster names to top users + * + * @return self + */ + public function setTopUsers($topUsers) + { + $this->container['topUsers'] = $topUsers; + + 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/Search/HighlightResult.php b/clients/algoliasearch-client-php/lib/Model/Search/HighlightResult.php new file mode 100644 index 0000000000..9b37a61f10 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/HighlightResult.php @@ -0,0 +1,419 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class HighlightResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'highlightResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'value' => 'string', + 'matchLevel' => 'string', + 'matchedWords' => 'string[]', + 'fullyHighlighted' => 'bool', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'matchLevel' => null, + 'matchedWords' => null, + 'fullyHighlighted' => 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 = [ + 'value' => 'value', + 'matchLevel' => 'matchLevel', + 'matchedWords' => 'matchedWords', + 'fullyHighlighted' => 'fullyHighlighted', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'matchLevel' => 'setMatchLevel', + 'matchedWords' => 'setMatchedWords', + 'fullyHighlighted' => 'setFullyHighlighted', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'matchLevel' => 'getMatchLevel', + 'matchedWords' => 'getMatchedWords', + 'fullyHighlighted' => 'getFullyHighlighted', + ]; + + /** + * 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 MATCH_LEVEL_NONE = 'none'; + const MATCH_LEVEL_PARTIAL = 'partial'; + const MATCH_LEVEL_FULL = 'full'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMatchLevelAllowableValues() + { + return [ + self::MATCH_LEVEL_NONE, + self::MATCH_LEVEL_PARTIAL, + self::MATCH_LEVEL_FULL, + ]; + } + + /** + * 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['value'] = $data['value'] ?? null; + $this->container['matchLevel'] = $data['matchLevel'] ?? null; + $this->container['matchedWords'] = $data['matchedWords'] ?? null; + $this->container['fullyHighlighted'] = $data['fullyHighlighted'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getMatchLevelAllowableValues(); + if (!is_null($this->container['matchLevel']) && !in_array($this->container['matchLevel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'matchLevel', must be one of '%s'", + $this->container['matchLevel'], + implode("', '", $allowedValues) + ); + } + + 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 value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value markup text with occurrences highlighted + * + * @return self + */ + public function setValue($value) + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets matchLevel + * + * @return string|null + */ + public function getMatchLevel() + { + return $this->container['matchLevel']; + } + + /** + * Sets matchLevel + * + * @param string|null $matchLevel indicates how well the attribute matched the search query + * + * @return self + */ + public function setMatchLevel($matchLevel) + { + $allowedValues = $this->getMatchLevelAllowableValues(); + if (!is_null($matchLevel) && !in_array($matchLevel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'matchLevel', must be one of '%s'", + $matchLevel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['matchLevel'] = $matchLevel; + + return $this; + } + + /** + * Gets matchedWords + * + * @return string[]|null + */ + public function getMatchedWords() + { + return $this->container['matchedWords']; + } + + /** + * Sets matchedWords + * + * @param string[]|null $matchedWords list of words from the query that matched the object + * + * @return self + */ + public function setMatchedWords($matchedWords) + { + $this->container['matchedWords'] = $matchedWords; + + return $this; + } + + /** + * Gets fullyHighlighted + * + * @return bool|null + */ + public function getFullyHighlighted() + { + return $this->container['fullyHighlighted']; + } + + /** + * Sets fullyHighlighted + * + * @param bool|null $fullyHighlighted whether the entire attribute value is highlighted + * + * @return self + */ + public function setFullyHighlighted($fullyHighlighted) + { + $this->container['fullyHighlighted'] = $fullyHighlighted; + + 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/Search/Hit.php b/clients/algoliasearch-client-php/lib/Model/Search/Hit.php new file mode 100644 index 0000000000..073da60416 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Hit.php @@ -0,0 +1,416 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Hit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'hit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'objectID' => 'string', + 'highlightResult' => '\Algolia\AlgoliaSearch\Model\Search\HighlightResult', + 'snippetResult' => '\Algolia\AlgoliaSearch\Model\Search\SnippetResult', + 'rankingInfo' => '\Algolia\AlgoliaSearch\Model\Search\RankingInfo', + 'distinctSeqID' => 'int', + ]; + + /** + * 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, + ]; + + /** + * 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', + ]; + + /** + * 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', + ]; + + /** + * 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', + ]; + + /** + * 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; + } + + /** + * 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"; + } + + 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\Search\HighlightResult|null + */ + public function getHighlightResult() + { + return $this->container['highlightResult']; + } + + /** + * Sets highlightResult + * + * @param \Algolia\AlgoliaSearch\Model\Search\HighlightResult|null $highlightResult highlightResult + * + * @return self + */ + public function setHighlightResult($highlightResult) + { + $this->container['highlightResult'] = $highlightResult; + + return $this; + } + + /** + * Gets snippetResult + * + * @return \Algolia\AlgoliaSearch\Model\Search\SnippetResult|null + */ + public function getSnippetResult() + { + return $this->container['snippetResult']; + } + + /** + * Sets snippetResult + * + * @param \Algolia\AlgoliaSearch\Model\Search\SnippetResult|null $snippetResult snippetResult + * + * @return self + */ + public function setSnippetResult($snippetResult) + { + $this->container['snippetResult'] = $snippetResult; + + return $this; + } + + /** + * Gets rankingInfo + * + * @return \Algolia\AlgoliaSearch\Model\Search\RankingInfo|null + */ + public function getRankingInfo() + { + return $this->container['rankingInfo']; + } + + /** + * Sets rankingInfo + * + * @param \Algolia\AlgoliaSearch\Model\Search\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; + } + /** + * 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/Search/IndexSettings.php b/clients/algoliasearch-client-php/lib/Model/Search/IndexSettings.php new file mode 100644 index 0000000000..95a21fc0bf --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/IndexSettings.php @@ -0,0 +1,2179 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class IndexSettings implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'indexSettings'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'replicas' => 'string[]', + 'paginationLimitedTo' => 'int', + 'disableTypoToleranceOnWords' => 'string[]', + 'attributesToTransliterate' => 'string[]', + 'camelCaseAttributes' => 'string[]', + 'decompoundedAttributes' => 'object', + 'indexLanguages' => 'string[]', + 'filterPromotes' => 'bool', + 'disablePrefixOnAttributes' => 'string[]', + 'allowCompressionOfIntegerArray' => 'bool', + 'numericAttributesForFiltering' => 'string[]', + 'userData' => 'object', + 'searchableAttributes' => 'string[]', + 'attributesForFaceting' => 'string[]', + 'unretrievableAttributes' => 'string[]', + 'attributesToRetrieve' => 'string[]', + 'restrictSearchableAttributes' => 'string[]', + 'ranking' => 'string[]', + 'customRanking' => 'string[]', + 'relevancyStrictness' => 'int', + 'attributesToHighlight' => 'string[]', + 'attributesToSnippet' => 'string[]', + 'highlightPreTag' => 'string', + 'highlightPostTag' => 'string', + 'snippetEllipsisText' => 'string', + 'restrictHighlightAndSnippetArrays' => 'bool', + 'hitsPerPage' => 'int', + 'minWordSizefor1Typo' => 'int', + 'minWordSizefor2Typos' => 'int', + 'typoTolerance' => 'string', + 'allowTyposOnNumericTokens' => 'bool', + 'disableTypoToleranceOnAttributes' => 'string[]', + 'separatorsToIndex' => 'string', + 'ignorePlurals' => 'string', + 'removeStopWords' => 'string', + 'keepDiacriticsOnCharacters' => 'string', + 'queryLanguages' => 'string[]', + 'decompoundQuery' => 'bool', + 'enableRules' => 'bool', + 'enablePersonalization' => 'bool', + 'queryType' => 'string', + 'removeWordsIfNoResults' => 'string', + 'advancedSyntax' => 'bool', + 'optionalWords' => 'string[]', + 'disableExactOnAttributes' => 'string[]', + 'exactOnSingleWordQuery' => 'string', + 'alternativesAsExact' => 'string[]', + 'advancedSyntaxFeatures' => 'string[]', + 'distinct' => 'int', + 'synonyms' => 'bool', + 'replaceSynonymsInHighlight' => 'bool', + 'minProximity' => 'int', + 'responseFields' => 'string[]', + 'maxFacetHits' => 'int', + 'attributeCriteriaComputedByMinProximity' => 'bool', + 'renderingContent' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'replicas' => null, + 'paginationLimitedTo' => null, + 'disableTypoToleranceOnWords' => null, + 'attributesToTransliterate' => null, + 'camelCaseAttributes' => null, + 'decompoundedAttributes' => null, + 'indexLanguages' => null, + 'filterPromotes' => null, + 'disablePrefixOnAttributes' => null, + 'allowCompressionOfIntegerArray' => null, + 'numericAttributesForFiltering' => null, + 'userData' => null, + 'searchableAttributes' => null, + 'attributesForFaceting' => null, + 'unretrievableAttributes' => null, + 'attributesToRetrieve' => null, + 'restrictSearchableAttributes' => null, + 'ranking' => null, + 'customRanking' => null, + 'relevancyStrictness' => null, + 'attributesToHighlight' => null, + 'attributesToSnippet' => null, + 'highlightPreTag' => null, + 'highlightPostTag' => null, + 'snippetEllipsisText' => null, + 'restrictHighlightAndSnippetArrays' => null, + 'hitsPerPage' => null, + 'minWordSizefor1Typo' => null, + 'minWordSizefor2Typos' => null, + 'typoTolerance' => null, + 'allowTyposOnNumericTokens' => null, + 'disableTypoToleranceOnAttributes' => null, + 'separatorsToIndex' => null, + 'ignorePlurals' => null, + 'removeStopWords' => null, + 'keepDiacriticsOnCharacters' => null, + 'queryLanguages' => null, + 'decompoundQuery' => null, + 'enableRules' => null, + 'enablePersonalization' => null, + 'queryType' => null, + 'removeWordsIfNoResults' => null, + 'advancedSyntax' => null, + 'optionalWords' => null, + 'disableExactOnAttributes' => null, + 'exactOnSingleWordQuery' => null, + 'alternativesAsExact' => null, + 'advancedSyntaxFeatures' => null, + 'distinct' => null, + 'synonyms' => null, + 'replaceSynonymsInHighlight' => null, + 'minProximity' => null, + 'responseFields' => null, + 'maxFacetHits' => null, + 'attributeCriteriaComputedByMinProximity' => null, + 'renderingContent' => 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 = [ + 'replicas' => 'replicas', + 'paginationLimitedTo' => 'paginationLimitedTo', + 'disableTypoToleranceOnWords' => 'disableTypoToleranceOnWords', + 'attributesToTransliterate' => 'attributesToTransliterate', + 'camelCaseAttributes' => 'camelCaseAttributes', + 'decompoundedAttributes' => 'decompoundedAttributes', + 'indexLanguages' => 'indexLanguages', + 'filterPromotes' => 'filterPromotes', + 'disablePrefixOnAttributes' => 'disablePrefixOnAttributes', + 'allowCompressionOfIntegerArray' => 'allowCompressionOfIntegerArray', + 'numericAttributesForFiltering' => 'numericAttributesForFiltering', + 'userData' => 'userData', + 'searchableAttributes' => 'searchableAttributes', + 'attributesForFaceting' => 'attributesForFaceting', + 'unretrievableAttributes' => 'unretrievableAttributes', + 'attributesToRetrieve' => 'attributesToRetrieve', + 'restrictSearchableAttributes' => 'restrictSearchableAttributes', + 'ranking' => 'ranking', + 'customRanking' => 'customRanking', + 'relevancyStrictness' => 'relevancyStrictness', + 'attributesToHighlight' => 'attributesToHighlight', + 'attributesToSnippet' => 'attributesToSnippet', + 'highlightPreTag' => 'highlightPreTag', + 'highlightPostTag' => 'highlightPostTag', + 'snippetEllipsisText' => 'snippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'restrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'hitsPerPage', + 'minWordSizefor1Typo' => 'minWordSizefor1Typo', + 'minWordSizefor2Typos' => 'minWordSizefor2Typos', + 'typoTolerance' => 'typoTolerance', + 'allowTyposOnNumericTokens' => 'allowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'disableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'separatorsToIndex', + 'ignorePlurals' => 'ignorePlurals', + 'removeStopWords' => 'removeStopWords', + 'keepDiacriticsOnCharacters' => 'keepDiacriticsOnCharacters', + 'queryLanguages' => 'queryLanguages', + 'decompoundQuery' => 'decompoundQuery', + 'enableRules' => 'enableRules', + 'enablePersonalization' => 'enablePersonalization', + 'queryType' => 'queryType', + 'removeWordsIfNoResults' => 'removeWordsIfNoResults', + 'advancedSyntax' => 'advancedSyntax', + 'optionalWords' => 'optionalWords', + 'disableExactOnAttributes' => 'disableExactOnAttributes', + 'exactOnSingleWordQuery' => 'exactOnSingleWordQuery', + 'alternativesAsExact' => 'alternativesAsExact', + 'advancedSyntaxFeatures' => 'advancedSyntaxFeatures', + 'distinct' => 'distinct', + 'synonyms' => 'synonyms', + 'replaceSynonymsInHighlight' => 'replaceSynonymsInHighlight', + 'minProximity' => 'minProximity', + 'responseFields' => 'responseFields', + 'maxFacetHits' => 'maxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'attributeCriteriaComputedByMinProximity', + 'renderingContent' => 'renderingContent', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'replicas' => 'setReplicas', + 'paginationLimitedTo' => 'setPaginationLimitedTo', + 'disableTypoToleranceOnWords' => 'setDisableTypoToleranceOnWords', + 'attributesToTransliterate' => 'setAttributesToTransliterate', + 'camelCaseAttributes' => 'setCamelCaseAttributes', + 'decompoundedAttributes' => 'setDecompoundedAttributes', + 'indexLanguages' => 'setIndexLanguages', + 'filterPromotes' => 'setFilterPromotes', + 'disablePrefixOnAttributes' => 'setDisablePrefixOnAttributes', + 'allowCompressionOfIntegerArray' => 'setAllowCompressionOfIntegerArray', + 'numericAttributesForFiltering' => 'setNumericAttributesForFiltering', + 'userData' => 'setUserData', + 'searchableAttributes' => 'setSearchableAttributes', + 'attributesForFaceting' => 'setAttributesForFaceting', + 'unretrievableAttributes' => 'setUnretrievableAttributes', + 'attributesToRetrieve' => 'setAttributesToRetrieve', + 'restrictSearchableAttributes' => 'setRestrictSearchableAttributes', + 'ranking' => 'setRanking', + 'customRanking' => 'setCustomRanking', + 'relevancyStrictness' => 'setRelevancyStrictness', + 'attributesToHighlight' => 'setAttributesToHighlight', + 'attributesToSnippet' => 'setAttributesToSnippet', + 'highlightPreTag' => 'setHighlightPreTag', + 'highlightPostTag' => 'setHighlightPostTag', + 'snippetEllipsisText' => 'setSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'setRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'setHitsPerPage', + 'minWordSizefor1Typo' => 'setMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'setMinWordSizefor2Typos', + 'typoTolerance' => 'setTypoTolerance', + 'allowTyposOnNumericTokens' => 'setAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'setDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'setSeparatorsToIndex', + 'ignorePlurals' => 'setIgnorePlurals', + 'removeStopWords' => 'setRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'setKeepDiacriticsOnCharacters', + 'queryLanguages' => 'setQueryLanguages', + 'decompoundQuery' => 'setDecompoundQuery', + 'enableRules' => 'setEnableRules', + 'enablePersonalization' => 'setEnablePersonalization', + 'queryType' => 'setQueryType', + 'removeWordsIfNoResults' => 'setRemoveWordsIfNoResults', + 'advancedSyntax' => 'setAdvancedSyntax', + 'optionalWords' => 'setOptionalWords', + 'disableExactOnAttributes' => 'setDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'setExactOnSingleWordQuery', + 'alternativesAsExact' => 'setAlternativesAsExact', + 'advancedSyntaxFeatures' => 'setAdvancedSyntaxFeatures', + 'distinct' => 'setDistinct', + 'synonyms' => 'setSynonyms', + 'replaceSynonymsInHighlight' => 'setReplaceSynonymsInHighlight', + 'minProximity' => 'setMinProximity', + 'responseFields' => 'setResponseFields', + 'maxFacetHits' => 'setMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'setAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'setRenderingContent', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'replicas' => 'getReplicas', + 'paginationLimitedTo' => 'getPaginationLimitedTo', + 'disableTypoToleranceOnWords' => 'getDisableTypoToleranceOnWords', + 'attributesToTransliterate' => 'getAttributesToTransliterate', + 'camelCaseAttributes' => 'getCamelCaseAttributes', + 'decompoundedAttributes' => 'getDecompoundedAttributes', + 'indexLanguages' => 'getIndexLanguages', + 'filterPromotes' => 'getFilterPromotes', + 'disablePrefixOnAttributes' => 'getDisablePrefixOnAttributes', + 'allowCompressionOfIntegerArray' => 'getAllowCompressionOfIntegerArray', + 'numericAttributesForFiltering' => 'getNumericAttributesForFiltering', + 'userData' => 'getUserData', + 'searchableAttributes' => 'getSearchableAttributes', + 'attributesForFaceting' => 'getAttributesForFaceting', + 'unretrievableAttributes' => 'getUnretrievableAttributes', + 'attributesToRetrieve' => 'getAttributesToRetrieve', + 'restrictSearchableAttributes' => 'getRestrictSearchableAttributes', + 'ranking' => 'getRanking', + 'customRanking' => 'getCustomRanking', + 'relevancyStrictness' => 'getRelevancyStrictness', + 'attributesToHighlight' => 'getAttributesToHighlight', + 'attributesToSnippet' => 'getAttributesToSnippet', + 'highlightPreTag' => 'getHighlightPreTag', + 'highlightPostTag' => 'getHighlightPostTag', + 'snippetEllipsisText' => 'getSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'getRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'getHitsPerPage', + 'minWordSizefor1Typo' => 'getMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'getMinWordSizefor2Typos', + 'typoTolerance' => 'getTypoTolerance', + 'allowTyposOnNumericTokens' => 'getAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'getDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'getSeparatorsToIndex', + 'ignorePlurals' => 'getIgnorePlurals', + 'removeStopWords' => 'getRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'getKeepDiacriticsOnCharacters', + 'queryLanguages' => 'getQueryLanguages', + 'decompoundQuery' => 'getDecompoundQuery', + 'enableRules' => 'getEnableRules', + 'enablePersonalization' => 'getEnablePersonalization', + 'queryType' => 'getQueryType', + 'removeWordsIfNoResults' => 'getRemoveWordsIfNoResults', + 'advancedSyntax' => 'getAdvancedSyntax', + 'optionalWords' => 'getOptionalWords', + 'disableExactOnAttributes' => 'getDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'getExactOnSingleWordQuery', + 'alternativesAsExact' => 'getAlternativesAsExact', + 'advancedSyntaxFeatures' => 'getAdvancedSyntaxFeatures', + 'distinct' => 'getDistinct', + 'synonyms' => 'getSynonyms', + 'replaceSynonymsInHighlight' => 'getReplaceSynonymsInHighlight', + 'minProximity' => 'getMinProximity', + 'responseFields' => 'getResponseFields', + 'maxFacetHits' => 'getMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'getAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'getRenderingContent', + ]; + + /** + * 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 TYPO_TOLERANCE_TRUE = 'true'; + const TYPO_TOLERANCE_FALSE = 'false'; + const TYPO_TOLERANCE_MIN = 'min'; + const TYPO_TOLERANCE_STRICT = 'strict'; + const QUERY_TYPE_PREFIX_LAST = 'prefixLast'; + const QUERY_TYPE_PREFIX_ALL = 'prefixAll'; + const QUERY_TYPE_PREFIX_NONE = 'prefixNone'; + const REMOVE_WORDS_IF_NO_RESULTS_NONE = 'none'; + const REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS = 'lastWords'; + const REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS = 'firstWords'; + const REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL = 'allOptional'; + const EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE = 'attribute'; + const EXACT_ON_SINGLE_WORD_QUERY_NONE = 'none'; + const EXACT_ON_SINGLE_WORD_QUERY_WORD = 'word'; + const ALTERNATIVES_AS_EXACT_IGNORE_PLURALS = 'ignorePlurals'; + const ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM = 'singleWordSynonym'; + const ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM = 'multiWordsSynonym'; + const ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE = 'exactPhrase'; + const ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS = 'excludeWords'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypoToleranceAllowableValues() + { + return [ + self::TYPO_TOLERANCE_TRUE, + self::TYPO_TOLERANCE_FALSE, + self::TYPO_TOLERANCE_MIN, + self::TYPO_TOLERANCE_STRICT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getQueryTypeAllowableValues() + { + return [ + self::QUERY_TYPE_PREFIX_LAST, + self::QUERY_TYPE_PREFIX_ALL, + self::QUERY_TYPE_PREFIX_NONE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRemoveWordsIfNoResultsAllowableValues() + { + return [ + self::REMOVE_WORDS_IF_NO_RESULTS_NONE, + self::REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExactOnSingleWordQueryAllowableValues() + { + return [ + self::EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE, + self::EXACT_ON_SINGLE_WORD_QUERY_NONE, + self::EXACT_ON_SINGLE_WORD_QUERY_WORD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativesAsExactAllowableValues() + { + return [ + self::ALTERNATIVES_AS_EXACT_IGNORE_PLURALS, + self::ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM, + self::ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAdvancedSyntaxFeaturesAllowableValues() + { + return [ + self::ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE, + self::ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS, + ]; + } + + /** + * 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['replicas'] = $data['replicas'] ?? null; + $this->container['paginationLimitedTo'] = $data['paginationLimitedTo'] ?? 1000; + $this->container['disableTypoToleranceOnWords'] = $data['disableTypoToleranceOnWords'] ?? null; + $this->container['attributesToTransliterate'] = $data['attributesToTransliterate'] ?? null; + $this->container['camelCaseAttributes'] = $data['camelCaseAttributes'] ?? null; + $this->container['decompoundedAttributes'] = $data['decompoundedAttributes'] ?? null; + $this->container['indexLanguages'] = $data['indexLanguages'] ?? null; + $this->container['filterPromotes'] = $data['filterPromotes'] ?? false; + $this->container['disablePrefixOnAttributes'] = $data['disablePrefixOnAttributes'] ?? null; + $this->container['allowCompressionOfIntegerArray'] = $data['allowCompressionOfIntegerArray'] ?? false; + $this->container['numericAttributesForFiltering'] = $data['numericAttributesForFiltering'] ?? null; + $this->container['userData'] = $data['userData'] ?? null; + $this->container['searchableAttributes'] = $data['searchableAttributes'] ?? null; + $this->container['attributesForFaceting'] = $data['attributesForFaceting'] ?? null; + $this->container['unretrievableAttributes'] = $data['unretrievableAttributes'] ?? null; + $this->container['attributesToRetrieve'] = $data['attributesToRetrieve'] ?? null; + $this->container['restrictSearchableAttributes'] = $data['restrictSearchableAttributes'] ?? null; + $this->container['ranking'] = $data['ranking'] ?? null; + $this->container['customRanking'] = $data['customRanking'] ?? null; + $this->container['relevancyStrictness'] = $data['relevancyStrictness'] ?? 100; + $this->container['attributesToHighlight'] = $data['attributesToHighlight'] ?? null; + $this->container['attributesToSnippet'] = $data['attributesToSnippet'] ?? null; + $this->container['highlightPreTag'] = $data['highlightPreTag'] ?? ''; + $this->container['highlightPostTag'] = $data['highlightPostTag'] ?? ''; + $this->container['snippetEllipsisText'] = $data['snippetEllipsisText'] ?? '…'; + $this->container['restrictHighlightAndSnippetArrays'] = $data['restrictHighlightAndSnippetArrays'] ?? false; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + $this->container['minWordSizefor1Typo'] = $data['minWordSizefor1Typo'] ?? 4; + $this->container['minWordSizefor2Typos'] = $data['minWordSizefor2Typos'] ?? 8; + $this->container['typoTolerance'] = $data['typoTolerance'] ?? 'true'; + $this->container['allowTyposOnNumericTokens'] = $data['allowTyposOnNumericTokens'] ?? true; + $this->container['disableTypoToleranceOnAttributes'] = $data['disableTypoToleranceOnAttributes'] ?? null; + $this->container['separatorsToIndex'] = $data['separatorsToIndex'] ?? ''; + $this->container['ignorePlurals'] = $data['ignorePlurals'] ?? 'false'; + $this->container['removeStopWords'] = $data['removeStopWords'] ?? 'false'; + $this->container['keepDiacriticsOnCharacters'] = $data['keepDiacriticsOnCharacters'] ?? ''; + $this->container['queryLanguages'] = $data['queryLanguages'] ?? null; + $this->container['decompoundQuery'] = $data['decompoundQuery'] ?? true; + $this->container['enableRules'] = $data['enableRules'] ?? true; + $this->container['enablePersonalization'] = $data['enablePersonalization'] ?? false; + $this->container['queryType'] = $data['queryType'] ?? 'prefixLast'; + $this->container['removeWordsIfNoResults'] = $data['removeWordsIfNoResults'] ?? 'none'; + $this->container['advancedSyntax'] = $data['advancedSyntax'] ?? false; + $this->container['optionalWords'] = $data['optionalWords'] ?? null; + $this->container['disableExactOnAttributes'] = $data['disableExactOnAttributes'] ?? null; + $this->container['exactOnSingleWordQuery'] = $data['exactOnSingleWordQuery'] ?? 'attribute'; + $this->container['alternativesAsExact'] = $data['alternativesAsExact'] ?? null; + $this->container['advancedSyntaxFeatures'] = $data['advancedSyntaxFeatures'] ?? null; + $this->container['distinct'] = $data['distinct'] ?? 0; + $this->container['synonyms'] = $data['synonyms'] ?? true; + $this->container['replaceSynonymsInHighlight'] = $data['replaceSynonymsInHighlight'] ?? false; + $this->container['minProximity'] = $data['minProximity'] ?? 1; + $this->container['responseFields'] = $data['responseFields'] ?? null; + $this->container['maxFacetHits'] = $data['maxFacetHits'] ?? 10; + $this->container['attributeCriteriaComputedByMinProximity'] = $data['attributeCriteriaComputedByMinProximity'] ?? false; + $this->container['renderingContent'] = $data['renderingContent'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($this->container['typoTolerance']) && !in_array($this->container['typoTolerance'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'typoTolerance', must be one of '%s'", + $this->container['typoTolerance'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($this->container['queryType']) && !in_array($this->container['queryType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'queryType', must be one of '%s'", + $this->container['queryType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($this->container['removeWordsIfNoResults']) && !in_array($this->container['removeWordsIfNoResults'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $this->container['removeWordsIfNoResults'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($this->container['exactOnSingleWordQuery']) && !in_array($this->container['exactOnSingleWordQuery'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $this->container['exactOnSingleWordQuery'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] > 4)) { + $invalidProperties[] = "invalid value for 'distinct', must be smaller than or equal to 4."; + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] < 0)) { + $invalidProperties[] = "invalid value for 'distinct', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] > 7)) { + $invalidProperties[] = "invalid value for 'minProximity', must be smaller than or equal to 7."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] < 1)) { + $invalidProperties[] = "invalid value for 'minProximity', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['maxFacetHits']) && ($this->container['maxFacetHits'] > 100)) { + $invalidProperties[] = "invalid value for 'maxFacetHits', must be smaller than or equal to 100."; + } + + 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 replicas + * + * @return string[]|null + */ + public function getReplicas() + { + return $this->container['replicas']; + } + + /** + * Sets replicas + * + * @param string[]|null $replicas creates replicas, exact copies of an index + * + * @return self + */ + public function setReplicas($replicas) + { + $this->container['replicas'] = $replicas; + + return $this; + } + + /** + * Gets paginationLimitedTo + * + * @return int|null + */ + public function getPaginationLimitedTo() + { + return $this->container['paginationLimitedTo']; + } + + /** + * Sets paginationLimitedTo + * + * @param int|null $paginationLimitedTo set the maximum number of hits accessible via pagination + * + * @return self + */ + public function setPaginationLimitedTo($paginationLimitedTo) + { + $this->container['paginationLimitedTo'] = $paginationLimitedTo; + + return $this; + } + + /** + * Gets disableTypoToleranceOnWords + * + * @return string[]|null + */ + public function getDisableTypoToleranceOnWords() + { + return $this->container['disableTypoToleranceOnWords']; + } + + /** + * Sets disableTypoToleranceOnWords + * + * @param string[]|null $disableTypoToleranceOnWords a list of words for which you want to turn off typo tolerance + * + * @return self + */ + public function setDisableTypoToleranceOnWords($disableTypoToleranceOnWords) + { + $this->container['disableTypoToleranceOnWords'] = $disableTypoToleranceOnWords; + + return $this; + } + + /** + * Gets attributesToTransliterate + * + * @return string[]|null + */ + public function getAttributesToTransliterate() + { + return $this->container['attributesToTransliterate']; + } + + /** + * Sets attributesToTransliterate + * + * @param string[]|null $attributesToTransliterate specify on which attributes to apply transliteration + * + * @return self + */ + public function setAttributesToTransliterate($attributesToTransliterate) + { + $this->container['attributesToTransliterate'] = $attributesToTransliterate; + + return $this; + } + + /** + * Gets camelCaseAttributes + * + * @return string[]|null + */ + public function getCamelCaseAttributes() + { + return $this->container['camelCaseAttributes']; + } + + /** + * Sets camelCaseAttributes + * + * @param string[]|null $camelCaseAttributes list of attributes on which to do a decomposition of camel case words + * + * @return self + */ + public function setCamelCaseAttributes($camelCaseAttributes) + { + $this->container['camelCaseAttributes'] = $camelCaseAttributes; + + return $this; + } + + /** + * Gets decompoundedAttributes + * + * @return object|null + */ + public function getDecompoundedAttributes() + { + return $this->container['decompoundedAttributes']; + } + + /** + * Sets decompoundedAttributes + * + * @param object|null $decompoundedAttributes specify on which attributes in your index Algolia should apply word segmentation, also known as decompounding + * + * @return self + */ + public function setDecompoundedAttributes($decompoundedAttributes) + { + $this->container['decompoundedAttributes'] = $decompoundedAttributes; + + return $this; + } + + /** + * Gets indexLanguages + * + * @return string[]|null + */ + public function getIndexLanguages() + { + return $this->container['indexLanguages']; + } + + /** + * Sets indexLanguages + * + * @param string[]|null $indexLanguages sets the languages at the index level for language-specific processing such as tokenization and normalization + * + * @return self + */ + public function setIndexLanguages($indexLanguages) + { + $this->container['indexLanguages'] = $indexLanguages; + + return $this; + } + + /** + * Gets filterPromotes + * + * @return bool|null + */ + public function getFilterPromotes() + { + return $this->container['filterPromotes']; + } + + /** + * Sets filterPromotes + * + * @param bool|null $filterPromotes whether promoted results should match the filters of the current search, except for geographic filters + * + * @return self + */ + public function setFilterPromotes($filterPromotes) + { + $this->container['filterPromotes'] = $filterPromotes; + + return $this; + } + + /** + * Gets disablePrefixOnAttributes + * + * @return string[]|null + */ + public function getDisablePrefixOnAttributes() + { + return $this->container['disablePrefixOnAttributes']; + } + + /** + * Sets disablePrefixOnAttributes + * + * @param string[]|null $disablePrefixOnAttributes list of attributes on which you want to disable prefix matching + * + * @return self + */ + public function setDisablePrefixOnAttributes($disablePrefixOnAttributes) + { + $this->container['disablePrefixOnAttributes'] = $disablePrefixOnAttributes; + + return $this; + } + + /** + * Gets allowCompressionOfIntegerArray + * + * @return bool|null + */ + public function getAllowCompressionOfIntegerArray() + { + return $this->container['allowCompressionOfIntegerArray']; + } + + /** + * Sets allowCompressionOfIntegerArray + * + * @param bool|null $allowCompressionOfIntegerArray enables compression of large integer arrays + * + * @return self + */ + public function setAllowCompressionOfIntegerArray($allowCompressionOfIntegerArray) + { + $this->container['allowCompressionOfIntegerArray'] = $allowCompressionOfIntegerArray; + + return $this; + } + + /** + * Gets numericAttributesForFiltering + * + * @return string[]|null + */ + public function getNumericAttributesForFiltering() + { + return $this->container['numericAttributesForFiltering']; + } + + /** + * Sets numericAttributesForFiltering + * + * @param string[]|null $numericAttributesForFiltering list of numeric attributes that can be used as numerical filters + * + * @return self + */ + public function setNumericAttributesForFiltering($numericAttributesForFiltering) + { + $this->container['numericAttributesForFiltering'] = $numericAttributesForFiltering; + + 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 searchableAttributes + * + * @return string[]|null + */ + public function getSearchableAttributes() + { + return $this->container['searchableAttributes']; + } + + /** + * Sets searchableAttributes + * + * @param string[]|null $searchableAttributes the complete list of attributes used for searching + * + * @return self + */ + public function setSearchableAttributes($searchableAttributes) + { + $this->container['searchableAttributes'] = $searchableAttributes; + + return $this; + } + + /** + * Gets attributesForFaceting + * + * @return string[]|null + */ + public function getAttributesForFaceting() + { + return $this->container['attributesForFaceting']; + } + + /** + * Sets attributesForFaceting + * + * @param string[]|null $attributesForFaceting the complete list of attributes that will be used for faceting + * + * @return self + */ + public function setAttributesForFaceting($attributesForFaceting) + { + $this->container['attributesForFaceting'] = $attributesForFaceting; + + return $this; + } + + /** + * Gets unretrievableAttributes + * + * @return string[]|null + */ + public function getUnretrievableAttributes() + { + return $this->container['unretrievableAttributes']; + } + + /** + * Sets unretrievableAttributes + * + * @param string[]|null $unretrievableAttributes list of attributes that can't be retrieved at query time + * + * @return self + */ + public function setUnretrievableAttributes($unretrievableAttributes) + { + $this->container['unretrievableAttributes'] = $unretrievableAttributes; + + return $this; + } + + /** + * Gets attributesToRetrieve + * + * @return string[]|null + */ + public function getAttributesToRetrieve() + { + return $this->container['attributesToRetrieve']; + } + + /** + * Sets attributesToRetrieve + * + * @param string[]|null $attributesToRetrieve this parameter controls which attributes to retrieve and which not to retrieve + * + * @return self + */ + public function setAttributesToRetrieve($attributesToRetrieve) + { + $this->container['attributesToRetrieve'] = $attributesToRetrieve; + + return $this; + } + + /** + * Gets restrictSearchableAttributes + * + * @return string[]|null + */ + public function getRestrictSearchableAttributes() + { + return $this->container['restrictSearchableAttributes']; + } + + /** + * Sets restrictSearchableAttributes + * + * @param string[]|null $restrictSearchableAttributes restricts a given query to look in only a subset of your searchable attributes + * + * @return self + */ + public function setRestrictSearchableAttributes($restrictSearchableAttributes) + { + $this->container['restrictSearchableAttributes'] = $restrictSearchableAttributes; + + return $this; + } + + /** + * Gets ranking + * + * @return string[]|null + */ + public function getRanking() + { + return $this->container['ranking']; + } + + /** + * Sets ranking + * + * @param string[]|null $ranking controls how Algolia should sort your results + * + * @return self + */ + public function setRanking($ranking) + { + $this->container['ranking'] = $ranking; + + return $this; + } + + /** + * Gets customRanking + * + * @return string[]|null + */ + public function getCustomRanking() + { + return $this->container['customRanking']; + } + + /** + * Sets customRanking + * + * @param string[]|null $customRanking specifies the custom ranking criterion + * + * @return self + */ + public function setCustomRanking($customRanking) + { + $this->container['customRanking'] = $customRanking; + + return $this; + } + + /** + * Gets relevancyStrictness + * + * @return int|null + */ + public function getRelevancyStrictness() + { + return $this->container['relevancyStrictness']; + } + + /** + * Sets relevancyStrictness + * + * @param int|null $relevancyStrictness controls the relevancy threshold below which less relevant results aren't included in the results + * + * @return self + */ + public function setRelevancyStrictness($relevancyStrictness) + { + $this->container['relevancyStrictness'] = $relevancyStrictness; + + return $this; + } + + /** + * Gets attributesToHighlight + * + * @return string[]|null + */ + public function getAttributesToHighlight() + { + return $this->container['attributesToHighlight']; + } + + /** + * Sets attributesToHighlight + * + * @param string[]|null $attributesToHighlight list of attributes to highlight + * + * @return self + */ + public function setAttributesToHighlight($attributesToHighlight) + { + $this->container['attributesToHighlight'] = $attributesToHighlight; + + return $this; + } + + /** + * Gets attributesToSnippet + * + * @return string[]|null + */ + public function getAttributesToSnippet() + { + return $this->container['attributesToSnippet']; + } + + /** + * Sets attributesToSnippet + * + * @param string[]|null $attributesToSnippet list of attributes to snippet, with an optional maximum number of words to snippet + * + * @return self + */ + public function setAttributesToSnippet($attributesToSnippet) + { + $this->container['attributesToSnippet'] = $attributesToSnippet; + + return $this; + } + + /** + * Gets highlightPreTag + * + * @return string|null + */ + public function getHighlightPreTag() + { + return $this->container['highlightPreTag']; + } + + /** + * Sets highlightPreTag + * + * @param string|null $highlightPreTag the HTML string to insert before the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPreTag($highlightPreTag) + { + $this->container['highlightPreTag'] = $highlightPreTag; + + return $this; + } + + /** + * Gets highlightPostTag + * + * @return string|null + */ + public function getHighlightPostTag() + { + return $this->container['highlightPostTag']; + } + + /** + * Sets highlightPostTag + * + * @param string|null $highlightPostTag the HTML string to insert after the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPostTag($highlightPostTag) + { + $this->container['highlightPostTag'] = $highlightPostTag; + + return $this; + } + + /** + * Gets snippetEllipsisText + * + * @return string|null + */ + public function getSnippetEllipsisText() + { + return $this->container['snippetEllipsisText']; + } + + /** + * Sets snippetEllipsisText + * + * @param string|null $snippetEllipsisText string used as an ellipsis indicator when a snippet is truncated + * + * @return self + */ + public function setSnippetEllipsisText($snippetEllipsisText) + { + $this->container['snippetEllipsisText'] = $snippetEllipsisText; + + return $this; + } + + /** + * Gets restrictHighlightAndSnippetArrays + * + * @return bool|null + */ + public function getRestrictHighlightAndSnippetArrays() + { + return $this->container['restrictHighlightAndSnippetArrays']; + } + + /** + * Sets restrictHighlightAndSnippetArrays + * + * @param bool|null $restrictHighlightAndSnippetArrays restrict highlighting and snippeting to items that matched the query + * + * @return self + */ + public function setRestrictHighlightAndSnippetArrays($restrictHighlightAndSnippetArrays) + { + $this->container['restrictHighlightAndSnippetArrays'] = $restrictHighlightAndSnippetArrays; + + return $this; + } + + /** + * Gets hitsPerPage + * + * @return int|null + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int|null $hitsPerPage set the number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Gets minWordSizefor1Typo + * + * @return int|null + */ + public function getMinWordSizefor1Typo() + { + return $this->container['minWordSizefor1Typo']; + } + + /** + * Sets minWordSizefor1Typo + * + * @param int|null $minWordSizefor1Typo minimum number of characters a word in the query string must contain to accept matches with 1 typo + * + * @return self + */ + public function setMinWordSizefor1Typo($minWordSizefor1Typo) + { + $this->container['minWordSizefor1Typo'] = $minWordSizefor1Typo; + + return $this; + } + + /** + * Gets minWordSizefor2Typos + * + * @return int|null + */ + public function getMinWordSizefor2Typos() + { + return $this->container['minWordSizefor2Typos']; + } + + /** + * Sets minWordSizefor2Typos + * + * @param int|null $minWordSizefor2Typos minimum number of characters a word in the query string must contain to accept matches with 2 typos + * + * @return self + */ + public function setMinWordSizefor2Typos($minWordSizefor2Typos) + { + $this->container['minWordSizefor2Typos'] = $minWordSizefor2Typos; + + return $this; + } + + /** + * Gets typoTolerance + * + * @return string|null + */ + public function getTypoTolerance() + { + return $this->container['typoTolerance']; + } + + /** + * Sets typoTolerance + * + * @param string|null $typoTolerance controls whether typo tolerance is enabled and how it is applied + * + * @return self + */ + public function setTypoTolerance($typoTolerance) + { + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($typoTolerance) && !in_array($typoTolerance, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'typoTolerance', must be one of '%s'", + $typoTolerance, + implode("', '", $allowedValues) + ) + ); + } + $this->container['typoTolerance'] = $typoTolerance; + + return $this; + } + + /** + * Gets allowTyposOnNumericTokens + * + * @return bool|null + */ + public function getAllowTyposOnNumericTokens() + { + return $this->container['allowTyposOnNumericTokens']; + } + + /** + * Sets allowTyposOnNumericTokens + * + * @param bool|null $allowTyposOnNumericTokens whether to allow typos on numbers (\"numeric tokens\") in the query string + * + * @return self + */ + public function setAllowTyposOnNumericTokens($allowTyposOnNumericTokens) + { + $this->container['allowTyposOnNumericTokens'] = $allowTyposOnNumericTokens; + + return $this; + } + + /** + * Gets disableTypoToleranceOnAttributes + * + * @return string[]|null + */ + public function getDisableTypoToleranceOnAttributes() + { + return $this->container['disableTypoToleranceOnAttributes']; + } + + /** + * Sets disableTypoToleranceOnAttributes + * + * @param string[]|null $disableTypoToleranceOnAttributes list of attributes on which you want to disable typo tolerance + * + * @return self + */ + public function setDisableTypoToleranceOnAttributes($disableTypoToleranceOnAttributes) + { + $this->container['disableTypoToleranceOnAttributes'] = $disableTypoToleranceOnAttributes; + + return $this; + } + + /** + * Gets separatorsToIndex + * + * @return string|null + */ + public function getSeparatorsToIndex() + { + return $this->container['separatorsToIndex']; + } + + /** + * Sets separatorsToIndex + * + * @param string|null $separatorsToIndex control which separators are indexed + * + * @return self + */ + public function setSeparatorsToIndex($separatorsToIndex) + { + $this->container['separatorsToIndex'] = $separatorsToIndex; + + return $this; + } + + /** + * Gets ignorePlurals + * + * @return string|null + */ + public function getIgnorePlurals() + { + return $this->container['ignorePlurals']; + } + + /** + * Sets ignorePlurals + * + * @param string|null $ignorePlurals treats singular, plurals, and other forms of declensions as matching terms + * + * @return self + */ + public function setIgnorePlurals($ignorePlurals) + { + $this->container['ignorePlurals'] = $ignorePlurals; + + return $this; + } + + /** + * Gets removeStopWords + * + * @return string|null + */ + public function getRemoveStopWords() + { + return $this->container['removeStopWords']; + } + + /** + * Sets removeStopWords + * + * @param string|null $removeStopWords removes stop (common) words from the query before executing it + * + * @return self + */ + public function setRemoveStopWords($removeStopWords) + { + $this->container['removeStopWords'] = $removeStopWords; + + return $this; + } + + /** + * Gets keepDiacriticsOnCharacters + * + * @return string|null + */ + public function getKeepDiacriticsOnCharacters() + { + return $this->container['keepDiacriticsOnCharacters']; + } + + /** + * Sets keepDiacriticsOnCharacters + * + * @param string|null $keepDiacriticsOnCharacters list of characters that the engine shouldn't automatically normalize + * + * @return self + */ + public function setKeepDiacriticsOnCharacters($keepDiacriticsOnCharacters) + { + $this->container['keepDiacriticsOnCharacters'] = $keepDiacriticsOnCharacters; + + return $this; + } + + /** + * Gets queryLanguages + * + * @return string[]|null + */ + public function getQueryLanguages() + { + return $this->container['queryLanguages']; + } + + /** + * Sets queryLanguages + * + * @param string[]|null $queryLanguages sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection + * + * @return self + */ + public function setQueryLanguages($queryLanguages) + { + $this->container['queryLanguages'] = $queryLanguages; + + return $this; + } + + /** + * Gets decompoundQuery + * + * @return bool|null + */ + public function getDecompoundQuery() + { + return $this->container['decompoundQuery']; + } + + /** + * Sets decompoundQuery + * + * @param bool|null $decompoundQuery splits compound words into their composing atoms in the query + * + * @return self + */ + public function setDecompoundQuery($decompoundQuery) + { + $this->container['decompoundQuery'] = $decompoundQuery; + + return $this; + } + + /** + * Gets enableRules + * + * @return bool|null + */ + public function getEnableRules() + { + return $this->container['enableRules']; + } + + /** + * Sets enableRules + * + * @param bool|null $enableRules whether Rules should be globally enabled + * + * @return self + */ + public function setEnableRules($enableRules) + { + $this->container['enableRules'] = $enableRules; + + return $this; + } + + /** + * Gets enablePersonalization + * + * @return bool|null + */ + public function getEnablePersonalization() + { + return $this->container['enablePersonalization']; + } + + /** + * Sets enablePersonalization + * + * @param bool|null $enablePersonalization enable the Personalization feature + * + * @return self + */ + public function setEnablePersonalization($enablePersonalization) + { + $this->container['enablePersonalization'] = $enablePersonalization; + + return $this; + } + + /** + * Gets queryType + * + * @return string|null + */ + public function getQueryType() + { + return $this->container['queryType']; + } + + /** + * Sets queryType + * + * @param string|null $queryType controls if and how query words are interpreted as prefixes + * + * @return self + */ + public function setQueryType($queryType) + { + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($queryType) && !in_array($queryType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'queryType', must be one of '%s'", + $queryType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['queryType'] = $queryType; + + return $this; + } + + /** + * Gets removeWordsIfNoResults + * + * @return string|null + */ + public function getRemoveWordsIfNoResults() + { + return $this->container['removeWordsIfNoResults']; + } + + /** + * Sets removeWordsIfNoResults + * + * @param string|null $removeWordsIfNoResults selects a strategy to remove words from the query when it doesn't match any hits + * + * @return self + */ + public function setRemoveWordsIfNoResults($removeWordsIfNoResults) + { + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($removeWordsIfNoResults) && !in_array($removeWordsIfNoResults, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $removeWordsIfNoResults, + implode("', '", $allowedValues) + ) + ); + } + $this->container['removeWordsIfNoResults'] = $removeWordsIfNoResults; + + return $this; + } + + /** + * Gets advancedSyntax + * + * @return bool|null + */ + public function getAdvancedSyntax() + { + return $this->container['advancedSyntax']; + } + + /** + * Sets advancedSyntax + * + * @param bool|null $advancedSyntax enables the advanced query syntax + * + * @return self + */ + public function setAdvancedSyntax($advancedSyntax) + { + $this->container['advancedSyntax'] = $advancedSyntax; + + return $this; + } + + /** + * Gets optionalWords + * + * @return string[]|null + */ + public function getOptionalWords() + { + return $this->container['optionalWords']; + } + + /** + * Sets optionalWords + * + * @param string[]|null $optionalWords a list of words that should be considered as optional when found in the query + * + * @return self + */ + public function setOptionalWords($optionalWords) + { + $this->container['optionalWords'] = $optionalWords; + + return $this; + } + + /** + * Gets disableExactOnAttributes + * + * @return string[]|null + */ + public function getDisableExactOnAttributes() + { + return $this->container['disableExactOnAttributes']; + } + + /** + * Sets disableExactOnAttributes + * + * @param string[]|null $disableExactOnAttributes list of attributes on which you want to disable the exact ranking criterion + * + * @return self + */ + public function setDisableExactOnAttributes($disableExactOnAttributes) + { + $this->container['disableExactOnAttributes'] = $disableExactOnAttributes; + + return $this; + } + + /** + * Gets exactOnSingleWordQuery + * + * @return string|null + */ + public function getExactOnSingleWordQuery() + { + return $this->container['exactOnSingleWordQuery']; + } + + /** + * Sets exactOnSingleWordQuery + * + * @param string|null $exactOnSingleWordQuery controls how the exact ranking criterion is computed when the query contains only one word + * + * @return self + */ + public function setExactOnSingleWordQuery($exactOnSingleWordQuery) + { + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($exactOnSingleWordQuery) && !in_array($exactOnSingleWordQuery, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $exactOnSingleWordQuery, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exactOnSingleWordQuery'] = $exactOnSingleWordQuery; + + return $this; + } + + /** + * Gets alternativesAsExact + * + * @return string[]|null + */ + public function getAlternativesAsExact() + { + return $this->container['alternativesAsExact']; + } + + /** + * Sets alternativesAsExact + * + * @param string[]|null $alternativesAsExact list of alternatives that should be considered an exact match by the exact ranking criterion + * + * @return self + */ + public function setAlternativesAsExact($alternativesAsExact) + { + $allowedValues = $this->getAlternativesAsExactAllowableValues(); + if (!is_null($alternativesAsExact) && array_diff($alternativesAsExact, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternativesAsExact', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternativesAsExact'] = $alternativesAsExact; + + return $this; + } + + /** + * Gets advancedSyntaxFeatures + * + * @return string[]|null + */ + public function getAdvancedSyntaxFeatures() + { + return $this->container['advancedSyntaxFeatures']; + } + + /** + * Sets advancedSyntaxFeatures + * + * @param string[]|null $advancedSyntaxFeatures allows you to specify which advanced syntax features are active when ‘advancedSyntax' is enabled + * + * @return self + */ + public function setAdvancedSyntaxFeatures($advancedSyntaxFeatures) + { + $allowedValues = $this->getAdvancedSyntaxFeaturesAllowableValues(); + if (!is_null($advancedSyntaxFeatures) && array_diff($advancedSyntaxFeatures, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'advancedSyntaxFeatures', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['advancedSyntaxFeatures'] = $advancedSyntaxFeatures; + + return $this; + } + + /** + * Gets distinct + * + * @return int|null + */ + public function getDistinct() + { + return $this->container['distinct']; + } + + /** + * Sets distinct + * + * @param int|null $distinct enables de-duplication or grouping of results + * + * @return self + */ + public function setDistinct($distinct) + { + if (!is_null($distinct) && ($distinct > 4)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling IndexSettings., must be smaller than or equal to 4.'); + } + if (!is_null($distinct) && ($distinct < 0)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling IndexSettings., must be bigger than or equal to 0.'); + } + + $this->container['distinct'] = $distinct; + + return $this; + } + + /** + * Gets synonyms + * + * @return bool|null + */ + public function getSynonyms() + { + return $this->container['synonyms']; + } + + /** + * Sets synonyms + * + * @param bool|null $synonyms whether to take into account an index's synonyms for a particular search + * + * @return self + */ + public function setSynonyms($synonyms) + { + $this->container['synonyms'] = $synonyms; + + return $this; + } + + /** + * Gets replaceSynonymsInHighlight + * + * @return bool|null + */ + public function getReplaceSynonymsInHighlight() + { + return $this->container['replaceSynonymsInHighlight']; + } + + /** + * Sets replaceSynonymsInHighlight + * + * @param bool|null $replaceSynonymsInHighlight whether to highlight and snippet the original word that matches the synonym or the synonym itself + * + * @return self + */ + public function setReplaceSynonymsInHighlight($replaceSynonymsInHighlight) + { + $this->container['replaceSynonymsInHighlight'] = $replaceSynonymsInHighlight; + + return $this; + } + + /** + * Gets minProximity + * + * @return int|null + */ + public function getMinProximity() + { + return $this->container['minProximity']; + } + + /** + * Sets minProximity + * + * @param int|null $minProximity precision of the proximity ranking criterion + * + * @return self + */ + public function setMinProximity($minProximity) + { + if (!is_null($minProximity) && ($minProximity > 7)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling IndexSettings., must be smaller than or equal to 7.'); + } + if (!is_null($minProximity) && ($minProximity < 1)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling IndexSettings., must be bigger than or equal to 1.'); + } + + $this->container['minProximity'] = $minProximity; + + return $this; + } + + /** + * Gets responseFields + * + * @return string[]|null + */ + public function getResponseFields() + { + return $this->container['responseFields']; + } + + /** + * Sets responseFields + * + * @param string[]|null $responseFields Choose which fields to return in the API response. This parameters applies to search and browse queries. + * + * @return self + */ + public function setResponseFields($responseFields) + { + $this->container['responseFields'] = $responseFields; + + return $this; + } + + /** + * Gets maxFacetHits + * + * @return int|null + */ + public function getMaxFacetHits() + { + return $this->container['maxFacetHits']; + } + + /** + * Sets maxFacetHits + * + * @param int|null $maxFacetHits Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. + * + * @return self + */ + public function setMaxFacetHits($maxFacetHits) + { + if (!is_null($maxFacetHits) && ($maxFacetHits > 100)) { + throw new \InvalidArgumentException('invalid value for $maxFacetHits when calling IndexSettings., must be smaller than or equal to 100.'); + } + + $this->container['maxFacetHits'] = $maxFacetHits; + + return $this; + } + + /** + * Gets attributeCriteriaComputedByMinProximity + * + * @return bool|null + */ + public function getAttributeCriteriaComputedByMinProximity() + { + return $this->container['attributeCriteriaComputedByMinProximity']; + } + + /** + * Sets attributeCriteriaComputedByMinProximity + * + * @param bool|null $attributeCriteriaComputedByMinProximity when attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage + * + * @return self + */ + public function setAttributeCriteriaComputedByMinProximity($attributeCriteriaComputedByMinProximity) + { + $this->container['attributeCriteriaComputedByMinProximity'] = $attributeCriteriaComputedByMinProximity; + + return $this; + } + + /** + * Gets renderingContent + * + * @return object|null + */ + public function getRenderingContent() + { + return $this->container['renderingContent']; + } + + /** + * Sets renderingContent + * + * @param object|null $renderingContent Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * + * @return self + */ + public function setRenderingContent($renderingContent) + { + $this->container['renderingContent'] = $renderingContent; + + 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/Search/IndexSettingsAsSearchParams.php b/clients/algoliasearch-client-php/lib/Model/Search/IndexSettingsAsSearchParams.php new file mode 100644 index 0000000000..eaebd70983 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/IndexSettingsAsSearchParams.php @@ -0,0 +1,1817 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class IndexSettingsAsSearchParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'indexSettingsAsSearchParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'searchableAttributes' => 'string[]', + 'attributesForFaceting' => 'string[]', + 'unretrievableAttributes' => 'string[]', + 'attributesToRetrieve' => 'string[]', + 'restrictSearchableAttributes' => 'string[]', + 'ranking' => 'string[]', + 'customRanking' => 'string[]', + 'relevancyStrictness' => 'int', + 'attributesToHighlight' => 'string[]', + 'attributesToSnippet' => 'string[]', + 'highlightPreTag' => 'string', + 'highlightPostTag' => 'string', + 'snippetEllipsisText' => 'string', + 'restrictHighlightAndSnippetArrays' => 'bool', + 'hitsPerPage' => 'int', + 'minWordSizefor1Typo' => 'int', + 'minWordSizefor2Typos' => 'int', + 'typoTolerance' => 'string', + 'allowTyposOnNumericTokens' => 'bool', + 'disableTypoToleranceOnAttributes' => 'string[]', + 'separatorsToIndex' => 'string', + 'ignorePlurals' => 'string', + 'removeStopWords' => 'string', + 'keepDiacriticsOnCharacters' => 'string', + 'queryLanguages' => 'string[]', + 'decompoundQuery' => 'bool', + 'enableRules' => 'bool', + 'enablePersonalization' => 'bool', + 'queryType' => 'string', + 'removeWordsIfNoResults' => 'string', + 'advancedSyntax' => 'bool', + 'optionalWords' => 'string[]', + 'disableExactOnAttributes' => 'string[]', + 'exactOnSingleWordQuery' => 'string', + 'alternativesAsExact' => 'string[]', + 'advancedSyntaxFeatures' => 'string[]', + 'distinct' => 'int', + 'synonyms' => 'bool', + 'replaceSynonymsInHighlight' => 'bool', + 'minProximity' => 'int', + 'responseFields' => 'string[]', + 'maxFacetHits' => 'int', + 'attributeCriteriaComputedByMinProximity' => 'bool', + 'renderingContent' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'searchableAttributes' => null, + 'attributesForFaceting' => null, + 'unretrievableAttributes' => null, + 'attributesToRetrieve' => null, + 'restrictSearchableAttributes' => null, + 'ranking' => null, + 'customRanking' => null, + 'relevancyStrictness' => null, + 'attributesToHighlight' => null, + 'attributesToSnippet' => null, + 'highlightPreTag' => null, + 'highlightPostTag' => null, + 'snippetEllipsisText' => null, + 'restrictHighlightAndSnippetArrays' => null, + 'hitsPerPage' => null, + 'minWordSizefor1Typo' => null, + 'minWordSizefor2Typos' => null, + 'typoTolerance' => null, + 'allowTyposOnNumericTokens' => null, + 'disableTypoToleranceOnAttributes' => null, + 'separatorsToIndex' => null, + 'ignorePlurals' => null, + 'removeStopWords' => null, + 'keepDiacriticsOnCharacters' => null, + 'queryLanguages' => null, + 'decompoundQuery' => null, + 'enableRules' => null, + 'enablePersonalization' => null, + 'queryType' => null, + 'removeWordsIfNoResults' => null, + 'advancedSyntax' => null, + 'optionalWords' => null, + 'disableExactOnAttributes' => null, + 'exactOnSingleWordQuery' => null, + 'alternativesAsExact' => null, + 'advancedSyntaxFeatures' => null, + 'distinct' => null, + 'synonyms' => null, + 'replaceSynonymsInHighlight' => null, + 'minProximity' => null, + 'responseFields' => null, + 'maxFacetHits' => null, + 'attributeCriteriaComputedByMinProximity' => null, + 'renderingContent' => 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 = [ + 'searchableAttributes' => 'searchableAttributes', + 'attributesForFaceting' => 'attributesForFaceting', + 'unretrievableAttributes' => 'unretrievableAttributes', + 'attributesToRetrieve' => 'attributesToRetrieve', + 'restrictSearchableAttributes' => 'restrictSearchableAttributes', + 'ranking' => 'ranking', + 'customRanking' => 'customRanking', + 'relevancyStrictness' => 'relevancyStrictness', + 'attributesToHighlight' => 'attributesToHighlight', + 'attributesToSnippet' => 'attributesToSnippet', + 'highlightPreTag' => 'highlightPreTag', + 'highlightPostTag' => 'highlightPostTag', + 'snippetEllipsisText' => 'snippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'restrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'hitsPerPage', + 'minWordSizefor1Typo' => 'minWordSizefor1Typo', + 'minWordSizefor2Typos' => 'minWordSizefor2Typos', + 'typoTolerance' => 'typoTolerance', + 'allowTyposOnNumericTokens' => 'allowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'disableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'separatorsToIndex', + 'ignorePlurals' => 'ignorePlurals', + 'removeStopWords' => 'removeStopWords', + 'keepDiacriticsOnCharacters' => 'keepDiacriticsOnCharacters', + 'queryLanguages' => 'queryLanguages', + 'decompoundQuery' => 'decompoundQuery', + 'enableRules' => 'enableRules', + 'enablePersonalization' => 'enablePersonalization', + 'queryType' => 'queryType', + 'removeWordsIfNoResults' => 'removeWordsIfNoResults', + 'advancedSyntax' => 'advancedSyntax', + 'optionalWords' => 'optionalWords', + 'disableExactOnAttributes' => 'disableExactOnAttributes', + 'exactOnSingleWordQuery' => 'exactOnSingleWordQuery', + 'alternativesAsExact' => 'alternativesAsExact', + 'advancedSyntaxFeatures' => 'advancedSyntaxFeatures', + 'distinct' => 'distinct', + 'synonyms' => 'synonyms', + 'replaceSynonymsInHighlight' => 'replaceSynonymsInHighlight', + 'minProximity' => 'minProximity', + 'responseFields' => 'responseFields', + 'maxFacetHits' => 'maxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'attributeCriteriaComputedByMinProximity', + 'renderingContent' => 'renderingContent', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'searchableAttributes' => 'setSearchableAttributes', + 'attributesForFaceting' => 'setAttributesForFaceting', + 'unretrievableAttributes' => 'setUnretrievableAttributes', + 'attributesToRetrieve' => 'setAttributesToRetrieve', + 'restrictSearchableAttributes' => 'setRestrictSearchableAttributes', + 'ranking' => 'setRanking', + 'customRanking' => 'setCustomRanking', + 'relevancyStrictness' => 'setRelevancyStrictness', + 'attributesToHighlight' => 'setAttributesToHighlight', + 'attributesToSnippet' => 'setAttributesToSnippet', + 'highlightPreTag' => 'setHighlightPreTag', + 'highlightPostTag' => 'setHighlightPostTag', + 'snippetEllipsisText' => 'setSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'setRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'setHitsPerPage', + 'minWordSizefor1Typo' => 'setMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'setMinWordSizefor2Typos', + 'typoTolerance' => 'setTypoTolerance', + 'allowTyposOnNumericTokens' => 'setAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'setDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'setSeparatorsToIndex', + 'ignorePlurals' => 'setIgnorePlurals', + 'removeStopWords' => 'setRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'setKeepDiacriticsOnCharacters', + 'queryLanguages' => 'setQueryLanguages', + 'decompoundQuery' => 'setDecompoundQuery', + 'enableRules' => 'setEnableRules', + 'enablePersonalization' => 'setEnablePersonalization', + 'queryType' => 'setQueryType', + 'removeWordsIfNoResults' => 'setRemoveWordsIfNoResults', + 'advancedSyntax' => 'setAdvancedSyntax', + 'optionalWords' => 'setOptionalWords', + 'disableExactOnAttributes' => 'setDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'setExactOnSingleWordQuery', + 'alternativesAsExact' => 'setAlternativesAsExact', + 'advancedSyntaxFeatures' => 'setAdvancedSyntaxFeatures', + 'distinct' => 'setDistinct', + 'synonyms' => 'setSynonyms', + 'replaceSynonymsInHighlight' => 'setReplaceSynonymsInHighlight', + 'minProximity' => 'setMinProximity', + 'responseFields' => 'setResponseFields', + 'maxFacetHits' => 'setMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'setAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'setRenderingContent', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'searchableAttributes' => 'getSearchableAttributes', + 'attributesForFaceting' => 'getAttributesForFaceting', + 'unretrievableAttributes' => 'getUnretrievableAttributes', + 'attributesToRetrieve' => 'getAttributesToRetrieve', + 'restrictSearchableAttributes' => 'getRestrictSearchableAttributes', + 'ranking' => 'getRanking', + 'customRanking' => 'getCustomRanking', + 'relevancyStrictness' => 'getRelevancyStrictness', + 'attributesToHighlight' => 'getAttributesToHighlight', + 'attributesToSnippet' => 'getAttributesToSnippet', + 'highlightPreTag' => 'getHighlightPreTag', + 'highlightPostTag' => 'getHighlightPostTag', + 'snippetEllipsisText' => 'getSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'getRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'getHitsPerPage', + 'minWordSizefor1Typo' => 'getMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'getMinWordSizefor2Typos', + 'typoTolerance' => 'getTypoTolerance', + 'allowTyposOnNumericTokens' => 'getAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'getDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'getSeparatorsToIndex', + 'ignorePlurals' => 'getIgnorePlurals', + 'removeStopWords' => 'getRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'getKeepDiacriticsOnCharacters', + 'queryLanguages' => 'getQueryLanguages', + 'decompoundQuery' => 'getDecompoundQuery', + 'enableRules' => 'getEnableRules', + 'enablePersonalization' => 'getEnablePersonalization', + 'queryType' => 'getQueryType', + 'removeWordsIfNoResults' => 'getRemoveWordsIfNoResults', + 'advancedSyntax' => 'getAdvancedSyntax', + 'optionalWords' => 'getOptionalWords', + 'disableExactOnAttributes' => 'getDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'getExactOnSingleWordQuery', + 'alternativesAsExact' => 'getAlternativesAsExact', + 'advancedSyntaxFeatures' => 'getAdvancedSyntaxFeatures', + 'distinct' => 'getDistinct', + 'synonyms' => 'getSynonyms', + 'replaceSynonymsInHighlight' => 'getReplaceSynonymsInHighlight', + 'minProximity' => 'getMinProximity', + 'responseFields' => 'getResponseFields', + 'maxFacetHits' => 'getMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'getAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'getRenderingContent', + ]; + + /** + * 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 TYPO_TOLERANCE_TRUE = 'true'; + const TYPO_TOLERANCE_FALSE = 'false'; + const TYPO_TOLERANCE_MIN = 'min'; + const TYPO_TOLERANCE_STRICT = 'strict'; + const QUERY_TYPE_PREFIX_LAST = 'prefixLast'; + const QUERY_TYPE_PREFIX_ALL = 'prefixAll'; + const QUERY_TYPE_PREFIX_NONE = 'prefixNone'; + const REMOVE_WORDS_IF_NO_RESULTS_NONE = 'none'; + const REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS = 'lastWords'; + const REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS = 'firstWords'; + const REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL = 'allOptional'; + const EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE = 'attribute'; + const EXACT_ON_SINGLE_WORD_QUERY_NONE = 'none'; + const EXACT_ON_SINGLE_WORD_QUERY_WORD = 'word'; + const ALTERNATIVES_AS_EXACT_IGNORE_PLURALS = 'ignorePlurals'; + const ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM = 'singleWordSynonym'; + const ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM = 'multiWordsSynonym'; + const ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE = 'exactPhrase'; + const ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS = 'excludeWords'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypoToleranceAllowableValues() + { + return [ + self::TYPO_TOLERANCE_TRUE, + self::TYPO_TOLERANCE_FALSE, + self::TYPO_TOLERANCE_MIN, + self::TYPO_TOLERANCE_STRICT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getQueryTypeAllowableValues() + { + return [ + self::QUERY_TYPE_PREFIX_LAST, + self::QUERY_TYPE_PREFIX_ALL, + self::QUERY_TYPE_PREFIX_NONE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRemoveWordsIfNoResultsAllowableValues() + { + return [ + self::REMOVE_WORDS_IF_NO_RESULTS_NONE, + self::REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExactOnSingleWordQueryAllowableValues() + { + return [ + self::EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE, + self::EXACT_ON_SINGLE_WORD_QUERY_NONE, + self::EXACT_ON_SINGLE_WORD_QUERY_WORD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativesAsExactAllowableValues() + { + return [ + self::ALTERNATIVES_AS_EXACT_IGNORE_PLURALS, + self::ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM, + self::ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAdvancedSyntaxFeaturesAllowableValues() + { + return [ + self::ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE, + self::ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS, + ]; + } + + /** + * 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['searchableAttributes'] = $data['searchableAttributes'] ?? null; + $this->container['attributesForFaceting'] = $data['attributesForFaceting'] ?? null; + $this->container['unretrievableAttributes'] = $data['unretrievableAttributes'] ?? null; + $this->container['attributesToRetrieve'] = $data['attributesToRetrieve'] ?? null; + $this->container['restrictSearchableAttributes'] = $data['restrictSearchableAttributes'] ?? null; + $this->container['ranking'] = $data['ranking'] ?? null; + $this->container['customRanking'] = $data['customRanking'] ?? null; + $this->container['relevancyStrictness'] = $data['relevancyStrictness'] ?? 100; + $this->container['attributesToHighlight'] = $data['attributesToHighlight'] ?? null; + $this->container['attributesToSnippet'] = $data['attributesToSnippet'] ?? null; + $this->container['highlightPreTag'] = $data['highlightPreTag'] ?? ''; + $this->container['highlightPostTag'] = $data['highlightPostTag'] ?? ''; + $this->container['snippetEllipsisText'] = $data['snippetEllipsisText'] ?? '…'; + $this->container['restrictHighlightAndSnippetArrays'] = $data['restrictHighlightAndSnippetArrays'] ?? false; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + $this->container['minWordSizefor1Typo'] = $data['minWordSizefor1Typo'] ?? 4; + $this->container['minWordSizefor2Typos'] = $data['minWordSizefor2Typos'] ?? 8; + $this->container['typoTolerance'] = $data['typoTolerance'] ?? 'true'; + $this->container['allowTyposOnNumericTokens'] = $data['allowTyposOnNumericTokens'] ?? true; + $this->container['disableTypoToleranceOnAttributes'] = $data['disableTypoToleranceOnAttributes'] ?? null; + $this->container['separatorsToIndex'] = $data['separatorsToIndex'] ?? ''; + $this->container['ignorePlurals'] = $data['ignorePlurals'] ?? 'false'; + $this->container['removeStopWords'] = $data['removeStopWords'] ?? 'false'; + $this->container['keepDiacriticsOnCharacters'] = $data['keepDiacriticsOnCharacters'] ?? ''; + $this->container['queryLanguages'] = $data['queryLanguages'] ?? null; + $this->container['decompoundQuery'] = $data['decompoundQuery'] ?? true; + $this->container['enableRules'] = $data['enableRules'] ?? true; + $this->container['enablePersonalization'] = $data['enablePersonalization'] ?? false; + $this->container['queryType'] = $data['queryType'] ?? 'prefixLast'; + $this->container['removeWordsIfNoResults'] = $data['removeWordsIfNoResults'] ?? 'none'; + $this->container['advancedSyntax'] = $data['advancedSyntax'] ?? false; + $this->container['optionalWords'] = $data['optionalWords'] ?? null; + $this->container['disableExactOnAttributes'] = $data['disableExactOnAttributes'] ?? null; + $this->container['exactOnSingleWordQuery'] = $data['exactOnSingleWordQuery'] ?? 'attribute'; + $this->container['alternativesAsExact'] = $data['alternativesAsExact'] ?? null; + $this->container['advancedSyntaxFeatures'] = $data['advancedSyntaxFeatures'] ?? null; + $this->container['distinct'] = $data['distinct'] ?? 0; + $this->container['synonyms'] = $data['synonyms'] ?? true; + $this->container['replaceSynonymsInHighlight'] = $data['replaceSynonymsInHighlight'] ?? false; + $this->container['minProximity'] = $data['minProximity'] ?? 1; + $this->container['responseFields'] = $data['responseFields'] ?? null; + $this->container['maxFacetHits'] = $data['maxFacetHits'] ?? 10; + $this->container['attributeCriteriaComputedByMinProximity'] = $data['attributeCriteriaComputedByMinProximity'] ?? false; + $this->container['renderingContent'] = $data['renderingContent'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($this->container['typoTolerance']) && !in_array($this->container['typoTolerance'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'typoTolerance', must be one of '%s'", + $this->container['typoTolerance'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($this->container['queryType']) && !in_array($this->container['queryType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'queryType', must be one of '%s'", + $this->container['queryType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($this->container['removeWordsIfNoResults']) && !in_array($this->container['removeWordsIfNoResults'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $this->container['removeWordsIfNoResults'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($this->container['exactOnSingleWordQuery']) && !in_array($this->container['exactOnSingleWordQuery'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $this->container['exactOnSingleWordQuery'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] > 4)) { + $invalidProperties[] = "invalid value for 'distinct', must be smaller than or equal to 4."; + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] < 0)) { + $invalidProperties[] = "invalid value for 'distinct', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] > 7)) { + $invalidProperties[] = "invalid value for 'minProximity', must be smaller than or equal to 7."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] < 1)) { + $invalidProperties[] = "invalid value for 'minProximity', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['maxFacetHits']) && ($this->container['maxFacetHits'] > 100)) { + $invalidProperties[] = "invalid value for 'maxFacetHits', must be smaller than or equal to 100."; + } + + 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 searchableAttributes + * + * @return string[]|null + */ + public function getSearchableAttributes() + { + return $this->container['searchableAttributes']; + } + + /** + * Sets searchableAttributes + * + * @param string[]|null $searchableAttributes the complete list of attributes used for searching + * + * @return self + */ + public function setSearchableAttributes($searchableAttributes) + { + $this->container['searchableAttributes'] = $searchableAttributes; + + return $this; + } + + /** + * Gets attributesForFaceting + * + * @return string[]|null + */ + public function getAttributesForFaceting() + { + return $this->container['attributesForFaceting']; + } + + /** + * Sets attributesForFaceting + * + * @param string[]|null $attributesForFaceting the complete list of attributes that will be used for faceting + * + * @return self + */ + public function setAttributesForFaceting($attributesForFaceting) + { + $this->container['attributesForFaceting'] = $attributesForFaceting; + + return $this; + } + + /** + * Gets unretrievableAttributes + * + * @return string[]|null + */ + public function getUnretrievableAttributes() + { + return $this->container['unretrievableAttributes']; + } + + /** + * Sets unretrievableAttributes + * + * @param string[]|null $unretrievableAttributes list of attributes that can't be retrieved at query time + * + * @return self + */ + public function setUnretrievableAttributes($unretrievableAttributes) + { + $this->container['unretrievableAttributes'] = $unretrievableAttributes; + + return $this; + } + + /** + * Gets attributesToRetrieve + * + * @return string[]|null + */ + public function getAttributesToRetrieve() + { + return $this->container['attributesToRetrieve']; + } + + /** + * Sets attributesToRetrieve + * + * @param string[]|null $attributesToRetrieve this parameter controls which attributes to retrieve and which not to retrieve + * + * @return self + */ + public function setAttributesToRetrieve($attributesToRetrieve) + { + $this->container['attributesToRetrieve'] = $attributesToRetrieve; + + return $this; + } + + /** + * Gets restrictSearchableAttributes + * + * @return string[]|null + */ + public function getRestrictSearchableAttributes() + { + return $this->container['restrictSearchableAttributes']; + } + + /** + * Sets restrictSearchableAttributes + * + * @param string[]|null $restrictSearchableAttributes restricts a given query to look in only a subset of your searchable attributes + * + * @return self + */ + public function setRestrictSearchableAttributes($restrictSearchableAttributes) + { + $this->container['restrictSearchableAttributes'] = $restrictSearchableAttributes; + + return $this; + } + + /** + * Gets ranking + * + * @return string[]|null + */ + public function getRanking() + { + return $this->container['ranking']; + } + + /** + * Sets ranking + * + * @param string[]|null $ranking controls how Algolia should sort your results + * + * @return self + */ + public function setRanking($ranking) + { + $this->container['ranking'] = $ranking; + + return $this; + } + + /** + * Gets customRanking + * + * @return string[]|null + */ + public function getCustomRanking() + { + return $this->container['customRanking']; + } + + /** + * Sets customRanking + * + * @param string[]|null $customRanking specifies the custom ranking criterion + * + * @return self + */ + public function setCustomRanking($customRanking) + { + $this->container['customRanking'] = $customRanking; + + return $this; + } + + /** + * Gets relevancyStrictness + * + * @return int|null + */ + public function getRelevancyStrictness() + { + return $this->container['relevancyStrictness']; + } + + /** + * Sets relevancyStrictness + * + * @param int|null $relevancyStrictness controls the relevancy threshold below which less relevant results aren't included in the results + * + * @return self + */ + public function setRelevancyStrictness($relevancyStrictness) + { + $this->container['relevancyStrictness'] = $relevancyStrictness; + + return $this; + } + + /** + * Gets attributesToHighlight + * + * @return string[]|null + */ + public function getAttributesToHighlight() + { + return $this->container['attributesToHighlight']; + } + + /** + * Sets attributesToHighlight + * + * @param string[]|null $attributesToHighlight list of attributes to highlight + * + * @return self + */ + public function setAttributesToHighlight($attributesToHighlight) + { + $this->container['attributesToHighlight'] = $attributesToHighlight; + + return $this; + } + + /** + * Gets attributesToSnippet + * + * @return string[]|null + */ + public function getAttributesToSnippet() + { + return $this->container['attributesToSnippet']; + } + + /** + * Sets attributesToSnippet + * + * @param string[]|null $attributesToSnippet list of attributes to snippet, with an optional maximum number of words to snippet + * + * @return self + */ + public function setAttributesToSnippet($attributesToSnippet) + { + $this->container['attributesToSnippet'] = $attributesToSnippet; + + return $this; + } + + /** + * Gets highlightPreTag + * + * @return string|null + */ + public function getHighlightPreTag() + { + return $this->container['highlightPreTag']; + } + + /** + * Sets highlightPreTag + * + * @param string|null $highlightPreTag the HTML string to insert before the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPreTag($highlightPreTag) + { + $this->container['highlightPreTag'] = $highlightPreTag; + + return $this; + } + + /** + * Gets highlightPostTag + * + * @return string|null + */ + public function getHighlightPostTag() + { + return $this->container['highlightPostTag']; + } + + /** + * Sets highlightPostTag + * + * @param string|null $highlightPostTag the HTML string to insert after the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPostTag($highlightPostTag) + { + $this->container['highlightPostTag'] = $highlightPostTag; + + return $this; + } + + /** + * Gets snippetEllipsisText + * + * @return string|null + */ + public function getSnippetEllipsisText() + { + return $this->container['snippetEllipsisText']; + } + + /** + * Sets snippetEllipsisText + * + * @param string|null $snippetEllipsisText string used as an ellipsis indicator when a snippet is truncated + * + * @return self + */ + public function setSnippetEllipsisText($snippetEllipsisText) + { + $this->container['snippetEllipsisText'] = $snippetEllipsisText; + + return $this; + } + + /** + * Gets restrictHighlightAndSnippetArrays + * + * @return bool|null + */ + public function getRestrictHighlightAndSnippetArrays() + { + return $this->container['restrictHighlightAndSnippetArrays']; + } + + /** + * Sets restrictHighlightAndSnippetArrays + * + * @param bool|null $restrictHighlightAndSnippetArrays restrict highlighting and snippeting to items that matched the query + * + * @return self + */ + public function setRestrictHighlightAndSnippetArrays($restrictHighlightAndSnippetArrays) + { + $this->container['restrictHighlightAndSnippetArrays'] = $restrictHighlightAndSnippetArrays; + + return $this; + } + + /** + * Gets hitsPerPage + * + * @return int|null + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int|null $hitsPerPage set the number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Gets minWordSizefor1Typo + * + * @return int|null + */ + public function getMinWordSizefor1Typo() + { + return $this->container['minWordSizefor1Typo']; + } + + /** + * Sets minWordSizefor1Typo + * + * @param int|null $minWordSizefor1Typo minimum number of characters a word in the query string must contain to accept matches with 1 typo + * + * @return self + */ + public function setMinWordSizefor1Typo($minWordSizefor1Typo) + { + $this->container['minWordSizefor1Typo'] = $minWordSizefor1Typo; + + return $this; + } + + /** + * Gets minWordSizefor2Typos + * + * @return int|null + */ + public function getMinWordSizefor2Typos() + { + return $this->container['minWordSizefor2Typos']; + } + + /** + * Sets minWordSizefor2Typos + * + * @param int|null $minWordSizefor2Typos minimum number of characters a word in the query string must contain to accept matches with 2 typos + * + * @return self + */ + public function setMinWordSizefor2Typos($minWordSizefor2Typos) + { + $this->container['minWordSizefor2Typos'] = $minWordSizefor2Typos; + + return $this; + } + + /** + * Gets typoTolerance + * + * @return string|null + */ + public function getTypoTolerance() + { + return $this->container['typoTolerance']; + } + + /** + * Sets typoTolerance + * + * @param string|null $typoTolerance controls whether typo tolerance is enabled and how it is applied + * + * @return self + */ + public function setTypoTolerance($typoTolerance) + { + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($typoTolerance) && !in_array($typoTolerance, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'typoTolerance', must be one of '%s'", + $typoTolerance, + implode("', '", $allowedValues) + ) + ); + } + $this->container['typoTolerance'] = $typoTolerance; + + return $this; + } + + /** + * Gets allowTyposOnNumericTokens + * + * @return bool|null + */ + public function getAllowTyposOnNumericTokens() + { + return $this->container['allowTyposOnNumericTokens']; + } + + /** + * Sets allowTyposOnNumericTokens + * + * @param bool|null $allowTyposOnNumericTokens whether to allow typos on numbers (\"numeric tokens\") in the query string + * + * @return self + */ + public function setAllowTyposOnNumericTokens($allowTyposOnNumericTokens) + { + $this->container['allowTyposOnNumericTokens'] = $allowTyposOnNumericTokens; + + return $this; + } + + /** + * Gets disableTypoToleranceOnAttributes + * + * @return string[]|null + */ + public function getDisableTypoToleranceOnAttributes() + { + return $this->container['disableTypoToleranceOnAttributes']; + } + + /** + * Sets disableTypoToleranceOnAttributes + * + * @param string[]|null $disableTypoToleranceOnAttributes list of attributes on which you want to disable typo tolerance + * + * @return self + */ + public function setDisableTypoToleranceOnAttributes($disableTypoToleranceOnAttributes) + { + $this->container['disableTypoToleranceOnAttributes'] = $disableTypoToleranceOnAttributes; + + return $this; + } + + /** + * Gets separatorsToIndex + * + * @return string|null + */ + public function getSeparatorsToIndex() + { + return $this->container['separatorsToIndex']; + } + + /** + * Sets separatorsToIndex + * + * @param string|null $separatorsToIndex control which separators are indexed + * + * @return self + */ + public function setSeparatorsToIndex($separatorsToIndex) + { + $this->container['separatorsToIndex'] = $separatorsToIndex; + + return $this; + } + + /** + * Gets ignorePlurals + * + * @return string|null + */ + public function getIgnorePlurals() + { + return $this->container['ignorePlurals']; + } + + /** + * Sets ignorePlurals + * + * @param string|null $ignorePlurals treats singular, plurals, and other forms of declensions as matching terms + * + * @return self + */ + public function setIgnorePlurals($ignorePlurals) + { + $this->container['ignorePlurals'] = $ignorePlurals; + + return $this; + } + + /** + * Gets removeStopWords + * + * @return string|null + */ + public function getRemoveStopWords() + { + return $this->container['removeStopWords']; + } + + /** + * Sets removeStopWords + * + * @param string|null $removeStopWords removes stop (common) words from the query before executing it + * + * @return self + */ + public function setRemoveStopWords($removeStopWords) + { + $this->container['removeStopWords'] = $removeStopWords; + + return $this; + } + + /** + * Gets keepDiacriticsOnCharacters + * + * @return string|null + */ + public function getKeepDiacriticsOnCharacters() + { + return $this->container['keepDiacriticsOnCharacters']; + } + + /** + * Sets keepDiacriticsOnCharacters + * + * @param string|null $keepDiacriticsOnCharacters list of characters that the engine shouldn't automatically normalize + * + * @return self + */ + public function setKeepDiacriticsOnCharacters($keepDiacriticsOnCharacters) + { + $this->container['keepDiacriticsOnCharacters'] = $keepDiacriticsOnCharacters; + + return $this; + } + + /** + * Gets queryLanguages + * + * @return string[]|null + */ + public function getQueryLanguages() + { + return $this->container['queryLanguages']; + } + + /** + * Sets queryLanguages + * + * @param string[]|null $queryLanguages sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection + * + * @return self + */ + public function setQueryLanguages($queryLanguages) + { + $this->container['queryLanguages'] = $queryLanguages; + + return $this; + } + + /** + * Gets decompoundQuery + * + * @return bool|null + */ + public function getDecompoundQuery() + { + return $this->container['decompoundQuery']; + } + + /** + * Sets decompoundQuery + * + * @param bool|null $decompoundQuery splits compound words into their composing atoms in the query + * + * @return self + */ + public function setDecompoundQuery($decompoundQuery) + { + $this->container['decompoundQuery'] = $decompoundQuery; + + return $this; + } + + /** + * Gets enableRules + * + * @return bool|null + */ + public function getEnableRules() + { + return $this->container['enableRules']; + } + + /** + * Sets enableRules + * + * @param bool|null $enableRules whether Rules should be globally enabled + * + * @return self + */ + public function setEnableRules($enableRules) + { + $this->container['enableRules'] = $enableRules; + + return $this; + } + + /** + * Gets enablePersonalization + * + * @return bool|null + */ + public function getEnablePersonalization() + { + return $this->container['enablePersonalization']; + } + + /** + * Sets enablePersonalization + * + * @param bool|null $enablePersonalization enable the Personalization feature + * + * @return self + */ + public function setEnablePersonalization($enablePersonalization) + { + $this->container['enablePersonalization'] = $enablePersonalization; + + return $this; + } + + /** + * Gets queryType + * + * @return string|null + */ + public function getQueryType() + { + return $this->container['queryType']; + } + + /** + * Sets queryType + * + * @param string|null $queryType controls if and how query words are interpreted as prefixes + * + * @return self + */ + public function setQueryType($queryType) + { + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($queryType) && !in_array($queryType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'queryType', must be one of '%s'", + $queryType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['queryType'] = $queryType; + + return $this; + } + + /** + * Gets removeWordsIfNoResults + * + * @return string|null + */ + public function getRemoveWordsIfNoResults() + { + return $this->container['removeWordsIfNoResults']; + } + + /** + * Sets removeWordsIfNoResults + * + * @param string|null $removeWordsIfNoResults selects a strategy to remove words from the query when it doesn't match any hits + * + * @return self + */ + public function setRemoveWordsIfNoResults($removeWordsIfNoResults) + { + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($removeWordsIfNoResults) && !in_array($removeWordsIfNoResults, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $removeWordsIfNoResults, + implode("', '", $allowedValues) + ) + ); + } + $this->container['removeWordsIfNoResults'] = $removeWordsIfNoResults; + + return $this; + } + + /** + * Gets advancedSyntax + * + * @return bool|null + */ + public function getAdvancedSyntax() + { + return $this->container['advancedSyntax']; + } + + /** + * Sets advancedSyntax + * + * @param bool|null $advancedSyntax enables the advanced query syntax + * + * @return self + */ + public function setAdvancedSyntax($advancedSyntax) + { + $this->container['advancedSyntax'] = $advancedSyntax; + + return $this; + } + + /** + * Gets optionalWords + * + * @return string[]|null + */ + public function getOptionalWords() + { + return $this->container['optionalWords']; + } + + /** + * Sets optionalWords + * + * @param string[]|null $optionalWords a list of words that should be considered as optional when found in the query + * + * @return self + */ + public function setOptionalWords($optionalWords) + { + $this->container['optionalWords'] = $optionalWords; + + return $this; + } + + /** + * Gets disableExactOnAttributes + * + * @return string[]|null + */ + public function getDisableExactOnAttributes() + { + return $this->container['disableExactOnAttributes']; + } + + /** + * Sets disableExactOnAttributes + * + * @param string[]|null $disableExactOnAttributes list of attributes on which you want to disable the exact ranking criterion + * + * @return self + */ + public function setDisableExactOnAttributes($disableExactOnAttributes) + { + $this->container['disableExactOnAttributes'] = $disableExactOnAttributes; + + return $this; + } + + /** + * Gets exactOnSingleWordQuery + * + * @return string|null + */ + public function getExactOnSingleWordQuery() + { + return $this->container['exactOnSingleWordQuery']; + } + + /** + * Sets exactOnSingleWordQuery + * + * @param string|null $exactOnSingleWordQuery controls how the exact ranking criterion is computed when the query contains only one word + * + * @return self + */ + public function setExactOnSingleWordQuery($exactOnSingleWordQuery) + { + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($exactOnSingleWordQuery) && !in_array($exactOnSingleWordQuery, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $exactOnSingleWordQuery, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exactOnSingleWordQuery'] = $exactOnSingleWordQuery; + + return $this; + } + + /** + * Gets alternativesAsExact + * + * @return string[]|null + */ + public function getAlternativesAsExact() + { + return $this->container['alternativesAsExact']; + } + + /** + * Sets alternativesAsExact + * + * @param string[]|null $alternativesAsExact list of alternatives that should be considered an exact match by the exact ranking criterion + * + * @return self + */ + public function setAlternativesAsExact($alternativesAsExact) + { + $allowedValues = $this->getAlternativesAsExactAllowableValues(); + if (!is_null($alternativesAsExact) && array_diff($alternativesAsExact, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternativesAsExact', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternativesAsExact'] = $alternativesAsExact; + + return $this; + } + + /** + * Gets advancedSyntaxFeatures + * + * @return string[]|null + */ + public function getAdvancedSyntaxFeatures() + { + return $this->container['advancedSyntaxFeatures']; + } + + /** + * Sets advancedSyntaxFeatures + * + * @param string[]|null $advancedSyntaxFeatures allows you to specify which advanced syntax features are active when ‘advancedSyntax' is enabled + * + * @return self + */ + public function setAdvancedSyntaxFeatures($advancedSyntaxFeatures) + { + $allowedValues = $this->getAdvancedSyntaxFeaturesAllowableValues(); + if (!is_null($advancedSyntaxFeatures) && array_diff($advancedSyntaxFeatures, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'advancedSyntaxFeatures', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['advancedSyntaxFeatures'] = $advancedSyntaxFeatures; + + return $this; + } + + /** + * Gets distinct + * + * @return int|null + */ + public function getDistinct() + { + return $this->container['distinct']; + } + + /** + * Sets distinct + * + * @param int|null $distinct enables de-duplication or grouping of results + * + * @return self + */ + public function setDistinct($distinct) + { + if (!is_null($distinct) && ($distinct > 4)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling IndexSettingsAsSearchParams., must be smaller than or equal to 4.'); + } + if (!is_null($distinct) && ($distinct < 0)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling IndexSettingsAsSearchParams., must be bigger than or equal to 0.'); + } + + $this->container['distinct'] = $distinct; + + return $this; + } + + /** + * Gets synonyms + * + * @return bool|null + */ + public function getSynonyms() + { + return $this->container['synonyms']; + } + + /** + * Sets synonyms + * + * @param bool|null $synonyms whether to take into account an index's synonyms for a particular search + * + * @return self + */ + public function setSynonyms($synonyms) + { + $this->container['synonyms'] = $synonyms; + + return $this; + } + + /** + * Gets replaceSynonymsInHighlight + * + * @return bool|null + */ + public function getReplaceSynonymsInHighlight() + { + return $this->container['replaceSynonymsInHighlight']; + } + + /** + * Sets replaceSynonymsInHighlight + * + * @param bool|null $replaceSynonymsInHighlight whether to highlight and snippet the original word that matches the synonym or the synonym itself + * + * @return self + */ + public function setReplaceSynonymsInHighlight($replaceSynonymsInHighlight) + { + $this->container['replaceSynonymsInHighlight'] = $replaceSynonymsInHighlight; + + return $this; + } + + /** + * Gets minProximity + * + * @return int|null + */ + public function getMinProximity() + { + return $this->container['minProximity']; + } + + /** + * Sets minProximity + * + * @param int|null $minProximity precision of the proximity ranking criterion + * + * @return self + */ + public function setMinProximity($minProximity) + { + if (!is_null($minProximity) && ($minProximity > 7)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling IndexSettingsAsSearchParams., must be smaller than or equal to 7.'); + } + if (!is_null($minProximity) && ($minProximity < 1)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling IndexSettingsAsSearchParams., must be bigger than or equal to 1.'); + } + + $this->container['minProximity'] = $minProximity; + + return $this; + } + + /** + * Gets responseFields + * + * @return string[]|null + */ + public function getResponseFields() + { + return $this->container['responseFields']; + } + + /** + * Sets responseFields + * + * @param string[]|null $responseFields Choose which fields to return in the API response. This parameters applies to search and browse queries. + * + * @return self + */ + public function setResponseFields($responseFields) + { + $this->container['responseFields'] = $responseFields; + + return $this; + } + + /** + * Gets maxFacetHits + * + * @return int|null + */ + public function getMaxFacetHits() + { + return $this->container['maxFacetHits']; + } + + /** + * Sets maxFacetHits + * + * @param int|null $maxFacetHits Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. + * + * @return self + */ + public function setMaxFacetHits($maxFacetHits) + { + if (!is_null($maxFacetHits) && ($maxFacetHits > 100)) { + throw new \InvalidArgumentException('invalid value for $maxFacetHits when calling IndexSettingsAsSearchParams., must be smaller than or equal to 100.'); + } + + $this->container['maxFacetHits'] = $maxFacetHits; + + return $this; + } + + /** + * Gets attributeCriteriaComputedByMinProximity + * + * @return bool|null + */ + public function getAttributeCriteriaComputedByMinProximity() + { + return $this->container['attributeCriteriaComputedByMinProximity']; + } + + /** + * Sets attributeCriteriaComputedByMinProximity + * + * @param bool|null $attributeCriteriaComputedByMinProximity when attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage + * + * @return self + */ + public function setAttributeCriteriaComputedByMinProximity($attributeCriteriaComputedByMinProximity) + { + $this->container['attributeCriteriaComputedByMinProximity'] = $attributeCriteriaComputedByMinProximity; + + return $this; + } + + /** + * Gets renderingContent + * + * @return object|null + */ + public function getRenderingContent() + { + return $this->container['renderingContent']; + } + + /** + * Sets renderingContent + * + * @param object|null $renderingContent Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * + * @return self + */ + public function setRenderingContent($renderingContent) + { + $this->container['renderingContent'] = $renderingContent; + + 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/Search/Indice.php b/clients/algoliasearch-client-php/lib/Model/Search/Indice.php new file mode 100644 index 0000000000..1f7cdd043d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Indice.php @@ -0,0 +1,615 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Indice implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'indice'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'name' => 'string', + 'createdAt' => 'string', + 'updatedAt' => 'string', + 'entries' => 'int', + 'dataSize' => 'int', + 'fileSize' => 'int', + 'lastBuildTimeS' => 'int', + 'numberOfPendingTask' => 'int', + 'pendingTask' => 'bool', + 'primary' => 'string', + 'replicas' => 'string[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'name' => null, + 'createdAt' => null, + 'updatedAt' => null, + 'entries' => null, + 'dataSize' => null, + 'fileSize' => null, + 'lastBuildTimeS' => null, + 'numberOfPendingTask' => null, + 'pendingTask' => null, + 'primary' => null, + 'replicas' => 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', + 'createdAt' => 'createdAt', + 'updatedAt' => 'updatedAt', + 'entries' => 'entries', + 'dataSize' => 'dataSize', + 'fileSize' => 'fileSize', + 'lastBuildTimeS' => 'lastBuildTimeS', + 'numberOfPendingTask' => 'numberOfPendingTask', + 'pendingTask' => 'pendingTask', + 'primary' => 'primary', + 'replicas' => 'replicas', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'name' => 'setName', + 'createdAt' => 'setCreatedAt', + 'updatedAt' => 'setUpdatedAt', + 'entries' => 'setEntries', + 'dataSize' => 'setDataSize', + 'fileSize' => 'setFileSize', + 'lastBuildTimeS' => 'setLastBuildTimeS', + 'numberOfPendingTask' => 'setNumberOfPendingTask', + 'pendingTask' => 'setPendingTask', + 'primary' => 'setPrimary', + 'replicas' => 'setReplicas', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'name' => 'getName', + 'createdAt' => 'getCreatedAt', + 'updatedAt' => 'getUpdatedAt', + 'entries' => 'getEntries', + 'dataSize' => 'getDataSize', + 'fileSize' => 'getFileSize', + 'lastBuildTimeS' => 'getLastBuildTimeS', + 'numberOfPendingTask' => 'getNumberOfPendingTask', + 'pendingTask' => 'getPendingTask', + 'primary' => 'getPrimary', + 'replicas' => 'getReplicas', + ]; + + /** + * 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['createdAt'] = $data['createdAt'] ?? null; + $this->container['updatedAt'] = $data['updatedAt'] ?? null; + $this->container['entries'] = $data['entries'] ?? null; + $this->container['dataSize'] = $data['dataSize'] ?? null; + $this->container['fileSize'] = $data['fileSize'] ?? null; + $this->container['lastBuildTimeS'] = $data['lastBuildTimeS'] ?? null; + $this->container['numberOfPendingTask'] = $data['numberOfPendingTask'] ?? null; + $this->container['pendingTask'] = $data['pendingTask'] ?? null; + $this->container['primary'] = $data['primary'] ?? null; + $this->container['replicas'] = $data['replicas'] ?? 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['createdAt'] === null) { + $invalidProperties[] = "'createdAt' can't be null"; + } + if ($this->container['updatedAt'] === null) { + $invalidProperties[] = "'updatedAt' can't be null"; + } + if ($this->container['entries'] === null) { + $invalidProperties[] = "'entries' can't be null"; + } + if ($this->container['dataSize'] === null) { + $invalidProperties[] = "'dataSize' can't be null"; + } + if ($this->container['fileSize'] === null) { + $invalidProperties[] = "'fileSize' can't be null"; + } + if ($this->container['lastBuildTimeS'] === null) { + $invalidProperties[] = "'lastBuildTimeS' can't be null"; + } + if ($this->container['pendingTask'] === null) { + $invalidProperties[] = "'pendingTask' 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 index name + * + * @return self + */ + public function setName($name) + { + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets createdAt + * + * @return string + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string $createdAt Index creation date. An empty string means that the index has no records. + * + * @return self + */ + public function setCreatedAt($createdAt) + { + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * 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; + } + + /** + * Gets entries + * + * @return int + */ + public function getEntries() + { + return $this->container['entries']; + } + + /** + * Sets entries + * + * @param int $entries number of records contained in the index + * + * @return self + */ + public function setEntries($entries) + { + $this->container['entries'] = $entries; + + return $this; + } + + /** + * Gets dataSize + * + * @return int + */ + public function getDataSize() + { + return $this->container['dataSize']; + } + + /** + * Sets dataSize + * + * @param int $dataSize number of bytes of the index in minified format + * + * @return self + */ + public function setDataSize($dataSize) + { + $this->container['dataSize'] = $dataSize; + + return $this; + } + + /** + * Gets fileSize + * + * @return int + */ + public function getFileSize() + { + return $this->container['fileSize']; + } + + /** + * Sets fileSize + * + * @param int $fileSize number of bytes of the index binary file + * + * @return self + */ + public function setFileSize($fileSize) + { + $this->container['fileSize'] = $fileSize; + + return $this; + } + + /** + * Gets lastBuildTimeS + * + * @return int + */ + public function getLastBuildTimeS() + { + return $this->container['lastBuildTimeS']; + } + + /** + * Sets lastBuildTimeS + * + * @param int $lastBuildTimeS Last build time + * + * @return self + */ + public function setLastBuildTimeS($lastBuildTimeS) + { + $this->container['lastBuildTimeS'] = $lastBuildTimeS; + + return $this; + } + + /** + * Gets numberOfPendingTask + * + * @return int|null + */ + public function getNumberOfPendingTask() + { + return $this->container['numberOfPendingTask']; + } + + /** + * Sets numberOfPendingTask + * + * @param int|null $numberOfPendingTask Number of pending indexing operations. This value is deprecated and should not be used. + * + * @return self + */ + public function setNumberOfPendingTask($numberOfPendingTask) + { + $this->container['numberOfPendingTask'] = $numberOfPendingTask; + + return $this; + } + + /** + * Gets pendingTask + * + * @return bool + */ + public function getPendingTask() + { + return $this->container['pendingTask']; + } + + /** + * Sets pendingTask + * + * @param bool $pendingTask A boolean which says whether the index has pending tasks. This value is deprecated and should not be used. + * + * @return self + */ + public function setPendingTask($pendingTask) + { + $this->container['pendingTask'] = $pendingTask; + + return $this; + } + + /** + * Gets primary + * + * @return string|null + */ + public function getPrimary() + { + return $this->container['primary']; + } + + /** + * Sets primary + * + * @param string|null $primary Only present if the index is a replica. Contains the name of the related primary index. + * + * @return self + */ + public function setPrimary($primary) + { + $this->container['primary'] = $primary; + + return $this; + } + + /** + * Gets replicas + * + * @return string[]|null + */ + public function getReplicas() + { + return $this->container['replicas']; + } + + /** + * Sets replicas + * + * @param string[]|null $replicas Only present if the index is a primary index with replicas. Contains the names of all linked replicas. + * + * @return self + */ + public function setReplicas($replicas) + { + $this->container['replicas'] = $replicas; + + 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/Search/Key.php b/clients/algoliasearch-client-php/lib/Model/Search/Key.php new file mode 100644 index 0000000000..96f100409e --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Key.php @@ -0,0 +1,586 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Key implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'key'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'acl' => 'string[]', + 'description' => 'string', + 'indexes' => 'string[]', + 'maxHitsPerQuery' => 'int', + 'maxQueriesPerIPPerHour' => 'int', + 'queryParameters' => 'string', + 'referers' => 'string[]', + 'validity' => 'int', + 'createdAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'acl' => null, + 'description' => null, + 'indexes' => null, + 'maxHitsPerQuery' => null, + 'maxQueriesPerIPPerHour' => null, + 'queryParameters' => null, + 'referers' => null, + 'validity' => null, + 'createdAt' => 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 = [ + 'acl' => 'acl', + 'description' => 'description', + 'indexes' => 'indexes', + 'maxHitsPerQuery' => 'maxHitsPerQuery', + 'maxQueriesPerIPPerHour' => 'maxQueriesPerIPPerHour', + 'queryParameters' => 'queryParameters', + 'referers' => 'referers', + 'validity' => 'validity', + 'createdAt' => 'createdAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'acl' => 'setAcl', + 'description' => 'setDescription', + 'indexes' => 'setIndexes', + 'maxHitsPerQuery' => 'setMaxHitsPerQuery', + 'maxQueriesPerIPPerHour' => 'setMaxQueriesPerIPPerHour', + 'queryParameters' => 'setQueryParameters', + 'referers' => 'setReferers', + 'validity' => 'setValidity', + 'createdAt' => 'setCreatedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'acl' => 'getAcl', + 'description' => 'getDescription', + 'indexes' => 'getIndexes', + 'maxHitsPerQuery' => 'getMaxHitsPerQuery', + 'maxQueriesPerIPPerHour' => 'getMaxQueriesPerIPPerHour', + 'queryParameters' => 'getQueryParameters', + 'referers' => 'getReferers', + 'validity' => 'getValidity', + 'createdAt' => 'getCreatedAt', + ]; + + /** + * 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 ACL_ADD_OBJECT = 'addObject'; + const ACL_ANALYTICS = 'analytics'; + const ACL_BROWSE = 'browse'; + const ACL_DELETE_OBJECT = 'deleteObject'; + const ACL_DELETE_INDEX = 'deleteIndex'; + const ACL_EDIT_SETTINGS = 'editSettings'; + const ACL_LIST_INDEXES = 'listIndexes'; + const ACL_LOGS = 'logs'; + const ACL_PERSONALIZATION = 'personalization'; + const ACL_RECOMMENDATION = 'recommendation'; + const ACL_SEARCH = 'search'; + const ACL_SEE_UNRETRIEVABLE_ATTRIBUTES = 'seeUnretrievableAttributes'; + const ACL_SETTINGS = 'settings'; + const ACL_USAGE = 'usage'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAclAllowableValues() + { + return [ + self::ACL_ADD_OBJECT, + self::ACL_ANALYTICS, + self::ACL_BROWSE, + self::ACL_DELETE_OBJECT, + self::ACL_DELETE_INDEX, + self::ACL_EDIT_SETTINGS, + self::ACL_LIST_INDEXES, + self::ACL_LOGS, + self::ACL_PERSONALIZATION, + self::ACL_RECOMMENDATION, + self::ACL_SEARCH, + self::ACL_SEE_UNRETRIEVABLE_ATTRIBUTES, + self::ACL_SETTINGS, + self::ACL_USAGE, + ]; + } + + /** + * 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['acl'] = $data['acl'] ?? null; + $this->container['description'] = $data['description'] ?? ''; + $this->container['indexes'] = $data['indexes'] ?? null; + $this->container['maxHitsPerQuery'] = $data['maxHitsPerQuery'] ?? 0; + $this->container['maxQueriesPerIPPerHour'] = $data['maxQueriesPerIPPerHour'] ?? 0; + $this->container['queryParameters'] = $data['queryParameters'] ?? ''; + $this->container['referers'] = $data['referers'] ?? null; + $this->container['validity'] = $data['validity'] ?? 0; + $this->container['createdAt'] = $data['createdAt'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['acl'] === null) { + $invalidProperties[] = "'acl' can't be null"; + } + if ($this->container['createdAt'] === null) { + $invalidProperties[] = "'createdAt' 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 acl + * + * @return string[] + */ + public function getAcl() + { + return $this->container['acl']; + } + + /** + * Sets acl + * + * @param string[] $acl set of permissions associated with the key + * + * @return self + */ + public function setAcl($acl) + { + $allowedValues = $this->getAclAllowableValues(); + if (array_diff($acl, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'acl', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['acl'] = $acl; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description A comment used to identify a key more easily in the dashboard. It is not interpreted by the API. + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets indexes + * + * @return string[]|null + */ + public function getIndexes() + { + return $this->container['indexes']; + } + + /** + * Sets indexes + * + * @param string[]|null $indexes Restrict this new API key to a list of indices or index patterns. If the list is empty, all indices are allowed. + * + * @return self + */ + public function setIndexes($indexes) + { + $this->container['indexes'] = $indexes; + + return $this; + } + + /** + * Gets maxHitsPerQuery + * + * @return int|null + */ + public function getMaxHitsPerQuery() + { + return $this->container['maxHitsPerQuery']; + } + + /** + * Sets maxHitsPerQuery + * + * @param int|null $maxHitsPerQuery Maximum number of hits this API key can retrieve in one query. If zero, no limit is enforced. + * + * @return self + */ + public function setMaxHitsPerQuery($maxHitsPerQuery) + { + $this->container['maxHitsPerQuery'] = $maxHitsPerQuery; + + return $this; + } + + /** + * Gets maxQueriesPerIPPerHour + * + * @return int|null + */ + public function getMaxQueriesPerIPPerHour() + { + return $this->container['maxQueriesPerIPPerHour']; + } + + /** + * Sets maxQueriesPerIPPerHour + * + * @param int|null $maxQueriesPerIPPerHour maximum number of API calls per hour allowed from a given IP address or a user token + * + * @return self + */ + public function setMaxQueriesPerIPPerHour($maxQueriesPerIPPerHour) + { + $this->container['maxQueriesPerIPPerHour'] = $maxQueriesPerIPPerHour; + + return $this; + } + + /** + * Gets queryParameters + * + * @return string|null + */ + public function getQueryParameters() + { + return $this->container['queryParameters']; + } + + /** + * Sets queryParameters + * + * @param string|null $queryParameters URL-encoded query string. Force some query parameters to be applied for each query made with this API key. + * + * @return self + */ + public function setQueryParameters($queryParameters) + { + $this->container['queryParameters'] = $queryParameters; + + return $this; + } + + /** + * Gets referers + * + * @return string[]|null + */ + public function getReferers() + { + return $this->container['referers']; + } + + /** + * Sets referers + * + * @param string[]|null $referers Restrict this new API key to specific referers. If empty or blank, defaults to all referers. + * + * @return self + */ + public function setReferers($referers) + { + $this->container['referers'] = $referers; + + return $this; + } + + /** + * Gets validity + * + * @return int|null + */ + public function getValidity() + { + return $this->container['validity']; + } + + /** + * Sets validity + * + * @param int|null $validity Validity limit for this key in seconds. The key will automatically be removed after this period of time. + * + * @return self + */ + public function setValidity($validity) + { + $this->container['validity'] = $validity; + + return $this; + } + + /** + * Gets createdAt + * + * @return string + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string $createdAt date of creation (ISO-8601 format) + * + * @return self + */ + public function setCreatedAt($createdAt) + { + $this->container['createdAt'] = $createdAt; + + 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/Search/Languages.php b/clients/algoliasearch-client-php/lib/Model/Search/Languages.php new file mode 100644 index 0000000000..fbb5302a74 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Languages.php @@ -0,0 +1,362 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Languages implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'languages'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'plurals' => '\Algolia\AlgoliaSearch\Model\Search\DictionaryLanguage', + 'stopwords' => '\Algolia\AlgoliaSearch\Model\Search\DictionaryLanguage', + 'compounds' => '\Algolia\AlgoliaSearch\Model\Search\DictionaryLanguage', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'plurals' => null, + 'stopwords' => null, + 'compounds' => 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 = [ + 'plurals' => 'plurals', + 'stopwords' => 'stopwords', + 'compounds' => 'compounds', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'plurals' => 'setPlurals', + 'stopwords' => 'setStopwords', + 'compounds' => 'setCompounds', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'plurals' => 'getPlurals', + 'stopwords' => 'getStopwords', + 'compounds' => 'getCompounds', + ]; + + /** + * 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['plurals'] = $data['plurals'] ?? null; + $this->container['stopwords'] = $data['stopwords'] ?? null; + $this->container['compounds'] = $data['compounds'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['plurals'] === null) { + $invalidProperties[] = "'plurals' can't be null"; + } + if ($this->container['stopwords'] === null) { + $invalidProperties[] = "'stopwords' can't be null"; + } + if ($this->container['compounds'] === null) { + $invalidProperties[] = "'compounds' 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 plurals + * + * @return \Algolia\AlgoliaSearch\Model\Search\DictionaryLanguage + */ + public function getPlurals() + { + return $this->container['plurals']; + } + + /** + * Sets plurals + * + * @param \Algolia\AlgoliaSearch\Model\Search\DictionaryLanguage $plurals plurals + * + * @return self + */ + public function setPlurals($plurals) + { + $this->container['plurals'] = $plurals; + + return $this; + } + + /** + * Gets stopwords + * + * @return \Algolia\AlgoliaSearch\Model\Search\DictionaryLanguage + */ + public function getStopwords() + { + return $this->container['stopwords']; + } + + /** + * Sets stopwords + * + * @param \Algolia\AlgoliaSearch\Model\Search\DictionaryLanguage $stopwords stopwords + * + * @return self + */ + public function setStopwords($stopwords) + { + $this->container['stopwords'] = $stopwords; + + return $this; + } + + /** + * Gets compounds + * + * @return \Algolia\AlgoliaSearch\Model\Search\DictionaryLanguage + */ + public function getCompounds() + { + return $this->container['compounds']; + } + + /** + * Sets compounds + * + * @param \Algolia\AlgoliaSearch\Model\Search\DictionaryLanguage $compounds compounds + * + * @return self + */ + public function setCompounds($compounds) + { + $this->container['compounds'] = $compounds; + + 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/Search/ListApiKeysResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/ListApiKeysResponse.php new file mode 100644 index 0000000000..100201f47a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/ListApiKeysResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ListApiKeysResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'listApiKeysResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'keys' => '\Algolia\AlgoliaSearch\Model\Search\Key[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'keys' => 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 = [ + 'keys' => 'keys', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'keys' => 'setKeys', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'keys' => 'getKeys', + ]; + + /** + * 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['keys'] = $data['keys'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['keys'] === null) { + $invalidProperties[] = "'keys' 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 keys + * + * @return \Algolia\AlgoliaSearch\Model\Search\Key[] + */ + public function getKeys() + { + return $this->container['keys']; + } + + /** + * Sets keys + * + * @param \Algolia\AlgoliaSearch\Model\Search\Key[] $keys list of api keys + * + * @return self + */ + public function setKeys($keys) + { + $this->container['keys'] = $keys; + + 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/Search/ListClustersResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/ListClustersResponse.php new file mode 100644 index 0000000000..c69fd9395d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/ListClustersResponse.php @@ -0,0 +1,296 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ListClustersResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'listClustersResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'topUsers' => 'string[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'topUsers' => 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 = [ + 'topUsers' => 'topUsers', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'topUsers' => 'setTopUsers', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'topUsers' => 'getTopUsers', + ]; + + /** + * 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['topUsers'] = $data['topUsers'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['topUsers'] === null) { + $invalidProperties[] = "'topUsers' 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 topUsers + * + * @return string[] + */ + public function getTopUsers() + { + return $this->container['topUsers']; + } + + /** + * Sets topUsers + * + * @param string[] $topUsers mapping of cluster names to top users + * + * @return self + */ + public function setTopUsers($topUsers) + { + $this->container['topUsers'] = $topUsers; + + 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/Search/ListIndicesResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/ListIndicesResponse.php new file mode 100644 index 0000000000..285646c91b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/ListIndicesResponse.php @@ -0,0 +1,320 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ListIndicesResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'listIndicesResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'items' => '\Algolia\AlgoliaSearch\Model\Search\Indice[]', + 'nbPages' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'items' => null, + 'nbPages' => 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 = [ + 'items' => 'items', + 'nbPages' => 'nbPages', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'items' => 'setItems', + 'nbPages' => 'setNbPages', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'items' => 'getItems', + 'nbPages' => 'getNbPages', + ]; + + /** + * 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['items'] = $data['items'] ?? null; + $this->container['nbPages'] = $data['nbPages'] ?? 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 items + * + * @return \Algolia\AlgoliaSearch\Model\Search\Indice[]|null + */ + public function getItems() + { + return $this->container['items']; + } + + /** + * Sets items + * + * @param \Algolia\AlgoliaSearch\Model\Search\Indice[]|null $items list of the fetched indices + * + * @return self + */ + public function setItems($items) + { + $this->container['items'] = $items; + + return $this; + } + + /** + * Gets nbPages + * + * @return int|null + */ + public function getNbPages() + { + return $this->container['nbPages']; + } + + /** + * Sets nbPages + * + * @param int|null $nbPages number of pages + * + * @return self + */ + public function setNbPages($nbPages) + { + $this->container['nbPages'] = $nbPages; + + 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/Search/ListUserIdsResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/ListUserIdsResponse.php new file mode 100644 index 0000000000..99f3ce5d7f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/ListUserIdsResponse.php @@ -0,0 +1,296 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ListUserIdsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'listUserIdsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'userIDs' => '\Algolia\AlgoliaSearch\Model\Search\UserId[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'userIDs' => 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 = [ + 'userIDs' => 'userIDs', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'userIDs' => 'setUserIDs', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'userIDs' => 'getUserIDs', + ]; + + /** + * 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['userIDs'] = $data['userIDs'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['userIDs'] === null) { + $invalidProperties[] = "'userIDs' 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 userIDs + * + * @return \Algolia\AlgoliaSearch\Model\Search\UserId[] + */ + public function getUserIDs() + { + return $this->container['userIDs']; + } + + /** + * Sets userIDs + * + * @param \Algolia\AlgoliaSearch\Model\Search\UserId[] $userIDs list of userIDs + * + * @return self + */ + public function setUserIDs($userIDs) + { + $this->container['userIDs'] = $userIDs; + + 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/Search/ModelInterface.php b/clients/algoliasearch-client-php/lib/Model/Search/ModelInterface.php new file mode 100644 index 0000000000..f4f70407c4 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/ModelInterface.php @@ -0,0 +1,68 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class MultipleBatchResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'multipleBatchResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'taskID' => 'object', + 'objectIDs' => 'string[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'taskID' => null, + 'objectIDs' => 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 = [ + 'taskID' => 'taskID', + 'objectIDs' => 'objectIDs', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'taskID' => 'setTaskID', + 'objectIDs' => 'setObjectIDs', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'taskID' => 'getTaskID', + 'objectIDs' => 'getObjectIDs', + ]; + + /** + * 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['taskID'] = $data['taskID'] ?? null; + $this->container['objectIDs'] = $data['objectIDs'] ?? 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 taskID + * + * @return object|null + */ + public function getTaskID() + { + return $this->container['taskID']; + } + + /** + * Sets taskID + * + * @param object|null $taskID list of tasksIDs per index + * + * @return self + */ + public function setTaskID($taskID) + { + $this->container['taskID'] = $taskID; + + return $this; + } + + /** + * Gets objectIDs + * + * @return string[]|null + */ + public function getObjectIDs() + { + return $this->container['objectIDs']; + } + + /** + * Sets objectIDs + * + * @param string[]|null $objectIDs list of objectID + * + * @return self + */ + public function setObjectIDs($objectIDs) + { + $this->container['objectIDs'] = $objectIDs; + + 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/Search/MultipleGetObjectsParams.php b/clients/algoliasearch-client-php/lib/Model/Search/MultipleGetObjectsParams.php new file mode 100644 index 0000000000..597210bf14 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/MultipleGetObjectsParams.php @@ -0,0 +1,359 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class MultipleGetObjectsParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'multipleGetObjectsParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'attributesToRetrieve' => 'string[]', + 'objectID' => 'string', + 'indexName' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'attributesToRetrieve' => null, + 'objectID' => 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 = [ + 'attributesToRetrieve' => 'attributesToRetrieve', + 'objectID' => 'objectID', + 'indexName' => 'indexName', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'attributesToRetrieve' => 'setAttributesToRetrieve', + 'objectID' => 'setObjectID', + 'indexName' => 'setIndexName', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'attributesToRetrieve' => 'getAttributesToRetrieve', + 'objectID' => 'getObjectID', + '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['attributesToRetrieve'] = $data['attributesToRetrieve'] ?? null; + $this->container['objectID'] = $data['objectID'] ?? 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['objectID'] === null) { + $invalidProperties[] = "'objectID' 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 attributesToRetrieve + * + * @return string[]|null + */ + public function getAttributesToRetrieve() + { + return $this->container['attributesToRetrieve']; + } + + /** + * Sets attributesToRetrieve + * + * @param string[]|null $attributesToRetrieve List of attributes to retrieve. By default, all retrievable attributes are returned. + * + * @return self + */ + public function setAttributesToRetrieve($attributesToRetrieve) + { + $this->container['attributesToRetrieve'] = $attributesToRetrieve; + + return $this; + } + + /** + * Gets objectID + * + * @return string + */ + public function getObjectID() + { + return $this->container['objectID']; + } + + /** + * Sets objectID + * + * @param string $objectID ID of the object within that index + * + * @return self + */ + public function setObjectID($objectID) + { + $this->container['objectID'] = $objectID; + + return $this; + } + + /** + * Gets indexName + * + * @return string + */ + public function getIndexName() + { + return $this->container['indexName']; + } + + /** + * Sets indexName + * + * @param string $indexName name of the index containing the object + * + * @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/Search/MultipleQueries.php b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueries.php new file mode 100644 index 0000000000..c0e39c126f --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueries.php @@ -0,0 +1,414 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class MultipleQueries implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'multipleQueries'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'indexName' => 'string', + 'query' => 'string', + 'type' => '\Algolia\AlgoliaSearch\Model\Search\MultipleQueriesType', + 'facet' => 'string', + 'params' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'indexName' => null, + 'query' => null, + 'type' => null, + 'facet' => null, + 'params' => 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', + 'query' => 'query', + 'type' => 'type', + 'facet' => 'facet', + 'params' => 'params', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'indexName' => 'setIndexName', + 'query' => 'setQuery', + 'type' => 'setType', + 'facet' => 'setFacet', + 'params' => 'setParams', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'indexName' => 'getIndexName', + 'query' => 'getQuery', + 'type' => 'getType', + 'facet' => 'getFacet', + 'params' => 'getParams', + ]; + + /** + * 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['query'] = $data['query'] ?? ''; + $this->container['type'] = $data['type'] ?? null; + $this->container['facet'] = $data['facet'] ?? null; + $this->container['params'] = $data['params'] ?? 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 the Algolia index name + * + * @return self + */ + public function setIndexName($indexName) + { + $this->container['indexName'] = $indexName; + + return $this; + } + + /** + * Gets query + * + * @return string|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param string|null $query the text to search in the index + * + * @return self + */ + public function setQuery($query) + { + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets type + * + * @return \Algolia\AlgoliaSearch\Model\Search\MultipleQueriesType|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Algolia\AlgoliaSearch\Model\Search\MultipleQueriesType|null $type type + * + * @return self + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets facet + * + * @return string|null + */ + public function getFacet() + { + return $this->container['facet']; + } + + /** + * Sets facet + * + * @param string|null $facet the `facet` name + * + * @return self + */ + public function setFacet($facet) + { + $this->container['facet'] = $facet; + + return $this; + } + + /** + * Gets params + * + * @return string|null + */ + public function getParams() + { + return $this->container['params']; + } + + /** + * Sets params + * + * @param string|null $params a query string of search parameters + * + * @return self + */ + public function setParams($params) + { + $this->container['params'] = $params; + + 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/Search/MultipleQueriesParams.php b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesParams.php new file mode 100644 index 0000000000..ec55eb5b9c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesParams.php @@ -0,0 +1,324 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class MultipleQueriesParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'multipleQueriesParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'requests' => '\Algolia\AlgoliaSearch\Model\Search\MultipleQueries[]', + 'strategy' => '\Algolia\AlgoliaSearch\Model\Search\MultipleQueriesStrategy', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'requests' => null, + 'strategy' => 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', + 'strategy' => 'strategy', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'requests' => 'setRequests', + 'strategy' => 'setStrategy', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'requests' => 'getRequests', + 'strategy' => 'getStrategy', + ]; + + /** + * 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; + $this->container['strategy'] = $data['strategy'] ?? 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\Search\MultipleQueries[] + */ + public function getRequests() + { + return $this->container['requests']; + } + + /** + * Sets requests + * + * @param \Algolia\AlgoliaSearch\Model\Search\MultipleQueries[] $requests requests + * + * @return self + */ + public function setRequests($requests) + { + $this->container['requests'] = $requests; + + return $this; + } + + /** + * Gets strategy + * + * @return \Algolia\AlgoliaSearch\Model\Search\MultipleQueriesStrategy|null + */ + public function getStrategy() + { + return $this->container['strategy']; + } + + /** + * Sets strategy + * + * @param \Algolia\AlgoliaSearch\Model\Search\MultipleQueriesStrategy|null $strategy strategy + * + * @return self + */ + public function setStrategy($strategy) + { + $this->container['strategy'] = $strategy; + + 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/Search/MultipleQueriesResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesResponse.php new file mode 100644 index 0000000000..9824632f1d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesResponse.php @@ -0,0 +1,290 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class MultipleQueriesResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'multipleQueriesResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'results' => '\Algolia\AlgoliaSearch\Model\Search\SearchResponse[]', + ]; + + /** + * 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\Search\SearchResponse[]|null + */ + public function getResults() + { + return $this->container['results']; + } + + /** + * Sets results + * + * @param \Algolia\AlgoliaSearch\Model\Search\SearchResponse[]|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/Search/MultipleQueriesStrategy.php b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesStrategy.php new file mode 100644 index 0000000000..cd7d63c38b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/MultipleQueriesStrategy.php @@ -0,0 +1,33 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Operation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Operation_'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'action' => '\Algolia\AlgoliaSearch\Model\Search\Action', + 'body' => 'object', + 'indexName' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'action' => null, + 'body' => 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 = [ + 'action' => 'action', + 'body' => 'body', + 'indexName' => 'indexName', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'action' => 'setAction', + 'body' => 'setBody', + 'indexName' => 'setIndexName', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'action' => 'getAction', + 'body' => 'getBody', + '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['action'] = $data['action'] ?? null; + $this->container['body'] = $data['body'] ?? null; + $this->container['indexName'] = $data['indexName'] ?? 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 action + * + * @return \Algolia\AlgoliaSearch\Model\Search\Action|null + */ + public function getAction() + { + return $this->container['action']; + } + + /** + * Sets action + * + * @param \Algolia\AlgoliaSearch\Model\Search\Action|null $action action + * + * @return self + */ + public function setAction($action) + { + $this->container['action'] = $action; + + return $this; + } + + /** + * Gets body + * + * @return object|null + */ + public function getBody() + { + return $this->container['body']; + } + + /** + * Sets body + * + * @param object|null $body arguments to the operation (depends on the type of the operation) + * + * @return self + */ + public function setBody($body) + { + $this->container['body'] = $body; + + return $this; + } + + /** + * Gets indexName + * + * @return string|null + */ + public function getIndexName() + { + return $this->container['indexName']; + } + + /** + * Sets indexName + * + * @param string|null $indexName index to target for this operation + * + * @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/Search/OperationIndexParams.php b/clients/algoliasearch-client-php/lib/Model/Search/OperationIndexParams.php new file mode 100644 index 0000000000..a560dae9f0 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/OperationIndexParams.php @@ -0,0 +1,357 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class OperationIndexParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'operationIndexParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'operation' => '\Algolia\AlgoliaSearch\Model\Search\OperationType', + 'destination' => 'string', + 'scope' => '\Algolia\AlgoliaSearch\Model\Search\ScopeType[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'operation' => null, + 'destination' => null, + 'scope' => 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 = [ + 'operation' => 'operation', + 'destination' => 'destination', + 'scope' => 'scope', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'operation' => 'setOperation', + 'destination' => 'setDestination', + 'scope' => 'setScope', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'operation' => 'getOperation', + 'destination' => 'getDestination', + 'scope' => 'getScope', + ]; + + /** + * 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['operation'] = $data['operation'] ?? null; + $this->container['destination'] = $data['destination'] ?? null; + $this->container['scope'] = $data['scope'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['operation'] === null) { + $invalidProperties[] = "'operation' can't be null"; + } + if ($this->container['destination'] === null) { + $invalidProperties[] = "'destination' 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 operation + * + * @return \Algolia\AlgoliaSearch\Model\Search\OperationType + */ + public function getOperation() + { + return $this->container['operation']; + } + + /** + * Sets operation + * + * @param \Algolia\AlgoliaSearch\Model\Search\OperationType $operation operation + * + * @return self + */ + public function setOperation($operation) + { + $this->container['operation'] = $operation; + + return $this; + } + + /** + * Gets destination + * + * @return string + */ + public function getDestination() + { + return $this->container['destination']; + } + + /** + * Sets destination + * + * @param string $destination the Algolia index name + * + * @return self + */ + public function setDestination($destination) + { + $this->container['destination'] = $destination; + + return $this; + } + + /** + * Gets scope + * + * @return \Algolia\AlgoliaSearch\Model\Search\ScopeType[]|null + */ + public function getScope() + { + return $this->container['scope']; + } + + /** + * Sets scope + * + * @param \Algolia\AlgoliaSearch\Model\Search\ScopeType[]|null $scope Scope of the data to copy. When absent, a full copy is performed. When present, only the selected scopes are copied. + * + * @return self + */ + public function setScope($scope) + { + $this->container['scope'] = $scope; + + 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/Search/OperationType.php b/clients/algoliasearch-client-php/lib/Model/Search/OperationType.php new file mode 100644 index 0000000000..8725c23675 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/OperationType.php @@ -0,0 +1,35 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Params implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'params'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'query' => 'string', + 'automaticFacetFilters' => '\Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]', + 'automaticOptionalFacetFilters' => '\Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'query' => null, + 'automaticFacetFilters' => null, + 'automaticOptionalFacetFilters' => 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', + 'automaticFacetFilters' => 'automaticFacetFilters', + 'automaticOptionalFacetFilters' => 'automaticOptionalFacetFilters', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'query' => 'setQuery', + 'automaticFacetFilters' => 'setAutomaticFacetFilters', + 'automaticOptionalFacetFilters' => 'setAutomaticOptionalFacetFilters', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'query' => 'getQuery', + 'automaticFacetFilters' => 'getAutomaticFacetFilters', + 'automaticOptionalFacetFilters' => 'getAutomaticOptionalFacetFilters', + ]; + + /** + * 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['automaticFacetFilters'] = $data['automaticFacetFilters'] ?? null; + $this->container['automaticOptionalFacetFilters'] = $data['automaticOptionalFacetFilters'] ?? 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 query + * + * @return string|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param string|null $query query string + * + * @return self + */ + public function setQuery($query) + { + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets automaticFacetFilters + * + * @return \Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]|null + */ + public function getAutomaticFacetFilters() + { + return $this->container['automaticFacetFilters']; + } + + /** + * Sets automaticFacetFilters + * + * @param \Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]|null $automaticFacetFilters names of facets to which automatic filtering must be applied; they must match the facet name of a facet value placeholder in the query pattern + * + * @return self + */ + public function setAutomaticFacetFilters($automaticFacetFilters) + { + $this->container['automaticFacetFilters'] = $automaticFacetFilters; + + return $this; + } + + /** + * Gets automaticOptionalFacetFilters + * + * @return \Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]|null + */ + public function getAutomaticOptionalFacetFilters() + { + return $this->container['automaticOptionalFacetFilters']; + } + + /** + * Sets automaticOptionalFacetFilters + * + * @param \Algolia\AlgoliaSearch\Model\Search\AutomaticFacetFilter[]|null $automaticOptionalFacetFilters same syntax as automaticFacetFilters, but the engine treats the filters as optional + * + * @return self + */ + public function setAutomaticOptionalFacetFilters($automaticOptionalFacetFilters) + { + $this->container['automaticOptionalFacetFilters'] = $automaticOptionalFacetFilters; + + 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/Search/Promote.php b/clients/algoliasearch-client-php/lib/Model/Search/Promote.php new file mode 100644 index 0000000000..3f06e62feb --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Promote.php @@ -0,0 +1,356 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Promote implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'promote'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'objectID' => 'string', + 'objectIDs' => 'string[]', + 'position' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'objectID' => null, + 'objectIDs' => null, + 'position' => 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 = [ + 'objectID' => 'objectID', + 'objectIDs' => 'objectIDs', + 'position' => 'position', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'objectID' => 'setObjectID', + 'objectIDs' => 'setObjectIDs', + 'position' => 'setPosition', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'objectID' => 'getObjectID', + 'objectIDs' => 'getObjectIDs', + 'position' => 'getPosition', + ]; + + /** + * 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['objectIDs'] = $data['objectIDs'] ?? null; + $this->container['position'] = $data['position'] ?? 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"; + } + + 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|null + */ + public function getObjectID() + { + return $this->container['objectID']; + } + + /** + * Sets objectID + * + * @param string|null $objectID unique identifier of the object to promote + * + * @return self + */ + public function setObjectID($objectID) + { + $this->container['objectID'] = $objectID; + + return $this; + } + + /** + * Gets objectIDs + * + * @return string[]|null + */ + public function getObjectIDs() + { + return $this->container['objectIDs']; + } + + /** + * Sets objectIDs + * + * @param string[]|null $objectIDs array of unique identifiers of the objects to promote + * + * @return self + */ + public function setObjectIDs($objectIDs) + { + $this->container['objectIDs'] = $objectIDs; + + return $this; + } + + /** + * Gets position + * + * @return int + */ + public function getPosition() + { + return $this->container['position']; + } + + /** + * Sets position + * + * @param int $position The position to promote the objects to (zero-based). If you pass objectIDs, the objects are placed at this position as a group. For example, if you pass four objectIDs to position 0, the objects take the first four positions. + * + * @return self + */ + public function setPosition($position) + { + $this->container['position'] = $position; + + 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/Search/RankingInfo.php b/clients/algoliasearch-client-php/lib/Model/Search/RankingInfo.php new file mode 100644 index 0000000000..2d78da24bc --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/RankingInfo.php @@ -0,0 +1,590 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RankingInfo implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'rankingInfo'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'filters' => 'int', + 'firstMatchedWord' => 'int', + 'geoDistance' => 'int', + 'geoPrecision' => 'int', + 'matchedGeoLocation' => 'array', + 'nbExactWords' => 'int', + 'nbTypos' => 'int', + 'promoted' => 'bool', + 'proximityDistance' => 'int', + 'userScore' => 'int', + 'word' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'filters' => null, + 'firstMatchedWord' => null, + 'geoDistance' => null, + 'geoPrecision' => null, + 'matchedGeoLocation' => null, + 'nbExactWords' => null, + 'nbTypos' => null, + 'promoted' => null, + 'proximityDistance' => null, + 'userScore' => null, + 'word' => 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 = [ + 'filters' => 'filters', + 'firstMatchedWord' => 'firstMatchedWord', + 'geoDistance' => 'geoDistance', + 'geoPrecision' => 'geoPrecision', + 'matchedGeoLocation' => 'matchedGeoLocation', + 'nbExactWords' => 'nbExactWords', + 'nbTypos' => 'nbTypos', + 'promoted' => 'promoted', + 'proximityDistance' => 'proximityDistance', + 'userScore' => 'userScore', + 'word' => 'word', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'filters' => 'setFilters', + 'firstMatchedWord' => 'setFirstMatchedWord', + 'geoDistance' => 'setGeoDistance', + 'geoPrecision' => 'setGeoPrecision', + 'matchedGeoLocation' => 'setMatchedGeoLocation', + 'nbExactWords' => 'setNbExactWords', + 'nbTypos' => 'setNbTypos', + 'promoted' => 'setPromoted', + 'proximityDistance' => 'setProximityDistance', + 'userScore' => 'setUserScore', + 'word' => 'setWord', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'filters' => 'getFilters', + 'firstMatchedWord' => 'getFirstMatchedWord', + 'geoDistance' => 'getGeoDistance', + 'geoPrecision' => 'getGeoPrecision', + 'matchedGeoLocation' => 'getMatchedGeoLocation', + 'nbExactWords' => 'getNbExactWords', + 'nbTypos' => 'getNbTypos', + 'promoted' => 'getPromoted', + 'proximityDistance' => 'getProximityDistance', + 'userScore' => 'getUserScore', + 'word' => 'getWord', + ]; + + /** + * 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['filters'] = $data['filters'] ?? null; + $this->container['firstMatchedWord'] = $data['firstMatchedWord'] ?? null; + $this->container['geoDistance'] = $data['geoDistance'] ?? null; + $this->container['geoPrecision'] = $data['geoPrecision'] ?? null; + $this->container['matchedGeoLocation'] = $data['matchedGeoLocation'] ?? null; + $this->container['nbExactWords'] = $data['nbExactWords'] ?? null; + $this->container['nbTypos'] = $data['nbTypos'] ?? null; + $this->container['promoted'] = $data['promoted'] ?? null; + $this->container['proximityDistance'] = $data['proximityDistance'] ?? null; + $this->container['userScore'] = $data['userScore'] ?? null; + $this->container['word'] = $data['word'] ?? 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 filters + * + * @return int|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param int|null $filters this field is reserved for advanced usage + * + * @return self + */ + public function setFilters($filters) + { + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets firstMatchedWord + * + * @return int|null + */ + public function getFirstMatchedWord() + { + return $this->container['firstMatchedWord']; + } + + /** + * Sets firstMatchedWord + * + * @param int|null $firstMatchedWord position of the most important matched attribute in the attributes to index list + * + * @return self + */ + public function setFirstMatchedWord($firstMatchedWord) + { + $this->container['firstMatchedWord'] = $firstMatchedWord; + + return $this; + } + + /** + * Gets geoDistance + * + * @return int|null + */ + public function getGeoDistance() + { + return $this->container['geoDistance']; + } + + /** + * Sets geoDistance + * + * @param int|null $geoDistance distance between the geo location in the search query and the best matching geo location in the record, divided by the geo precision (in meters) + * + * @return self + */ + public function setGeoDistance($geoDistance) + { + $this->container['geoDistance'] = $geoDistance; + + return $this; + } + + /** + * Gets geoPrecision + * + * @return int|null + */ + public function getGeoPrecision() + { + return $this->container['geoPrecision']; + } + + /** + * Sets geoPrecision + * + * @param int|null $geoPrecision precision used when computing the geo distance, in meters + * + * @return self + */ + public function setGeoPrecision($geoPrecision) + { + $this->container['geoPrecision'] = $geoPrecision; + + return $this; + } + + /** + * Gets matchedGeoLocation + * + * @return array|null + */ + public function getMatchedGeoLocation() + { + return $this->container['matchedGeoLocation']; + } + + /** + * Sets matchedGeoLocation + * + * @param array|null $matchedGeoLocation matchedGeoLocation + * + * @return self + */ + public function setMatchedGeoLocation($matchedGeoLocation) + { + $this->container['matchedGeoLocation'] = $matchedGeoLocation; + + return $this; + } + + /** + * Gets nbExactWords + * + * @return int|null + */ + public function getNbExactWords() + { + return $this->container['nbExactWords']; + } + + /** + * Sets nbExactWords + * + * @param int|null $nbExactWords number of exactly matched words + * + * @return self + */ + public function setNbExactWords($nbExactWords) + { + $this->container['nbExactWords'] = $nbExactWords; + + return $this; + } + + /** + * Gets nbTypos + * + * @return int|null + */ + public function getNbTypos() + { + return $this->container['nbTypos']; + } + + /** + * Sets nbTypos + * + * @param int|null $nbTypos number of typos encountered when matching the record + * + * @return self + */ + public function setNbTypos($nbTypos) + { + $this->container['nbTypos'] = $nbTypos; + + return $this; + } + + /** + * Gets promoted + * + * @return bool|null + */ + public function getPromoted() + { + return $this->container['promoted']; + } + + /** + * Sets promoted + * + * @param bool|null $promoted present and set to true if a Rule promoted the hit + * + * @return self + */ + public function setPromoted($promoted) + { + $this->container['promoted'] = $promoted; + + return $this; + } + + /** + * Gets proximityDistance + * + * @return int|null + */ + public function getProximityDistance() + { + return $this->container['proximityDistance']; + } + + /** + * Sets proximityDistance + * + * @param int|null $proximityDistance when the query contains more than one word, the sum of the distances between matched words (in meters) + * + * @return self + */ + public function setProximityDistance($proximityDistance) + { + $this->container['proximityDistance'] = $proximityDistance; + + return $this; + } + + /** + * Gets userScore + * + * @return int|null + */ + public function getUserScore() + { + return $this->container['userScore']; + } + + /** + * Sets userScore + * + * @param int|null $userScore custom ranking for the object, expressed as a single integer value + * + * @return self + */ + public function setUserScore($userScore) + { + $this->container['userScore'] = $userScore; + + return $this; + } + + /** + * Gets word + * + * @return int|null + */ + public function getWord() + { + return $this->container['word']; + } + + /** + * Sets word + * + * @param int|null $word number of matched words, including prefixes and typos + * + * @return self + */ + public function setWord($word) + { + $this->container['word'] = $word; + + 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/Search/RankingInfoMatchedGeoLocation.php b/clients/algoliasearch-client-php/lib/Model/Search/RankingInfoMatchedGeoLocation.php new file mode 100644 index 0000000000..5483c9449b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/RankingInfoMatchedGeoLocation.php @@ -0,0 +1,350 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RankingInfoMatchedGeoLocation implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'rankingInfo_matchedGeoLocation'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'lat' => 'double', + 'lng' => 'double', + 'distance' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'lat' => 'double', + 'lng' => 'double', + 'distance' => 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 = [ + 'lat' => 'lat', + 'lng' => 'lng', + 'distance' => 'distance', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'lat' => 'setLat', + 'lng' => 'setLng', + 'distance' => 'setDistance', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'lat' => 'getLat', + 'lng' => 'getLng', + 'distance' => 'getDistance', + ]; + + /** + * 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['lat'] = $data['lat'] ?? null; + $this->container['lng'] = $data['lng'] ?? null; + $this->container['distance'] = $data['distance'] ?? 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 lat + * + * @return float|null + */ + public function getLat() + { + return $this->container['lat']; + } + + /** + * Sets lat + * + * @param float|null $lat latitude of the matched location + * + * @return self + */ + public function setLat($lat) + { + $this->container['lat'] = $lat; + + return $this; + } + + /** + * Gets lng + * + * @return float|null + */ + public function getLng() + { + return $this->container['lng']; + } + + /** + * Sets lng + * + * @param float|null $lng longitude of the matched location + * + * @return self + */ + public function setLng($lng) + { + $this->container['lng'] = $lng; + + return $this; + } + + /** + * Gets distance + * + * @return int|null + */ + public function getDistance() + { + return $this->container['distance']; + } + + /** + * Sets distance + * + * @param int|null $distance distance between the matched location and the search location (in meters) + * + * @return self + */ + public function setDistance($distance) + { + $this->container['distance'] = $distance; + + 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/Search/RemoveUserIdResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/RemoveUserIdResponse.php new file mode 100644 index 0000000000..4cd699585a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/RemoveUserIdResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RemoveUserIdResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'removeUserIdResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'deletedAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'deletedAt' => 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 = [ + 'deletedAt' => 'deletedAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'deletedAt' => 'setDeletedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'deletedAt' => 'getDeletedAt', + ]; + + /** + * 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['deletedAt'] = $data['deletedAt'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['deletedAt'] === null) { + $invalidProperties[] = "'deletedAt' 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 deletedAt + * + * @return string + */ + public function getDeletedAt() + { + return $this->container['deletedAt']; + } + + /** + * Sets deletedAt + * + * @param string $deletedAt date of deletion (ISO-8601 format) + * + * @return self + */ + public function setDeletedAt($deletedAt) + { + $this->container['deletedAt'] = $deletedAt; + + 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/Search/ReplaceSourceResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/ReplaceSourceResponse.php new file mode 100644 index 0000000000..27268b3cb6 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/ReplaceSourceResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class ReplaceSourceResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'replaceSourceResponse'; + + /** + * 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/Search/RequiredSearchParams.php b/clients/algoliasearch-client-php/lib/Model/Search/RequiredSearchParams.php new file mode 100644 index 0000000000..2e7b76996d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/RequiredSearchParams.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class RequiredSearchParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'requiredSearchParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'query' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'query' => 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', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'query' => 'setQuery', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'query' => 'getQuery', + ]; + + /** + * 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'] ?? ''; + } + + /** + * 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"; + } + + 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 text to search in the index + * + * @return self + */ + public function setQuery($query) + { + $this->container['query'] = $query; + + 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/Search/Rule.php b/clients/algoliasearch-client-php/lib/Model/Search/Rule.php new file mode 100644 index 0000000000..e643e875a7 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Rule.php @@ -0,0 +1,449 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Rule implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'rule'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'objectID' => 'string', + 'conditions' => '\Algolia\AlgoliaSearch\Model\Search\Condition[]', + 'consequence' => '\Algolia\AlgoliaSearch\Model\Search\Consequence', + 'description' => 'string', + 'enabled' => 'bool', + 'validity' => '\Algolia\AlgoliaSearch\Model\Search\TimeRange[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'objectID' => null, + 'conditions' => null, + 'consequence' => null, + 'description' => null, + 'enabled' => null, + 'validity' => 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 = [ + 'objectID' => 'objectID', + 'conditions' => 'conditions', + 'consequence' => 'consequence', + 'description' => 'description', + 'enabled' => 'enabled', + 'validity' => 'validity', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'objectID' => 'setObjectID', + 'conditions' => 'setConditions', + 'consequence' => 'setConsequence', + 'description' => 'setDescription', + 'enabled' => 'setEnabled', + 'validity' => 'setValidity', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'objectID' => 'getObjectID', + 'conditions' => 'getConditions', + 'consequence' => 'getConsequence', + 'description' => 'getDescription', + 'enabled' => 'getEnabled', + 'validity' => 'getValidity', + ]; + + /** + * 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['conditions'] = $data['conditions'] ?? null; + $this->container['consequence'] = $data['consequence'] ?? null; + $this->container['description'] = $data['description'] ?? null; + $this->container['enabled'] = $data['enabled'] ?? true; + $this->container['validity'] = $data['validity'] ?? 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['consequence'] === null) { + $invalidProperties[] = "'consequence' 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 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 conditions + * + * @return \Algolia\AlgoliaSearch\Model\Search\Condition[]|null + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \Algolia\AlgoliaSearch\Model\Search\Condition[]|null $conditions A list of conditions that should apply to activate a Rule. You can use up to 25 conditions per Rule. + * + * @return self + */ + public function setConditions($conditions) + { + $this->container['conditions'] = $conditions; + + return $this; + } + + /** + * Gets consequence + * + * @return \Algolia\AlgoliaSearch\Model\Search\Consequence + */ + public function getConsequence() + { + return $this->container['consequence']; + } + + /** + * Sets consequence + * + * @param \Algolia\AlgoliaSearch\Model\Search\Consequence $consequence consequence + * + * @return self + */ + public function setConsequence($consequence) + { + $this->container['consequence'] = $consequence; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description This field is intended for Rule management purposes, in particular to ease searching for Rules and presenting them to human readers. It's not interpreted by the API. + * + * @return self + */ + public function setDescription($description) + { + $this->container['description'] = $description; + + return $this; + } + + /** + * Gets enabled + * + * @return bool|null + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool|null $enabled Whether the Rule is enabled. Disabled Rules remain in the index, but aren't applied at query time. + * + * @return self + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets validity + * + * @return \Algolia\AlgoliaSearch\Model\Search\TimeRange[]|null + */ + public function getValidity() + { + return $this->container['validity']; + } + + /** + * Sets validity + * + * @param \Algolia\AlgoliaSearch\Model\Search\TimeRange[]|null $validity By default, Rules are permanently valid. When validity periods are specified, the Rule applies only during those periods; it's ignored the rest of the time. The list must not be empty. + * + * @return self + */ + public function setValidity($validity) + { + $this->container['validity'] = $validity; + + 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/Search/SaveObjectResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/SaveObjectResponse.php new file mode 100644 index 0000000000..abcbc1fcb4 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SaveObjectResponse.php @@ -0,0 +1,350 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SaveObjectResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'saveObjectResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'createdAt' => 'string', + 'taskID' => 'int', + 'objectID' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'createdAt' => null, + 'taskID' => null, + 'objectID' => 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 = [ + 'createdAt' => 'createdAt', + 'taskID' => 'taskID', + 'objectID' => 'objectID', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'createdAt' => 'setCreatedAt', + 'taskID' => 'setTaskID', + 'objectID' => 'setObjectID', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'createdAt' => 'getCreatedAt', + 'taskID' => 'getTaskID', + 'objectID' => 'getObjectID', + ]; + + /** + * 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['createdAt'] = $data['createdAt'] ?? null; + $this->container['taskID'] = $data['taskID'] ?? null; + $this->container['objectID'] = $data['objectID'] ?? 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 createdAt + * + * @return string|null + */ + public function getCreatedAt() + { + return $this->container['createdAt']; + } + + /** + * Sets createdAt + * + * @param string|null $createdAt createdAt + * + * @return self + */ + public function setCreatedAt($createdAt) + { + $this->container['createdAt'] = $createdAt; + + return $this; + } + + /** + * Gets taskID + * + * @return int|null + */ + public function getTaskID() + { + return $this->container['taskID']; + } + + /** + * Sets taskID + * + * @param int|null $taskID taskID of the task to wait for + * + * @return self + */ + public function setTaskID($taskID) + { + $this->container['taskID'] = $taskID; + + return $this; + } + + /** + * Gets objectID + * + * @return string|null + */ + public function getObjectID() + { + return $this->container['objectID']; + } + + /** + * Sets objectID + * + * @param string|null $objectID unique identifier of the object + * + * @return self + */ + public function setObjectID($objectID) + { + $this->container['objectID'] = $objectID; + + 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/Search/SaveSynonymResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/SaveSynonymResponse.php new file mode 100644 index 0000000000..1d40aa5704 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SaveSynonymResponse.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SaveSynonymResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'saveSynonymResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'taskID' => 'int', + 'updatedAt' => 'string', + 'id' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'taskID' => null, + 'updatedAt' => null, + 'id' => 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 = [ + 'taskID' => 'taskID', + 'updatedAt' => 'updatedAt', + 'id' => 'id', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'taskID' => 'setTaskID', + 'updatedAt' => 'setUpdatedAt', + 'id' => 'setId', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'taskID' => 'getTaskID', + 'updatedAt' => 'getUpdatedAt', + 'id' => 'getId', + ]; + + /** + * 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['taskID'] = $data['taskID'] ?? null; + $this->container['updatedAt'] = $data['updatedAt'] ?? null; + $this->container['id'] = $data['id'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['taskID'] === null) { + $invalidProperties[] = "'taskID' can't be null"; + } + if ($this->container['updatedAt'] === null) { + $invalidProperties[] = "'updatedAt' can't be null"; + } + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' 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 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; + } + + /** + * 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; + } + + /** + * Gets id + * + * @return string + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param string $id objectID of the inserted object + * + * @return self + */ + public function setId($id) + { + $this->container['id'] = $id; + + 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/Search/ScopeType.php b/clients/algoliasearch-client-php/lib/Model/Search/ScopeType.php new file mode 100644 index 0000000000..07b0653506 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/ScopeType.php @@ -0,0 +1,36 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchDictionaryEntries implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchDictionaryEntries'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'query' => 'string', + 'page' => 'int', + 'hitsPerPage' => 'int', + 'language' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'query' => null, + 'page' => null, + 'hitsPerPage' => null, + 'language' => 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', + 'page' => 'page', + 'hitsPerPage' => 'hitsPerPage', + 'language' => 'language', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'query' => 'setQuery', + 'page' => 'setPage', + 'hitsPerPage' => 'setHitsPerPage', + 'language' => 'setLanguage', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'query' => 'getQuery', + 'page' => 'getPage', + 'hitsPerPage' => 'getHitsPerPage', + 'language' => 'getLanguage', + ]; + + /** + * 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'] ?? ''; + $this->container['page'] = $data['page'] ?? 0; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + $this->container['language'] = $data['language'] ?? 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"; + } + + 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 text to search in the index + * + * @return self + */ + public function setQuery($query) + { + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets page + * + * @return int|null + */ + public function getPage() + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param int|null $page specify the page to retrieve + * + * @return self + */ + public function setPage($page) + { + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets hitsPerPage + * + * @return int|null + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int|null $hitsPerPage set the number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Gets language + * + * @return string|null + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param string|null $language Language ISO code supported by the dictionary (e.g., \"en\" for English). + * + * @return self + */ + public function setLanguage($language) + { + $this->container['language'] = $language; + + 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/Search/SearchForFacetValuesRequest.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchForFacetValuesRequest.php new file mode 100644 index 0000000000..2d5f54be7a --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchForFacetValuesRequest.php @@ -0,0 +1,358 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchForFacetValuesRequest implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchForFacetValuesRequest'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'params' => 'string', + 'facetQuery' => 'string', + 'maxFacetHits' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'params' => null, + 'facetQuery' => null, + 'maxFacetHits' => 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 = [ + 'params' => 'params', + 'facetQuery' => 'facetQuery', + 'maxFacetHits' => 'maxFacetHits', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'params' => 'setParams', + 'facetQuery' => 'setFacetQuery', + 'maxFacetHits' => 'setMaxFacetHits', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'params' => 'getParams', + 'facetQuery' => 'getFacetQuery', + 'maxFacetHits' => 'getMaxFacetHits', + ]; + + /** + * 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['params'] = $data['params'] ?? ''; + $this->container['facetQuery'] = $data['facetQuery'] ?? ''; + $this->container['maxFacetHits'] = $data['maxFacetHits'] ?? 10; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['maxFacetHits']) && ($this->container['maxFacetHits'] > 100)) { + $invalidProperties[] = "invalid value for 'maxFacetHits', must be smaller than or equal to 100."; + } + + 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 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 facetQuery + * + * @return string|null + */ + public function getFacetQuery() + { + return $this->container['facetQuery']; + } + + /** + * Sets facetQuery + * + * @param string|null $facetQuery text to search inside the facet's values + * + * @return self + */ + public function setFacetQuery($facetQuery) + { + $this->container['facetQuery'] = $facetQuery; + + return $this; + } + + /** + * Gets maxFacetHits + * + * @return int|null + */ + public function getMaxFacetHits() + { + return $this->container['maxFacetHits']; + } + + /** + * Sets maxFacetHits + * + * @param int|null $maxFacetHits Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. + * + * @return self + */ + public function setMaxFacetHits($maxFacetHits) + { + if (!is_null($maxFacetHits) && ($maxFacetHits > 100)) { + throw new \InvalidArgumentException('invalid value for $maxFacetHits when calling SearchForFacetValuesRequest., must be smaller than or equal to 100.'); + } + + $this->container['maxFacetHits'] = $maxFacetHits; + + 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/Search/SearchForFacetValuesResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchForFacetValuesResponse.php new file mode 100644 index 0000000000..5561f5e6a9 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchForFacetValuesResponse.php @@ -0,0 +1,294 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchForFacetValuesResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchForFacetValuesResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'facetHits' => '\Algolia\AlgoliaSearch\Model\Search\SearchForFacetValuesResponseFacetHits[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'facetHits' => 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 = [ + 'facetHits' => 'facetHits', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'facetHits' => 'setFacetHits', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'facetHits' => 'getFacetHits', + ]; + + /** + * 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['facetHits'] = $data['facetHits'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['facetHits'] === null) { + $invalidProperties[] = "'facetHits' 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 facetHits + * + * @return \Algolia\AlgoliaSearch\Model\Search\SearchForFacetValuesResponseFacetHits[] + */ + public function getFacetHits() + { + return $this->container['facetHits']; + } + + /** + * Sets facetHits + * + * @param \Algolia\AlgoliaSearch\Model\Search\SearchForFacetValuesResponseFacetHits[] $facetHits facetHits + * + * @return self + */ + public function setFacetHits($facetHits) + { + $this->container['facetHits'] = $facetHits; + + 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/Search/SearchForFacetValuesResponseFacetHits.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchForFacetValuesResponseFacetHits.php new file mode 100644 index 0000000000..30aab83f87 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchForFacetValuesResponseFacetHits.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchForFacetValuesResponseFacetHits implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchForFacetValuesResponse_facetHits'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'value' => 'string', + 'highlighted' => 'string', + 'count' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'highlighted' => 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 = [ + 'value' => 'value', + 'highlighted' => 'highlighted', + 'count' => 'count', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'highlighted' => 'setHighlighted', + 'count' => 'setCount', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'highlighted' => 'getHighlighted', + '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['value'] = $data['value'] ?? null; + $this->container['highlighted'] = $data['highlighted'] ?? 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['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + if ($this->container['highlighted'] === null) { + $invalidProperties[] = "'highlighted' 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 value + * + * @return string + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string $value raw value of the facet + * + * @return self + */ + public function setValue($value) + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets highlighted + * + * @return string + */ + public function getHighlighted() + { + return $this->container['highlighted']; + } + + /** + * Sets highlighted + * + * @param string $highlighted markup text with occurrences highlighted + * + * @return self + */ + public function setHighlighted($highlighted) + { + $this->container['highlighted'] = $highlighted; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count How many objects contain this facet value. This takes into account the extra search parameters specified in the query. Like for a regular search query, the counts may not be exhaustive. + * + * @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/Search/SearchHits.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchHits.php new file mode 100644 index 0000000000..0492fd4e19 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchHits.php @@ -0,0 +1,290 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchHits implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchHits'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hits' => '\Algolia\AlgoliaSearch\Model\Search\Hit[]', + ]; + + /** + * 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\Search\Hit[]|null + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\Search\Hit[]|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/Search/SearchParams.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchParams.php new file mode 100644 index 0000000000..696fd1de87 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchParams.php @@ -0,0 +1,2863 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'params' => 'string', + 'similarQuery' => 'string', + 'filters' => 'string', + 'facetFilters' => 'string[]', + 'optionalFilters' => 'string[]', + 'numericFilters' => 'string[]', + 'tagFilters' => 'string[]', + 'sumOrFiltersScores' => 'bool', + 'facets' => 'string[]', + 'maxValuesPerFacet' => 'int', + 'facetingAfterDistinct' => 'bool', + 'sortFacetValuesBy' => 'string', + 'page' => 'int', + 'offset' => 'int', + 'length' => 'int', + 'aroundLatLng' => 'string', + 'aroundLatLngViaIP' => 'bool', + 'aroundRadius' => 'OneOfIntegerString', + 'aroundPrecision' => 'int', + 'minimumAroundRadius' => 'int', + 'insideBoundingBox' => 'float[]', + 'insidePolygon' => 'float[]', + 'naturalLanguages' => 'string[]', + 'ruleContexts' => 'string[]', + 'personalizationImpact' => 'int', + 'userToken' => 'string', + 'getRankingInfo' => 'bool', + 'clickAnalytics' => 'bool', + 'analytics' => 'bool', + 'analyticsTags' => 'string[]', + 'percentileComputation' => 'bool', + 'enableABTest' => 'bool', + 'enableReRanking' => 'bool', + 'query' => 'string', + 'searchableAttributes' => 'string[]', + 'attributesForFaceting' => 'string[]', + 'unretrievableAttributes' => 'string[]', + 'attributesToRetrieve' => 'string[]', + 'restrictSearchableAttributes' => 'string[]', + 'ranking' => 'string[]', + 'customRanking' => 'string[]', + 'relevancyStrictness' => 'int', + 'attributesToHighlight' => 'string[]', + 'attributesToSnippet' => 'string[]', + 'highlightPreTag' => 'string', + 'highlightPostTag' => 'string', + 'snippetEllipsisText' => 'string', + 'restrictHighlightAndSnippetArrays' => 'bool', + 'hitsPerPage' => 'int', + 'minWordSizefor1Typo' => 'int', + 'minWordSizefor2Typos' => 'int', + 'typoTolerance' => 'string', + 'allowTyposOnNumericTokens' => 'bool', + 'disableTypoToleranceOnAttributes' => 'string[]', + 'separatorsToIndex' => 'string', + 'ignorePlurals' => 'string', + 'removeStopWords' => 'string', + 'keepDiacriticsOnCharacters' => 'string', + 'queryLanguages' => 'string[]', + 'decompoundQuery' => 'bool', + 'enableRules' => 'bool', + 'enablePersonalization' => 'bool', + 'queryType' => 'string', + 'removeWordsIfNoResults' => 'string', + 'advancedSyntax' => 'bool', + 'optionalWords' => 'string[]', + 'disableExactOnAttributes' => 'string[]', + 'exactOnSingleWordQuery' => 'string', + 'alternativesAsExact' => 'string[]', + 'advancedSyntaxFeatures' => 'string[]', + 'distinct' => 'int', + 'synonyms' => 'bool', + 'replaceSynonymsInHighlight' => 'bool', + 'minProximity' => 'int', + 'responseFields' => 'string[]', + 'maxFacetHits' => 'int', + 'attributeCriteriaComputedByMinProximity' => 'bool', + 'renderingContent' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'params' => null, + 'similarQuery' => null, + 'filters' => null, + 'facetFilters' => null, + 'optionalFilters' => null, + 'numericFilters' => null, + 'tagFilters' => null, + 'sumOrFiltersScores' => null, + 'facets' => null, + 'maxValuesPerFacet' => null, + 'facetingAfterDistinct' => null, + 'sortFacetValuesBy' => null, + 'page' => null, + 'offset' => null, + 'length' => null, + 'aroundLatLng' => null, + 'aroundLatLngViaIP' => null, + 'aroundRadius' => null, + 'aroundPrecision' => null, + 'minimumAroundRadius' => null, + 'insideBoundingBox' => null, + 'insidePolygon' => null, + 'naturalLanguages' => null, + 'ruleContexts' => null, + 'personalizationImpact' => null, + 'userToken' => null, + 'getRankingInfo' => null, + 'clickAnalytics' => null, + 'analytics' => null, + 'analyticsTags' => null, + 'percentileComputation' => null, + 'enableABTest' => null, + 'enableReRanking' => null, + 'query' => null, + 'searchableAttributes' => null, + 'attributesForFaceting' => null, + 'unretrievableAttributes' => null, + 'attributesToRetrieve' => null, + 'restrictSearchableAttributes' => null, + 'ranking' => null, + 'customRanking' => null, + 'relevancyStrictness' => null, + 'attributesToHighlight' => null, + 'attributesToSnippet' => null, + 'highlightPreTag' => null, + 'highlightPostTag' => null, + 'snippetEllipsisText' => null, + 'restrictHighlightAndSnippetArrays' => null, + 'hitsPerPage' => null, + 'minWordSizefor1Typo' => null, + 'minWordSizefor2Typos' => null, + 'typoTolerance' => null, + 'allowTyposOnNumericTokens' => null, + 'disableTypoToleranceOnAttributes' => null, + 'separatorsToIndex' => null, + 'ignorePlurals' => null, + 'removeStopWords' => null, + 'keepDiacriticsOnCharacters' => null, + 'queryLanguages' => null, + 'decompoundQuery' => null, + 'enableRules' => null, + 'enablePersonalization' => null, + 'queryType' => null, + 'removeWordsIfNoResults' => null, + 'advancedSyntax' => null, + 'optionalWords' => null, + 'disableExactOnAttributes' => null, + 'exactOnSingleWordQuery' => null, + 'alternativesAsExact' => null, + 'advancedSyntaxFeatures' => null, + 'distinct' => null, + 'synonyms' => null, + 'replaceSynonymsInHighlight' => null, + 'minProximity' => null, + 'responseFields' => null, + 'maxFacetHits' => null, + 'attributeCriteriaComputedByMinProximity' => null, + 'renderingContent' => 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 = [ + 'params' => 'params', + 'similarQuery' => 'similarQuery', + 'filters' => 'filters', + 'facetFilters' => 'facetFilters', + 'optionalFilters' => 'optionalFilters', + 'numericFilters' => 'numericFilters', + 'tagFilters' => 'tagFilters', + 'sumOrFiltersScores' => 'sumOrFiltersScores', + 'facets' => 'facets', + 'maxValuesPerFacet' => 'maxValuesPerFacet', + 'facetingAfterDistinct' => 'facetingAfterDistinct', + 'sortFacetValuesBy' => 'sortFacetValuesBy', + 'page' => 'page', + 'offset' => 'offset', + 'length' => 'length', + 'aroundLatLng' => 'aroundLatLng', + 'aroundLatLngViaIP' => 'aroundLatLngViaIP', + 'aroundRadius' => 'aroundRadius', + 'aroundPrecision' => 'aroundPrecision', + 'minimumAroundRadius' => 'minimumAroundRadius', + 'insideBoundingBox' => 'insideBoundingBox', + 'insidePolygon' => 'insidePolygon', + 'naturalLanguages' => 'naturalLanguages', + 'ruleContexts' => 'ruleContexts', + 'personalizationImpact' => 'personalizationImpact', + 'userToken' => 'userToken', + 'getRankingInfo' => 'getRankingInfo', + 'clickAnalytics' => 'clickAnalytics', + 'analytics' => 'analytics', + 'analyticsTags' => 'analyticsTags', + 'percentileComputation' => 'percentileComputation', + 'enableABTest' => 'enableABTest', + 'enableReRanking' => 'enableReRanking', + 'query' => 'query', + 'searchableAttributes' => 'searchableAttributes', + 'attributesForFaceting' => 'attributesForFaceting', + 'unretrievableAttributes' => 'unretrievableAttributes', + 'attributesToRetrieve' => 'attributesToRetrieve', + 'restrictSearchableAttributes' => 'restrictSearchableAttributes', + 'ranking' => 'ranking', + 'customRanking' => 'customRanking', + 'relevancyStrictness' => 'relevancyStrictness', + 'attributesToHighlight' => 'attributesToHighlight', + 'attributesToSnippet' => 'attributesToSnippet', + 'highlightPreTag' => 'highlightPreTag', + 'highlightPostTag' => 'highlightPostTag', + 'snippetEllipsisText' => 'snippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'restrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'hitsPerPage', + 'minWordSizefor1Typo' => 'minWordSizefor1Typo', + 'minWordSizefor2Typos' => 'minWordSizefor2Typos', + 'typoTolerance' => 'typoTolerance', + 'allowTyposOnNumericTokens' => 'allowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'disableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'separatorsToIndex', + 'ignorePlurals' => 'ignorePlurals', + 'removeStopWords' => 'removeStopWords', + 'keepDiacriticsOnCharacters' => 'keepDiacriticsOnCharacters', + 'queryLanguages' => 'queryLanguages', + 'decompoundQuery' => 'decompoundQuery', + 'enableRules' => 'enableRules', + 'enablePersonalization' => 'enablePersonalization', + 'queryType' => 'queryType', + 'removeWordsIfNoResults' => 'removeWordsIfNoResults', + 'advancedSyntax' => 'advancedSyntax', + 'optionalWords' => 'optionalWords', + 'disableExactOnAttributes' => 'disableExactOnAttributes', + 'exactOnSingleWordQuery' => 'exactOnSingleWordQuery', + 'alternativesAsExact' => 'alternativesAsExact', + 'advancedSyntaxFeatures' => 'advancedSyntaxFeatures', + 'distinct' => 'distinct', + 'synonyms' => 'synonyms', + 'replaceSynonymsInHighlight' => 'replaceSynonymsInHighlight', + 'minProximity' => 'minProximity', + 'responseFields' => 'responseFields', + 'maxFacetHits' => 'maxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'attributeCriteriaComputedByMinProximity', + 'renderingContent' => 'renderingContent', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'params' => 'setParams', + 'similarQuery' => 'setSimilarQuery', + 'filters' => 'setFilters', + 'facetFilters' => 'setFacetFilters', + 'optionalFilters' => 'setOptionalFilters', + 'numericFilters' => 'setNumericFilters', + 'tagFilters' => 'setTagFilters', + 'sumOrFiltersScores' => 'setSumOrFiltersScores', + 'facets' => 'setFacets', + 'maxValuesPerFacet' => 'setMaxValuesPerFacet', + 'facetingAfterDistinct' => 'setFacetingAfterDistinct', + 'sortFacetValuesBy' => 'setSortFacetValuesBy', + 'page' => 'setPage', + 'offset' => 'setOffset', + 'length' => 'setLength', + 'aroundLatLng' => 'setAroundLatLng', + 'aroundLatLngViaIP' => 'setAroundLatLngViaIP', + 'aroundRadius' => 'setAroundRadius', + 'aroundPrecision' => 'setAroundPrecision', + 'minimumAroundRadius' => 'setMinimumAroundRadius', + 'insideBoundingBox' => 'setInsideBoundingBox', + 'insidePolygon' => 'setInsidePolygon', + 'naturalLanguages' => 'setNaturalLanguages', + 'ruleContexts' => 'setRuleContexts', + 'personalizationImpact' => 'setPersonalizationImpact', + 'userToken' => 'setUserToken', + 'getRankingInfo' => 'setGetRankingInfo', + 'clickAnalytics' => 'setClickAnalytics', + 'analytics' => 'setAnalytics', + 'analyticsTags' => 'setAnalyticsTags', + 'percentileComputation' => 'setPercentileComputation', + 'enableABTest' => 'setEnableABTest', + 'enableReRanking' => 'setEnableReRanking', + 'query' => 'setQuery', + 'searchableAttributes' => 'setSearchableAttributes', + 'attributesForFaceting' => 'setAttributesForFaceting', + 'unretrievableAttributes' => 'setUnretrievableAttributes', + 'attributesToRetrieve' => 'setAttributesToRetrieve', + 'restrictSearchableAttributes' => 'setRestrictSearchableAttributes', + 'ranking' => 'setRanking', + 'customRanking' => 'setCustomRanking', + 'relevancyStrictness' => 'setRelevancyStrictness', + 'attributesToHighlight' => 'setAttributesToHighlight', + 'attributesToSnippet' => 'setAttributesToSnippet', + 'highlightPreTag' => 'setHighlightPreTag', + 'highlightPostTag' => 'setHighlightPostTag', + 'snippetEllipsisText' => 'setSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'setRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'setHitsPerPage', + 'minWordSizefor1Typo' => 'setMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'setMinWordSizefor2Typos', + 'typoTolerance' => 'setTypoTolerance', + 'allowTyposOnNumericTokens' => 'setAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'setDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'setSeparatorsToIndex', + 'ignorePlurals' => 'setIgnorePlurals', + 'removeStopWords' => 'setRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'setKeepDiacriticsOnCharacters', + 'queryLanguages' => 'setQueryLanguages', + 'decompoundQuery' => 'setDecompoundQuery', + 'enableRules' => 'setEnableRules', + 'enablePersonalization' => 'setEnablePersonalization', + 'queryType' => 'setQueryType', + 'removeWordsIfNoResults' => 'setRemoveWordsIfNoResults', + 'advancedSyntax' => 'setAdvancedSyntax', + 'optionalWords' => 'setOptionalWords', + 'disableExactOnAttributes' => 'setDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'setExactOnSingleWordQuery', + 'alternativesAsExact' => 'setAlternativesAsExact', + 'advancedSyntaxFeatures' => 'setAdvancedSyntaxFeatures', + 'distinct' => 'setDistinct', + 'synonyms' => 'setSynonyms', + 'replaceSynonymsInHighlight' => 'setReplaceSynonymsInHighlight', + 'minProximity' => 'setMinProximity', + 'responseFields' => 'setResponseFields', + 'maxFacetHits' => 'setMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'setAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'setRenderingContent', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'params' => 'getParams', + 'similarQuery' => 'getSimilarQuery', + 'filters' => 'getFilters', + 'facetFilters' => 'getFacetFilters', + 'optionalFilters' => 'getOptionalFilters', + 'numericFilters' => 'getNumericFilters', + 'tagFilters' => 'getTagFilters', + 'sumOrFiltersScores' => 'getSumOrFiltersScores', + 'facets' => 'getFacets', + 'maxValuesPerFacet' => 'getMaxValuesPerFacet', + 'facetingAfterDistinct' => 'getFacetingAfterDistinct', + 'sortFacetValuesBy' => 'getSortFacetValuesBy', + 'page' => 'getPage', + 'offset' => 'getOffset', + 'length' => 'getLength', + 'aroundLatLng' => 'getAroundLatLng', + 'aroundLatLngViaIP' => 'getAroundLatLngViaIP', + 'aroundRadius' => 'getAroundRadius', + 'aroundPrecision' => 'getAroundPrecision', + 'minimumAroundRadius' => 'getMinimumAroundRadius', + 'insideBoundingBox' => 'getInsideBoundingBox', + 'insidePolygon' => 'getInsidePolygon', + 'naturalLanguages' => 'getNaturalLanguages', + 'ruleContexts' => 'getRuleContexts', + 'personalizationImpact' => 'getPersonalizationImpact', + 'userToken' => 'getUserToken', + 'getRankingInfo' => 'getGetRankingInfo', + 'clickAnalytics' => 'getClickAnalytics', + 'analytics' => 'getAnalytics', + 'analyticsTags' => 'getAnalyticsTags', + 'percentileComputation' => 'getPercentileComputation', + 'enableABTest' => 'getEnableABTest', + 'enableReRanking' => 'getEnableReRanking', + 'query' => 'getQuery', + 'searchableAttributes' => 'getSearchableAttributes', + 'attributesForFaceting' => 'getAttributesForFaceting', + 'unretrievableAttributes' => 'getUnretrievableAttributes', + 'attributesToRetrieve' => 'getAttributesToRetrieve', + 'restrictSearchableAttributes' => 'getRestrictSearchableAttributes', + 'ranking' => 'getRanking', + 'customRanking' => 'getCustomRanking', + 'relevancyStrictness' => 'getRelevancyStrictness', + 'attributesToHighlight' => 'getAttributesToHighlight', + 'attributesToSnippet' => 'getAttributesToSnippet', + 'highlightPreTag' => 'getHighlightPreTag', + 'highlightPostTag' => 'getHighlightPostTag', + 'snippetEllipsisText' => 'getSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'getRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'getHitsPerPage', + 'minWordSizefor1Typo' => 'getMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'getMinWordSizefor2Typos', + 'typoTolerance' => 'getTypoTolerance', + 'allowTyposOnNumericTokens' => 'getAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'getDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'getSeparatorsToIndex', + 'ignorePlurals' => 'getIgnorePlurals', + 'removeStopWords' => 'getRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'getKeepDiacriticsOnCharacters', + 'queryLanguages' => 'getQueryLanguages', + 'decompoundQuery' => 'getDecompoundQuery', + 'enableRules' => 'getEnableRules', + 'enablePersonalization' => 'getEnablePersonalization', + 'queryType' => 'getQueryType', + 'removeWordsIfNoResults' => 'getRemoveWordsIfNoResults', + 'advancedSyntax' => 'getAdvancedSyntax', + 'optionalWords' => 'getOptionalWords', + 'disableExactOnAttributes' => 'getDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'getExactOnSingleWordQuery', + 'alternativesAsExact' => 'getAlternativesAsExact', + 'advancedSyntaxFeatures' => 'getAdvancedSyntaxFeatures', + 'distinct' => 'getDistinct', + 'synonyms' => 'getSynonyms', + 'replaceSynonymsInHighlight' => 'getReplaceSynonymsInHighlight', + 'minProximity' => 'getMinProximity', + 'responseFields' => 'getResponseFields', + 'maxFacetHits' => 'getMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'getAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'getRenderingContent', + ]; + + /** + * 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 TYPO_TOLERANCE_TRUE = 'true'; + const TYPO_TOLERANCE_FALSE = 'false'; + const TYPO_TOLERANCE_MIN = 'min'; + const TYPO_TOLERANCE_STRICT = 'strict'; + const QUERY_TYPE_PREFIX_LAST = 'prefixLast'; + const QUERY_TYPE_PREFIX_ALL = 'prefixAll'; + const QUERY_TYPE_PREFIX_NONE = 'prefixNone'; + const REMOVE_WORDS_IF_NO_RESULTS_NONE = 'none'; + const REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS = 'lastWords'; + const REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS = 'firstWords'; + const REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL = 'allOptional'; + const EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE = 'attribute'; + const EXACT_ON_SINGLE_WORD_QUERY_NONE = 'none'; + const EXACT_ON_SINGLE_WORD_QUERY_WORD = 'word'; + const ALTERNATIVES_AS_EXACT_IGNORE_PLURALS = 'ignorePlurals'; + const ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM = 'singleWordSynonym'; + const ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM = 'multiWordsSynonym'; + const ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE = 'exactPhrase'; + const ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS = 'excludeWords'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypoToleranceAllowableValues() + { + return [ + self::TYPO_TOLERANCE_TRUE, + self::TYPO_TOLERANCE_FALSE, + self::TYPO_TOLERANCE_MIN, + self::TYPO_TOLERANCE_STRICT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getQueryTypeAllowableValues() + { + return [ + self::QUERY_TYPE_PREFIX_LAST, + self::QUERY_TYPE_PREFIX_ALL, + self::QUERY_TYPE_PREFIX_NONE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRemoveWordsIfNoResultsAllowableValues() + { + return [ + self::REMOVE_WORDS_IF_NO_RESULTS_NONE, + self::REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExactOnSingleWordQueryAllowableValues() + { + return [ + self::EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE, + self::EXACT_ON_SINGLE_WORD_QUERY_NONE, + self::EXACT_ON_SINGLE_WORD_QUERY_WORD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativesAsExactAllowableValues() + { + return [ + self::ALTERNATIVES_AS_EXACT_IGNORE_PLURALS, + self::ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM, + self::ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAdvancedSyntaxFeaturesAllowableValues() + { + return [ + self::ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE, + self::ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS, + ]; + } + + /** + * 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['params'] = $data['params'] ?? ''; + $this->container['similarQuery'] = $data['similarQuery'] ?? ''; + $this->container['filters'] = $data['filters'] ?? ''; + $this->container['facetFilters'] = $data['facetFilters'] ?? null; + $this->container['optionalFilters'] = $data['optionalFilters'] ?? null; + $this->container['numericFilters'] = $data['numericFilters'] ?? null; + $this->container['tagFilters'] = $data['tagFilters'] ?? null; + $this->container['sumOrFiltersScores'] = $data['sumOrFiltersScores'] ?? false; + $this->container['facets'] = $data['facets'] ?? null; + $this->container['maxValuesPerFacet'] = $data['maxValuesPerFacet'] ?? 100; + $this->container['facetingAfterDistinct'] = $data['facetingAfterDistinct'] ?? false; + $this->container['sortFacetValuesBy'] = $data['sortFacetValuesBy'] ?? 'count'; + $this->container['page'] = $data['page'] ?? 0; + $this->container['offset'] = $data['offset'] ?? null; + $this->container['length'] = $data['length'] ?? null; + $this->container['aroundLatLng'] = $data['aroundLatLng'] ?? ''; + $this->container['aroundLatLngViaIP'] = $data['aroundLatLngViaIP'] ?? false; + $this->container['aroundRadius'] = $data['aroundRadius'] ?? null; + $this->container['aroundPrecision'] = $data['aroundPrecision'] ?? 10; + $this->container['minimumAroundRadius'] = $data['minimumAroundRadius'] ?? null; + $this->container['insideBoundingBox'] = $data['insideBoundingBox'] ?? null; + $this->container['insidePolygon'] = $data['insidePolygon'] ?? null; + $this->container['naturalLanguages'] = $data['naturalLanguages'] ?? null; + $this->container['ruleContexts'] = $data['ruleContexts'] ?? null; + $this->container['personalizationImpact'] = $data['personalizationImpact'] ?? 100; + $this->container['userToken'] = $data['userToken'] ?? null; + $this->container['getRankingInfo'] = $data['getRankingInfo'] ?? false; + $this->container['clickAnalytics'] = $data['clickAnalytics'] ?? false; + $this->container['analytics'] = $data['analytics'] ?? true; + $this->container['analyticsTags'] = $data['analyticsTags'] ?? null; + $this->container['percentileComputation'] = $data['percentileComputation'] ?? true; + $this->container['enableABTest'] = $data['enableABTest'] ?? true; + $this->container['enableReRanking'] = $data['enableReRanking'] ?? true; + $this->container['query'] = $data['query'] ?? ''; + $this->container['searchableAttributes'] = $data['searchableAttributes'] ?? null; + $this->container['attributesForFaceting'] = $data['attributesForFaceting'] ?? null; + $this->container['unretrievableAttributes'] = $data['unretrievableAttributes'] ?? null; + $this->container['attributesToRetrieve'] = $data['attributesToRetrieve'] ?? null; + $this->container['restrictSearchableAttributes'] = $data['restrictSearchableAttributes'] ?? null; + $this->container['ranking'] = $data['ranking'] ?? null; + $this->container['customRanking'] = $data['customRanking'] ?? null; + $this->container['relevancyStrictness'] = $data['relevancyStrictness'] ?? 100; + $this->container['attributesToHighlight'] = $data['attributesToHighlight'] ?? null; + $this->container['attributesToSnippet'] = $data['attributesToSnippet'] ?? null; + $this->container['highlightPreTag'] = $data['highlightPreTag'] ?? ''; + $this->container['highlightPostTag'] = $data['highlightPostTag'] ?? ''; + $this->container['snippetEllipsisText'] = $data['snippetEllipsisText'] ?? '…'; + $this->container['restrictHighlightAndSnippetArrays'] = $data['restrictHighlightAndSnippetArrays'] ?? false; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + $this->container['minWordSizefor1Typo'] = $data['minWordSizefor1Typo'] ?? 4; + $this->container['minWordSizefor2Typos'] = $data['minWordSizefor2Typos'] ?? 8; + $this->container['typoTolerance'] = $data['typoTolerance'] ?? 'true'; + $this->container['allowTyposOnNumericTokens'] = $data['allowTyposOnNumericTokens'] ?? true; + $this->container['disableTypoToleranceOnAttributes'] = $data['disableTypoToleranceOnAttributes'] ?? null; + $this->container['separatorsToIndex'] = $data['separatorsToIndex'] ?? ''; + $this->container['ignorePlurals'] = $data['ignorePlurals'] ?? 'false'; + $this->container['removeStopWords'] = $data['removeStopWords'] ?? 'false'; + $this->container['keepDiacriticsOnCharacters'] = $data['keepDiacriticsOnCharacters'] ?? ''; + $this->container['queryLanguages'] = $data['queryLanguages'] ?? null; + $this->container['decompoundQuery'] = $data['decompoundQuery'] ?? true; + $this->container['enableRules'] = $data['enableRules'] ?? true; + $this->container['enablePersonalization'] = $data['enablePersonalization'] ?? false; + $this->container['queryType'] = $data['queryType'] ?? 'prefixLast'; + $this->container['removeWordsIfNoResults'] = $data['removeWordsIfNoResults'] ?? 'none'; + $this->container['advancedSyntax'] = $data['advancedSyntax'] ?? false; + $this->container['optionalWords'] = $data['optionalWords'] ?? null; + $this->container['disableExactOnAttributes'] = $data['disableExactOnAttributes'] ?? null; + $this->container['exactOnSingleWordQuery'] = $data['exactOnSingleWordQuery'] ?? 'attribute'; + $this->container['alternativesAsExact'] = $data['alternativesAsExact'] ?? null; + $this->container['advancedSyntaxFeatures'] = $data['advancedSyntaxFeatures'] ?? null; + $this->container['distinct'] = $data['distinct'] ?? 0; + $this->container['synonyms'] = $data['synonyms'] ?? true; + $this->container['replaceSynonymsInHighlight'] = $data['replaceSynonymsInHighlight'] ?? false; + $this->container['minProximity'] = $data['minProximity'] ?? 1; + $this->container['responseFields'] = $data['responseFields'] ?? null; + $this->container['maxFacetHits'] = $data['maxFacetHits'] ?? 10; + $this->container['attributeCriteriaComputedByMinProximity'] = $data['attributeCriteriaComputedByMinProximity'] ?? false; + $this->container['renderingContent'] = $data['renderingContent'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['length']) && ($this->container['length'] > 1000)) { + $invalidProperties[] = "invalid value for 'length', must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['length']) && ($this->container['length'] < 1)) { + $invalidProperties[] = "invalid value for 'length', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['minimumAroundRadius']) && ($this->container['minimumAroundRadius'] < 1)) { + $invalidProperties[] = "invalid value for 'minimumAroundRadius', must be bigger than or equal to 1."; + } + + if ($this->container['query'] === null) { + $invalidProperties[] = "'query' can't be null"; + } + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($this->container['typoTolerance']) && !in_array($this->container['typoTolerance'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'typoTolerance', must be one of '%s'", + $this->container['typoTolerance'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($this->container['queryType']) && !in_array($this->container['queryType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'queryType', must be one of '%s'", + $this->container['queryType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($this->container['removeWordsIfNoResults']) && !in_array($this->container['removeWordsIfNoResults'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $this->container['removeWordsIfNoResults'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($this->container['exactOnSingleWordQuery']) && !in_array($this->container['exactOnSingleWordQuery'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $this->container['exactOnSingleWordQuery'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] > 4)) { + $invalidProperties[] = "invalid value for 'distinct', must be smaller than or equal to 4."; + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] < 0)) { + $invalidProperties[] = "invalid value for 'distinct', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] > 7)) { + $invalidProperties[] = "invalid value for 'minProximity', must be smaller than or equal to 7."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] < 1)) { + $invalidProperties[] = "invalid value for 'minProximity', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['maxFacetHits']) && ($this->container['maxFacetHits'] > 100)) { + $invalidProperties[] = "invalid value for 'maxFacetHits', must be smaller than or equal to 100."; + } + + 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 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 + * + * @return string|null + */ + public function getSimilarQuery() + { + return $this->container['similarQuery']; + } + + /** + * Sets similarQuery + * + * @param string|null $similarQuery overrides the query parameter and performs a more generic search that can be used to find \"similar\" results + * + * @return self + */ + public function setSimilarQuery($similarQuery) + { + $this->container['similarQuery'] = $similarQuery; + + return $this; + } + + /** + * Gets filters + * + * @return string|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param string|null $filters filter the query with numeric, facet and/or tag filters + * + * @return self + */ + public function setFilters($filters) + { + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets facetFilters + * + * @return string[]|null + */ + public function getFacetFilters() + { + return $this->container['facetFilters']; + } + + /** + * Sets facetFilters + * + * @param string[]|null $facetFilters filter hits by facet value + * + * @return self + */ + public function setFacetFilters($facetFilters) + { + $this->container['facetFilters'] = $facetFilters; + + return $this; + } + + /** + * Gets optionalFilters + * + * @return string[]|null + */ + public function getOptionalFilters() + { + return $this->container['optionalFilters']; + } + + /** + * Sets optionalFilters + * + * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * + * @return self + */ + public function setOptionalFilters($optionalFilters) + { + $this->container['optionalFilters'] = $optionalFilters; + + return $this; + } + + /** + * Gets numericFilters + * + * @return string[]|null + */ + public function getNumericFilters() + { + return $this->container['numericFilters']; + } + + /** + * Sets numericFilters + * + * @param string[]|null $numericFilters filter on numeric attributes + * + * @return self + */ + public function setNumericFilters($numericFilters) + { + $this->container['numericFilters'] = $numericFilters; + + return $this; + } + + /** + * Gets tagFilters + * + * @return string[]|null + */ + public function getTagFilters() + { + return $this->container['tagFilters']; + } + + /** + * Sets tagFilters + * + * @param string[]|null $tagFilters filter hits by tags + * + * @return self + */ + public function setTagFilters($tagFilters) + { + $this->container['tagFilters'] = $tagFilters; + + return $this; + } + + /** + * Gets sumOrFiltersScores + * + * @return bool|null + */ + public function getSumOrFiltersScores() + { + return $this->container['sumOrFiltersScores']; + } + + /** + * Sets sumOrFiltersScores + * + * @param bool|null $sumOrFiltersScores determines how to calculate the total score for filtering + * + * @return self + */ + public function setSumOrFiltersScores($sumOrFiltersScores) + { + $this->container['sumOrFiltersScores'] = $sumOrFiltersScores; + + return $this; + } + + /** + * Gets facets + * + * @return string[]|null + */ + public function getFacets() + { + return $this->container['facets']; + } + + /** + * Sets facets + * + * @param string[]|null $facets retrieve facets and their facet values + * + * @return self + */ + public function setFacets($facets) + { + $this->container['facets'] = $facets; + + return $this; + } + + /** + * Gets maxValuesPerFacet + * + * @return int|null + */ + public function getMaxValuesPerFacet() + { + return $this->container['maxValuesPerFacet']; + } + + /** + * Sets maxValuesPerFacet + * + * @param int|null $maxValuesPerFacet maximum number of facet values to return for each facet during a regular search + * + * @return self + */ + public function setMaxValuesPerFacet($maxValuesPerFacet) + { + $this->container['maxValuesPerFacet'] = $maxValuesPerFacet; + + return $this; + } + + /** + * Gets facetingAfterDistinct + * + * @return bool|null + */ + public function getFacetingAfterDistinct() + { + return $this->container['facetingAfterDistinct']; + } + + /** + * Sets facetingAfterDistinct + * + * @param bool|null $facetingAfterDistinct force faceting to be applied after de-duplication (via the Distinct setting) + * + * @return self + */ + public function setFacetingAfterDistinct($facetingAfterDistinct) + { + $this->container['facetingAfterDistinct'] = $facetingAfterDistinct; + + return $this; + } + + /** + * Gets sortFacetValuesBy + * + * @return string|null + */ + public function getSortFacetValuesBy() + { + return $this->container['sortFacetValuesBy']; + } + + /** + * Sets sortFacetValuesBy + * + * @param string|null $sortFacetValuesBy controls how facet values are fetched + * + * @return self + */ + public function setSortFacetValuesBy($sortFacetValuesBy) + { + $this->container['sortFacetValuesBy'] = $sortFacetValuesBy; + + return $this; + } + + /** + * Gets page + * + * @return int|null + */ + public function getPage() + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param int|null $page specify the page to retrieve + * + * @return self + */ + public function setPage($page) + { + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets offset + * + * @return int|null + */ + public function getOffset() + { + return $this->container['offset']; + } + + /** + * Sets offset + * + * @param int|null $offset specify the offset of the first hit to return + * + * @return self + */ + public function setOffset($offset) + { + $this->container['offset'] = $offset; + + return $this; + } + + /** + * Gets length + * + * @return int|null + */ + public function getLength() + { + return $this->container['length']; + } + + /** + * Sets length + * + * @param int|null $length set the number of hits to retrieve (used only with offset) + * + * @return self + */ + public function setLength($length) + { + if (!is_null($length) && ($length > 1000)) { + throw new \InvalidArgumentException('invalid value for $length when calling SearchParams., must be smaller than or equal to 1000.'); + } + if (!is_null($length) && ($length < 1)) { + throw new \InvalidArgumentException('invalid value for $length when calling SearchParams., must be bigger than or equal to 1.'); + } + + $this->container['length'] = $length; + + return $this; + } + + /** + * Gets aroundLatLng + * + * @return string|null + */ + public function getAroundLatLng() + { + return $this->container['aroundLatLng']; + } + + /** + * Sets aroundLatLng + * + * @param string|null $aroundLatLng search for entries around a central geolocation, enabling a geo search within a circular area + * + * @return self + */ + public function setAroundLatLng($aroundLatLng) + { + $this->container['aroundLatLng'] = $aroundLatLng; + + return $this; + } + + /** + * Gets aroundLatLngViaIP + * + * @return bool|null + */ + public function getAroundLatLngViaIP() + { + return $this->container['aroundLatLngViaIP']; + } + + /** + * Sets aroundLatLngViaIP + * + * @param bool|null $aroundLatLngViaIP search for entries around a given location automatically computed from the requester's IP address + * + * @return self + */ + public function setAroundLatLngViaIP($aroundLatLngViaIP) + { + $this->container['aroundLatLngViaIP'] = $aroundLatLngViaIP; + + return $this; + } + + /** + * Gets aroundRadius + * + * @return OneOfIntegerString|null + */ + public function getAroundRadius() + { + return $this->container['aroundRadius']; + } + + /** + * Sets aroundRadius + * + * @param OneOfIntegerString|null $aroundRadius define the maximum radius for a geo search (in meters) + * + * @return self + */ + public function setAroundRadius($aroundRadius) + { + $this->container['aroundRadius'] = $aroundRadius; + + return $this; + } + + /** + * Gets aroundPrecision + * + * @return int|null + */ + public function getAroundPrecision() + { + return $this->container['aroundPrecision']; + } + + /** + * Sets aroundPrecision + * + * @param int|null $aroundPrecision precision of geo search (in meters), to add grouping by geo location to the ranking formula + * + * @return self + */ + public function setAroundPrecision($aroundPrecision) + { + $this->container['aroundPrecision'] = $aroundPrecision; + + return $this; + } + + /** + * Gets minimumAroundRadius + * + * @return int|null + */ + public function getMinimumAroundRadius() + { + return $this->container['minimumAroundRadius']; + } + + /** + * Sets minimumAroundRadius + * + * @param int|null $minimumAroundRadius minimum radius (in meters) used for a geo search when aroundRadius is not set + * + * @return self + */ + public function setMinimumAroundRadius($minimumAroundRadius) + { + if (!is_null($minimumAroundRadius) && ($minimumAroundRadius < 1)) { + throw new \InvalidArgumentException('invalid value for $minimumAroundRadius when calling SearchParams., must be bigger than or equal to 1.'); + } + + $this->container['minimumAroundRadius'] = $minimumAroundRadius; + + return $this; + } + + /** + * Gets insideBoundingBox + * + * @return float[]|null + */ + public function getInsideBoundingBox() + { + return $this->container['insideBoundingBox']; + } + + /** + * Sets insideBoundingBox + * + * @param float[]|null $insideBoundingBox search inside a rectangular area (in geo coordinates) + * + * @return self + */ + public function setInsideBoundingBox($insideBoundingBox) + { + $this->container['insideBoundingBox'] = $insideBoundingBox; + + return $this; + } + + /** + * Gets insidePolygon + * + * @return float[]|null + */ + public function getInsidePolygon() + { + return $this->container['insidePolygon']; + } + + /** + * Sets insidePolygon + * + * @param float[]|null $insidePolygon search inside a polygon (in geo coordinates) + * + * @return self + */ + public function setInsidePolygon($insidePolygon) + { + $this->container['insidePolygon'] = $insidePolygon; + + return $this; + } + + /** + * Gets naturalLanguages + * + * @return string[]|null + */ + public function getNaturalLanguages() + { + return $this->container['naturalLanguages']; + } + + /** + * Sets naturalLanguages + * + * @param string[]|null $naturalLanguages This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. + * + * @return self + */ + public function setNaturalLanguages($naturalLanguages) + { + $this->container['naturalLanguages'] = $naturalLanguages; + + return $this; + } + + /** + * Gets ruleContexts + * + * @return string[]|null + */ + public function getRuleContexts() + { + return $this->container['ruleContexts']; + } + + /** + * Sets ruleContexts + * + * @param string[]|null $ruleContexts enables contextual rules + * + * @return self + */ + public function setRuleContexts($ruleContexts) + { + $this->container['ruleContexts'] = $ruleContexts; + + return $this; + } + + /** + * Gets personalizationImpact + * + * @return int|null + */ + public function getPersonalizationImpact() + { + return $this->container['personalizationImpact']; + } + + /** + * Sets personalizationImpact + * + * @param int|null $personalizationImpact define the impact of the Personalization feature + * + * @return self + */ + public function setPersonalizationImpact($personalizationImpact) + { + $this->container['personalizationImpact'] = $personalizationImpact; + + return $this; + } + + /** + * Gets userToken + * + * @return string|null + */ + public function getUserToken() + { + return $this->container['userToken']; + } + + /** + * Sets userToken + * + * @param string|null $userToken associates a certain user token with the current search + * + * @return self + */ + public function setUserToken($userToken) + { + $this->container['userToken'] = $userToken; + + return $this; + } + + /** + * Gets getRankingInfo + * + * @return bool|null + */ + public function getGetRankingInfo() + { + return $this->container['getRankingInfo']; + } + + /** + * Sets getRankingInfo + * + * @param bool|null $getRankingInfo retrieve detailed ranking information + * + * @return self + */ + public function setGetRankingInfo($getRankingInfo) + { + $this->container['getRankingInfo'] = $getRankingInfo; + + return $this; + } + + /** + * Gets clickAnalytics + * + * @return bool|null + */ + public function getClickAnalytics() + { + return $this->container['clickAnalytics']; + } + + /** + * Sets clickAnalytics + * + * @param bool|null $clickAnalytics enable the Click Analytics feature + * + * @return self + */ + public function setClickAnalytics($clickAnalytics) + { + $this->container['clickAnalytics'] = $clickAnalytics; + + return $this; + } + + /** + * Gets analytics + * + * @return bool|null + */ + public function getAnalytics() + { + return $this->container['analytics']; + } + + /** + * Sets analytics + * + * @param bool|null $analytics whether the current query will be taken into account in the Analytics + * + * @return self + */ + public function setAnalytics($analytics) + { + $this->container['analytics'] = $analytics; + + return $this; + } + + /** + * Gets analyticsTags + * + * @return string[]|null + */ + public function getAnalyticsTags() + { + return $this->container['analyticsTags']; + } + + /** + * Sets analyticsTags + * + * @param string[]|null $analyticsTags list of tags to apply to the query for analytics purposes + * + * @return self + */ + public function setAnalyticsTags($analyticsTags) + { + $this->container['analyticsTags'] = $analyticsTags; + + return $this; + } + + /** + * Gets percentileComputation + * + * @return bool|null + */ + public function getPercentileComputation() + { + return $this->container['percentileComputation']; + } + + /** + * Sets percentileComputation + * + * @param bool|null $percentileComputation whether to include or exclude a query from the processing-time percentile computation + * + * @return self + */ + public function setPercentileComputation($percentileComputation) + { + $this->container['percentileComputation'] = $percentileComputation; + + return $this; + } + + /** + * Gets enableABTest + * + * @return bool|null + */ + public function getEnableABTest() + { + return $this->container['enableABTest']; + } + + /** + * Sets enableABTest + * + * @param bool|null $enableABTest whether this search should participate in running AB tests + * + * @return self + */ + public function setEnableABTest($enableABTest) + { + $this->container['enableABTest'] = $enableABTest; + + return $this; + } + + /** + * Gets enableReRanking + * + * @return bool|null + */ + public function getEnableReRanking() + { + return $this->container['enableReRanking']; + } + + /** + * Sets enableReRanking + * + * @param bool|null $enableReRanking whether this search should use AI Re-Ranking + * + * @return self + */ + public function setEnableReRanking($enableReRanking) + { + $this->container['enableReRanking'] = $enableReRanking; + + 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 searchableAttributes + * + * @return string[]|null + */ + public function getSearchableAttributes() + { + return $this->container['searchableAttributes']; + } + + /** + * Sets searchableAttributes + * + * @param string[]|null $searchableAttributes the complete list of attributes used for searching + * + * @return self + */ + public function setSearchableAttributes($searchableAttributes) + { + $this->container['searchableAttributes'] = $searchableAttributes; + + return $this; + } + + /** + * Gets attributesForFaceting + * + * @return string[]|null + */ + public function getAttributesForFaceting() + { + return $this->container['attributesForFaceting']; + } + + /** + * Sets attributesForFaceting + * + * @param string[]|null $attributesForFaceting the complete list of attributes that will be used for faceting + * + * @return self + */ + public function setAttributesForFaceting($attributesForFaceting) + { + $this->container['attributesForFaceting'] = $attributesForFaceting; + + return $this; + } + + /** + * Gets unretrievableAttributes + * + * @return string[]|null + */ + public function getUnretrievableAttributes() + { + return $this->container['unretrievableAttributes']; + } + + /** + * Sets unretrievableAttributes + * + * @param string[]|null $unretrievableAttributes list of attributes that can't be retrieved at query time + * + * @return self + */ + public function setUnretrievableAttributes($unretrievableAttributes) + { + $this->container['unretrievableAttributes'] = $unretrievableAttributes; + + return $this; + } + + /** + * Gets attributesToRetrieve + * + * @return string[]|null + */ + public function getAttributesToRetrieve() + { + return $this->container['attributesToRetrieve']; + } + + /** + * Sets attributesToRetrieve + * + * @param string[]|null $attributesToRetrieve this parameter controls which attributes to retrieve and which not to retrieve + * + * @return self + */ + public function setAttributesToRetrieve($attributesToRetrieve) + { + $this->container['attributesToRetrieve'] = $attributesToRetrieve; + + return $this; + } + + /** + * Gets restrictSearchableAttributes + * + * @return string[]|null + */ + public function getRestrictSearchableAttributes() + { + return $this->container['restrictSearchableAttributes']; + } + + /** + * Sets restrictSearchableAttributes + * + * @param string[]|null $restrictSearchableAttributes restricts a given query to look in only a subset of your searchable attributes + * + * @return self + */ + public function setRestrictSearchableAttributes($restrictSearchableAttributes) + { + $this->container['restrictSearchableAttributes'] = $restrictSearchableAttributes; + + return $this; + } + + /** + * Gets ranking + * + * @return string[]|null + */ + public function getRanking() + { + return $this->container['ranking']; + } + + /** + * Sets ranking + * + * @param string[]|null $ranking controls how Algolia should sort your results + * + * @return self + */ + public function setRanking($ranking) + { + $this->container['ranking'] = $ranking; + + return $this; + } + + /** + * Gets customRanking + * + * @return string[]|null + */ + public function getCustomRanking() + { + return $this->container['customRanking']; + } + + /** + * Sets customRanking + * + * @param string[]|null $customRanking specifies the custom ranking criterion + * + * @return self + */ + public function setCustomRanking($customRanking) + { + $this->container['customRanking'] = $customRanking; + + return $this; + } + + /** + * Gets relevancyStrictness + * + * @return int|null + */ + public function getRelevancyStrictness() + { + return $this->container['relevancyStrictness']; + } + + /** + * Sets relevancyStrictness + * + * @param int|null $relevancyStrictness controls the relevancy threshold below which less relevant results aren't included in the results + * + * @return self + */ + public function setRelevancyStrictness($relevancyStrictness) + { + $this->container['relevancyStrictness'] = $relevancyStrictness; + + return $this; + } + + /** + * Gets attributesToHighlight + * + * @return string[]|null + */ + public function getAttributesToHighlight() + { + return $this->container['attributesToHighlight']; + } + + /** + * Sets attributesToHighlight + * + * @param string[]|null $attributesToHighlight list of attributes to highlight + * + * @return self + */ + public function setAttributesToHighlight($attributesToHighlight) + { + $this->container['attributesToHighlight'] = $attributesToHighlight; + + return $this; + } + + /** + * Gets attributesToSnippet + * + * @return string[]|null + */ + public function getAttributesToSnippet() + { + return $this->container['attributesToSnippet']; + } + + /** + * Sets attributesToSnippet + * + * @param string[]|null $attributesToSnippet list of attributes to snippet, with an optional maximum number of words to snippet + * + * @return self + */ + public function setAttributesToSnippet($attributesToSnippet) + { + $this->container['attributesToSnippet'] = $attributesToSnippet; + + return $this; + } + + /** + * Gets highlightPreTag + * + * @return string|null + */ + public function getHighlightPreTag() + { + return $this->container['highlightPreTag']; + } + + /** + * Sets highlightPreTag + * + * @param string|null $highlightPreTag the HTML string to insert before the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPreTag($highlightPreTag) + { + $this->container['highlightPreTag'] = $highlightPreTag; + + return $this; + } + + /** + * Gets highlightPostTag + * + * @return string|null + */ + public function getHighlightPostTag() + { + return $this->container['highlightPostTag']; + } + + /** + * Sets highlightPostTag + * + * @param string|null $highlightPostTag the HTML string to insert after the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPostTag($highlightPostTag) + { + $this->container['highlightPostTag'] = $highlightPostTag; + + return $this; + } + + /** + * Gets snippetEllipsisText + * + * @return string|null + */ + public function getSnippetEllipsisText() + { + return $this->container['snippetEllipsisText']; + } + + /** + * Sets snippetEllipsisText + * + * @param string|null $snippetEllipsisText string used as an ellipsis indicator when a snippet is truncated + * + * @return self + */ + public function setSnippetEllipsisText($snippetEllipsisText) + { + $this->container['snippetEllipsisText'] = $snippetEllipsisText; + + return $this; + } + + /** + * Gets restrictHighlightAndSnippetArrays + * + * @return bool|null + */ + public function getRestrictHighlightAndSnippetArrays() + { + return $this->container['restrictHighlightAndSnippetArrays']; + } + + /** + * Sets restrictHighlightAndSnippetArrays + * + * @param bool|null $restrictHighlightAndSnippetArrays restrict highlighting and snippeting to items that matched the query + * + * @return self + */ + public function setRestrictHighlightAndSnippetArrays($restrictHighlightAndSnippetArrays) + { + $this->container['restrictHighlightAndSnippetArrays'] = $restrictHighlightAndSnippetArrays; + + return $this; + } + + /** + * Gets hitsPerPage + * + * @return int|null + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int|null $hitsPerPage set the number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Gets minWordSizefor1Typo + * + * @return int|null + */ + public function getMinWordSizefor1Typo() + { + return $this->container['minWordSizefor1Typo']; + } + + /** + * Sets minWordSizefor1Typo + * + * @param int|null $minWordSizefor1Typo minimum number of characters a word in the query string must contain to accept matches with 1 typo + * + * @return self + */ + public function setMinWordSizefor1Typo($minWordSizefor1Typo) + { + $this->container['minWordSizefor1Typo'] = $minWordSizefor1Typo; + + return $this; + } + + /** + * Gets minWordSizefor2Typos + * + * @return int|null + */ + public function getMinWordSizefor2Typos() + { + return $this->container['minWordSizefor2Typos']; + } + + /** + * Sets minWordSizefor2Typos + * + * @param int|null $minWordSizefor2Typos minimum number of characters a word in the query string must contain to accept matches with 2 typos + * + * @return self + */ + public function setMinWordSizefor2Typos($minWordSizefor2Typos) + { + $this->container['minWordSizefor2Typos'] = $minWordSizefor2Typos; + + return $this; + } + + /** + * Gets typoTolerance + * + * @return string|null + */ + public function getTypoTolerance() + { + return $this->container['typoTolerance']; + } + + /** + * Sets typoTolerance + * + * @param string|null $typoTolerance controls whether typo tolerance is enabled and how it is applied + * + * @return self + */ + public function setTypoTolerance($typoTolerance) + { + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($typoTolerance) && !in_array($typoTolerance, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'typoTolerance', must be one of '%s'", + $typoTolerance, + implode("', '", $allowedValues) + ) + ); + } + $this->container['typoTolerance'] = $typoTolerance; + + return $this; + } + + /** + * Gets allowTyposOnNumericTokens + * + * @return bool|null + */ + public function getAllowTyposOnNumericTokens() + { + return $this->container['allowTyposOnNumericTokens']; + } + + /** + * Sets allowTyposOnNumericTokens + * + * @param bool|null $allowTyposOnNumericTokens whether to allow typos on numbers (\"numeric tokens\") in the query string + * + * @return self + */ + public function setAllowTyposOnNumericTokens($allowTyposOnNumericTokens) + { + $this->container['allowTyposOnNumericTokens'] = $allowTyposOnNumericTokens; + + return $this; + } + + /** + * Gets disableTypoToleranceOnAttributes + * + * @return string[]|null + */ + public function getDisableTypoToleranceOnAttributes() + { + return $this->container['disableTypoToleranceOnAttributes']; + } + + /** + * Sets disableTypoToleranceOnAttributes + * + * @param string[]|null $disableTypoToleranceOnAttributes list of attributes on which you want to disable typo tolerance + * + * @return self + */ + public function setDisableTypoToleranceOnAttributes($disableTypoToleranceOnAttributes) + { + $this->container['disableTypoToleranceOnAttributes'] = $disableTypoToleranceOnAttributes; + + return $this; + } + + /** + * Gets separatorsToIndex + * + * @return string|null + */ + public function getSeparatorsToIndex() + { + return $this->container['separatorsToIndex']; + } + + /** + * Sets separatorsToIndex + * + * @param string|null $separatorsToIndex control which separators are indexed + * + * @return self + */ + public function setSeparatorsToIndex($separatorsToIndex) + { + $this->container['separatorsToIndex'] = $separatorsToIndex; + + return $this; + } + + /** + * Gets ignorePlurals + * + * @return string|null + */ + public function getIgnorePlurals() + { + return $this->container['ignorePlurals']; + } + + /** + * Sets ignorePlurals + * + * @param string|null $ignorePlurals treats singular, plurals, and other forms of declensions as matching terms + * + * @return self + */ + public function setIgnorePlurals($ignorePlurals) + { + $this->container['ignorePlurals'] = $ignorePlurals; + + return $this; + } + + /** + * Gets removeStopWords + * + * @return string|null + */ + public function getRemoveStopWords() + { + return $this->container['removeStopWords']; + } + + /** + * Sets removeStopWords + * + * @param string|null $removeStopWords removes stop (common) words from the query before executing it + * + * @return self + */ + public function setRemoveStopWords($removeStopWords) + { + $this->container['removeStopWords'] = $removeStopWords; + + return $this; + } + + /** + * Gets keepDiacriticsOnCharacters + * + * @return string|null + */ + public function getKeepDiacriticsOnCharacters() + { + return $this->container['keepDiacriticsOnCharacters']; + } + + /** + * Sets keepDiacriticsOnCharacters + * + * @param string|null $keepDiacriticsOnCharacters list of characters that the engine shouldn't automatically normalize + * + * @return self + */ + public function setKeepDiacriticsOnCharacters($keepDiacriticsOnCharacters) + { + $this->container['keepDiacriticsOnCharacters'] = $keepDiacriticsOnCharacters; + + return $this; + } + + /** + * Gets queryLanguages + * + * @return string[]|null + */ + public function getQueryLanguages() + { + return $this->container['queryLanguages']; + } + + /** + * Sets queryLanguages + * + * @param string[]|null $queryLanguages sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection + * + * @return self + */ + public function setQueryLanguages($queryLanguages) + { + $this->container['queryLanguages'] = $queryLanguages; + + return $this; + } + + /** + * Gets decompoundQuery + * + * @return bool|null + */ + public function getDecompoundQuery() + { + return $this->container['decompoundQuery']; + } + + /** + * Sets decompoundQuery + * + * @param bool|null $decompoundQuery splits compound words into their composing atoms in the query + * + * @return self + */ + public function setDecompoundQuery($decompoundQuery) + { + $this->container['decompoundQuery'] = $decompoundQuery; + + return $this; + } + + /** + * Gets enableRules + * + * @return bool|null + */ + public function getEnableRules() + { + return $this->container['enableRules']; + } + + /** + * Sets enableRules + * + * @param bool|null $enableRules whether Rules should be globally enabled + * + * @return self + */ + public function setEnableRules($enableRules) + { + $this->container['enableRules'] = $enableRules; + + return $this; + } + + /** + * Gets enablePersonalization + * + * @return bool|null + */ + public function getEnablePersonalization() + { + return $this->container['enablePersonalization']; + } + + /** + * Sets enablePersonalization + * + * @param bool|null $enablePersonalization enable the Personalization feature + * + * @return self + */ + public function setEnablePersonalization($enablePersonalization) + { + $this->container['enablePersonalization'] = $enablePersonalization; + + return $this; + } + + /** + * Gets queryType + * + * @return string|null + */ + public function getQueryType() + { + return $this->container['queryType']; + } + + /** + * Sets queryType + * + * @param string|null $queryType controls if and how query words are interpreted as prefixes + * + * @return self + */ + public function setQueryType($queryType) + { + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($queryType) && !in_array($queryType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'queryType', must be one of '%s'", + $queryType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['queryType'] = $queryType; + + return $this; + } + + /** + * Gets removeWordsIfNoResults + * + * @return string|null + */ + public function getRemoveWordsIfNoResults() + { + return $this->container['removeWordsIfNoResults']; + } + + /** + * Sets removeWordsIfNoResults + * + * @param string|null $removeWordsIfNoResults selects a strategy to remove words from the query when it doesn't match any hits + * + * @return self + */ + public function setRemoveWordsIfNoResults($removeWordsIfNoResults) + { + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($removeWordsIfNoResults) && !in_array($removeWordsIfNoResults, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $removeWordsIfNoResults, + implode("', '", $allowedValues) + ) + ); + } + $this->container['removeWordsIfNoResults'] = $removeWordsIfNoResults; + + return $this; + } + + /** + * Gets advancedSyntax + * + * @return bool|null + */ + public function getAdvancedSyntax() + { + return $this->container['advancedSyntax']; + } + + /** + * Sets advancedSyntax + * + * @param bool|null $advancedSyntax enables the advanced query syntax + * + * @return self + */ + public function setAdvancedSyntax($advancedSyntax) + { + $this->container['advancedSyntax'] = $advancedSyntax; + + return $this; + } + + /** + * Gets optionalWords + * + * @return string[]|null + */ + public function getOptionalWords() + { + return $this->container['optionalWords']; + } + + /** + * Sets optionalWords + * + * @param string[]|null $optionalWords a list of words that should be considered as optional when found in the query + * + * @return self + */ + public function setOptionalWords($optionalWords) + { + $this->container['optionalWords'] = $optionalWords; + + return $this; + } + + /** + * Gets disableExactOnAttributes + * + * @return string[]|null + */ + public function getDisableExactOnAttributes() + { + return $this->container['disableExactOnAttributes']; + } + + /** + * Sets disableExactOnAttributes + * + * @param string[]|null $disableExactOnAttributes list of attributes on which you want to disable the exact ranking criterion + * + * @return self + */ + public function setDisableExactOnAttributes($disableExactOnAttributes) + { + $this->container['disableExactOnAttributes'] = $disableExactOnAttributes; + + return $this; + } + + /** + * Gets exactOnSingleWordQuery + * + * @return string|null + */ + public function getExactOnSingleWordQuery() + { + return $this->container['exactOnSingleWordQuery']; + } + + /** + * Sets exactOnSingleWordQuery + * + * @param string|null $exactOnSingleWordQuery controls how the exact ranking criterion is computed when the query contains only one word + * + * @return self + */ + public function setExactOnSingleWordQuery($exactOnSingleWordQuery) + { + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($exactOnSingleWordQuery) && !in_array($exactOnSingleWordQuery, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $exactOnSingleWordQuery, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exactOnSingleWordQuery'] = $exactOnSingleWordQuery; + + return $this; + } + + /** + * Gets alternativesAsExact + * + * @return string[]|null + */ + public function getAlternativesAsExact() + { + return $this->container['alternativesAsExact']; + } + + /** + * Sets alternativesAsExact + * + * @param string[]|null $alternativesAsExact list of alternatives that should be considered an exact match by the exact ranking criterion + * + * @return self + */ + public function setAlternativesAsExact($alternativesAsExact) + { + $allowedValues = $this->getAlternativesAsExactAllowableValues(); + if (!is_null($alternativesAsExact) && array_diff($alternativesAsExact, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternativesAsExact', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternativesAsExact'] = $alternativesAsExact; + + return $this; + } + + /** + * Gets advancedSyntaxFeatures + * + * @return string[]|null + */ + public function getAdvancedSyntaxFeatures() + { + return $this->container['advancedSyntaxFeatures']; + } + + /** + * Sets advancedSyntaxFeatures + * + * @param string[]|null $advancedSyntaxFeatures allows you to specify which advanced syntax features are active when ‘advancedSyntax' is enabled + * + * @return self + */ + public function setAdvancedSyntaxFeatures($advancedSyntaxFeatures) + { + $allowedValues = $this->getAdvancedSyntaxFeaturesAllowableValues(); + if (!is_null($advancedSyntaxFeatures) && array_diff($advancedSyntaxFeatures, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'advancedSyntaxFeatures', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['advancedSyntaxFeatures'] = $advancedSyntaxFeatures; + + return $this; + } + + /** + * Gets distinct + * + * @return int|null + */ + public function getDistinct() + { + return $this->container['distinct']; + } + + /** + * Sets distinct + * + * @param int|null $distinct enables de-duplication or grouping of results + * + * @return self + */ + public function setDistinct($distinct) + { + if (!is_null($distinct) && ($distinct > 4)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling SearchParams., must be smaller than or equal to 4.'); + } + if (!is_null($distinct) && ($distinct < 0)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling SearchParams., must be bigger than or equal to 0.'); + } + + $this->container['distinct'] = $distinct; + + return $this; + } + + /** + * Gets synonyms + * + * @return bool|null + */ + public function getSynonyms() + { + return $this->container['synonyms']; + } + + /** + * Sets synonyms + * + * @param bool|null $synonyms whether to take into account an index's synonyms for a particular search + * + * @return self + */ + public function setSynonyms($synonyms) + { + $this->container['synonyms'] = $synonyms; + + return $this; + } + + /** + * Gets replaceSynonymsInHighlight + * + * @return bool|null + */ + public function getReplaceSynonymsInHighlight() + { + return $this->container['replaceSynonymsInHighlight']; + } + + /** + * Sets replaceSynonymsInHighlight + * + * @param bool|null $replaceSynonymsInHighlight whether to highlight and snippet the original word that matches the synonym or the synonym itself + * + * @return self + */ + public function setReplaceSynonymsInHighlight($replaceSynonymsInHighlight) + { + $this->container['replaceSynonymsInHighlight'] = $replaceSynonymsInHighlight; + + return $this; + } + + /** + * Gets minProximity + * + * @return int|null + */ + public function getMinProximity() + { + return $this->container['minProximity']; + } + + /** + * Sets minProximity + * + * @param int|null $minProximity precision of the proximity ranking criterion + * + * @return self + */ + public function setMinProximity($minProximity) + { + if (!is_null($minProximity) && ($minProximity > 7)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling SearchParams., must be smaller than or equal to 7.'); + } + if (!is_null($minProximity) && ($minProximity < 1)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling SearchParams., must be bigger than or equal to 1.'); + } + + $this->container['minProximity'] = $minProximity; + + return $this; + } + + /** + * Gets responseFields + * + * @return string[]|null + */ + public function getResponseFields() + { + return $this->container['responseFields']; + } + + /** + * Sets responseFields + * + * @param string[]|null $responseFields Choose which fields to return in the API response. This parameters applies to search and browse queries. + * + * @return self + */ + public function setResponseFields($responseFields) + { + $this->container['responseFields'] = $responseFields; + + return $this; + } + + /** + * Gets maxFacetHits + * + * @return int|null + */ + public function getMaxFacetHits() + { + return $this->container['maxFacetHits']; + } + + /** + * Sets maxFacetHits + * + * @param int|null $maxFacetHits Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. + * + * @return self + */ + public function setMaxFacetHits($maxFacetHits) + { + if (!is_null($maxFacetHits) && ($maxFacetHits > 100)) { + throw new \InvalidArgumentException('invalid value for $maxFacetHits when calling SearchParams., must be smaller than or equal to 100.'); + } + + $this->container['maxFacetHits'] = $maxFacetHits; + + return $this; + } + + /** + * Gets attributeCriteriaComputedByMinProximity + * + * @return bool|null + */ + public function getAttributeCriteriaComputedByMinProximity() + { + return $this->container['attributeCriteriaComputedByMinProximity']; + } + + /** + * Sets attributeCriteriaComputedByMinProximity + * + * @param bool|null $attributeCriteriaComputedByMinProximity when attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage + * + * @return self + */ + public function setAttributeCriteriaComputedByMinProximity($attributeCriteriaComputedByMinProximity) + { + $this->container['attributeCriteriaComputedByMinProximity'] = $attributeCriteriaComputedByMinProximity; + + return $this; + } + + /** + * Gets renderingContent + * + * @return object|null + */ + public function getRenderingContent() + { + return $this->container['renderingContent']; + } + + /** + * Sets renderingContent + * + * @param object|null $renderingContent Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * + * @return self + */ + public function setRenderingContent($renderingContent) + { + $this->container['renderingContent'] = $renderingContent; + + 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/Search/SearchParamsObject.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchParamsObject.php new file mode 100644 index 0000000000..1875cea254 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchParamsObject.php @@ -0,0 +1,2833 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchParamsObject implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchParamsObject'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'similarQuery' => 'string', + 'filters' => 'string', + 'facetFilters' => 'string[]', + 'optionalFilters' => 'string[]', + 'numericFilters' => 'string[]', + 'tagFilters' => 'string[]', + 'sumOrFiltersScores' => 'bool', + 'facets' => 'string[]', + 'maxValuesPerFacet' => 'int', + 'facetingAfterDistinct' => 'bool', + 'sortFacetValuesBy' => 'string', + 'page' => 'int', + 'offset' => 'int', + 'length' => 'int', + 'aroundLatLng' => 'string', + 'aroundLatLngViaIP' => 'bool', + 'aroundRadius' => 'OneOfIntegerString', + 'aroundPrecision' => 'int', + 'minimumAroundRadius' => 'int', + 'insideBoundingBox' => 'float[]', + 'insidePolygon' => 'float[]', + 'naturalLanguages' => 'string[]', + 'ruleContexts' => 'string[]', + 'personalizationImpact' => 'int', + 'userToken' => 'string', + 'getRankingInfo' => 'bool', + 'clickAnalytics' => 'bool', + 'analytics' => 'bool', + 'analyticsTags' => 'string[]', + 'percentileComputation' => 'bool', + 'enableABTest' => 'bool', + 'enableReRanking' => 'bool', + 'query' => 'string', + 'searchableAttributes' => 'string[]', + 'attributesForFaceting' => 'string[]', + 'unretrievableAttributes' => 'string[]', + 'attributesToRetrieve' => 'string[]', + 'restrictSearchableAttributes' => 'string[]', + 'ranking' => 'string[]', + 'customRanking' => 'string[]', + 'relevancyStrictness' => 'int', + 'attributesToHighlight' => 'string[]', + 'attributesToSnippet' => 'string[]', + 'highlightPreTag' => 'string', + 'highlightPostTag' => 'string', + 'snippetEllipsisText' => 'string', + 'restrictHighlightAndSnippetArrays' => 'bool', + 'hitsPerPage' => 'int', + 'minWordSizefor1Typo' => 'int', + 'minWordSizefor2Typos' => 'int', + 'typoTolerance' => 'string', + 'allowTyposOnNumericTokens' => 'bool', + 'disableTypoToleranceOnAttributes' => 'string[]', + 'separatorsToIndex' => 'string', + 'ignorePlurals' => 'string', + 'removeStopWords' => 'string', + 'keepDiacriticsOnCharacters' => 'string', + 'queryLanguages' => 'string[]', + 'decompoundQuery' => 'bool', + 'enableRules' => 'bool', + 'enablePersonalization' => 'bool', + 'queryType' => 'string', + 'removeWordsIfNoResults' => 'string', + 'advancedSyntax' => 'bool', + 'optionalWords' => 'string[]', + 'disableExactOnAttributes' => 'string[]', + 'exactOnSingleWordQuery' => 'string', + 'alternativesAsExact' => 'string[]', + 'advancedSyntaxFeatures' => 'string[]', + 'distinct' => 'int', + 'synonyms' => 'bool', + 'replaceSynonymsInHighlight' => 'bool', + 'minProximity' => 'int', + 'responseFields' => 'string[]', + 'maxFacetHits' => 'int', + 'attributeCriteriaComputedByMinProximity' => 'bool', + 'renderingContent' => 'object', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'similarQuery' => null, + 'filters' => null, + 'facetFilters' => null, + 'optionalFilters' => null, + 'numericFilters' => null, + 'tagFilters' => null, + 'sumOrFiltersScores' => null, + 'facets' => null, + 'maxValuesPerFacet' => null, + 'facetingAfterDistinct' => null, + 'sortFacetValuesBy' => null, + 'page' => null, + 'offset' => null, + 'length' => null, + 'aroundLatLng' => null, + 'aroundLatLngViaIP' => null, + 'aroundRadius' => null, + 'aroundPrecision' => null, + 'minimumAroundRadius' => null, + 'insideBoundingBox' => null, + 'insidePolygon' => null, + 'naturalLanguages' => null, + 'ruleContexts' => null, + 'personalizationImpact' => null, + 'userToken' => null, + 'getRankingInfo' => null, + 'clickAnalytics' => null, + 'analytics' => null, + 'analyticsTags' => null, + 'percentileComputation' => null, + 'enableABTest' => null, + 'enableReRanking' => null, + 'query' => null, + 'searchableAttributes' => null, + 'attributesForFaceting' => null, + 'unretrievableAttributes' => null, + 'attributesToRetrieve' => null, + 'restrictSearchableAttributes' => null, + 'ranking' => null, + 'customRanking' => null, + 'relevancyStrictness' => null, + 'attributesToHighlight' => null, + 'attributesToSnippet' => null, + 'highlightPreTag' => null, + 'highlightPostTag' => null, + 'snippetEllipsisText' => null, + 'restrictHighlightAndSnippetArrays' => null, + 'hitsPerPage' => null, + 'minWordSizefor1Typo' => null, + 'minWordSizefor2Typos' => null, + 'typoTolerance' => null, + 'allowTyposOnNumericTokens' => null, + 'disableTypoToleranceOnAttributes' => null, + 'separatorsToIndex' => null, + 'ignorePlurals' => null, + 'removeStopWords' => null, + 'keepDiacriticsOnCharacters' => null, + 'queryLanguages' => null, + 'decompoundQuery' => null, + 'enableRules' => null, + 'enablePersonalization' => null, + 'queryType' => null, + 'removeWordsIfNoResults' => null, + 'advancedSyntax' => null, + 'optionalWords' => null, + 'disableExactOnAttributes' => null, + 'exactOnSingleWordQuery' => null, + 'alternativesAsExact' => null, + 'advancedSyntaxFeatures' => null, + 'distinct' => null, + 'synonyms' => null, + 'replaceSynonymsInHighlight' => null, + 'minProximity' => null, + 'responseFields' => null, + 'maxFacetHits' => null, + 'attributeCriteriaComputedByMinProximity' => null, + 'renderingContent' => 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 = [ + 'similarQuery' => 'similarQuery', + 'filters' => 'filters', + 'facetFilters' => 'facetFilters', + 'optionalFilters' => 'optionalFilters', + 'numericFilters' => 'numericFilters', + 'tagFilters' => 'tagFilters', + 'sumOrFiltersScores' => 'sumOrFiltersScores', + 'facets' => 'facets', + 'maxValuesPerFacet' => 'maxValuesPerFacet', + 'facetingAfterDistinct' => 'facetingAfterDistinct', + 'sortFacetValuesBy' => 'sortFacetValuesBy', + 'page' => 'page', + 'offset' => 'offset', + 'length' => 'length', + 'aroundLatLng' => 'aroundLatLng', + 'aroundLatLngViaIP' => 'aroundLatLngViaIP', + 'aroundRadius' => 'aroundRadius', + 'aroundPrecision' => 'aroundPrecision', + 'minimumAroundRadius' => 'minimumAroundRadius', + 'insideBoundingBox' => 'insideBoundingBox', + 'insidePolygon' => 'insidePolygon', + 'naturalLanguages' => 'naturalLanguages', + 'ruleContexts' => 'ruleContexts', + 'personalizationImpact' => 'personalizationImpact', + 'userToken' => 'userToken', + 'getRankingInfo' => 'getRankingInfo', + 'clickAnalytics' => 'clickAnalytics', + 'analytics' => 'analytics', + 'analyticsTags' => 'analyticsTags', + 'percentileComputation' => 'percentileComputation', + 'enableABTest' => 'enableABTest', + 'enableReRanking' => 'enableReRanking', + 'query' => 'query', + 'searchableAttributes' => 'searchableAttributes', + 'attributesForFaceting' => 'attributesForFaceting', + 'unretrievableAttributes' => 'unretrievableAttributes', + 'attributesToRetrieve' => 'attributesToRetrieve', + 'restrictSearchableAttributes' => 'restrictSearchableAttributes', + 'ranking' => 'ranking', + 'customRanking' => 'customRanking', + 'relevancyStrictness' => 'relevancyStrictness', + 'attributesToHighlight' => 'attributesToHighlight', + 'attributesToSnippet' => 'attributesToSnippet', + 'highlightPreTag' => 'highlightPreTag', + 'highlightPostTag' => 'highlightPostTag', + 'snippetEllipsisText' => 'snippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'restrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'hitsPerPage', + 'minWordSizefor1Typo' => 'minWordSizefor1Typo', + 'minWordSizefor2Typos' => 'minWordSizefor2Typos', + 'typoTolerance' => 'typoTolerance', + 'allowTyposOnNumericTokens' => 'allowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'disableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'separatorsToIndex', + 'ignorePlurals' => 'ignorePlurals', + 'removeStopWords' => 'removeStopWords', + 'keepDiacriticsOnCharacters' => 'keepDiacriticsOnCharacters', + 'queryLanguages' => 'queryLanguages', + 'decompoundQuery' => 'decompoundQuery', + 'enableRules' => 'enableRules', + 'enablePersonalization' => 'enablePersonalization', + 'queryType' => 'queryType', + 'removeWordsIfNoResults' => 'removeWordsIfNoResults', + 'advancedSyntax' => 'advancedSyntax', + 'optionalWords' => 'optionalWords', + 'disableExactOnAttributes' => 'disableExactOnAttributes', + 'exactOnSingleWordQuery' => 'exactOnSingleWordQuery', + 'alternativesAsExact' => 'alternativesAsExact', + 'advancedSyntaxFeatures' => 'advancedSyntaxFeatures', + 'distinct' => 'distinct', + 'synonyms' => 'synonyms', + 'replaceSynonymsInHighlight' => 'replaceSynonymsInHighlight', + 'minProximity' => 'minProximity', + 'responseFields' => 'responseFields', + 'maxFacetHits' => 'maxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'attributeCriteriaComputedByMinProximity', + 'renderingContent' => 'renderingContent', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'similarQuery' => 'setSimilarQuery', + 'filters' => 'setFilters', + 'facetFilters' => 'setFacetFilters', + 'optionalFilters' => 'setOptionalFilters', + 'numericFilters' => 'setNumericFilters', + 'tagFilters' => 'setTagFilters', + 'sumOrFiltersScores' => 'setSumOrFiltersScores', + 'facets' => 'setFacets', + 'maxValuesPerFacet' => 'setMaxValuesPerFacet', + 'facetingAfterDistinct' => 'setFacetingAfterDistinct', + 'sortFacetValuesBy' => 'setSortFacetValuesBy', + 'page' => 'setPage', + 'offset' => 'setOffset', + 'length' => 'setLength', + 'aroundLatLng' => 'setAroundLatLng', + 'aroundLatLngViaIP' => 'setAroundLatLngViaIP', + 'aroundRadius' => 'setAroundRadius', + 'aroundPrecision' => 'setAroundPrecision', + 'minimumAroundRadius' => 'setMinimumAroundRadius', + 'insideBoundingBox' => 'setInsideBoundingBox', + 'insidePolygon' => 'setInsidePolygon', + 'naturalLanguages' => 'setNaturalLanguages', + 'ruleContexts' => 'setRuleContexts', + 'personalizationImpact' => 'setPersonalizationImpact', + 'userToken' => 'setUserToken', + 'getRankingInfo' => 'setGetRankingInfo', + 'clickAnalytics' => 'setClickAnalytics', + 'analytics' => 'setAnalytics', + 'analyticsTags' => 'setAnalyticsTags', + 'percentileComputation' => 'setPercentileComputation', + 'enableABTest' => 'setEnableABTest', + 'enableReRanking' => 'setEnableReRanking', + 'query' => 'setQuery', + 'searchableAttributes' => 'setSearchableAttributes', + 'attributesForFaceting' => 'setAttributesForFaceting', + 'unretrievableAttributes' => 'setUnretrievableAttributes', + 'attributesToRetrieve' => 'setAttributesToRetrieve', + 'restrictSearchableAttributes' => 'setRestrictSearchableAttributes', + 'ranking' => 'setRanking', + 'customRanking' => 'setCustomRanking', + 'relevancyStrictness' => 'setRelevancyStrictness', + 'attributesToHighlight' => 'setAttributesToHighlight', + 'attributesToSnippet' => 'setAttributesToSnippet', + 'highlightPreTag' => 'setHighlightPreTag', + 'highlightPostTag' => 'setHighlightPostTag', + 'snippetEllipsisText' => 'setSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'setRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'setHitsPerPage', + 'minWordSizefor1Typo' => 'setMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'setMinWordSizefor2Typos', + 'typoTolerance' => 'setTypoTolerance', + 'allowTyposOnNumericTokens' => 'setAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'setDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'setSeparatorsToIndex', + 'ignorePlurals' => 'setIgnorePlurals', + 'removeStopWords' => 'setRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'setKeepDiacriticsOnCharacters', + 'queryLanguages' => 'setQueryLanguages', + 'decompoundQuery' => 'setDecompoundQuery', + 'enableRules' => 'setEnableRules', + 'enablePersonalization' => 'setEnablePersonalization', + 'queryType' => 'setQueryType', + 'removeWordsIfNoResults' => 'setRemoveWordsIfNoResults', + 'advancedSyntax' => 'setAdvancedSyntax', + 'optionalWords' => 'setOptionalWords', + 'disableExactOnAttributes' => 'setDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'setExactOnSingleWordQuery', + 'alternativesAsExact' => 'setAlternativesAsExact', + 'advancedSyntaxFeatures' => 'setAdvancedSyntaxFeatures', + 'distinct' => 'setDistinct', + 'synonyms' => 'setSynonyms', + 'replaceSynonymsInHighlight' => 'setReplaceSynonymsInHighlight', + 'minProximity' => 'setMinProximity', + 'responseFields' => 'setResponseFields', + 'maxFacetHits' => 'setMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'setAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'setRenderingContent', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'similarQuery' => 'getSimilarQuery', + 'filters' => 'getFilters', + 'facetFilters' => 'getFacetFilters', + 'optionalFilters' => 'getOptionalFilters', + 'numericFilters' => 'getNumericFilters', + 'tagFilters' => 'getTagFilters', + 'sumOrFiltersScores' => 'getSumOrFiltersScores', + 'facets' => 'getFacets', + 'maxValuesPerFacet' => 'getMaxValuesPerFacet', + 'facetingAfterDistinct' => 'getFacetingAfterDistinct', + 'sortFacetValuesBy' => 'getSortFacetValuesBy', + 'page' => 'getPage', + 'offset' => 'getOffset', + 'length' => 'getLength', + 'aroundLatLng' => 'getAroundLatLng', + 'aroundLatLngViaIP' => 'getAroundLatLngViaIP', + 'aroundRadius' => 'getAroundRadius', + 'aroundPrecision' => 'getAroundPrecision', + 'minimumAroundRadius' => 'getMinimumAroundRadius', + 'insideBoundingBox' => 'getInsideBoundingBox', + 'insidePolygon' => 'getInsidePolygon', + 'naturalLanguages' => 'getNaturalLanguages', + 'ruleContexts' => 'getRuleContexts', + 'personalizationImpact' => 'getPersonalizationImpact', + 'userToken' => 'getUserToken', + 'getRankingInfo' => 'getGetRankingInfo', + 'clickAnalytics' => 'getClickAnalytics', + 'analytics' => 'getAnalytics', + 'analyticsTags' => 'getAnalyticsTags', + 'percentileComputation' => 'getPercentileComputation', + 'enableABTest' => 'getEnableABTest', + 'enableReRanking' => 'getEnableReRanking', + 'query' => 'getQuery', + 'searchableAttributes' => 'getSearchableAttributes', + 'attributesForFaceting' => 'getAttributesForFaceting', + 'unretrievableAttributes' => 'getUnretrievableAttributes', + 'attributesToRetrieve' => 'getAttributesToRetrieve', + 'restrictSearchableAttributes' => 'getRestrictSearchableAttributes', + 'ranking' => 'getRanking', + 'customRanking' => 'getCustomRanking', + 'relevancyStrictness' => 'getRelevancyStrictness', + 'attributesToHighlight' => 'getAttributesToHighlight', + 'attributesToSnippet' => 'getAttributesToSnippet', + 'highlightPreTag' => 'getHighlightPreTag', + 'highlightPostTag' => 'getHighlightPostTag', + 'snippetEllipsisText' => 'getSnippetEllipsisText', + 'restrictHighlightAndSnippetArrays' => 'getRestrictHighlightAndSnippetArrays', + 'hitsPerPage' => 'getHitsPerPage', + 'minWordSizefor1Typo' => 'getMinWordSizefor1Typo', + 'minWordSizefor2Typos' => 'getMinWordSizefor2Typos', + 'typoTolerance' => 'getTypoTolerance', + 'allowTyposOnNumericTokens' => 'getAllowTyposOnNumericTokens', + 'disableTypoToleranceOnAttributes' => 'getDisableTypoToleranceOnAttributes', + 'separatorsToIndex' => 'getSeparatorsToIndex', + 'ignorePlurals' => 'getIgnorePlurals', + 'removeStopWords' => 'getRemoveStopWords', + 'keepDiacriticsOnCharacters' => 'getKeepDiacriticsOnCharacters', + 'queryLanguages' => 'getQueryLanguages', + 'decompoundQuery' => 'getDecompoundQuery', + 'enableRules' => 'getEnableRules', + 'enablePersonalization' => 'getEnablePersonalization', + 'queryType' => 'getQueryType', + 'removeWordsIfNoResults' => 'getRemoveWordsIfNoResults', + 'advancedSyntax' => 'getAdvancedSyntax', + 'optionalWords' => 'getOptionalWords', + 'disableExactOnAttributes' => 'getDisableExactOnAttributes', + 'exactOnSingleWordQuery' => 'getExactOnSingleWordQuery', + 'alternativesAsExact' => 'getAlternativesAsExact', + 'advancedSyntaxFeatures' => 'getAdvancedSyntaxFeatures', + 'distinct' => 'getDistinct', + 'synonyms' => 'getSynonyms', + 'replaceSynonymsInHighlight' => 'getReplaceSynonymsInHighlight', + 'minProximity' => 'getMinProximity', + 'responseFields' => 'getResponseFields', + 'maxFacetHits' => 'getMaxFacetHits', + 'attributeCriteriaComputedByMinProximity' => 'getAttributeCriteriaComputedByMinProximity', + 'renderingContent' => 'getRenderingContent', + ]; + + /** + * 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 TYPO_TOLERANCE_TRUE = 'true'; + const TYPO_TOLERANCE_FALSE = 'false'; + const TYPO_TOLERANCE_MIN = 'min'; + const TYPO_TOLERANCE_STRICT = 'strict'; + const QUERY_TYPE_PREFIX_LAST = 'prefixLast'; + const QUERY_TYPE_PREFIX_ALL = 'prefixAll'; + const QUERY_TYPE_PREFIX_NONE = 'prefixNone'; + const REMOVE_WORDS_IF_NO_RESULTS_NONE = 'none'; + const REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS = 'lastWords'; + const REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS = 'firstWords'; + const REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL = 'allOptional'; + const EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE = 'attribute'; + const EXACT_ON_SINGLE_WORD_QUERY_NONE = 'none'; + const EXACT_ON_SINGLE_WORD_QUERY_WORD = 'word'; + const ALTERNATIVES_AS_EXACT_IGNORE_PLURALS = 'ignorePlurals'; + const ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM = 'singleWordSynonym'; + const ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM = 'multiWordsSynonym'; + const ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE = 'exactPhrase'; + const ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS = 'excludeWords'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getTypoToleranceAllowableValues() + { + return [ + self::TYPO_TOLERANCE_TRUE, + self::TYPO_TOLERANCE_FALSE, + self::TYPO_TOLERANCE_MIN, + self::TYPO_TOLERANCE_STRICT, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getQueryTypeAllowableValues() + { + return [ + self::QUERY_TYPE_PREFIX_LAST, + self::QUERY_TYPE_PREFIX_ALL, + self::QUERY_TYPE_PREFIX_NONE, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getRemoveWordsIfNoResultsAllowableValues() + { + return [ + self::REMOVE_WORDS_IF_NO_RESULTS_NONE, + self::REMOVE_WORDS_IF_NO_RESULTS_LAST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_FIRST_WORDS, + self::REMOVE_WORDS_IF_NO_RESULTS_ALL_OPTIONAL, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getExactOnSingleWordQueryAllowableValues() + { + return [ + self::EXACT_ON_SINGLE_WORD_QUERY_ATTRIBUTE, + self::EXACT_ON_SINGLE_WORD_QUERY_NONE, + self::EXACT_ON_SINGLE_WORD_QUERY_WORD, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAlternativesAsExactAllowableValues() + { + return [ + self::ALTERNATIVES_AS_EXACT_IGNORE_PLURALS, + self::ALTERNATIVES_AS_EXACT_SINGLE_WORD_SYNONYM, + self::ALTERNATIVES_AS_EXACT_MULTI_WORDS_SYNONYM, + ]; + } + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getAdvancedSyntaxFeaturesAllowableValues() + { + return [ + self::ADVANCED_SYNTAX_FEATURES_EXACT_PHRASE, + self::ADVANCED_SYNTAX_FEATURES_EXCLUDE_WORDS, + ]; + } + + /** + * 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['similarQuery'] = $data['similarQuery'] ?? ''; + $this->container['filters'] = $data['filters'] ?? ''; + $this->container['facetFilters'] = $data['facetFilters'] ?? null; + $this->container['optionalFilters'] = $data['optionalFilters'] ?? null; + $this->container['numericFilters'] = $data['numericFilters'] ?? null; + $this->container['tagFilters'] = $data['tagFilters'] ?? null; + $this->container['sumOrFiltersScores'] = $data['sumOrFiltersScores'] ?? false; + $this->container['facets'] = $data['facets'] ?? null; + $this->container['maxValuesPerFacet'] = $data['maxValuesPerFacet'] ?? 100; + $this->container['facetingAfterDistinct'] = $data['facetingAfterDistinct'] ?? false; + $this->container['sortFacetValuesBy'] = $data['sortFacetValuesBy'] ?? 'count'; + $this->container['page'] = $data['page'] ?? 0; + $this->container['offset'] = $data['offset'] ?? null; + $this->container['length'] = $data['length'] ?? null; + $this->container['aroundLatLng'] = $data['aroundLatLng'] ?? ''; + $this->container['aroundLatLngViaIP'] = $data['aroundLatLngViaIP'] ?? false; + $this->container['aroundRadius'] = $data['aroundRadius'] ?? null; + $this->container['aroundPrecision'] = $data['aroundPrecision'] ?? 10; + $this->container['minimumAroundRadius'] = $data['minimumAroundRadius'] ?? null; + $this->container['insideBoundingBox'] = $data['insideBoundingBox'] ?? null; + $this->container['insidePolygon'] = $data['insidePolygon'] ?? null; + $this->container['naturalLanguages'] = $data['naturalLanguages'] ?? null; + $this->container['ruleContexts'] = $data['ruleContexts'] ?? null; + $this->container['personalizationImpact'] = $data['personalizationImpact'] ?? 100; + $this->container['userToken'] = $data['userToken'] ?? null; + $this->container['getRankingInfo'] = $data['getRankingInfo'] ?? false; + $this->container['clickAnalytics'] = $data['clickAnalytics'] ?? false; + $this->container['analytics'] = $data['analytics'] ?? true; + $this->container['analyticsTags'] = $data['analyticsTags'] ?? null; + $this->container['percentileComputation'] = $data['percentileComputation'] ?? true; + $this->container['enableABTest'] = $data['enableABTest'] ?? true; + $this->container['enableReRanking'] = $data['enableReRanking'] ?? true; + $this->container['query'] = $data['query'] ?? ''; + $this->container['searchableAttributes'] = $data['searchableAttributes'] ?? null; + $this->container['attributesForFaceting'] = $data['attributesForFaceting'] ?? null; + $this->container['unretrievableAttributes'] = $data['unretrievableAttributes'] ?? null; + $this->container['attributesToRetrieve'] = $data['attributesToRetrieve'] ?? null; + $this->container['restrictSearchableAttributes'] = $data['restrictSearchableAttributes'] ?? null; + $this->container['ranking'] = $data['ranking'] ?? null; + $this->container['customRanking'] = $data['customRanking'] ?? null; + $this->container['relevancyStrictness'] = $data['relevancyStrictness'] ?? 100; + $this->container['attributesToHighlight'] = $data['attributesToHighlight'] ?? null; + $this->container['attributesToSnippet'] = $data['attributesToSnippet'] ?? null; + $this->container['highlightPreTag'] = $data['highlightPreTag'] ?? ''; + $this->container['highlightPostTag'] = $data['highlightPostTag'] ?? ''; + $this->container['snippetEllipsisText'] = $data['snippetEllipsisText'] ?? '…'; + $this->container['restrictHighlightAndSnippetArrays'] = $data['restrictHighlightAndSnippetArrays'] ?? false; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + $this->container['minWordSizefor1Typo'] = $data['minWordSizefor1Typo'] ?? 4; + $this->container['minWordSizefor2Typos'] = $data['minWordSizefor2Typos'] ?? 8; + $this->container['typoTolerance'] = $data['typoTolerance'] ?? 'true'; + $this->container['allowTyposOnNumericTokens'] = $data['allowTyposOnNumericTokens'] ?? true; + $this->container['disableTypoToleranceOnAttributes'] = $data['disableTypoToleranceOnAttributes'] ?? null; + $this->container['separatorsToIndex'] = $data['separatorsToIndex'] ?? ''; + $this->container['ignorePlurals'] = $data['ignorePlurals'] ?? 'false'; + $this->container['removeStopWords'] = $data['removeStopWords'] ?? 'false'; + $this->container['keepDiacriticsOnCharacters'] = $data['keepDiacriticsOnCharacters'] ?? ''; + $this->container['queryLanguages'] = $data['queryLanguages'] ?? null; + $this->container['decompoundQuery'] = $data['decompoundQuery'] ?? true; + $this->container['enableRules'] = $data['enableRules'] ?? true; + $this->container['enablePersonalization'] = $data['enablePersonalization'] ?? false; + $this->container['queryType'] = $data['queryType'] ?? 'prefixLast'; + $this->container['removeWordsIfNoResults'] = $data['removeWordsIfNoResults'] ?? 'none'; + $this->container['advancedSyntax'] = $data['advancedSyntax'] ?? false; + $this->container['optionalWords'] = $data['optionalWords'] ?? null; + $this->container['disableExactOnAttributes'] = $data['disableExactOnAttributes'] ?? null; + $this->container['exactOnSingleWordQuery'] = $data['exactOnSingleWordQuery'] ?? 'attribute'; + $this->container['alternativesAsExact'] = $data['alternativesAsExact'] ?? null; + $this->container['advancedSyntaxFeatures'] = $data['advancedSyntaxFeatures'] ?? null; + $this->container['distinct'] = $data['distinct'] ?? 0; + $this->container['synonyms'] = $data['synonyms'] ?? true; + $this->container['replaceSynonymsInHighlight'] = $data['replaceSynonymsInHighlight'] ?? false; + $this->container['minProximity'] = $data['minProximity'] ?? 1; + $this->container['responseFields'] = $data['responseFields'] ?? null; + $this->container['maxFacetHits'] = $data['maxFacetHits'] ?? 10; + $this->container['attributeCriteriaComputedByMinProximity'] = $data['attributeCriteriaComputedByMinProximity'] ?? false; + $this->container['renderingContent'] = $data['renderingContent'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if (!is_null($this->container['length']) && ($this->container['length'] > 1000)) { + $invalidProperties[] = "invalid value for 'length', must be smaller than or equal to 1000."; + } + + if (!is_null($this->container['length']) && ($this->container['length'] < 1)) { + $invalidProperties[] = "invalid value for 'length', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['minimumAroundRadius']) && ($this->container['minimumAroundRadius'] < 1)) { + $invalidProperties[] = "invalid value for 'minimumAroundRadius', must be bigger than or equal to 1."; + } + + if ($this->container['query'] === null) { + $invalidProperties[] = "'query' can't be null"; + } + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($this->container['typoTolerance']) && !in_array($this->container['typoTolerance'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'typoTolerance', must be one of '%s'", + $this->container['typoTolerance'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($this->container['queryType']) && !in_array($this->container['queryType'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'queryType', must be one of '%s'", + $this->container['queryType'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($this->container['removeWordsIfNoResults']) && !in_array($this->container['removeWordsIfNoResults'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $this->container['removeWordsIfNoResults'], + implode("', '", $allowedValues) + ); + } + + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($this->container['exactOnSingleWordQuery']) && !in_array($this->container['exactOnSingleWordQuery'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $this->container['exactOnSingleWordQuery'], + implode("', '", $allowedValues) + ); + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] > 4)) { + $invalidProperties[] = "invalid value for 'distinct', must be smaller than or equal to 4."; + } + + if (!is_null($this->container['distinct']) && ($this->container['distinct'] < 0)) { + $invalidProperties[] = "invalid value for 'distinct', must be bigger than or equal to 0."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] > 7)) { + $invalidProperties[] = "invalid value for 'minProximity', must be smaller than or equal to 7."; + } + + if (!is_null($this->container['minProximity']) && ($this->container['minProximity'] < 1)) { + $invalidProperties[] = "invalid value for 'minProximity', must be bigger than or equal to 1."; + } + + if (!is_null($this->container['maxFacetHits']) && ($this->container['maxFacetHits'] > 100)) { + $invalidProperties[] = "invalid value for 'maxFacetHits', must be smaller than or equal to 100."; + } + + 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 similarQuery + * + * @return string|null + */ + public function getSimilarQuery() + { + return $this->container['similarQuery']; + } + + /** + * Sets similarQuery + * + * @param string|null $similarQuery overrides the query parameter and performs a more generic search that can be used to find \"similar\" results + * + * @return self + */ + public function setSimilarQuery($similarQuery) + { + $this->container['similarQuery'] = $similarQuery; + + return $this; + } + + /** + * Gets filters + * + * @return string|null + */ + public function getFilters() + { + return $this->container['filters']; + } + + /** + * Sets filters + * + * @param string|null $filters filter the query with numeric, facet and/or tag filters + * + * @return self + */ + public function setFilters($filters) + { + $this->container['filters'] = $filters; + + return $this; + } + + /** + * Gets facetFilters + * + * @return string[]|null + */ + public function getFacetFilters() + { + return $this->container['facetFilters']; + } + + /** + * Sets facetFilters + * + * @param string[]|null $facetFilters filter hits by facet value + * + * @return self + */ + public function setFacetFilters($facetFilters) + { + $this->container['facetFilters'] = $facetFilters; + + return $this; + } + + /** + * Gets optionalFilters + * + * @return string[]|null + */ + public function getOptionalFilters() + { + return $this->container['optionalFilters']; + } + + /** + * Sets optionalFilters + * + * @param string[]|null $optionalFilters create filters for ranking purposes, where records that match the filter are ranked higher, or lower in the case of a negative optional filter + * + * @return self + */ + public function setOptionalFilters($optionalFilters) + { + $this->container['optionalFilters'] = $optionalFilters; + + return $this; + } + + /** + * Gets numericFilters + * + * @return string[]|null + */ + public function getNumericFilters() + { + return $this->container['numericFilters']; + } + + /** + * Sets numericFilters + * + * @param string[]|null $numericFilters filter on numeric attributes + * + * @return self + */ + public function setNumericFilters($numericFilters) + { + $this->container['numericFilters'] = $numericFilters; + + return $this; + } + + /** + * Gets tagFilters + * + * @return string[]|null + */ + public function getTagFilters() + { + return $this->container['tagFilters']; + } + + /** + * Sets tagFilters + * + * @param string[]|null $tagFilters filter hits by tags + * + * @return self + */ + public function setTagFilters($tagFilters) + { + $this->container['tagFilters'] = $tagFilters; + + return $this; + } + + /** + * Gets sumOrFiltersScores + * + * @return bool|null + */ + public function getSumOrFiltersScores() + { + return $this->container['sumOrFiltersScores']; + } + + /** + * Sets sumOrFiltersScores + * + * @param bool|null $sumOrFiltersScores determines how to calculate the total score for filtering + * + * @return self + */ + public function setSumOrFiltersScores($sumOrFiltersScores) + { + $this->container['sumOrFiltersScores'] = $sumOrFiltersScores; + + return $this; + } + + /** + * Gets facets + * + * @return string[]|null + */ + public function getFacets() + { + return $this->container['facets']; + } + + /** + * Sets facets + * + * @param string[]|null $facets retrieve facets and their facet values + * + * @return self + */ + public function setFacets($facets) + { + $this->container['facets'] = $facets; + + return $this; + } + + /** + * Gets maxValuesPerFacet + * + * @return int|null + */ + public function getMaxValuesPerFacet() + { + return $this->container['maxValuesPerFacet']; + } + + /** + * Sets maxValuesPerFacet + * + * @param int|null $maxValuesPerFacet maximum number of facet values to return for each facet during a regular search + * + * @return self + */ + public function setMaxValuesPerFacet($maxValuesPerFacet) + { + $this->container['maxValuesPerFacet'] = $maxValuesPerFacet; + + return $this; + } + + /** + * Gets facetingAfterDistinct + * + * @return bool|null + */ + public function getFacetingAfterDistinct() + { + return $this->container['facetingAfterDistinct']; + } + + /** + * Sets facetingAfterDistinct + * + * @param bool|null $facetingAfterDistinct force faceting to be applied after de-duplication (via the Distinct setting) + * + * @return self + */ + public function setFacetingAfterDistinct($facetingAfterDistinct) + { + $this->container['facetingAfterDistinct'] = $facetingAfterDistinct; + + return $this; + } + + /** + * Gets sortFacetValuesBy + * + * @return string|null + */ + public function getSortFacetValuesBy() + { + return $this->container['sortFacetValuesBy']; + } + + /** + * Sets sortFacetValuesBy + * + * @param string|null $sortFacetValuesBy controls how facet values are fetched + * + * @return self + */ + public function setSortFacetValuesBy($sortFacetValuesBy) + { + $this->container['sortFacetValuesBy'] = $sortFacetValuesBy; + + return $this; + } + + /** + * Gets page + * + * @return int|null + */ + public function getPage() + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param int|null $page specify the page to retrieve + * + * @return self + */ + public function setPage($page) + { + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets offset + * + * @return int|null + */ + public function getOffset() + { + return $this->container['offset']; + } + + /** + * Sets offset + * + * @param int|null $offset specify the offset of the first hit to return + * + * @return self + */ + public function setOffset($offset) + { + $this->container['offset'] = $offset; + + return $this; + } + + /** + * Gets length + * + * @return int|null + */ + public function getLength() + { + return $this->container['length']; + } + + /** + * Sets length + * + * @param int|null $length set the number of hits to retrieve (used only with offset) + * + * @return self + */ + public function setLength($length) + { + if (!is_null($length) && ($length > 1000)) { + throw new \InvalidArgumentException('invalid value for $length when calling SearchParamsObject., must be smaller than or equal to 1000.'); + } + if (!is_null($length) && ($length < 1)) { + throw new \InvalidArgumentException('invalid value for $length when calling SearchParamsObject., must be bigger than or equal to 1.'); + } + + $this->container['length'] = $length; + + return $this; + } + + /** + * Gets aroundLatLng + * + * @return string|null + */ + public function getAroundLatLng() + { + return $this->container['aroundLatLng']; + } + + /** + * Sets aroundLatLng + * + * @param string|null $aroundLatLng search for entries around a central geolocation, enabling a geo search within a circular area + * + * @return self + */ + public function setAroundLatLng($aroundLatLng) + { + $this->container['aroundLatLng'] = $aroundLatLng; + + return $this; + } + + /** + * Gets aroundLatLngViaIP + * + * @return bool|null + */ + public function getAroundLatLngViaIP() + { + return $this->container['aroundLatLngViaIP']; + } + + /** + * Sets aroundLatLngViaIP + * + * @param bool|null $aroundLatLngViaIP search for entries around a given location automatically computed from the requester's IP address + * + * @return self + */ + public function setAroundLatLngViaIP($aroundLatLngViaIP) + { + $this->container['aroundLatLngViaIP'] = $aroundLatLngViaIP; + + return $this; + } + + /** + * Gets aroundRadius + * + * @return OneOfIntegerString|null + */ + public function getAroundRadius() + { + return $this->container['aroundRadius']; + } + + /** + * Sets aroundRadius + * + * @param OneOfIntegerString|null $aroundRadius define the maximum radius for a geo search (in meters) + * + * @return self + */ + public function setAroundRadius($aroundRadius) + { + $this->container['aroundRadius'] = $aroundRadius; + + return $this; + } + + /** + * Gets aroundPrecision + * + * @return int|null + */ + public function getAroundPrecision() + { + return $this->container['aroundPrecision']; + } + + /** + * Sets aroundPrecision + * + * @param int|null $aroundPrecision precision of geo search (in meters), to add grouping by geo location to the ranking formula + * + * @return self + */ + public function setAroundPrecision($aroundPrecision) + { + $this->container['aroundPrecision'] = $aroundPrecision; + + return $this; + } + + /** + * Gets minimumAroundRadius + * + * @return int|null + */ + public function getMinimumAroundRadius() + { + return $this->container['minimumAroundRadius']; + } + + /** + * Sets minimumAroundRadius + * + * @param int|null $minimumAroundRadius minimum radius (in meters) used for a geo search when aroundRadius is not set + * + * @return self + */ + public function setMinimumAroundRadius($minimumAroundRadius) + { + if (!is_null($minimumAroundRadius) && ($minimumAroundRadius < 1)) { + throw new \InvalidArgumentException('invalid value for $minimumAroundRadius when calling SearchParamsObject., must be bigger than or equal to 1.'); + } + + $this->container['minimumAroundRadius'] = $minimumAroundRadius; + + return $this; + } + + /** + * Gets insideBoundingBox + * + * @return float[]|null + */ + public function getInsideBoundingBox() + { + return $this->container['insideBoundingBox']; + } + + /** + * Sets insideBoundingBox + * + * @param float[]|null $insideBoundingBox search inside a rectangular area (in geo coordinates) + * + * @return self + */ + public function setInsideBoundingBox($insideBoundingBox) + { + $this->container['insideBoundingBox'] = $insideBoundingBox; + + return $this; + } + + /** + * Gets insidePolygon + * + * @return float[]|null + */ + public function getInsidePolygon() + { + return $this->container['insidePolygon']; + } + + /** + * Sets insidePolygon + * + * @param float[]|null $insidePolygon search inside a polygon (in geo coordinates) + * + * @return self + */ + public function setInsidePolygon($insidePolygon) + { + $this->container['insidePolygon'] = $insidePolygon; + + return $this; + } + + /** + * Gets naturalLanguages + * + * @return string[]|null + */ + public function getNaturalLanguages() + { + return $this->container['naturalLanguages']; + } + + /** + * Sets naturalLanguages + * + * @param string[]|null $naturalLanguages This parameter changes the default values of certain parameters and settings that work best for a natural language query, such as ignorePlurals, removeStopWords, removeWordsIfNoResults, analyticsTags and ruleContexts. These parameters and settings work well together when the query is formatted in natural language instead of keywords, for example when your user performs a voice search. + * + * @return self + */ + public function setNaturalLanguages($naturalLanguages) + { + $this->container['naturalLanguages'] = $naturalLanguages; + + return $this; + } + + /** + * Gets ruleContexts + * + * @return string[]|null + */ + public function getRuleContexts() + { + return $this->container['ruleContexts']; + } + + /** + * Sets ruleContexts + * + * @param string[]|null $ruleContexts enables contextual rules + * + * @return self + */ + public function setRuleContexts($ruleContexts) + { + $this->container['ruleContexts'] = $ruleContexts; + + return $this; + } + + /** + * Gets personalizationImpact + * + * @return int|null + */ + public function getPersonalizationImpact() + { + return $this->container['personalizationImpact']; + } + + /** + * Sets personalizationImpact + * + * @param int|null $personalizationImpact define the impact of the Personalization feature + * + * @return self + */ + public function setPersonalizationImpact($personalizationImpact) + { + $this->container['personalizationImpact'] = $personalizationImpact; + + return $this; + } + + /** + * Gets userToken + * + * @return string|null + */ + public function getUserToken() + { + return $this->container['userToken']; + } + + /** + * Sets userToken + * + * @param string|null $userToken associates a certain user token with the current search + * + * @return self + */ + public function setUserToken($userToken) + { + $this->container['userToken'] = $userToken; + + return $this; + } + + /** + * Gets getRankingInfo + * + * @return bool|null + */ + public function getGetRankingInfo() + { + return $this->container['getRankingInfo']; + } + + /** + * Sets getRankingInfo + * + * @param bool|null $getRankingInfo retrieve detailed ranking information + * + * @return self + */ + public function setGetRankingInfo($getRankingInfo) + { + $this->container['getRankingInfo'] = $getRankingInfo; + + return $this; + } + + /** + * Gets clickAnalytics + * + * @return bool|null + */ + public function getClickAnalytics() + { + return $this->container['clickAnalytics']; + } + + /** + * Sets clickAnalytics + * + * @param bool|null $clickAnalytics enable the Click Analytics feature + * + * @return self + */ + public function setClickAnalytics($clickAnalytics) + { + $this->container['clickAnalytics'] = $clickAnalytics; + + return $this; + } + + /** + * Gets analytics + * + * @return bool|null + */ + public function getAnalytics() + { + return $this->container['analytics']; + } + + /** + * Sets analytics + * + * @param bool|null $analytics whether the current query will be taken into account in the Analytics + * + * @return self + */ + public function setAnalytics($analytics) + { + $this->container['analytics'] = $analytics; + + return $this; + } + + /** + * Gets analyticsTags + * + * @return string[]|null + */ + public function getAnalyticsTags() + { + return $this->container['analyticsTags']; + } + + /** + * Sets analyticsTags + * + * @param string[]|null $analyticsTags list of tags to apply to the query for analytics purposes + * + * @return self + */ + public function setAnalyticsTags($analyticsTags) + { + $this->container['analyticsTags'] = $analyticsTags; + + return $this; + } + + /** + * Gets percentileComputation + * + * @return bool|null + */ + public function getPercentileComputation() + { + return $this->container['percentileComputation']; + } + + /** + * Sets percentileComputation + * + * @param bool|null $percentileComputation whether to include or exclude a query from the processing-time percentile computation + * + * @return self + */ + public function setPercentileComputation($percentileComputation) + { + $this->container['percentileComputation'] = $percentileComputation; + + return $this; + } + + /** + * Gets enableABTest + * + * @return bool|null + */ + public function getEnableABTest() + { + return $this->container['enableABTest']; + } + + /** + * Sets enableABTest + * + * @param bool|null $enableABTest whether this search should participate in running AB tests + * + * @return self + */ + public function setEnableABTest($enableABTest) + { + $this->container['enableABTest'] = $enableABTest; + + return $this; + } + + /** + * Gets enableReRanking + * + * @return bool|null + */ + public function getEnableReRanking() + { + return $this->container['enableReRanking']; + } + + /** + * Sets enableReRanking + * + * @param bool|null $enableReRanking whether this search should use AI Re-Ranking + * + * @return self + */ + public function setEnableReRanking($enableReRanking) + { + $this->container['enableReRanking'] = $enableReRanking; + + 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 searchableAttributes + * + * @return string[]|null + */ + public function getSearchableAttributes() + { + return $this->container['searchableAttributes']; + } + + /** + * Sets searchableAttributes + * + * @param string[]|null $searchableAttributes the complete list of attributes used for searching + * + * @return self + */ + public function setSearchableAttributes($searchableAttributes) + { + $this->container['searchableAttributes'] = $searchableAttributes; + + return $this; + } + + /** + * Gets attributesForFaceting + * + * @return string[]|null + */ + public function getAttributesForFaceting() + { + return $this->container['attributesForFaceting']; + } + + /** + * Sets attributesForFaceting + * + * @param string[]|null $attributesForFaceting the complete list of attributes that will be used for faceting + * + * @return self + */ + public function setAttributesForFaceting($attributesForFaceting) + { + $this->container['attributesForFaceting'] = $attributesForFaceting; + + return $this; + } + + /** + * Gets unretrievableAttributes + * + * @return string[]|null + */ + public function getUnretrievableAttributes() + { + return $this->container['unretrievableAttributes']; + } + + /** + * Sets unretrievableAttributes + * + * @param string[]|null $unretrievableAttributes list of attributes that can't be retrieved at query time + * + * @return self + */ + public function setUnretrievableAttributes($unretrievableAttributes) + { + $this->container['unretrievableAttributes'] = $unretrievableAttributes; + + return $this; + } + + /** + * Gets attributesToRetrieve + * + * @return string[]|null + */ + public function getAttributesToRetrieve() + { + return $this->container['attributesToRetrieve']; + } + + /** + * Sets attributesToRetrieve + * + * @param string[]|null $attributesToRetrieve this parameter controls which attributes to retrieve and which not to retrieve + * + * @return self + */ + public function setAttributesToRetrieve($attributesToRetrieve) + { + $this->container['attributesToRetrieve'] = $attributesToRetrieve; + + return $this; + } + + /** + * Gets restrictSearchableAttributes + * + * @return string[]|null + */ + public function getRestrictSearchableAttributes() + { + return $this->container['restrictSearchableAttributes']; + } + + /** + * Sets restrictSearchableAttributes + * + * @param string[]|null $restrictSearchableAttributes restricts a given query to look in only a subset of your searchable attributes + * + * @return self + */ + public function setRestrictSearchableAttributes($restrictSearchableAttributes) + { + $this->container['restrictSearchableAttributes'] = $restrictSearchableAttributes; + + return $this; + } + + /** + * Gets ranking + * + * @return string[]|null + */ + public function getRanking() + { + return $this->container['ranking']; + } + + /** + * Sets ranking + * + * @param string[]|null $ranking controls how Algolia should sort your results + * + * @return self + */ + public function setRanking($ranking) + { + $this->container['ranking'] = $ranking; + + return $this; + } + + /** + * Gets customRanking + * + * @return string[]|null + */ + public function getCustomRanking() + { + return $this->container['customRanking']; + } + + /** + * Sets customRanking + * + * @param string[]|null $customRanking specifies the custom ranking criterion + * + * @return self + */ + public function setCustomRanking($customRanking) + { + $this->container['customRanking'] = $customRanking; + + return $this; + } + + /** + * Gets relevancyStrictness + * + * @return int|null + */ + public function getRelevancyStrictness() + { + return $this->container['relevancyStrictness']; + } + + /** + * Sets relevancyStrictness + * + * @param int|null $relevancyStrictness controls the relevancy threshold below which less relevant results aren't included in the results + * + * @return self + */ + public function setRelevancyStrictness($relevancyStrictness) + { + $this->container['relevancyStrictness'] = $relevancyStrictness; + + return $this; + } + + /** + * Gets attributesToHighlight + * + * @return string[]|null + */ + public function getAttributesToHighlight() + { + return $this->container['attributesToHighlight']; + } + + /** + * Sets attributesToHighlight + * + * @param string[]|null $attributesToHighlight list of attributes to highlight + * + * @return self + */ + public function setAttributesToHighlight($attributesToHighlight) + { + $this->container['attributesToHighlight'] = $attributesToHighlight; + + return $this; + } + + /** + * Gets attributesToSnippet + * + * @return string[]|null + */ + public function getAttributesToSnippet() + { + return $this->container['attributesToSnippet']; + } + + /** + * Sets attributesToSnippet + * + * @param string[]|null $attributesToSnippet list of attributes to snippet, with an optional maximum number of words to snippet + * + * @return self + */ + public function setAttributesToSnippet($attributesToSnippet) + { + $this->container['attributesToSnippet'] = $attributesToSnippet; + + return $this; + } + + /** + * Gets highlightPreTag + * + * @return string|null + */ + public function getHighlightPreTag() + { + return $this->container['highlightPreTag']; + } + + /** + * Sets highlightPreTag + * + * @param string|null $highlightPreTag the HTML string to insert before the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPreTag($highlightPreTag) + { + $this->container['highlightPreTag'] = $highlightPreTag; + + return $this; + } + + /** + * Gets highlightPostTag + * + * @return string|null + */ + public function getHighlightPostTag() + { + return $this->container['highlightPostTag']; + } + + /** + * Sets highlightPostTag + * + * @param string|null $highlightPostTag the HTML string to insert after the highlighted parts in all highlight and snippet results + * + * @return self + */ + public function setHighlightPostTag($highlightPostTag) + { + $this->container['highlightPostTag'] = $highlightPostTag; + + return $this; + } + + /** + * Gets snippetEllipsisText + * + * @return string|null + */ + public function getSnippetEllipsisText() + { + return $this->container['snippetEllipsisText']; + } + + /** + * Sets snippetEllipsisText + * + * @param string|null $snippetEllipsisText string used as an ellipsis indicator when a snippet is truncated + * + * @return self + */ + public function setSnippetEllipsisText($snippetEllipsisText) + { + $this->container['snippetEllipsisText'] = $snippetEllipsisText; + + return $this; + } + + /** + * Gets restrictHighlightAndSnippetArrays + * + * @return bool|null + */ + public function getRestrictHighlightAndSnippetArrays() + { + return $this->container['restrictHighlightAndSnippetArrays']; + } + + /** + * Sets restrictHighlightAndSnippetArrays + * + * @param bool|null $restrictHighlightAndSnippetArrays restrict highlighting and snippeting to items that matched the query + * + * @return self + */ + public function setRestrictHighlightAndSnippetArrays($restrictHighlightAndSnippetArrays) + { + $this->container['restrictHighlightAndSnippetArrays'] = $restrictHighlightAndSnippetArrays; + + return $this; + } + + /** + * Gets hitsPerPage + * + * @return int|null + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int|null $hitsPerPage set the number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Gets minWordSizefor1Typo + * + * @return int|null + */ + public function getMinWordSizefor1Typo() + { + return $this->container['minWordSizefor1Typo']; + } + + /** + * Sets minWordSizefor1Typo + * + * @param int|null $minWordSizefor1Typo minimum number of characters a word in the query string must contain to accept matches with 1 typo + * + * @return self + */ + public function setMinWordSizefor1Typo($minWordSizefor1Typo) + { + $this->container['minWordSizefor1Typo'] = $minWordSizefor1Typo; + + return $this; + } + + /** + * Gets minWordSizefor2Typos + * + * @return int|null + */ + public function getMinWordSizefor2Typos() + { + return $this->container['minWordSizefor2Typos']; + } + + /** + * Sets minWordSizefor2Typos + * + * @param int|null $minWordSizefor2Typos minimum number of characters a word in the query string must contain to accept matches with 2 typos + * + * @return self + */ + public function setMinWordSizefor2Typos($minWordSizefor2Typos) + { + $this->container['minWordSizefor2Typos'] = $minWordSizefor2Typos; + + return $this; + } + + /** + * Gets typoTolerance + * + * @return string|null + */ + public function getTypoTolerance() + { + return $this->container['typoTolerance']; + } + + /** + * Sets typoTolerance + * + * @param string|null $typoTolerance controls whether typo tolerance is enabled and how it is applied + * + * @return self + */ + public function setTypoTolerance($typoTolerance) + { + $allowedValues = $this->getTypoToleranceAllowableValues(); + if (!is_null($typoTolerance) && !in_array($typoTolerance, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'typoTolerance', must be one of '%s'", + $typoTolerance, + implode("', '", $allowedValues) + ) + ); + } + $this->container['typoTolerance'] = $typoTolerance; + + return $this; + } + + /** + * Gets allowTyposOnNumericTokens + * + * @return bool|null + */ + public function getAllowTyposOnNumericTokens() + { + return $this->container['allowTyposOnNumericTokens']; + } + + /** + * Sets allowTyposOnNumericTokens + * + * @param bool|null $allowTyposOnNumericTokens whether to allow typos on numbers (\"numeric tokens\") in the query string + * + * @return self + */ + public function setAllowTyposOnNumericTokens($allowTyposOnNumericTokens) + { + $this->container['allowTyposOnNumericTokens'] = $allowTyposOnNumericTokens; + + return $this; + } + + /** + * Gets disableTypoToleranceOnAttributes + * + * @return string[]|null + */ + public function getDisableTypoToleranceOnAttributes() + { + return $this->container['disableTypoToleranceOnAttributes']; + } + + /** + * Sets disableTypoToleranceOnAttributes + * + * @param string[]|null $disableTypoToleranceOnAttributes list of attributes on which you want to disable typo tolerance + * + * @return self + */ + public function setDisableTypoToleranceOnAttributes($disableTypoToleranceOnAttributes) + { + $this->container['disableTypoToleranceOnAttributes'] = $disableTypoToleranceOnAttributes; + + return $this; + } + + /** + * Gets separatorsToIndex + * + * @return string|null + */ + public function getSeparatorsToIndex() + { + return $this->container['separatorsToIndex']; + } + + /** + * Sets separatorsToIndex + * + * @param string|null $separatorsToIndex control which separators are indexed + * + * @return self + */ + public function setSeparatorsToIndex($separatorsToIndex) + { + $this->container['separatorsToIndex'] = $separatorsToIndex; + + return $this; + } + + /** + * Gets ignorePlurals + * + * @return string|null + */ + public function getIgnorePlurals() + { + return $this->container['ignorePlurals']; + } + + /** + * Sets ignorePlurals + * + * @param string|null $ignorePlurals treats singular, plurals, and other forms of declensions as matching terms + * + * @return self + */ + public function setIgnorePlurals($ignorePlurals) + { + $this->container['ignorePlurals'] = $ignorePlurals; + + return $this; + } + + /** + * Gets removeStopWords + * + * @return string|null + */ + public function getRemoveStopWords() + { + return $this->container['removeStopWords']; + } + + /** + * Sets removeStopWords + * + * @param string|null $removeStopWords removes stop (common) words from the query before executing it + * + * @return self + */ + public function setRemoveStopWords($removeStopWords) + { + $this->container['removeStopWords'] = $removeStopWords; + + return $this; + } + + /** + * Gets keepDiacriticsOnCharacters + * + * @return string|null + */ + public function getKeepDiacriticsOnCharacters() + { + return $this->container['keepDiacriticsOnCharacters']; + } + + /** + * Sets keepDiacriticsOnCharacters + * + * @param string|null $keepDiacriticsOnCharacters list of characters that the engine shouldn't automatically normalize + * + * @return self + */ + public function setKeepDiacriticsOnCharacters($keepDiacriticsOnCharacters) + { + $this->container['keepDiacriticsOnCharacters'] = $keepDiacriticsOnCharacters; + + return $this; + } + + /** + * Gets queryLanguages + * + * @return string[]|null + */ + public function getQueryLanguages() + { + return $this->container['queryLanguages']; + } + + /** + * Sets queryLanguages + * + * @param string[]|null $queryLanguages sets the languages to be used by language-specific settings and functionalities such as ignorePlurals, removeStopWords, and CJK word-detection + * + * @return self + */ + public function setQueryLanguages($queryLanguages) + { + $this->container['queryLanguages'] = $queryLanguages; + + return $this; + } + + /** + * Gets decompoundQuery + * + * @return bool|null + */ + public function getDecompoundQuery() + { + return $this->container['decompoundQuery']; + } + + /** + * Sets decompoundQuery + * + * @param bool|null $decompoundQuery splits compound words into their composing atoms in the query + * + * @return self + */ + public function setDecompoundQuery($decompoundQuery) + { + $this->container['decompoundQuery'] = $decompoundQuery; + + return $this; + } + + /** + * Gets enableRules + * + * @return bool|null + */ + public function getEnableRules() + { + return $this->container['enableRules']; + } + + /** + * Sets enableRules + * + * @param bool|null $enableRules whether Rules should be globally enabled + * + * @return self + */ + public function setEnableRules($enableRules) + { + $this->container['enableRules'] = $enableRules; + + return $this; + } + + /** + * Gets enablePersonalization + * + * @return bool|null + */ + public function getEnablePersonalization() + { + return $this->container['enablePersonalization']; + } + + /** + * Sets enablePersonalization + * + * @param bool|null $enablePersonalization enable the Personalization feature + * + * @return self + */ + public function setEnablePersonalization($enablePersonalization) + { + $this->container['enablePersonalization'] = $enablePersonalization; + + return $this; + } + + /** + * Gets queryType + * + * @return string|null + */ + public function getQueryType() + { + return $this->container['queryType']; + } + + /** + * Sets queryType + * + * @param string|null $queryType controls if and how query words are interpreted as prefixes + * + * @return self + */ + public function setQueryType($queryType) + { + $allowedValues = $this->getQueryTypeAllowableValues(); + if (!is_null($queryType) && !in_array($queryType, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'queryType', must be one of '%s'", + $queryType, + implode("', '", $allowedValues) + ) + ); + } + $this->container['queryType'] = $queryType; + + return $this; + } + + /** + * Gets removeWordsIfNoResults + * + * @return string|null + */ + public function getRemoveWordsIfNoResults() + { + return $this->container['removeWordsIfNoResults']; + } + + /** + * Sets removeWordsIfNoResults + * + * @param string|null $removeWordsIfNoResults selects a strategy to remove words from the query when it doesn't match any hits + * + * @return self + */ + public function setRemoveWordsIfNoResults($removeWordsIfNoResults) + { + $allowedValues = $this->getRemoveWordsIfNoResultsAllowableValues(); + if (!is_null($removeWordsIfNoResults) && !in_array($removeWordsIfNoResults, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'removeWordsIfNoResults', must be one of '%s'", + $removeWordsIfNoResults, + implode("', '", $allowedValues) + ) + ); + } + $this->container['removeWordsIfNoResults'] = $removeWordsIfNoResults; + + return $this; + } + + /** + * Gets advancedSyntax + * + * @return bool|null + */ + public function getAdvancedSyntax() + { + return $this->container['advancedSyntax']; + } + + /** + * Sets advancedSyntax + * + * @param bool|null $advancedSyntax enables the advanced query syntax + * + * @return self + */ + public function setAdvancedSyntax($advancedSyntax) + { + $this->container['advancedSyntax'] = $advancedSyntax; + + return $this; + } + + /** + * Gets optionalWords + * + * @return string[]|null + */ + public function getOptionalWords() + { + return $this->container['optionalWords']; + } + + /** + * Sets optionalWords + * + * @param string[]|null $optionalWords a list of words that should be considered as optional when found in the query + * + * @return self + */ + public function setOptionalWords($optionalWords) + { + $this->container['optionalWords'] = $optionalWords; + + return $this; + } + + /** + * Gets disableExactOnAttributes + * + * @return string[]|null + */ + public function getDisableExactOnAttributes() + { + return $this->container['disableExactOnAttributes']; + } + + /** + * Sets disableExactOnAttributes + * + * @param string[]|null $disableExactOnAttributes list of attributes on which you want to disable the exact ranking criterion + * + * @return self + */ + public function setDisableExactOnAttributes($disableExactOnAttributes) + { + $this->container['disableExactOnAttributes'] = $disableExactOnAttributes; + + return $this; + } + + /** + * Gets exactOnSingleWordQuery + * + * @return string|null + */ + public function getExactOnSingleWordQuery() + { + return $this->container['exactOnSingleWordQuery']; + } + + /** + * Sets exactOnSingleWordQuery + * + * @param string|null $exactOnSingleWordQuery controls how the exact ranking criterion is computed when the query contains only one word + * + * @return self + */ + public function setExactOnSingleWordQuery($exactOnSingleWordQuery) + { + $allowedValues = $this->getExactOnSingleWordQueryAllowableValues(); + if (!is_null($exactOnSingleWordQuery) && !in_array($exactOnSingleWordQuery, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'exactOnSingleWordQuery', must be one of '%s'", + $exactOnSingleWordQuery, + implode("', '", $allowedValues) + ) + ); + } + $this->container['exactOnSingleWordQuery'] = $exactOnSingleWordQuery; + + return $this; + } + + /** + * Gets alternativesAsExact + * + * @return string[]|null + */ + public function getAlternativesAsExact() + { + return $this->container['alternativesAsExact']; + } + + /** + * Sets alternativesAsExact + * + * @param string[]|null $alternativesAsExact list of alternatives that should be considered an exact match by the exact ranking criterion + * + * @return self + */ + public function setAlternativesAsExact($alternativesAsExact) + { + $allowedValues = $this->getAlternativesAsExactAllowableValues(); + if (!is_null($alternativesAsExact) && array_diff($alternativesAsExact, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'alternativesAsExact', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['alternativesAsExact'] = $alternativesAsExact; + + return $this; + } + + /** + * Gets advancedSyntaxFeatures + * + * @return string[]|null + */ + public function getAdvancedSyntaxFeatures() + { + return $this->container['advancedSyntaxFeatures']; + } + + /** + * Sets advancedSyntaxFeatures + * + * @param string[]|null $advancedSyntaxFeatures allows you to specify which advanced syntax features are active when ‘advancedSyntax' is enabled + * + * @return self + */ + public function setAdvancedSyntaxFeatures($advancedSyntaxFeatures) + { + $allowedValues = $this->getAdvancedSyntaxFeaturesAllowableValues(); + if (!is_null($advancedSyntaxFeatures) && array_diff($advancedSyntaxFeatures, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for 'advancedSyntaxFeatures', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + $this->container['advancedSyntaxFeatures'] = $advancedSyntaxFeatures; + + return $this; + } + + /** + * Gets distinct + * + * @return int|null + */ + public function getDistinct() + { + return $this->container['distinct']; + } + + /** + * Sets distinct + * + * @param int|null $distinct enables de-duplication or grouping of results + * + * @return self + */ + public function setDistinct($distinct) + { + if (!is_null($distinct) && ($distinct > 4)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling SearchParamsObject., must be smaller than or equal to 4.'); + } + if (!is_null($distinct) && ($distinct < 0)) { + throw new \InvalidArgumentException('invalid value for $distinct when calling SearchParamsObject., must be bigger than or equal to 0.'); + } + + $this->container['distinct'] = $distinct; + + return $this; + } + + /** + * Gets synonyms + * + * @return bool|null + */ + public function getSynonyms() + { + return $this->container['synonyms']; + } + + /** + * Sets synonyms + * + * @param bool|null $synonyms whether to take into account an index's synonyms for a particular search + * + * @return self + */ + public function setSynonyms($synonyms) + { + $this->container['synonyms'] = $synonyms; + + return $this; + } + + /** + * Gets replaceSynonymsInHighlight + * + * @return bool|null + */ + public function getReplaceSynonymsInHighlight() + { + return $this->container['replaceSynonymsInHighlight']; + } + + /** + * Sets replaceSynonymsInHighlight + * + * @param bool|null $replaceSynonymsInHighlight whether to highlight and snippet the original word that matches the synonym or the synonym itself + * + * @return self + */ + public function setReplaceSynonymsInHighlight($replaceSynonymsInHighlight) + { + $this->container['replaceSynonymsInHighlight'] = $replaceSynonymsInHighlight; + + return $this; + } + + /** + * Gets minProximity + * + * @return int|null + */ + public function getMinProximity() + { + return $this->container['minProximity']; + } + + /** + * Sets minProximity + * + * @param int|null $minProximity precision of the proximity ranking criterion + * + * @return self + */ + public function setMinProximity($minProximity) + { + if (!is_null($minProximity) && ($minProximity > 7)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling SearchParamsObject., must be smaller than or equal to 7.'); + } + if (!is_null($minProximity) && ($minProximity < 1)) { + throw new \InvalidArgumentException('invalid value for $minProximity when calling SearchParamsObject., must be bigger than or equal to 1.'); + } + + $this->container['minProximity'] = $minProximity; + + return $this; + } + + /** + * Gets responseFields + * + * @return string[]|null + */ + public function getResponseFields() + { + return $this->container['responseFields']; + } + + /** + * Sets responseFields + * + * @param string[]|null $responseFields Choose which fields to return in the API response. This parameters applies to search and browse queries. + * + * @return self + */ + public function setResponseFields($responseFields) + { + $this->container['responseFields'] = $responseFields; + + return $this; + } + + /** + * Gets maxFacetHits + * + * @return int|null + */ + public function getMaxFacetHits() + { + return $this->container['maxFacetHits']; + } + + /** + * Sets maxFacetHits + * + * @param int|null $maxFacetHits Maximum number of facet hits to return during a search for facet values. For performance reasons, the maximum allowed number of returned values is 100. + * + * @return self + */ + public function setMaxFacetHits($maxFacetHits) + { + if (!is_null($maxFacetHits) && ($maxFacetHits > 100)) { + throw new \InvalidArgumentException('invalid value for $maxFacetHits when calling SearchParamsObject., must be smaller than or equal to 100.'); + } + + $this->container['maxFacetHits'] = $maxFacetHits; + + return $this; + } + + /** + * Gets attributeCriteriaComputedByMinProximity + * + * @return bool|null + */ + public function getAttributeCriteriaComputedByMinProximity() + { + return $this->container['attributeCriteriaComputedByMinProximity']; + } + + /** + * Sets attributeCriteriaComputedByMinProximity + * + * @param bool|null $attributeCriteriaComputedByMinProximity when attribute is ranked above proximity in your ranking formula, proximity is used to select which searchable attribute is matched in the attribute ranking stage + * + * @return self + */ + public function setAttributeCriteriaComputedByMinProximity($attributeCriteriaComputedByMinProximity) + { + $this->container['attributeCriteriaComputedByMinProximity'] = $attributeCriteriaComputedByMinProximity; + + return $this; + } + + /** + * Gets renderingContent + * + * @return object|null + */ + public function getRenderingContent() + { + return $this->container['renderingContent']; + } + + /** + * Sets renderingContent + * + * @param object|null $renderingContent Content defining how the search interface should be rendered. Can be set via the settings for a default value and can be overridden via rules. + * + * @return self + */ + public function setRenderingContent($renderingContent) + { + $this->container['renderingContent'] = $renderingContent; + + 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/Search/SearchParamsString.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchParamsString.php new file mode 100644 index 0000000000..d3c40d8442 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchParamsString.php @@ -0,0 +1,290 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchParamsString implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchParamsString'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'params' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'params' => 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 = [ + 'params' => 'params', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'params' => 'setParams', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'params' => 'getParams', + ]; + + /** + * 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['params'] = $data['params'] ?? ''; + } + + /** + * 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 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; + } + /** + * 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/Search/SearchResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchResponse.php new file mode 100644 index 0000000000..c64038e60c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchResponse.php @@ -0,0 +1,1049 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchResponse'; + + /** + * 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\Search\Hit[]', + ]; + + /** + * 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 SearchResponse., 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\Search\Hit[] + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\Search\Hit[] $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/Search/SearchRulesParams.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchRulesParams.php new file mode 100644 index 0000000000..0bdb649303 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchRulesParams.php @@ -0,0 +1,472 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchRulesParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchRulesParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'query' => 'string', + 'anchoring' => '\Algolia\AlgoliaSearch\Model\Search\Anchoring', + 'context' => 'string', + 'page' => 'int', + 'hitsPerPage' => 'int', + 'enabled' => 'bool', + 'requestOptions' => 'object[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'query' => null, + 'anchoring' => null, + 'context' => null, + 'page' => null, + 'hitsPerPage' => null, + 'enabled' => null, + 'requestOptions' => 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', + 'anchoring' => 'anchoring', + 'context' => 'context', + 'page' => 'page', + 'hitsPerPage' => 'hitsPerPage', + 'enabled' => 'enabled', + 'requestOptions' => 'requestOptions', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'query' => 'setQuery', + 'anchoring' => 'setAnchoring', + 'context' => 'setContext', + 'page' => 'setPage', + 'hitsPerPage' => 'setHitsPerPage', + 'enabled' => 'setEnabled', + 'requestOptions' => 'setRequestOptions', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'query' => 'getQuery', + 'anchoring' => 'getAnchoring', + 'context' => 'getContext', + 'page' => 'getPage', + 'hitsPerPage' => 'getHitsPerPage', + 'enabled' => 'getEnabled', + 'requestOptions' => 'getRequestOptions', + ]; + + /** + * 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'] ?? ''; + $this->container['anchoring'] = $data['anchoring'] ?? null; + $this->container['context'] = $data['context'] ?? null; + $this->container['page'] = $data['page'] ?? 0; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + $this->container['enabled'] = $data['enabled'] ?? null; + $this->container['requestOptions'] = $data['requestOptions'] ?? 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 query + * + * @return string|null + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param string|null $query full text query + * + * @return self + */ + public function setQuery($query) + { + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets anchoring + * + * @return \Algolia\AlgoliaSearch\Model\Search\Anchoring|null + */ + public function getAnchoring() + { + return $this->container['anchoring']; + } + + /** + * Sets anchoring + * + * @param \Algolia\AlgoliaSearch\Model\Search\Anchoring|null $anchoring anchoring + * + * @return self + */ + public function setAnchoring($anchoring) + { + $this->container['anchoring'] = $anchoring; + + return $this; + } + + /** + * Gets context + * + * @return string|null + */ + public function getContext() + { + return $this->container['context']; + } + + /** + * Sets context + * + * @param string|null $context restricts matches to contextual rules with a specific context (exact match) + * + * @return self + */ + public function setContext($context) + { + $this->container['context'] = $context; + + return $this; + } + + /** + * Gets page + * + * @return int|null + */ + public function getPage() + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param int|null $page requested page (zero-based) + * + * @return self + */ + public function setPage($page) + { + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets hitsPerPage + * + * @return int|null + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int|null $hitsPerPage Maximum number of hits in a page. Minimum is 1, maximum is 1000. + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * Gets enabled + * + * @return bool|null + */ + public function getEnabled() + { + return $this->container['enabled']; + } + + /** + * Sets enabled + * + * @param bool|null $enabled When specified, restricts matches to rules with a specific enabled status. When absent (default), all rules are retrieved, regardless of their enabled status. + * + * @return self + */ + public function setEnabled($enabled) + { + $this->container['enabled'] = $enabled; + + return $this; + } + + /** + * Gets requestOptions + * + * @return object[]|null + */ + public function getRequestOptions() + { + return $this->container['requestOptions']; + } + + /** + * Sets requestOptions + * + * @param object[]|null $requestOptions a mapping of requestOptions to send along with the request + * + * @return self + */ + public function setRequestOptions($requestOptions) + { + $this->container['requestOptions'] = $requestOptions; + + 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/Search/SearchRulesResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchRulesResponse.php new file mode 100644 index 0000000000..92f0bc024e --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchRulesResponse.php @@ -0,0 +1,393 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchRulesResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchRulesResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hits' => '\Algolia\AlgoliaSearch\Model\Search\Rule[]', + 'nbHits' => 'int', + 'page' => 'int', + 'nbPages' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hits' => null, + 'nbHits' => null, + 'page' => null, + 'nbPages' => 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', + 'nbHits' => 'nbHits', + 'page' => 'page', + 'nbPages' => 'nbPages', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hits' => 'setHits', + 'nbHits' => 'setNbHits', + 'page' => 'setPage', + 'nbPages' => 'setNbPages', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hits' => 'getHits', + 'nbHits' => 'getNbHits', + 'page' => 'getPage', + 'nbPages' => 'getNbPages', + ]; + + /** + * 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; + $this->container['nbHits'] = $data['nbHits'] ?? null; + $this->container['page'] = $data['page'] ?? null; + $this->container['nbPages'] = $data['nbPages'] ?? 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"; + } + if ($this->container['nbHits'] === null) { + $invalidProperties[] = "'nbHits' can't be null"; + } + if ($this->container['page'] === null) { + $invalidProperties[] = "'page' can't be null"; + } + if ($this->container['nbPages'] === null) { + $invalidProperties[] = "'nbPages' 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\Search\Rule[] + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\Search\Rule[] $hits fetched rules + * + * @return self + */ + public function setHits($hits) + { + $this->container['hits'] = $hits; + + return $this; + } + + /** + * Gets nbHits + * + * @return int + */ + public function getNbHits() + { + return $this->container['nbHits']; + } + + /** + * Sets nbHits + * + * @param int $nbHits number of fetched rules + * + * @return self + */ + public function setNbHits($nbHits) + { + $this->container['nbHits'] = $nbHits; + + return $this; + } + + /** + * Gets page + * + * @return int + */ + public function getPage() + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param int $page current page + * + * @return self + */ + public function setPage($page) + { + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets nbPages + * + * @return int + */ + public function getNbPages() + { + return $this->container['nbPages']; + } + + /** + * Sets nbPages + * + * @param int $nbPages number of pages + * + * @return self + */ + public function setNbPages($nbPages) + { + $this->container['nbPages'] = $nbPages; + + 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/Search/SearchSynonymsResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchSynonymsResponse.php new file mode 100644 index 0000000000..6ecb838e55 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchSynonymsResponse.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchSynonymsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchSynonymsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hits' => '\Algolia\AlgoliaSearch\Model\Search\SynonymHit[]', + 'nbHits' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hits' => 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 = [ + 'hits' => 'hits', + 'nbHits' => 'nbHits', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hits' => 'setHits', + 'nbHits' => 'setNbHits', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hits' => 'getHits', + '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['hits'] = $data['hits'] ?? 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['hits'] === null) { + $invalidProperties[] = "'hits' 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 hits + * + * @return \Algolia\AlgoliaSearch\Model\Search\SynonymHit[] + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\Search\SynonymHit[] $hits array of synonym objects + * + * @return self + */ + public function setHits($hits) + { + $this->container['hits'] = $hits; + + 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/Search/SearchUserIdsParams.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchUserIdsParams.php new file mode 100644 index 0000000000..0d182ddcce --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchUserIdsParams.php @@ -0,0 +1,386 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchUserIdsParams implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchUserIdsParams'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'query' => 'string', + 'clusterName' => 'string', + 'page' => 'int', + 'hitsPerPage' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'query' => null, + 'clusterName' => null, + 'page' => null, + 'hitsPerPage' => 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', + 'clusterName' => 'clusterName', + 'page' => 'page', + 'hitsPerPage' => 'hitsPerPage', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'query' => 'setQuery', + 'clusterName' => 'setClusterName', + 'page' => 'setPage', + 'hitsPerPage' => 'setHitsPerPage', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'query' => 'getQuery', + 'clusterName' => 'getClusterName', + 'page' => 'getPage', + 'hitsPerPage' => 'getHitsPerPage', + ]; + + /** + * 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['clusterName'] = $data['clusterName'] ?? null; + $this->container['page'] = $data['page'] ?? 0; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + } + + /** + * 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"; + } + + 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 Query to search. The search is a prefix search with typoTolerance. Use empty query to retrieve all users. + * + * @return self + */ + public function setQuery($query) + { + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets clusterName + * + * @return string|null + */ + public function getClusterName() + { + return $this->container['clusterName']; + } + + /** + * Sets clusterName + * + * @param string|null $clusterName name of the cluster + * + * @return self + */ + public function setClusterName($clusterName) + { + $this->container['clusterName'] = $clusterName; + + return $this; + } + + /** + * Gets page + * + * @return int|null + */ + public function getPage() + { + return $this->container['page']; + } + + /** + * Sets page + * + * @param int|null $page specify the page to retrieve + * + * @return self + */ + public function setPage($page) + { + $this->container['page'] = $page; + + return $this; + } + + /** + * Gets hitsPerPage + * + * @return int|null + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int|null $hitsPerPage set the number of hits per page + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + 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/Search/SearchUserIdsResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchUserIdsResponse.php new file mode 100644 index 0000000000..0bbb5506c7 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchUserIdsResponse.php @@ -0,0 +1,428 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchUserIdsResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchUserIdsResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'hits' => '\Algolia\AlgoliaSearch\Model\Search\SearchUserIdsResponseHits[]', + 'nbHits' => 'int', + 'page' => 'int', + 'hitsPerPage' => 'int', + 'updatedAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'hits' => null, + 'nbHits' => null, + 'page' => null, + 'hitsPerPage' => null, + '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 = [ + 'hits' => 'hits', + 'nbHits' => 'nbHits', + 'page' => 'page', + 'hitsPerPage' => 'hitsPerPage', + 'updatedAt' => 'updatedAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'hits' => 'setHits', + 'nbHits' => 'setNbHits', + 'page' => 'setPage', + 'hitsPerPage' => 'setHitsPerPage', + 'updatedAt' => 'setUpdatedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'hits' => 'getHits', + 'nbHits' => 'getNbHits', + 'page' => 'getPage', + 'hitsPerPage' => 'getHitsPerPage', + '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['hits'] = $data['hits'] ?? null; + $this->container['nbHits'] = $data['nbHits'] ?? null; + $this->container['page'] = $data['page'] ?? 0; + $this->container['hitsPerPage'] = $data['hitsPerPage'] ?? 20; + $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['hits'] === null) { + $invalidProperties[] = "'hits' can't be null"; + } + if ($this->container['nbHits'] === null) { + $invalidProperties[] = "'nbHits' can't be null"; + } + if ($this->container['page'] === null) { + $invalidProperties[] = "'page' can't be null"; + } + if ($this->container['hitsPerPage'] === null) { + $invalidProperties[] = "'hitsPerPage' can't be null"; + } + 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 hits + * + * @return \Algolia\AlgoliaSearch\Model\Search\SearchUserIdsResponseHits[] + */ + public function getHits() + { + return $this->container['hits']; + } + + /** + * Sets hits + * + * @param \Algolia\AlgoliaSearch\Model\Search\SearchUserIdsResponseHits[] $hits list of user object matching the query + * + * @return self + */ + public function setHits($hits) + { + $this->container['hits'] = $hits; + + 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 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 hitsPerPage + * + * @return int + */ + public function getHitsPerPage() + { + return $this->container['hitsPerPage']; + } + + /** + * Sets hitsPerPage + * + * @param int $hitsPerPage Maximum number of hits in a page. Minimum is 1, maximum is 1000. + * + * @return self + */ + public function setHitsPerPage($hitsPerPage) + { + $this->container['hitsPerPage'] = $hitsPerPage; + + return $this; + } + + /** + * 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/Search/SearchUserIdsResponseHighlightResult.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchUserIdsResponseHighlightResult.php new file mode 100644 index 0000000000..79c4154c8b --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchUserIdsResponseHighlightResult.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchUserIdsResponseHighlightResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchUserIdsResponse__highlightResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'userID' => '\Algolia\AlgoliaSearch\Model\Search\HighlightResult', + 'clusterName' => '\Algolia\AlgoliaSearch\Model\Search\HighlightResult', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'userID' => null, + 'clusterName' => 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 = [ + 'userID' => 'userID', + 'clusterName' => 'clusterName', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'userID' => 'setUserID', + 'clusterName' => 'setClusterName', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'userID' => 'getUserID', + 'clusterName' => 'getClusterName', + ]; + + /** + * 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['userID'] = $data['userID'] ?? null; + $this->container['clusterName'] = $data['clusterName'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['userID'] === null) { + $invalidProperties[] = "'userID' can't be null"; + } + if ($this->container['clusterName'] === null) { + $invalidProperties[] = "'clusterName' 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 userID + * + * @return \Algolia\AlgoliaSearch\Model\Search\HighlightResult + */ + public function getUserID() + { + return $this->container['userID']; + } + + /** + * Sets userID + * + * @param \Algolia\AlgoliaSearch\Model\Search\HighlightResult $userID userID + * + * @return self + */ + public function setUserID($userID) + { + $this->container['userID'] = $userID; + + return $this; + } + + /** + * Gets clusterName + * + * @return \Algolia\AlgoliaSearch\Model\Search\HighlightResult + */ + public function getClusterName() + { + return $this->container['clusterName']; + } + + /** + * Sets clusterName + * + * @param \Algolia\AlgoliaSearch\Model\Search\HighlightResult $clusterName clusterName + * + * @return self + */ + public function setClusterName($clusterName) + { + $this->container['clusterName'] = $clusterName; + + 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/Search/SearchUserIdsResponseHits.php b/clients/algoliasearch-client-php/lib/Model/Search/SearchUserIdsResponseHits.php new file mode 100644 index 0000000000..25f4a23219 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SearchUserIdsResponseHits.php @@ -0,0 +1,467 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SearchUserIdsResponseHits implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'searchUserIdsResponse_hits'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'userID' => 'string', + 'clusterName' => 'string', + 'nbRecords' => 'int', + 'dataSize' => 'int', + 'objectID' => 'string', + 'highlightResult' => '\Algolia\AlgoliaSearch\Model\Search\SearchUserIdsResponseHighlightResult', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'userID' => null, + 'clusterName' => null, + 'nbRecords' => null, + 'dataSize' => null, + 'objectID' => null, + 'highlightResult' => 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 = [ + 'userID' => 'userID', + 'clusterName' => 'clusterName', + 'nbRecords' => 'nbRecords', + 'dataSize' => 'dataSize', + 'objectID' => 'objectID', + 'highlightResult' => '_highlightResult', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'userID' => 'setUserID', + 'clusterName' => 'setClusterName', + 'nbRecords' => 'setNbRecords', + 'dataSize' => 'setDataSize', + 'objectID' => 'setObjectID', + 'highlightResult' => 'setHighlightResult', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'userID' => 'getUserID', + 'clusterName' => 'getClusterName', + 'nbRecords' => 'getNbRecords', + 'dataSize' => 'getDataSize', + 'objectID' => 'getObjectID', + 'highlightResult' => 'getHighlightResult', + ]; + + /** + * 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['userID'] = $data['userID'] ?? null; + $this->container['clusterName'] = $data['clusterName'] ?? null; + $this->container['nbRecords'] = $data['nbRecords'] ?? null; + $this->container['dataSize'] = $data['dataSize'] ?? null; + $this->container['objectID'] = $data['objectID'] ?? null; + $this->container['highlightResult'] = $data['highlightResult'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['userID'] === null) { + $invalidProperties[] = "'userID' can't be null"; + } + if (!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $this->container['userID'])) { + $invalidProperties[] = "invalid value for 'userID', must be conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/."; + } + + if ($this->container['clusterName'] === null) { + $invalidProperties[] = "'clusterName' can't be null"; + } + if ($this->container['nbRecords'] === null) { + $invalidProperties[] = "'nbRecords' can't be null"; + } + if ($this->container['dataSize'] === null) { + $invalidProperties[] = "'dataSize' can't be null"; + } + if ($this->container['objectID'] === null) { + $invalidProperties[] = "'objectID' can't be null"; + } + if ($this->container['highlightResult'] === null) { + $invalidProperties[] = "'highlightResult' 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 userID + * + * @return string + */ + public function getUserID() + { + return $this->container['userID']; + } + + /** + * Sets userID + * + * @param string $userID userID of the user + * + * @return self + */ + public function setUserID($userID) + { + if ((!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $userID))) { + throw new \InvalidArgumentException("invalid value for $userID when calling SearchUserIdsResponseHits., must conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/."); + } + + $this->container['userID'] = $userID; + + return $this; + } + + /** + * Gets clusterName + * + * @return string + */ + public function getClusterName() + { + return $this->container['clusterName']; + } + + /** + * Sets clusterName + * + * @param string $clusterName name of the cluster + * + * @return self + */ + public function setClusterName($clusterName) + { + $this->container['clusterName'] = $clusterName; + + return $this; + } + + /** + * Gets nbRecords + * + * @return int + */ + public function getNbRecords() + { + return $this->container['nbRecords']; + } + + /** + * Sets nbRecords + * + * @param int $nbRecords number of records in the cluster + * + * @return self + */ + public function setNbRecords($nbRecords) + { + $this->container['nbRecords'] = $nbRecords; + + return $this; + } + + /** + * Gets dataSize + * + * @return int + */ + public function getDataSize() + { + return $this->container['dataSize']; + } + + /** + * Sets dataSize + * + * @param int $dataSize data size taken by all the users assigned to the cluster + * + * @return self + */ + public function setDataSize($dataSize) + { + $this->container['dataSize'] = $dataSize; + + return $this; + } + + /** + * Gets objectID + * + * @return string + */ + public function getObjectID() + { + return $this->container['objectID']; + } + + /** + * Sets objectID + * + * @param string $objectID userID of the requested user. Same as userID. + * + * @return self + */ + public function setObjectID($objectID) + { + $this->container['objectID'] = $objectID; + + return $this; + } + + /** + * Gets highlightResult + * + * @return \Algolia\AlgoliaSearch\Model\Search\SearchUserIdsResponseHighlightResult + */ + public function getHighlightResult() + { + return $this->container['highlightResult']; + } + + /** + * Sets highlightResult + * + * @param \Algolia\AlgoliaSearch\Model\Search\SearchUserIdsResponseHighlightResult $highlightResult highlightResult + * + * @return self + */ + public function setHighlightResult($highlightResult) + { + $this->container['highlightResult'] = $highlightResult; + + 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/Search/SnippetResult.php b/clients/algoliasearch-client-php/lib/Model/Search/SnippetResult.php new file mode 100644 index 0000000000..e507424b3e --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SnippetResult.php @@ -0,0 +1,357 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SnippetResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'snippetResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'value' => 'string', + 'matchLevel' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'value' => null, + 'matchLevel' => 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 = [ + 'value' => 'value', + 'matchLevel' => 'matchLevel', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'value' => 'setValue', + 'matchLevel' => 'setMatchLevel', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'value' => 'getValue', + 'matchLevel' => 'getMatchLevel', + ]; + + /** + * 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 MATCH_LEVEL_NONE = 'none'; + const MATCH_LEVEL_PARTIAL = 'partial'; + const MATCH_LEVEL_FULL = 'full'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getMatchLevelAllowableValues() + { + return [ + self::MATCH_LEVEL_NONE, + self::MATCH_LEVEL_PARTIAL, + self::MATCH_LEVEL_FULL, + ]; + } + + /** + * 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['value'] = $data['value'] ?? null; + $this->container['matchLevel'] = $data['matchLevel'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + $allowedValues = $this->getMatchLevelAllowableValues(); + if (!is_null($this->container['matchLevel']) && !in_array($this->container['matchLevel'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'matchLevel', must be one of '%s'", + $this->container['matchLevel'], + implode("', '", $allowedValues) + ); + } + + 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 value + * + * @return string|null + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param string|null $value markup text with occurrences highlighted + * + * @return self + */ + public function setValue($value) + { + $this->container['value'] = $value; + + return $this; + } + + /** + * Gets matchLevel + * + * @return string|null + */ + public function getMatchLevel() + { + return $this->container['matchLevel']; + } + + /** + * Sets matchLevel + * + * @param string|null $matchLevel indicates how well the attribute matched the search query + * + * @return self + */ + public function setMatchLevel($matchLevel) + { + $allowedValues = $this->getMatchLevelAllowableValues(); + if (!is_null($matchLevel) && !in_array($matchLevel, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'matchLevel', must be one of '%s'", + $matchLevel, + implode("', '", $allowedValues) + ) + ); + } + $this->container['matchLevel'] = $matchLevel; + + 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/Search/Source.php b/clients/algoliasearch-client-php/lib/Model/Search/Source.php new file mode 100644 index 0000000000..7ab01b8cf1 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/Source.php @@ -0,0 +1,326 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class Source implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'source'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'source' => 'string', + 'description' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'source' => 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 = [ + 'source' => 'source', + 'description' => 'description', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'source' => 'setSource', + 'description' => 'setDescription', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'source' => 'getSource', + '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['source'] = $data['source'] ?? 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['source'] === null) { + $invalidProperties[] = "'source' 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 source + * + * @return string + */ + public function getSource() + { + return $this->container['source']; + } + + /** + * Sets source + * + * @param string $source the IP range of the source + * + * @return self + */ + public function setSource($source) + { + $this->container['source'] = $source; + + return $this; + } + + /** + * Gets description + * + * @return string|null + */ + public function getDescription() + { + return $this->container['description']; + } + + /** + * Sets description + * + * @param string|null $description the description of the source + * + * @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/Search/StandardEntries.php b/clients/algoliasearch-client-php/lib/Model/Search/StandardEntries.php new file mode 100644 index 0000000000..f83d158810 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/StandardEntries.php @@ -0,0 +1,352 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class StandardEntries implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'standardEntries'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'plurals' => 'array', + 'stopwords' => 'array', + 'compounds' => 'array', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'plurals' => null, + 'stopwords' => null, + 'compounds' => 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 = [ + 'plurals' => 'plurals', + 'stopwords' => 'stopwords', + 'compounds' => 'compounds', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'plurals' => 'setPlurals', + 'stopwords' => 'setStopwords', + 'compounds' => 'setCompounds', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'plurals' => 'getPlurals', + 'stopwords' => 'getStopwords', + 'compounds' => 'getCompounds', + ]; + + /** + * 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['plurals'] = $data['plurals'] ?? null; + $this->container['stopwords'] = $data['stopwords'] ?? null; + $this->container['compounds'] = $data['compounds'] ?? 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 plurals + * + * @return array|null + */ + public function getPlurals() + { + return $this->container['plurals']; + } + + /** + * Sets plurals + * + * @param array|null $plurals language ISO code + * + * @return self + */ + public function setPlurals($plurals) + { + $this->container['plurals'] = $plurals; + + return $this; + } + + /** + * Gets stopwords + * + * @return array|null + */ + public function getStopwords() + { + return $this->container['stopwords']; + } + + /** + * Sets stopwords + * + * @param array|null $stopwords language ISO code + * + * @return self + */ + public function setStopwords($stopwords) + { + $this->container['stopwords'] = $stopwords; + + return $this; + } + + /** + * Gets compounds + * + * @return array|null + */ + public function getCompounds() + { + return $this->container['compounds']; + } + + /** + * Sets compounds + * + * @param array|null $compounds language ISO code + * + * @return self + */ + public function setCompounds($compounds) + { + $this->container['compounds'] = $compounds; + + 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/Search/SynonymHit.php b/clients/algoliasearch-client-php/lib/Model/Search/SynonymHit.php new file mode 100644 index 0000000000..136fd68db1 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SynonymHit.php @@ -0,0 +1,539 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SynonymHit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'synonymHit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'objectID' => 'string', + 'type' => '\Algolia\AlgoliaSearch\Model\Search\SynonymType', + 'synonyms' => 'string[]', + 'input' => 'string', + 'word' => 'string', + 'corrections' => 'string[]', + 'placeholder' => 'string', + 'replacements' => 'string[]', + 'highlightResult' => '\Algolia\AlgoliaSearch\Model\Search\SynonymHitHighlightResult', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'objectID' => null, + 'type' => null, + 'synonyms' => null, + 'input' => null, + 'word' => null, + 'corrections' => null, + 'placeholder' => null, + 'replacements' => null, + 'highlightResult' => 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 = [ + 'objectID' => 'objectID', + 'type' => 'type', + 'synonyms' => 'synonyms', + 'input' => 'input', + 'word' => 'word', + 'corrections' => 'corrections', + 'placeholder' => 'placeholder', + 'replacements' => 'replacements', + 'highlightResult' => '_highlightResult', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'objectID' => 'setObjectID', + 'type' => 'setType', + 'synonyms' => 'setSynonyms', + 'input' => 'setInput', + 'word' => 'setWord', + 'corrections' => 'setCorrections', + 'placeholder' => 'setPlaceholder', + 'replacements' => 'setReplacements', + 'highlightResult' => 'setHighlightResult', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'objectID' => 'getObjectID', + 'type' => 'getType', + 'synonyms' => 'getSynonyms', + 'input' => 'getInput', + 'word' => 'getWord', + 'corrections' => 'getCorrections', + 'placeholder' => 'getPlaceholder', + 'replacements' => 'getReplacements', + 'highlightResult' => 'getHighlightResult', + ]; + + /** + * 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['type'] = $data['type'] ?? null; + $this->container['synonyms'] = $data['synonyms'] ?? null; + $this->container['input'] = $data['input'] ?? null; + $this->container['word'] = $data['word'] ?? null; + $this->container['corrections'] = $data['corrections'] ?? null; + $this->container['placeholder'] = $data['placeholder'] ?? null; + $this->container['replacements'] = $data['replacements'] ?? null; + $this->container['highlightResult'] = $data['highlightResult'] ?? 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['type'] === null) { + $invalidProperties[] = "'type' 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 objectID + * + * @return string + */ + public function getObjectID() + { + return $this->container['objectID']; + } + + /** + * Sets objectID + * + * @param string $objectID unique identifier of the synonym object to be created or updated + * + * @return self + */ + public function setObjectID($objectID) + { + $this->container['objectID'] = $objectID; + + return $this; + } + + /** + * Gets type + * + * @return \Algolia\AlgoliaSearch\Model\Search\SynonymType + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Algolia\AlgoliaSearch\Model\Search\SynonymType $type type + * + * @return self + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets synonyms + * + * @return string[]|null + */ + public function getSynonyms() + { + return $this->container['synonyms']; + } + + /** + * Sets synonyms + * + * @param string[]|null $synonyms words or phrases to be considered equivalent + * + * @return self + */ + public function setSynonyms($synonyms) + { + $this->container['synonyms'] = $synonyms; + + return $this; + } + + /** + * Gets input + * + * @return string|null + */ + public function getInput() + { + return $this->container['input']; + } + + /** + * Sets input + * + * @param string|null $input word or phrase to appear in query strings (for onewaysynonym) + * + * @return self + */ + public function setInput($input) + { + $this->container['input'] = $input; + + return $this; + } + + /** + * Gets word + * + * @return string|null + */ + public function getWord() + { + return $this->container['word']; + } + + /** + * Sets word + * + * @param string|null $word word or phrase to appear in query strings (for altcorrection1 and altcorrection2) + * + * @return self + */ + public function setWord($word) + { + $this->container['word'] = $word; + + return $this; + } + + /** + * Gets corrections + * + * @return string[]|null + */ + public function getCorrections() + { + return $this->container['corrections']; + } + + /** + * Sets corrections + * + * @param string[]|null $corrections words to be matched in records + * + * @return self + */ + public function setCorrections($corrections) + { + $this->container['corrections'] = $corrections; + + return $this; + } + + /** + * Gets placeholder + * + * @return string|null + */ + public function getPlaceholder() + { + return $this->container['placeholder']; + } + + /** + * Sets placeholder + * + * @param string|null $placeholder token to be put inside records + * + * @return self + */ + public function setPlaceholder($placeholder) + { + $this->container['placeholder'] = $placeholder; + + return $this; + } + + /** + * Gets replacements + * + * @return string[]|null + */ + public function getReplacements() + { + return $this->container['replacements']; + } + + /** + * Sets replacements + * + * @param string[]|null $replacements list of query words that will match the token + * + * @return self + */ + public function setReplacements($replacements) + { + $this->container['replacements'] = $replacements; + + return $this; + } + + /** + * Gets highlightResult + * + * @return \Algolia\AlgoliaSearch\Model\Search\SynonymHitHighlightResult|null + */ + public function getHighlightResult() + { + return $this->container['highlightResult']; + } + + /** + * Sets highlightResult + * + * @param \Algolia\AlgoliaSearch\Model\Search\SynonymHitHighlightResult|null $highlightResult highlightResult + * + * @return self + */ + public function setHighlightResult($highlightResult) + { + $this->container['highlightResult'] = $highlightResult; + + 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/Search/SynonymHitHighlightResult.php b/clients/algoliasearch-client-php/lib/Model/Search/SynonymHitHighlightResult.php new file mode 100644 index 0000000000..669a114dea --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SynonymHitHighlightResult.php @@ -0,0 +1,322 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class SynonymHitHighlightResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'synonymHit__highlightResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'type' => '\Algolia\AlgoliaSearch\Model\Search\HighlightResult', + 'synonyms' => '\Algolia\AlgoliaSearch\Model\Search\HighlightResult[]', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'type' => null, + 'synonyms' => 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 = [ + 'type' => 'type', + 'synonyms' => 'synonyms', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'type' => 'setType', + 'synonyms' => 'setSynonyms', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'type' => 'getType', + 'synonyms' => 'getSynonyms', + ]; + + /** + * 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['type'] = $data['type'] ?? null; + $this->container['synonyms'] = $data['synonyms'] ?? 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 type + * + * @return \Algolia\AlgoliaSearch\Model\Search\HighlightResult|null + */ + public function getType() + { + return $this->container['type']; + } + + /** + * Sets type + * + * @param \Algolia\AlgoliaSearch\Model\Search\HighlightResult|null $type type + * + * @return self + */ + public function setType($type) + { + $this->container['type'] = $type; + + return $this; + } + + /** + * Gets synonyms + * + * @return \Algolia\AlgoliaSearch\Model\Search\HighlightResult[]|null + */ + public function getSynonyms() + { + return $this->container['synonyms']; + } + + /** + * Sets synonyms + * + * @param \Algolia\AlgoliaSearch\Model\Search\HighlightResult[]|null $synonyms synonyms + * + * @return self + */ + public function setSynonyms($synonyms) + { + $this->container['synonyms'] = $synonyms; + + 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/Search/SynonymType.php b/clients/algoliasearch-client-php/lib/Model/Search/SynonymType.php new file mode 100644 index 0000000000..c3e816b217 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/SynonymType.php @@ -0,0 +1,44 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class TimeRange implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'timeRange'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => 'int', + 'until' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'until' => 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 = [ + 'from' => 'from', + 'until' => 'until', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'until' => 'setUntil', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + 'until' => 'getUntil', + ]; + + /** + * 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['from'] = $data['from'] ?? null; + $this->container['until'] = $data['until'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['until'] === null) { + $invalidProperties[] = "'until' 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 from + * + * @return int + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param int $from lower bound of the time range (Unix timestamp) + * + * @return self + */ + public function setFrom($from) + { + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets until + * + * @return int + */ + public function getUntil() + { + return $this->container['until']; + } + + /** + * Sets until + * + * @param int $until upper bound of the time range (Unix timestamp) + * + * @return self + */ + public function setUntil($until) + { + $this->container['until'] = $until; + + 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/Search/UpdateApiKeyResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/UpdateApiKeyResponse.php new file mode 100644 index 0000000000..d9d278c0a4 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/UpdateApiKeyResponse.php @@ -0,0 +1,327 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdateApiKeyResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'updateApiKeyResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'key' => 'string', + 'updatedAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'key' => null, + '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 = [ + 'key' => 'key', + 'updatedAt' => 'updatedAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'key' => 'setKey', + 'updatedAt' => 'setUpdatedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'key' => 'getKey', + '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['key'] = $data['key'] ?? 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['key'] === null) { + $invalidProperties[] = "'key' can't be null"; + } + 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 key + * + * @return string + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param string $key key string + * + * @return self + */ + public function setKey($key) + { + $this->container['key'] = $key; + + return $this; + } + + /** + * 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/Search/UpdatedAtResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/UpdatedAtResponse.php new file mode 100644 index 0000000000..6b300a4157 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/UpdatedAtResponse.php @@ -0,0 +1,329 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdatedAtResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'updatedAtResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'taskID' => 'int', + 'updatedAt' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'taskID' => null, + '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 = [ + 'taskID' => 'taskID', + 'updatedAt' => 'updatedAt', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'taskID' => 'setTaskID', + 'updatedAt' => 'setUpdatedAt', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'taskID' => 'getTaskID', + '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['taskID'] = $data['taskID'] ?? 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['taskID'] === null) { + $invalidProperties[] = "'taskID' can't be null"; + } + 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 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; + } + + /** + * 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/Search/UpdatedAtWithObjectIdResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/UpdatedAtWithObjectIdResponse.php new file mode 100644 index 0000000000..00d77c0c1d --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/UpdatedAtWithObjectIdResponse.php @@ -0,0 +1,352 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdatedAtWithObjectIdResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'updatedAtWithObjectIdResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'taskID' => 'int', + 'updatedAt' => 'string', + 'objectID' => 'string', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'taskID' => null, + 'updatedAt' => null, + 'objectID' => 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 = [ + 'taskID' => 'taskID', + 'updatedAt' => 'updatedAt', + 'objectID' => 'objectID', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'taskID' => 'setTaskID', + 'updatedAt' => 'setUpdatedAt', + 'objectID' => 'setObjectID', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'taskID' => 'getTaskID', + 'updatedAt' => 'getUpdatedAt', + 'objectID' => 'getObjectID', + ]; + + /** + * 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['taskID'] = $data['taskID'] ?? null; + $this->container['updatedAt'] = $data['updatedAt'] ?? null; + $this->container['objectID'] = $data['objectID'] ?? 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 taskID + * + * @return int|null + */ + public function getTaskID() + { + return $this->container['taskID']; + } + + /** + * Sets taskID + * + * @param int|null $taskID taskID of the task to wait for + * + * @return self + */ + public function setTaskID($taskID) + { + $this->container['taskID'] = $taskID; + + return $this; + } + + /** + * Gets updatedAt + * + * @return string|null + */ + public function getUpdatedAt() + { + return $this->container['updatedAt']; + } + + /** + * Sets updatedAt + * + * @param string|null $updatedAt date of last update (ISO-8601 format) + * + * @return self + */ + public function setUpdatedAt($updatedAt) + { + $this->container['updatedAt'] = $updatedAt; + + return $this; + } + + /** + * Gets objectID + * + * @return string|null + */ + public function getObjectID() + { + return $this->container['objectID']; + } + + /** + * Sets objectID + * + * @param string|null $objectID unique identifier of the object + * + * @return self + */ + public function setObjectID($objectID) + { + $this->container['objectID'] = $objectID; + + 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/Search/UpdatedRuleResponse.php b/clients/algoliasearch-client-php/lib/Model/Search/UpdatedRuleResponse.php new file mode 100644 index 0000000000..eeffeaaeef --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/UpdatedRuleResponse.php @@ -0,0 +1,360 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UpdatedRuleResponse implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'updatedRuleResponse'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'objectID' => 'string', + 'updatedAt' => 'string', + 'taskID' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'objectID' => null, + 'updatedAt' => 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 = [ + 'objectID' => 'objectID', + 'updatedAt' => 'updatedAt', + 'taskID' => 'taskID', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'objectID' => 'setObjectID', + 'updatedAt' => 'setUpdatedAt', + 'taskID' => 'setTaskID', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'objectID' => 'getObjectID', + 'updatedAt' => 'getUpdatedAt', + '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['objectID'] = $data['objectID'] ?? null; + $this->container['updatedAt'] = $data['updatedAt'] ?? 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['objectID'] === null) { + $invalidProperties[] = "'objectID' can't be null"; + } + if ($this->container['updatedAt'] === null) { + $invalidProperties[] = "'updatedAt' 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 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 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; + } + + /** + * 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/Search/UserId.php b/clients/algoliasearch-client-php/lib/Model/Search/UserId.php new file mode 100644 index 0000000000..1d2e6a5c50 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Model/Search/UserId.php @@ -0,0 +1,403 @@ + + * @template TKey int|null + * @template TValue mixed|null + */ +class UserId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'userId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'userID' => 'string', + 'clusterName' => 'string', + 'nbRecords' => 'int', + 'dataSize' => 'int', + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'userID' => null, + 'clusterName' => null, + 'nbRecords' => null, + 'dataSize' => 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 = [ + 'userID' => 'userID', + 'clusterName' => 'clusterName', + 'nbRecords' => 'nbRecords', + 'dataSize' => 'dataSize', + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'userID' => 'setUserID', + 'clusterName' => 'setClusterName', + 'nbRecords' => 'setNbRecords', + 'dataSize' => 'setDataSize', + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'userID' => 'getUserID', + 'clusterName' => 'getClusterName', + 'nbRecords' => 'getNbRecords', + 'dataSize' => 'getDataSize', + ]; + + /** + * 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['userID'] = $data['userID'] ?? null; + $this->container['clusterName'] = $data['clusterName'] ?? null; + $this->container['nbRecords'] = $data['nbRecords'] ?? null; + $this->container['dataSize'] = $data['dataSize'] ?? null; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['userID'] === null) { + $invalidProperties[] = "'userID' can't be null"; + } + if (!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $this->container['userID'])) { + $invalidProperties[] = "invalid value for 'userID', must be conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/."; + } + + if ($this->container['clusterName'] === null) { + $invalidProperties[] = "'clusterName' can't be null"; + } + if ($this->container['nbRecords'] === null) { + $invalidProperties[] = "'nbRecords' can't be null"; + } + if ($this->container['dataSize'] === null) { + $invalidProperties[] = "'dataSize' 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 userID + * + * @return string + */ + public function getUserID() + { + return $this->container['userID']; + } + + /** + * Sets userID + * + * @param string $userID userID of the user + * + * @return self + */ + public function setUserID($userID) + { + if ((!preg_match('/^[a-zA-Z0-9 \\-*.]+$/', $userID))) { + throw new \InvalidArgumentException("invalid value for $userID when calling UserId., must conform to the pattern /^[a-zA-Z0-9 \\-*.]+$/."); + } + + $this->container['userID'] = $userID; + + return $this; + } + + /** + * Gets clusterName + * + * @return string + */ + public function getClusterName() + { + return $this->container['clusterName']; + } + + /** + * Sets clusterName + * + * @param string $clusterName cluster on which the user is assigned + * + * @return self + */ + public function setClusterName($clusterName) + { + $this->container['clusterName'] = $clusterName; + + return $this; + } + + /** + * Gets nbRecords + * + * @return int + */ + public function getNbRecords() + { + return $this->container['nbRecords']; + } + + /** + * Sets nbRecords + * + * @param int $nbRecords number of records belonging to the user + * + * @return self + */ + public function setNbRecords($nbRecords) + { + $this->container['nbRecords'] = $nbRecords; + + return $this; + } + + /** + * Gets dataSize + * + * @return int + */ + public function getDataSize() + { + return $this->container['dataSize']; + } + + /** + * Sets dataSize + * + * @param int $dataSize data size used by the user + * + * @return self + */ + public function setDataSize($dataSize) + { + $this->container['dataSize'] = $dataSize; + + 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/ModelInterface.php b/clients/algoliasearch-client-php/lib/ModelInterface.php new file mode 100644 index 0000000000..a9505a67e5 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/ModelInterface.php @@ -0,0 +1,68 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if ($value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach ($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + + return (object) $values; + } + + return (string) $data; + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } + + return $filename; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the query, by imploding comma-separated if it's an object. + * If it's a string, pass through unchanged. It will be url-encoded + * later. + * + * @param string[]|string|\DateTime $object an object to be serialized to a string + * + * @return string the serialized object + */ + public static function toQueryValue($object) + { + if (is_array($object)) { + return implode(',', $object); + } + + return self::toString($object); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } + + return $value; + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(mb_substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = mb_substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = mb_substr($class, 4, -1); + $deserialized = []; + if (mb_strrpos($inner, ',') !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + + return $data; + } + + if ($class === '\DateTime') { + // Some API's return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some API's return a date-time with too high nanosecond + // precision for php's DateTime to handle. This conversion + // (string -> unix timestamp -> DateTime) is a workaround + // for the problem. + return (new \DateTime())->setTimestamp(strtotime($data)); + } + } else { + return null; + } + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + + return $data; + } + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + + return $data; + } + $data = is_string($data) ? json_decode($data) : $data; + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\Algolia\AlgoliaSearch\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + + return $instance; + } +} diff --git a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptions.php b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptions.php new file mode 100644 index 0000000000..45b176223c --- /dev/null +++ b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptions.php @@ -0,0 +1,368 @@ +{$name} = $options[$name]; + } + } + + $this->readTimeout = $options['readTimeout']; + $this->writeTimeout = $options['writeTimeout']; + $this->connectTimeout = $options['connectTimeout']; + } + + /** + * Get the HTTP headers to add to the request. + * + * @return array List of name/value pairs + */ + public function getHeaders() + { + return $this->headers; + } + + /** + * Add a header to the list. If a value already exists for that name, it will be overwritten. + * + * @param string $name Name of the header + * @param string $value Value of the header + * + * @return $this + */ + public function addHeader($name, $value) + { + $this->headers[$name] = $value; + + return $this; + } + + /** + * @param $headers + * + * @return $this + */ + public function addHeaders($headers) + { + $this->headers = array_merge($this->headers, $headers); + + return $this; + } + + /** + * Add a new header to the list if there is no value already set. + * + * @param string $name Name of the header + * @param string $value Value of the header + * + * @return $this + */ + public function addDefaultHeader($name, $value) + { + if (!isset($this->headers[$name])) { + $this->headers[$name] = $value; + } + + return $this; + } + + /** + * Add the headers passed if the value isn't already set. + * + * @param array $headers List of header name/value pairs + * + * @return $this + */ + public function addDefaultHeaders($headers) + { + foreach ($headers as $name => $value) { + $this->addDefaultHeader($name, $value); + } + + return $this; + } + + /** + * Replace all existing headers with the given name/value pairs. + * + * @param array $headers List of header name/value pairs + * + * @return $this + */ + public function setHeaders($headers) + { + $this->headers = $headers; + + return $this; + } + + /** + * @return array List of name/value query parameters + */ + public function getQueryParameters() + { + return $this->query; + } + + /** + * @return string URL-encoded query string + */ + public function getBuiltQueryParameters() + { + return Helpers::buildQuery($this->query); + } + + /** + * Add a query parameter. If a value already exists for that name, it will be overwritten. + * + * @param string $name + * @param string $value + * + * @return $this + */ + public function addQueryParameter($name, $value) + { + $this->query[$name] = $value; + + return $this; + } + + /** + * Add a list of query parameters name/value pairs. + * If a value already exists for a name, it will be overwritten. + * + * @param $parameters + * + * @return $this + */ + public function addQueryParameters($parameters) + { + $this->query = array_merge($this->query, $parameters); + + return $this; + } + + /** + * Add a query parameter if it isn't already set. + * + * @param string $name Name of the query parameter + * @param string $value Value of the query parameter + * + * @return $this + */ + public function addDefaultQueryParameter($name, $value) + { + if (!isset($this->query[$name])) { + $this->query[$name] = $value; + } + + return $this; + } + + /** + * Add parameters if they aren't already set. + * + * @param array $queryParameters Query parameters name/value pairs + * + * @return $this + */ + public function addDefaultQueryParameters($queryParameters) + { + foreach ($queryParameters as $name => $value) { + $this->addDefaultQueryParameter($name, $value); + } + + return $this; + } + + /** + * Replace all existing query parameters with the given name/value pairs. + * + * @param array $queryParameters + * + * @return $this + */ + public function setQueryParameters($queryParameters) + { + $this->query = $queryParameters; + + return $this; + } + + /** + * Get HTTP body to add. + * + * @return array + */ + public function getBody() + { + return $this->body; + } + + /** + * Add a body parameter. If a value already exists for that name, it will be overwritten. + * + * @param string $name + * @param mixed $value + * + * @return $this + */ + public function addBodyParameter($name, $value) + { + $this->body[$name] = $value; + + return $this; + } + + /** + * Add parameters if they aren't already set. + * + * @param array $parameters Body parameters name/value pairs + * + * @return $this + */ + public function addBodyParameters($parameters) + { + $this->body = array_merge($this->body, $parameters); + + return $this; + } + + /** + * Add a body parameter if it isn't already set. + * + * @param string $name Name of the query parameter + * @param string $value Value of the query parameter + * + * @return $this + */ + public function addDefaultBodyParameter($name, $value) + { + if (!isset($this->body[$name])) { + $this->body[$name] = $value; + } + + return $this; + } + + /** + * Add parameters if they aren't already set. + * + * @param array $parameters Body parameters name/value pairs + * + * @return $this + */ + public function addDefaultBodyParameters($parameters) + { + foreach ($parameters as $name => $value) { + $this->addDefaultBodyParameter($name, $value); + } + + return $this; + } + + /** + * Replace all existing body parameters with the given name/value pairs. + * + * @param $body + * + * @return $this + */ + public function setBody($body) + { + $this->body = $body; + + return $this; + } + + /** + * Get timeout for read operations. + * + * @return int Timeout in seconds + */ + public function getReadTimeout() + { + return $this->readTimeout; + } + + /** + * Set timeout for read operations. + * + * @param int $readTimeout Timeout in seconds + * + * @return $this + */ + public function setReadTimeout($readTimeout) + { + $this->readTimeout = $readTimeout; + + return $this; + } + + /** + * Get timeout for write operations. + * + * @return int Timeout in seconds + */ + public function getWriteTimeout() + { + return $this->writeTimeout; + } + + /** + * Set timeout for write operations. + * + * @param int $writeTimeout Timeout in seconds + * + * @return $this + */ + public function setWriteTimeout($writeTimeout) + { + $this->writeTimeout = $writeTimeout; + + return $this; + } + + /** + * Get connect timeout. + * + * @return int Connect timeout in seconds + */ + public function getConnectTimeout() + { + return $this->connectTimeout; + } + + /** + * Set connect timeout. + * + * @param $connectTimeout Connect timeout in seconds + * + * @return $this + */ + public function setConnectTimeout($connectTimeout) + { + $this->connectTimeout = $connectTimeout; + + return $this; + } +} diff --git a/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php new file mode 100644 index 0000000000..f02eca5c7e --- /dev/null +++ b/clients/algoliasearch-client-php/lib/RequestOptions/RequestOptionsFactory.php @@ -0,0 +1,132 @@ +config = $config; + } + + /** + * @param \Algolia\AlgoliaSearch\RequestOptions\RequestOptions|array $options + * @param array $defaults + * + * @return \Algolia\AlgoliaSearch\RequestOptions\RequestOptions + */ + public function create($options, $defaults = []) + { + if (is_array($options)) { + $options += $defaults; + $options = $this->format($options); + $options = $this->normalize($options); + + $options = new RequestOptions($options); + } elseif ($options instanceof RequestOptions) { + $defaults = $this->create($defaults); + $options->addDefaultHeaders($defaults->getHeaders()); + $options->addDefaultQueryParameters($defaults->getQueryParameters()); + $options->addDefaultBodyParameters($defaults->getBody()); + } else { + throw new \InvalidArgumentException('RequestOptions can only be created from array or from RequestOptions object'); + } + + return $options->addDefaultHeaders($this->config->getDefaultHeaders()); + } + + public function createBodyLess($options, $defaults = []) + { + $options = $this->create($options, $defaults); + + return $options + ->addQueryParameters($options->getBody()) + ->setBody([]); + } + + private function normalize($options) + { + $normalized = [ + 'headers' => [ + 'X-Algolia-Application-Id' => $this->config->getAppId(), + 'X-Algolia-API-Key' => $this->config->getAlgoliaApiKey(), + 'User-Agent' => $this->config->getUserAgent() ? $this->config->getUserAgent() : UserAgent::get(), + 'Content-Type' => 'application/json', + ], + 'query' => [], + 'body' => [], + 'readTimeout' => $this->config->getReadTimeout(), + 'writeTimeout' => $this->config->getWriteTimeout(), + 'connectTimeout' => $this->config->getConnectTimeout(), + ]; + + foreach ($options as $optionName => $value) { + $type = $this->getOptionType($optionName); + + if (in_array($type, ['readTimeout', 'writeTimeout', 'connectTimeout'], true)) { + $normalized[$type] = $value; + } else { + $normalized[$type][$optionName] = $value; + } + } + + return $normalized; + } + + private function format($options) + { + foreach ($options as $name => $value) { + if (in_array($name, ['attributesToRetrieve', 'type'], true)) { + if (is_array($value)) { + $options[$name] = implode(',', $value); + } + } + } + + return $options; + } + + private function getOptionType($optionName) + { + if ($this->isValidHeaderName($optionName)) { + return 'headers'; + } elseif (in_array($optionName, $this->validQueryParameters, true)) { + return 'query'; + } elseif (in_array($optionName, ['connectTimeout', 'readTimeout', 'writeTimeout'], true)) { + return $optionName; + } + + return 'body'; + } + + private function isValidHeaderName($name) + { + if (preg_match('/^X-[a-zA-Z-]+/', $name)) { + return true; + } + + if (in_array($name, $this->validHeaders, true)) { + return true; + } + + return false; + } +} diff --git a/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php b/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php new file mode 100644 index 0000000000..ce4d782241 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapper.php @@ -0,0 +1,269 @@ +http = $http; + $this->config = $config; + $this->clusterHosts = $clusterHosts; + $this->requestOptionsFactory = $RqstOptsFactory ?: new RequestOptionsFactory($config); + $this->logger = $logger ?: Algolia::getLogger(); + if (defined('JSON_UNESCAPED_UNICODE')) { + // `JSON_UNESCAPED_UNICODE` is introduced in PHP 5.4.0 + $this->jsonOptions = JSON_UNESCAPED_UNICODE; + } + } + + public function read($method, $path, $requestOptions = [], $defaultRequestOptions = []) + { + if ('GET' === mb_strtoupper($method)) { + $requestOptions = $this->requestOptionsFactory->createBodyLess($requestOptions, $defaultRequestOptions); + } else { + $requestOptions = $this->requestOptionsFactory->create($requestOptions, $defaultRequestOptions); + } + + return $this->request( + $method, + $path, + $requestOptions, + $this->clusterHosts->read(), + $requestOptions->getReadTimeout() + ); + } + + public function write($method, $path, $data = [], $requestOptions = [], $defaultRequestOptions = []) + { + if ('DELETE' === mb_strtoupper($method)) { + $requestOptions = $this->requestOptionsFactory->createBodyLess($requestOptions, $defaultRequestOptions); + $data = []; + } else { + $requestOptions = $this->requestOptionsFactory->create($requestOptions, $defaultRequestOptions); + } + + return $this->request( + $method, + $path, + $requestOptions, + $this->clusterHosts->write(), + $requestOptions->getWriteTimeout(), + $data + ); + } + + public function send($method, $path, $requestOptions = [], $hosts = null) + { + $requestOptions = $this->requestOptionsFactory->create($requestOptions); + + if (null === $hosts) { + $hosts = $this->clusterHosts->write(); + } elseif (!is_array($hosts)) { + $hosts = [$hosts]; + } + + return $this->request( + $method, + $path, + $requestOptions, + $hosts, + $requestOptions->getWriteTimeout() + ); + } + + private function request($method, $path, RequestOptions $requestOptions, $hosts, $timeout, $data = []) + { + $uri = $this->createUri($path) + ->withQuery($requestOptions->getBuiltQueryParameters()) + ->withScheme('https'); + + $body = array_merge($data, $requestOptions->getBody()); + + $logParams = [ + 'body' => $body, + 'headers' => $requestOptions->getHeaders(), + 'method' => $method, + 'query' => $requestOptions->getQueryParameters(), + ]; + + $retry = 1; + foreach ($hosts as $host) { + $uri = $uri->withHost($host); + $request = null; + $logParams['retryNumber'] = $retry; + $logParams['host'] = (string) $uri; + + try { + $request = $this->createRequest( + $method, + $uri, + $requestOptions->getHeaders(), + $body + ); + + $this->log(LogLevel::DEBUG, 'Sending request.', $logParams); + + $response = $this->http->sendRequest( + $request, + $timeout * $retry, + $requestOptions->getConnectTimeout() * $retry + ); + + $responseBody = $this->handleResponse($response, $request); + + $logParams['response'] = $responseBody; + $this->log(LogLevel::DEBUG, 'Response received.', $logParams); + + return $responseBody; + } catch (RetriableException $e) { + $this->log(LogLevel::DEBUG, 'Host failed.', array_merge($logParams, [ + 'description' => $e->getMessage(), + ])); + + $this->clusterHosts->failed($host); + } catch (BadRequestException $e) { + unset($logParams['body'], $logParams['headers']); + $logParams['description'] = $e->getMessage(); + $this->log(LogLevel::WARNING, 'Bad request.', $logParams); + + throw $e; + } catch (\Exception $e) { + unset($logParams['body'], $logParams['headers']); + $logParams['description'] = $e->getMessage(); + $this->log(LogLevel::ERROR, 'Generic error.', $logParams); + + throw $e; + } + + $retry++; + } + + throw new UnreachableException(); + } + + private function handleResponse(ResponseInterface $response, RequestInterface $request) + { + $body = (string) $response->getBody(); + $statusCode = $response->getStatusCode(); + + if (0 === $statusCode || ($statusCode >= 100 && $statusCode < 200) || $statusCode >= 500) { + $reason = $response->getReasonPhrase(); + + if (null === $response->getReasonPhrase() || '' === $response->getReasonPhrase()) { + $reason = $statusCode >= 500 ? 'Internal Server Error' : 'Unreachable Host'; + } + + throw new RetriableException('Retriable failure on '.$request->getUri()->getHost().': '.$reason, $statusCode); + } + + $responseArray = Helpers::json_decode($body, true); + + if (404 === $statusCode) { + throw new NotFoundException($responseArray['message'], $statusCode); + } elseif ($statusCode >= 400) { + throw new BadRequestException($responseArray['message'], $statusCode); + } elseif (2 !== (int) ($statusCode / 100)) { + throw new AlgoliaException($statusCode.': '.$body, $statusCode); + } + + return $responseArray; + } + + private function createUri($uri) + { + if ($uri instanceof UriInterface) { + return $uri; + } elseif (is_string($uri)) { + return new Uri($uri); + } + + throw new \InvalidArgumentException('URI must be a string or UriInterface'); + } + + private function createRequest( + $method, + $uri, + array $headers = [], + $body = null, + $protocolVersion = '1.1' + ) { + if (is_array($body)) { + // Send an empty body instead of "[]" in case there are + // no content/params to send + if (empty($body)) { + $body = ''; + } else { + $body = \json_encode($body, $this->jsonOptions); + if (JSON_ERROR_NONE !== json_last_error()) { + throw new \InvalidArgumentException('json_encode error: '.json_last_error_msg()); + } + } + } + + return new Request($method, $uri, $headers, $body, $protocolVersion); + } + + /** + * @param string $level + * @param string $message + */ + private function log($level, $message, array $context = []) + { + $this->logger->log($level, 'Algolia API client: '.$message, $context); + } +} diff --git a/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapperInterface.php b/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapperInterface.php new file mode 100644 index 0000000000..9d2ba6f822 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/RetryStrategy/ApiWrapperInterface.php @@ -0,0 +1,12 @@ +read = $read; + $this->write = $write; + } + + public static function create($read, $write = null) + { + if (null === $write) { + $write = $read; + } + + if (is_string($read)) { + $read = [$read => 0]; + } + + if (is_string($write)) { + $write = [$write => 0]; + } + + if (array_values($read) === $read) { + $read = array_fill_keys($read, 0); + } + + if (array_values($write) === $write) { + $write = array_fill_keys($write, 0); + } + + return new static(HostCollection::create($read), HostCollection::create($write)); + } + + public static function createFromAppId($applicationId) + { + $read = $write = [ + $applicationId.'-1.algolianet.com' => 0, + $applicationId.'-2.algolianet.com' => 0, + $applicationId.'-3.algolianet.com' => 0, + ]; + + $read[$applicationId.'-dsn.algolia.net'] = 10; + $write[$applicationId.'.algolia.net'] = 10; + + return static::create($read, $write); + } + + public static function createForAnalytics($region) + { + return static::create('analytics.'.$region.'.algolia.com'); + } + + public static function createForInsights($region) + { + return static::create('insights.'.$region.'.algolia.io'); + } + + 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()) { + return false; + } + + if (!Algolia::getCache()->has($cacheKey)) { + return false; + } + + return @unserialize(Algolia::getCache()->get($cacheKey)); + } + + public function read() + { + return $this->getUrls('read'); + } + + public function write() + { + return $this->getUrls('write'); + } + + public function failed($host) + { + $this->read->markAsDown($host); + $this->write->markAsDown($host); + + $this->updateCache(); + + return $this; + } + + public function reset() + { + $this->read->reset(); + $this->write->reset(); + + return $this; + } + + public function shuffle() + { + $this->read->shuffle(); + $this->write->shuffle(); + + return $this; + } + + /** + * Sets the cache key to save the state of the ClusterHosts. + * + * @param string $cacheKey + * + * @return $this + */ + public function setCacheKey($cacheKey) + { + $this->cacheKey = $cacheKey; + + return $this; + } + + private function getUrls($type) + { + $urls = $this->{$type}->getUrls(); + $lashHashName = 'last'.ucfirst($type).'Hash'; + + if (Algolia::isCacheEnabled()) { + $hash = sha1(implode('-', $urls)); + if ($hash !== $this->{$lashHashName}) { + $this->updateCache(); + } + $this->{$lashHashName} = $hash; + } + + return $urls; + } + + private function updateCache() + { + if (null !== $this->cacheKey && Algolia::isCacheEnabled()) { + Algolia::getCache()->set($this->cacheKey, serialize($this)); + } + } +} diff --git a/clients/algoliasearch-client-php/lib/RetryStrategy/Host.php b/clients/algoliasearch-client-php/lib/RetryStrategy/Host.php new file mode 100644 index 0000000000..d7685487ce --- /dev/null +++ b/clients/algoliasearch-client-php/lib/RetryStrategy/Host.php @@ -0,0 +1,65 @@ +url = $url; + $this->priority = $priority; + } + + public function getUrl() + { + return $this->url; + } + + public function getPriority() + { + return $this->priority; + } + + public function isUp() + { + if (!$this->up) { + $this->resetIfExpired(); + } + + return $this->up; + } + + public function markAsDown() + { + $this->up = false; + $this->lastCheck = time(); + } + + public function reset() + { + $this->up = true; + $this->lastCheck = null; + } + + private function resetIfExpired() + { + $expired = $this->lastCheck + self::TTL < time(); + + if ($expired) { + $this->reset(); + } + } +} diff --git a/clients/algoliasearch-client-php/lib/RetryStrategy/HostCollection.php b/clients/algoliasearch-client-php/lib/RetryStrategy/HostCollection.php new file mode 100644 index 0000000000..1f2c76d220 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/RetryStrategy/HostCollection.php @@ -0,0 +1,85 @@ +hosts = $hosts; + + $this->shuffle(); + } + + public static function create(array $urlsWithPriority) + { + $hosts = []; + foreach ($urlsWithPriority as $url => $priority) { + $hosts[] = new Host($url, $priority); + } + + return new static($hosts); + } + + public function get() + { + // We pass the result through array_values because sometimes + // we need to make sure you can access the first element + // via $result[0] + return array_values(array_filter($this->hosts, function (Host $host) { + return $host->isUp(); + })); + } + + public function getUrls() + { + return array_map(function (Host $host) { + return $host->getUrl(); + }, $this->get()); + } + + public function markAsDown($hostKey) + { + array_map(function (Host $host) use ($hostKey) { + if ($host->getUrl() === $hostKey) { + $host->markAsDown(); + } + }, $this->hosts); + } + + public function shuffle() + { + if (shuffle($this->hosts)) { + $this->sort(); + } + + return $this; + } + + public function reset() + { + foreach ($this->hosts as $host) { + $host->reset(); + } + + return $this; + } + + private function sort() + { + usort($this->hosts, function (Host $a, Host $b) { + $prioA = $a->getPriority(); + $prioB = $b->getPriority(); + if ($prioA === $prioB) { + return 0; + } + + return ($prioA > $prioB) ? -1 : 1; + }); + } +} diff --git a/clients/algoliasearch-client-php/lib/Support/Helpers.php b/clients/algoliasearch-client-php/lib/Support/Helpers.php new file mode 100644 index 0000000000..33716920e4 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Support/Helpers.php @@ -0,0 +1,62 @@ + ['one', 'two']] is + * turned into key[1]=one&key[2]=two. Algolia will not understand key[x]. + * It should be turned into key=['one','two'] (before being url_encoded). + * + * @return string The urlencoded query string to send to Algolia + */ + public static function buildQuery(array $args) + { + if (!$args) { + return ''; + } + + $args = array_map(function ($value) { + if (is_array($value)) { + return json_encode($value); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } + + return $value; + }, $args); + + return http_build_query($args); + } + + /** + * Wrapper for json_decode that throws when an error occurs. + * + * This function is extracted from Guzzlehttp/Guzzle package which is not + * compatible with PHP 5.3 so the client cannot always use it. + * + * @param string $json JSON data to parse + * @param bool $assoc when true, returned objects will be converted + * into associative arrays + * @param int $depth user specified recursion depth + * + * @throws \InvalidArgumentException if the JSON cannot be decoded + * + * @return mixed + * + * @see http://www.php.net/manual/en/function.json-decode.php + */ + public static function json_decode($json, $assoc = false, $depth = 512) + { + $data = \json_decode($json, $assoc, $depth); + if (JSON_ERROR_NONE !== json_last_error()) { + throw new \InvalidArgumentException('json_decode error: '.json_last_error_msg()); + } + + return $data; + } +} diff --git a/clients/algoliasearch-client-php/lib/Support/UserAgent.php b/clients/algoliasearch-client-php/lib/Support/UserAgent.php new file mode 100644 index 0000000000..6be12e5f53 --- /dev/null +++ b/clients/algoliasearch-client-php/lib/Support/UserAgent.php @@ -0,0 +1,59 @@ + $version) { + $ua[] = $segment.' ('.$version.')'; + } + + return implode('; ', $ua); + } + + private static function getDefaultSegments() + { + $segments = []; + + $segments['Algolia for PHP'] = Algolia::VERSION; + $segments['PHP'] = rtrim(str_replace(PHP_EXTRA_VERSION, '', PHP_VERSION), '-'); + if (defined('HHVM_VERSION')) { + $segments['HHVM'] = HHVM_VERSION; + } + if (interface_exists('\GuzzleHttp\ClientInterface')) { + if (defined('\GuzzleHttp\ClientInterface::VERSION')) { + $segments['Guzzle'] = \GuzzleHttp\ClientInterface::VERSION; + } else { + $segments['Guzzle'] = \GuzzleHttp\ClientInterface::MAJOR_VERSION; + } + } + + return $segments; + } +} diff --git a/openapitools.json b/openapitools.json index 1e8f24dfc8..71d0fddc28 100644 --- a/openapitools.json +++ b/openapitools.json @@ -197,6 +197,163 @@ "dateLibrary": "java8", "packageName": "algoliasearch-client-java-2" } + }, + "php-search": { + "generatorName": "php", + "templateDir": "#{cwd}/templates/php/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-php", + "glob": "specs/dist/search.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "modelPackage": "Model\\Search", + "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/dist/recommend.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "modelPackage": "Model\\Recommend", + "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/dist/personalization.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "modelPackage": "Model\\Personalization", + "additionalProperties": { + "configClassname": "PersonalizationConfig", + "clusterHostsMethod": "createForRecommendation", + "hasRegionalHost": true, + "allowedRegions": "us-eu", + "variableNamingConvention": "camelCase", + "packageName": "algoliasearch-client-php", + "isEuHost": true, + "host": "personalization", + "topLevelDomain": "com" + } + }, + "php-analytics": { + "generatorName": "php", + "templateDir": "#{cwd}/templates/php/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-php", + "glob": "specs/dist/analytics.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "modelPackage": "Model\\Analytics", + "additionalProperties": { + "configClassname": "AnalyticsConfig", + "clusterHostsMethod": "createForAnalytics", + "hasRegionalHost": true, + "allowedRegions": "us-de", + "variableNamingConvention": "camelCase", + "packageName": "algoliasearch-client-php", + "fallbackToAliasHost": true, + "isDeHost": true, + "host": "analytics", + "topLevelDomain": "com" + } + }, + "php-insights": { + "generatorName": "php", + "templateDir": "#{cwd}/templates/php/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-php", + "glob": "specs/dist/insights.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "modelPackage": "Model\\Insights", + "additionalProperties": { + "configClassname": "InsightsConfig", + "clusterHostsMethod": "createForInsights", + "hasRegionalHost": true, + "allowedRegions": "us-de", + "variableNamingConvention": "camelCase", + "packageName": "algoliasearch-client-php", + "fallbackToAliasHost": true, + "isDeHost": true, + "host": "insights", + "topLevelDomain": "io" + } + }, + "php-abtesting": { + "generatorName": "php", + "templateDir": "#{cwd}/templates/php/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-php", + "glob": "specs/dist/abtesting.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "modelPackage": "Model\\ABTesting", + "additionalProperties": { + "configClassname": "AbTestingConfig", + "clusterHostsMethod": "createForAnalytics", + "hasRegionalHost": true, + "allowedRegions": "us-de", + "variableNamingConvention": "camelCase", + "packageName": "algoliasearch-client-php", + "fallbackToAliasHost": true, + "isDeHost": true, + "host": "analytics", + "topLevelDomain": "com" + } + }, + "php-query-suggestions": { + "generatorName": "php", + "templateDir": "#{cwd}/templates/php/", + "config": "#{cwd}/openapitools.json", + "output": "#{cwd}/clients/algoliasearch-client-php", + "glob": "specs/dist/query-suggestions.yml", + "gitHost": "algolia", + "gitUserId": "algolia", + "gitRepoId": "algoliasearch-client-php", + "invokerPackage": "Algolia\\AlgoliaSearch", + "modelPackage": "Model\\QuerySuggestions", + "additionalProperties": { + "configClassname": "QuerySuggestionsConfig", + "clusterHostsMethod": "createForQuerySuggestions", + "hasRegionalHost": true, + "allowedRegions": "us-eu", + "variableNamingConvention": "camelCase", + "packageName": "algoliasearch-client-php", + "isEuHost": true, + "host": "query-suggestions", + "topLevelDomain": "com" + } } } } diff --git a/playground/php/src/abtesting.php b/playground/php/src/abtesting.php new file mode 100644 index 0000000000..0ed14a1665 --- /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..9d09bd8f84 --- /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..131cbbdd3a --- /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..bc2ae4fab1 --- /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..5a3739cbee --- /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..f826375c6b --- /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/playground/php/src/search.php b/playground/php/src/search.php new file mode 100644 index 0000000000..16319182a3 --- /dev/null +++ b/playground/php/src/search.php @@ -0,0 +1,10 @@ +search($indexName, ['query' => getenv('SEARCH_QUERY')])); diff --git a/scripts/builds/clients.sh b/scripts/builds/clients.sh index e1cfb8a60e..91a2908b85 100755 --- a/scripts/builds/clients.sh +++ b/scripts/builds/clients.sh @@ -22,6 +22,9 @@ echo "> Building $GENERATOR..." if [[ $LANGUAGE == 'javascript' ]]; then CMD="yarn workspace $PACKAGE build" +elif [[ $LANGUAGE == 'php' ]]; then + # no build needed (for now) + : elif [[ $LANGUAGE == 'java' ]]; then CMD="mvn install -f clients/$PACKAGE/pom.xml" fi diff --git a/scripts/formatter.sh b/scripts/formatter.sh index 3ffb323d43..402383a40a 100755 --- a/scripts/formatter.sh +++ b/scripts/formatter.sh @@ -10,10 +10,22 @@ cd ${DIR}/.. LANGUAGE=$1 FOLDER=$2 +if [[ ! -d "$FOLDER" ]]; then + echo "Output folder does not exist for $LANGUAGE, skipping..." + exit 0 +fi + if [[ $LANGUAGE == 'javascript' ]]; then # jsdoc/require-hyphen-before-param-description fails to lint more than # 6 parameters, we re-run the script if failed to lint the rest CMD="yarn eslint --ext=ts ${FOLDER} --fix || yarn eslint --ext=ts ${FOLDER} --fix" +elif [[ $LANGUAGE == 'php' ]]; then + if [[ $CI ]]; then + PHP="php" + else + PHP="php8" + fi + CMD="cd $FOLDER && composer update && composer dump-autoload && PHP_CS_FIXER_IGNORE_ENV=1 $PHP vendor/bin/php-cs-fixer fix lib/ --using-cache=no --allow-risky=yes" elif [[ $LANGUAGE == 'java' ]]; then CMD="find $FOLDER -type f -name \"*.java\" | xargs java --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ diff --git a/scripts/playground.sh b/scripts/playground.sh index de418f379c..4912d83c87 100755 --- a/scripts/playground.sh +++ b/scripts/playground.sh @@ -16,6 +16,12 @@ run_playground() { yarn workspace javascript-playground start:$CLIENT elif [[ $LANGUAGE == 'java' ]]; then mvn clean compile exec:java -f playground/java/pom.xml + elif [[ $lang == 'php' ]]; then + cd playground/php + composer update + composer dump-autoload + cd src + php8 $client.php fi } diff --git a/scripts/post-gen/php.sh b/scripts/post-gen/php.sh new file mode 100755 index 0000000000..df070ad7e1 --- /dev/null +++ b/scripts/post-gen/php.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +FOLDER=$1 + +#Move Configuration file +mv ./$FOLDER/lib/Configuration.php ./$FOLDER/lib/Configuration/ + diff --git a/templates/php/.php-cs-fixer.php b/templates/php/.php-cs-fixer.php new file mode 100644 index 0000000000..90c95dcf68 --- /dev/null +++ b/templates/php/.php-cs-fixer.php @@ -0,0 +1,63 @@ +setUsingCache(true) + ->setRules([ + 'array_syntax' => [ 'syntax' => 'short' ], + 'blank_line_after_namespace' => false, + 'blank_line_after_opening_tag' => true, + 'blank_line_before_statement' => true, + 'braces' => false, + 'cast_spaces' => true, + 'combine_consecutive_unsets' => true, + 'echo_tag_syntax' => true, + 'general_phpdoc_tag_rename' => true, + 'mb_str_functions' => true, + 'no_blank_lines_after_class_opening' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_multiline_whitespace_around_double_arrow' => true, + 'no_short_bool_cast' => true, + 'no_trailing_whitespace' => true, + 'no_trailing_whitespace_in_comment' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unreachable_default_argument_value' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_return' => true, + 'no_whitespace_before_comma_in_array' => true, + 'no_whitespace_in_blank_line' => true, + 'normalize_index_brace' => true, + 'not_operator_with_space' => false, + 'object_operator_without_whitespace' => true, + 'ordered_imports' => true, + 'phpdoc_annotation_without_dot' => true, + 'phpdoc_inline_tag_normalizer' => true, + 'phpdoc_order' => true, + 'phpdoc_scalar' => true, + 'phpdoc_separation' => true, + 'phpdoc_single_line_var_spacing' => true, + 'phpdoc_tag_type' => true, + 'protected_to_private' => true, + '@PSR2' => true, + 'short_scalar_cast' => true, + 'single_blank_line_at_eof' => false, + 'single_blank_line_before_namespace' => true, + 'single_quote' => true, + 'space_after_semicolon' => true, + 'standardize_not_equals' => true, + 'strict_comparison' => true, + 'strict_param' => true, + 'ternary_operator_spaces' => true, + 'trailing_comma_in_multiline' => true, + 'trim_array_spaces' => true, + ]) + ->setFinder( + PhpCsFixer\Finder::create() + ->exclude('test') + ->exclude('tests') + ->in(__DIR__) + ); diff --git a/templates/php/ApiException.mustache b/templates/php/ApiException.mustache new file mode 100644 index 0000000000..dbcb1c3fde --- /dev/null +++ b/templates/php/ApiException.mustache @@ -0,0 +1,93 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/templates/php/Configuration.mustache b/templates/php/Configuration.mustache new file mode 100644 index 0000000000..2fa87b1468 --- /dev/null +++ b/templates/php/Configuration.mustache @@ -0,0 +1,271 @@ +setAlgoliaApiKey($config['apiKey']); + $this->setApiKey('X-Algolia-API-Key', $config['apiKey']); + } + + if(isset($config['appId'])) { + $this->setAppId($config['appId']); + $this->setApiKey('X-Algolia-Application-Id', $config['appId']); + } + + $config += $this->getDefaultConfiguration(); + $this->config = $config; + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + 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/ModelInterface.mustache b/templates/php/ModelInterface.mustache new file mode 100644 index 0000000000..e69228a020 --- /dev/null +++ b/templates/php/ModelInterface.mustache @@ -0,0 +1,68 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, [{{&primitives}}], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if ($value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the query, by imploding comma-separated if it's an object. + * If it's a string, pass through unchanged. It will be url-encoded + * later. + * + * @param string[]|string|\DateTime $object an object to be serialized to a string + * + * @return string the serialized object + */ + public static function toQueryValue($object) + { + if (is_array($object)) { + return implode(',', $object); + } else { + return self::toString($object); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param string|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * @param string $discriminator discriminator if polymorphism is used + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } else if ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some API's return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some API's return a date-time with too high nanosecond + // precision for php's DateTime to handle. This conversion + // (string -> unix timestamp -> DateTime) is a workaround + // for the problem. + return (new \DateTime())->setTimestamp(strtotime($data)); + } + } else { + return null; + } + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, [{{&primitives}}], true)) { + settype($data, $class); + return $data; + } + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\{{invokerPackage}}\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter) || !isset($data->{$instance::attributeMap()[$property]})) { + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } +} diff --git a/templates/php/api.mustache b/templates/php/api.mustache new file mode 100644 index 0000000000..7784cc69df --- /dev/null +++ b/templates/php/api.mustache @@ -0,0 +1,353 @@ +config = $config; + + $this->api = $apiWrapper; + } + + {{#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 + * + * @param string $appId Application ID + * @param string $apiKey Algolia API Key + */ + public static function create($appId = null, $apiKey = null) + { + return static::createWithConfig({{configClassname}}::create($appId, $apiKey)); + } + {{/hasRegionalHost}} + + /** + * Instantiate the client with congiguration + * + * @param {{configClassname}} $config Configuration + */ + public static function createWithConfig({{configClassname}} $config) + { + $config = clone $config; + + {{#useCache}} + $cacheKey = sprintf('%s-clusterHosts-%s', __CLASS__, $config->getAppId()); + + if ($hosts = $config->getHosts()) { + // If a list of hosts was passed, we ignore the cache + $clusterHosts = ClusterHosts::create($hosts); + } 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::{{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(), + $config, + $clusterHosts + ); + + return new static($apiWrapper, $config); + } + + /** + * @return {{configClassname}} + */ + public function getClientConfig() + { + return $this->config; + } + +{{#operation}} + /** + * Operation {{{operationId}}} +{{#summary}} + * + * {{.}} +{{/summary}} + * +{{#description}} + * {{.}} + * +{{/description}} +{{#vendorExtensions.x-group-parameters}} + * Note: the input parameter is an associative array with the keys listed as the parameter name below + * +{{/vendorExtensions.x-group-parameters}} +{{#servers}} +{{#-first}} + * This operation contains host(s) defined in the OpenAP spec. Use 'hostIndex' to select the host. +{{/-first}} + * URL: {{{url}}} +{{#-last}} + * +{{/-last}} +{{/servers}} +{{#allParams}} + * @param {{{dataType}}} ${{paramName}}{{#description}} {{.}}{{/description}}{{^description}} {{paramName}}{{/description}} {{#required}}(required){{/required}}{{^required}}(optional{{#defaultValue}}, default to {{{.}}}{{/defaultValue}}){{/required}}{{#isDeprecated}} (deprecated){{/isDeprecated}} +{{/allParams}} + * + * @throws \{{invokerPackage}}\ApiException on non-2xx response + * @throws \InvalidArgumentException + * @return {{#returnType}}{{#responses}}{{#dataType}}{{^-first}}|{{/-first}}{{/dataType}}{{{dataType}}}{{/responses}}{{/returnType}}{{^returnType}}void{{/returnType}} + {{#isDeprecated}} + * @deprecated + {{/isDeprecated}} + */ + public function {{operationId}}({{^vendorExtensions.x-group-parameters}}{{#allParams}}${{paramName}}{{^required}} = {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}{{/required}}{{^-last}}, {{/-last}}{{/allParams}}{{/vendorExtensions.x-group-parameters}}{{#vendorExtensions.x-group-parameters}}$associative_array{{/vendorExtensions.x-group-parameters}}) + { + {{#vendorExtensions.x-group-parameters}} + // unbox the parameters from the associative array + {{#allParams}} + ${{paramName}} = array_key_exists('{{paramName}}', $associative_array) ? $associative_array['{{paramName}}'] : {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}; + {{/allParams}} + + {{/vendorExtensions.x-group-parameters}} + {{#allParams}} + {{#required}} + // verify the required parameter '{{paramName}}' is set + if (${{paramName}} === null || (is_array(${{paramName}}) && count(${{paramName}}) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter ${{paramName}} when calling {{operationId}}' + ); + } + {{/required}} + {{#hasValidation}} + {{#maxLength}} + if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) > {{maxLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + } + {{/maxLength}} + {{#minLength}} + if ({{^required}}${{paramName}} !== null && {{/required}}strlen(${{paramName}}) < {{minLength}}) { + throw new \InvalidArgumentException('invalid length for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if ({{^required}}${{paramName}} !== null && {{/required}}${{paramName}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if ({{^required}}${{paramName}} !== null && {{/required}}!preg_match("{{{pattern}}}", ${{paramName}})) { + throw new \InvalidArgumentException("invalid value for \"{{paramName}}\" when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."); + } + {{/pattern}} + {{#maxItems}} + if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) > {{maxItems}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.'); + } + {{/maxItems}} + {{#minItems}} + if ({{^required}}${{paramName}} !== null && {{/required}}count(${{paramName}}) < {{minItems}}) { + throw new \InvalidArgumentException('invalid value for "${{paramName}}" when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); + } + {{/minItems}} + + {{/hasValidation}} + {{/allParams}} + + $resourcePath = '{{{path}}}'; + $queryParams = []; + $headerParams = []; + $httpBody = []; + {{#queryParams}} + + {{#isExplode}} + if (${{paramName}} !== null) { + {{#style}} + if('form' === '{{style}}' && is_array(${{paramName}})) { + foreach(${{paramName}} as $key => $value) { + $queryParams[$key] = $value; + } + } + else { + $queryParams['{{baseName}}'] = ${{paramName}}; + } + {{/style}} + {{^style}} + $queryParams['{{baseName}}'] = ${{paramName}}; + {{/style}} + } + {{/isExplode}} + {{^isExplode}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{style}}{{^style}}{{collectionFormat}}{{/style}}', true); + } + if (${{paramName}} !== null) { + $queryParams['{{baseName}}'] = ${{paramName}}; + } + {{/isExplode}} + {{/queryParams}} + {{#headerParams}} + // header params + {{#collectionFormat}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); + } + {{/collectionFormat}} + if (${{paramName}} !== null) { + $headerParams['{{baseName}}'] = ObjectSerializer::toHeaderValue(${{paramName}}); + } + {{/headerParams}} + {{#pathParams}} + // path params + {{#collectionFormat}} + if (is_array(${{paramName}})) { + ${{paramName}} = ObjectSerializer::serializeCollection(${{paramName}}, '{{collectionFormat}}'); + } + {{/collectionFormat}} + if (${{paramName}} !== null) { + $resourcePath = str_replace( + '{' . '{{baseName}}' . '}', + ObjectSerializer::toPathValue(${{paramName}}), + $resourcePath + ); + } + {{/pathParams}} + + $headers = []; + $headers['Accept'] = 'application/json'; + $headers['Content-Type'] = 'application/json'; + {{#bodyParams}} + if (isset(${{paramName}})) { + $httpBody = ${{paramName}}; + } + {{/bodyParams}} + {{#authMethods}} + {{#isBasic}} + {{#isBasicBasic}} + // this endpoint requires HTTP basic authentication + if (!empty($this->config->getUsername()) || !(empty($this->config->getPassword()))) { + $headers['Authorization'] = 'Basic ' . base64_encode($this->config->getUsername() . ":" . $this->config->getPassword()); + } + {{/isBasicBasic}} + {{#isBasicBearer}} + // this endpoint requires Bearer{{#bearerFormat}} ({{{.}}}){{/bearerFormat}} authentication (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + {{/isBasicBearer}} + {{/isBasic}} + {{#isOAuth}} + // this endpoint requires OAuth (access token) + if ($this->config->getAccessToken() !== null) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + {{/isOAuth}} + {{/authMethods}} + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + {{#servers.0}} + $operationHosts = [{{#servers}}"{{{url}}}"{{^-last}}, {{/-last}}{{/servers}}]; + if ($this->hostIndex < 0 || $this->hostIndex >= sizeof($operationHosts)) { + throw new \InvalidArgumentException("Invalid index {$this->hostIndex} when selecting the host. Must be less than ".sizeof($operationHosts)); + } + $operationHost = $operationHosts[$this->hostIndex]; + + {{/servers.0}} + $query = \GuzzleHttp\Psr7\Query::build($queryParams); + + return $this->sendRequest('{{httpMethod}}', $resourcePath, $query, $httpBody); + } + {{/operation}} + + 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; + } +} +{{/operations}} diff --git a/templates/php/composer.mustache b/templates/php/composer.mustache new file mode 100644 index 0000000000..3cfdb1bfa6 --- /dev/null +++ b/templates/php/composer.mustache @@ -0,0 +1,49 @@ +{ + {{#composerPackageName}} + "name": "{{.}}", + {{/composerPackageName}} + {{#artifactVersion}} + "version": "{{.}}", + {{/artifactVersion}} + "description": "API powering the features of Algolia.", + "keywords": [ + "openapitools", + "openapi-generator", + "openapi", + "php", + "sdk", + "rest", + "api" + ], + "homepage": "https://openapi-generator.tech", + "license": "unlicense", + "authors": [ + { + "name": "OpenAPI-Generator contributors", + "homepage": "https://openapi-generator.tech" + } + ], + "require": { + "php": "^7.3 || ^8.0", + "ext-curl": "*", + "ext-json": "*", + "ext-mbstring": "*", + "guzzlehttp/guzzle": "^7.3", + "guzzlehttp/psr7": "^2.0", + "psr/http-message": "^1.0", + "psr/log": "^1.0 || ^2.0 || ^3.0", + "psr/simple-cache": "^1.0 || ^2.0 || ^3.0" + }, + "require-dev": { + "friendsofphp/php-cs-fixer": "^3.5.0" + }, + "autoload": { + "psr-4": { "{{escapedInvokerPackage}}\\" : "{{srcBasePath}}/" }, + "files": [ + "{{srcBasePath}}/Http/Psr7/functions.php" + ] + }, + "autoload-dev": { + "psr-4": { "{{escapedInvokerPackage}}\\Test\\" : "{{testBasePath}}/" } + } +} diff --git a/templates/php/gitignore b/templates/php/gitignore new file mode 100644 index 0000000000..aa44c17b5e --- /dev/null +++ b/templates/php/gitignore @@ -0,0 +1,13 @@ +# ref: https://github.com/github/gitignore/blob/master/Composer.gitignore + +composer.phar +/vendor/ + +# php-cs-fixer cache +.php_cs.cache + +# PHPUnit cache +.phpunit.result.cache + +.openapi-generator/ +composer.lock diff --git a/templates/php/model.mustache b/templates/php/model.mustache new file mode 100644 index 0000000000..a6afd1683d --- /dev/null +++ b/templates/php/model.mustache @@ -0,0 +1,29 @@ + + * @template TKey int|null + * @template TValue mixed|null +{{/isEnum}} + */ +{{#isEnum}}{{>model_enum}}{{/isEnum}}{{^isEnum}}{{>model_generic}}{{/isEnum}} +{{/model}}{{/models}} diff --git a/templates/php/model_enum.mustache b/templates/php/model_enum.mustache new file mode 100644 index 0000000000..88036f76ff --- /dev/null +++ b/templates/php/model_enum.mustache @@ -0,0 +1,28 @@ +class {{classname}} +{ + /** + * Possible values of this enum + */ + {{#allowableValues}} + {{#enumVars}} + const {{^isString}}NUMBER_{{/isString}}{{{name}}} = {{{value}}}; + + {{/enumVars}} + {{/allowableValues}} + /** + * Gets allowable values of the enum + * @return string[] + */ + public static function getAllowableEnumValues() + { + return [ + {{#allowableValues}} + {{#enumVars}} + self::{{^isString}}NUMBER_{{/isString}}{{{name}}}{{^-last}}, + {{/-last}} + {{/enumVars}} + {{/allowableValues}} + + ]; + } +} diff --git a/templates/php/model_generic.mustache b/templates/php/model_generic.mustache new file mode 100644 index 0000000000..a56a82181e --- /dev/null +++ b/templates/php/model_generic.mustache @@ -0,0 +1,454 @@ +class {{classname}} {{#parentSchema}}extends {{{parent}}}{{/parentSchema}}{{^parentSchema}}implements ModelInterface, ArrayAccess, \JsonSerializable{{/parentSchema}} +{ + public const DISCRIMINATOR = {{#discriminator}}'{{discriminatorName}}'{{/discriminator}}{{^discriminator}}null{{/discriminator}}; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = '{{name}}'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + {{#vars}}'{{name}}' => '{{{dataType}}}'{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + {{#vars}}'{{name}}' => {{#dataFormat}}'{{{.}}}'{{/dataFormat}}{{^dataFormat}}null{{/dataFormat}}{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes{{#parentSchema}} + parent::openAPITypes(){{/parentSchema}}; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats{{#parentSchema}} + parent::openAPIFormats(){{/parentSchema}}; + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + {{#vars}}'{{name}}' => '{{baseName}}'{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + {{#vars}}'{{name}}' => '{{setter}}'{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + {{#vars}}'{{name}}' => '{{getter}}'{{^-last}}, + {{/-last}}{{/vars}} + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return {{#parentSchema}}parent::attributeMap() + {{/parentSchema}}self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return {{#parentSchema}}parent::setters() + {{/parentSchema}}self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return {{#parentSchema}}parent::getters() + {{/parentSchema}}self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + {{#vars}} + {{#isEnum}} + {{#allowableValues}} + {{#enumVars}} + const {{enumName}}_{{{name}}} = {{{value}}}; + {{/enumVars}} + {{/allowableValues}} + {{/isEnum}} + {{/vars}} + + {{#vars}} + {{#isEnum}} + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function {{getter}}AllowableValues() + { + return [ + {{#allowableValues}}{{#enumVars}}self::{{enumName}}_{{{name}}},{{^-last}} + {{/-last}}{{/enumVars}}{{/allowableValues}} + ]; + } + + {{/isEnum}} + {{/vars}} + {{^parentSchema}} + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + {{/parentSchema}} + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + {{#parentSchema}} + parent::__construct($data); + + {{/parentSchema}} + {{#vars}} + $this->container['{{name}}'] = $data['{{name}}'] ?? {{{defaultValue}}}{{^defaultValue}}null{{/defaultValue}}; + {{/vars}} + {{#discriminator}} + + // Initialize discriminator property with the model name. + $this->container['{{discriminatorName}}'] = static::$openAPIModelName; + {{/discriminator}} + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + {{#parentSchema}} + $invalidProperties = parent::listInvalidProperties(); + {{/parentSchema}} + {{^parentSchema}} + $invalidProperties = []; + {{/parentSchema}} + + {{#vars}} + {{#required}} + if ($this->container['{{name}}'] === null) { + $invalidProperties[] = "'{{name}}' can't be null"; + } + {{/required}} + {{#isEnum}} + {{^isContainer}} + $allowedValues = $this->{{getter}}AllowableValues(); + if (!is_null($this->container['{{name}}']) && !in_array($this->container['{{name}}'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for '{{name}}', must be one of '%s'", + $this->container['{{name}}'], + implode("', '", $allowedValues) + ); + } + + {{/isContainer}} + {{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(mb_strlen($this->container['{{name}}']) > {{maxLength}})) { + $invalidProperties[] = "invalid value for '{{name}}', the character length must be smaller than or equal to {{{maxLength}}}."; + } + + {{/maxLength}} + {{#minLength}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(mb_strlen($this->container['{{name}}']) < {{minLength}})) { + $invalidProperties[] = "invalid value for '{{name}}', the character length must be bigger than or equal to {{{minLength}}}."; + } + + {{/minLength}} + {{#maximum}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}($this->container['{{name}}'] >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}})) { + $invalidProperties[] = "invalid value for '{{name}}', must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}."; + } + + {{/maximum}} + {{#minimum}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}($this->container['{{name}}'] <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}})) { + $invalidProperties[] = "invalid value for '{{name}}', must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}."; + } + + {{/minimum}} + {{#pattern}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}!preg_match("{{{pattern}}}", $this->container['{{name}}'])) { + $invalidProperties[] = "invalid value for '{{name}}', must be conform to the pattern {{{pattern}}}."; + } + + {{/pattern}} + {{#maxItems}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(count($this->container['{{name}}']) > {{maxItems}})) { + $invalidProperties[] = "invalid value for '{{name}}', number of items must be less than or equal to {{{maxItems}}}."; + } + + {{/maxItems}} + {{#minItems}} + if ({{^required}}!is_null($this->container['{{name}}']) && {{/required}}(count($this->container['{{name}}']) < {{minItems}})) { + $invalidProperties[] = "invalid value for '{{name}}', number of items must be greater than or equal to {{{minItems}}}."; + } + + {{/minItems}} + {{/hasValidation}} + {{/vars}} + 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; + } + + {{#vars}} + + /** + * Gets {{name}} + * + * @return {{{dataType}}}{{^required}}|null{{/required}} + {{#deprecated}} + * @deprecated + {{/deprecated}} + */ + public function {{getter}}() + { + return $this->container['{{name}}']; + } + + /** + * Sets {{name}} + * + * @param {{{dataType}}}{{^required}}|null{{/required}} ${{name}}{{#description}} {{{.}}}{{/description}}{{^description}} {{{name}}}{{/description}} + * + * @return self + {{#deprecated}} + * @deprecated + {{/deprecated}} + */ + public function {{setter}}(${{name}}) + { + {{#isEnum}} + $allowedValues = $this->{{getter}}AllowableValues(); + {{^isContainer}} + if ({{^required}}!is_null(${{name}}) && {{/required}}!in_array(${{{name}}}, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for '{{name}}', must be one of '%s'", + ${{{name}}}, + implode("', '", $allowedValues) + ) + ); + } + {{/isContainer}} + {{#isContainer}} + if ({{^required}}!is_null(${{name}}) && {{/required}}array_diff(${{{name}}}, $allowedValues)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value for '{{name}}', must be one of '%s'", + implode("', '", $allowedValues) + ) + ); + } + {{/isContainer}} + {{/isEnum}} + {{#hasValidation}} + {{#maxLength}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(mb_strlen(${{name}}) > {{maxLength}})) { + throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than or equal to {{maxLength}}.'); + }{{/maxLength}} + {{#minLength}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(mb_strlen(${{name}}) < {{minLength}})) { + throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than or equal to {{minLength}}.'); + } + {{/minLength}} + {{#maximum}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(${{name}} >{{#exclusiveMaximum}}={{/exclusiveMaximum}} {{maximum}})) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be smaller than {{^exclusiveMaximum}}or equal to {{/exclusiveMaximum}}{{maximum}}.'); + } + {{/maximum}} + {{#minimum}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(${{name}} <{{#exclusiveMinimum}}={{/exclusiveMinimum}} {{minimum}})) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must be bigger than {{^exclusiveMinimum}}or equal to {{/exclusiveMinimum}}{{minimum}}.'); + } + {{/minimum}} + {{#pattern}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(!preg_match("{{{pattern}}}", ${{name}}))) { + throw new \InvalidArgumentException("invalid value for ${{name}} when calling {{classname}}.{{operationId}}, must conform to the pattern {{{pattern}}}."); + } + {{/pattern}} + {{#maxItems}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(count(${{name}}) > {{maxItems}})) { + throw new \InvalidArgumentException('invalid value for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be less than or equal to {{maxItems}}.'); + }{{/maxItems}} + {{#minItems}} + if ({{^required}}!is_null(${{name}}) && {{/required}}(count(${{name}}) < {{minItems}})) { + throw new \InvalidArgumentException('invalid length for ${{name}} when calling {{classname}}.{{operationId}}, number of items must be greater than or equal to {{minItems}}.'); + } + {{/minItems}} + {{/hasValidation}} + $this->container['{{name}}'] = ${{name}}; + + return $this; + } + {{/vars}} + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset) + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $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 integer $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)); + } +}